dump argv to panic buffer

This is solely to make bug reports more useful
parent 9210c468
......@@ -713,6 +713,22 @@ pan_threadattr(struct vsb *vsb)
}
#endif
static void
pan_argv(struct vsb *vsb)
{
int i;
VSB_printf(pan_vsb, "argv = {\n");
VSB_indent(vsb, 2);
for (i = 0; i < heritage.argc; i++) {
VSB_printf(vsb, "[%d] = ", i);
VSB_quote(vsb, heritage.argv[i], -1, VSB_QUOTE_CSTR);
VSB_cat(vsb, ",\n");
}
VSB_cat(vsb, "}\n");
VSB_indent(vsb, -2);
}
/*--------------------------------------------------------------------*/
static void __attribute__((__noreturn__))
......@@ -781,6 +797,8 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
if (err)
VSB_printf(pan_vsb, "errno = %d (%s)\n", err, vstrerror(err));
pan_argv(pan_vsb);
VSB_printf(pan_vsb, "pthread.self = %p\n", TRUST_ME(pthread_self()));
q = THR_GetName();
......
......@@ -89,6 +89,9 @@ struct heritage {
unsigned min_vcl_version;
unsigned max_vcl_version;
int argc;
char * const * argv;
};
extern struct heritage heritage;
......
......@@ -489,6 +489,9 @@ main(int argc, char * const *argv)
struct vsb *vsb;
pid_t pid;
heritage.argc = argc;
heritage.argv = argv;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment