www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 136] New: Corrupt GDB backtrace

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=136

           Summary: Corrupt GDB backtrace
           Product: D
           Version: 0.157
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: oskar.linde gmail.com


void main() {
        static int i = 0;
        while(i++ < 10)
                main();
        *(cast(int *)0) = 0;
}

On DMD 0.157 compiling with dmd -g -debug and running in gdb and printing a
backtrace gives:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208064320 (LWP 23068)]
0x0804b1fa in _Dmain () at debug.d:5
5               *(cast(int *)0) = 0;
Current language:  auto; currently minimal
(gdb) bt




Previous frame inner to this frame (corrupt stack?)

Compared to DMD 0.156:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208064320 (LWP 23192)]
0x0804b1fa in _Dmain () at debug.d:5
5               *(cast(int *)0) = 0;
Current language:  auto; currently minimal
(gdb) bt














-- 
May 11 2006
next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=136


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME





Many gdb's fail with the -g switch. Use -gc instead. With -gc -debug, the
backtrace works fine on my machine:

gdb 5.3
i386-redhat-linux-gnu


-- 
May 12 2006
parent Lars Ivar Igesund <larsivar igesund.net> writes:
d-bugmail puremagic.com wrote:

 http://d.puremagic.com/bugzilla/show_bug.cgi?id=136
 
 
 bugzilla digitalmars.com changed:
 
            What    |Removed                     |Added
 ----------------------------------------------------------------------------
              Status|NEW                         |RESOLVED
          Resolution|                            |WORKSFORME
 
 
 
 

 Many gdb's fail with the -g switch. Use -gc instead. With -gc -debug, the
 backtrace works fine on my machine:
 
 gdb 5.3
 i386-redhat-linux-gnu
 
 
 --
Hmm, -gc is not listed in DMD's help ? I see it is under the linux version on http://www.digitalmars.com/d/dcompiler.html, but not if you do "dmd" on the linux command line. Looked for it on all the latest version. -- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi
May 12 2006
prev sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=136


oskar.linde gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |





Maybe this is really a GDB bug, but the error remains with -gc.

On i686-pc-linux-gnu (RedHat EL4), with all of the following gdb versions:
gdb 6.4 + d symbol demangling patches
gdb 6.4 vanilla
gdb 6.3
gdb 6.0
(I was unable to get gdb 5.3 and 5.2.1 to work on my system)

compiled with:
dmd -gc => corrupt backtrace
dmd -g => corrupt backtrace
dmd => OK backtrace

with DMD 0.156 and earlier, the back traces work fine with all above
combinations.


-- 
Jun 01 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-06-01:
 http://d.puremagic.com/bugzilla/show_bug.cgi?id=136
 Maybe this is really a GDB bug, but the error remains with -gc.
This seems to be GDB related. Valgrind hand no problems: ==23266== Invalid write of size 4 ==23266== at 0x804A0C0: void a.foo() (a.d:7) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0BB: void a.foo() (a.d:5) ==23266== by 0x804A0CB: _Dmain (a.d:11) ==23266== Address 0x0 is not stack'd, malloc'd or (recently) free'd Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEgFOK3w+/yD4P9tIRAmDGAKCfoL6jMeP9DW4v2DWg1yh3z8014wCgyxR+ MG8+4PPsyk7xTXxhLzy9ACo= =Mhov -----END PGP SIGNATURE-----
Jun 02 2006