public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "keiths at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/12266] Typedefs are not expanded to their base types in breakpoint definitions
Date: Fri, 19 Aug 2011 10:01:00 -0000	[thread overview]
Message-ID: <bug-12266-4717-yI41ZlpUs2@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12266-4717@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=12266

--- Comment #12 from Keith Seitz <keiths at redhat dot com> 2011-08-18 22:19:05 UTC ---
Hey, thanks for the note!

On 08/18/2011 02:44 PM, anonyme_uprh at hotmail dot com wrote:

> At first I tried to apply the patches that were linked to in
> http://sourceware.org/ml/gdb-patches/2011-07/msg00795.html to the GDB-7.3 base
> archive. The patches succeeded with minor offsets.

Yeah, that's probably not going to work anymore, but you are correct: I 
did just commit all this.

> Then I tried to execute "break calltest(foo)", "break calltest(std::string)"
> and "break calltest(basic_string...). In GDB 7.1 and earlier all three worked.
> In GDB 7.2/7.3 the break on std::string failed, but the break on foo worked
> after an initial "whatis" query. Without this initial query, only the full
> expansion worked.

Yuck. This is because of a recent change to the symbol reader committed 
by a maintainer. Instead of constructing physnames (which are stored in 
the symbol table), we now "simply" use the demangler to demangle 
DW_AT_MIPS_linkage_name. Unfortunately, maintainers turned off 
"DMGL_VERBOSE", which would turn std::string into std::basic_string<...>.

As a result, my patch ends up looking for 
"calltest(std::basic_string<...>)" and this demangler has returned 
"calltest(std::string)". Not nice, but that's what the maintainers 
chose. So I apparently have to hack around this problem another time.

> The good news is that with your changes, the break on "calltest(std::string)"
> works right out of the box. But unfortunately, now the breaks on
> "calltest(foo)" AND "calltest(basic_string)" don't not work at all -- even
> after a whatis query.

The call to basic_string will not work at all (without the 
aforementioned DMGL_VERBOSE), as I mentioned above. Again, that was a 
decision by maintainers and out of my control.

I'll find some way to work around this mess, though. Don't worry!

> After that, I tried your plain-C test case of:
>
> ===========================================================
> #include<stdlib.h>
>
> typedef const char* const* my_type;
> typedef my_type my_other_type;
>
> void
> test (my_other_type foo) { }
>
> int
> main (void)
> {
>    test (NULL);
>    return 0;
> }
> ============================================================
>
> Here, GDB 7.1 worked with everything whereas GDB 7.2/7.3 only worked halfway
> after whatis coercion.

This is a real mess, since for C source code, DW_AT_MIPS_linkage_name is 
never defined (by the compiler). Additionally, another recent maintainer 
change double-checked that if you did specify overload information 
(regardless of language), it must match EXACTLY. Earlier gdb's never did 
this (if there was a single match, regardless of overload information, 
it would return that match).


> Ideally, the user should be able to use all types interchangeably, because as
> you can see with whatis and ptype, GDB occassionally reports the expanded
> types, instead of the typedefs that were actually used in the code.

Yes, indeed. I will see what I can do.

I'm really sorry about all the delays.

Keith

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


      parent reply	other threads:[~2011-08-18 22:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 20:47 [Bug c++/12266] New: " anonyme_uprh at hotmail dot com
2010-12-07 21:19 ` [Bug c++/12266] " keiths at redhat dot com
2011-01-31 13:10 ` anonyme_uprh at hotmail dot com
2011-02-17 21:09 ` keiths at redhat dot com
2011-02-18 10:25 ` anonyme_uprh at hotmail dot com
2011-02-18 10:27 ` anonyme_uprh at hotmail dot com
2011-03-17 18:07 ` keiths at redhat dot com
2011-03-23 17:49 ` anonyme_uprh at hotmail dot com
2011-03-30 15:08 ` keiths at redhat dot com
2011-08-01 20:22 ` keiths at redhat dot com
2011-08-02 17:17 ` anonyme_uprh at hotmail dot com
2011-08-02 17:24 ` keiths at redhat dot com
2011-08-18 21:45 ` cvs-commit at gcc dot gnu.org
2011-08-18 22:19 ` anonyme_uprh at hotmail dot com
2011-08-19 10:01 ` keiths at redhat dot com [this message]

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=bug-12266-4717-yI41ZlpUs2@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).