From d727a9bcf4071f793b5252c8d8c79991cf8f5cc2 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 4 Feb 2002 18:40:40 +0000 Subject: [PATCH] Fixed some bad behavior when many symbols with same names where found. Removed external readline support. --- debugger/dbg.y | 13 ++----------- debugger/debug.l | 16 +++++----------- debugger/debugger.h | 2 +- debugger/hash.c | 2 +- debugger/source.c | 2 +- 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/debugger/dbg.y b/debugger/dbg.y index f736b78a761..86af2a82499 100644 --- a/debugger/dbg.y +++ b/debugger/dbg.y @@ -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 @@ int yyerror(char *); %% -input: line { issue_prompt(); } - | input line { issue_prompt(); } +input: line + | input line line: command | tEOL @@ -344,13 +343,6 @@ identifier: %% -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 +402,6 @@ BOOL DEBUG_Parser(void) ret_ok = FALSE; do { __TRY { - issue_prompt(); ret_ok = TRUE; if ((ret = yyparse())) { DEBUG_FlushSymbols(); diff --git a/debugger/debug.l b/debugger/debug.l index c882eada5af..442984074af 100644 --- a/debugger/debug.l +++ b/debugger/debug.l @@ -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 +167,6 @@ enum { return tENUM; } int yywrap(void) { return 1; } #endif -#ifndef DONT_USE_READLINE - #ifndef whitespace #define whitespace(c) (((c) == ' ') || ((c) == '\t')) #endif @@ -195,7 +191,7 @@ static void stripwhite (char *string) 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 +200,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind) 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 +215,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind) /* 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 +230,7 @@ int DEBUG_ReadLine(const char* pfx, char * buf, int size, int remind) } 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 +265,3 @@ void DEBUG_FlushSymbols(void) while(--next_symbol >= 0) DBG_free(local_symbols[next_symbol]); next_symbol = 0; } - -#endif /* DONT_USE_READLINE */ diff --git a/debugger/debugger.h b/debugger/debugger.h index 526e1f6728e..cffdbf78cdf 100644 --- a/debugger/debugger.h +++ b/debugger/debugger.h @@ -293,7 +293,7 @@ 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); diff --git a/debugger/hash.c b/debugger/hash.c index d987b8dcee0..a9abbda76d8 100644 --- a/debugger/hash.c +++ b/debugger/hash.c @@ -413,7 +413,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno, } 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) diff --git a/debugger/source.c b/debugger/source.c index ec5b1d0913b..d7375242cbe 100644 --- a/debugger/source.c +++ b/debugger/source.c @@ -188,7 +188,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end) * 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' ) {