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

Method readObjdumpSymbolLine

src/backend/symbols.ts:413–472  ·  view source on GitHub ↗
(symF: SymbolFile, line: string, err: any)

Source from the content-addressed store, hash-verified

411 }
412
413 private readObjdumpSymbolLine(symF: SymbolFile, line: string, err: any): boolean {
414 if (!line) {
415 return line === '' ? true : false;
416 }
417 const match = line.match(OBJDUMP_SYMBOL_RE);
418 if (match) {
419 if (match[7] === 'd' && match[8] === 'f') {
420 if (match[11]) {
421 this.currentObjDumpFile = SymbolTable.NormalizePath(match[11].trim());
422 } else {
423 // This can happen with C++. Inline and template methods/variables/functions/etc. are listed with
424 // an empty file association. So, symbols after this line can come from multiple compilation
425 // units with no clear owner. These can be locals, globals or other.
426 this.currentObjDumpFile = null;
427 }
428 // We don't really use the symbol except know that the symbol following this belong to this file
429 return true;
430 } else if ((match[7] === 'd') && (match[8] === ' ')) {
431 // This is a pure debug symbol. No use for them
432 return true;
433 }
434 const type = TYPE_MAP[match[8]];
435 const scope = SCOPE_MAP[match[2]];
436 let name = match[11].trim();
437 let hidden = false;
438
439 if (name.startsWith('.hidden')) {
440 name = name.substring(7).trim();
441 hidden = true;
442 }
443
444 const secName = match[9].trim();
445 const size = parseInt(match[10], 16);
446 if ((secName === '*ABS*') || (secName === '*UND*')) {
447 // These are not true symbols, AFAIK and can be safely ignored as there can be hundreds of these
448 // junk symbols. We already handled file names above
449 return true;
450 }
451
452 const offset = symF.offset || 0;
453 const addr = parseInt(match[1], 16);
454 const section = symF.sectionMap[secName];
455 const newaddr = addr + (section ? addr - section.addressOrig : offset);
456 const sym: SymbolInformation = {
457 addressOrig: addr,
458 address: newaddr,
459 name: name,
460 file: this.currentObjDumpFile,
461 type: type,
462 scope: scope,
463 section: secName,
464 length: size,
465 isStatic: (scope === SymbolScope.Local) && this.currentObjDumpFile ? true : false,
466 instructions: null,
467 hidden: hidden
468 };
469 this.addSymbol(sym);
470 }

Callers

nothing calls this directly

Calls 2

addSymbolMethod · 0.95
NormalizePathMethod · 0.80

Tested by

no test coverage detected