Fixed demangling invocation.

Be a bit more verbose on implemented features.
This commit is contained in:
Eric Pouech 2001-09-17 20:26:27 +00:00 committed by Alexandre Julliard
parent 7c1db50c2f
commit 5bdbc1a37e
5 changed files with 25 additions and 10 deletions

View File

@ -149,7 +149,7 @@ struct option
static const struct option option_table[] = {
{"-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"},
{"-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)"},
@ -259,7 +259,6 @@ int main (int argc, char *argv[])
{
parsed_symbol symbol;
int count = 0;
int result;
globals.mode = NONE;
@ -272,15 +271,18 @@ int main (int argc, char *argv[])
case DMGL:
globals.uc_dll_name = "";
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)
printf (symbol.arg_text[0]);
else
output_prototype (stdout, &symbol);
fputc ('\n', stdout);
return result ? 1 : 0;
symbol_clear(&symbol);
break;
case SPEC:
dll_open (globals.input_name);

View File

@ -486,7 +486,10 @@ static char *demangle_datatype (char **str, compound_type *ct,
/* FIXME: P6 = Function pointer, others who knows.. */
if (isdigit (*iter))
{
if (*iter == 6) printf("Function pointer in argument list is not handled yet\n");
return NULL;
}
/* Recurse to get the pointed-to type */
if (!demangle_datatype (&iter, &sub_ct, sym))

View File

@ -336,15 +336,17 @@ static void dump_dir_exported_functions(void)
name = (char*)RVA(*pName, sizeof(DWORD));
if (name && globals.do_demangle)
{
symbol.symbol = strdup(name);
symbol_demangle (&symbol);
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
output_prototype(stdout, &symbol);
printf("\n");
symbol_clear(&symbol);
}
else
{

View File

@ -72,6 +72,12 @@ static const char *known_longs[] =
"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

View File

@ -138,6 +138,8 @@ void dll_open (const char *dll_name);
int dll_next_symbol (parsed_symbol * sym);
/* Symbol functions */
int symbol_init(parsed_symbol* symbol, const char* name);
int symbol_demangle (parsed_symbol *symbol);
int symbol_search (parsed_symbol *symbol);