This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/10309] New: gdb wide char support fails with typedefs in C
- From: "holger dot hopp at sap dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 22 Jun 2009 14:39:55 -0000
- Subject: [Bug gdb/10309] New: gdb wide char support fails with typedefs in C
- Reply-to: sourceware-bugzilla at sourceware dot org
I noticed that the gdb in development (gdb-weekly-6.8.50.20090616.tar.bz2)
now includes support for printing wide character (wchar_t, char16_t,
char32_t) types. That's great!
Unfortunately this does not work correctly with typedefs in C.
With typedefs in C++ this works properly.
Reproduce:
Compile the attached example program with gcc-4.4 oder gcc-4.5 (trunk):
$ gcc --std=gnu99 -O0 -g tst.c -o tst-c
$ g++ --std=c++0x -O0 -g tst.c -o tst-c++
And then single-step tst-c and tst-c++ in gdb.
With tst-c++ you will get
[...]
(gdb)
main () at tst.c:60
60 ignore_mw (mwstr);
(gdb)
ignore_mw (str=0x4009a0 L"Hello World 8") at tst.c:45
45 void ignore_mw (const my_wchar_t *str) { ignore ((void*)str); }
(gdb)
ignore (anything=0x4009a0) at tst.c:36
36 { }
[...]
gdb prints L"Hello World 8" and that's what I expect.
With tst-c you will get
[...]
(gdb)
main () at tst.c:60
60 ignore_mw (mwstr);
(gdb)
ignore_mw (str=0x4008a0) at tst.c:45
45 void ignore_mw (const my_wchar_t *str) { ignore ((void*)str); }
(gdb)
ignore (anything=0x4008a0) at tst.c:36
36 { }
(gdb)
[...]
gdb does not detect wchar_t string type in C, if the type is a typedef.
Probable reason:
In C there is not base type wchar_t [char16_t, char32_t] as in C++.
There is only a typedef (with gcc via __WCHAR_TYPE__, __CHAR16_TYPE__,
and __CHAR32_TYPE__). But the function 'classify_type' in gdb/c-lang.c
does not pass all typedefs. The comment says
/* We do one or two passes -- one on ELTTYPE, and then maybe a
second one on a typedef target. */
I think some modifications in 'classify_type' are needed. The two-pass
solution is not sufficient.
--
Summary: gdb wide char support fails with typedefs in C
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: holger dot hopp at sap dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=10309
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.