public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-9884] libstdc++: Install libstdc++*-gdb.py more robustly [PR 99453] Date: Thu, 3 Jun 2021 14:57:44 +0000 (GMT) [thread overview] Message-ID: <20210603145744.45FCC398CC1D@sourceware.org> (raw) https://gcc.gnu.org/g:5b4b18b892278380cdb303c097466009914b828e commit r10-9884-g5b4b18b892278380cdb303c097466009914b828e Author: Philippe Blain <levraiphilippeblain@gmail.com> Date: Fri Mar 12 19:26:46 2021 -0500 libstdc++: Install libstdc++*-gdb.py more robustly [PR 99453] In order for GDB to auto-load the pretty printers, they must be installed as "libstdc++.$ext-gdb.py", where 'libstdc++.$ext' is the name of the object file that is loaded by GDB [1], i.e. the libstdc++ shared library. The approach taken in libstdc++-v3/python/Makefile.am is to loop over files matching 'libstdc++*' in $(DESTDIR)$(toolexeclibdir) and choose the last file matching that glob that is not a symlink, the Libtool '*.la' file or a Python file. That works fine for ELF targets where the matching names are: libstdc++.a libstdc++.so libstdc++.so.6 libstdc++.so.6.0.29 But not for macOS with: libstdc++.6.dylib libstdc++.a Or MinGW with: libstdc++-6.dll libstdc++.dll.a Try to make a better job at installing the pretty printers with the correct name by copying the approach taken by isl [2], that is, using a sed invocation on the Libtool-generated 'libstdc++.la' to read the correct name for the current platform. [1] https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html [2] https://repo.or.cz/isl.git/blob/HEAD:/Makefile.am#l611 libstdc++-v3/ChangeLog: PR libstdc++/99453 * python/Makefile.am: Install libstdc++*-gdb.py more robustly. * python/Makefile.in: Regenerate. Co-authored-by: Jonathan Wakely <jwakely@redhat.com> (cherry picked from commit c2fc1702cb3a3d5cc9c40de47f63b4c8f3f1d09c) Diff: --- libstdc++-v3/python/Makefile.am | 20 ++++---------------- libstdc++-v3/python/Makefile.in | 14 ++------------ 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am index 5249137ce4b..3b7c77c8659 100644 --- a/libstdc++-v3/python/Makefile.am +++ b/libstdc++-v3/python/Makefile.am @@ -44,21 +44,9 @@ gdb.py: hook.in Makefile install-data-local: gdb.py @$(mkdir_p) $(DESTDIR)$(toolexeclibdir) ## We want to install gdb.py as SOMETHING-gdb.py. SOMETHING is the -## full name of the final library. We want to ignore symlinks, the -## .la file, and any previous -gdb.py file. This is inherently -## fragile, but there does not seem to be a better option, because -## libtool hides the real names from us. - @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++.*; do \ - case $$file in \ - *-gdb.py) ;; \ - *.la) ;; \ - *) if test -h $$file; then \ - continue; \ - fi; \ - libname=$$file;; \ - esac; \ - done; \ - cd $$here; \ +## full name of the final library. We use the libtool .la file to get +## the correct name. + @libname=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ + $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \ echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \ $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in index 1817b3340aa..91395ee9d57 100644 --- a/libstdc++-v3/python/Makefile.in +++ b/libstdc++-v3/python/Makefile.in @@ -602,18 +602,8 @@ gdb.py: hook.in Makefile install-data-local: gdb.py @$(mkdir_p) $(DESTDIR)$(toolexeclibdir) - @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++.*; do \ - case $$file in \ - *-gdb.py) ;; \ - *.la) ;; \ - *) if test -h $$file; then \ - continue; \ - fi; \ - libname=$$file;; \ - esac; \ - done; \ - cd $$here; \ + @libname=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ + $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \ echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \ $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
reply other threads:[~2021-06-03 14:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210603145744.45FCC398CC1D@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).