diff options
author | Mattias Andrée <maandree@kth.se> | 2020-05-30 23:18:42 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-05-30 23:18:42 +0200 |
commit | b3b9cf7dc1912c4df8c9d8dd740144dab8050bff (patch) | |
tree | 0d945745dc9644910c184dd93bf4ad1c29b5ee4c /util.c | |
parent | Do not print PID numbers if only configured to trace one thread (diff) | |
download | sctrace-b3b9cf7dc1912c4df8c9d8dd740144dab8050bff.tar.gz sctrace-b3b9cf7dc1912c4df8c9d8dd740144dab8050bff.tar.bz2 sctrace-b3b9cf7dc1912c4df8c9d8dd740144dab8050bff.tar.xz |
Add support for tracing threads
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | util.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -25,10 +25,17 @@ tprintf(struct process *proc, const char *fmt, ...) fmt = &fmt[1]; } if (multiproctrace) { - if (last_char == '\n') - fprintf(trace_fp, "[%ju] ", (uintmax_t)proc->pid); - else if (proc->pid != last_pid) - fprintf(trace_fp, "\n[%ju] ", (uintmax_t)proc->pid); + if (proc->thread_group_leader) { + if (last_char == '\n') + fprintf(trace_fp, "[%ju, %ju] ", (uintmax_t)proc->thread_group_leader, (uintmax_t)proc->pid); + else if (proc->pid != last_pid) + fprintf(trace_fp, "\n[%ju, %ju] ", (uintmax_t)proc->thread_group_leader, (uintmax_t)proc->pid); + } else { + if (last_char == '\n') + fprintf(trace_fp, "[%ju] ", (uintmax_t)proc->pid); + else if (proc->pid != last_pid) + fprintf(trace_fp, "\n[%ju] ", (uintmax_t)proc->pid); + } } va_start(ap, fmt); vfprintf(trace_fp, fmt, ap); |