NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/58895: gdb can't find frames in a debuged gdb



>Number:         58895
>Category:       toolchain
>Synopsis:       gdb can't find frames in a debuged gdb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 12 11:05:00 +0000 2024
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.12
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 10.99.12 NetBSD 10.99.12 (GENERIC) #251: Mon Nov 25 18:30:20 CET 2024 martin%martins.aprisoft.de@localhost:/home/martin/current/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

Trying to debug gdb does not work well:

[~] martin@martins > gdb gdb
GNU gdb (GDB) 15.1
[..]
Reading symbols from gdb...
Reading symbols from /usr/libdata/debug//usr/bin/gdb.debug...
(gdb) break main
Breakpoint 1 at 0x5ec09c: file /home/martin/current/src/external/gpl3/gdb/bin/gdb/../../dist/gdb/gdb.c, line 30.
(gdb) run
Starting program: /usr/bin/gdb 

Breakpoint 1, main ()
    at /home/martin/current/src/external/gpl3/gdb/bin/gdb/../../dist/gdb/gdb.c:30
30	  gdb_assert (is_main_thread ());
(gdb) n
34	  memset (&args, 0, sizeof args);
(gdb) n
35	  args.argc = argc;
(gdb) p args
No symbol "args" in current context.
(gdb) 

Things called from gdb e.g. in libc or libcurses are debuggable.
Other C++ programs are debugable:

[/tmp] martin@martins > cat test.c 
#include <iostream>
#include <math.h>

int main(int argc, char **argv)
{
	auto a = sin(0.5f);
	std::cout << "my sin value: " << a << std::endl;
	return 0;
}
[/tmp] martin@martins > cat test.c 
#include <iostream>
#include <math.h>

int main(int argc, char **argv)
{
	auto a = sin(0.5f);
	std::cout << "my sin value: " << a << std::endl;
	return 0;
}
[/tmp] martin@martins > gdb a.out 
GNU gdb (GDB) 15.1
[..]
Reading symbols from a.out...
(gdb) break main
Breakpoint 1 at 0x4014b2: file test.cc, line 6.
(gdb) run
Starting program: /tmp/a.out 

Breakpoint 1, main (argc=1, argv=0x7f7fff913898) at test.cc:6
6		auto a = sin(0.5f);
(gdb) n
7		std::cout << "my sin value: " << a << std::endl;
(gdb) p a
$1 = 0.47942553860420301


>How-To-Repeat:
s/a

>Fix:
n/a



Home | Main Index | Thread Index | Old Index