winedump fixes

eric pouech eric.pouech at wanadoo.fr
Sat Sep 15 13:32:35 CDT 2001


this patch should fix some errors occuring while dumping demangled
symbols 
in winedump
however, there's still some demangling code to be added (functions
pointers
are not handled yet)

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: winedump
ChangeLog: fixed demangling invocation
	be a bit more verbose on implemented features
GenDate: 2001/09/15 18:30:42 UTC
ModifiedFiles: tools/winedump/pe.c tools/winedump/main.c tools/winedump/msmangle.c tools/winedump/symbol.c tools/winedump/winedump.h
AddedFiles: 
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winedump/pe.c,v
retrieving revision 1.2
diff -u -u -r1.2 pe.c
--- tools/winedump/pe.c	2001/09/14 00:16:12	1.2
+++ tools/winedump/pe.c	2001/09/15 07:08:19
@@ -336,15 +336,17 @@
 	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
 	{
Index: tools/winedump/main.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winedump/main.c,v
retrieving revision 1.1
diff -u -u -r1.1 main.c
--- tools/winedump/main.c	2001/09/07 16:04:39	1.1
+++ tools/winedump/main.c	2001/09/15 07:06:33
@@ -149,7 +149,7 @@
 
 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 @@
 {
     parsed_symbol symbol;
     int count = 0;
-    int result;
 
     globals.mode = NONE;
 
@@ -272,15 +271,18 @@
     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);
 
Index: tools/winedump/msmangle.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winedump/msmangle.c,v
retrieving revision 1.1
diff -u -u -r1.1 msmangle.c
--- tools/winedump/msmangle.c	2001/09/07 16:04:39	1.1
+++ tools/winedump/msmangle.c	2001/09/15 06:56:17
@@ -486,7 +486,10 @@
 
         /* 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))
Index: tools/winedump/symbol.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winedump/symbol.c,v
retrieving revision 1.1
diff -u -u -r1.1 symbol.c
--- tools/winedump/symbol.c	2001/09/07 16:04:39	1.1
+++ tools/winedump/symbol.c	2001/09/15 07:06:15
@@ -72,6 +72,12 @@
   "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
Index: tools/winedump/winedump.h
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winedump/winedump.h,v
retrieving revision 1.1
diff -u -u -r1.1 winedump.h
--- tools/winedump/winedump.h	2001/09/07 16:04:39	1.1
+++ tools/winedump/winedump.h	2001/09/15 07:03:14
@@ -138,6 +138,8 @@
 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);


More information about the wine-patches mailing list