Fix for debugger disassembly being off by one byte after using nexti
on a "call" instruction.
diff --git a/debugger/break.c b/debugger/break.c
index 3117465..b3a07ba 100644
--- a/debugger/break.c
+++ b/debugger/break.c
@@ -695,9 +695,8 @@
* Determine if we should continue execution after a SIGTRAP signal when
* executing in the given mode.
*/
-BOOL DEBUG_ShouldContinue( DWORD code, enum exec_mode mode, int * count )
+BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, int * count )
{
- DBG_ADDR addr;
int bpnum;
DWORD oldval;
int wpnum;
@@ -706,12 +705,14 @@
#ifdef __i386__
/* If not single-stepping, back up over the int3 instruction */
- if (code == EXCEPTION_BREAKPOINT)
+ if (code == EXCEPTION_BREAKPOINT)
+ {
DEBUG_context.Eip--;
+ addr->off--;
+ }
#endif
- DEBUG_GetCurrentAddress( &addr );
- bpnum = DEBUG_FindBreakpoint( &addr, DBG_BREAK );
+ bpnum = DEBUG_FindBreakpoint( addr, DBG_BREAK );
breakpoints[0].enabled = FALSE; /* disable the step-over breakpoint */
if ((bpnum != 0) && (bpnum != -1))
@@ -736,16 +737,16 @@
{
#ifdef __i386__
DEBUG_context.Eip++;
- addr.off++;
+ addr->off++;
#endif
}
if (!DEBUG_ShallBreak(wpnum)) return TRUE;
#ifdef __i386__
- if (addr.seg) addrlen = DEBUG_GetSelectorType( addr.seg );
+ if (addr->seg) addrlen = DEBUG_GetSelectorType( addr->seg );
#endif
DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum);
- syminfo = DEBUG_PrintAddress( &addr, addrlen, TRUE );
+ syminfo = DEBUG_PrintAddress( addr, addrlen, TRUE );
DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n",
oldval, breakpoints[wpnum].u.w.oldval);
@@ -761,7 +762,7 @@
*/
if( mode == EXEC_STEP_OVER || mode == EXEC_STEP_INSTR )
{
- if( DEBUG_CheckLinenoStatus(&addr) == AT_LINENUMBER )
+ if( DEBUG_CheckLinenoStatus(addr) == AT_LINENUMBER )
{
(*count)--;
}
@@ -785,7 +786,7 @@
*/
if (mode != EXEC_CONT && mode != EXEC_PASS && mode != EXEC_FINISH)
{
- DEBUG_FindNearestSymbol( &addr, TRUE, NULL, 0, &syminfo.list);
+ DEBUG_FindNearestSymbol( addr, TRUE, NULL, 0, &syminfo.list);
if( syminfo.list.sourcefile != NULL )
{
DEBUG_List(&syminfo.list, NULL, 0);
@@ -796,7 +797,10 @@
/* If there's no breakpoint and we are not single-stepping, then we */
/* must have encountered an int3 in the Windows program; let's skip it. */
if ((bpnum == -1) && code == EXCEPTION_BREAKPOINT)
+ {
DEBUG_context.Eip++;
+ addr->off++;
+ }
#endif
/* no breakpoint, continue if in continuous mode */
diff --git a/debugger/debugger.h b/debugger/debugger.h
index 9a7adec..b5c021e 100644
--- a/debugger/debugger.h
+++ b/debugger/debugger.h
@@ -241,7 +241,7 @@
extern void DEBUG_EnableBreakpoint( int num, BOOL enable );
extern void DEBUG_InfoBreakpoints(void);
extern BOOL DEBUG_HandleTrap(void);
-extern BOOL DEBUG_ShouldContinue( DWORD code, enum exec_mode mode, int * count );
+extern BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, enum exec_mode mode, int * count );
extern void DEBUG_SuspendExecution( void );
extern enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count );
extern BOOL DEBUG_IsFctReturn(void);
diff --git a/debugger/winedbg.c b/debugger/winedbg.c
index c5fb9ce..8825b70 100644
--- a/debugger/winedbg.c
+++ b/debugger/winedbg.c
@@ -296,7 +296,8 @@
DEBUG_LoadEntryPoints("Loading new modules symbols:\n");
if (!force && is_debug &&
- DEBUG_ShouldContinue(code,
+ DEBUG_ShouldContinue(&addr,
+ code,
DEBUG_CurrThread->dbg_exec_mode,
&DEBUG_CurrThread->dbg_exec_count))
return FALSE;