Gdb auto-load python scripts

From: Paul Floyd <>
Date: Sun, 08 Jan 2023 21:03:17 UTC

Does anyone have experience with gdb auto-load of python scripts?

Valgrind just added a new feature that uses python to make interactive 
debugging nicer, but it doesn't work on FreeBSD.

It uses an elf .debug_gdb_scripts section to tell what to load

+#define DEFINE_GDB_PY_SCRIPT(script_name) \
+  asm("\
+.pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
+.byte 1 /* Python */\n\
+.asciz \"" script_name "\"\n\
+.popsection \n\

But with this I get gdb errors:

To stderr:
+warning: File 
auto-loading has been declined by your `auto-load safe-path' set to 

To stdout:
+To enable execution of this file add
+       add-auto-load-safe-path 
+line to your configuration file "/home/paulf/.gdbinit".
+To completely disable this security protection add
+       set auto-load safe-path /
+line to your configuration file "/home/paulf/.gdbinit".
+For more information about this security protection see the
+"Auto-loading safe path" section in the GDB manual.  E.g., run from the 
+       info "(gdb)Auto-loading safe path"

I've tried adding
set auto-load safe-path /

to my ~/.gdbinit

Any suggestions? My iniitisl impression is that ths is a gdb problem.