]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/lib: add log_panic_action()
authorRalph Boehme <slow@samba.org>
Wed, 13 Dec 2023 06:57:46 +0000 (07:57 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 21 Dec 2023 23:48:46 +0000 (23:48 +0000)
Can be used to log a nice stack backtrace with full debug symbols by setting
"panic action" to something like

    panic action = cd /home/slow/git/samba/master && /home/slow/git/samba/master/selftest/gdb_backtrace %d

This is similar to log_stack_trace(), but that doesn't come with debug symbols.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/include/proto.h
source3/lib/util.c

index 5c1ba8512873bd128d35fbc871168419ec532428..49b5a47a06b1775d31fee75b5703d31f30e76ed3 100644 (file)
@@ -317,6 +317,7 @@ char *gidtoname(gid_t gid);
 uid_t nametouid(const char *name);
 gid_t nametogid(const char *name);
 void smb_panic_s3(const char *why);
+void log_panic_action(const char *msg);
 const char *readdirname(DIR *p);
 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
index b12dffb33ae5bb1ed9d71fe06453edcac0069c83..51dc50d0b66e54df6de75d9efc8113bfd9da6edf 100644 (file)
@@ -720,6 +720,12 @@ void smb_panic_s3(const char *why)
        dump_core();
 }
 
+void log_panic_action(const char *msg)
+{
+       DBG_ERR("%s", msg);
+       call_panic_action(msg, true);
+}
+
 /*******************************************************************
   A readdir wrapper which just returns the file name.
  ********************************************************************/