Changeset View
Standalone View
lldb/source/Commands/CommandObjectTarget.cpp
Show First 20 Lines • Show All 1,535 Lines • ▼ Show 20 Lines | if (num_matches > 0) { | ||||
strm.Indent(); | strm.Indent(); | ||||
strm.Printf("%u symbols match %s'%s' in ", num_matches, | strm.Printf("%u symbols match %s'%s' in ", num_matches, | ||||
name_is_regex ? "the regular expression " : "", name); | name_is_regex ? "the regular expression " : "", name); | ||||
DumpFullpath(strm, &module->GetFileSpec(), 0); | DumpFullpath(strm, &module->GetFileSpec(), 0); | ||||
strm.PutCString(":\n"); | strm.PutCString(":\n"); | ||||
strm.IndentMore(); | strm.IndentMore(); | ||||
for (uint32_t i = 0; i < num_matches; ++i) { | for (uint32_t i = 0; i < num_matches; ++i) { | ||||
Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]); | Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]); | ||||
if (symbol && symbol->ValueIsAddress()) { | if (symbol) { | ||||
if (symbol->ValueIsAddress()) { | |||||
DumpAddress( | DumpAddress( | ||||
interpreter.GetExecutionContext().GetBestExecutionContextScope(), | interpreter.GetExecutionContext().GetBestExecutionContextScope(), | ||||
symbol->GetAddressRef(), verbose, all_ranges, strm); | symbol->GetAddressRef(), verbose, all_ranges, strm); | ||||
} else { | |||||
strm.IndentMore(); | |||||
alvinhochun: This `IndentMore` added is missing a matching `IndentLess` call. | |||||
clayborgAuthorUnsubmitted Yes, a fix is needed. Feel free to post a patch, or I will try to get to this soon. clayborg: Yes, a fix is needed. Feel free to post a patch, or I will try to get to this soon. | |||||
strm.Indent(" Value: "); | |||||
strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetRawValue()); | |||||
if (symbol->GetByteSizeIsValid()) { | |||||
strm.Indent(" Size: "); | |||||
strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetByteSize()); | |||||
} | |||||
alvinhochunUnsubmitted Not Done ReplyInline ActionsMay I ask, is it expected for this to print only the value and size but not the name of the symbol? Also, in some COFF binaries linked by LLD there are a bunch of absolute symbols (e.g. __guard_flags) and when they hit this code path all they print is Value: 0xffffffffffffffff. llvm-readobj shows the symbol as: Symbol { Name: __guard_flags Value: 2147550464 Section: IMAGE_SYM_ABSOLUTE (-1) BaseType: Null (0x0) ComplexType: Null (0x0) StorageClass: External (0x2) AuxSymbolCount: 0 } Though neither values are correct. I expect the value to be 0x10500. I haven't looked into this yet. Any idea what might be going on? alvinhochun: May I ask, is it expected for this to print only the value and size but not the name of the… | |||||
clayborgAuthorUnsubmitted We should be printing the name. I guess in the "symbol->ValueIsAddress()" case it would print the name from the symbolication of the address. Should be an easy fix, feel free to submit a patch, or I can try to get to it when i have some time. I would look at the lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp and check the "ObjectFilePECOFF::ParseSymtab(Symtab &symtab)" method. It must not be creating the symbols correctly from the symbol table. Any fixes for the PECOFF object file plug-in would be appreciated if you find any issues or things we can do better. Back in the day I had a hard time getting any symbol table the show up in the PECOFF file, but that was a long time ago and I wasn't super familiar with Windows binaries. clayborg: We should be printing the name. I guess in the "symbol->ValueIsAddress()" case it would print… | |||||
alvinhochunUnsubmitted Not Done ReplyInline ActionsThanks for the reply. I can make a patch for this and the indentation issue. I did find out how to get lldb to load COFF absolute symbols, but I think there may be a separate issue with LLD actually writing the wrong value to the file in the first place. Anyway I will try to fix that separately. alvinhochun: Thanks for the reply. I can make a patch for this and the indentation issue.
I did find out… | |||||
} | |||||
} | } | ||||
} | } | ||||
strm.IndentLess(); | strm.IndentLess(); | ||||
} | } | ||||
return num_matches; | return num_matches; | ||||
} | } | ||||
static void DumpSymbolContextList(ExecutionContextScope *exe_scope, | static void DumpSymbolContextList(ExecutionContextScope *exe_scope, | ||||
▲ Show 20 Lines • Show All 3,586 Lines • Show Last 20 Lines |
This IndentMore added is missing a matching IndentLess call.