From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 04/18] gdbserver crash running gdb.threads/non-ldr-exc-1.exp
Date: Mon, 26 Oct 2015 13:54:00 -0000 [thread overview]
Message-ID: <86mvv52920.fsf@gmail.com> (raw)
In-Reply-To: <1444836486-25679-5-git-send-email-palves@redhat.com> (Pedro Alves's message of "Wed, 14 Oct 2015 16:27:52 +0100")
Pedro Alves <palves@redhat.com> writes:
> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index e25b7c7..ec52f84 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -1971,6 +1971,27 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
>
> if (strcmp ("qSymbol::", own_buf) == 0)
> {
> + struct thread_info *save_thread = current_thread;
> +
> + /* For qSymbol, GDB only changes the current thread if the
> + previous current thread was of a different process. So if
> + the previous thread is gone, we need to pick another one of
> + the same process. This can happen e.g., if we followed an
> + exec in a non-leader thread. */
> + if (current_thread == NULL)
> + {
> + current_thread = find_any_thread_of_pid (ptid_get_pid (general_thread));
> +
Nit, this line is too long. Patch looks good to me, otherwise.
I do something similar in AArch64 GDBserver backend to fix the crash.
Could you include this patch in your series if it is OK to you? My
patch depends on your patch 04/18.
Note that I didn't add "set_general_process" as you suggested, because I
am not 100% sure the rules of switching current_thread.
--
Yao (齐尧)
From 58ad7851575c5b9c1a2343e6de3dfb4b7b51a6c6 Mon Sep 17 00:00:00 2001
From: Yao Qi <yao.qi@linaro.org>
Date: Fri, 23 Oct 2015 14:00:50 +0100
Subject: [PATCH] [aarch64] gdbserver crash running
gdb.threads/no-unwaited-for-left.exp
This fixes an aarch64 GDBserver crash when running
gdb.threads/no-unwaited-for-left.exp. The problem is that current_thread
is NULL when GDBserver checks whether is 64-bit or not. The fix is
straightforward, if current_thread is NULL, find other thread in the
same process. If none is found, assume the thread is 64-bit.
gdb/gdbserver:
2015-10-26 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (is_64bit_tdesc): If current_thread is NULL,
select another thread of the same process, otherwise, select
current_thread.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index cb49a04..54d8891 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -81,7 +81,24 @@ struct arch_process_info
static int
is_64bit_tdesc (void)
{
- struct regcache *regcache = get_thread_regcache (current_thread, 0);
+ struct thread_info *thread;
+ struct regcache *regcache;
+
+ /* If the current thread is gone, pick another one of the same
+ process. */
+ if (current_thread == NULL)
+ thread = find_any_thread_of_pid (ptid_get_pid (general_thread));
+ else
+ thread = current_thread;
+
+ if (thread == NULL)
+ {
+ /* If we didn't find a thread, assume the inferior will be an
+ aarch64 process. */
+ return 1;
+ }
+
+ regcache = get_thread_regcache (thread, 0);
return register_size (regcache->tdesc, 0) == 8;
}
next prev parent reply other threads:[~2015-10-26 10:55 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 15:28 [PATCH 00/18] Remote all-stop on top of non-stop Pedro Alves
2015-10-14 15:28 ` [PATCH 03/18] attach + target always in non-stop mode: stop all threads Pedro Alves
2015-10-26 13:22 ` Yao Qi
2015-11-23 18:15 ` Pedro Alves
2015-11-23 18:42 ` Pedro Alves
2015-11-26 16:12 ` Yao Qi
2015-11-26 16:23 ` Pedro Alves
2015-11-27 9:33 ` Yao Qi
2015-10-14 15:28 ` [PATCH 13/18] infrun: Fix TARGET_WAITKIND_NO_RESUMED handling in non-stop mode Pedro Alves
2015-10-14 15:28 ` [PATCH 18/18] remote: enable "maint set target-non-stop" by default Pedro Alves
2015-10-14 15:28 ` [PATCH 01/18] Fix mi-nonstop.exp with extended-remote Pedro Alves
2015-10-14 15:28 ` [PATCH 02/18] Remote all-stop-on-top-of-non-stop Pedro Alves
2015-10-24 22:39 ` Yao Qi
2015-11-23 15:40 ` Pedro Alves
2015-11-23 18:39 ` Pedro Alves
2015-11-26 15:53 ` Yao Qi
2015-10-14 15:28 ` [PATCH 15/18] gdbserver:prepare_access_memory: pick another thread Pedro Alves
2015-10-14 15:33 ` [PATCH 10/18] Remote thread create/exit events Pedro Alves
2015-10-14 16:35 ` Eli Zaretskii
2015-10-26 16:50 ` Yao Qi
2015-11-23 15:41 ` Pedro Alves
2015-12-01 15:12 ` Ulrich Weigand
2015-12-01 16:06 ` Pedro Alves
2015-12-01 17:10 ` Ulrich Weigand
2015-10-14 15:33 ` [PATCH 05/18] remote: stop reason and watchpoint data address per thread Pedro Alves
2015-10-14 15:36 ` [PATCH 14/18] Implement TARGET_WAITKIND_NO_RESUMED in the remote protocol Pedro Alves
2015-10-14 16:36 ` Eli Zaretskii
2015-10-19 16:21 ` Yao Qi
2015-10-19 16:48 ` Pedro Alves
2015-10-14 15:36 ` [PATCH 04/18] gdbserver crash running gdb.threads/non-ldr-exc-1.exp Pedro Alves
2015-10-26 13:54 ` Yao Qi [this message]
2015-11-24 16:34 ` Pedro Alves
2015-11-26 16:23 ` Yao Qi
2015-11-30 14:53 ` Pedro Alves
2015-10-14 15:36 ` [PATCH 06/18] New vCtrlC packet, non-stop mode equivalent of \003 Pedro Alves
2015-10-26 14:11 ` Yao Qi
2015-11-30 18:25 ` Pedro Alves
2015-10-14 15:36 ` [PATCH 17/18] gdbserver: don't exit until GDB disconnects Pedro Alves
2015-10-14 15:36 ` [PATCH 11/18] gdbserver: fix killed-outside.exp Pedro Alves
2015-10-27 12:02 ` Yao Qi
2015-11-25 15:06 ` Pedro Alves
2015-11-26 16:51 ` Yao Qi
2015-11-26 17:56 ` Pedro Alves
2015-10-14 15:36 ` [PATCH 12/18] testsuite: Range stepping and non-stop mode Pedro Alves
2015-10-14 15:37 ` [PATCH 07/18] gdbserver crash if gdb attaches too fast Pedro Alves
2015-10-14 15:37 ` [PATCH 16/18] gdbserver/linux: Always wake up event loop after resume Pedro Alves
2015-10-26 17:28 ` Yao Qi
2015-11-25 15:31 ` Pedro Alves
2015-10-14 15:37 ` [PATCH 09/18] Make dprintf-non-stop.exp cope with remote testing Pedro Alves
2015-10-14 15:38 ` [PATCH 08/18] gdbserver resume_stop handling bug Pedro Alves
2015-10-14 16:37 ` Eli Zaretskii
2015-11-25 15:12 ` Pedro Alves
2015-11-25 17:53 ` Eli Zaretskii
2015-10-15 10:46 ` [PATCH 00/18] Remote all-stop on top of non-stop Pedro Alves
2015-10-16 16:47 ` Yao Qi
2015-10-19 11:48 ` Yao Qi
2015-10-19 15:28 ` Pedro Alves
2015-10-19 15:47 ` Yao Qi
2015-10-27 13:11 ` Yao Qi
2015-11-30 19:59 ` Pedro Alves
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=86mvv52920.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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