[Lldb-commits] [lldb] r115077 - in /lldb/trunk/source: Breakpoint/BreakpointIDList.cpp Commands/CommandObjectBreakpoint.cpp
Caroline Tice
ctice at apple.com
Wed Sep 29 12:42:34 PDT 2010
Author: ctice
Date: Wed Sep 29 14:42:33 2010
New Revision: 115077
URL: http://llvm.org/viewvc/llvm-project?rev=115077&view=rev
Log:
Fix breakpoint id range testing to disallow ranges that specify breakpoint locations from
crossing major breakpoint boundaries (must be within a single breakpoint if specifying locations).
Add .* as a means of specifying all the breakpoint locations under a major breakpoint, e.g. "3.*"
means "all the breakpoint locations of breakpoint 3".
Fix error message to make more sense, if user attempts to specify a breakpoint command when there
isn't a target yet.
Modified:
lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=115077&r1=115076&r2=115077&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Wed Sep 29 14:42:33 2010
@@ -195,6 +195,35 @@
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 @@
// 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 @@
}
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;
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=115077&r1=115076&r2=115077&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Wed Sep 29 14:42:33 2010
@@ -275,7 +275,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
More information about the lldb-commits
mailing list