public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/10309] New: gdb wide char support fails with typedefs in C
@ 2009-06-22 14:39 holger dot hopp at sap dot com
2009-06-22 14:41 ` [Bug gdb/10309] " holger dot hopp at sap dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: holger dot hopp at sap dot com @ 2009-06-22 14:39 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/10309] gdb wide char support fails with typedefs in C
2009-06-22 14:39 [Bug gdb/10309] New: gdb wide char support fails with typedefs in C holger dot hopp at sap dot com
@ 2009-06-22 14:41 ` holger dot hopp at sap dot com
2009-06-22 18:33 ` tromey at redhat dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: holger dot hopp at sap dot com @ 2009-06-22 14:41 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From holger dot hopp at sap dot com 2009-06-22 14:41 -------
Created an attachment (id=4012)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=4012&action=view)
test case
--
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/10309] gdb wide char support fails with typedefs in C
2009-06-22 14:39 [Bug gdb/10309] New: gdb wide char support fails with typedefs in C holger dot hopp at sap dot com
2009-06-22 14:41 ` [Bug gdb/10309] " holger dot hopp at sap dot com
@ 2009-06-22 18:33 ` tromey at redhat dot com
2009-06-23 16:26 ` cvs-commit at gcc dot gnu dot org
2009-06-23 16:28 ` tromey at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2009-06-22 18:33 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2009-06-22 18:33 -------
I'll handle this.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware dot|tromey at redhat dot com
|org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2009-06-22 18:33:54
date| |
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/10309] gdb wide char support fails with typedefs in C
2009-06-22 14:39 [Bug gdb/10309] New: gdb wide char support fails with typedefs in C holger dot hopp at sap dot com
2009-06-22 14:41 ` [Bug gdb/10309] " holger dot hopp at sap dot com
2009-06-22 18:33 ` tromey at redhat dot com
@ 2009-06-23 16:26 ` cvs-commit at gcc dot gnu dot org
2009-06-23 16:28 ` tromey at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2009-06-23 16:26 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2009-06-23 16:26 -------
Subject: Bug 10309
CVSROOT: /cvs/src
Module name: src
Changes by: tromey@sourceware.org 2009-06-23 16:26:05
Modified files:
gdb : ChangeLog c-lang.c c-valprint.c
gdb/testsuite : ChangeLog
gdb/testsuite/gdb.base: charset.c charset.exp
Log message:
gdb
PR gdb/10309:
* c-lang.c (classify_type): Iterate over typedefs.
* c-valprint.c (textual_element_type): Iterate over typedefs.
gdb/testsuite
* gdb.base/charset.exp (test_combination): Regression test.
* gdb.base/charset.c (my_wchar_t): New typedef.
(myvar): New global.
(main): Set myvar.
Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10620&r2=1.10621
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.c.diff?cvsroot=src&r1=1.71&r2=1.72
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.57&r2=1.58
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1891&r2=1.1892
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/charset.c.diff?cvsroot=src&r1=1.9&r2=1.10
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/charset.exp.diff?cvsroot=src&r1=1.14&r2=1.15
--
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/10309] gdb wide char support fails with typedefs in C
2009-06-22 14:39 [Bug gdb/10309] New: gdb wide char support fails with typedefs in C holger dot hopp at sap dot com
` (2 preceding siblings ...)
2009-06-23 16:26 ` cvs-commit at gcc dot gnu dot org
@ 2009-06-23 16:28 ` tromey at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2009-06-23 16:28 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2009-06-23 16:28 -------
I've checked in the fix.
Thanks for finding this.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|6.8 |6.9
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-23 16:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 14:39 [Bug gdb/10309] New: gdb wide char support fails with typedefs in C holger dot hopp at sap dot com
2009-06-22 14:41 ` [Bug gdb/10309] " holger dot hopp at sap dot com
2009-06-22 18:33 ` tromey at redhat dot com
2009-06-23 16:26 ` cvs-commit at gcc dot gnu dot org
2009-06-23 16:28 ` tromey at redhat dot com
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).