summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Mangled.h17
-rw-r--r--lldb/include/lldb/Target/ThreadPlanRunToAddress.h13
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj1
-rw-r--r--lldb/source/Core/Mangled.cpp28
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp41
-rw-r--r--lldb/source/Target/ThreadPlanRunToAddress.cpp150
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp9
7 files changed, 203 insertions, 56 deletions
diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h
index 194ff04f9eb..f89e4b9fb06 100644
--- a/lldb/include/lldb/Core/Mangled.h
+++ b/lldb/include/lldb/Core/Mangled.h
@@ -51,6 +51,12 @@ public:
eQualifier, ///< A language qualifier
eError ///< The token failed to parse
};
+
+ enum NamePreference
+ {
+ ePreferMangled,
+ ePreferDemangled
+ };
//------------------------------------------------------------------
/// Mangled::Token structure
@@ -415,13 +421,16 @@ public:
//----------------------------------------------------------------------
/// Best name get accessor.
///
+ /// @param[in] preference
+ /// Which name would you prefer to get?
+ ///
/// @return
- /// A const reference to the the mangled name string object if this
- /// object has a valid mangled name, else a const reference to the
- /// demangled name is returned.
+ /// A const reference to the the preferred name string object if this
+ /// object has a valid name of that kind, else a const reference to the
+ /// other name is returned.
//----------------------------------------------------------------------
const ConstString&
- GetName () const;
+ GetName (NamePreference preference = ePreferDemangled) const;
//----------------------------------------------------------------------
/// Generate the tokens from the demangled name.
diff --git a/lldb/include/lldb/Target/ThreadPlanRunToAddress.h b/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
index 3b591ea3324..5d287a5718c 100644
--- a/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
+++ b/lldb/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -30,6 +32,11 @@ public:
lldb::addr_t address,
bool stop_others);
+ ThreadPlanRunToAddress (Thread &thread,
+ std::vector<lldb::addr_t> &addresses,
+ bool stop_others);
+
+
virtual
~ThreadPlanRunToAddress ();
@@ -61,13 +68,13 @@ public:
MischiefManaged ();
protected:
- void SetInitialBreakpoint();
+ void SetInitialBreakpoints();
bool AtOurAddress();
private:
bool m_stop_others;
- lldb::addr_t m_address; // This is the address we are going to run to.
+ std::vector<lldb::addr_t> m_addresses; // This is the address we are going to run to.
// TODO: Would it be useful to have multiple addresses?
- lldb::user_id_t m_break_id; // This is the breakpoint we are using to stop us at m_address.
+ std::vector<lldb::user_id_t> m_break_ids; // This is the breakpoint we are using to stop us at m_address.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanRunToAddress);
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index d1aa4e216bf..d3f03b6ce0c 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -2325,7 +2325,6 @@
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
compatibilityVersion = "Xcode 3.1";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index c3657952c16..95fff224846 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -95,7 +95,7 @@ Mangled::Clear ()
int
Mangled::Compare (const Mangled& a, const Mangled& b)
{
- return ConstString::Compare(a.GetName(), a.GetName());
+ return ConstString::Compare(a.GetName(ePreferDemangled), a.GetName(ePreferDemangled));
}
@@ -214,12 +214,28 @@ Mangled::GetMangledName () const
// Get the demangled name if there is one, else return the mangled name.
//----------------------------------------------------------------------
const ConstString&
-Mangled::GetName () const
+Mangled::GetName (Mangled::NamePreference preference) const
{
- const ConstString& name = GetDemangledName();
- if (name && !name.IsEmpty())
- return name;
- return m_mangled;
+ switch (preference)
+ {
+ case ePreferDemangled:
+ {
+ const ConstString& name = GetDemangledName();
+ if (name && !name.IsEmpty())
+ return name;
+ return m_mangled;
+ }
+ break;
+ case ePreferMangled:
+ {
+ const ConstString& name = GetMangledName();
+ if (name && !name.IsEmpty())
+ return name;
+ return m_demangled;
+
+ }
+ break;
+ }
}
//----------------------------------------------------------------------
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index fb65cb716a4..403ec49a3c2 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1067,12 +1067,14 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
StackFrame *current_frame = thread.GetStackFrameAtIndex(0).get();
const SymbolContext &current_context = current_frame->GetSymbolContext(eSymbolContextSymbol);
Symbol *current_symbol = current_context.symbol;
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (current_symbol != NULL)
{
if (current_symbol->IsTrampoline())
{
- const ConstString &trampoline_name = current_symbol->GetMangled().GetName();
+ const ConstString &trampoline_name = current_symbol->GetMangled().GetName(Mangled::ePreferMangled);
+
if (trampoline_name)
{
SymbolContextList target_symbols;
@@ -1080,7 +1082,8 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode, target_symbols);
// FIXME - Make the Run to Address take multiple addresses, and
// run to any of them.
- if (target_symbols.GetSize() == 1)
+ uint32_t num_symbols = target_symbols.GetSize();
+ if (num_symbols == 1)
{
SymbolContext context;
AddressRange addr_range;
@@ -1089,18 +1092,37 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
context.GetAddressRange (eSymbolContextEverything, addr_range);
thread_plan_sp.reset (new ThreadPlanRunToAddress (thread, addr_range.GetBaseAddress(), stop_others));
}
+ else
+ {
+ if (log)
+ log->Printf ("Couldn't resolve the symbol context.");
+ }
}
- else if (target_symbols.GetSize() > 1)
+ else if (num_symbols > 1)
{
- Log *log = DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (1);
- if (log)
+ std::vector<lldb::addr_t> addresses;
+ addresses.resize (num_symbols);
+ for (uint32_t i = 0; i < num_symbols; i++)
{
- log->Printf ("Found more than one symbol for trampoline target: \"%s\"", trampoline_name.AsCString());
+ SymbolContext context;
+ AddressRange addr_range;
+ if (target_symbols.GetContextAtIndex(i, context))
+ {
+ context.GetAddressRange (eSymbolContextEverything, addr_range);
+ lldb::addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(&(thread.GetProcess()));
+ addresses[i] = load_addr;
+ }
+ }
+ if (addresses.size() > 0)
+ thread_plan_sp.reset (new ThreadPlanRunToAddress (thread, addresses, stop_others));
+ else
+ {
+ if (log)
+ log->Printf ("Couldn't resolve the symbol contexts.");
}
}
else
{
- Log *log = DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (1);
if (log)
{
log->Printf ("Could not find symbol for trampoline target: \"%s\"", trampoline_name.AsCString());
@@ -1109,6 +1131,11 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
}
}
}
+ else
+ {
+ if (log)
+ log->Printf ("Could not find symbol for step through.");
+ }
if (thread_plan_sp == NULL && m_objc_trampoline_handler_ap.get())
thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others);
diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp
index 077541ed27c..edfe7e5900d 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 ecdb6fa471d..d6abddd8114 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())
OpenPOWER on IntegriCloud