aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/ThreadPlanRunToAddress.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-05-22 22:46:53 +0000
committerGreg Clayton <gclayton@apple.com>2011-05-22 22:46:53 +0000
commitf3ef3d2af95e8cd20bb9bd9aeceb24b4bf8107ca (patch)
tree1614e0a38827a33bfae37302a3567c9cec8a391b /lldb/source/Target/ThreadPlanRunToAddress.cpp
parent5c51177981f6e482dbf2a99700fa8bc801f53401 (diff)
downloadllvm-f3ef3d2af95e8cd20bb9bd9aeceb24b4bf8107ca.zip
llvm-f3ef3d2af95e8cd20bb9bd9aeceb24b4bf8107ca.tar.gz
llvm-f3ef3d2af95e8cd20bb9bd9aeceb24b4bf8107ca.tar.bz2
Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB: lldb::addr_t Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error); bool Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error); size_t Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error); size_t Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error); in lldb_private::Process the following functions were renamed: From: uint64_t Process::ReadUnsignedInteger (lldb::addr_t load_addr, size_t byte_size, Error &error); To: uint64_t Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Error &error); Cleaned up a lot of code that was manually doing what the above functions do to use the functions listed above. Added the ability to get a scalar value as a buffer that can be written down to a process (byte swapping the Scalar value if needed): uint32_t Scalar::GetAsMemoryData (void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Error &error) const; The "dst_len" can be smaller that the size of the scalar and the least significant bytes will be written. "dst_len" can also be larger and the most significant bytes will be padded with zeroes. Centralized the code that adds or removes address bits for callable and opcode addresses into lldb_private::Target: lldb::addr_t Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const; lldb::addr_t Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const; All necessary lldb_private::Address functions now use the target versions so changes should only need to happen in one place if anything needs updating. Fixed up a lot of places that were calling : addr_t Address::GetLoadAddress(Target*); to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress() as needed. There were many places in the breakpoint code where things could go wrong for ARM if these weren't used. llvm-svn: 131878
Diffstat (limited to 'lldb/source/Target/ThreadPlanRunToAddress.cpp')
-rw-r--r--lldb/source/Target/ThreadPlanRunToAddress.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp
index 2394545..0779a1f 100644
--- a/lldb/source/Target/ThreadPlanRunToAddress.cpp
+++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp
@@ -39,7 +39,7 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
m_addresses (),
m_break_ids ()
{
- m_addresses.push_back (address.GetLoadAddress(&m_thread.GetProcess().GetTarget()));
+ m_addresses.push_back (address.GetOpcodeLoadAddress (&m_thread.GetProcess().GetTarget()));
SetInitialBreakpoints();
}
@@ -54,14 +54,14 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
m_addresses (),
m_break_ids ()
{
- m_addresses.push_back(address);
+ m_addresses.push_back(m_thread.GetProcess().GetTarget().GetOpcodeLoadAddress(address));
SetInitialBreakpoints();
}
ThreadPlanRunToAddress::ThreadPlanRunToAddress
(
Thread &thread,
- std::vector<lldb::addr_t> &addresses,
+ const std::vector<lldb::addr_t> &addresses,
bool stop_others
) :
ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to address plan", thread, eVoteNoOpinion, eVoteNoOpinion),
@@ -69,6 +69,13 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
m_addresses (addresses),
m_break_ids ()
{
+ // Convert all addressses into opcode addresses to make sure we set
+ // breakpoints at the correct address.
+ Target &target = thread.GetProcess().GetTarget();
+ std::vector<lldb::addr_t>::iterator pos, end = m_addresses.end();
+ for (pos = m_addresses.begin(); pos != end; ++pos)
+ *pos = target.GetOpcodeLoadAddress (*pos);
+
SetInitialBreakpoints();
}