Commit 2271a8d4 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedump: Dump PE symbols table if any.

parent 947f2456
......@@ -187,9 +187,15 @@ static void do_dumpall(const char *arg)
{
globals.do_dumpheader = 1;
globals.do_dump_rawdata = 1;
globals.do_symbol_table = 1;
globals.dumpsect = "ALL";
}
static void do_symtable(const char* arg)
{
globals.do_symbol_table = 1;
}
struct my_option
{
const char *name;
......@@ -222,6 +228,7 @@ static const struct my_option option_table[] = {
{"-f", DUMP, 0, do_dumphead, "-f Dumps file header information"},
{"-G", DUMP, 0, do_rawdebug, "-G Dumps raw debug information"},
{"-j", DUMP, 1, do_dumpsect, "-j sect_name Dumps only the content of section sect_name (import, export, debug, resource, tls, clr)"},
{"-t", DUMP, 0, do_symtable, "-t Dumps symbol table"},
{"-x", DUMP, 0, do_dumpall, "-x Dumps everything"},
{NULL, NONE, 0, NULL, NULL}
};
......
......@@ -1399,6 +1399,24 @@ static void dump_debug(void)
dump_stabs(stabs, szstabs, stabstr, szstr);
}
static void dump_symbol_table(void)
{
const IMAGE_SYMBOL* sym;
int numsym;
const char* strtable;
numsym = PE_nt_headers->FileHeader.NumberOfSymbols;
if (!PE_nt_headers->FileHeader.PointerToSymbolTable || !numsym)
return;
sym = (const IMAGE_SYMBOL*)PRD(PE_nt_headers->FileHeader.PointerToSymbolTable,
sizeof(*sym) * numsym);
if (!sym) return;
/* FIXME: no way to get strtable size */
strtable = (const char*)&sym[numsym];
dump_coff_symbol_table(sym, numsym, IMAGE_FIRST_SECTION(PE_nt_headers));
}
enum FileSig get_kind_exec(void)
{
const WORD* pw;
......@@ -1468,6 +1486,8 @@ void pe_dump(void)
if (all || !strcmp(globals.dumpsect, "except"))
dump_dir_exceptions();
}
if (globals.do_symbol_table)
dump_symbol_table();
if (globals.do_debug)
dump_debug();
}
......
......@@ -123,6 +123,7 @@ typedef struct __globals
int do_dumpheader; /* -f */
int do_dump_rawdata; /* -x */
int do_debug; /* -G == 1, -g == 2 */
int do_symbol_table; /* -t */
/* Option arguments: spec mode */
int start_ordinal; /* -s */
......@@ -263,6 +264,8 @@ void codeview_dump_linetab2(const char* linetab, DWORD size, const ch
void dump_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr, unsigned szstr);
void dump_codeview(unsigned long ptr, unsigned long len);
void dump_coff(unsigned long coffbase, unsigned long len, const void* sect_map);
void dump_coff_symbol_table(const IMAGE_SYMBOL *coff_symbols, unsigned num_sym,
const IMAGE_SECTION_HEADER *sectHead);
void dump_frame_pointer_omission(unsigned long base, unsigned long len);
FILE *open_file (const char *name, const char *ext, const char *mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment