summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Address.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-05-19 18:17:41 +0000
committerGreg Clayton <gclayton@apple.com>2011-05-19 18:17:41 +0000
commit92bb12ca3e6dfbbebf906257f758d0b1a30ed425 (patch)
tree2b6f65bd2bf3fbc8af09f6c56987a8214d8cc3c0 /lldb/source/Core/Address.cpp
parent92ab6db6c8d2ebd4c71eb4d2b45d2233bfbef6ab (diff)
downloadbcm5719-llvm-92bb12ca3e6dfbbebf906257f758d0b1a30ed425.tar.gz
bcm5719-llvm-92bb12ca3e6dfbbebf906257f758d0b1a30ed425.zip
Moved a lot of simple functions from StoppointLocation.cpp to be inlined in
StoppointLocation.h. Added a new lldb_private::Address function: addr_t Address::GetOpcodeLoadAddress (Target *target) const; This will strip any special bits from an address to make sure it is suitable for use in addressing an opcode. Often ARM addresses have an extra bit zero that can be set to indicate ARM vs Thumb addresses (gotten from return address registers, or symbol addresses that may be marked up specially). We need to strip these bits off prior to setting breakpoints, so we can centralized the place to do this inside the Address class. llvm-svn: 131658
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