Commit 5bdbc1a3 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed demangling invocation.

Be a bit more verbose on implemented features.
parent 7c1db50c
...@@ -149,7 +149,7 @@ struct option ...@@ -149,7 +149,7 @@ struct option
static const struct option option_table[] = { static const struct option option_table[] = {
{"-h", NONE, 0, do_usage, "-h Display this help message"}, {"-h", NONE, 0, do_usage, "-h Display this help message"},
{"sym", DMGL, 2, do_demangle, "sym <sym> Demangle C++ symbol <sym>' and exit"}, {"sym", DMGL, 2, do_demangle, "sym <sym> Demangle C++ symbol <sym> and exit"},
{"spec", SPEC, 2, do_spec, "spec <dll> Use dll for input file and generate implementation code"}, {"spec", SPEC, 2, do_spec, "spec <dll> Use dll for input file and generate implementation code"},
{"-I", SPEC, 1, do_include, "-I dir Look for prototypes in 'dir' (implies -c)"}, {"-I", SPEC, 1, do_include, "-I dir Look for prototypes in 'dir' (implies -c)"},
{"-c", SPEC, 0, do_code, "-c Generate skeleton code (requires -I)"}, {"-c", SPEC, 0, do_code, "-c Generate skeleton code (requires -I)"},
...@@ -259,7 +259,6 @@ int main (int argc, char *argv[]) ...@@ -259,7 +259,6 @@ int main (int argc, char *argv[])
{ {
parsed_symbol symbol; parsed_symbol symbol;
int count = 0; int count = 0;
int result;
globals.mode = NONE; globals.mode = NONE;
...@@ -272,15 +271,18 @@ int main (int argc, char *argv[]) ...@@ -272,15 +271,18 @@ int main (int argc, char *argv[])
case DMGL: case DMGL:
globals.uc_dll_name = ""; globals.uc_dll_name = "";
VERBOSE = 1; VERBOSE = 1;
symbol.symbol = strdup(globals.input_name);
result = symbol_demangle (&symbol); symbol_init (&symbol, globals.input_name);
if (symbol_demangle (&symbol) == -1);
fatal( "Symbol hasn't got a mangled name\n");
if (symbol.flags & SYM_DATA) if (symbol.flags & SYM_DATA)
printf (symbol.arg_text[0]); printf (symbol.arg_text[0]);
else else
output_prototype (stdout, &symbol); output_prototype (stdout, &symbol);
fputc ('\n', stdout); fputc ('\n', stdout);
return result ? 1 : 0; symbol_clear(&symbol);
break; break;
case SPEC: case SPEC:
dll_open (globals.input_name); dll_open (globals.input_name);
......
...@@ -486,7 +486,10 @@ static char *demangle_datatype (char **str, compound_type *ct, ...@@ -486,7 +486,10 @@ static char *demangle_datatype (char **str, compound_type *ct,
/* FIXME: P6 = Function pointer, others who knows.. */ /* FIXME: P6 = Function pointer, others who knows.. */
if (isdigit (*iter)) if (isdigit (*iter))
{
if (*iter == 6) printf("Function pointer in argument list is not handled yet\n");
return NULL; return NULL;
}
/* Recurse to get the pointed-to type */ /* Recurse to get the pointed-to type */
if (!demangle_datatype (&iter, &sub_ct, sym)) if (!demangle_datatype (&iter, &sub_ct, sym))
......
...@@ -336,15 +336,17 @@ static void dump_dir_exported_functions(void) ...@@ -336,15 +336,17 @@ static void dump_dir_exported_functions(void)
name = (char*)RVA(*pName, sizeof(DWORD)); name = (char*)RVA(*pName, sizeof(DWORD));
if (name && globals.do_demangle) if (name && globals.do_demangle)
{ {
symbol.symbol = strdup(name);
symbol_demangle (&symbol);
printf(" %08lX %4lu ", pFunc[*pOrdl], exportDir->Base + *pOrdl); printf(" %08lX %4lu ", pFunc[*pOrdl], exportDir->Base + *pOrdl);
if (symbol.flags & SYM_DATA)
printf (symbol.arg_text[0]); symbol_init(&symbol, name);
if (symbol_demangle(&symbol) == -1)
printf(name);
else if (symbol.flags & SYM_DATA)
printf(symbol.arg_text[0]);
else else
output_prototype(stdout, &symbol); output_prototype(stdout, &symbol);
printf("\n"); printf("\n");
symbol_clear(&symbol);
} }
else else
{ {
......
...@@ -72,6 +72,12 @@ static const char *known_longs[] = ...@@ -72,6 +72,12 @@ static const char *known_longs[] =
"WCHAR", "BOOL", "bool", "INT16", "WORD", "DWORD", NULL "WCHAR", "BOOL", "bool", "INT16", "WORD", "DWORD", NULL
}; };
int symbol_init(parsed_symbol* sym, const char* name)
{
memset(sym, 0, sizeof(parsed_symbol));
sym->symbol = strdup(name);
return 0;
}
/******************************************************************* /*******************************************************************
* symbol_clear * symbol_clear
......
...@@ -138,6 +138,8 @@ void dll_open (const char *dll_name); ...@@ -138,6 +138,8 @@ void dll_open (const char *dll_name);
int dll_next_symbol (parsed_symbol * sym); int dll_next_symbol (parsed_symbol * sym);
/* Symbol functions */ /* Symbol functions */
int symbol_init(parsed_symbol* symbol, const char* name);
int symbol_demangle (parsed_symbol *symbol); int symbol_demangle (parsed_symbol *symbol);
int symbol_search (parsed_symbol *symbol); int symbol_search (parsed_symbol *symbol);
......
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