MCPcopy Create free account
hub / github.com/Marus/cortex-debug / loadSymbols

Method loadSymbols

src/gdb.ts:365–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

363
364 private dbgSymbolTable: SymbolTable = null;
365 private loadSymbols(): Promise<void> {
366 return new Promise<void>((resolve) => {
367 // this.dbgSymbolStuff(args, '/Users/hdm/Downloads/XXX-01.elf', 'main', null);
368 // this.dbgSymbolStuff(args, '/Users/hdm/Downloads/bme680-driver-design_585.out', 'setup_bme680', './src/bme680_test_app.c');
369 // this.dbgSymbolStuff(args, '/Users/hdm/Downloads/test.out', 'BSP_Delay', 'C:/Development/GitRepos/Firmware/phoenix/STM32F4/usb_bsp.c');
370 const execs: SymbolFile[] = this.args.symbolFiles || [defSymbolFile(this.args.executable)];
371 this.symbolTable = new SymbolTable(this, execs);
372 this.symbolTable.loadSymbols().then(() => {
373 if (this.args.rttConfig.enabled) {
374 const symName = this.symbolTable.rttSymbolName;
375 if (!this.args.rttConfig.address) {
376 this.handleMsg('stderr', 'INFO: "rttConfig.address" not specified. Defaulting to "auto"\n');
377 this.args.rttConfig.address = 'auto';
378 }
379 if (this.args.rttConfig.address === 'auto') {
380 const rttSym = this.symbolTable.getGlobalOrStaticVarByName(symName);
381 if (!rttSym) {
382 this.args.rttConfig.enabled = false;
383 this.handleMsg('stderr', `Could not find symbol '${symName}' in executable. ` +
384 'Make sure you compile/link with debug ON or you can specify your own RTT address\n');
385 } else {
386 const searchStr = this.args.rttConfig.searchId || 'SEGGER RTT';
387 this.args.rttConfig.address = hexFormat(rttSym.address);
388 this.args.rttConfig.searchSize = Math.max(this.args.rttConfig.searchSize || 0, searchStr.length);
389 this.args.rttConfig.searchId = searchStr;
390 this.args.rttConfig.clearSearch = (this.args.rttConfig.clearSearch === undefined) ? true : this.args.rttConfig.clearSearch;
391 }
392 }
393 }
394 resolve();
395 }, (e) => {
396 this.handleMsg('log', `WARNING: Loading symbols failed. Please report this issue. Debugging may still work ${e}\n`);
397 resolve();
398 });
399 });
400 }
401
402 private async dbgSymbolStuff(args: ConfigurationArguments, elfFile: string, func: string, file: string) {
403 if (os.userInfo().username === 'hdm') {

Callers 1

Calls 4

handleMsgMethod · 0.95
defSymbolFileFunction · 0.90
hexFormatFunction · 0.90

Tested by

no test coverage detected