winedbg: enhancing symbol lookup

Eric Pouech eric.pouech at wanadoo.fr
Mon Sep 9 14:41:53 CDT 2002


Fabian Cardenes keeping his hard work of finding bug throughout wine
noticed that, when looking for a symbol in the debugger, and when
multiple symbols with the same name were present, you couldn't abort the
lookup...
this patch brings this feature back to life (it had been partly
implemented, and quite broken afterwards)

this patch requires the other winedbg patch (readline) to function
properly

A+
-------------- next part --------------
Name:          wd_sym_abrt
ChangeLog:     added ability to abort on interactive symbol lookup
License:       X11
GenDate:       2002/09/09 19:36:11 UTC
ModifiedFiles: debugger/break.c debugger/dbg.y debugger/debugger.h debugger/hash.c debugger/expr.c debugger/info.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/break.c,v
retrieving revision 1.35
diff -u -u -r1.35 break.c
--- debugger/break.c	30 Jul 2002 00:06:34 -0000	1.35
+++ debugger/break.c	2 Sep 2002 19:39:59 -0000
@@ -421,10 +421,15 @@
     DBG_VALUE 	value;
     int		i;
 
-    if (DEBUG_GetSymbolValue(name, lineno, &value, TRUE))
+    switch (DEBUG_GetSymbolValue(name, lineno, &value, TRUE))
     {
+    case TRUE:
         DEBUG_AddBreakpoint(&value, NULL, TRUE);
         return;
+    case FALSE:
+        break;
+    case ABORT: /* user aborted symbol lookup */
+        return;
     }
 
     DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint, will check again when a new DLL is loaded\n");
@@ -487,11 +492,11 @@
     {
         if (dbp[i].is_symbol)
         {
-            if (!DEBUG_GetSymbolValue(dbp[i].u.symbol.name, dbp[i].u.symbol.lineno, &value, TRUE))
+            if (DEBUG_GetSymbolValue(dbp[i].u.symbol.name, dbp[i].u.symbol.lineno, &value, TRUE) != TRUE)
                 continue;
         }
         else
             value = dbp[i].u.value;
         DEBUG_Printf(DBG_CHN_MESG, "trying to add delayed %s-bp\n", dbp[i].is_symbol ? "S" : "A");
         if (!dbp[i].is_symbol)
             DEBUG_Printf(DBG_CHN_MESG, "\t%04x %04lx:%08lx\n",
@@ -586,10 +593,17 @@
 {
    DBG_VALUE value;
 
-   if( DEBUG_GetSymbolValue(name, -1, &value, TRUE) )
+   switch (DEBUG_GetSymbolValue(name, -1, &value, TRUE))
+   {
+   case TRUE:
       DEBUG_AddWatchpoint( &value, 1 );
-   else
+      break;
+   case FALSE:
       DEBUG_Printf(DBG_CHN_MESG, "Unable to add watchpoint\n");
+      break;
+   case ABORT: /* user aborted symbol lookup */
+       break;
+   }
 }
 
 /***********************************************************************
Index: debugger/dbg.y
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/dbg.y,v
retrieving revision 1.63
diff -u -u -r1.63 dbg.y
--- debugger/dbg.y	13 Aug 2002 18:04:01 -0000	1.63
+++ debugger/dbg.y	2 Sep 2002 19:44:42 -0000
@@ -405,6 +408,8 @@
    case DEBUG_STATUS_NO_FIELD:
       DEBUG_Printf(DBG_CHN_MESG, "No such field in structure or union\n");
       break;
+   case DEBUG_STATUS_ABORT:
+       break;
    default:
       DEBUG_Printf(DBG_CHN_MESG, "Exception %lx\n", GetExceptionCode());
       DEBUG_ExternalDebugger();
Index: debugger/debugger.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/debugger.h,v
retrieving revision 1.42
diff -u -u -r1.42 debugger.h
--- debugger/debugger.h	13 Aug 2002 18:04:02 -0000	1.42
+++ debugger/debugger.h	2 Sep 2002 19:39:24 -0000
@@ -32,6 +32,8 @@
 #define V86_FLAG  0x00020000
 #endif
 
+#define ABORT   ((BOOL)-1)
+
 #define SYM_FUNC	 0x0
 #define SYM_DATA	 0x1
 #define SYM_WIN32	 0x2
@@ -582,6 +584,7 @@
 #define	DEBUG_STATUS_DIV_BY_ZERO	(DEBUG_STATUS_OFFSET+2)
 #define	DEBUG_STATUS_BAD_TYPE		(DEBUG_STATUS_OFFSET+3)
 #define DEBUG_STATUS_NO_FIELD		(DEBUG_STATUS_OFFSET+4)
+#define DEBUG_STATUS_ABORT              (DEBUG_STATUS_OFFSET+5)
 
 extern DBG_INTVAR		DEBUG_IntVars[];
 
Index: debugger/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/hash.c,v
retrieving revision 1.33
diff -u -u -r1.33 hash.c
--- debugger/hash.c	23 Jul 2002 20:53:41 -0000	1.33
+++ debugger/hash.c	2 Sep 2002 19:54:20 -0000
@@ -346,6 +346,11 @@
  *           DEBUG_GetSymbolValue
  *
  * Get the address of a named symbol.
+ * Return values:
+ *      TRUE if the symbol is found
+ *      FALSE if the symbol isn't found
+ *      ABORT: some error occured (likely, many symbols of same name exist, 
+ *          and user didn't pick one of them)
  */
 static int    DEBUG_GSV_Helper(const char* name, const int lineno,
 			       DBG_VALUE* value, int num, int bp_flag)
@@ -429,6 +434,7 @@
 	  i = 0;
 	  if (DEBUG_ReadLine("=> ", buffer, sizeof(buffer)))
 	  {
+              if (buffer[0] == '\0') return ABORT;
 	      i = atoi(buffer);
 	      if (i < 1 || i > num)
 		  DEBUG_Printf(DBG_CHN_MESG, "Invalid choice %d\n", i);
Index: debugger/expr.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/expr.c,v
retrieving revision 1.27
diff -u -u -r1.27 expr.c
--- debugger/expr.c	31 May 2002 23:06:46 -0000	1.27
+++ debugger/expr.c	2 Sep 2002 19:39:59 -0000
@@ -350,10 +356,16 @@
       rtn.addr.seg = 0;
       break;
     case EXPR_TYPE_SYMBOL:
-      if( !DEBUG_GetSymbolValue(exp->un.symbol.name, -1, &rtn, FALSE) )
+      switch (DEBUG_GetSymbolValue(exp->un.symbol.name, -1, &rtn, FALSE))
       {
-	  DEBUG_Printf(DBG_CHN_MESG, "%s\n", exp->un.symbol.name);
+      case TRUE:
+          break;
+      case FALSE:
 	  RaiseException(DEBUG_STATUS_NO_SYMBOL, 0, 0, NULL);
+          /* should never be here */
+      case ABORT:
+          RaiseException(DEBUG_STATUS_ABORT, 0, 0, NULL);
+          /* should never be here */
       }
       break;
     case EXPR_TYPE_PSTRUCT:
@@ -408,10 +420,17 @@
       /*
        * Now look up the address of the function itself.
        */
-      if( !DEBUG_GetSymbolValue(exp->un.call.funcname, -1, &rtn, FALSE ) )
-	{
+      switch (DEBUG_GetSymbolValue(exp->un.call.funcname, -1, &rtn, FALSE ))
+      {
+      case TRUE:
+          break;
+      case FALSE:
 	  RaiseException(DEBUG_STATUS_NO_SYMBOL, 0, 0, NULL);
-	}
+          /* should never be here */
+      case ABORT:
+          RaiseException(DEBUG_STATUS_ABORT, 0, 0, NULL);
+          /* should never be here */
+      }
 
 #if 0
       /* FIXME: NEWDBG NIY */
Index: debugger/info.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/info.c,v
retrieving revision 1.29
diff -u -u -r1.29 info.c
--- debugger/info.c	26 Aug 2002 21:48:05 -0000	1.29
+++ debugger/info.c	2 Sep 2002 19:37:34 -0000
@@ -709,7 +709,7 @@
     BOOL                        bAll;
     void*                       addr;
 
-    if (!DEBUG_GetSymbolValue("first_dll", -1, &val, FALSE))
+    if (DEBUG_GetSymbolValue("first_dll", -1, &val, FALSE) != TRUE)
     {
         DEBUG_Printf(DBG_CHN_MESG, "Can't get first_option symbol");
         return;


More information about the wine-patches mailing list