diff options
author | Jim Ingham <jingham@apple.com> | 2017-08-02 00:16:10 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2017-08-02 00:16:10 +0000 |
commit | af26b22cd2156217bf03ac355cc1751693b00442 (patch) | |
tree | ab1124ad40f9de909302b151256fd4804810dc0e /lldb/source/API/SBBreakpointLocation.cpp | |
parent | 37c052f503877fce8596c8fdc3207c6f81033957 (diff) | |
download | bcm5719-llvm-af26b22cd2156217bf03ac355cc1751693b00442.tar.gz bcm5719-llvm-af26b22cd2156217bf03ac355cc1751693b00442.zip |
Fix a mis-feature with propagation of breakpoint options -> location options.
When an option was set at on a location, I was just copying the whole option set
to the location, and letting it shadow the breakpoint options. That was wrong since
it meant changes to unrelated options on the breakpoint would no longer take on this
location. I added a mask of set options and use that for option propagation.
I also added a "location" property to breakpoints, and added SBBreakpointLocation.{G,S}etCommandLineCommands
since I wanted to use them to write some more test cases.
<rdar://problem/24397798>
llvm-svn: 309772
Diffstat (limited to 'lldb/source/API/SBBreakpointLocation.cpp')
-rw-r--r-- | lldb/source/API/SBBreakpointLocation.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index 3678d1d33e0..f5e0b91483e 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -12,6 +12,7 @@ #include "lldb/API/SBDebugger.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBStream.h" +#include "lldb/API/SBStringList.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" @@ -195,6 +196,33 @@ SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) { return sb_error; } +void SBBreakpointLocation::SetCommandLineCommands(SBStringList &commands) { + BreakpointLocationSP loc_sp = GetSP(); + if (!loc_sp) + return; + if (commands.GetSize() == 0) + return; + + std::lock_guard<std::recursive_mutex> guard( + loc_sp->GetTarget().GetAPIMutex()); + std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up( + new BreakpointOptions::CommandData(*commands, eScriptLanguageNone)); + + loc_sp->GetLocationOptions()->SetCommandDataCallback(cmd_data_up); +} + +bool SBBreakpointLocation::GetCommandLineCommands(SBStringList &commands) { + BreakpointLocationSP loc_sp = GetSP(); + if (!loc_sp) + return false; + StringList command_list; + bool has_commands = + loc_sp->GetLocationOptions()->GetCommandLineCallbacks(command_list); + if (has_commands) + commands.AppendList(command_list); + return has_commands; +} + void SBBreakpointLocation::SetThreadID(tid_t thread_id) { BreakpointLocationSP loc_sp = GetSP(); if (loc_sp) { |