meson, tools: Add check for GDB when debug-self-in-build option is set

This commit is contained in:
Bruno Lopes 2026-03-24 06:55:48 -03:00
parent 21721eafa3
commit aba2a9b852
2 changed files with 9 additions and 4 deletions

View file

@ -2016,7 +2016,12 @@ gimp_run_env=environment()
gimp_run_env.set('GIMP_GLOBAL_BUILD_ROOT', meson.global_build_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')
gdb = find_program('gdb', required: true)
if not platform_windows or platform_windows and debugging_format == 'DWARF'
gimp_run_env.set('GIMP_DEBUG_SELF_WRAPPER', gdb.full_path())
else
error('GDB does not support native CodeView symbols. Please set -Dwin-debugging=dwarf')
endif
endif
gimp_run_env.set('GIMP_PYTHON_WITH_GI', python.full_path())

View file

@ -60,9 +60,9 @@ try:
os.symlink(os.environ.get("GIMP_PYTHON_WITH_GI"), tmp_symlink)
os.environ["PATH"] = tmp_path + os.pathsep + os.environ.get("PATH", "")
if "GIMP_DEBUG_SELF" in os.environ and shutil.which("gdb"):
print(f"RUNNING: gdb --batch -x {os.environ['GIMP_GLOBAL_SOURCE_ROOT']}/tools/debug-in-build-gimp.py --args {os.environ['GIMP_SELF_IN_BUILD']} {' '.join(sys.argv[1:])}")
subprocess.run(["gdb","--return-child-result","--batch","-x",f"{os.environ['GIMP_GLOBAL_SOURCE_ROOT']}/tools/debug-in-build-gimp.py","--args", os.environ["GIMP_SELF_IN_BUILD"]] + sys.argv[1:], stdin=sys.stdin, check=True)
if "GIMP_DEBUG_SELF_WRAPPER" in os.environ and shutil.which("gdb"):
print(f"RUNNING: {os.environ['GIMP_DEBUG_SELF_WRAPPER']} --batch -x {os.environ['GIMP_GLOBAL_SOURCE_ROOT']}/tools/debug-in-build-gimp.py --args {os.environ['GIMP_SELF_IN_BUILD']} {' '.join(sys.argv[1:])}")
subprocess.run([os.environ["GIMP_DEBUG_SELF_WRAPPER"],"--return-child-result","--batch","-x",f"{os.environ['GIMP_GLOBAL_SOURCE_ROOT']}/tools/debug-in-build-gimp.py","--args", os.environ["GIMP_SELF_IN_BUILD"]] + sys.argv[1:], stdin=sys.stdin, check=True)
else:
print(f"RUNNING: {os.environ['GIMP_SELF_IN_BUILD']} {' '.join(sys.argv[1:])}")
subprocess.run([os.environ["GIMP_SELF_IN_BUILD"]] + sys.argv[1:],stdin=sys.stdin, check=True)