From 1ad0927959b1dd4ea4640b9b529c633afbc1f197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Nov 2023 16:56:26 +0100 Subject: [PATCH] debuggers/gdb: use a more standard install location. Same as https://github.com/mosra/corrade/commit/4922edf269ce77efe073f6b750a34892e1f3c30d, just mirrored here. --- doc/changelog.dox | 5 +++-- doc/debuggers.dox | 20 ++++++++++---------- src/debuggers/CMakeLists.txt | 2 +- src/debuggers/gdb/{ => magnum}/__init__.py | 0 src/debuggers/gdb/{ => magnum}/printers.py | 0 5 files changed, 14 insertions(+), 13 deletions(-) rename src/debuggers/gdb/{ => magnum}/__init__.py (100%) rename src/debuggers/gdb/{ => magnum}/printers.py (100%) diff --git a/doc/changelog.dox b/doc/changelog.dox index 270bd8240..ad1f9b5e0 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -79,8 +79,9 @@ See also: - Added MSVC Natvis files and pretty-printers for GDB. See @ref debuggers, [mosra/magnum#589](https://github.com/mosra/magnum/pull/589), [mosra/magnum#595](https://github.com/mosra/magnum/pull/595), - [mosra/magnum#620](https://github.com/mosra/magnum/pull/620) and - [mosra/magnum#623](https://github.com/mosra/magnum/pull/623) for more + [mosra/magnum#620](https://github.com/mosra/magnum/pull/620), + [mosra/magnum#623](https://github.com/mosra/magnum/pull/623) and + [mosra/corrade#179](https://github.com/mosra/corrade/issues/179) for more information. @subsubsection changelog-latest-new-debugtools DebugTools library diff --git a/doc/debuggers.dox b/doc/debuggers.dox index 4295ff748..c8ecfa4a4 100644 --- a/doc/debuggers.dox +++ b/doc/debuggers.dox @@ -36,20 +36,19 @@ The [src/debuggers/gdb](https://github.com/mosra/magnum/tree/master/src/debugger directory contains [GDB pretty printers](https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html) for important types in the @ref Magnum and @ref Animation namespace and most @ref Math classes. Contents of this directory are also copied into -@cb{.sh} ${CMAKE_PREFIX_PATH}/share/magnum/debuggers/gdb @ce during -installation, where the prefix is usually `/usr` or `/usr/local`. +@cb{.sh} ${CMAKE_INSTALL_PREFIX}/share/gdb/python @ce during installation, +where the prefix is usually `/usr` or `/usr/local`. Easiest is to auto-load them on startup, by putting the following snippet into the user-specific `~/.gdbinit` or `~/.config/gdb/gdbinit` file: @code{.py} python -import sys -# Adapt this path to the actual install location (or Magnum's src/ directory). -# Not pointing to the debuggers subdirectory here because it could conflict -# with the built-in GDB module. -sys.path.insert(0, '/usr/share') -from magnum.debuggers.gdb import register_magnum_printers +# If not installing into /usr, you'll need to insert the install location (or +# the src/debuggers/gdb/ directory inside Magnum sources) to Python's path: +#import sys +#sys.path.insert(0, '/magnum/install/prefix/share/gdb/python') +from magnum import register_magnum_printers register_magnum_printers(gdb.current_objfile()) end @endcode @@ -71,8 +70,9 @@ See also @ref corrade-debuggers-gdb-pretty-printers "Corrade GDB pretty printers The [src/debuggers/natvis](https://github.com/mosra/magnum/tree/master/src/debuggers/natvis) directory contains MSVC natvis files for important @ref Math classes. Contents -of this directory are also copied into @cb{.sh} ${CMAKE_PREFIX_PATH}/share/magnum/debuggers/natvis @ce -during installation. +of this directory are also copied into +@cb{.sh} ${CMAKE_INSTALL_PREFIX}/share/magnum/debuggers/natvis @ce during +installation. Easiest way to use is to copy them to the user-specific Natvis directory for given version of Visual Studio, such as @cb{.bat} %USERPROFILE%/Documents/Visual Studio 2022/Visualizers @ce. diff --git a/src/debuggers/CMakeLists.txt b/src/debuggers/CMakeLists.txt index 0c467bbce..11918fd62 100644 --- a/src/debuggers/CMakeLists.txt +++ b/src/debuggers/CMakeLists.txt @@ -26,7 +26,7 @@ # TODO: same TODOs as in corrade/src/debuggers/CMakeLists.txt apply here if(NOT CORRADE_TARGET_MSVC AND NOT CORRADE_TARGET_EMSCRIPTEN) - install(DIRECTORY gdb DESTINATION ${MAGNUM_DATA_INSTALL_DIR}/debuggers) + install(DIRECTORY gdb/magnum DESTINATION share/gdb/python) endif() if(CORRADE_TARGET_MSVC) diff --git a/src/debuggers/gdb/__init__.py b/src/debuggers/gdb/magnum/__init__.py similarity index 100% rename from src/debuggers/gdb/__init__.py rename to src/debuggers/gdb/magnum/__init__.py diff --git a/src/debuggers/gdb/printers.py b/src/debuggers/gdb/magnum/printers.py similarity index 100% rename from src/debuggers/gdb/printers.py rename to src/debuggers/gdb/magnum/printers.py