From 651640fd5faf0e24d9cd88c596854c108f732329 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 24 Nov 2023 08:00:00 +0000 Subject: [PATCH] Move print_debug_info() definition before cleanup() * src/strace.c (print_debug_info): Move before cleanup(). Reference: https://github.com/strace/strace/commit/651640fd5faf0e24d9cd88c596854c108f732329 Conflict: Since the current version has not merged commits 462fa296 and d0e007f6, based on the current version, move print_debug_info() definition before cleanup(). --- src/strace.c | 56 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/strace.c b/src/strace.c index d3fa44f30..28f5b4368 100644 --- a/src/strace.c +++ b/src/strace.c @@ -2779,34 +2779,6 @@ pid2tcb(const int pid) } static void -cleanup(int fatal_sig) -{ - unsigned int i; - struct tcb *tcp; - - if (!fatal_sig) - fatal_sig = SIGTERM; - - for (i = 0; i < tcbtabsize; i++) { - tcp = tcbtab[i]; - if (!tcp->pid) - continue; - debug_func_msg("looking at pid %u", tcp->pid); - if (tcp->pid == strace_child) { - kill(tcp->pid, SIGCONT); - kill(tcp->pid, fatal_sig); - } - detach(tcp); - } -} - -static void -interrupt(int sig) -{ - interrupted = sig; -} - -static void print_debug_info(const int pid, int status) { const unsigned int event = (unsigned int) status >> 16; @@ -2845,6 +2817,34 @@ print_debug_info(const int pid, int stat error_msg("[wait(0x%06x) = %u] %s%s", status, pid, buf, evbuf); } +static void +cleanup(int fatal_sig) +{ + unsigned int i; + struct tcb *tcp; + + if (!fatal_sig) + fatal_sig = SIGTERM; + + for (i = 0; i < tcbtabsize; i++) { + tcp = tcbtab[i]; + if (!tcp->pid) + continue; + debug_func_msg("looking at pid %u", tcp->pid); + if (tcp->pid == strace_child) { + kill(tcp->pid, SIGCONT); + kill(tcp->pid, fatal_sig); + } + detach(tcp); + } +} + +static void +interrupt(int sig) +{ + interrupted = sig; +} + static struct tcb * maybe_allocate_tcb(const int pid, int status) { -- 2.33.0