Thread overview
[Issue 136] gdb: Corrupt backtrace
[Issue 136] Corrupt GDB backtrace
Jan 24, 2007
d-bugmail
Feb 27, 2007
d-bugmail
Mar 02, 2007
d-bugmail
Mar 18, 2007
d-bugmail
Oct 12, 2009
Leandro Lucarella
January 24, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=136


larsivar@igesund.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |larsivar@igesund.net




------- Comment #4 from larsivar@igesund.net  2007-01-24 04:52 -------
I just want to note that since this failed after upgrading DMD (not GDB) this can hardly be considered the fault of GDB. Would be nice to have it working.


-- 

February 27, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=136





------- Comment #5 from thomas-dloop@kuehne.cn  2007-02-27 10:47 -------
(In reply to comment #4)
> I just want to note that since this failed after upgrading DMD (not GDB) this can hardly be considered the fault of GDB.

This isn't a code generation issue.
It might be related to incomplete/incorrect debugging information.

# import cn.kuehne.flectioned; // for print_trace
#
# void main() {
#       static int i = 0;
#       while(i++ < 10)
#               main();
#       *(cast(int *)0) = 0;
# }


dmd -g test.d flectioned.d
gdb ./test
[...]
(gdb) run
Starting program: /cage/test.d
[Thread debugging using libthread_db enabled]
[New Thread 4158367408 (LWP 23206)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 4158367408 (LWP 23206)]
0x0804af4a in _Dmain () at a.d:16
16              *(cast(int *)0) = 0;
Current language:  auto; currently minimal
(gdb) bt
#0  0x0804af4a in _Dmain () at a.d:16
#1  0xf7cbdb00 in ?? ()
#2  0xfff775a0 in ?? ()
#3  0x0804af44 in _Dmain () at a.d:15
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) call print_trace($ebp)
0xfff775a0      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775a8      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775b0      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775b8      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775c0      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775c8      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775d0      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775d8      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775e0      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff775e8      0x804af44       int main(char[][]) (0x804af2c, 36)
0xfff77618      0x8052269       extern(C) int main(int, char**) (0x80521a0,
279)

call_trace only uses stack/frame pointers and those seem to be OK. DMD-0.155's doesn't show this issue but DMD-0.157 does.

Added to DStress as http://dstress.kuehne.cn/norun/d/debug_info_12_A.d


-- 

March 02, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=136





------- Comment #6 from thomas-dloop@kuehne.cn  2007-03-02 06:29 -------
This is defiantly a DMD issue. DMD-0.157 produces a .debug_frame section whereas DMD-0.155 doesn't. If the .debug_frame section is removed GDB displays the correct trace.

dmd-0.157 -c -g a.d && objcopy -R .debug_frame a.o b.o && dmd-0.157 b.o -ofb && gdb ./b

(gdb) run
Starting program: /tmp/b
[Thread debugging using libthread_db enabled]
[New Thread 4157970096 (LWP 113)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 4157970096 (LWP 113)]
0x0804a09a in _Dmain () at a.d:5
5               *(cast(int *)0) = 0;
Current language:  auto; currently minimal
(gdb) bt
#0  0x0804a09a in _Dmain () at a.d:5
#1  0x0804a094 in _Dmain () at a.d:4
#2  0x0804a094 in _Dmain () at a.d:4
#3  0x0804a094 in _Dmain () at a.d:4
#4  0x0804a094 in _Dmain () at a.d:4
#5  0x0804a094 in _Dmain () at a.d:4
#6  0x0804a094 in _Dmain () at a.d:4
#7  0x0804a094 in _Dmain () at a.d:4
#8  0x0804a094 in _Dmain () at a.d:4
#9  0x0804a094 in _Dmain () at a.d:4
#10 0x0804a094 in _Dmain () at a.d:4
#11 0x0804a163 in main ()


-- 

March 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=136


cristian@zerobugs.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yvad@mail.ru,
                   |                            |cristian@zerobugs.org




------- Comment #7 from cristian@zerobugs.org  2007-03-18 13:37 -------
Have tried with dmd 1.009 on a Fedora6 box. Zero shows the same behavior (line
4 shows up in the stack trace several times), and gdb (6.5-15.fc6rh) says:

(gdb) run
Starting program: /home/cristiv/dmd/bug
[Thread debugging using libthread_db enabled]
[New Thread 1235648 (LWP 18592)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1235648 (LWP 18592)]
0x08049e46 in _Dmain () at bug.d:5
5               *(cast(int *)0) = 0;
Current language:  auto; currently minimal
(gdb) bt
#0  0x08049e46 in _Dmain () at bug.d:5
#1  0x00d316c8 in _r_debug ()
#2  0xbf865250 in ?? ()
#3  0x08049e40 in _Dmain () at bug.d:4
Previous frame inner to this frame (corrupt stack?)


-- 

October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=136


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |llucax@gmail.com
         Resolution|                            |FIXED
            Summary|Corrupt GDB backtrace       |gdb: Corrupt backtrace


--- Comment #8 from Leandro Lucarella <llucax@gmail.com> 2009-10-12 14:00:11 PDT ---
This seems to be working in DMD 1.049 and 2.034.

I'm trying to organize GDB-related bugs, so I will close this one. Please let me know if I shouldn't be closing bugs and feel free to reopen it if still having this problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------