[Lldb-commits] [lldb] r185406 - Use the "last created watchpoint" rather than asserting on watchpoint commands passing no watchpoint ID.
Jim Ingham
jingham at apple.com
Mon Jul 1 19:09:46 PDT 2013
Author: jingham
Date: Mon Jul 1 21:09:46 2013
New Revision: 185406
URL: http://llvm.org/viewvc/llvm-project?rev=185406&view=rev
Log:
Use the "last created watchpoint" rather than asserting on watchpoint commands passing no watchpoint ID.
<rdar://problem/14327560>
Modified:
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.h
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=185406&r1=185405&r2=185406&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Mon Jul 1 21:09:46 2013
@@ -88,10 +88,22 @@ WithRSAIndex(llvm::StringRef &Arg)
// Return true if wp_ids is successfully populated with the watch ids.
// False otherwise.
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.
- 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("-");
std::vector<llvm::StringRef> StrRefArgs;
@@ -292,7 +304,7 @@ protected:
{
// Particular watchpoints selected; enable them.
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.SetStatus(eReturnStatusFailed);
@@ -392,7 +404,7 @@ protected:
{
// Particular watchpoints selected; enable them.
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.SetStatus(eReturnStatusFailed);
@@ -477,7 +489,7 @@ protected:
{
// Particular watchpoints selected; disable them.
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.SetStatus(eReturnStatusFailed);
@@ -560,7 +572,7 @@ protected:
{
// Particular watchpoints selected; delete them.
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.SetStatus(eReturnStatusFailed);
@@ -701,7 +713,7 @@ protected:
{
// Particular watchpoints selected; ignore them.
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.SetStatus(eReturnStatusFailed);
@@ -858,7 +870,7 @@ protected:
{
// Particular watchpoints selected; set condition on them.
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.SetStatus(eReturnStatusFailed);
Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.h?rev=185406&r1=185405&r2=185406&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.h (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.h Mon Jul 1 21:09:46 2013
@@ -34,7 +34,7 @@ public:
~CommandObjectMultiwordWatchpoint ();
static bool
- VerifyWatchpointIDs(Args &args, std::vector<uint32_t> &wp_ids);
+ VerifyWatchpointIDs(Target *target, Args &args, std::vector<uint32_t> &wp_ids);
};
Modified: lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp?rev=185406&r1=185405&r2=185406&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp Mon Jul 1 21:09:46 2013
@@ -512,7 +512,7 @@ protected:
}
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.SetStatus(eReturnStatusFailed);
@@ -678,7 +678,7 @@ protected:
}
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.SetStatus(eReturnStatusFailed);
@@ -770,7 +770,7 @@ protected:
}
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.SetStatus(eReturnStatusFailed);
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=185406&r1=185405&r2=185406&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Jul 1 21:09:46 2013
@@ -782,6 +782,7 @@ Target::RemoveAllWatchpoints (bool end_t
return false;
}
m_watchpoint_list.RemoveAll (true);
+ m_last_created_watchpoint.reset();
return true; // Success!
}
@@ -949,6 +950,10 @@ Target::RemoveWatchpointByID (lldb::watc
if (log)
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))
{
m_watchpoint_list.Remove(watch_id, true);
More information about the lldb-commits
mailing list