This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug symtab/11479] New: Stabs qualified function argument with opaque type not dispalyed correctly
- From: "muller at ics dot u-strasbg dot fr" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 8 Apr 2010 16:13:11 -0000
- Subject: [Bug symtab/11479] New: Stabs qualified function argument with opaque type not dispalyed correctly
- Reply-to: sourceware-bugzilla at sourceware dot org
If a function is using qualified arguments with opaque types,
the size of this qualified type is not set correctly when the type
is resolved.
This leads to garbage output with GDB.
Example code:
struct dummy;
void *
test (const struct dummy *t)
{
struct dummy *tt;
tt = t;
return t;
}
void *
test2 (struct dummy *t)
{
struct dummy *tt;
tt = t;
return t;
}
struct dummy {
int x;
int y;
double b;
} tag_dummy;
int
main ()
{
struct dummy tt;
tt.x = 5;
tt.y = 25;
tt.b = 2.5;
test2 (&tt);
return test (&tt);
}
gcc -gstabs+ -o test test.c
gives the following output:
Pierre@d620-muller ~/gdbcvs/build-norm/gdb
$ gdb71.exe ./test
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/src/gdbcvs/build-norm/gdb/test.exe...done.
Setting up the environment for debugging gdb.
Function "internal_error" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; i
nput not from terminal]
Function "info_command" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; i
nput not from terminal]
/usr/local/src/gdbcvs/build-norm/gdb/.gdbinit:8: Error in sourced command file:
No breakpoint number 0.
(gdb) rb test
Breakpoint 1 at 0x401056: file test.c, line 8.
void *test(const struct dummy *);
Breakpoint 2 at 0x401067: file test.c, line 16.
void *test2(struct dummy *);
(gdb) r
Starting program: /usr/local/src/gdbcvs/build-norm/gdb/test.exe
[New Thread 5388.0x774]
[New Thread 5388.0x1438]
Breakpoint 2, test2 (t=0x22cc80) at test.c:16
16 tt = t;
(gdb) p *t
$1 = {x = 5, y = 25, b = 2.5}
(gdb) c
Continuing.
Breakpoint 1, test (t=0x22cc80) at test.c:8
8 tt = t;
(gdb) p *t
$2 = {x = 0, y = 0, b = 5.3049894774131808e-313}
Using 'set debug target 1'
explains better what happens:
Breakpoint 2, test2 (t=0x22cc80) at test.c:16
16 tt = t;
(gdb) set debug target 1
(gdb) p *t
child:target_xfer_partial (2, (null), 0x1edea50, 0x0, 0x22cc50, 4) = 4, bytes =
80 cc 22 00
child:target_xfer_partial (2, (null), 0x1ede9d0, 0x0, 0x22cc80, 16) = 16, bytes
=
05 00 00 00 19 00 00 00 00 00 00 00 00 00 04 40
$5 = {x = 5, y = 25, b = 2.5}
(gdb) set debug target 0
(gdb) c
Continuing.
Breakpoint 1, test (t=0x22cc80) at test.c:8
8 tt = t;
(gdb) set debug target 1
(gdb) p *t
child:target_xfer_partial (2, (null), 0x202fc20, 0x0, 0x22cc50, 4) = 4, bytes =
80 cc 22 00
$6 = {x = 0, y = 0, b = 4.0317920028340174e-313}
(gdb) p sizeof (*t)
$7 = 0
If fact, the const qualifier in test function declaration
triggers the generation of a new structure type.
This new type does not get its size set when the structure
is resolved.
Tested both on windows and linux (32 bit generated code).
--
Summary: Stabs qualified function argument with opaque type not
dispalyed correctly
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: symtab
AssignedTo: unassigned at sourceware dot org
ReportedBy: muller at ics dot u-strasbg dot fr
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11479
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.