Re: Gdb misdetects threads (SA_ONSTACK?)

[email protected] (Christos Zoulas)
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
In article <[email protected]>,
Valery Ushakov  <[email protected]> wrote:
>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*):
>A problem internal to GDB has been detected,
>further debugging may prove unreliable.
>Quit this debugging session? (y or n) 

Is that i386 code on x86_64? I tried to build on amd64 and it did not link:

ld: skipping incompatible /usr/X11R7/lib/libX11.so when searching for -lX11
ld: skipping incompatible /usr/X11R7/lib/libX11.a when searching for -lX11
ld: cannot find -lX11: No such file or directory
ld: skipping incompatible /usr/X11R7/lib/libX11.so when searching for -lX11
ld: skipping incompatible /usr/X11R7/lib/libXext.so when searching for -lXext
ld: skipping incompatible /usr/X11R7/lib/libXext.a when searching for -lXext
ld: cannot find -lXext: No such file or directory
ld: skipping incompatible /usr/X11R7/lib/libXext.so when searching for -lXext
ld: skipping incompatible /usr/pkg/lib/libncurses.so when searching for -lncurses
ld: skipping incompatible /usr/pkg/lib/libncurses.a when searching for -lncurses
ld: cannot find -lncurses: No such file or directory
ld: skipping incompatible /usr/pkg/lib/libncurses.so when searching for -lncurses
--- vm/Self ---

christos
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.