winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
569 discussions
Start a n
N
ew thread
Eric Pouech : winedbg: Support 'run' command with arguments to restart current debuggee.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 4448ef5031a9e3ac6f4208d238d9c27e7e0d6fd6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4448ef5031a9e3ac6f4208d2…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:30:29 2021 +0100 winedbg: Support 'run' command with arguments to restart current debuggee. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/dbg.y | 10 ++++++-- programs/winedbg/debug.l | 8 +++--- programs/winedbg/debugger.h | 7 +++++- programs/winedbg/tgt_active.c | 55 +++++++++++++++++++++++++++++++---------- programs/winedbg/winedbg.man.in | 8 ++++++ 5 files changed, 69 insertions(+), 19 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 612e6a4106d..c5e7b2b43ca 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -43,6 +43,7 @@ static void parser(const char*); IMAGEHLP_LINE64 listing; struct expr* expression; struct type_expr_t type; + struct list_string* strings; } %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tALL tINFO tUP tDOWN @@ -85,6 +86,7 @@ static void parser(const char*); %type <string> pathname identifier cpp_identifier %type <listing> list_arg %type <type> type_expr +%type <strings> list_of_words %% @@ -183,8 +185,12 @@ list_arg: ; run_command: - tRUN { dbg_run_debuggee(NULL); } - | tRUN tSTRING { dbg_run_debuggee($2); } + tRUN list_of_words { dbg_run_debuggee($2); } + ; + +list_of_words: + %empty { $$ = NULL; } + | tSTRING list_of_words { $$ = (struct list_string*)lexeme_alloc_size(sizeof(*$$)); $$->next = $2; $$->string = $1; } ; list_command: diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 280dcbfbc6b..dc93901a71c 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -115,6 +115,7 @@ STRING \"(\\[^\n]|[^\\"\n])*\" %x PATH_EXPECTED %x ASTRING_EXPECTED +%x AWORD_EXPECTED %x NOPROCESS %% /* set to special state when no process is loaded. */ @@ -153,10 +154,11 @@ STRING \"(\\[^\n]|[^\\"\n])*\" <FORMAT_EXPECTED>"/"{FORMAT} { dbg_lval.integer = (1 << 8) | yytext[1]; return tFORMAT; } -{STRING} { dbg_lval.string = unescape_string(yytext); return tSTRING;} +<*>{STRING} { dbg_lval.string = unescape_string(yytext); return tSTRING;} <ASTRING_EXPECTED>[^\n]+ { char* p = yytext; while (*p == ' ' || *p == '\t') p++; dbg_lval.string = lexeme_alloc(p); return tSTRING; } - +<AWORD_EXPECTED>[^ \t\n]+ { char* p = yytext; while (*p == ' ' || *p == '\t') p++; + dbg_lval.string = lexeme_alloc(p); return tSTRING; } <INITIAL,NOPROCESS>info|inf|in { BEGIN(INFO_CMD); return tINFO; } <INITIAL>up { BEGIN(NOCMD); return tUP; } <INITIAL>down|dow|do { BEGIN(NOCMD); return tDOWN; } @@ -200,7 +202,7 @@ STRING \"(\\[^\n]|[^\\"\n])*\" <INITIAL>watch|watc|wat { BEGIN(NOCMD); return tWATCH; } <INITIAL>rwatch|rwatc|rwat { BEGIN(NOCMD); return tRWATCH; } <INITIAL>whatis|whati|what { BEGIN(NOCMD); return tWHATIS; } -<INITIAL,NOPROCESS>run|ru|r { BEGIN(ASTRING_EXPECTED); return tRUN;} +<INITIAL,NOPROCESS>run|ru|r { BEGIN(AWORD_EXPECTED); return tRUN;} <INITIAL>detach|detac|deta|det { BEGIN(NOCMD); return tDETACH; } <INITIAL>kill|kil|ki|k { BEGIN(NOCMD); return tKILL; } <INITIAL,NOPROCESS>maintenance|maint { BEGIN(MAINT_CMD); return tMAINTENANCE; } diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index c511f3f76bc..0e6d715a2d1 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -421,7 +421,12 @@ extern enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv struct dbg_lvalue* rtn); /* tgt_active.c */ -extern void dbg_run_debuggee(const char* args); +struct list_string +{ + char* string; + struct list_string* next; +}; +extern void dbg_run_debuggee(struct list_string* ls); extern void dbg_wait_next_exception(DWORD cont, int count, int mode); extern enum dbg_start dbg_active_attach(int argc, char* argv[]); extern BOOL dbg_set_curr_thread(DWORD tid); diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 4bcd5ba659e..0993bddc985 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -31,6 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg); +static char* dbg_executable; static char* dbg_last_cmd_line; static struct be_process_io be_process_active_io; @@ -632,6 +633,11 @@ static BOOL dbg_start_debuggee(LPSTR cmdLine) dbg_curr_pid = info.dwProcessId; if (!(dbg_curr_process = dbg_add_process(&be_process_active_io, dbg_curr_pid, 0))) return FALSE; dbg_curr_process->active_debuggee = TRUE; + if (cmdLine != dbg_last_cmd_line) + { + free(dbg_last_cmd_line); + dbg_last_cmd_line = cmdLine; + } return TRUE; } @@ -718,24 +724,46 @@ static char *dbg_build_command_line( char **argv ) } -void dbg_run_debuggee(const char* args) +void dbg_run_debuggee(struct list_string* ls) { - if (args) + if (dbg_curr_process) { - WINE_FIXME("Re-running current program with %s as args is broken\n", wine_dbgstr_a(args)); + dbg_printf("Already attached to a process. Use 'detach' or 'kill' before using 'run'\n"); return; } - else + if (!dbg_executable) { - if (!dbg_last_cmd_line) + dbg_printf("No active target to be restarted\n"); + return; + } + if (ls) + { + char* cl; + char** argv; + unsigned argc = 2, i; + struct list_string* cls; + + for (cls = ls; cls; cls = cls->next) argc++; + if (!(argv = malloc(argc * sizeof(argv[0])))) return; + argv[0] = dbg_executable; + for (i = 1, cls = ls; cls; cls = cls->next, i++) argv[i] = cls->string; + argv[i] = NULL; + cl = dbg_build_command_line(argv); + free(argv); + + if (!cl || !dbg_start_debuggee(cl)) { - dbg_printf("Cannot find previously used command line.\n"); - return; - } - dbg_start_debuggee(dbg_last_cmd_line); - dbg_active_wait_for_first_exception(); - source_list_from_addr(NULL, 0); + free(cl); + return; + } + } + else + { + if (!dbg_last_cmd_line) dbg_last_cmd_line = strdup(dbg_executable); + dbg_start_debuggee(dbg_last_cmd_line); } + dbg_active_wait_for_first_exception(); + source_list_from_addr(NULL, 0); } static BOOL str2int(const char* str, DWORD_PTR* val) @@ -893,14 +921,15 @@ enum dbg_start dbg_active_launch(int argc, char* argv[]) if (argc == 0) return start_error_parse; + dbg_executable = strdup(argv[0]); cmd_line = dbg_build_command_line(argv); + if (!dbg_start_debuggee(cmd_line)) { free(cmd_line); return start_error_init; } - free(dbg_last_cmd_line); - dbg_last_cmd_line = cmd_line; + return start_ok; } diff --git a/programs/winedbg/winedbg.man.in b/programs/winedbg/winedbg.man.in index 6ed8d4474c4..871b7ad6764 100644 --- a/programs/winedbg/winedbg.man.in +++ b/programs/winedbg/winedbg.man.in @@ -109,6 +109,8 @@ of variations from \fBgdb\fR commands. Aborts the debugger. .IP \fBquit\fR Exits the debugger. +.PP +\fIProcess handling\fR .IP \fBattach\ \fIN\fR Attach to a Wine process (\fIN\fR is its Windows ID, numeric or hexadecimal). IDs can be obtained using the \fBinfo\ process\fR command. Note the @@ -119,6 +121,12 @@ Detach from a Wine-process. .IP \fBthread\ \fIN\fR Change the current thread to \fIN\fR (its Windows TID, numeric or hexadecimal). .IP +.IP \fBrun\fR +Re-run the same process with the same arguments. +Note: all breakpoints of precedent process are no longer available. +.IP \fBrun\ \fIarg1\ arg2...\fR +Re-run the same process with arguments \fIarg1\ arg2...\fR. +Note: all breakpoints of precedent process are no longer available. .PP \fIHelp commands\fR .IP \fBhelp\fR
1
0
0
0
Eric Pouech : winedbg: Properly handle escaped characters inside strings.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: d331d9cb936f047fd94c4b30b16f81d549c131ac URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d331d9cb936f047fd94c4b30…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:30:23 2021 +0100 winedbg: Properly handle escaped characters inside strings. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/debug.l | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index a497f34e6b0..280dcbfbc6b 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -60,6 +60,34 @@ void lexeme_flush(void) next_lexeme = 0; } +/* called with quoted string, unescape all elements inside the quotes */ +static char* unescape_string(const char* str) +{ + size_t len = strlen(str) - 2; + char* ret = lexeme_alloc_size(len + 1); + char* dst = ret; + const char* ptr; + for (ptr = str + 1; ptr < str + 1 + len; ptr++) + { + if (*ptr == '\\') + { + switch (*++ptr) + { + case 't': *dst++ = '\t'; break; + case 'r': *dst++ = '\r'; break; + case 'n': *dst++ = '\n'; break; + case '\\': *dst++ = '\\'; break; + case '"': *dst++ = '"'; break; + default: *dst++ = '\\'; *dst++ = *ptr; /* not handled, don't change */ + } + } + else + *dst++ = *ptr; + } + *dst = '\0'; + return ret; +} + #define YY_INPUT(buf,result,max_size) \ (result = input_lex_read_buffer(buf, max_size)) @@ -72,7 +100,7 @@ HEXDIGIT [0-9a-fA-F] FORMAT [ubcdgiswxa] IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]* PATHNAME [\\/_a-zA-Z0-9\.~@][\\/\-_a-zA-Z0-9\.~@]* -STRING \"[^\n"]+\" +STRING \"(\\[^\n]|[^\\"\n])*\" %s FORMAT_EXPECTED %s INFO_CMD @@ -125,7 +153,7 @@ STRING \"[^\n"]+\" <FORMAT_EXPECTED>"/"{FORMAT} { dbg_lval.integer = (1 << 8) | yytext[1]; return tFORMAT; } -{STRING} { dbg_lval.string = lexeme_alloc(yytext + 1); dbg_lval.string[strlen(dbg_lval.string) - 1] = '\0'; return tSTRING; } +{STRING} { dbg_lval.string = unescape_string(yytext); return tSTRING;} <ASTRING_EXPECTED>[^\n]+ { char* p = yytext; while (*p == ' ' || *p == '\t') p++; dbg_lval.string = lexeme_alloc(p); return tSTRING; }
1
0
0
0
Eric Pouech : winedbg: Properly escape debuggee arguments.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 94ca4be2a62cdb05adaee524084875b04b283afb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=94ca4be2a62cdb05adaee524…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:30:17 2021 +0100 winedbg: Properly escape debuggee arguments. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/tgt_active.c | 106 +++++++++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 21 deletions(-) diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 2a2af67debe..4bcd5ba659e 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -636,6 +636,88 @@ static BOOL dbg_start_debuggee(LPSTR cmdLine) return TRUE; } +/*********************************************************************** + * dbg_build_command_line + * + * (converted from dlls/ntdll/unix/env.c) + * + * Build the command line of a process from the argv array. + * + * We must quote and escape characters so that the argv array can be rebuilt + * from the command line: + * - spaces and tabs must be quoted + * 'a b' -> '"a b"' + * - quotes must be escaped + * '"' -> '\"' + * - if '\'s are followed by a '"', they must be doubled and followed by '\"', + * resulting in an odd number of '\' followed by a '"' + * '\"' -> '\\\"' + * '\\"' -> '\\\\\"' + * - '\'s are followed by the closing '"' must be doubled, + * resulting in an even number of '\' followed by a '"' + * ' \' -> '" \\"' + * ' \\' -> '" \\\\"' + * - '\'s that are not followed by a '"' can be left as is + * 'a\b' == 'a\b' + * 'a\\b' == 'a\\b' + */ +static char *dbg_build_command_line( char **argv ) +{ + int len; + char **arg, *ret; + LPSTR p; + + len = 1; + for (arg = argv; *arg; arg++) len += 3 + 2 * strlen( *arg ); + if (!(ret = malloc( len ))) return NULL; + + p = ret; + for (arg = argv; *arg; arg++) + { + BOOL has_space, has_quote; + int i, bcount; + char *a; + + /* check for quotes and spaces in this argument (first arg is always quoted) */ + has_space = (arg == argv) || !**arg || strchr( *arg, ' ' ) || strchr( *arg, '\t' ); + has_quote = strchr( *arg, '"' ) != NULL; + + /* now transfer it to the command line */ + if (has_space) *p++ = '"'; + if (has_quote || has_space) + { + bcount = 0; + for (a = *arg; *a; a++) + { + if (*a == '\\') bcount++; + else + { + if (*a == '"') /* double all the '\\' preceding this '"', plus one */ + for (i = 0; i <= bcount; i++) *p++ = '\\'; + bcount = 0; + } + *p++ = *a; + } + } + else + { + strcpy( p, *arg ); + p += strlen( p ); + } + if (has_space) + { + /* Double all the '\' preceding the closing quote */ + for (i = 0; i < bcount; i++) *p++ = '\\'; + *p++ = '"'; + } + *p++ = ' '; + } + if (p > ret) p--; /* remove last space */ + *p = 0; + return ret; +} + + void dbg_run_debuggee(const char* args) { if (args) @@ -807,35 +889,17 @@ enum dbg_start dbg_active_attach(int argc, char* argv[]) */ enum dbg_start dbg_active_launch(int argc, char* argv[]) { - int i, len; LPSTR cmd_line; if (argc == 0) return start_error_parse; - if (!(cmd_line = HeapAlloc(GetProcessHeap(), 0, len = 1))) - { - oom_leave: - dbg_printf("Out of memory\n"); - return start_error_init; - } - cmd_line[0] = '\0'; - - for (i = 0; i < argc; i++) - { - len += strlen(argv[i]) + 1; - if (!(cmd_line = HeapReAlloc(GetProcessHeap(), 0, cmd_line, len))) - goto oom_leave; - strcat(cmd_line, argv[i]); - cmd_line[len - 2] = ' '; - cmd_line[len - 1] = '\0'; - } - + cmd_line = dbg_build_command_line(argv); if (!dbg_start_debuggee(cmd_line)) { - HeapFree(GetProcessHeap(), 0, cmd_line); + free(cmd_line); return start_error_init; } - HeapFree(GetProcessHeap(), 0, dbg_last_cmd_line); + free(dbg_last_cmd_line); dbg_last_cmd_line = cmd_line; return start_ok; }
1
0
0
0
Eric Pouech : winedbg: Don't repeat last command (from empty input) when parsing a file.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 44f49d75ec27ba6109d62e090f2c27e45a70e6e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=44f49d75ec27ba6109d62e09…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:30:11 2021 +0100 winedbg: Don't repeat last command (from empty input) when parsing a file. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/dbg.y | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index b58875b6c31..612e6a4106d 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -524,10 +524,9 @@ size_t input_lex_read_buffer(char* buf, int size) len--; } - /* FIXME: should have a pair of buffers, and switch between the two, instead of - * reallocating a new one for each line - */ - if (dbg_parser.last_line && (len == 0 || (len == 1 && tmp[0] == '\n'))) + /* recall last command when empty input buffer and not parsing a file */ + if (dbg_parser.last_line && (len == 0 || (len == 1 && tmp[0] == '\n')) && + dbg_parser.output != INVALID_HANDLE_VALUE) { HeapFree(GetProcessHeap(), 0, tmp); }
1
0
0
0
Eric Pouech : winedbg: Move lex buffers inside struct parser_context.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 956a978801e1403f4944d779c183230900fa89c0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=956a978801e1403f4944d779…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:30:05 2021 +0100 winedbg: Move lex buffers inside struct parser_context. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/dbg.y | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index ace29039753..b58875b6c31 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -458,9 +458,11 @@ struct parser_context HANDLE input; HANDLE output; unsigned line_no; + char* last_line; + size_t last_line_idx; }; -static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0}; +static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0, NULL, 0}; static int input_fetch_entire_line(const char* pfx, char** line) { @@ -504,11 +506,9 @@ static int input_fetch_entire_line(const char* pfx, char** line) size_t input_lex_read_buffer(char* buf, int size) { int len; - static char* last_line = NULL; - static size_t last_line_idx = 0; /* try first to fetch the remaining of an existing line */ - if (last_line_idx == 0) + if (dbg_parser.last_line_idx == 0) { char* tmp = NULL; /* no remaining chars to be read from last line, grab a brand new line up to '\n' */ @@ -527,22 +527,22 @@ size_t input_lex_read_buffer(char* buf, int size) /* FIXME: should have a pair of buffers, and switch between the two, instead of * reallocating a new one for each line */ - if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n'))) + if (dbg_parser.last_line && (len == 0 || (len == 1 && tmp[0] == '\n'))) { HeapFree(GetProcessHeap(), 0, tmp); } else { - HeapFree(GetProcessHeap(), 0, last_line); - last_line = tmp; + HeapFree(GetProcessHeap(), 0, dbg_parser.last_line); + dbg_parser.last_line = tmp; } } - len = min(strlen(last_line + last_line_idx), size - 1); - memcpy(buf, last_line + last_line_idx, len); + len = min(strlen(dbg_parser.last_line + dbg_parser.last_line_idx), size - 1); + memcpy(buf, dbg_parser.last_line + dbg_parser.last_line_idx, len); buf[len] = '\0'; - if ((last_line_idx += len) >= strlen(last_line)) - last_line_idx = 0; + if ((dbg_parser.last_line_idx += len) >= strlen(dbg_parser.last_line)) + dbg_parser.last_line_idx = 0; return len; } @@ -585,6 +585,8 @@ void parser_handle(const char* filename, HANDLE input) } dbg_parser.line_no = 0; dbg_parser.filename = filename; + dbg_parser.last_line = NULL; + dbg_parser.last_line_idx = 0; do { __TRY
1
0
0
0
Eric Pouech : winedbg: Move YY_INPUT implementation to dbg.y.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 5ffd0d05a8482bad7cdd182ef16138aeec330849 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ffd0d05a8482bad7cdd182e…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:29:59 2021 +0100 winedbg: Move YY_INPUT implementation to dbg.y. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/dbg.y | 47 ++++++++++++++++++++++++++++++++++++++++++++- programs/winedbg/debug.l | 47 +-------------------------------------------- programs/winedbg/debugger.h | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 2106b8414e8..ace29039753 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -462,7 +462,7 @@ struct parser_context static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0}; -int input_fetch_entire_line(const char* pfx, char** line) +static int input_fetch_entire_line(const char* pfx, char** line) { char* buffer; char ch; @@ -501,6 +501,51 @@ int input_fetch_entire_line(const char* pfx, char** line) return len; } +size_t input_lex_read_buffer(char* buf, int size) +{ + int len; + static char* last_line = NULL; + static size_t last_line_idx = 0; + + /* try first to fetch the remaining of an existing line */ + if (last_line_idx == 0) + { + char* tmp = NULL; + /* no remaining chars to be read from last line, grab a brand new line up to '\n' */ + lexeme_flush(); + len = input_fetch_entire_line("Wine-dbg>", &tmp); + if (len < 0) return 0; /* eof */ + + /* remove carriage return in newline */ + if (len >= 2 && tmp[len - 2] == '\r') + { + tmp[len - 2] = '\n'; + tmp[len - 1] = '\0'; + len--; + } + + /* FIXME: should have a pair of buffers, and switch between the two, instead of + * reallocating a new one for each line + */ + if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n'))) + { + HeapFree(GetProcessHeap(), 0, tmp); + } + else + { + HeapFree(GetProcessHeap(), 0, last_line); + last_line = tmp; + } + } + + len = min(strlen(last_line + last_line_idx), size - 1); + memcpy(buf, last_line + last_line_idx, len); + buf[len] = '\0'; + if ((last_line_idx += len) >= strlen(last_line)) + last_line_idx = 0; + return len; +} + int input_read_line(const char* pfx, char* buf, int size) { char* line = NULL; diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 3c9acc5fe60..a497f34e6b0 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -60,53 +60,8 @@ void lexeme_flush(void) next_lexeme = 0; } -static size_t read_input(const char* pfx, char* buf, int size) -{ - int len; - static char* last_line = NULL; - static size_t last_line_idx = 0; - - /* try first to fetch the remaining of an existing line */ - if (last_line_idx == 0) - { - char* tmp = NULL; - /* no remaining chars to be read from last line, grab a brand new line up to '\n' */ - lexeme_flush(); - len = input_fetch_entire_line(pfx, &tmp); - if (len < 0) return 0; /* eof */ - - /* remove carriage return in newline */ - if (len >= 2 && tmp[len - 2] == '\r') - { - tmp[len - 2] = '\n'; - tmp[len - 1] = '\0'; - len--; - } - - /* FIXME: should have a pair of buffers, and switch between the two, instead of - * reallocating a new one for each line - */ - if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n'))) - { - HeapFree(GetProcessHeap(), 0, tmp); - } - else - { - HeapFree(GetProcessHeap(), 0, last_line); - last_line = tmp; - } - } - - len = min(strlen(last_line + last_line_idx), size - 1); - memcpy(buf, last_line + last_line_idx, len); - buf[len] = '\0'; - if ((last_line_idx += len) >= strlen(last_line)) - last_line_idx = 0; - return len; -} - #define YY_INPUT(buf,result,max_size) \ - (result = read_input("Wine-dbg>", buf, max_size)) + (result = input_lex_read_buffer(buf, max_size)) static int syntax_error; %} diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 8180488d1e5..c511f3f76bc 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -311,7 +311,7 @@ extern int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UI /* dbg.y */ extern void parser_handle(const char*, HANDLE); extern int input_read_line(const char* pfx, char* buffer, int size); -extern int input_fetch_entire_line(const char* pfx, char** line); +extern size_t input_lex_read_buffer(char* pfx, int size); extern HANDLE WINAPIV parser_generate_command_file(const char*, ...); /* debug.l */
1
0
0
0
Eric Pouech : winedbg: Display line number of syntax errors when reading a command file.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 5a94f200650b61c9cec1e10d260472334f357d37 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5a94f200650b61c9cec1e10d…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:29:52 2021 +0100 winedbg: Display line number of syntax errors when reading a command file. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/dbg.y | 41 +++++++++++++++++++++++++---------------- programs/winedbg/debugger.h | 4 ++-- programs/winedbg/tgt_active.c | 6 +++--- programs/winedbg/winedbg.c | 8 +++++--- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 3b206342946..2106b8414e8 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -452,8 +452,15 @@ static LONG WINAPI wine_dbg_cmd(EXCEPTION_POINTERS *eptr) return EXCEPTION_EXECUTE_HANDLER; } -static HANDLE dbg_parser_input; -static HANDLE dbg_parser_output; +struct parser_context +{ + const char* filename; + HANDLE input; + HANDLE output; + unsigned line_no; +}; + +static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0}; int input_fetch_entire_line(const char* pfx, char** line) { @@ -465,15 +472,16 @@ int input_fetch_entire_line(const char* pfx, char** line) /* as of today, console handles can be file handles... so better use file APIs rather than * console's */ - WriteFile(dbg_parser_output, pfx, strlen(pfx), &nread, NULL); + WriteFile(dbg_parser.output, pfx, strlen(pfx), &nread, NULL); buffer = HeapAlloc(GetProcessHeap(), 0, alloc = 16); assert(buffer != NULL); + dbg_parser.line_no++; len = 0; do { - if (!ReadFile(dbg_parser_input, &ch, 1, &nread, NULL) || nread == 0) + if (!ReadFile(dbg_parser.input, &ch, 1, &nread, NULL) || nread == 0) { HeapFree(GetProcessHeap(), 0, buffer); return -1; @@ -513,25 +521,25 @@ int input_read_line(const char* pfx, char* buf, int size) * * Debugger command line parser */ -void parser_handle(HANDLE input) +void parser_handle(const char* filename, HANDLE input) { - BOOL ret_ok; - HANDLE in_copy = dbg_parser_input; - HANDLE out_copy = dbg_parser_output; + BOOL ret_ok; + struct parser_context prev = dbg_parser; ret_ok = FALSE; if (input != INVALID_HANDLE_VALUE) { - dbg_parser_output = INVALID_HANDLE_VALUE; - dbg_parser_input = input; + dbg_parser.output = INVALID_HANDLE_VALUE; + dbg_parser.input = input; } else { - dbg_parser_output = GetStdHandle(STD_OUTPUT_HANDLE); - dbg_parser_input = GetStdHandle(STD_INPUT_HANDLE); + dbg_parser.output = GetStdHandle(STD_OUTPUT_HANDLE); + dbg_parser.input = GetStdHandle(STD_INPUT_HANDLE); } - + dbg_parser.line_no = 0; + dbg_parser.filename = filename; do { __TRY @@ -547,8 +555,7 @@ void parser_handle(HANDLE input) lexeme_flush(); } while (!ret_ok); - dbg_parser_input = in_copy; - dbg_parser_output = out_copy; + dbg_parser = prev; } static void parser(const char* filename) @@ -556,13 +563,15 @@ static void parser(const char* filename) HANDLE h = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0L, 0); if (h != INVALID_HANDLE_VALUE) { - parser_handle(h); + parser_handle(filename, h); CloseHandle(h); } } static int dbg_error(const char* s) { + if (dbg_parser.filename) + dbg_printf("%s:%d:", dbg_parser.filename, dbg_parser.line_no); dbg_printf("%s\n", s); return 0; } diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 28126c28930..8180488d1e5 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -309,7 +309,7 @@ extern HANDLE display_crash_details(HANDLE event); extern int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UINT uType); /* dbg.y */ -extern void parser_handle(HANDLE); +extern void parser_handle(const char*, HANDLE); extern int input_read_line(const char* pfx, char* buffer, int size); extern int input_fetch_entire_line(const char* pfx, char** line); extern HANDLE WINAPIV parser_generate_command_file(const char*, ...); @@ -476,7 +476,7 @@ extern void dbg_del_thread(struct dbg_thread* t); extern BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade); extern BOOL dbg_load_module(HANDLE hProc, HANDLE hFile, const WCHAR* name, DWORD_PTR base, DWORD size); extern void dbg_set_option(const char*, const char*); -extern void dbg_start_interactive(HANDLE hFile); +extern void dbg_start_interactive(const char*, HANDLE hFile); extern void dbg_init_console(void); /* gdbproxy.c */ diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 2fd05df39d9..2a2af67debe 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -865,7 +865,7 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) case ID_DEBUG: AllocConsole(); dbg_init_console(); - dbg_start_interactive(INVALID_HANDLE_VALUE); + dbg_start_interactive(NULL, INVALID_HANDLE_VALUE); return start_ok; case ID_DETAILS: event = CreateEventW( NULL, TRUE, FALSE, NULL ); @@ -882,7 +882,7 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) dbg_active_wait_for_first_exception(); dbg_interactiveP = TRUE; - parser_handle(input); + parser_handle(NULL, input); output_system_info(); if (output != INVALID_HANDLE_VALUE) @@ -963,7 +963,7 @@ enum dbg_start dbg_active_minidump(int argc, char* argv[]) dbg_active_wait_for_first_exception(); dbg_interactiveP = TRUE; - parser_handle(hFile); + parser_handle(NULL, hFile); return start_ok; } diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 55801536a79..659ca364544 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -562,7 +562,7 @@ static int dbg_winedbg_usage(BOOL advanced) return 0; } -void dbg_start_interactive(HANDLE hFile) +void dbg_start_interactive(const char* filename, HANDLE hFile) { struct dbg_process* p; struct dbg_process* p2; @@ -574,7 +574,7 @@ void dbg_start_interactive(HANDLE hFile) } dbg_interactiveP = TRUE; - parser_handle(hFile); + parser_handle(filename, hFile); LIST_FOR_EACH_ENTRY_SAFE(p, p2, &dbg_process_list, struct dbg_process, entry) p->process_io->close_process(p, FALSE); @@ -624,6 +624,7 @@ int main(int argc, char** argv) int retv = 0; HANDLE hFile = INVALID_HANDLE_VALUE; enum dbg_start ds; + const char* filename = NULL; /* Initialize the output */ dbg_houtput = GetStdHandle(STD_OUTPUT_HANDLE); @@ -688,6 +689,7 @@ int main(int argc, char** argv) if (!strcmp(argv[0], "--file") && argc > 1) { argc--; argv++; + filename = argv[0]; hFile = CreateFileA(argv[0], GENERIC_READ|DELETE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) @@ -718,7 +720,7 @@ int main(int argc, char** argv) restart_if_wow64(); - dbg_start_interactive(hFile); + dbg_start_interactive(filename, hFile); return 0; }
1
0
0
0
Eric Pouech : winedbg: Support # as comment delimiter in commands.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: dd59222d4ddd2c128cc50c5752effb7b76a1f92b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dd59222d4ddd2c128cc50c57…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:29:46 2021 +0100 winedbg: Support # as comment delimiter in commands. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/debug.l | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 875688f774f..3c9acc5fe60 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -138,6 +138,7 @@ STRING \"[^\n"]+\" if (!dbg_num_processes() && YYSTATE == INITIAL) {BEGIN(NOPROCESS);} <<EOF>> { return tEOF; } +<*>"#"[^\n]* /* Skip comments */ <*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; } /* Indicates end of command. Reset state. */
1
0
0
0
Eric Pouech : winedbg: Be more strict when detecting a string from an array.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 9061634a01d358dd6b071ebcca5a7567d604219e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9061634a01d358dd6b071ebc…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Wed Dec 1 15:29:39 2021 +0100 winedbg: Be more strict when detecting a string from an array. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/types.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 5e9188ccc6e..0ee6ab05f0f 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -519,24 +519,29 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level) count = 1; size = 1; types_get_info(&type, TI_GET_COUNT, &count); types_get_info(&type, TI_GET_LENGTH, &size); + lvalue_field = *lvalue; + types_get_info(&lvalue_field.type, TI_GET_TYPE, &lvalue_field.type.id); + types_get_real_type(&lvalue_field.type, &tag); - if (size == count) - { - unsigned len; - char buffer[256]; - /* - * Special handling for character arrays. - */ - /* FIXME should check basic type here (should be a char!!!!)... */ - len = min(count, sizeof(buffer)); - memory_get_string(dbg_curr_process, - memory_to_linear_addr(&lvalue->addr), - lvalue->cookie == DLV_TARGET, TRUE, buffer, len); - dbg_printf("\"%s%s\"", buffer, (len < count) ? "..." : ""); - break; + if (size == count && tag == SymTagBaseType) + { + DWORD basetype; + + types_get_info(&lvalue_field.type, TI_GET_BASETYPE, &basetype); + if (basetype == btChar) + { + char buffer[256]; + /* + * Special handling for character arrays. + */ + unsigned len = min(count, sizeof(buffer)); + memory_get_string(dbg_curr_process, + memory_to_linear_addr(&lvalue->addr), + lvalue->cookie == DLV_TARGET, TRUE, buffer, len); + dbg_printf("\"%s%s\"", buffer, (len < count) ? "..." : ""); + break; + } } - lvalue_field = *lvalue; - types_get_info(&type, TI_GET_TYPE, &lvalue_field.type.id); dbg_printf("{"); for (i = 0; i < count; i++) {
1
0
0
0
Alexandre Julliard : configure: Fix the netapi check.
by Alexandre Julliard
01 Dec '21
01 Dec '21
Module: wine Branch: master Commit: 13a3340bc22b85f7294dfb72d9bc2410b804ce16 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=13a3340bc22b85f7294dfb72…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Dec 1 16:54:07 2021 +0100 configure: Fix the netapi check. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index aec64ea0232..8e3ec2a1363 100755 --- a/configure +++ b/configure @@ -17346,7 +17346,7 @@ fi CPPFLAGS=$ac_save_CPPFLAGS fi -if test "x$ac_cv_lib_soname_netapi" != xyes +if test "x$ac_cv_lib_soname_netapi" = "x" then : case "x$with_netapi" in x) as_fn_append wine_notices "|libnetapi not found, Samba NetAPI won't be supported." ;; diff --git a/configure.ac b/configure.ac index aa5396e8d06..9d88ea7cf6e 100644 --- a/configure.ac +++ b/configure.ac @@ -1684,7 +1684,7 @@ then WINE_PACKAGE_FLAGS(NETAPI,[netapi],,,, [WINE_CHECK_SONAME(netapi,libnetapi_init,,[AC_DEFINE_UNQUOTED(SONAME_LIBNETAPI,["libnetapi.$LIBEXT"])],[$NETAPI_LIBS])]) fi -WINE_NOTICE_WITH(netapi,[test "x$ac_cv_lib_soname_netapi" != xyes], +WINE_NOTICE_WITH(netapi,[test "x$ac_cv_lib_soname_netapi" = "x"], [libnetapi not found, Samba NetAPI won't be supported.], [enable_netapi])
1
0
0
0
← Newer
1
...
50
51
52
53
54
55
56
57
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Results per page:
10
25
50
100
200