winedump: Print more meaningful information about module list.

This commit is contained in:
Eric Pouech 2008-04-30 21:25:41 +02:00 committed by Alexandre Julliard
parent 69c29866c1
commit 1185c5123d
1 changed files with 25 additions and 20 deletions

View File

@ -210,8 +210,10 @@ static void pdb_dump_symbols(struct pdb_reader* reader)
if (symbols->srcmodule_size) if (symbols->srcmodule_size)
{ {
const PDB_SYMBOL_SOURCE*src; const PDB_SYMBOL_SOURCE*src;
int i; int i, j, cfile;
const WORD* indx;
const DWORD* offset; const DWORD* offset;
const char* start_cstr;
const char* cstr; const char* cstr;
printf("\t----------src module------------\n"); printf("\t----------src module------------\n");
@ -219,35 +221,38 @@ static void pdb_dump_symbols(struct pdb_reader* reader)
symbols->module_size + symbols->offset_size + symbols->hash_size); symbols->module_size + symbols->offset_size + symbols->hash_size);
printf("\tSource Modules\n" printf("\tSource Modules\n"
"\t\tnModules: %u\n" "\t\tnModules: %u\n"
"\t\tnSrcFiles: %u\n" "\t\tnSrcFiles: %u\n",
"\t\ttable:\n",
src->nModules, src->nSrcFiles); src->nModules, src->nSrcFiles);
/* usage of table seems to be as follows: /* usage of table seems to be as follows:
* two arrays of WORD (src->nModules as size) * two arrays of WORD (src->nModules as size)
* - first array contains index into files for "module" compilation (module = compilation unit ??) * - first array contains index into files for "module" compilation
* - second array contains increment in index (if needed) * (module = compilation unit ??)
* - usage of this later is not very clear. it could be that if second array entry is null, then no file * - second array contains the number of source files in module
* name is to be used ?
* an array of DWORD (src->nSrcFiles as size) * an array of DWORD (src->nSrcFiles as size)
* - contains offset (in following string table) of the source file name * - contains offset (in following string table) of the source file name
* a string table * a string table
* - each string is a pascal string (ie. with its length as first BYTE) or * - each string is a pascal string (ie. with its length as first BYTE) or
* 0-terminated string (depending on version) * 0-terminated string (depending on version)
*/ */
indx = &src->table[src->nModules];
offset = (const DWORD*)&src->table[2 * src->nModules]; offset = (const DWORD*)&src->table[2 * src->nModules];
cstr = (const char*)&src->table[2 * (src->nModules + src->nSrcFiles)]; cstr = (const char*)&src->table[2 * (src->nModules + src->nSrcFiles)];
start_cstr = cstr;
for (i = 0; i < src->nModules; i++) for (i = cfile = 0; i < src->nModules; i++)
{
printf("\t\tModule[%2d]:\n", i);
for (j = 0; j < indx[i]; j++, cfile++)
{ {
/* FIXME: in some cases, it's a p_string but WHEN ? */ /* FIXME: in some cases, it's a p_string but WHEN ? */
if (cstr + offset[src->table[i]] < (const char*)src + symbols->srcmodule_size) if (src->table[cfile] < src->nSrcFiles &&
printf("\t\t\tmodule[%2d]: src=%s (%04x)\n", cstr + offset[src->table[cfile]] >= (const char*)start_cstr /* wrap around */ &&
i, cstr + offset[src->table[i]], src->table[src->nModules + i]); cstr + offset[src->table[cfile]] < (const char*)src + symbols->srcmodule_size)
printf("\t\t\tSource file: %s\n", cstr + offset[src->table[cfile]]);
else else
printf("\t\t\tmodule[%2d]: src=<<out of bounds>> (%04x)\n", printf("\t\t\tSource file: <<out of bounds>>\n");
i, src->table[src->nModules + i]); }
} }
} }
if (symbols->pdbimport_size) if (symbols->pdbimport_size)