]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Install GDB pretty printers for debug library
authorJonathan Wakely <jwakely@redhat.com>
Thu, 12 Aug 2021 18:56:14 +0000 (19:56 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 16 Aug 2021 16:51:42 +0000 (17:51 +0100)
The additional libraries installed by --enable-libstdcxx-debug are built
without optimization to aid debugging, but the Python pretty printers
are not installed alongside them. This means that you can step through
the unoptimized library code, but at the expense of pretty printing the
library types.

This remedies the situation by installing another copy of the GDB hooks
alongside the debug version of libstdc++.so.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* python/Makefile.am [GLIBCXX_BUILD_DEBUG] (install-data-local):
Install another copy of the GDB hook.
* python/Makefile.in: Regenerate.

libstdc++-v3/python/Makefile.am
libstdc++-v3/python/Makefile.in

index 8efefa5725c4311f60b328fa980f98cb0e9f92cc..bc4a26651d8265557db163968137a2d7f2169f73 100644 (file)
@@ -29,6 +29,12 @@ else
 pythondir = $(datadir)/gcc-$(gcc_version)/python
 endif
 
+if GLIBCXX_BUILD_DEBUG
+debug_gdb_py = YES
+else
+debug_gdb_py =
+endif
+
 all-local: gdb.py
 
 nobase_python_DATA = \
@@ -53,4 +59,8 @@ install-data-local: gdb.py
                  $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
        fi; \
        echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
-       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
+       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
+       if [ -n "$(debug_gdb_py)" ]; then \
+         sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+         $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
+       fi
index 9904a9197de41a3dab686d1c77046e10b8d822c4..b3b56c41597e39d28b9ae807f50f428e4bba4ffb 100644 (file)
@@ -403,6 +403,8 @@ WARN_CXXFLAGS = \
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
 @ENABLE_PYTHONDIR_FALSE@pythondir = $(datadir)/gcc-$(gcc_version)/python
 @ENABLE_PYTHONDIR_TRUE@pythondir = $(prefix)/$(python_mod_dir)
+@GLIBCXX_BUILD_DEBUG_FALSE@debug_gdb_py = 
+@GLIBCXX_BUILD_DEBUG_TRUE@debug_gdb_py = YES
 nobase_python_DATA = \
     libstdcxx/v6/printers.py \
     libstdcxx/v6/xmethods.py \
@@ -614,7 +616,11 @@ install-data-local: gdb.py
                  $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \
        fi; \
        echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
-       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
+       $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py ; \
+       if [ -n "$(debug_gdb_py)" ]; then \
+         sed "/^libdir = /s;'$$;/debug';" gdb.py > debug-gdb.py ; \
+         $(INSTALL_DATA) debug-gdb.py $(DESTDIR)$(toolexeclibdir)/debug/$$libname-gdb.py ; \
+       fi
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.