aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mdevenv.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-11-03 10:02:33 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2022-12-06 07:59:48 -0500
commitbc2f1fb2f3e4e3601a262facc16313e1852926f0 (patch)
tree567c8ae08f386e165774015e511f1395a8510bc4 /mesonbuild/mdevenv.py
parent3e7433086c19fbaa5029f2926515f3ca5087299c (diff)
downloadmeson-bc2f1fb2f3e4e3601a262facc16313e1852926f0.zip
meson-bc2f1fb2f3e4e3601a262facc16313e1852926f0.tar.gz
meson-bc2f1fb2f3e4e3601a262facc16313e1852926f0.tar.bz2
devenv: Add more info how to get gdb scripts working
Now that top builddir is not the default workdir any more, the .gdbinit file we write there won't be loaded automatically unless user cd there, or use --init-command. There is also a global setting that user has to set to allow automatically loading .gdbinit file.
Diffstat (limited to 'mesonbuild/mdevenv.py')
-rw-r--r--mesonbuild/mdevenv.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py
index 6223b14..7f9b04e 100644
--- a/mesonbuild/mdevenv.py
+++ b/mesonbuild/mdevenv.py
@@ -92,7 +92,7 @@ def add_gdb_auto_load(autoload_path: Path, gdb_helper: str, fname: Path) -> None
except (FileExistsError, shutil.SameFileError):
pass
-def write_gdb_script(privatedir: Path, install_data: 'InstallData') -> None:
+def write_gdb_script(privatedir: Path, install_data: 'InstallData', workdir: Path) -> None:
if not shutil.which('gdb'):
return
bdir = privatedir.parent
@@ -122,7 +122,16 @@ def write_gdb_script(privatedir: Path, install_data: 'InstallData') -> None:
gdbinit_path.write_text(gdbinit_line, encoding='utf-8')
first_time = True
if first_time:
- mlog.log('Meson detected GDB helpers and added config in', mlog.bold(str(gdbinit_path)))
+ gdbinit_path = gdbinit_path.resolve()
+ workdir_path = workdir.resolve()
+ rel_path = gdbinit_path.relative_to(workdir_path)
+ mlog.log('Meson detected GDB helpers and added config in', mlog.bold(str(rel_path)))
+ mlog.log('To load it automatically you might need to:')
+ mlog.log(' - Add', mlog.bold(f'add-auto-load-safe-path {gdbinit_path.parent}'),
+ 'in', mlog.bold('~/.gdbinit'))
+ if gdbinit_path.parent != workdir_path:
+ mlog.log(' - Change current workdir to', mlog.bold(str(rel_path.parent)),
+ 'or use', mlog.bold(f'--init-command {rel_path}'))
def run(options: argparse.Namespace) -> int:
privatedir = Path(options.builddir) / 'meson-private'
@@ -142,7 +151,7 @@ def run(options: argparse.Namespace) -> int:
return 0
install_data = minstall.load_install_data(str(privatedir / 'install.dat'))
- write_gdb_script(privatedir, install_data)
+ write_gdb_script(privatedir, install_data, workdir)
setup_vsenv(b.need_vsenv)