winedbg: Allow changing the current thread.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Damjan Jovanovic 2019-11-16 13:39:30 +02:00 committed by Alexandre Julliard
parent da42f2e075
commit 8c52c17a08
6 changed files with 30 additions and 1 deletions

View File

@ -139,6 +139,7 @@ command:
| tWHATIS expr_lvalue { dbg_printf("type = "); types_print_type(&$2.type, FALSE); dbg_printf("\n"); }
| tATTACH tNUM { dbg_attach_debuggee($2); dbg_active_wait_for_first_exception(); }
| tDETACH { dbg_curr_process->process_io->close_process(dbg_curr_process, FALSE); }
| tTHREAD tNUM { dbg_set_curr_thread($2); }
| tKILL { dbg_curr_process->process_io->close_process(dbg_curr_process, TRUE); }
| tMINIDUMP pathname { minidump_write($2, (dbg_curr_thread && dbg_curr_thread->in_exception) ? &dbg_curr_thread->excpt_record : NULL);}
| tECHO tSTRING { dbg_printf("%s\n", $2); }

View File

@ -187,6 +187,7 @@ STRING \"[^\n"]+\"
<INFO_CMD,BD_CMD>display|displa|displ|disp|dis|di|d { BEGIN(NOCMD); return tDISPLAY; }
<INITIAL>undisplay|undispla|undispl|undisp|undis|undi|und { BEGIN(NOCMD); return tUNDISPLAY; }
<INITIAL>delete|delet|dele|del { BEGIN(BD_CMD); return tDELETE; }
<INITIAL>thread|threa|thre|thr|th { BEGIN(NOCMD); return tTHREAD; }
<INITIAL,NOPROCESS>quit|qui|qu|q { BEGIN(NOCMD); return tQUIT; }
<INITIAL>set|se { BEGIN(NOCMD); return tSET; }
<INITIAL>x { BEGIN(FORMAT_EXPECTED); return tEXAM; }

View File

@ -427,6 +427,7 @@ extern enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv
extern void dbg_run_debuggee(const char* args);
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);
extern enum dbg_start dbg_active_launch(int argc, char* argv[]);
extern enum dbg_start dbg_active_auto(int argc, char* argv[]);
extern enum dbg_start dbg_active_minidump(int argc, char* argv[]);

View File

@ -66,7 +66,7 @@ void print_help(void)
" show dir dir <path>",
" set <reg> = <expr> set *<addr> = <expr>",
" pass whatis",
" info (see 'help info' for options)",
" info (see 'help info' for options) thread <tid>",
"The 'x' command accepts repeat counts and formats (including 'i') in the",
"same way that gdb does.\n",

View File

@ -98,6 +98,29 @@ static unsigned dbg_fetch_context(void)
return TRUE;
}
BOOL dbg_set_curr_thread(DWORD tid)
{
struct dbg_thread* thread;
if (!dbg_curr_process)
{
dbg_printf("No process loaded\n");
return FALSE;
}
thread = dbg_get_thread(dbg_curr_process, tid);
if (thread)
{
dbg_curr_thread = thread;
dbg_fetch_context();
stack_fetch_frames(&dbg_context);
dbg_curr_tid = tid;
return TRUE;
}
dbg_printf("No such thread\n");
return thread != NULL;
}
/***********************************************************************
* dbg_exception_prolog
*

View File

@ -116,6 +116,9 @@ IDs can be obtained using the \fBinfo\ process\fR command. Note the
.IP
.IP \fBdetach\fR
Detach from a Wine-process.
.IP \fBthread\ \fIN\fR
Change the current thread to \fIN\fR (its Windows TID, numeric or hexadecimal).
.IP
.PP
\fIHelp commands\fR
.IP \fBhelp\fR