diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-08-24 15:32:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-24 15:32:40 -0700 |
commit | 6f64eeab605b82b187b2dd1fc72492f434bad603 (patch) | |
tree | 476d9ccf008ab58bbdd8e479c45df7b4bc23a14c /trace2/tr2_tgt_normal.c | |
parent | Merge branch 'hn/refs-test-cleanup' (diff) | |
parent | tr2: log parent process name (diff) | |
download | tgif-6f64eeab605b82b187b2dd1fc72492f434bad603.tar.xz |
Merge branch 'es/trace2-log-parent-process-name'
trace2 logs learned to show parent process name to see in what
context Git was invoked.
* es/trace2-log-parent-process-name:
tr2: log parent process name
tr2: make process info collection platform-generic
Diffstat (limited to 'trace2/tr2_tgt_normal.c')
-rw-r--r-- | trace2/tr2_tgt_normal.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c index 31b602c171..a5751c8864 100644 --- a/trace2/tr2_tgt_normal.c +++ b/trace2/tr2_tgt_normal.c @@ -160,6 +160,24 @@ static void fn_command_path_fl(const char *file, int line, const char *pathname) strbuf_release(&buf_payload); } +static void fn_command_ancestry_fl(const char *file, int line, const char **parent_names) +{ + const char *parent_name = NULL; + struct strbuf buf_payload = STRBUF_INIT; + + /* cmd_ancestry parent <- grandparent <- great-grandparent */ + strbuf_addstr(&buf_payload, "cmd_ancestry "); + while ((parent_name = *parent_names++)) { + strbuf_addstr(&buf_payload, parent_name); + /* if we'll write another one after this, add a delimiter */ + if (parent_names && *parent_names) + strbuf_addstr(&buf_payload, " <- "); + } + + normal_io_write_fl(file, line, &buf_payload); + strbuf_release(&buf_payload); +} + static void fn_command_name_fl(const char *file, int line, const char *name, const char *hierarchy) { @@ -306,6 +324,7 @@ struct tr2_tgt tr2_tgt_normal = { fn_atexit, fn_error_va_fl, fn_command_path_fl, + fn_command_ancestry_fl, fn_command_name_fl, fn_command_mode_fl, fn_alias_fl, |