Re: NetBSD 9.2 Alpha: gdb failure

Rin Okuyama <[email protected]> Fri, 17 Sep 2021 12:45:59 +0900
Newsgroups gmane.os.netbsd.ports.alpha
Message-ID <[email protected]>
On 2021/09/17 9:12, Christos Zoulas wrote:
> In article <[email protected]>,
> Nelson H. F. Beebe <[email protected]> wrote:
>> In attempting to debug the data conversion and floating-point issues
>> that I reported on this list yesterday, I found that gdb is unusable,
>> even for a trivial program that just prints a greeting:
>>
>> 	% cat hello.c
>> 	#include <stdio.h>
>>
>> 	int
>> 	main(void)
>> 	{
>> 	    printf("hello, world\n");
>> 	    return 0;
>> 	}
>>
>> 	% cc -g -g3 hello.c
>>
>> 	% gdb a.out
>> 	GNU gdb (GDB) 11.0.50.20200914-git
>> 	...
>> 	(gdb) b main
>> 	Breakpoint 1 at 0x1200008c8: file /u/sy/beebe/c/hello.c, line 6.
>> 	(gdb) run
>> 	Starting program: /local/build/cc/fx-0.0.40/a.out
>> 	limit: stacksize: Can't set limit (Operation not permitted)
>> 	terminate called without an active exception
>> 	[ 176884.2498815] sorry, pid 12842 was killed: orphaned traced process
>> 	Abort (core dumped)
>>
>> My QEMU hardware configuration is:
>>
>> 	% sysctl -a | grep ncpu
>> 	hw.ncpu = 2
>> 	hw.ncpuonline = 2
>>
>> 	% sysctl -a | grep hw.phy
>> 	hw.physmem = -122880
>> 	hw.physmem64 = 4294844416
>>
>> That is, 2 CPUs and 4GB DRAM.
>>
>> 	% limit stacksize
>> 	stacksize    28672 kbytes
>>
>> Even as root, I cannot increase the stacksize, and a hello-world
>> program needs only a few bytes on the stack.
>>
>> On Debian 11 Linux with gdb 10.1.90, I can successfully single step
>> programs, set breakpoints, and examine variables.
>>
>> Is gdb known to work on NetBSD 9.2 on a real physical Alpha system?

GDB shipped with 9.2 is older one. Do you use kernel and base from -current?
(You cannot use -current userland on 9.2 kernel, whereas 9.2 userland on
-current kernel is possible.)

Anyway, it works just fine on real HW (DS10, 21264):

----
$ uname -a
NetBSD ds10 9.99.88 NetBSD 9.99.88 (GENERIC-$Revision: 1.414 $) #71: Fri Sep 17 12:19:24 JST 2021  rin@latipes:/sys/arch/alpha/compile/DS10 alpha
$ cc -g -g3 hello.c
$ gdb a.out
GNU gdb (GDB) 11.0.50.20200914-git
...
(gdb) b main
Breakpoint 1 at 0x1200008c8: file hello.c, line 6.
(gdb) r
Starting program: /home/rin/a.out

Breakpoint 1, main () at hello.c:6
6                   printf("hello, world\n");
(gdb)
----

Thanks,
rin