[Lldb-commits] [PATCH] D14507: Make sure we use symbol flags to detect thumbness.
Stephane Sezer via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 9 12:18:04 PST 2015
sas created this revision.
sas added reviewers: tberghammer, clayborg.
sas added a subscriber: lldb-commits.
Herald added a subscriber: rengolin.
This was GetAddressClass' behavior before. This is required when
debugging binaries that don't have mapping symbols ($a, $t, etc). These
binaries will only have the lower bit of the address set in the symbol
table.
http://reviews.llvm.org/D14507
Files:
source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -972,9 +972,29 @@
auto ub = m_address_class_map.upper_bound(file_addr);
if (ub == m_address_class_map.begin())
{
- // No entry in the address class map before the address. Return
- // default address class for an address in a code section.
- return eAddressClassCode;
+ // No entry in the address class map before the address. Try finding
+ // the address class by using symbol flags, otherwise return default
+ // address class for an address in a code section.
+
+ ArchSpec arch_spec;
+ GetArchitecture(arch_spec);
+ if (arch_spec.GetMachine() != llvm::Triple::arm)
+ return res;
+
+ auto symtab = GetSymtab();
+ if (symtab == nullptr)
+ return res;
+
+ auto symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+ if (symbol == nullptr)
+ return res;
+
+ // Thumb symbols have the lower bit set in the flags field so we just check
+ // for that.
+ if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
+ res = eAddressClassCodeAlternateISA;
+
+ return res;
}
// Move iterator to the address class entry preceding address
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14507.39735.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151109/768e7c70/attachment.bin>
More information about the lldb-commits
mailing list