winedump: Now dumping codeview source line information.

This commit is contained in:
Eric Pouech 2008-09-29 21:32:09 +02:00 committed by Alexandre Julliard
parent 864a60d5ba
commit f8380ba37a
3 changed files with 59 additions and 0 deletions

View File

@ -1311,3 +1311,57 @@ int codeview_dump_symbols(const void* root, unsigned long size)
}
return 0;
}
void codeview_dump_linetab(const char* linetab, DWORD size, BOOL pascal_str, const char* pfx)
{
const char* ptr = linetab;
int nfile, nseg, nline;
int i, j, k;
const unsigned int* filetab;
const unsigned int* lt_ptr;
const struct startend* start;
nfile = *(const short*)linetab;
filetab = (const unsigned int*)(linetab + 2 * sizeof(short));
printf("%s%d files with %d ???\n", pfx, nfile, *(const short*)(linetab + sizeof(short)));
for (i = 0; i < nfile; i++)
{
ptr = linetab + filetab[i];
nseg = *(const short*)ptr;
ptr += 2 * sizeof(short);
lt_ptr = (const unsigned int*)ptr;
start = (const struct startend*)(lt_ptr + nseg);
/*
* Now snarf the filename for all of the segments for this file.
*/
if (pascal_str)
{
char filename[MAX_PATH];
const struct p_string* p_fn;
p_fn = (const struct p_string*)(start + nseg);
memset(filename, 0, sizeof(filename));
memcpy(filename, p_fn->name, p_fn->namelen);
printf("%slines for file #%d/%d %s %d\n", pfx, i, nfile, filename, nseg);
}
else
printf("%slines for file #%d/%d %s %d\n", pfx, i, nfile, (const char*)(start + nseg), nseg);
for (j = 0; j < nseg; j++)
{
ptr = linetab + *lt_ptr++;
nline = *(const short*)(ptr + 2);
printf("%s %04x:%08x-%08x #%d\n",
pfx, *(const short*)(ptr + 0), start[j].start, start[j].end, nline);
ptr += 4;
for (k = 0; k < nline; k++)
{
printf("%s %x %d\n",
pfx, ((const unsigned int*)ptr)[k],
((const unsigned short*)((const unsigned int*)ptr + nline))[k]);
}
}
}
}

View File

@ -405,6 +405,10 @@ static void pdb_dump_symbols(struct pdb_reader* reader)
if (symbol_size)
codeview_dump_symbols((const char*)modimage + sizeof(DWORD), symbol_size);
/* line number info */
if (lineno_size)
codeview_dump_linetab((const char*)modimage + symbol_size, lineno_size, TRUE, " ");
/* what's that part ??? */
if (0)
dump_data(modimage + symbol_size + lineno_size, total_size - (symbol_size + lineno_size), " ");

View File

@ -255,6 +255,7 @@ void pdb_dump(void);
int codeview_dump_symbols(const void* root, unsigned long size);
int codeview_dump_types_from_offsets(const void* table, const DWORD* offsets, unsigned num_types);
int codeview_dump_types_from_block(const void* table, unsigned long len);
void codeview_dump_linetab(const char* linetab, DWORD size, BOOL pascal_str, const char* pfx);
void dump_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr, unsigned szstr);
void dump_codeview(unsigned long ptr, unsigned long len);