Hooked up ability to look up data symbols so they show up in disassembly
if the address comes from a data section.
Fixed an issue that could occur when looking up a symbol that has a zero
byte size where no match would be returned even if there was an exact symbol
match.
Cleaned up the section dump output and added the section type into the output.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116017 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 8326a44..6ae3e83 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -65,7 +65,7 @@
Symtab::Dump(Stream *s, Target *target) const
{
const_iterator pos;
- s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
+// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
const FileSpec &file_spec = m_objfile->GetFileSpec();
const char * object_name = NULL;
@@ -705,7 +705,24 @@
if (info.match_symbol)
{
- if (info.match_offset < CalculateSymbolSize(info.match_symbol))
+ if (info.match_offset == 0)
+ {
+ // We found an exact match!
+ return info.match_symbol;
+ }
+
+ const size_t symbol_byte_size = CalculateSymbolSize(info.match_symbol);
+
+ if (symbol_byte_size == 0)
+ {
+ // We weren't able to find the size of the symbol so lets just go
+ // with that match we found in our search...
+ return info.match_symbol;
+ }
+
+ // We were able to figure out a symbol size so lets make sure our
+ // offset puts "file_addr" in the symbol's address range.
+ if (info.match_offset < symbol_byte_size)
return info.match_symbol;
}
return NULL;