Bug 469768 - Make it possible to install gdb scripts in a different location
Summary: Make it possible to install gdb scripts in a different location
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.20.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-14 21:47 UTC by Mark Wielaard
Modified: 2023-05-19 14:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Add --with-gdbscripts-dir=PATH configure option (4.90 KB, text/plain)
2023-05-14 21:47 UTC, Mark Wielaard
Details
Add --with-gdbscripts-dir=PATH configure option (6.73 KB, text/plain)
2023-05-19 13:53 UTC, Mark Wielaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2023-05-14 21:47:10 UTC
Created attachment 158950 [details]
Add --with-gdbscripts-dir=PATH configure option

Add --with-gdbscripts-dir=PATH configure option
    
    Currently the gdb valgrind scripts are installed under VG_LIBDIR
    which is normally pkglibexecdir which is likely not in the default
    gdb safe-path (a list of directories from which it is safe to
    auto-load files). So users will have to add the directory to their
    .gdbinit file.
    
    This patch adds a --with-gdbscripts-dir=PATH configure option that
    sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
    not given).
    
    Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
    python files and pass it with CPPFLAGS when building vg_preloaded.c
    and vgdb.c to use instead of VG_LIBDIR.
Comment 1 Mark Wielaard 2023-05-15 11:31:52 UTC
e.g. for fedora this would be used with configure --with-gdbscripts-dir=%{_datadir}/gdb/auto-load
Comment 2 Mark Wielaard 2023-05-17 08:48:35 UTC
Sasha tried this on Fedora and it seems to work well:
https://bodhi.fedoraproject.org/updates/FEDORA-2023-8f22f996f2
Comment 3 Mark Wielaard 2023-05-19 13:53:44 UTC
Created attachment 159103 [details]
Add --with-gdbscripts-dir=PATH configure option

Updated patch to include --without-gdbscripts-dir option to not install the scripts
Comment 4 Mark Wielaard 2023-05-19 14:09:31 UTC
commit e3602b3eec0696b183722ea21da14588cf205c74 
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun May 14 23:34:05 2023 +0200

    Add --with-gdbscripts-dir=PATH configure option
    
    Currently the gdb valgrind scripts are installed under VG_LIBDIR
    which is normally pkglibexecdir which is likely not in the default
    gdb safe-path (a list of directories from which it is safe to
    auto-load files). So users will have to add the directory to their
    .gdbinit file.
    
    This patch adds a --with-gdbscripts-dir=PATH configure option that
    sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
    not given). A user can also configure --without-gdbscripts-dir to
    disable adding a .debug_gdb_scripts section to the vgpreload library
    and installing the valgrind-monitor python scripts completely.
    
    Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
    python files and pass it with CPPFLAGS when building vg_preloaded.c
    and vgdb.c to use instead of VG_LIBDIR.
    
    https://bugs.kde.org/show_bug.cgi?id=469768