diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 9cd5fcac5c36..29662486d93f 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -195,6 +195,35 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman is_range = true; i = i+2; } + else + { + // See if user has specified id.* + std::string tmp_str = old_args.GetArgumentAtIndex (i); + size_t pos = tmp_str.find ('.'); + if (pos != std::string::npos) + { + std::string bp_id_str = tmp_str.substr (0, pos); + if (BreakpointID::IsValidIDExpression (bp_id_str.c_str()) + && tmp_str[pos+1] == '*' + && tmp_str.length() == (pos + 2)) + { + break_id_t bp_id; + break_id_t bp_loc_id; + + BreakpointID::ParseCanonicalReference (bp_id_str.c_str(), &bp_id, &bp_loc_id); + BreakpointSP breakpoint_sp = target->GetBreakpointByID (bp_id); + const size_t num_locations = breakpoint_sp->GetNumLocations(); + for (size_t j = 0; j < num_locations; ++j) + { + BreakpointLocation *bp_loc = breakpoint_sp->GetLocationAtIndex(j).get(); + StreamString canonical_id_str; + BreakpointID::GetCanonicalReference (&canonical_id_str, bp_id, bp_loc->GetID()); + new_args.AppendArgument (canonical_id_str.GetData()); + } + } + + } + } if (is_range) { @@ -226,6 +255,25 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman // We have valid range starting & ending breakpoint IDs. Go through all the breakpoints in the // target and find all the breakpoints that fit into this range, and add them to new_args. + + // Next check to see if we have location id's. If so, make sure the start_bp_id and end_bp_id are + // for the same breakpoint; otherwise we have an illegal range: breakpoint id ranges that specify + // bp locations are NOT allowed to cross major bp id numbers. + + if ((start_loc_id != LLDB_INVALID_BREAK_ID) + || (end_loc_id != LLDB_INVALID_BREAK_ID)) + { + if (start_bp_id != end_bp_id) + { + new_args.Clear(); + result.AppendErrorWithFormat ("Invalid range: Ranges that specify particular breakpoint locations" + " must be within the same major breakpoint; you specified two" + " different major breakpoints, %d and %d.\n", + start_bp_id, end_bp_id); + result.SetStatus (eReturnStatusFailed); + return; + } + } const BreakpointList& breakpoints = target->GetBreakpointList(); const size_t num_breakpoints = breakpoints.GetSize(); @@ -284,7 +332,9 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman } bool -BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, uint32_t *range_start_len, uint32_t *range_end_pos) +BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, + uint32_t *range_start_len, + uint32_t *range_end_pos) { bool is_range_expression = false; std::string arg_str = in_string; diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index f5c64bc0e081..2fc5f2b3085d 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -275,7 +275,7 @@ CommandObjectBreakpointSet::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. Must set target before setting breakpoints (see 'file' command)."); result.SetStatus (eReturnStatusFailed); return false; } @@ -709,7 +709,7 @@ CommandObjectBreakpointList::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. No current target or breakpoints."); result.SetStatus (eReturnStatusSuccessFinishNoResult); return true; } @@ -800,7 +800,7 @@ CommandObjectBreakpointEnable::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. No existing target or breakpoints."); result.SetStatus (eReturnStatusFailed); return false; } @@ -900,7 +900,7 @@ CommandObjectBreakpointDisable::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. No existing target or breakpoints."); result.SetStatus (eReturnStatusFailed); return false; } @@ -996,7 +996,7 @@ CommandObjectBreakpointDelete::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. No existing target or breakpoints."); result.SetStatus (eReturnStatusFailed); return false; } @@ -1229,7 +1229,7 @@ CommandObjectBreakpointModify::Execute Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) { - result.AppendError ("Invalid target, set executable file using 'file' command."); + result.AppendError ("Invalid target. No existing target or breakpoints."); result.SetStatus (eReturnStatusFailed); return false; }