[Lldb-commits] [lldb] r289913 - Fix a bug when using a StructuredData darwin-log plugin
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 15 18:48:40 PST 2016
Author: jmolenda
Date: Thu Dec 15 20:48:39 2016
New Revision: 289913
URL: http://llvm.org/viewvc/llvm-project?rev=289913&view=rev
Log:
Fix a bug when using a StructuredData darwin-log plugin
where we would insert a breakpoint into a system library
but never remove it, so the second time we ran the binary
there would be two breakpoints and the debugger would
stop there.
<rdar://problem/29654974>
Modified:
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=289913&r1=289912&r2=289913&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Thu Dec 15 20:48:39 2016
@@ -1405,6 +1405,20 @@ void StructuredDataDarwinLog::ModulesDid
EnableNow();
}
+// -----------------------------------------------------------------------------
+// public destructor
+// -----------------------------------------------------------------------------
+
+StructuredDataDarwinLog::~StructuredDataDarwinLog() {
+ if (m_breakpoint_id != LLDB_INVALID_BREAK_ID) {
+ ProcessSP process_sp(GetProcess());
+ if (process_sp) {
+ process_sp->GetTarget().RemoveBreakpointByID(m_breakpoint_id);
+ m_breakpoint_id = LLDB_INVALID_BREAK_ID;
+ }
+ }
+}
+
#pragma mark -
#pragma mark Private instance methods
@@ -1415,7 +1429,8 @@ void StructuredDataDarwinLog::ModulesDid
StructuredDataDarwinLog::StructuredDataDarwinLog(const ProcessWP &process_wp)
: StructuredDataPlugin(process_wp), m_recorded_first_timestamp(false),
m_first_timestamp_seen(0), m_is_enabled(false),
- m_added_breakpoint_mutex(), m_added_breakpoint() {}
+ m_added_breakpoint_mutex(), m_added_breakpoint(),
+ m_breakpoint_id(LLDB_INVALID_BREAK_ID) {}
// -----------------------------------------------------------------------------
// Private static methods
@@ -1734,6 +1749,7 @@ void StructuredDataDarwinLog::AddInitCom
// Set our callback.
breakpoint_sp->SetCallback(InitCompletionHookCallback, nullptr);
+ m_breakpoint_id = breakpoint_sp->GetID();
if (log)
log->Printf("StructuredDataDarwinLog::%s() breakpoint set in module %s,"
"function %s (process uid %u)",
Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h?rev=289913&r1=289912&r2=289913&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h Thu Dec 15 20:48:39 2016
@@ -74,6 +74,8 @@ public:
void ModulesDidLoad(Process &process, ModuleList &module_list) override;
+ ~StructuredDataDarwinLog();
+
private:
// -------------------------------------------------------------------------
// Private constructors
@@ -129,6 +131,7 @@ private:
bool m_is_enabled;
std::mutex m_added_breakpoint_mutex;
bool m_added_breakpoint;
+ lldb::user_id_t m_breakpoint_id;
};
}
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=289913&r1=289912&r2=289913&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Dec 15 20:48:39 2016
@@ -889,6 +889,7 @@ void Process::Finalize() {
m_public_run_lock.SetStopped();
m_private_run_lock.TrySetRunning(); // This will do nothing if already locked
m_private_run_lock.SetStopped();
+ m_structured_data_plugin_map.clear();
m_finalize_called = true;
}
More information about the lldb-commits
mailing list