public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30223] New: Nice printing of std::string doesn't work with -static
@ 2023-03-11 19:59 safinaskar at mail dot ru
  2023-03-12 12:06 ` [Bug python/30223] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: safinaskar at mail dot ru @ 2023-03-11 19:59 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30223

            Bug ID: 30223
           Summary: Nice printing of std::string doesn't work with -static
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: safinaskar at mail dot ru
  Target Milestone: ---

Good printing of std::string values (i. e. printing them as "a" as opposed to {
_M_dataplus = ... } doesn't work with static binaries.

Here is full dockerfile for reproducing:
===
# 20230227 = 20230227T000000Z = 20230226T090712Z
FROM debian:sid-20230227
ENV LC_ALL C.UTF-8
# The following two lines for reproducibility
RUN sed  -i    's~^URIs:.*$~URIs:
http://snapshot.notset.fr/archive/debian/20230226T090712Z~'
/etc/apt/sources.list.d/debian.sources
RUN echo 'Acquire::Check-Valid-Until "false";' >
/etc/apt/apt.conf.d/02acquire-check-valid-until

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
whiptail
RUN apt-get update && apt-get install -y --no-install-recommends less mc
aptitude man-db
RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ gdb
RUN echo '#include <string>' > a.cpp
RUN echo 'int main() {' >> a.cpp
RUN echo '  std::string a = "a";' >> a.cpp
RUN echo '  label:;' >> a.cpp
RUN echo '}' >> a.cpp
RUN g++ -std=gnu++20 -g -fkeep-inline-functions -o a a.cpp
RUN printf 'br main:label\nr\np a\n' | gdb ./a # works
RUN g++ -std=gnu++20 -g -fkeep-inline-functions -static-libstdc++ -o a a.cpp
RUN printf 'br main:label\nr\np a\n' | gdb ./a # fail
RUN g++ -std=gnu++20 -g -fkeep-inline-functions -static -o a a.cpp
RUN printf 'br main:label\nr\np a\n' | gdb ./a # fail
===

Here is output: https://paste.debian.net/1273714/

gdb version is 13.1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug python/30223] Nice printing of std::string doesn't work with -static
  2023-03-11 19:59 [Bug c++/30223] New: Nice printing of std::string doesn't work with -static safinaskar at mail dot ru
@ 2023-03-12 12:06 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2023-03-12 12:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30223

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |python
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
libstdc++ relies on the loading of the shared library to install
the pretty-printers in gdb.

They can be activated by a special section instead (Rust takes
this approach because it uses static linking) but this also has
drawbacks.

Anyway this isn't exactly a bug -- it's expected behavior -- but
more like a problem we don't really have a good way to solve.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-12 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-11 19:59 [Bug c++/30223] New: Nice printing of std::string doesn't work with -static safinaskar at mail dot ru
2023-03-12 12:06 ` [Bug python/30223] " tromey at sourceware dot org

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).