Gdb auto-load python scripts

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

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\
+");
+
+DEFINE_GDB_PY_SCRIPT(VG_LIBDIR "/valgrind-monitor.py")

But with this I get gdb errors:

To stderr:
+warning: File 
"/usr/home/paulf/tools/valgrind/libexec/valgrind/valgrind-monitor.py" 
auto-loading has been declined by your `auto-load safe-path' set to 
"$debugdir:$datadir/auto-load".

To stdout:
+To enable execution of this file add
+       add-auto-load-safe-path 
/usr/home/paulf/tools/valgrind/libexec/valgrind/valgrind-monitor.py
+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 
shell:
+       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.

A+
Paul