WineDbg cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this patch implements some cleanup in winedbg command set
- it removes the no longer used queue & modref related commands
basically, 'walk modref', 'walk queue'
- it protected all walk commands while being called with no process loaded
- for some commands, it allows some expressions while only numbers where accepted (walk except)
- it renammes 'info maps' into 'walk maps' and let it work on any process (with an additional parameter)
A+

--
Eric Pouech
Name:          wd_cmd
ChangeLog:     
	- Removed no longer used queue & modref related commands
	- Protected walk commands while being called with no process loaded
	- In command grammar, allowed some expressions while only numbers where accepted
	- Renammed 'info maps' info 'walk maps' and let it work on any process
License:       X11
GenDate:       2003/01/28 20:07:21 UTC
ModifiedFiles: programs/winedbg/debugger.h programs/winedbg/debug.l programs/winedbg/dbg.y programs/winedbg/info.c programs/winedbg/module.c documentation/debugger.sgml
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/debugger.h,v
retrieving revision 1.3
diff -u -u -r1.3 debugger.h
--- programs/winedbg/debugger.h	11 Jan 2003 22:48:42 -0000	1.3
+++ programs/winedbg/debugger.h	12 Jan 2003 09:04:44 -0000
@@ -248,7 +248,7 @@
 extern	DBG_THREAD*	DEBUG_CurrThread;
 extern	DWORD		DEBUG_CurrTid;
 extern	DWORD		DEBUG_CurrPid;
-extern  CONTEXT		DEBUG_context;
+extern  CONTEXT 	DEBUG_context;
 extern  BOOL		DEBUG_InteractiveP;
 extern  enum exit_mode  DEBUG_ExitMode;
 extern  HANDLE          DEBUG_hParserInput;
@@ -402,16 +402,13 @@
 						     int flag );
 extern void DEBUG_InfoClass(const char* clsName);
 extern void DEBUG_WalkClasses(void);
-extern void DEBUG_WalkModref(DWORD p);
 extern void DEBUG_DumpModule(DWORD mod);
 extern void DEBUG_WalkModules(void);
 extern void DEBUG_WalkProcess(void);
 extern void DEBUG_WalkThreads(void);
 extern void DEBUG_WalkExceptions(DWORD tid);
-extern void DEBUG_DumpQueue(DWORD q);
-extern void DEBUG_WalkQueues(void);
 extern void DEBUG_InfoSegments(DWORD s, int v);
-extern void DEBUG_InfoVirtual(void);
+extern void DEBUG_InfoVirtual(DWORD pid);
 extern void DEBUG_InfoWindow(HWND hWnd);
 extern void DEBUG_WalkWindows(HWND hWnd, int indent);
 extern void DEBUG_DbgChannel(BOOL add, const char* chnl, const char* name);
Index: programs/winedbg/debug.l
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/debug.l,v
retrieving revision 1.2
diff -u -u -r1.2 debug.l
--- programs/winedbg/debug.l	11 Jan 2003 22:48:42 -0000	1.2
+++ programs/winedbg/debug.l	12 Jan 2003 08:48:37 -0000
@@ -144,16 +144,14 @@
 <INFO_CMD>locals|local|loca|loc		{ return tLOCAL; }
 <INFO_CMD,WALK_CMD>class|clas|cla       { return tCLASS; }
 <INFO_CMD,WALK_CMD>module|modul|modu|mod { return tMODULE; }
-<INFO_CMD,WALK_CMD>queue|queu|que	{ return tQUEUE; }
 <INFO_CMD,WALK_CMD>process|proces|proce|proc   		{ return tPROCESS; }
 <INFO_CMD,WALK_CMD>threads|thread|threa|thre|thr|th { return tTHREAD; }
-<INFO_CMD,WALK_CMD>modref|modre|modr	{ return tMODREF; }
 <WALK_CMD>exception|except|exc|ex	{ return tEXCEPTION; }
 <INFO_CMD>registers|regs|reg|re		{ return tREGS; }
 <INFO_CMD>segments|segment|segm|seg|se	{ return tSEGMENTS; }
 <INFO_CMD>stack|stac|sta|st     	{ return tSTACK; }
 <INFO_CMD>symbol|sym                    { BEGIN(ASTRING_EXPECTED); return tSYMBOL; }
