public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "anonyme_uprh at hotmail 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: Thu, 18 Aug 2011 22:19:00 -0000	[thread overview]
Message-ID: <bug-12266-4717-vXSDZdGq8r@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 #11 from Martin Schröder <anonyme_uprh at hotmail dot com> 2011-08-18 21:44:40 UTC ---
Hello Keith!

I've finally found the time to examine this bug again, and I can report that,
indeed, some things work better, but not across the board.

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.

Unfortunately, the compilation failed. After that, I checked out the CVS head
(because I interpret your recent posting to mean that you merged your changes
into the mainline). Anyway, that version compiled and I started to test it.

First, I selected my own initial test code:
==========================================================
#include <string>

typedef std::string foo;

void calltest(foo val) {}

int main() {
    calltest(foo(""));
}
==========================================================

The good news is that "whatis" still correctly reports both "foo" and
"std::string". It tells us that foo maps to string and string to basic_string.

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.


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.




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.

With the CVS HEAD, the situation looks even worse. Only "break test" works; but
nothing else. Of course, both "whatis" and "ptype" still report things
correctly, according to their differing type-depth expansion styles:

============================================================
(gdb) whatis test
type = void (my_other_type)

(gdb) whatis my_other_type
type = my_type

(gdb) whatis my_type
type = const char * const *

(gdb) ptype test
type = void (my_other_type)

(gdb) ptype my_type
type = const char * const *

(gdb) ptype my_other_type
type = const char * const *
============================================================




So, as long as I am correct in presuming that the CVS Head contains your
changes, I can only say that some things are improved, but some things still
don't work right.

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.




Thanks again for your continued work and patience with this nasty bug,
    Martin.

-- 
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 21:45 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 [this message]
2011-08-19 10:01 ` keiths at redhat dot com

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