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.
|
||||
*/
|
||||
DEBUG_InitTypes();
|
||||
DEBUG_InitCVDataTypes();
|
||||
|
||||
/*
|
||||
* In some cases we can read the stabs information directly
|
||||
|
@ -541,10 +542,14 @@ static void DEBUG_Main( BOOL is_debug )
|
|||
SymbolTableFile, sizeof(SymbolTableFile));
|
||||
DEBUG_ReadSymbolTable( SymbolTableFile );
|
||||
}
|
||||
|
||||
DEBUG_LoadEntryPoints();
|
||||
DEBUG_LoadEntryPoints(NULL);
|
||||
DEBUG_ProcessDeferredDebug();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG_LoadEntryPoints("Loading new modules symbols:\n"))
|
||||
DEBUG_ProcessDeferredDebug();
|
||||
}
|
||||
|
||||
#if 0
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* Load the entry points of all the modules into the hash table.
|
||||
*/
|
||||
void DEBUG_LoadEntryPoints(void)
|
||||
int DEBUG_LoadEntryPoints(const char* pfx)
|
||||
{
|
||||
MODULEENTRY entry;
|
||||
NE_MODULE *pModule;
|
||||
BOOL ok;
|
||||
WINE_MODREF *wm;
|
||||
int rowcount = 3;
|
||||
MODULEENTRY entry;
|
||||
NE_MODULE* pModule;
|
||||
BOOL ok;
|
||||
WINE_MODREF*wm;
|
||||
DBG_LEPData lep;
|
||||
|
||||
lep.first = 0;
|
||||
lep.pfx = pfx;
|
||||
|
||||
/* FIXME: we assume that a module is never removed from memory */
|
||||
|
||||
fprintf( stderr, " " );
|
||||
for (ok = ModuleFirst16(&entry); ok; ok = ModuleNext16(&entry))
|
||||
{
|
||||
if (!(pModule = NE_GetPtr( entry.hModule ))) continue;
|
||||
if (!(pModule->flags & NE_FFLAGS_WIN32)) /* NE module */
|
||||
{
|
||||
if ((rowcount + strlen(entry.szModule)) > 76)
|
||||
{
|
||||
fprintf( stderr,"\n ");
|
||||
rowcount = 3;
|
||||
}
|
||||
fprintf( stderr, " %s", entry.szModule );
|
||||
rowcount += strlen(entry.szModule) + 1;
|
||||
|
||||
DEBUG_LoadEntryPoints16( entry.hModule, pModule, entry.szModule );
|
||||
}
|
||||
if (!(pModule->flags & NE_FFLAGS_WIN32) && /* NE module */
|
||||
DEBUG_LEPHelper( entry.szModule, TRUE, &lep ))
|
||||
DEBUG_LoadEntryPoints16( entry.hModule, pModule, entry.szModule );
|
||||
}
|
||||
for (wm=PROCESS_Current()->modref_list;wm;wm=wm->next)
|
||||
{
|
||||
if ((rowcount + strlen(wm->modname)) > 76)
|
||||
{
|
||||
fprintf( stderr,"\n ");
|
||||
rowcount = 3;
|
||||
}
|
||||
fprintf( stderr, " %s", wm->modname );
|
||||
rowcount += strlen(wm->modname) + 1;
|
||||
DEBUG_LoadEntryPoints32( wm->module, wm->modname );
|
||||
if (DEBUG_LEPHelper( wm->modname, FALSE, &lep ))
|
||||
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;
|
||||
int nsect;
|
||||
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;
|
||||
|
||||
/*
|
||||
|
@ -1025,7 +1029,7 @@ DEBUG_RegisterDebugInfo( HMODULE hModule, const char *module_name)
|
|||
deefer->dbg_size = dbgptr->SizeOfData;
|
||||
deefer->dbgdir = dbgptr;
|
||||
deefer->next = dbglist;
|
||||
deefer->loaded = FALSE;
|
||||
deefer->status = DF_STATUS_NEW;
|
||||
deefer->dbg_index = DEBUG_next_index;
|
||||
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->dbgdir = NULL;
|
||||
deefer->next = dbglist;
|
||||
deefer->loaded = TRUE;
|
||||
deefer->status = DF_STATUS_LOADED;
|
||||
deefer->dbg_index = DEBUG_next_index;
|
||||
deefer->module_name = DBG_strdup(name);
|
||||
dbglist = deefer;
|
||||
|
@ -2387,12 +2391,11 @@ DEBUG_ProcessDeferredDebug()
|
|||
char * filename;
|
||||
int last_proc = -1;
|
||||
int need_print =0;
|
||||
|
||||
DEBUG_InitCVDataTypes();
|
||||
int sts;
|
||||
|
||||
for(deefer = dbglist; deefer; deefer = deefer->next)
|
||||
{
|
||||
if( deefer->loaded )
|
||||
if( deefer->status != DF_STATUS_NEW )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2418,7 +2421,7 @@ DEBUG_ProcessDeferredDebug()
|
|||
#if 0
|
||||
fprintf(stderr, "Processing COFF symbols...\n");
|
||||
#endif
|
||||
DEBUG_ProcessCoff(deefer);
|
||||
sts = DEBUG_ProcessCoff(deefer);
|
||||
break;
|
||||
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
||||
/*
|
||||
|
@ -2432,9 +2435,10 @@ DEBUG_ProcessDeferredDebug()
|
|||
* Whatever this is, we don't know how to deal with
|
||||
* it yet.
|
||||
*/
|
||||
sts = FALSE;
|
||||
break;
|
||||
}
|
||||
DEBUG_ProcessPDBFile(deefer, cvd->cv_name);
|
||||
sts = DEBUG_ProcessPDBFile(deefer, cvd->cv_name);
|
||||
#if 0
|
||||
fprintf(stderr, "Processing PDB file %s\n", cvd->cv_name);
|
||||
#endif
|
||||
|
@ -2456,7 +2460,8 @@ DEBUG_ProcessDeferredDebug()
|
|||
|| ( (strcmp(filename, ".dbg") != 0)
|
||||
&& (strcmp(filename, ".DBG") != 0)) )
|
||||
{
|
||||
break;
|
||||
sts = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
filename = (char *) &misc->Data;
|
||||
|
@ -2464,18 +2469,21 @@ DEBUG_ProcessDeferredDebug()
|
|||
/*
|
||||
* Do the dirty deed...
|
||||
*/
|
||||
DEBUG_ProcessDBGFile(deefer, filename);
|
||||
sts = DEBUG_ProcessDBGFile(deefer, filename);
|
||||
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* We should never get here...
|
||||
*/
|
||||
sts = FALSE;
|
||||
break;
|
||||
}
|
||||
deefer->status = (sts) ? DF_STATUS_LOADED : DF_STATUS_ERROR;
|
||||
|
||||
}
|
||||
if(need_print)
|
||||
fprintf(stderr, "\n");
|
||||
if(need_print)
|
||||
fprintf(stderr, "\n");
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ extern const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
|
|||
unsigned int ebp,
|
||||
struct list_id * source);
|
||||
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,
|
||||
unsigned long offset );
|
||||
extern struct wine_locals *
|
||||
|
|
Loading…
Reference in New Issue