-<INFO_CMD>maps|map			{ return tMAPS; }
+<WALK_CMD>maps|map			{ return tMAPS; }
 <INFO_CMD,WALK_CMD>window|windo|wind|win|wnd	{ return tWND; }
 <HELP_CMD>info|inf|in                   { return tINFO; }
 <MODE_CMD>vm86                          { return tVM86; }
Index: programs/winedbg/dbg.y
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/dbg.y,v
retrieving revision 1.4
diff -u -u -r1.4 dbg.y
--- programs/winedbg/dbg.y	11 Jan 2003 22:48:42 -0000	1.4
+++ programs/winedbg/dbg.y	12 Jan 2003 09:05:48 -0000
@@ -52,6 +52,8 @@
 
 %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
 %token tENABLE tDISABLE tBREAK tWATCH tDELETE tSET tMODE tPRINT tEXAM tABORT tVM86
+%token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tSYMBOL tREGS tWND tLOCAL tEXCEPTION
+%token tPROCESS tTHREAD tEOL tEOF
 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tSYMBOL tREGS tWND tQUEUE tLOCAL tEXCEPTION
 %token tPROCESS tTHREAD tMODREF tEOL tEOF
 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
@@ -104,7 +106,7 @@
     ;
 
 command:
-      tQUIT tEOL		{ /*DEBUG_Quit();*/ return 1; }
+      tQUIT tEOL                { /*DEBUG_Quit();*/ return 1; }
     | tHELP tEOL                { DEBUG_Help(); }
     | tHELP tINFO tEOL          { DEBUG_HelpInfo(); }
     | tPASS tEOL                { DEBUG_WaitNextException(DBG_EXCEPTION_NOT_HANDLED, 0, 0); }
@@ -122,8 +124,8 @@
     | tABORT tEOL              	{ kill(getpid(), SIGABRT); }
     | tMODE tNUM tEOL          	{ mode_command($2); }
     | tMODE tVM86 tEOL         	{ DEBUG_CurrThread->dbg_mode = MODE_VM86; }
-    | tENABLE tNUM tEOL        	{ DEBUG_EnableBreakpoint( $2, TRUE ); }
-    | tDISABLE tNUM tEOL       	{ DEBUG_EnableBreakpoint( $2, FALSE ); }
+    | tENABLE tNUM tEOL         { DEBUG_EnableBreakpoint( $2, TRUE ); }
+    | tDISABLE tNUM tEOL        { DEBUG_EnableBreakpoint( $2, FALSE ); }
     | tDELETE tBREAK tNUM tEOL 	{ DEBUG_DelBreakpoint( $3 ); }
     | tBACKTRACE tEOL	       	{ DEBUG_BackTrace(DEBUG_CurrTid, TRUE); }
     | tBACKTRACE tNUM tEOL     	{ DEBUG_BackTrace($2, TRUE); }
@@ -165,28 +167,28 @@
 
 set_command:
       tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory(&$2, $4); DEBUG_FreeExprMem(); }
-    | tSET '+' tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, NULL, $3);}
-    | tSET '-' tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, NULL, $3);}
-    | tSET tIDENTIFIER '+' tIDENTIFIER tEOL {DEBUG_DbgChannel(TRUE, $2, $4);}
-    | tSET tIDENTIFIER '-' tIDENTIFIER tEOL {DEBUG_DbgChannel(FALSE, $2, $4);}
+    | tSET '+' tIDENTIFIER tEOL { DEBUG_DbgChannel(TRUE, NULL, $3); }
+    | tSET '-' tIDENTIFIER tEOL { DEBUG_DbgChannel(FALSE, NULL, $3); }
+    | tSET tIDENTIFIER '+' tIDENTIFIER tEOL { DEBUG_DbgChannel(TRUE, $2, $4); }
+    | tSET tIDENTIFIER '-' tIDENTIFIER tEOL { DEBUG_DbgChannel(FALSE, $2, $4); }
     ;
 
 pathname:
-      tIDENTIFIER              { $$ = $1; }
-    | tPATH		       { $$ = $1; }
+      tIDENTIFIER               { $$ = $1; }
+    | tPATH                     { $$ = $1; }
     ;
 
 disassemble_command:
