[PATCH 16/19] [WineDump]: now dumping codeview source line information
Eric Pouech
eric.pouech at orange.fr
Mon Sep 29 14:32:09 CDT 2008
A+
---
tools/winedump/msc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++
tools/winedump/pdb.c | 4 +++
tools/winedump/winedump.h | 1 +
3 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index c49406e..0351cac 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -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]);
+ }
+ }
+ }
+}
diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c
index 1d9fce0..72a63fd 100644
--- a/tools/winedump/pdb.c
+++ b/tools/winedump/pdb.c
@@ -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), " ");
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index f3caf94..d2bf9d3 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -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);
More information about the wine-patches
mailing list