Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp
Date: Thu,  5 May 2022 19:50:17 +0100	[thread overview]
Message-ID: <20220505185020.3648774-1-pedro@palves.net> (raw)

This series evolved from the discussion starting at:

  [PATCH] Fix gdb.cp/no-dmgl-verbose.exp test
  https://sourceware.org/pipermail/gdb-patches/2022-April/188542.html

Turns out gdb.cp/no-dmgl-verbose.exp is right as long as GDB doesn't
use DMGL_VERBOSE (which it doesn't today), _and_ on libstdc++, it is
build for pre-C++11 ABI.

See "GCC5 and the C++11 ABI", at
<https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi>.

And "Dual ABI" at
<https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html>.

On systems with compilers that default to modern C++11 ABI
(practically everywhere these days), gdb.cp/no-dmgl-verbose.exp
exposes that "b func(std::string)" doesn't work any more.

This series fixes this, ensuring that the scenario works on both
pre-C++11, and C++11 ABIs.  It does this by switching GDB to use
DMGL_VERBOSE, and removing some related code from gdb/cp-support.c.

This is done in patch #1.

Patch #2 is preparatory work for patch #3.

Patch #3 is about making it so that "b f(std::string)" also works if
the current language is C.  I noticed that it doesn't work, because
the testcase debugs a .o file, and in such case, GDB doesn't figure
out that the program's language is C++, and so it assumes the language
is C.  Without doing "set language c++", "b f(std::string)" would
still fail.  But I think that should have not been necessary, I think
GDB should have been able to set the breakpoint even with "set
language c".

Tested on x86_64 GNU/Linux with no regressions.

Pedro Alves (3):
  Fix "b f(std::string)", always use DMGL_VERBOSE
  Always pass an explicit language down to c_type_print
  Fix "b f(std::string)" when current language is C

 gdb/ada-typeprint.c                           |   2 +-
 gdb/c-exp.y                                   |   1 +
 gdb/c-lang.c                                  |   8 +-
 gdb/c-lang.h                                  |  17 +--
 gdb/c-typeprint.c                             |  25 +---
 gdb/cp-name-parser.y                          |   5 +-
 gdb/cp-support.c                              |  54 ++++++---
 gdb/cp-support.h                              |  12 ++
 gdb/d-lang.c                                  |   2 +-
 gdb/gnu-v3-abi.c                              |   3 +-
 gdb/go-typeprint.c                            |   2 +-
 gdb/objc-lang.c                               |   2 +-
 gdb/opencl-lang.c                             |   2 +-
 gdb/rust-lang.c                               |   5 +-
 ...-dmgl-verbose.cc => break-f-std-string.cc} |   0
 gdb/testsuite/gdb.cp/break-f-std-string.exp   | 112 ++++++++++++++++++
 gdb/testsuite/gdb.cp/no-dmgl-verbose.exp      |  35 ------
 17 files changed, 192 insertions(+), 95 deletions(-)
 rename gdb/testsuite/gdb.cp/{no-dmgl-verbose.cc => break-f-std-string.cc} (100%)
 create mode 100644 gdb/testsuite/gdb.cp/break-f-std-string.exp
 delete mode 100644 gdb/testsuite/gdb.cp/no-dmgl-verbose.exp


base-commit: 8e1ada9e0bd4f57597b835b2d09b100d24c604d8
-- 
2.36.0


             reply	other threads:[~2022-05-05 18:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 18:50 Pedro Alves [this message]
2022-05-05 18:50 ` [PATCH 1/3] Fix "b f(std::string)", always use DMGL_VERBOSE Pedro Alves
2022-05-05 20:31   ` Keith Seitz via Gdb-patches
2022-05-05 21:49   ` Carl Love via Gdb-patches
2022-05-06 13:21     ` Pedro Alves
2022-05-06  8:10   ` Lancelot SIX via Gdb-patches
2022-05-06 13:09     ` Pedro Alves
2022-05-05 18:50 ` [PATCH 2/3] Always pass an explicit language down to c_type_print Pedro Alves
2022-05-05 20:47   ` Keith Seitz via Gdb-patches
2022-05-06 12:33     ` Pedro Alves
2022-05-05 18:50 ` [PATCH 3/3] Fix "b f(std::string)" when current language is C Pedro Alves
2022-05-05 20:50   ` Keith Seitz via Gdb-patches
2022-05-06  8:34   ` Lancelot SIX via Gdb-patches
2022-05-06 13:09     ` Pedro Alves
2022-05-09 16:54 ` [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp Tom Tromey

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=20220505185020.3648774-1-pedro@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.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: link
Be 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