-      tDISASSEMBLE tEOL              { DEBUG_Disassemble( NULL, NULL, 10 ); }
-    | tDISASSEMBLE expr_addr tEOL    { DEBUG_Disassemble( & $2, NULL, 10 ); }
+      tDISASSEMBLE tEOL         { DEBUG_Disassemble( NULL, NULL, 10 ); }
+    | tDISASSEMBLE expr_addr tEOL       { DEBUG_Disassemble( & $2, NULL, 10 ); }
     | tDISASSEMBLE expr_addr ',' expr_addr tEOL { DEBUG_Disassemble( & $2, & $4, 0 ); }
     ;
 
 list_command:
-      tLIST tEOL               { DEBUG_List( NULL, NULL, 10 ); }
-    | tLIST '-' tEOL	       { DEBUG_List( NULL, NULL, -10 ); }
-    | tLIST list_arg tEOL      { DEBUG_List( & $2, NULL, 10 ); }
-    | tLIST ',' list_arg tEOL  { DEBUG_List( NULL, & $3, -10 ); }
+      tLIST tEOL                { DEBUG_List( NULL, NULL, 10 ); }
+    | tLIST '-' tEOL            { DEBUG_List( NULL, NULL, -10 ); }
+    | tLIST list_arg tEOL       { DEBUG_List( & $2, NULL, 10 ); }
+    | tLIST ',' list_arg tEOL   { DEBUG_List( NULL, & $3, -10 ); }
     | tLIST list_arg ',' list_arg tEOL { DEBUG_List( & $2, & $4, 0 ); }
     ;
 
@@ -229,13 +231,11 @@
     | tINFO tCLASS tSTRING tEOL	{ DEBUG_InfoClass( $3 ); }
     | tINFO tSHARE tEOL		{ DEBUG_InfoShare(); }
     | tINFO tMODULE expr_value tEOL   { DEBUG_DumpModule( $3 ); DEBUG_FreeExprMem(); }
-    | tINFO tQUEUE expr_value tEOL    { DEBUG_DumpQueue( $3 ); DEBUG_FreeExprMem(); }
     | tINFO tREGS tEOL          { DEBUG_InfoRegisters(&DEBUG_context); }
     | tINFO tSEGMENTS expr_value tEOL { DEBUG_InfoSegments( $3, 1 ); DEBUG_FreeExprMem(); }
     | tINFO tSEGMENTS tEOL      { DEBUG_InfoSegments( 0, -1 ); }
     | tINFO tSTACK tEOL         { DEBUG_InfoStack(); }
-    | tINFO tSYMBOL tSTRING     { DEBUG_InfoSymbols($3); }
-    | tINFO tMAPS tEOL          { DEBUG_InfoVirtual(); }
+    | tINFO tSYMBOL tSTRING tEOL{ DEBUG_InfoSymbols($3); }
     | tINFO tWND expr_value tEOL{ DEBUG_InfoWindow( (HWND)$3 ); DEBUG_FreeExprMem(); }
     | tINFO tLOCAL tEOL         { DEBUG_InfoLocals(); }
     | tINFO tDISPLAY tEOL       { DEBUG_InfoDisplay(); }
@@ -244,14 +244,14 @@
 walk_command:
       tWALK tCLASS tEOL         { DEBUG_WalkClasses(); }
     | tWALK tMODULE tEOL        { DEBUG_WalkModules(); }
-    | tWALK tQUEUE tEOL         { DEBUG_WalkQueues(); }
     | tWALK tWND tEOL           { DEBUG_WalkWindows( 0, 0 ); }
-    | tWALK tWND tNUM tEOL      { DEBUG_WalkWindows( (HWND)$3, 0 ); }
+    | tWALK tWND expr_value tEOL{ DEBUG_WalkWindows( (HWND)$3, 0 ); DEBUG_FreeExprMem(); }
+    | tWALK tMAPS tEOL          { DEBUG_InfoVirtual(0); }
+    | tWALK tMAPS expr_value tEOL { DEBUG_InfoVirtual($3); DEBUG_FreeExprMem(); }
     | tWALK tPROCESS tEOL       { DEBUG_WalkProcess(); }
     | tWALK tTHREAD tEOL        { DEBUG_WalkThreads(); }
