diff options
author | Jim Ingham <jingham@apple.com> | 2016-09-21 01:21:19 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-09-21 01:21:19 +0000 |
commit | ff9a91ea98e2093887220cf08081036b638e92ef (patch) | |
tree | 16a6cec1d52d049b618f62d87e1df0daf22c3c23 /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
parent | 09aa01a6f86e348800d76d7e7008eba9b2d5803f (diff) | |
download | llvm-ff9a91ea98e2093887220cf08081036b638e92ef.zip llvm-ff9a91ea98e2093887220cf08081036b638e92ef.tar.gz llvm-ff9a91ea98e2093887220cf08081036b638e92ef.tar.bz2 |
Adds tests for breakpoint names, and a FindBreakpointsByName.
Also if you set a breakpoint with an invalid name, we'll
refuse to set the breakpoint rather than silently ignoring
the name.
llvm-svn: 282043
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index bab8ecb..b0c8332 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -249,6 +249,9 @@ public: case 'N': { if (BreakpointID::StringIsBreakpointName(option_strref, error)) m_breakpoint_names.push_back(option_arg); + else + error.SetErrorStringWithFormat("Invalid breakpoint name: %s", + option_arg); break; } @@ -622,10 +625,17 @@ protected: bp->GetOptions()->SetCondition(m_options.m_condition.c_str()); if (!m_options.m_breakpoint_names.empty()) { - Error error; // We don't need to check the error here, since the option - // parser checked it... - for (auto name : m_options.m_breakpoint_names) - bp->AddName(name.c_str(), error); + Error name_error; + for (auto name : m_options.m_breakpoint_names) { + bp->AddName(name.c_str(), name_error); + if (name_error.Fail()) { + result.AppendErrorWithFormat("Invalid breakpoint name: %s", + name.c_str()); + target->RemoveBreakpointByID(bp->GetID()); + result.SetStatus(eReturnStatusFailed); + return false; + } + } } bp->SetOneShot(m_options.m_one_shot); |