public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp
@ 2022-05-05 18:50 Pedro Alves
  2022-05-05 18:50 ` [PATCH 1/3] Fix "b f(std::string)", always use DMGL_VERBOSE Pedro Alves
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Pedro Alves @ 2022-05-05 18:50 UTC (permalink / raw)
  To: gdb-patches

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


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

end of thread, other threads:[~2022-05-09 16:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 18:50 [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp Pedro Alves
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
2022-05-05 21:49   ` Carl Love
2022-05-06 13:21     ` Pedro Alves
2022-05-06  8:10   ` Lancelot SIX
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
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
2022-05-06  8:34   ` Lancelot SIX
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

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