-    | tWALK tEXCEPTION tEOL           { DEBUG_WalkExceptions(DEBUG_CurrTid); }
-    | tWALK tEXCEPTION tNUM tEOL      { DEBUG_WalkExceptions($3); }
-    | tWALK tMODREF expr_value tEOL   { DEBUG_WalkModref( $3 ); DEBUG_FreeExprMem(); }
+    | tWALK tEXCEPTION tEOL     { DEBUG_WalkExceptions(DEBUG_CurrTid); }
+    | tWALK tEXCEPTION expr_value tEOL{ DEBUG_WalkExceptions($3); DEBUG_FreeExprMem(); }
     ;
 
 run_command:
Index: programs/winedbg/info.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/info.c,v
retrieving revision 1.3
diff -u -u -r1.3 info.c
--- programs/winedbg/info.c	8 Jan 2003 21:09:26 -0000	1.3
+++ programs/winedbg/info.c	28 Jan 2003 20:07:13 -0000
@@ -220,8 +220,8 @@
 "  list <lines>                           disassemble [<addr>][,<addr>]",
 "  show dir                               dir <path>",
 "  set <reg> = <expr>                     set *<addr> = <expr>",
-"  mode [16,32,vm86]                      walk [wnd,class,queue,module,",
-"  whatis                                       process,modref <pid>]",
+"  mode [16,32,vm86]                      walk [wnd,class,module,maps,",
+"  whatis                                       process,thread,exception]",
 "  info (see 'help info' for options)     debugmsg <class>[-+]<type>\n",
 
 "The 'x' command accepts repeat counts and formats (including 'i') in the",
@@ -255,9 +255,7 @@
 "  info break           Dumps information about breakpoints",
 "  info display         Shows auto-display expressions in use",
 "  info locals          Displays values of all local vars for current frame",
-"  info maps            Dumps all virtual memory mappings",
 "  info module <handle> Displays internal module state",
-"  info queue <handle>  Displays internal queue state",
 "  info reg             Displays values in all registers at top of stack",
 "  info segments        Dumps information about all known segments",
 "  info share           Dumps information about shared libraries",
@@ -375,16 +373,6 @@
    DBG_free(cw.table);
 }
 
-void DEBUG_DumpQueue(DWORD q)
-{
-   DEBUG_Printf(DBG_CHN_MESG, "No longer doing info queue '0x%08lx'\n", q);
-}
-
-void DEBUG_WalkQueues(void)
-{
-   DEBUG_Printf(DBG_CHN_MESG, "No longer walking queues list\n");
-}
-
 void DEBUG_InfoWindow(HWND hWnd)
 {
    char	clsName[128];
@@ -538,11 +526,6 @@
     }
 }
 
