diff options
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 28 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.h | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpointCommand.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 5 |
4 files changed, 29 insertions, 12 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index bed490a7aa2..7a6a47e60d0 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -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); diff --git a/lldb/source/Commands/CommandObjectWatchpoint.h b/lldb/source/Commands/CommandObjectWatchpoint.h index 65bed7c154c..1b1ebd7764a 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.h +++ b/lldb/source/Commands/CommandObjectWatchpoint.h @@ -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); }; diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 0be21f1fdd5..4e200465031 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -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); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 064023e6b2e..c7638e9dbbc 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -782,6 +782,7 @@ Target::RemoveAllWatchpoints (bool end_to_end) return false; } m_watchpoint_list.RemoveAll (true); + m_last_created_watchpoint.reset(); return true; // Success! } @@ -949,6 +950,10 @@ Target::RemoveWatchpointByID (lldb::watch_id_t watch_id) 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); |