Allow loading of modules debug information after first invocation of
debugger.
This commit is contained in:
parent
2f2c817a55
commit
a88cae1a0b
|
@ -519,6 +519,7 @@ static void DEBUG_Main( BOOL is_debug )
|
||||||
* Initialize the type handling stuff.
|
* Initialize the type handling stuff.
|
||||||
*/
|
*/
|
||||||
DEBUG_InitTypes();
|
DEBUG_InitTypes();
|
||||||
|
DEBUG_InitCVDataTypes();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In some cases we can read the stabs information directly
|
* In some cases we can read the stabs information directly
|
||||||
|
@ -541,10 +542,14 @@ static void DEBUG_Main( BOOL is_debug )
|
||||||
SymbolTableFile, sizeof(SymbolTableFile));
|
SymbolTableFile, sizeof(SymbolTableFile));
|
||||||
DEBUG_ReadSymbolTable( SymbolTableFile );
|
DEBUG_ReadSymbolTable( SymbolTableFile );
|
||||||
}
|
}
|
||||||
|
DEBUG_LoadEntryPoints(NULL);
|
||||||
DEBUG_LoadEntryPoints();
|
|
||||||
DEBUG_ProcessDeferredDebug();
|
DEBUG_ProcessDeferredDebug();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DEBUG_LoadEntryPoints("Loading new modules symbols:\n"))
|
||||||
|
DEBUG_ProcessDeferredDebug();
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "Entering debugger PC=%x, mode=%d, count=%d\n",
|
fprintf(stderr, "Entering debugger PC=%x, mode=%d, count=%d\n",
|
||||||
|
|
122
debugger/hash.c
122
debugger/hash.c
|
@ -879,49 +879,115 @@ static void DEBUG_LoadEntryPoints32( HMODULE hModule, const char *name )
|
||||||
#undef RVA
|
#undef RVA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct tag_lmr{
|
||||||
|
char* module_name;
|
||||||
|
BOOL is16;
|
||||||
|
struct tag_lmr* next;
|
||||||
|
} DBG_LoadedModuleRef;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int rowcount;
|
||||||
|
int first;
|
||||||
|
const char* pfx;
|
||||||
|
} DBG_LEPData;
|
||||||
|
|
||||||
|
static BOOL DEBUG_LEPHelper(const char* mod_name, BOOL is16, DBG_LEPData* lep)
|
||||||
|
{
|
||||||
|
static DBG_LoadedModuleRef* lmr = NULL;
|
||||||
|
DBG_LoadedModuleRef* p;
|
||||||
|
DBG_LoadedModuleRef** pp1;
|
||||||
|
DBG_LoadedModuleRef* p2;
|
||||||
|
int len = strlen(mod_name);
|
||||||
|
int cmp;
|
||||||
|
|
||||||
|
for (p = lmr; p; p = p->next) {
|
||||||
|
cmp = strcmp(p->module_name, mod_name);
|
||||||
|
if (cmp < 0)
|
||||||
|
continue;
|
||||||
|
if (cmp == 0) {
|
||||||
|
if (p->is16 == is16)
|
||||||
|
return FALSE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lep->first) {
|
||||||
|
if (lep->pfx) fprintf( stderr, lep->pfx );
|
||||||
|
fprintf( stderr, " " );
|
||||||
|
lep->first++;
|
||||||
|
lep->rowcount = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((lep->rowcount + len) > 76)
|
||||||
|
{
|
||||||
|
fprintf( stderr, "\n ");
|
||||||
|
lep->rowcount = 3;
|
||||||
|
}
|
||||||
|
fprintf( stderr, " %s", mod_name );
|
||||||
|
lep->rowcount += len + 1;
|
||||||
|
|
||||||
|
p = DBG_alloc(sizeof(*lmr));
|
||||||
|
p->module_name = DBG_strdup(mod_name);
|
||||||
|
p->is16 = is16;
|
||||||
|
|
||||||
|
p2 = NULL;
|
||||||
|
for (pp1 = &lmr; *pp1; pp1 = &(*pp1)->next) {
|
||||||
|
if (strcmp((*pp1)->module_name, mod_name) > 0)
|
||||||
|
break;
|
||||||
|
p2 = *pp1;
|
||||||
|
}
|
||||||
|
if (p2 == NULL)
|
||||||
|
{
|
||||||
|
p->next = lmr;
|
||||||
|
lmr = p;
|
||||||
|
}
|
||||||
|
else if (*pp1 == NULL)
|
||||||
|
{
|
||||||
|
p->next = NULL;
|
||||||
|
*pp1 = p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->next = *pp1;
|
||||||
|
p2->next = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEBUG_LoadEntryPoints
|
* DEBUG_LoadEntryPoints
|
||||||
*
|
*
|
||||||
* Load the entry points of all the modules into the hash table.
|
* Load the entry points of all the modules into the hash table.
|
||||||
*/
|
*/
|
||||||
void DEBUG_LoadEntryPoints(void)
|
int DEBUG_LoadEntryPoints(const char* pfx)
|
||||||
{
|
{
|
||||||
MODULEENTRY entry;
|
MODULEENTRY entry;
|
||||||
NE_MODULE *pModule;
|
NE_MODULE* pModule;
|
||||||
BOOL ok;
|
BOOL ok;
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF*wm;
|
||||||
int rowcount = 3;
|
DBG_LEPData lep;
|
||||||
|
|
||||||
|
lep.first = 0;
|
||||||
|
lep.pfx = pfx;
|
||||||
|
|
||||||
fprintf( stderr, " " );
|
/* FIXME: we assume that a module is never removed from memory */
|
||||||
|
|
||||||
for (ok = ModuleFirst16(&entry); ok; ok = ModuleNext16(&entry))
|
for (ok = ModuleFirst16(&entry); ok; ok = ModuleNext16(&entry))
|
||||||
{
|
{
|
||||||
if (!(pModule = NE_GetPtr( entry.hModule ))) continue;
|
if (!(pModule = NE_GetPtr( entry.hModule ))) continue;
|
||||||
if (!(pModule->flags & NE_FFLAGS_WIN32)) /* NE module */
|
if (!(pModule->flags & NE_FFLAGS_WIN32) && /* NE module */
|
||||||
{
|
DEBUG_LEPHelper( entry.szModule, TRUE, &lep ))
|
||||||
if ((rowcount + strlen(entry.szModule)) > 76)
|
DEBUG_LoadEntryPoints16( entry.hModule, pModule, entry.szModule );
|
||||||
{
|
|
||||||
fprintf( stderr,"\n ");
|
|
||||||
rowcount = 3;
|
|
||||||
}
|
|
||||||
fprintf( stderr, " %s", entry.szModule );
|
|
||||||
rowcount += strlen(entry.szModule) + 1;
|
|
||||||
|
|
||||||
DEBUG_LoadEntryPoints16( entry.hModule, pModule, entry.szModule );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (wm=PROCESS_Current()->modref_list;wm;wm=wm->next)
|
for (wm=PROCESS_Current()->modref_list;wm;wm=wm->next)
|
||||||
{
|
{
|
||||||
if ((rowcount + strlen(wm->modname)) > 76)
|
if (DEBUG_LEPHelper( wm->modname, FALSE, &lep ))
|
||||||
{
|
DEBUG_LoadEntryPoints32( wm->module, wm->modname );
|
||||||
fprintf( stderr,"\n ");
|
|
||||||
rowcount = 3;
|
|
||||||
}
|
|
||||||
fprintf( stderr, " %s", wm->modname );
|
|
||||||
rowcount += strlen(wm->modname) + 1;
|
|
||||||
DEBUG_LoadEntryPoints32( wm->module, wm->modname );
|
|
||||||
}
|
}
|
||||||
fprintf( stderr, "\n" );
|
if (lep.first) fprintf( stderr, "\n" );
|
||||||
|
return lep.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -553,9 +553,13 @@ struct deferred_debug_info
|
||||||
PIMAGE_SECTION_HEADER sectp;
|
PIMAGE_SECTION_HEADER sectp;
|
||||||
int nsect;
|
int nsect;
|
||||||
short int dbg_index;
|
short int dbg_index;
|
||||||
char loaded;
|
char status;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DF_STATUS_NEW 0
|
||||||
|
#define DF_STATUS_LOADED 1
|
||||||
|
#define DF_STATUS_ERROR 2
|
||||||
|
|
||||||
struct deferred_debug_info * dbglist = NULL;
|
struct deferred_debug_info * dbglist = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1025,7 +1029,7 @@ DEBUG_RegisterDebugInfo( HMODULE hModule, const char *module_name)
|
||||||
deefer->dbg_size = dbgptr->SizeOfData;
|
deefer->dbg_size = dbgptr->SizeOfData;
|
||||||
deefer->dbgdir = dbgptr;
|
deefer->dbgdir = dbgptr;
|
||||||
deefer->next = dbglist;
|
deefer->next = dbglist;
|
||||||
deefer->loaded = FALSE;
|
deefer->status = DF_STATUS_NEW;
|
||||||
deefer->dbg_index = DEBUG_next_index;
|
deefer->dbg_index = DEBUG_next_index;
|
||||||
deefer->module_name = DBG_strdup(module_name);
|
deefer->module_name = DBG_strdup(module_name);
|
||||||
|
|
||||||
|
@ -1094,7 +1098,7 @@ DEBUG_RegisterELFDebugInfo(int load_addr, u_long size, char * name)
|
||||||
deefer->load_addr = (char *) load_addr;
|
deefer->load_addr = (char *) load_addr;
|
||||||
deefer->dbgdir = NULL;
|
deefer->dbgdir = NULL;
|
||||||
deefer->next = dbglist;
|
deefer->next = dbglist;
|
||||||
deefer->loaded = TRUE;
|
deefer->status = DF_STATUS_LOADED;
|
||||||
deefer->dbg_index = DEBUG_next_index;
|
deefer->dbg_index = DEBUG_next_index;
|
||||||
deefer->module_name = DBG_strdup(name);
|
deefer->module_name = DBG_strdup(name);
|
||||||
dbglist = deefer;
|
dbglist = deefer;
|
||||||
|
@ -2387,12 +2391,11 @@ DEBUG_ProcessDeferredDebug()
|
||||||
char * filename;
|
char * filename;
|
||||||
int last_proc = -1;
|
int last_proc = -1;
|
||||||
int need_print =0;
|
int need_print =0;
|
||||||
|
int sts;
|
||||||
DEBUG_InitCVDataTypes();
|
|
||||||
|
|
||||||
for(deefer = dbglist; deefer; deefer = deefer->next)
|
for(deefer = dbglist; deefer; deefer = deefer->next)
|
||||||
{
|
{
|
||||||
if( deefer->loaded )
|
if( deefer->status != DF_STATUS_NEW )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2418,7 +2421,7 @@ DEBUG_ProcessDeferredDebug()
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "Processing COFF symbols...\n");
|
fprintf(stderr, "Processing COFF symbols...\n");
|
||||||
#endif
|
#endif
|
||||||
DEBUG_ProcessCoff(deefer);
|
sts = DEBUG_ProcessCoff(deefer);
|
||||||
break;
|
break;
|
||||||
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
||||||
/*
|
/*
|
||||||
|
@ -2432,9 +2435,10 @@ DEBUG_ProcessDeferredDebug()
|
||||||
* Whatever this is, we don't know how to deal with
|
* Whatever this is, we don't know how to deal with
|
||||||
* it yet.
|
* it yet.
|
||||||
*/
|
*/
|
||||||
|
sts = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DEBUG_ProcessPDBFile(deefer, cvd->cv_name);
|
sts = DEBUG_ProcessPDBFile(deefer, cvd->cv_name);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "Processing PDB file %s\n", cvd->cv_name);
|
fprintf(stderr, "Processing PDB file %s\n", cvd->cv_name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2456,7 +2460,8 @@ DEBUG_ProcessDeferredDebug()
|
||||||
|| ( (strcmp(filename, ".dbg") != 0)
|
|| ( (strcmp(filename, ".dbg") != 0)
|
||||||
&& (strcmp(filename, ".DBG") != 0)) )
|
&& (strcmp(filename, ".DBG") != 0)) )
|
||||||
{
|
{
|
||||||
break;
|
sts = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = (char *) &misc->Data;
|
filename = (char *) &misc->Data;
|
||||||
|
@ -2464,18 +2469,21 @@ DEBUG_ProcessDeferredDebug()
|
||||||
/*
|
/*
|
||||||
* Do the dirty deed...
|
* Do the dirty deed...
|
||||||
*/
|
*/
|
||||||
DEBUG_ProcessDBGFile(deefer, filename);
|
sts = DEBUG_ProcessDBGFile(deefer, filename);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* We should never get here...
|
* We should never get here...
|
||||||
*/
|
*/
|
||||||
|
sts = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
deefer->status = (sts) ? DF_STATUS_LOADED : DF_STATUS_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(need_print)
|
if(need_print)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ extern const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
|
||||||
unsigned int ebp,
|
unsigned int ebp,
|
||||||
struct list_id * source);
|
struct list_id * source);
|
||||||
extern void DEBUG_ReadSymbolTable( const char * filename );
|
extern void DEBUG_ReadSymbolTable( const char * filename );
|
||||||
extern void DEBUG_LoadEntryPoints(void);
|
extern int DEBUG_LoadEntryPoints( const char * prefix );
|
||||||
extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
|
extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
|
||||||
unsigned long offset );
|
unsigned long offset );
|
||||||
extern struct wine_locals *
|
extern struct wine_locals *
|
||||||
|
|
Loading…
Reference in New Issue