summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Address.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/Address.cpp')
-rw-r--r--lldb/source/Core/Address.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index de4e4d39164..7ab02a40f9a 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -301,6 +301,8 @@ Address::GetCallableLoadAddress (Target *target) const
{
addr_t code_addr = GetLoadAddress (target);
+ // Make sure we have section, otherwise the call to GetAddressClass() will
+ // fail because it uses the section to get to the module.
if (m_section && code_addr != LLDB_INVALID_ADDRESS)
{
switch (target->GetArchitecture().GetMachine())
@@ -332,6 +334,28 @@ Address::GetCallableLoadAddress (Target *target) const
return code_addr;
}
+addr_t
+Address::GetOpcodeLoadAddress (Target *target) const
+{
+ addr_t code_addr = GetLoadAddress (target);
+
+ if (code_addr != LLDB_INVALID_ADDRESS)
+ {
+ switch (target->GetArchitecture().GetMachine())
+ {
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+ // Strip bit zero to make sure we end up on an opcode boundary
+ return code_addr & ~(1ull);
+ break;
+
+ default:
+ break;
+ }
+ }
+ return code_addr;
+}
+
bool
Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style, uint32_t addr_size) const
{
OpenPOWER on IntegriCloud