aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2017-08-02 00:16:10 +0000
committerJim Ingham <jingham@apple.com>2017-08-02 00:16:10 +0000
commitaf26b22cd2156217bf03ac355cc1751693b00442 (patch)
treeab1124ad40f9de909302b151256fd4804810dc0e /lldb/source/Commands/CommandObjectBreakpointCommand.cpp
parent37c052f503877fce8596c8fdc3207c6f81033957 (diff)
downloadllvm-af26b22cd2156217bf03ac355cc1751693b00442.zip
llvm-af26b22cd2156217bf03ac355cc1751693b00442.tar.gz
llvm-af26b22cd2156217bf03ac355cc1751693b00442.tar.bz2
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/Commands/CommandObjectBreakpointCommand.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index de49119..ecb00f9 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -673,48 +673,49 @@ protected:
target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
if (bp) {
- const BreakpointOptions *bp_options = nullptr;
+ BreakpointLocationSP bp_loc_sp;
if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
- BreakpointLocationSP bp_loc_sp(
- bp->FindLocationByID(cur_bp_id.GetLocationID()));
- if (bp_loc_sp)
- bp_options = bp_loc_sp->GetOptionsNoCreate();
- else {
+ bp_loc_sp = bp->FindLocationByID(cur_bp_id.GetLocationID());
+ if (!bp_loc_sp)
+ {
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
cur_bp_id.GetBreakpointID(),
cur_bp_id.GetLocationID());
result.SetStatus(eReturnStatusFailed);
return false;
}
- } else {
- bp_options = bp->GetOptions();
}
- if (bp_options) {
- StreamString id_str;
- BreakpointID::GetCanonicalReference(&id_str,
- cur_bp_id.GetBreakpointID(),
- cur_bp_id.GetLocationID());
- const Baton *baton = bp_options->GetBaton();
- if (baton) {
- result.GetOutputStream().Printf("Breakpoint %s:\n",
- id_str.GetData());
- result.GetOutputStream().IndentMore();
- baton->GetDescription(&result.GetOutputStream(),
- eDescriptionLevelFull);
- result.GetOutputStream().IndentLess();
- } else {
- result.AppendMessageWithFormat(
- "Breakpoint %s does not have an associated command.\n",
- id_str.GetData());
- }
+ StreamString id_str;
+ BreakpointID::GetCanonicalReference(&id_str,
+ cur_bp_id.GetBreakpointID(),
+ cur_bp_id.GetLocationID());
+ const Baton *baton = nullptr;
+ if (bp_loc_sp)
+ baton = bp_loc_sp
+ ->GetOptionsSpecifyingKind(BreakpointOptions::eCallback)
+ ->GetBaton();
+ else
+ baton = bp->GetOptions()->GetBaton();
+
+ if (baton) {
+ result.GetOutputStream().Printf("Breakpoint %s:\n",
+ id_str.GetData());
+ result.GetOutputStream().IndentMore();
+ baton->GetDescription(&result.GetOutputStream(),
+ eDescriptionLevelFull);
+ result.GetOutputStream().IndentLess();
+ } else {
+ result.AppendMessageWithFormat(
+ "Breakpoint %s does not have an associated command.\n",
+ id_str.GetData());
}
- result.SetStatus(eReturnStatusSuccessFinishResult);
- } else {
- result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
- cur_bp_id.GetBreakpointID());
- result.SetStatus(eReturnStatusFailed);
}
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ } else {
+ result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
+ cur_bp_id.GetBreakpointID());
+ result.SetStatus(eReturnStatusFailed);
}
}
}