about summary refs log tree commit homepage
path: root/httpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'httpd.h')
-rw-r--r--httpd.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/httpd.h b/httpd.h
index fc7b873..afce2a1 100644
--- a/httpd.h
+++ b/httpd.h
@@ -483,7 +483,7 @@ static off_t write_loc_name(FILE *fp, const struct src_loc *l)
                 if (!s) return -1;
                 if (l->f) fputc('\n', fp);
 
-                /* omit local " [$ADDRESS]" if doing deep backtraces */
+                /* omit local " [RETURN_ADDRESS]" if doing deep backtraces */
                 for (uint32_t i = 0; i < l->bt_len; ++i) {
                         char *c = memrchr(s[i], '[', strlen(s[i]));
                         if (c && c > (s[i] + 2) && c[-1] == ' ')
@@ -723,12 +723,29 @@ static enum mw_qev pid_root(struct mw_h1 *h1, struct mw_h1req *h1r)
         if (!fp) return h1_close(h1);
 #define default_min "2000"
 
-        FPUTS("<html><head><title>mwrap demo</title></head><body>"
-                "<p>mwrap demo", fp);
+        int pid = (int)getpid();
+        fprintf(fp, "<html><head><title>mwrap PID:%d</title></head><body>"
+                "<pre>mwrap PID:%d", pid, pid);
         show_stats(fp);
-        FPUTS("<p><a\nhref=\"each/" default_min "\">allocations &gt;"
-                default_min " bytes</a>"
-                "<p><a\nhref=\"" URL "\">" URL "</a></body></html>", fp);
+        FPUTS("\n\n<a\nhref=\"each/" default_min "\">allocations &gt;"
+                default_min " bytes</a>""</pre><pre\nid=help>"
+"To get source file and line info for native backtraces, consult your\n"
+"distro for -dbg, -dbgsym, or -debug packages.\n"
+"And/or rebuild your code with debug flags (e.g. `-ggdb3' if using gcc)\n"
+"and don't strip the resulting binaries.\n"
+"You should see locations from the backtrace_symbols(3) function\n"
+"in the form of FILENAME(+OFFSET) or FILENAME(SYMBOL+OFFSET)\n"
+"(e.g. /usr/lib/foo.so(+0xdead) or /usr/lib/foo.so(func+(0xbeef))\n"
+"\n"
+"Any version of addr2line should decode FILENAME(+OFFSET) locations:\n"
+"\n"
+"        addr2line -e FILENAME OFFSET\n"
+"\n"
+"SYMBOL+OFFSET requires addr2line from GNU binutils 2.39+ (Aug 2022):\n"
+"\n"
+"        addr2line -e FILENAME SYMBOL+OFFSET\n", fp);
+
+        FPUTS("\n<a\nhref=\"" URL "\">" URL "</a></pre></body></html>", fp);
         return h1_200(h1, &html, TYPE_HTML);
 #undef default_min
 }