mirror of
https://github.com/sstefani/mtrace.git
synced 2026-02-09 03:06:43 +08:00
fix exit handling
This commit is contained in:
parent
8eb2424e8f
commit
8060b8ef7f
@ -1327,32 +1327,23 @@ struct process *process_new(pid_t pid, unsigned int swap_endian, unsigned int tr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void process_show_exit(struct process *process)
|
|
||||||
{
|
|
||||||
if (options.client || (!options.client && !options.verbose))
|
|
||||||
fprintf(options.output, "+++ process %d exited +++\n", process->pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void process_exit(struct process *process)
|
void process_exit(struct process *process)
|
||||||
{
|
{
|
||||||
process_show_exit(process);
|
|
||||||
process_set_status(process, MT_PROCESS_EXIT);
|
process_set_status(process, MT_PROCESS_EXIT);
|
||||||
|
|
||||||
|
if (options.client || (!options.client && !options.verbose))
|
||||||
|
fprintf(options.output, "+++ process %d exited +++\n", process->pid);
|
||||||
|
|
||||||
if (!options.interactive)
|
if (!options.interactive)
|
||||||
_process_dump(process, sort_allocations, skip_zero_allocations, options.output);
|
_process_dump(process, sort_allocations, skip_zero_allocations, options.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_about_exit(struct process *process)
|
void process_about_exit(struct process *process)
|
||||||
{
|
{
|
||||||
if (options.auto_scan) {
|
process_set_status(process, MT_PROCESS_EXITING);
|
||||||
process_show_exit(process);
|
|
||||||
process_set_status(process, MT_PROCESS_EXITING);
|
if (options.auto_scan)
|
||||||
process_leaks_scan(process, SCAN_ALL);
|
process_leaks_scan(process, SCAN_ALL);
|
||||||
}
|
|
||||||
else {
|
|
||||||
process_exit(process);
|
|
||||||
client_send_msg(process, MT_EXIT, NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_detach(struct process *process)
|
void process_detach(struct process *process)
|
||||||
|
|||||||
13
event.c
13
event.c
@ -173,17 +173,12 @@ static void show_exit(struct task *task)
|
|||||||
|
|
||||||
static struct task *handle_about_exit(struct task *task)
|
static struct task *handle_about_exit(struct task *task)
|
||||||
{
|
{
|
||||||
show_exit(task);
|
if (task->leader == task)
|
||||||
|
report_about_exit(task);
|
||||||
|
|
||||||
if (task->leader == task) {
|
continue_task(task, 0);
|
||||||
if (report_about_exit(task) != -1)
|
|
||||||
return task;
|
|
||||||
remove_proc(task);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
remove_task(task);
|
|
||||||
|
|
||||||
return NULL;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct task *handle_exit(struct task *task)
|
static struct task *handle_exit(struct task *task)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user