summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2016-12-16 02:48:39 +0000
committerJason Molenda <jmolenda@apple.com>2016-12-16 02:48:39 +0000
commit3826727453b258ac8b6df655892497cbdd7dc5df (patch)
tree092e8993112a5d381a075e48cc205be46b6c3ab5 /lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
parent519de4b69205a17df69250e92423d8bd482bbf99 (diff)
downloadbcm5719-llvm-3826727453b258ac8b6df655892497cbdd7dc5df.tar.gz
bcm5719-llvm-3826727453b258ac8b6df655892497cbdd7dc5df.zip
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> llvm-svn: 289913
Diffstat (limited to 'lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp')
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 5e1dd27e8c2..e459268f544 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -1405,6 +1405,20 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process &process,
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::ModulesDidLoad(Process &process,
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::AddInitCompletionHook(Process &process) {
// 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)",
OpenPOWER on IntegriCloud