mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
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
This commit is contained in:
parent
519de4b692
commit
3826727453
@ -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)",
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user