tech-toolchain archive

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

Re: Gdb misdetects threads (SA_ONSTACK?)



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


Home | Main Index | Thread Index | Old Index