public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/11479] New: Stabs qualified function argument with opaque type not dispalyed correctly
@ 2010-04-08 16:13 muller at ics dot u-strasbg dot fr
  2010-04-23 15:04 ` [Bug symtab/11479] Stabs qualified function argument with opaque type not displayed correctly muller at ics dot u-strasbg dot fr
  0 siblings, 1 reply; 2+ messages in thread
From: muller at ics dot u-strasbg dot fr @ 2010-04-08 16:13 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug symtab/11479] Stabs qualified function argument with opaque type not displayed correctly
  2010-04-08 16:13 [Bug symtab/11479] New: Stabs qualified function argument with opaque type not dispalyed correctly muller at ics dot u-strasbg dot fr
@ 2010-04-23 15:04 ` muller at ics dot u-strasbg dot fr
  0 siblings, 0 replies; 2+ messages in thread
From: muller at ics dot u-strasbg dot fr @ 2010-04-23 15:04 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-04-22 12:31 -------
Subject: Bug 11479

CVSROOT:	/cvs/src
Module name:	src
Changes by:	muller@sourceware.org	2010-04-22 12:30:55

Modified files:
	gdb            : ChangeLog stabsread.c 

Log message:
	PR stabs/11479.
	* stabsread.c (set_length_in_type_chain): New function.
	(read_struct_type): Call set_length_in_type_chain function.
	(read_enum_type): Idem.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11666&r2=1.11667
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/stabsread.c.diff?cvsroot=src&r1=1.124&r2=1.125


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-04-22 13:37 -------
Subject: Bug 11479

CVSROOT:	/cvs/src
Module name:	src
Changes by:	muller@sourceware.org	2010-04-22 13:37:18

Modified files:
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.stabs: gdb11479.c gdb11479.exp 

Log message:
	PR stabs/11479.
	* gdb.stabs/gdb11479.exp: New file.
	* gdb.stabs/gdb11479.c: New file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2247&r2=1.2248
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.stabs/gdb11479.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.stabs/gdb11479.exp.diff?cvsroot=src&r1=NONE&r2=1.1


------- Additional Comments From muller at ics dot u-strasbg dot fr  2010-04-23 15:04 -------
 Fixed by the commits from 2010/04/22
listed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
            Summary|Stabs qualified function    |Stabs qualified function
                   |argument with opaque type   |argument with opaque type
                   |not dispalyed correctly     |not displayed correctly
   Target Milestone|7.1                         |7.2


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-23 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 16:13 [Bug symtab/11479] New: Stabs qualified function argument with opaque type not dispalyed correctly muller at ics dot u-strasbg dot fr
2010-04-23 15:04 ` [Bug symtab/11479] Stabs qualified function argument with opaque type not displayed correctly muller at ics dot u-strasbg dot fr

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