Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jan 2023 22:03:17 +0100
From:      Paul Floyd <paulf2718@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Gdb auto-load python scripts
Message-ID:  <f0ae3380-5ca3-f9a6-cc70-ebce47a878fd@gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f0ae3380-5ca3-f9a6-cc70-ebce47a878fd>