mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:08:19 +00:00
winedbg: No longer hide current WineDbg process from 'info proc'.
We used to hide current WineDbg instance when displaying processes' list (command 'info proc'). This can potentially generate some "dangling" processes in the hierarchy (related to this WineDbg instance): - conhost.exe - start.exe (when launched from unix shell without full path to winedbg.exe) Also, print a more comprehensive error message when trying to attach to itself (now that debugger's PID is more easily available). Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a354bb18fa
commit
f8d3c2b203
|
@ -498,14 +498,18 @@ static unsigned get_parent(const struct dump_proc* dp, unsigned idx)
|
||||||
static void dump_proc_info(const struct dump_proc* dp, unsigned idx, unsigned depth)
|
static void dump_proc_info(const struct dump_proc* dp, unsigned idx, unsigned depth)
|
||||||
{
|
{
|
||||||
struct dump_proc_entry* dpe;
|
struct dump_proc_entry* dpe;
|
||||||
|
char info;
|
||||||
for ( ; idx != -1; idx = dp->entries[idx].sibling)
|
for ( ; idx != -1; idx = dp->entries[idx].sibling)
|
||||||
{
|
{
|
||||||
assert(idx < dp->count);
|
assert(idx < dp->count);
|
||||||
dpe = &dp->entries[idx];
|
dpe = &dp->entries[idx];
|
||||||
dbg_printf("%c%08lx %-8ld ",
|
if (dbg_curr_process && dpe->proc.th32ProcessID == dbg_curr_process->pid)
|
||||||
(dpe->proc.th32ProcessID == (dbg_curr_process ?
|
info = '>';
|
||||||
dbg_curr_process->pid : 0)) ? '>' : ' ',
|
else if (dpe->proc.th32ProcessID == GetCurrentProcessId())
|
||||||
dpe->proc.th32ProcessID, dpe->proc.cntThreads);
|
info = '=';
|
||||||
|
else
|
||||||
|
info = ' ';
|
||||||
|
dbg_printf("%c%08lx %-8ld ", info, dpe->proc.th32ProcessID, dpe->proc.cntThreads);
|
||||||
if (depth)
|
if (depth)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -537,11 +541,10 @@ void info_win32_processes(void)
|
||||||
dp.entries[dp.count].proc.dwSize = sizeof(dp.entries[dp.count].proc);
|
dp.entries[dp.count].proc.dwSize = sizeof(dp.entries[dp.count].proc);
|
||||||
ok = Process32First(snap, &dp.entries[dp.count].proc);
|
ok = Process32First(snap, &dp.entries[dp.count].proc);
|
||||||
|
|
||||||
/* fetch all process information into dp (skipping this debugger) */
|
/* fetch all process information into dp */
|
||||||
while (ok)
|
while (ok)
|
||||||
{
|
{
|
||||||
if (dp.entries[dp.count].proc.th32ProcessID != GetCurrentProcessId())
|
dp.entries[dp.count++].children = -1;
|
||||||
dp.entries[dp.count++].children = -1;
|
|
||||||
if (dp.count >= dp.alloc)
|
if (dp.count >= dp.alloc)
|
||||||
{
|
{
|
||||||
dp.entries = HeapReAlloc(GetProcessHeap(), 0, dp.entries, sizeof(*dp.entries) * (dp.alloc *= 2));
|
dp.entries = HeapReAlloc(GetProcessHeap(), 0, dp.entries, sizeof(*dp.entries) * (dp.alloc *= 2));
|
||||||
|
|
|
@ -70,9 +70,14 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de);
|
||||||
*/
|
*/
|
||||||
BOOL dbg_attach_debuggee(DWORD pid)
|
BOOL dbg_attach_debuggee(DWORD pid)
|
||||||
{
|
{
|
||||||
|
if (pid == GetCurrentProcessId())
|
||||||
|
{
|
||||||
|
dbg_printf("WineDbg can't debug its own process. Please use another process ID.\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (!(dbg_curr_process = dbg_add_process(&be_process_active_io, pid, 0))) return FALSE;
|
if (!(dbg_curr_process = dbg_add_process(&be_process_active_io, pid, 0))) return FALSE;
|
||||||
|
|
||||||
if (!DebugActiveProcess(pid))
|
if (!DebugActiveProcess(pid))
|
||||||
{
|
{
|
||||||
dbg_printf("Can't attach process %04lx: error %lu\n", pid, GetLastError());
|
dbg_printf("Can't attach process %04lx: error %lu\n", pid, GetLastError());
|
||||||
dbg_del_process(dbg_curr_process);
|
dbg_del_process(dbg_curr_process);
|
||||||
|
|
Loading…
Reference in a new issue