Re: Gdb misdetects threads (SA_ONSTACK?)

Valery Ushakov <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Tue, Jan 03, 2023 at 15:20:22 +0300, Valery Ushakov wrote:

> On a ~month old current, GNU gdb (GDB) 11.0.50.20200914-git seems to
> get very confused.  My uninformed guess is it's alternative stacks for
> signal handlers that confuse it and make it think a program is
> threaded when it's not.  E.g.
> 
> $ gdb -q --args ./Self ...

I didn't try to make a minimized reproducer, sorry.  I pushed my work
to github, so you can grab

  https://github.com/nbuwe/self/tree/feature/netbsd-i386

and build it with

  cmake -B build-nb-debug -DCMAKE_BUILD_TYPE=Debug .
  cmake --build build-nb-debug --verbose -- VERBOSE=1  # add -j to taste

then

  cd build-nb-debug/vm
  gdb -q --args ./Self

when it shows the prompt, hit ^C and:


VM# [New process 17956]
^C
Thread 2 received signal SIGINT, Interrupt.
[Switching to process 17956]
0xbae4f777 in read () from /usr/lib/libc.so.12
(gdb) info threads
  Id   Target Id                     Frame 
  1    LWP 17956 of process 17956 "" 0xbae4f777 in read ()
   from /usr/lib/libc.so.12
* 2    process 17956                 0xbae4f777 in read ()
   from /usr/lib/libc.so.12
(gdb) s
Single stepping until exit from function read,
which has no line number information.
[New process 17956]
[New process 17956]
/home/uwe/work/netbsd/ro/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/infrun.c:5683: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) 

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.