Subject: toolchain/23672: gdb does not work on alpha
To: None <gnats-bugs@gnats.netbsd.org>
From: None <armihu@utu.fi>
List: netbsd-bugs
Date: 12/06/2003 18:14:03
>Number:         23672
>Category:       toolchain
>Synopsis:       gdb does not work on alpha
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 06 16:15:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Arto Huusko
>Release:        NetBSD 1.6ZF 20031128
>Organization:
	
>Environment:
GNU gdb 5.3nb1
System: NetBSD maailma.yok.utu.fi 1.6ZF NetBSD 1.6ZF (MAAILMA) #2: Mon Dec 1 21:44:24 EET 2003 arto@lady:/data/netbsd/current/alpha/obj/sys/arch/alpha/compile/MAAILMA alpha
Architecture: alpha
Machine: alpha
>Description:
	gdb 5.3 does apparently not work too well on alpha.
	There are a couple of problems.

	1. Compile and run the following program:
	
		int main(int argc, char **argv)
		{char *tst = (char *)0; tst[1] = '\0'; return 0;}
	
	   Load the binary and core to gdb (gdb tst tst.core) and
	   inspect stack trace:
#0  0x0000000120000b9c in main ()
#1  0x0000000120000808 in __start ()
#2  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#3  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#4  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#5  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#6  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#7  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#8  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#9  0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#10 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#11 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#12 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#13 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#14 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#15 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#16 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#17 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#18 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#19 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#20 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#21 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
#22 0x0000000160014774 in _rtld_start () from /usr/libexec/ld.elf_so
	   The _rtld_start goes on and on.

	2. Using the same program, start "gdb tst", and say "run":
Starting program: /local/home/arto/tst 
(no debugging symbols found)...(no debugging symbols found)...ptrace: Device busy.

Stopped due to shared library event
(gdb) where
#0  0x0000000160015f30 in _rtld_debug_state () from /usr/libexec/ld.elf_so
#1  0x0000000160015378 in _rtld () from /usr/libexec/ld.elf_so
#2  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#3  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#4  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#5  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#6  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#7  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#8  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#9  0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#10 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#11 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#12 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#13 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#14 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#15 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#16 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#17 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#18 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#19 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#20 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#21 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so
#22 0x0000000160014750 in _rtld_start () from /usr/libexec/ld.elf_so

	3. Attach gdb to some running program, and try to step:
maailma:/home/arto % gdb /usr/bin/top 2340
GNU gdb 5.3nb1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alpha--netbsd"...(no debugging symbols found)...
Attaching to program: /usr/bin/top, process 2340
Reading symbols from /usr/libexec/ld.elf_so...(no debugging symbols found)...
done.
Loaded symbols for /usr/libexec/ld.elf_so
Reading symbols from /usr/lib/libtermcap.so.0...(no debugging symbols found)...
done.
Loaded symbols for /usr/lib/libtermcap.so.0
Reading symbols from /usr/lib/libm.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libm.so.0
Reading symbols from /usr/lib/libkvm.so.5...(no debugging symbols found)...
done.
Loaded symbols for /usr/lib/libkvm.so.5
Reading symbols from /usr/lib/libc.so.12...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libc.so.12
0x00000001600f772c in poll () from /usr/lib/libc.so.12
(gdb) nexti
ptrace: Device busy.
0x00000001600f772c in poll () from /usr/lib/libc.so.12
(gdb) nexti
ptrace: Device busy.
0x00000001600f772c in poll () from /usr/lib/libc.so.12
(gdb) next
Single stepping until exit from function poll, 
which has no line number information.
ptrace: Device busy.
0x00000001600f772c in poll () from /usr/lib/libc.so.12
(gdb) next
Single stepping until exit from function poll, 
which has no line number information.
ptrace: Device busy.
0x00000001600f772c in poll () from /usr/lib/libc.so.12


>How-To-Repeat:
	Try to use GDB.
>Fix:
	Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted: