winedbg: disassembly readabiltiy patch

Mike McCormack mike at codeweavers.com
Thu Jul 17 14:41:35 CDT 2003


ChangeLog:
* When doing disassembly in winedbg, only show the symbol info once
   per disassembly, rather than on every line.
-------------- next part --------------
Index: programs/winedbg/break.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/break.c,v
retrieving revision 1.2
diff -u -r1.2 break.c
--- programs/winedbg/break.c	16 Sep 2002 19:26:48 -0000	1.2
+++ programs/winedbg/break.c	17 Jul 2003 19:40:03 -0000
@@ -362,7 +362,7 @@
 
     DEBUG_Printf( DBG_CHN_MESG, "Breakpoint %d at ", num );
     DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16,
-			TRUE );
+			TRUE, TRUE );
     DEBUG_Printf( DBG_CHN_MESG, "\n" );
 
     return FALSE;
@@ -577,7 +577,7 @@
       breakpoints[reg].u.w.reg = reg;
 
       DEBUG_Printf( DBG_CHN_MESG, "Watchpoint %d at ", num );
-      DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16, TRUE );
+      DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16, TRUE, TRUE );
       DEBUG_Printf( DBG_CHN_MESG, "\n" );
    }
 }
@@ -735,7 +735,7 @@
         {
             DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
             DEBUG_PrintAddress( &breakpoints[i].addr,
-				breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
+				breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE, TRUE);
             DEBUG_Printf( DBG_CHN_MESG, " (%u)\n", breakpoints[i].refcount );
 	    if( breakpoints[i].condition != NULL )
 	    {
@@ -752,7 +752,7 @@
         {
             DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
             DEBUG_PrintAddress( &breakpoints[i].addr,
-				breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
+				breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE, TRUE);
             DEBUG_Printf( DBG_CHN_MESG, " on %d byte%s (%c)\n",
 		     breakpoints[i].u.w.len + 1,
 		     breakpoints[i].u.w.len > 0 ? "s" : "",
@@ -836,7 +836,7 @@
 
         DEBUG_Printf( DBG_CHN_MESG, "Stopped on breakpoint %d at ", bpnum );
         syminfo = DEBUG_PrintAddress( &breakpoints[bpnum].addr,
-				      breakpoints[bpnum].is32 ? MODE_32 : MODE_16, TRUE );
+				      breakpoints[bpnum].is32 ? MODE_32 : MODE_16, TRUE, TRUE );
         DEBUG_Printf( DBG_CHN_MESG, "\n" );
 
 	if( syminfo.list.sourcefile != NULL )
@@ -859,7 +859,7 @@
 
        addr_mode = DEBUG_GetSelectorType( addr->seg );
        DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum);
-       syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE );
+       syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE, TRUE );
 
        DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n",
                     oldval, breakpoints[wpnum].u.w.oldval);
Index: programs/winedbg/db_disasm.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/db_disasm.c,v
retrieving revision 1.1
diff -u -r1.1 db_disasm.c
--- programs/winedbg/db_disasm.c	13 Sep 2002 17:54:28 -0000	1.1
+++ programs/winedbg/db_disasm.c	17 Jul 2003 19:40:03 -0000
@@ -1188,7 +1188,7 @@
     address.seg = 0;
     address.off = addr;
 
-    DEBUG_PrintAddress( &address, db_disasm_16 ? MODE_16 : MODE_32, TRUE );
+    DEBUG_PrintAddress( &address, db_disasm_16 ? MODE_16 : MODE_32, TRUE, TRUE );
 }
 
 void db_print_address(char *seg, int size, struct i_addr *addrp, int byref)
@@ -1810,7 +1810,7 @@
                                        2, FALSE );
 			if( db_display )
 			  {
-			    DEBUG_PrintAddress( &address, short_addr ? MODE_16 : MODE_32, TRUE );
+			    DEBUG_PrintAddress( &address, short_addr ? MODE_16 : MODE_32, TRUE, TRUE );
 			  }
 
                     }
Index: programs/winedbg/debugger.h
===================================================================
RCS file: /home/wine/wine/programs/winedbg/debugger.h,v
retrieving revision 1.9
diff -u -r1.9 debugger.h
--- programs/winedbg/debugger.h	1 Apr 2003 00:02:36 -0000	1.9
+++ programs/winedbg/debugger.h	17 Jul 2003 19:40:03 -0000
@@ -390,7 +390,7 @@
   /* debugger/info.c */
 extern void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format );
 extern struct symbol_info DEBUG_PrintAddress( const DBG_ADDR *addr,
-					      enum dbg_mode mode, int flag );
+				      enum dbg_mode mode, int flag, int show_name );
 extern void DEBUG_Help(void);
 extern void DEBUG_HelpInfo(void);
 extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
Index: programs/winedbg/hash.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/hash.c,v
retrieving revision 1.9
diff -u -r1.9 hash.c
--- programs/winedbg/hash.c	15 Jul 2003 20:53:40 -0000	1.9
+++ programs/winedbg/hash.c	17 Jul 2003 19:40:03 -0000
@@ -445,7 +445,7 @@
              else
                  DEBUG_Printf(DBG_CHN_MESG, "local variable\n");
          } else {
-             DEBUG_PrintAddress( &value[i].addr, DEBUG_GetSelectorType(value[i].addr.seg), TRUE);
+             DEBUG_PrintAddress( &value[i].addr, DEBUG_GetSelectorType(value[i].addr.seg), TRUE, TRUE);
              DEBUG_Printf(DBG_CHN_MESG, "\n");
          }
       }
