Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sourceware.org
Subject: [RFC] 12266 Fallout
Date: Thu, 25 Aug 2011 23:03:00 -0000	[thread overview]
Message-ID: <4E56D4A3.7000306@redhat.com> (raw)

Hi,

I am writing for some maintainer guidance on an issue that has arisen.

The original reporter for c++/12266 reports that the bug is not fixed. 
And indeed, it isn't!

The reporter's test case (C++):

typedef std::string foo;
void calltest (foo) {}

Setting a break at "calltest(foo)" does not work because inspect_type 
(part of 12266 patchset) uses check_typedef, which resolves foo -> 
std::string -> std::basic_string<char, std::char_traits<char>, 
std::alloactor<char> >. But because we are no longer using DMGL_VERBOSE 
in dwarf2_physname (and other places) to do demangling, the symbol table 
actually stores "calltest(std::string)".

Setting a break at "calltest(std::string)" works.

Setting a break at "calltest(std::basic_string<char, ...>)" also does 
not work for the same reason "foo" didn't work.

There are two ways I can see to fix this.
1) Add DMGL_VERBOSE where it is needed so that NO typedefs ever appear 
in a (non-TYPE_CODE_TYPEDEF) symbol's name, i.e, store 
"calltest(std::basic_string<...>)" in the symbol table instead of 
"calltest(std::string)".

2) Add a new version of check_typedef which "stops" at std::string (and 
std::ostream, std::istream, std::iostream), and add logic (somewhere) to 
deal with going from "std::basic_string<...>" back to "std::string" (and 
likewise for the others).

For whatever it may be worth, my preference is for #1. I've always felt 
storing the most fundamental representation of a symbol was the best 
option: it treats all symbols the same.

Along these lines, I have done a quick audit of the code (look for 
DMGL_PARAMS), and the only places where DMGL_VERBOSE needs to be added 
is dwarf2_physname, lookup_symbol_in_language, and 
symbol_find_demangled_name. All other users of DMGL_PARAMS are using it 
for output to the display, and leaving out DMGL_VERBOSE would be preferred.

This will have the immediate side effect of printing symbol names with 
"std::basic_string<...>" instead of the more preferred "std::string".
Actually in this case, the "right" output would be "calltest(foo)", but 
that is a different, but related, problem, for which I developed a patch 
a long time ago, part of the first 12266 patch submissions 
(dwarf2_print_name).

So, I humbly ask maintainers:

- Shall I continue #1 and start submitting patches?
- Shall I start teaching gdb about std::string et al and how to deal 
with them in the environment we have today?
- Have I missed something that would be preferable to anything I've 
mentioned?

Keith


             reply	other threads:[~2011-08-25 23:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 23:03 Keith Seitz [this message]
2011-08-26 18:05 ` Tom Tromey
2011-08-26 18:17   ` Keith Seitz
2011-08-26 18:31 ` Jan Kratochvil

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=4E56D4A3.7000306@redhat.com \
    --to=keiths@redhat.com \
    --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