diff options
22 files changed, 158 insertions, 14 deletions
diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index 816c0fb1344..3f8a39e53c7 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -489,6 +489,32 @@ public: GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations = false); //------------------------------------------------------------------ + /// Set the "kind" description for a breakpoint. If the breakpoint is hit + /// the stop info will show this "kind" description instead of the breakpoint + /// number. Mostly useful for internal breakpoints, where the breakpoint number + /// doesn't have meaning to the user. + /// + /// @param[in] kind + /// New "kind" description. + //------------------------------------------------------------------ + void + SetBreakpointKind (const char *kind) + { + m_kind_description.assign (kind); + } + + //------------------------------------------------------------------ + /// Return the "kind" description for a breakpoint. + /// + /// @return + /// The breakpoint kind, or NULL if none is set. + //------------------------------------------------------------------ + const char *GetBreakpointKind () const + { + return m_kind_description.c_str(); + } + + //------------------------------------------------------------------ /// Accessor for the breakpoint Target. /// @return /// This breakpoint's Target. @@ -588,6 +614,7 @@ private: lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint. BreakpointOptions m_options; // Settable breakpoint options BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint. + std::string m_kind_description; void SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind); diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h index 0a1ee7174a2..7f6a659323b 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -171,6 +171,14 @@ public: //------------------------------------------------------------------ bool ValidForThisThread (Thread *thread); + //------------------------------------------------------------------ + /// Tell whether ALL the breakpoints in the location collection are internal. + /// + /// @result + /// \b true if all breakpoint locations are owned by internal breakpoints, + /// \b false otherwise. + //------------------------------------------------------------------ + bool IsInternal() const; protected: diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h index ff71e0441e8..cc9ea9493d7 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h @@ -220,9 +220,29 @@ public: GetDescription (Stream *s, lldb::DescriptionLevel level); + //------------------------------------------------------------------ + /// Tell whether a breakpoint has a location at this site. + /// + /// @param[in] bp_id + /// The breakpoint id to query. + /// + /// @result + /// \b true if bp_id has a location that is at this site, + /// \b false otherwise. + //------------------------------------------------------------------ bool IsBreakpointAtThisSite (lldb::break_id_t bp_id); + //------------------------------------------------------------------ + /// Tell whether ALL the breakpoints in the location collection are internal. + /// + /// @result + /// \b true if all breakpoint locations are owned by internal breakpoints, + /// \b false otherwise. + //------------------------------------------------------------------ + bool + IsInternal () const; + BreakpointSite::Type GetType () const { diff --git a/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h index 2c876575e08..6b76e5891ae 100644 --- a/lldb/include/lldb/Target/DynamicLoader.h +++ b/lldb/include/lldb/Target/DynamicLoader.h @@ -229,7 +229,6 @@ protected: // Member variables. //------------------------------------------------------------------ Process* m_process; ///< The process that this dynamic loader plug-in is tracking. - bool m_stop_when_images_change; ///< Boolean value that indicates if the process should stop when imamges change. private: DISALLOW_COPY_AND_ASSIGN (DynamicLoader); diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 0de212d9cc8..3c0a61acc0c 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -85,6 +85,12 @@ public: void SetUnwindOnErrorInExpressions (bool ignore); + + bool + GetStopOnSharedLibraryEvents () const; + + void + SetStopOnSharedLibraryEvents (bool stop); }; typedef STD_SHARED_PTR(ProcessProperties) ProcessPropertiesSP; diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 9e486580387..ce7cc9223a3 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -525,12 +525,21 @@ Breakpoint::GetNumLocations() const void Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations) { - const size_t num_locations = GetNumLocations (); - const size_t num_resolved_locations = GetNumResolvedLocations (); - assert (s != NULL); - + if (!m_kind_description.empty()) + { + if (eDescriptionLevelBrief) + { + s->PutCString (GetBreakpointKind()); + return; + } + else + s->Printf("Kind: %s\n", GetBreakpointKind ()); + } + + const size_t num_locations = GetNumLocations (); + const size_t num_resolved_locations = GetNumResolvedLocations (); // They just made the breakpoint, they don't need to be told HOW they made it... // Also, we'll print the breakpoint number differently depending on whether there is 1 or more locations. diff --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp index c03b7dd2b16..ee3f56f928d 100644 --- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp +++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp @@ -162,6 +162,25 @@ BreakpointLocationCollection::ValidForThisThread (Thread *thread) return false; } +bool +BreakpointLocationCollection::IsInternal () const +{ + collection::const_iterator pos, + begin = m_break_loc_collection.begin(), + end = m_break_loc_collection.end(); + + bool is_internal = true; + + for (pos = begin; pos != end; ++pos) + { + if (!(*pos)->GetBreakpoint().IsInternal ()) + { + is_internal = false; + break; + } + } + return is_internal; +} void BreakpointLocationCollection::GetDescription (Stream *s, lldb::DescriptionLevel level) diff --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp index 77572e86e19..fa5d8c1f9f8 100644 --- a/lldb/source/Breakpoint/BreakpointSite.cpp +++ b/lldb/source/Breakpoint/BreakpointSite.cpp @@ -98,6 +98,12 @@ BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level) m_owners.GetDescription (s, level); } +bool +BreakpointSite::IsInternal() const +{ + return m_owners.IsInternal(); +} + uint8_t * BreakpointSite::GetTrapOpcodeBytes() { diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp index fa00e77ceb7..17a796fee9d 100644 --- a/lldb/source/Core/DynamicLoader.cpp +++ b/lldb/source/Core/DynamicLoader.cpp @@ -9,6 +9,7 @@ #include "lldb/lldb-private.h" #include "lldb/Target/DynamicLoader.h" +#include "lldb/Target/Process.h" #include "lldb/Core/PluginManager.h" using namespace lldb; @@ -45,8 +46,7 @@ DynamicLoader::FindPlugin (Process *process, const char *plugin_name) // DynamicLoader constructor //---------------------------------------------------------------------- DynamicLoader::DynamicLoader(Process *process) : - m_process (process), - m_stop_when_images_change(false) // Stop the process by default when a process' images change + m_process (process) { } @@ -64,12 +64,12 @@ DynamicLoader::~DynamicLoader() bool DynamicLoader::GetStopWhenImagesChange () const { - return m_stop_when_images_change; + return m_process->GetStopOnSharedLibraryEvents(); } void DynamicLoader::SetStopWhenImagesChange (bool stop) { - m_stop_when_images_change = stop; + m_process->SetStopOnSharedLibraryEvents (stop); } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index dd34da370db..fe761ebdcce 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -238,7 +238,7 @@ DynamicLoaderMacOSXDYLD::Clear (bool clear_process) Mutex::Locker locker(m_mutex); if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id)) - m_process->ClearBreakpointSiteByID(m_break_id); + m_process->GetTarget().RemoveBreakpointByID (m_break_id); if (clear_process) m_process = NULL; @@ -1565,6 +1565,7 @@ DynamicLoaderMacOSXDYLD::SetNotificationBreakpoint () { Breakpoint *dyld_break = m_process->GetTarget().CreateBreakpoint (so_addr, true).get(); dyld_break->SetCallback (DynamicLoaderMacOSXDYLD::NotifyBreakpointHit, this, true); + dyld_break->SetBreakpointKind ("shared-library-event"); m_break_id = dyld_break->GetID(); } } diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 1400427094b..e3ac4885e56 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -202,6 +202,7 @@ DynamicLoaderPOSIXDYLD::ProbeEntry() entry_break = m_process->GetTarget().CreateBreakpoint(entry, true).get(); entry_break->SetCallback(EntryBreakpointHit, this, true); + entry_break->SetBreakpointKind("shared-library-event"); } // The runtime linker has run and initialized the rendezvous structure once the @@ -233,6 +234,7 @@ DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() break_addr = m_rendezvous.GetBreakAddress(); dyld_break = m_process->GetTarget().CreateBreakpoint(break_addr, true).get(); dyld_break->SetCallback(RendezvousBreakpointHit, this, true); + dyld_break->SetBreakpointKind ("shared-library-event"); } bool diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 494cf92bc37..b54eb325f2d 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -418,6 +418,7 @@ ItaniumABILanguageRuntime::SetExceptionBreakpoints () SearchFilterSP filter_sp = target.GetSearchFilterForModule(NULL); m_cxx_exception_bp_sp = target.CreateBreakpoint (filter_sp, exception_resolver_sp, is_internal); + m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception"); } else m_cxx_exception_bp_sp->SetEnabled (true); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index 7766f5cd2aa..8f31d8418e7 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -382,6 +382,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () { m_trampolines_changed_bp_id = trampolines_changed_bp_sp->GetID(); trampolines_changed_bp_sp->SetCallback (RefreshTrampolines, this, true); + trampolines_changed_bp_sp->SetBreakpointKind ("objc-trampolines-changed"); return true; } } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 73f40aee8ba..5db55b5a068 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -964,6 +964,7 @@ PlatformDarwin::SetThreadCreationBreakpoint (Target &target) eFunctionNameTypeFull, skip_prologue, internal); + bp_sp->SetBreakpointKind("thread-creation"); return bp_sp; } diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp index 611b336f6a2..ecd69a351f0 100644 --- a/lldb/source/Target/LanguageRuntime.cpp +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -61,6 +61,8 @@ LanguageRuntime::CreateExceptionBreakpoint( SearchFilterSP filter_sp(target.GetSearchFilterForModule(NULL)); exc_breakpt_sp = target.CreateBreakpoint (filter_sp, resolver_sp, is_internal); + if (is_internal) + exc_breakpt_sp->SetBreakpointKind("exception"); return exc_breakpt_sp; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index a6bbdcf83a7..699063ff938 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -100,6 +100,7 @@ g_properties[] = { "ignore-breakpoints-in-expressions", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, breakpoints will be ignored during expression evaluation." }, { "unwind-on-error-in-expressions", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, errors in expression evaluation will unwind the stack back to the state before the call." }, { "python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, NULL, NULL, "A path to a python OS plug-in module file that contains a OperatingSystemPlugIn class." }, + { "stop-on-sharedlibrary-events" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, stop when a shared library is loaded or unloaded." }, { NULL , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL } }; @@ -108,7 +109,8 @@ enum { ePropertyExtraStartCommand, ePropertyIgnoreBreakpointsInExpressions, ePropertyUnwindOnErrorInExpressions, - ePropertyPythonOSPluginPath + ePropertyPythonOSPluginPath, + ePropertyStopOnSharedLibraryEvents }; ProcessProperties::ProcessProperties (bool is_global) : @@ -119,7 +121,7 @@ ProcessProperties::ProcessProperties (bool is_global) : m_collection_sp.reset (new ProcessOptionValueProperties(ConstString("process"))); m_collection_sp->Initialize(g_properties); m_collection_sp->AppendProperty(ConstString("thread"), - ConstString("Settings specify to threads."), + ConstString("Settings specific to threads."), true, Thread::GetGlobalProperties()->GetValueProperties()); } @@ -197,6 +199,20 @@ ProcessProperties::SetUnwindOnErrorInExpressions (bool ignore) m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, ignore); } +bool +ProcessProperties::GetStopOnSharedLibraryEvents () const +{ + const uint32_t idx = ePropertyStopOnSharedLibraryEvents; + return m_collection_sp->GetPropertyAtIndexAsBoolean(NULL, idx, g_properties[idx].default_uint_value != 0); +} + +void +ProcessProperties::SetStopOnSharedLibraryEvents (bool stop) +{ + const uint32_t idx = ePropertyStopOnSharedLibraryEvents; + m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, stop); +} + void ProcessInstanceInfo::Dump (Stream &s, Platform *platform) const { diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 3774c510eea..1a7779d4fb9 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -206,6 +206,22 @@ public: if (bp_site_sp) { StreamString strm; + // If we have just hit an internal breakpoint, and it has a kind description, print that instead of the + // full breakpoint printing: + if (bp_site_sp->IsInternal()) + { + size_t num_owners = bp_site_sp->GetNumberOfOwners(); + for (size_t idx = 0; idx < num_owners; idx++) + { + const char *kind = bp_site_sp->GetOwnerAtIndex(idx)->GetBreakpoint().GetBreakpointKind(); + if (kind != NULL) + { + m_description.assign (kind); + return kind; + } + } + } + strm.Printf("breakpoint "); bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief); m_description.swap (strm.GetString()); diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp index f406c37bd53..39d11f71c48 100644 --- a/lldb/source/Target/ThreadPlanRunToAddress.cpp +++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp @@ -93,6 +93,7 @@ ThreadPlanRunToAddress::SetInitialBreakpoints () { m_break_ids[i] = breakpoint->GetID(); breakpoint->SetThreadID(m_thread.GetID()); + breakpoint->SetBreakpointKind("run-to-address"); } } } diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 678498f68b2..536efad527c 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -107,6 +107,7 @@ ThreadPlanStepOut::ThreadPlanStepOut { return_bp->SetThreadID(m_thread.GetID()); m_return_bp_id = return_bp->GetID(); + return_bp->SetBreakpointKind ("step-out"); } if (immediate_return_from_sp) diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index 25de2b35bed..0137e8b865d 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -334,8 +334,13 @@ ThreadPlanStepRange::SetNextBranchBreakpoint () const bool is_internal = true; run_to_address = instructions->GetInstructionAtIndex(branch_index)->GetAddress(); m_next_branch_bp_sp = GetTarget().CreateBreakpoint(run_to_address, is_internal); - m_next_branch_bp_sp->SetThreadID(m_thread.GetID()); - return true; + if (m_next_branch_bp_sp) + { + m_next_branch_bp_sp->SetThreadID(m_thread.GetID()); + m_next_branch_bp_sp->SetBreakpointKind ("next-branch-location"); + } + else + return false; } } return false; diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp index 21e1eeb8d3c..b72b53480c5 100644 --- a/lldb/source/Target/ThreadPlanStepThrough.cpp +++ b/lldb/source/Target/ThreadPlanStepThrough.cpp @@ -61,6 +61,7 @@ ThreadPlanStepThrough::ThreadPlanStepThrough (Thread &thread, StackID &m_stack_i { return_bp->SetThreadID(m_thread.GetID()); m_backstop_bkpt_id = return_bp->GetID(); + return_bp->SetBreakpointKind("step-through-backstop"); } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp index deda7d9184e..3d2713f2614 100644 --- a/lldb/source/Target/ThreadPlanStepUntil.cpp +++ b/lldb/source/Target/ThreadPlanStepUntil.cpp @@ -73,6 +73,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil { return_bp->SetThreadID(thread_id); m_return_bp_id = return_bp->GetID(); + return_bp->SetBreakpointKind ("until-return-backstop"); } } @@ -86,6 +87,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil { until_bp->SetThreadID(thread_id); m_until_points[address_list[i]] = until_bp->GetID(); + until_bp->SetBreakpointKind("until-target"); } else { |