Index: programs/winedbg/info.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/info.c,v
retrieving revision 1.5
diff -u -r1.5 info.c
--- programs/winedbg/info.c	14 Feb 2003 19:22:48 -0000	1.5
+++ programs/winedbg/info.c	17 Jul 2003 19:40:03 -0000
@@ -154,12 +154,13 @@
  * Print an 16- or 32-bit address, with the nearest symbol if any.
  */
 struct symbol_info
-DEBUG_PrintAddress( const DBG_ADDR *addr, enum dbg_mode mode, int flag )
+DEBUG_PrintAddress( const DBG_ADDR *addr, enum dbg_mode mode, int flag, int show_name )
 {
     struct symbol_info rtn;
+    const char *name = NULL;
 
-    const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0,
-						&rtn.list );
+    if( show_name )
+        name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0, &rtn.list );
 
     if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg&0xFFFF );
     if (mode != MODE_32) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx", addr->off );
Index: programs/winedbg/memory.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/memory.c,v
retrieving revision 1.3
diff -u -r1.3 memory.c
--- programs/winedbg/memory.c	13 Nov 2002 04:07:46 -0000	1.3
+++ programs/winedbg/memory.c	17 Jul 2003 19:40:03 -0000
@@ -135,7 +135,7 @@
 void	DEBUG_InvalAddr( const DBG_ADDR* addr )
 {
    DEBUG_Printf(DBG_CHN_MESG,"*** Invalid address ");
-   DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, FALSE);
+   DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, FALSE, FALSE);
    DEBUG_Printf(DBG_CHN_MESG,"\n");
    if (DBG_IVAR(ExtDbgOnInvalidAddress)) DEBUG_ExternalDebugger();
 }
@@ -271,7 +271,7 @@
 
     if (format != 'i' && count > 1)
     {
-        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );
+        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE, FALSE );
         DEBUG_Printf(DBG_CHN_MESG,": ");
     }
 
@@ -305,7 +305,7 @@
                     value.addr.off += sizeof(guid);
                     if (count)
                     {
-                        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );
+                        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE, FALSE );
                         DEBUG_Printf(DBG_CHN_MESG,": ");
                     }
                 }
@@ -319,7 +319,7 @@
                     pnt += sizeof(_t); value.addr.off += sizeof(_t); \
                     if ((i % (_l)) == (_l)-1) { \
                         DEBUG_Printf(DBG_CHN_MESG,"\n"); \
-                        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );\
+                        DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE, FALSE );\
                         DEBUG_Printf(DBG_CHN_MESG,": ");\
                     } \
 		} \
Index: programs/winedbg/source.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/source.c,v
retrieving revision 1.2
diff -u -r1.2 source.c
--- programs/winedbg/source.c	11 Feb 2003 22:07:16 -0000	1.2
+++ programs/winedbg/source.c	17 Jul 2003 19:40:03 -0000
@@ -439,7 +439,7 @@
    char		ch;
    BOOL		ret = TRUE;
 
-   DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, TRUE);
+   DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, TRUE, FALSE);
    DEBUG_Printf(DBG_CHN_MESG, ": ");
    if (!DEBUG_READ_MEM_VERBOSE((void*)DEBUG_ToLinear(addr), &ch, sizeof(ch))) {
       DEBUG_Printf(DBG_CHN_MESG, "-- no code --");
@@ -471,6 +471,9 @@
     if (!last.seg && !last.off)
       DEBUG_GetCurrentAddress( &last );
 
+    DEBUG_PrintAddress(&last, DEBUG_CurrThread->dbg_mode, TRUE, TRUE);
+    DEBUG_Printf(DBG_CHN_MESG,"\n");
+
     for (i=0;i<offset;i++)
       if (!DEBUG_DisassembleInstruction(&last)) break;
     DEBUG_LastDisassemble = last;
@@ -478,6 +481,9 @@
   }
   last = start.addr;
   if (!xend) {
+    DEBUG_PrintAddress(&last, DEBUG_CurrThread->dbg_mode, TRUE, TRUE);
+    DEBUG_Printf(DBG_CHN_MESG,"\n");
+
     for (i=0;i<offset;i++)
       if (!DEBUG_DisassembleInstruction(&last)) break;
     DEBUG_LastDisassemble = last;
Index: programs/winedbg/winedbg.c
===================================================================
RCS file: /home/wine/wine/programs/winedbg/winedbg.c,v
retrieving revision 1.12
diff -u -r1.12 winedbg.c
--- programs/winedbg/winedbg.c	30 Jun 2003 20:19:42 -0000	1.12
+++ programs/winedbg/winedbg.c	17 Jul 2003 19:40:03 -0000
@@ -591,7 +591,7 @@
 		addr.off = rec->ExceptionInformation[0];
 
 		DEBUG_Printf(DBG_CHN_MESG, "wait failed on critical section ");
-		DEBUG_PrintAddress(&addr, DEBUG_CurrThread->dbg_mode, FALSE);
+		DEBUG_PrintAddress(&addr, DEBUG_CurrThread->dbg_mode, FALSE, TRUE);
 	    }
 	    if (!DBG_IVAR(BreakOnCritSectTimeOut))
 	    {


More information about the wine-patches mailing list