This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12266] Typedefs are not expanded to their base types inbreakpoint definitions


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]