diff options
Diffstat (limited to 'source/Breakpoint/BreakpointOptions.cpp')
| -rw-r--r-- | source/Breakpoint/BreakpointOptions.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp index 662b288794d3..b5869fc34dfc 100644 --- a/source/Breakpoint/BreakpointOptions.cpp +++ b/source/Breakpoint/BreakpointOptions.cpp @@ -425,10 +425,9 @@ void BreakpointOptions::SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool callback_is_synchronous) { // FIXME: This seems unsafe. If BatonSP actually *is* a CommandBaton, but - // in a shared_ptr<Baton> instead of a shared_ptr<CommandBaton>, then we - // will set m_baton_is_command_baton to false, which is incorrect. - // One possible solution is to make the base Baton class provide a method - // such as: + // in a shared_ptr<Baton> instead of a shared_ptr<CommandBaton>, then we will + // set m_baton_is_command_baton to false, which is incorrect. One possible + // solution is to make the base Baton class provide a method such as: // virtual StringRef getBatonId() const { return ""; } // and have CommandBaton override this to return something unique, and then // check for it here. Another option might be to make Baton using the llvm @@ -470,12 +469,18 @@ const Baton *BreakpointOptions::GetBaton() const { bool BreakpointOptions::InvokeCallback(StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id) { - if (m_callback && context->is_synchronous == IsCallbackSynchronous()) { - return m_callback(m_callback_baton_sp ? m_callback_baton_sp->data() + if (m_callback) { + if (context->is_synchronous == IsCallbackSynchronous()) { + return m_callback(m_callback_baton_sp ? m_callback_baton_sp->data() : nullptr, context, break_id, break_loc_id); - } else - return true; + } else if (IsCallbackSynchronous()) { + // If a synchronous callback is called at async time, it should not say + // to stop. + return false; + } + } + return true; } bool BreakpointOptions::HasCallback() const { @@ -526,7 +531,10 @@ const ThreadSpec *BreakpointOptions::GetThreadSpecNoCreate() const { ThreadSpec *BreakpointOptions::GetThreadSpec() { if (m_thread_spec_ap.get() == nullptr) + { + m_set_flags.Set(eThreadSpec); m_thread_spec_ap.reset(new ThreadSpec()); + } return m_thread_spec_ap.get(); } @@ -545,8 +553,7 @@ void BreakpointOptions::SetThreadSpec( void BreakpointOptions::GetDescription(Stream *s, lldb::DescriptionLevel level) const { // Figure out if there are any options not at their default value, and only - // print - // anything if there are: + // print anything if there are: if (m_ignore_count != 0 || !m_enabled || m_one_shot || m_auto_continue || (GetThreadSpecNoCreate() != nullptr && @@ -651,8 +658,7 @@ bool BreakpointOptions::BreakpointOptionsCallbackFunction( CommandReturnObject result; Debugger &debugger = target->GetDebugger(); // Rig up the results secondary output stream to the debugger's, so the - // output will come out synchronously - // if the debugger is set up that way. + // output will come out synchronously if the debugger is set up that way. StreamSP output_stream(debugger.GetAsyncOutputStream()); StreamSP error_stream(debugger.GetAsyncErrorStream()); |