-void DEBUG_WalkModref(DWORD p)
-{
-   DEBUG_Printf(DBG_CHN_MESG, "No longer walking module references list\n");
-}
-
 /***********************************************************************
  *           DEBUG_WalkExceptions
  *
@@ -553,6 +536,13 @@
     DBG_THREAD * thread;
     void *next_frame;
 
+    if (!DEBUG_CurrProcess || !DEBUG_CurrThread)
+    {
+        DEBUG_Printf(DBG_CHN_MESG, 
+                     "Cannot walk exceptions while no process is loaded\n");
+        return;
+    }
+
     DEBUG_Printf( DBG_CHN_MESG, "Exception frames:\n" );
 
     if (tid == DEBUG_CurrTid) thread = DEBUG_CurrThread;
@@ -606,8 +596,8 @@
 
     for (i = start; i < start + length; i++)
     {
-       if (!GetThreadSelectorEntry(DEBUG_CurrThread->handle, (i << 3)|7, &le))
-	  continue;
+        if (!GetThreadSelectorEntry(DEBUG_CurrThread->handle, (i << 3) | 7, &le))
+            continue;
 
         if (le.HighWord.Bits.Type & 0x08)
         {
@@ -633,20 +623,38 @@
     }
 }
 
-void DEBUG_InfoVirtual(void)
+void DEBUG_InfoVirtual(DWORD pid)
 {
     MEMORY_BASIC_INFORMATION    mbi;
     char*                       addr = 0;
     char*                       state;
     char*                       type;
     char                        prot[3+1];
+    HANDLE                      hProc;
 
-    if (DEBUG_CurrProcess == NULL)
-        return;
+    if (pid == 0)
+    {
+        if (DEBUG_CurrProcess == NULL)
+        {
+            DEBUG_Printf(DBG_CHN_MESG, 
+                         "Cannot look at mapping of current process, while no process is loaded\n");
+            return;
+        }
+        hProc = DEBUG_CurrProcess->handle;
+    }
+    else
+    {
+        hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
+        if (hProc == NULL)
+        {
+            DEBUG_Printf(DBG_CHN_MESG, "Cannot open process <%lu>\n", pid);
+            return;
+        }
+    }
 
     DEBUG_Printf(DBG_CHN_MESG, "Address  Size     State   Type    RWX\n");
 
-    while (VirtualQueryEx(DEBUG_CurrProcess->handle, addr, &mbi, sizeof(mbi)) >= sizeof(mbi))
+    while (VirtualQueryEx(hProc, addr, &mbi, sizeof(mbi)) >= sizeof(mbi))
     {
         switch (mbi.State)
         {
@@ -687,6 +695,7 @@
             break;
         addr += mbi.RegionSize;
     }
+    if (hProc != DEBUG_CurrProcess->handle) CloseHandle(hProc);
 }
 
 struct dll_option_layout
Index: programs/winedbg/module.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/module.c,v
retrieving revision 1.1
diff -u -u -r1.1 module.c
--- programs/winedbg/module.c	13 Sep 2002 17:54:28 -0000	1.1
+++ programs/winedbg/module.c	3 Jan 2003 16:08:58 -0000
@@ -622,6 +622,13 @@
     DBG_MODULE**	amod;
     int			i;
 
+    if (!DEBUG_CurrProcess)
+    {
+        DEBUG_Printf(DBG_CHN_MESG, 
+                     "Cannot walk classes while no process is loaded\n");
+        return;
+    }
+
     DEBUG_Printf(DBG_CHN_MESG, "Address\t\t\tModule\tName\n");
 
     amod = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
Index: documentation/debugger.sgml
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/documentation/debugger.sgml,v
retrieving revision 1.16
diff -u -u -r1.16 debugger.sgml
--- documentation/debugger.sgml	5 Jan 2003 01:08:56 -0000	1.16
+++ documentation/debugger.sgml	5 Jan 2003 11:25:21 -0000
@@ -1455,28 +1455,26 @@
         <title>Information on Wine's internals</title>
 
         <screen>
-info class &lt;id&gt;	prints information on Windows's class &lt;id&gt;
+info class &lt;id&gt; prints information on Windows's class &lt;id&gt;
 walk class	lists all Windows' class registered in Wine
 info share	lists all the dynamic libraries loaded the debugged
 		program (including .so files, NE and PE DLLs)
-info module N	prints information on module of handle N
+info module &lt;N&gt; prints information on module of handle &lt;N&gt;
 walk module	lists all modules loaded by debugged program
-info queue N	prints information on Wine's queue N
-walk queue	lists all queues allocated in Wine
 info regs	prints the value of CPU register
-info segment N	prints information on segment N
+info segment &lt;N&gt;prints information on segment &lt;N&gt;
 info segment	lists all allocated segments
 info stack	prints the values on top of the stack
-info map	lists all virtual mappings used by the debugged
+walk map	lists all virtual mappings used by the debugged
 		program
-info wnd N	prints information of Window of handle N
+walk map &lt;N&gt;    lists all virtual mappings used by the program of pid &lt;N&gt;
+info wnd &lt;N&gt;    prints information of Window of handle &lt;N&gt;
 walk wnd	lists all the window hierarchy starting from the
 		desktop window
-walk wnd N	lists all the window hierarchy starting from the
-		window of handle N
+walk wnd &lt;N&gt;    lists all the window hierarchy starting from the
+		window of handle &lt;N&gt;
 walk process	lists all w-processes in Wine session
 walk thread	lists all w-threads in Wine session
-walk modref	(no longer avail)
 walk exception  lists the exception frames (starting from current
                 stack frame)
         </screen>

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux