aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-09-14 22:03:00 +0000
committerJim Ingham <jingham@apple.com>2010-09-14 22:03:00 +0000
commit08b87e0dedc4bf9939190a61c81200c0ea97c3c7 (patch)
treebd2b9d09ea807a49b675974826737576ba968060 /lldb/source/Target
parent1aad5c61f82b8c8032f66bf22a39408a8c3bfd53 (diff)
downloadllvm-08b87e0dedc4bf9939190a61c81200c0ea97c3c7.tar.gz
llvm-08b87e0dedc4bf9939190a61c81200c0ea97c3c7.tar.bz2
llvm-08b87e0dedc4bf9939190a61c81200c0ea97c3c7.zip
Add the ability for "ThreadPlanRunToAddress" to run to multiple addresses.
Added the ability to specify a preference for mangled or demangled to Mangled::GetName. Changed one place where mangled was prefered in GetName. The Dynamic loader should look up the target of a stub by mangled name if it exists. llvm-svn: 113869
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/ThreadPlanRunToAddress.cpp150
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp9
2 files changed, 124 insertions, 35 deletions
diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp
index 077541ed27cf..edfe7e5900d6 100644
--- a/lldb/source/Target/ThreadPlanRunToAddress.cpp
+++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp
@@ -34,13 +34,13 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
Address &address,
bool stop_others
) :
- ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+ ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to address plan", thread, eVoteNoOpinion, eVoteNoOpinion),
m_stop_others (stop_others),
- m_address (LLDB_INVALID_ADDRESS),
- m_break_id (LLDB_INVALID_BREAK_ID)
+ m_addresses (),
+ m_break_ids ()
{
- m_address = address.GetLoadAddress(&m_thread.GetProcess());
- SetInitialBreakpoint();
+ m_addresses.push_back (address.GetLoadAddress(&m_thread.GetProcess()));
+ SetInitialBreakpoints();
}
ThreadPlanRunToAddress::ThreadPlanRunToAddress
@@ -49,52 +49,109 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress
lldb::addr_t address,
bool stop_others
) :
- ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+ ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to address plan", thread, eVoteNoOpinion, eVoteNoOpinion),
m_stop_others (stop_others),
- m_address (address),
- m_break_id (LLDB_INVALID_BREAK_ID)
+ m_addresses (),
+ m_break_ids ()
{
- SetInitialBreakpoint();
+ m_addresses.push_back(address);
+ SetInitialBreakpoints();
+}
+
+ThreadPlanRunToAddress::ThreadPlanRunToAddress
+(
+ Thread &thread,
+ std::vector<lldb::addr_t> &addresses,
+ bool stop_others
+) :
+ ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to address plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+ m_stop_others (stop_others),
+ m_addresses (addresses),
+ m_break_ids ()
+{
+ SetInitialBreakpoints();
}
void
-ThreadPlanRunToAddress::SetInitialBreakpoint ()
+ThreadPlanRunToAddress::SetInitialBreakpoints ()
{
- Breakpoint *breakpoint;
- breakpoint = m_thread.GetProcess().GetTarget().CreateBreakpoint (m_address, true).get();
- if (breakpoint != NULL)
+ size_t num_addresses = m_addresses.size();
+ m_break_ids.resize(num_addresses);
+
+ for (size_t i = 0; i < num_addresses; i++)
{
- m_break_id = breakpoint->GetID();
- breakpoint->SetThreadID(m_thread.GetID());
+ Breakpoint *breakpoint;
+ breakpoint = m_thread.GetProcess().GetTarget().CreateBreakpoint (m_addresses[i], true).get();
+ if (breakpoint != NULL)
+ {
+ m_break_ids[i] = breakpoint->GetID();
+ breakpoint->SetThreadID(m_thread.GetID());
+ }
}
}
ThreadPlanRunToAddress::~ThreadPlanRunToAddress ()
{
- if (m_break_id != LLDB_INVALID_BREAK_ID)
+ size_t num_break_ids = m_break_ids.size();
+ for (size_t i = 0; i < num_break_ids; i++)
{
- m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_id);
+ m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_ids[i]);
}
}
void
ThreadPlanRunToAddress::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
+ size_t num_addresses = m_addresses.size();
+
if (level == lldb::eDescriptionLevelBrief)
{
- s->Printf ("run to address: ");
- s->Address (m_address, sizeof (addr_t));
+ if (num_addresses == 0)
+ {
+ s->Printf ("run to address with no addresses given.");
+ return;
+ }
+ else if (num_addresses == 1)
+ s->Printf ("run to address: ");
+ else
+ s->Printf ("run to addresses: ");
+
+ for (size_t i = 0; i < num_addresses; i++)
+ {
+ s->Address (m_addresses[i], sizeof (addr_t));
+ s->Printf(" ");
+ }
}
else
{
- s->Printf ("Run to address: ");
- s->Address(m_address, sizeof (addr_t));
- s->Printf (" using breakpoint: %d - ", m_break_id);
- Breakpoint *breakpoint = m_thread.GetProcess().GetTarget().GetBreakpointByID (m_break_id).get();
- if (breakpoint)
- breakpoint->Dump (s);
+ if (num_addresses == 0)
+ {
+ s->Printf ("run to address with no addresses given.");
+ return;
+ }
+ else if (num_addresses == 1)
+ s->Printf ("Run to address: ");
else
- s->Printf ("but the breakpoint has been deleted.");
+ {
+ s->Printf ("Run to addresses: ");
+ }
+
+ for (size_t i = 0; i < num_addresses; i++)
+ {
+ if (num_addresses > 1)
+ {
+ s->Printf("\n");
+ s->Indent();
+ }
+
+ s->Address(m_addresses[i], sizeof (addr_t));
+ s->Printf (" using breakpoint: %d - ", m_break_ids[i]);
+ Breakpoint *breakpoint = m_thread.GetProcess().GetTarget().GetBreakpointByID (m_break_ids[i]).get();
+ if (breakpoint)
+ breakpoint->Dump (s);
+ else
+ s->Printf ("but the breakpoint has been deleted.");
+ }
}
}
@@ -103,10 +160,20 @@ ThreadPlanRunToAddress::ValidatePlan (Stream *error)
{
// If we couldn't set the breakpoint for some reason, then this won't
// work.
- if(m_break_id == LLDB_INVALID_BREAK_ID)
- return false;
- else
- return true;
+ bool all_bps_good = true;
+ size_t num_break_ids = m_break_ids.size();
+
+ for (size_t i = 0; i < num_break_ids; i++)
+ {
+ if (m_break_ids[i] == LLDB_INVALID_BREAK_ID)
+ {
+ all_bps_good = false;
+ error->Printf ("Could not set breakpoint for address: ");
+ error->Address (m_addresses[i], sizeof (addr_t));
+ error->Printf ("\n");
+ }
+ }
+ return all_bps_good;
}
bool
@@ -153,12 +220,16 @@ ThreadPlanRunToAddress::MischiefManaged ()
if (AtOurAddress())
{
// Remove the breakpoint
- if (m_break_id != LLDB_INVALID_BREAK_ID)
+ size_t num_break_ids = m_break_ids.size();
+
+ for (size_t i = 0; i < num_break_ids; i++)
{
- m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_id);
- m_break_id = LLDB_INVALID_BREAK_ID;
+ if (m_break_ids[i] != LLDB_INVALID_BREAK_ID)
+ {
+ m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_ids[i]);
+ m_break_ids[i] = LLDB_INVALID_BREAK_ID;
+ }
}
-
if (log)
log->Printf("Completed run to address plan.");
ThreadPlan::MischiefManaged ();
@@ -172,5 +243,14 @@ bool
ThreadPlanRunToAddress::AtOurAddress ()
{
lldb::addr_t current_address = m_thread.GetRegisterContext()->GetPC();
- return m_address == current_address;
+ bool found_it = false;
+ for (size_t i = 0; i < m_addresses[i]; i++)
+ {
+ if (m_addresses[i] == current_address)
+ {
+ found_it = true;
+ break;
+ }
+ }
+ return found_it;
}
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index ecdb6fa471db..d6abddd81147 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -111,6 +111,15 @@ ThreadPlanStepInRange::ShouldStop (Event *event_ptr)
stop_others = false;
new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others);
+
+ if (log)
+ {
+ if (new_plan != NULL)
+ log->Printf ("Found a step through plan: %s", new_plan->GetName());
+ else
+ log->Printf ("No step through plan found.");
+ }
+
// If not, give the "should_stop" callback a chance to push a plan to get us out of here.
// But only do that if we actually have stepped in.
if (!new_plan && FrameIsYounger())