Remove additional current process tracking in backtrace_all as it can
refer to freed memory.
This commit is contained in:
parent
04a8cff140
commit
0c9195c650
|
@ -209,17 +209,13 @@ static void backtrace_all(void)
|
||||||
entry.dwSize = sizeof(entry);
|
entry.dwSize = sizeof(entry);
|
||||||
if (Thread32First(snapshot, &entry))
|
if (Thread32First(snapshot, &entry))
|
||||||
{
|
{
|
||||||
struct dbg_process* cp = dbg_curr_process;
|
|
||||||
DWORD cpid = dbg_curr_pid;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (entry.th32OwnerProcessID == GetCurrentProcessId()) continue;
|
if (entry.th32OwnerProcessID == GetCurrentProcessId()) continue;
|
||||||
if (dbg_curr_process && dbg_curr_pid != cpid)
|
if (dbg_curr_process && dbg_curr_pid != entry.th32OwnerProcessID)
|
||||||
dbg_detach_debuggee();
|
dbg_detach_debuggee();
|
||||||
|
|
||||||
if (entry.th32OwnerProcessID == cpid)
|
if (entry.th32OwnerProcessID != dbg_curr_pid)
|
||||||
dbg_curr_process = cp;
|
|
||||||
else if (entry.th32OwnerProcessID != dbg_curr_pid)
|
|
||||||
{
|
{
|
||||||
if (!dbg_attach_debuggee(entry.th32OwnerProcessID, FALSE, TRUE))
|
if (!dbg_attach_debuggee(entry.th32OwnerProcessID, FALSE, TRUE))
|
||||||
{
|
{
|
||||||
|
@ -236,9 +232,8 @@ static void backtrace_all(void)
|
||||||
}
|
}
|
||||||
while (Thread32Next(snapshot, &entry));
|
while (Thread32Next(snapshot, &entry));
|
||||||
|
|
||||||
if (dbg_curr_process && dbg_curr_pid != cpid)
|
if (dbg_curr_process)
|
||||||
dbg_detach_debuggee();
|
dbg_detach_debuggee();
|
||||||
dbg_curr_process = cp; dbg_curr_pid = cpid;
|
|
||||||
}
|
}
|
||||||
CloseHandle(snapshot);
|
CloseHandle(snapshot);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue