Add new "walk" command options to list processes and modref's.

This commit is contained in:
Guy Albertelli 1999-06-12 10:49:36 +00:00 committed by Alexandre Julliard
parent 63ec7daa69
commit 0e65b38ff3
7 changed files with 62 additions and 1 deletions

View File

@ -74,6 +74,7 @@ extern void VIRTUAL_Dump(void); /* memory/virtual.c */
%token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
%token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT tDEBUGMSG
%token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
%token tPROCESS tMODREF
%token tEOL tSTRING tDEBUGSTR
%token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
%token tSTEPI tNEXTI tFINISH tSHOW tDIR
@ -313,6 +314,8 @@ walk_command:
| tWALK tQUEUE tEOL { QUEUE_WalkQueues(); }
| tWALK tWND tEOL { WIN_WalkWindows( 0, 0 ); }
| tWALK tWND tNUM tEOL { WIN_WalkWindows( $3, 0 ); }
| tWALK tPROCESS tEOL { PROCESS_WalkProcess(); }
| tWALK tMODREF expr_value tEOL { MODULE_WalkModref( $3 ); }
type_cast:

View File

@ -156,6 +156,8 @@ $gs { yylval.reg = REG_GS; return tREG; }
<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>modref|modre|modr { return tMODREF; }
<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; }

View File

@ -142,7 +142,8 @@ void DEBUG_Help(void)
" delete display <disnum> debugmsg <class>[-+]<type>\n",
"Wine-specific commands:",
" mode [16,32] walk [wnd,class,queue,module]",
" mode [16,32] walk [wnd,class,queue,module,",
" process,modref <pid>]",
" info (see 'help info' for options)\n",
"The 'x' command accepts repeat counts and formats (including 'i') in the",

View File

@ -187,6 +187,7 @@ extern HMODULE MODULE_CreateDummyModule( const OFSTRUCT *ofs, LPCSTR modName );
extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
extern void MODULE_WalkModref( DWORD id );
/* resource.c */
extern INT WINAPI AccessResource(HMODULE,HRSRC);

View File

@ -165,6 +165,7 @@ extern PDB *PROCESS_Create( struct _NE_MODULE *pModule,
BOOL inherit, DWORD flags,
STARTUPINFOA *startup, PROCESS_INFORMATION *info );
extern void PROCESS_FreePDB( PDB *pdb );
extern void PROCESS_WalkProcess( void );
/* scheduler/debugger.c */
extern DWORD DEBUG_SendExceptionEvent( EXCEPTION_RECORD *rec, BOOL first_chance );

View File

@ -35,6 +35,35 @@
DECLARE_DEBUG_CHANNEL(module)
DECLARE_DEBUG_CHANNEL(win32)
/*************************************************************************
* MODULE_WalkModref
* Walk MODREFs for input process ID
*/
void MODULE_WalkModref( DWORD id )
{
int i;
WINE_MODREF *zwm, *prev = NULL;
PDB *pdb = PROCESS_IdToPDB( id );
if (!pdb) {
MESSAGE("Invalid process id (pid)\n");
return;
}
MESSAGE("Modref list for process pdb=%p\n", pdb);
MESSAGE("Modref next prev handle deps flags name\n");
for ( zwm = pdb->modref_list; zwm; zwm = zwm->next) {
MESSAGE("%p %p %p %04x %5d %04x %s\n", zwm, zwm->next, zwm->prev,
zwm->module, zwm->nDeps, zwm->flags, zwm->modname);
for ( i = 0; i < zwm->nDeps; i++ ) {
if ( zwm->deps[i] )
MESSAGE(" %d %p %s\n", i, zwm->deps[i], zwm->deps[i]->modname);
}
if (prev != zwm->prev)
MESSAGE(" --> modref corrupt, previous pointer wrong!!\n");
prev = zwm;
}
}
/*************************************************************************
* MODULE32_LookupHMODULE

View File

@ -36,6 +36,30 @@ static PDB initial_pdb;
static PDB *PROCESS_First = &initial_pdb;
/***********************************************************************
* PROCESS_WalkProcess
*/
void PROCESS_WalkProcess(void)
{
PDB *pdb;
char *name;
pdb = PROCESS_First;
MESSAGE( " pid PDB #th modref module \n" );
while(pdb)
{
if (pdb == &initial_pdb)
name = "initial PDB";
else
name = (pdb->exe_modref) ? pdb->exe_modref->shortname : "";
MESSAGE( " %8p %8p %5d %8p %s\n", pdb->server_pid, pdb,
pdb->threads, pdb->exe_modref, name);
pdb = pdb->next;
}
return;
}
/***********************************************************************
* PROCESS_Current
*/