From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Simon Marchi <simark@simark.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Limit the switch_to_thread() calls in startup_inferior()
Date: Sun, 1 Nov 2020 19:33:50 +0100 [thread overview]
Message-ID: <20201101183350.4kjanzjzuo7tmumz@function> (raw)
In-Reply-To: <1b79497d-a376-0c48-9544-ef1bb3056fc9@simark.ca>
Hello,
(Note that I have never really hacked very much into gdb's inferior
management, so I don't know much how things are supposed to be working.)
Simon Marchi, le sam. 24 oct. 2020 22:58:05 -0400, a ecrit:
> I tried to wrap my head around this and understand the need for the
> switch_to_thread, what could be the impacts of your change, and I just
> can't give anything close to a definitive answer.
>
[...]
> Samuel, as the last person who touched gnu-nat.c, do you have a bit of
> time to test Kamil's patch on Hurd, see if it breaks starting inferiors?
I am not really sure what I am supposed to test. I tried a program that
starts a second thread which just pause()s. With Kamil's patch I can
switch & backtrace between the two threads.
(gdb) r
Starting program: /home/samy/test
^C[New Thread 13012.6]
[New Thread 13012.7]
Thread 5 received signal SIGINT, Interrupt.
0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
(gdb) info thread
Id Target Id Frame
* 5 Thread 13012.5 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
6 Thread 13012.6 0x0109dc74 in _hurd_intr_rpc_mach_msg ()
from /lib/i386-gnu/libc.so.0.3
7 Thread 13012.7 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
(gdb) bt
#0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
#1 0x01079cc6 in mach_msg () from /lib/i386-gnu/libc.so.0.3
[...]
#5 0x0104cdca in pthread_join () from /lib/i386-gnu/libpthread.so.0.3
#6 0x0803254b in main () at test.c:13
(gdb) thread 7
[Switching to thread 7 (Thread 13012.7)]
#0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
(gdb) bt
#0 0x0107951c in ?? () from /lib/i386-gnu/libc.so.0.3
[...]
#3 0x0114e4ce in pause () from /lib/i386-gnu/libc.so.0.3
#4 0x080324fa in f (foo=0x0) at test.c:6
#5 0x0104c3ff in entry_point () from /lib/i386-gnu/libpthread.so.0.3
#6 0x00000000 in ?? ()
> And what if you remove all the switch_to_thread from that function, does
> it still work?
If I remove all calls from that fonction I am getting
(gdb) r
Starting program: /home/samy/test
Can't fetch registers from thread bogus thread id 1: No such thread
(gdb) info thread
Id Target Id Frame
5 Thread 18821.5 0x000021e0 in ?? ()
The current thread <Thread ID 1> has terminated. See `help thread'.
Since I now have a built tree I can easily experiment more.
Samuel
next prev parent reply other threads:[~2020-11-01 18:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 8:49 Kamil Rytarowski
2020-10-25 2:58 ` Simon Marchi
2020-11-01 18:33 ` Samuel Thibault [this message]
2020-11-02 0:47 ` Simon Marchi
2020-11-02 0:34 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201101183350.4kjanzjzuo7tmumz@function \
--to=samuel.thibault@ens-lyon.org \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox