Use the "last created watchpoint" rather than asserting on watchpoint commands passing no watchpoint ID.
<rdar://problem/14327560> llvm-svn: 185406
This commit is contained in:
parent
92821745bf
commit
b0b4513ea2
|
@ -88,10 +88,22 @@ WithRSAIndex(llvm::StringRef &Arg)
|
||||||
// Return true if wp_ids is successfully populated with the watch ids.
|
// Return true if wp_ids is successfully populated with the watch ids.
|
||||||
// False otherwise.
|
// False otherwise.
|
||||||
bool
|
bool
|
||||||
CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids)
|
CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(Target *target, Args &args, std::vector<uint32_t> &wp_ids)
|
||||||
{
|
{
|
||||||
// Pre-condition: args.GetArgumentCount() > 0.
|
// Pre-condition: args.GetArgumentCount() > 0.
|
||||||
assert(args.GetArgumentCount() > 0);
|
if (args.GetArgumentCount() == 0)
|
||||||
|
{
|
||||||
|
if (target == NULL)
|
||||||
|
return false;
|
||||||
|
WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
|
||||||
|
if (watch_sp)
|
||||||
|
{
|
||||||
|
wp_ids.push_back(watch_sp->GetID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
llvm::StringRef Minus("-");
|
llvm::StringRef Minus("-");
|
||||||
std::vector<llvm::StringRef> StrRefArgs;
|
std::vector<llvm::StringRef> StrRefArgs;
|
||||||
|
@ -292,7 +304,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; enable them.
|
// Particular watchpoints selected; enable them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -392,7 +404,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; enable them.
|
// Particular watchpoints selected; enable them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -477,7 +489,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; disable them.
|
// Particular watchpoints selected; disable them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -560,7 +572,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; delete them.
|
// Particular watchpoints selected; delete them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -701,7 +713,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; ignore them.
|
// Particular watchpoints selected; ignore them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -858,7 +870,7 @@ protected:
|
||||||
{
|
{
|
||||||
// Particular watchpoints selected; set condition on them.
|
// Particular watchpoints selected; set condition on them.
|
||||||
std::vector<uint32_t> wp_ids;
|
std::vector<uint32_t> wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
~CommandObjectMultiwordWatchpoint ();
|
~CommandObjectMultiwordWatchpoint ();
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids);
|
VerifyWatchpointIDs(Target *target, Args &args, std::vector<uint32_t> &wp_ids);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> valid_wp_ids;
|
std::vector<uint32_t> valid_wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -678,7 +678,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> valid_wp_ids;
|
std::vector<uint32_t> valid_wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
@ -770,7 +770,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> valid_wp_ids;
|
std::vector<uint32_t> valid_wp_ids;
|
||||||
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(command, valid_wp_ids))
|
if (!CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs(target, command, valid_wp_ids))
|
||||||
{
|
{
|
||||||
result.AppendError("Invalid watchpoints specification.");
|
result.AppendError("Invalid watchpoints specification.");
|
||||||
result.SetStatus(eReturnStatusFailed);
|
result.SetStatus(eReturnStatusFailed);
|
||||||
|
|
|
@ -782,6 +782,7 @@ Target::RemoveAllWatchpoints (bool end_to_end)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_watchpoint_list.RemoveAll (true);
|
m_watchpoint_list.RemoveAll (true);
|
||||||
|
m_last_created_watchpoint.reset();
|
||||||
return true; // Success!
|
return true; // Success!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,6 +950,10 @@ Target::RemoveWatchpointByID (lldb::watch_id_t watch_id)
|
||||||
if (log)
|
if (log)
|
||||||
log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
|
log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
|
||||||
|
|
||||||
|
WatchpointSP watch_to_remove_sp = m_watchpoint_list.FindByID(watch_id);
|
||||||
|
if (watch_to_remove_sp == m_last_created_watchpoint)
|
||||||
|
m_last_created_watchpoint.reset();
|
||||||
|
|
||||||
if (DisableWatchpointByID (watch_id))
|
if (DisableWatchpointByID (watch_id))
|
||||||
{
|
{
|
||||||
m_watchpoint_list.Remove(watch_id, true);
|
m_watchpoint_list.Remove(watch_id, true);
|
||||||
|
|
Loading…
Reference in New Issue