Issue #12904: make debugging self with gdb optional with -Ddebug-self-in-build.

Some people reported cases where gdb doesn't even seem to understand
Python scripts (the error in #12904 implies it is looking for standard
gdb commands, because apparently -x option allows both styles).
Others had issues in sandbox building (#12956).

I don't really want to spend too much time understanding each case,
especially as it's a self-debugging tool, not absolutely necessary for a
successful compilation.

So let's just make this optional, and default to "false".
This commit is contained in:
Jehan 2025-02-24 18:13:09 +01:00
parent 0ec94aef5b
commit c3bc4e5336
3 changed files with 6 additions and 1 deletions

View file

@ -1959,6 +1959,9 @@ subdir('app-tools')
gimp_run_env=environment() gimp_run_env=environment()
gimp_run_env.set('GIMP_GLOBAL_BUILD_ROOT', meson.global_build_root()) gimp_run_env.set('GIMP_GLOBAL_BUILD_ROOT', meson.global_build_root())
gimp_run_env.set('GIMP_GLOBAL_SOURCE_ROOT', meson.global_source_root()) gimp_run_env.set('GIMP_GLOBAL_SOURCE_ROOT', meson.global_source_root())
if get_option('debug-self-in-build')
gimp_run_env.set('GIMP_DEBUG_SELF', '1')
endif
if meson.can_run_host_binaries() and have_gobject_introspection if meson.can_run_host_binaries() and have_gobject_introspection
if enable_console_bin if enable_console_bin

View file

@ -66,3 +66,5 @@ option('vector-icons', type: 'boolean', value: true, description: 'Use ve
option('vala', type: 'feature', value: 'auto', description: 'Build VAPI and Vala plugins') option('vala', type: 'feature', value: 'auto', description: 'Build VAPI and Vala plugins')
option('javascript', type: 'feature', value: 'auto', description: 'Install Javascript plug-ins') option('javascript', type: 'feature', value: 'auto', description: 'Install Javascript plug-ins')
option('lua', type: 'boolean', value: false, description: 'Install Lua plug-ins (experimental)') option('lua', type: 'boolean', value: false, description: 'Install Lua plug-ins (experimental)')
option('debug-self-in-build', type: 'boolean', value: false, description: 'Run in-build GIMP within gdb for debugging purpose')

View file

@ -24,7 +24,7 @@ if [ -n "$GIMP_TEMP_UPDATE_RPATH" ]; then
unset IFS unset IFS
fi fi
if command -v gdb; then if [ -n "$GIMP_DEBUG_SELF" ] && command -v gdb; then
echo RUNNING: cat /dev/stdin "|" gdb --batch -x "$GIMP_GLOBAL_SOURCE_ROOT/tools/debug-in-build-gimp.py" --args $GIMP_SELF_IN_BUILD "$@" echo RUNNING: cat /dev/stdin "|" gdb --batch -x "$GIMP_GLOBAL_SOURCE_ROOT/tools/debug-in-build-gimp.py" --args $GIMP_SELF_IN_BUILD "$@"
cat /dev/stdin | gdb --return-child-result --batch -x "$GIMP_GLOBAL_SOURCE_ROOT/tools/debug-in-build-gimp.py" --args $GIMP_SELF_IN_BUILD "$@" cat /dev/stdin | gdb --return-child-result --batch -x "$GIMP_GLOBAL_SOURCE_ROOT/tools/debug-in-build-gimp.py" --args $GIMP_SELF_IN_BUILD "$@"
else else