- 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.
- Renamed 'info maps' info 'walk maps' and let it work on any
  process.
This commit is contained in:
Eric Pouech 2003-01-30 00:24:18 +00:00 committed by Alexandre Julliard
parent 1f7dbca935
commit 45adf0843f
6 changed files with 75 additions and 66 deletions

View File

@ -1455,28 +1455,26 @@ disas <expr>,<expr>disassembles code between addresses specified by
<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>

View File

@ -52,6 +52,8 @@ int yyerror(char *);
%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 @@ line: command
;
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 @@ command:
| 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 @@ command:
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 @@ info_command:
| 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 @@ info_command:
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:

View File

@ -144,16 +144,14 @@ STRING \"[^\n"]+\"
<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; }

View File

@ -248,7 +248,7 @@ extern DBG_PROCESS* DEBUG_CurrProcess;
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 @@ extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
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);

View File

@ -220,8 +220,8 @@ void DEBUG_Help(void)
" 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 @@ void DEBUG_HelpInfo(void)
" 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 @@ void DEBUG_WalkClasses(void)
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_WalkThreads(void)
}
}
void DEBUG_WalkModref(DWORD p)
{
DEBUG_Printf(DBG_CHN_MESG, "No longer walking module references list\n");
}
/***********************************************************************
* DEBUG_WalkExceptions
*
@ -553,6 +536,13 @@ void DEBUG_WalkExceptions(DWORD tid)
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 @@ void DEBUG_InfoSegments(DWORD start, int length)
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_InfoSegments(DWORD start, int length)
}
}
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 @@ void DEBUG_InfoVirtual(void)
break;
addr += mbi.RegionSize;
}
if (hProc != DEBUG_CurrProcess->handle) CloseHandle(hProc);
}
struct dll_option_layout

View File

@ -622,6 +622,13 @@ void DEBUG_WalkModules(void)
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);