[RESENT] winedbg: Fix stepping over

Petr Tesarik petr at tesarici.cz
Fri Mar 24 05:46:10 CST 2006


Hi,

this patch fixes a bug in winedbg, which caused it to continue
execution at a wrong address when stepping over a function call.
The trouble was that if there was no breakpoint found, the code at the
end of break_should_continue reversed the PC adjustment and later the
debugger resumed program execution AFTER the INT3 instruction, which
is clearly wrong.

This patch also handles the count. WRT Eric Pouech:

> you don't handle the count here...
> what you should do is only compute dbg_curr_thread->stopped_xpoint (and 
> do the appropriate handling) when its current value is -1 (not found)

ChangeLog:

* Fix stepping over an instruction
-------------- next part --------------
Index: break.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/break.c,v
retrieving revision 1.17
diff -u -r1.17 break.c
--- break.c	27 Jan 2006 15:22:15 -0000	1.17
+++ break.c	24 Mar 2006 11:43:35 -0000
@@ -731,9 +731,9 @@
     if (code == EXCEPTION_BREAKPOINT)
         addr->Offset += be_cpu->adjust_pc_for_break(&dbg_context, TRUE);
 
+    dbg_curr_thread->stopped_xpoint = find_xpoint(addr, be_xpoint_break);
     dbg_curr_process->bp[0].enabled = FALSE;  /* disable the step-over breakpoint */
 
-    dbg_curr_thread->stopped_xpoint = find_xpoint(addr, be_xpoint_break);
     if (dbg_curr_thread->stopped_xpoint > 0)
     {
         if (!should_stop(dbg_curr_thread->stopped_xpoint)) return TRUE;
@@ -744,7 +744,8 @@
         return FALSE;
     }
 
-    dbg_curr_thread->stopped_xpoint = find_xpoint(addr, be_xpoint_watch_exec);
+    if(dbg_curr_thread->stopped_xpoint < 0)
+        dbg_curr_thread->stopped_xpoint = find_xpoint(addr, be_xpoint_watch_exec);
     if (dbg_curr_thread->stopped_xpoint > 0)
     {
         /* If not single-stepping, do not back up over the break instruction */
@@ -759,7 +760,8 @@
         return FALSE;
     }
 
-    dbg_curr_thread->stopped_xpoint = find_triggered_watch(&oldval);
+    if(dbg_curr_thread->stopped_xpoint < 0)
+        dbg_curr_thread->stopped_xpoint = find_triggered_watch(&oldval);
     if (dbg_curr_thread->stopped_xpoint > 0)
     {
         /* If not single-stepping, do not back up over the break instruction */


More information about the wine-patches mailing list