nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, jingham, labath.
nitesh.jain added subscribers: jaydeep, bhushan, slthakur, lldb-commits.

In case of MIPS, the watchpoint exception occur before associated instruction 
is executed. When watchpoint hit , we first enable the Ephemeral mode and then 
disable the associated watchpoint. After single stepping, the associated 
watchpoint is enable and Ephemeral mode is turn off. Thus preserving watchpoint 
index.


https://reviews.llvm.org/D27124

Files:
  source/Target/StopInfo.cpp


Index: source/Target/StopInfo.cpp
===================================================================
--- source/Target/StopInfo.cpp
+++ source/Target/StopInfo.cpp
@@ -692,7 +692,9 @@
             if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after)
                     .Success()) {
               if (!wp_triggers_after) {
-                process_sp->DisableWatchpoint(wp_sp.get(), false);
+                Watchpoint *wp = wp_sp.get();
+                wp->TurnOnEphemeralMode();
+                process_sp->DisableWatchpoint(wp, false);
                 StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo();
                 assert(stored_stop_info_sp.get() == this);
 
@@ -710,7 +712,8 @@
                 process_sp->GetThreadList().SetSelectedThreadByID(
                     thread_sp->GetID());
                 thread_sp->SetStopInfo(stored_stop_info_sp);
-                process_sp->EnableWatchpoint(wp_sp.get(), false);
+                process_sp->EnableWatchpoint(wp, false);
+                wp->TurnOffEphemeralMode();
               }
             }
           }


Index: source/Target/StopInfo.cpp
===================================================================
--- source/Target/StopInfo.cpp
+++ source/Target/StopInfo.cpp
@@ -692,7 +692,9 @@
             if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after)
                     .Success()) {
               if (!wp_triggers_after) {
-                process_sp->DisableWatchpoint(wp_sp.get(), false);
+                Watchpoint *wp = wp_sp.get();
+                wp->TurnOnEphemeralMode();
+                process_sp->DisableWatchpoint(wp, false);
                 StopInfoSP stored_stop_info_sp = thread_sp->GetStopInfo();
                 assert(stored_stop_info_sp.get() == this);
 
@@ -710,7 +712,8 @@
                 process_sp->GetThreadList().SetSelectedThreadByID(
                     thread_sp->GetID());
                 thread_sp->SetStopInfo(stored_stop_info_sp);
-                process_sp->EnableWatchpoint(wp_sp.get(), false);
+                process_sp->EnableWatchpoint(wp, false);
+                wp->TurnOffEphemeralMode();
               }
             }
           }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to