debugger fixes

Eric Pouech eric.pouech at wanadoo.fr
Sat Feb 2 14:04:06 CST 2002


this patch does two things:
1/ removing some now obsolete readline support
2/ fix (f)lex symbol handling (when a precision was asked to the user,
multiple defined symbols for example), the symbol table was trashed too
early

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: wdbg_lex
ChangeLog: fixed some bad behavior when many symbols with same names where found
	removed external readline support
GenDate: 2002/02/02 18:20:53 UTC
ModifiedFiles: debugger/dbg.y debugger/debug.l debugger/debugger.h debugger/hash.c debugger/source.c
AddedFiles: 
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/dbg.y,v
retrieving revision 1.47
diff -u -u -r1.47 dbg.y
--- debugger/dbg.y	21 Dec 2001 20:29:58 -0000	1.47
+++ debugger/dbg.y	21 Jan 2002 07:17:51 -0000
@@ -21,7 +21,6 @@
 
 extern FILE * yyin;
 
-static void issue_prompt(void);
 static void mode_command(int);
 int yylex(void);
 int yyerror(char *);
@@ -81,8 +80,8 @@
 
 %%
 
-input: line                   	{ issue_prompt(); }
-    | input line                { issue_prompt(); }
+input: line                   	{ }
+    | input line                { }
 
 line: command 
     | tEOL
@@ -344,13 +344,6 @@
 
 %%
 
-static void issue_prompt(void)
-{
-#ifdef DONT_USE_READLINE
-   DEBUG_Printf(DBG_CHN_MESG, "Wine-dbg>");
-#endif
-}
-
 static void mode_command(int newmode)
 {
     switch(newmode)
@@ -410,7 +403,6 @@
     ret_ok = FALSE;
     do {
        __TRY {
-	  issue_prompt();
 	  ret_ok = TRUE;
 	  if ((ret = yyparse())) {
 	     DEBUG_FlushSymbols();
Index: debugger/debug.l
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/debug.l,v
retrieving revision 1.22
diff -u -u -r1.22 debug.l
--- debugger/debug.l	25 Nov 2001 00:48:44 -0000	1.22
+++ debugger/debug.l	30 Jan 2002 17:38:24 -0000
@@ -13,13 +13,11 @@
 #include "debugger.h"
 #include "y.tab.h"
 
-#ifndef DONT_USE_READLINE
 #undef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
-	if ( (result = DEBUG_ReadLine("Wine-dbg>", (char *) buf, max_size, TRUE )) < 0 ) \
+	if ( (result = DEBUG_ReadLine("Wine-dbg>", (char *) buf, max_size, TRUE, TRUE )) < 0 ) \
 	    YY_FATAL_ERROR( "read() in flex scanner failed" );
 
-#endif  /* DONT_USE_READLINE */
 
 #define YY_NO_UNPUT
 
@@ -169,8 +168,6 @@
 int yywrap(void) { return 1; }
 #endif
 
-#ifndef DONT_USE_READLINE
-
 #ifndef whitespace
 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
 #endif
@@ -195,7 +192,7 @@
   string[++i] = '\0';
 }
 
-int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind)
+int DEBUG_ReadLine(const char* pfx, char * buf, int size, int flush_sym, int keep_hist)
 {
     char 	buf_line[256];
     char*	ptr;
@@ -204,7 +201,7 @@
 
     for (;;)
     {
-        DEBUG_FlushSymbols();
+        if (flush_sym) DEBUG_FlushSymbols();
 	/* as of today, console handles can be file handles... so better use file APIs rather than
 	 * consoles
 	 */
@@ -219,7 +216,7 @@
         /* Remove leading and trailing whitespace from the line */
         stripwhite (buf_line);
 
-	if (remind)
+	if (keep_hist)
 	{
 	    static char last_line[256] = "";
 	    /* If there is anything left, add it to the history list
@@ -234,7 +231,7 @@
 	}
 	else
 	{
-	    /* I could also tweak with the undoc functions to remove this line from the console
+	    /* I should also tweak with the undoc functions to remove this line from the console
 	     * history... */
 	    ptr = buf_line;
 	}
@@ -269,5 +266,3 @@
 	while(--next_symbol >= 0) DBG_free(local_symbols[next_symbol]);
 	next_symbol = 0;
 }
-
-#endif  /* DONT_USE_READLINE */
Index: debugger/debugger.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/debugger.h,v
retrieving revision 1.27
diff -u -u -r1.27 debugger.h
--- debugger/debugger.h	21 Dec 2001 20:29:58 -0000	1.27
+++ debugger/debugger.h	30 Jan 2002 17:37:17 -0000
@@ -287,13 +291,13 @@
 extern void DEBUG_Disasm( DBG_ADDR *addr, int display );
 
   /* debugger/dbg.y */
 extern BOOL DEBUG_Parser(void);
 extern void DEBUG_Exit( DWORD );
 
   /* debugger/debug.l */
 extern void DEBUG_FlushSymbols(void);
 extern char*DEBUG_MakeSymbol(const char*);
-extern int  DEBUG_ReadLine(const char* pfx, char* buffer, int size, int remind);
+extern int  DEBUG_ReadLine(const char* pfx, char* buffer, int size, int flush_sym, int keep_hist);
 
   /* debugger/display.c */
 extern int DEBUG_DoDisplay(void);
Index: debugger/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/hash.c,v
retrieving revision 1.26
diff -u -u -r1.26 hash.c
--- debugger/hash.c	12 Jan 2002 21:14:40 -0000	1.26
+++ debugger/hash.c	30 Jan 2002 17:38:03 -0000
@@ -413,7 +413,7 @@
       }
       do {
 	  i = 0;
-	  if (DEBUG_ReadLine("=> ", buffer, sizeof(buffer), FALSE))
+	  if (DEBUG_ReadLine("=> ", buffer, sizeof(buffer), FALSE, FALSE))
 	  {
 	      i = atoi(buffer);
 	      if (i < 1 || i > num)
Index: debugger/source.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/source.c,v
retrieving revision 1.17
diff -u -u -r1.17 source.c
--- debugger/source.c	23 Nov 2001 23:10:08 -0000	1.17
+++ debugger/source.c	30 Jan 2002 17:38:03 -0000
@@ -188,7 +188,7 @@
 	       * Still couldn't find it.  Ask user for path to add.
 	       */
 	      sprintf(zbuf, "Enter path to file '%s': ", sourcefile);
-	      DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE);
+	      DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE, FALSE);
 	      
 	      if( tmppath[strlen(tmppath)-1] == '\n' )
 		{


More information about the wine-patches mailing list