This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 04/18] gdbserver crash running gdb.threads/non-ldr-exc-1.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 24 Nov 2015 16:34:41 +0000
- Subject: Re: [PATCH 04/18] gdbserver crash running gdb.threads/non-ldr-exc-1.exp
- Authentication-results: sourceware.org; auth=none
- References: <1444836486-25679-1-git-send-email-palves at redhat dot com> <1444836486-25679-5-git-send-email-palves at redhat dot com> <86mvv52920 dot fsf at gmail dot com>
On 10/26/2015 10:55 AM, Yao Qi wrote:
> 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.
>
Hmm, using one of the new Aarch64 machines on the GCC compile farm, I see
that the crash comes from here:
(gdb) bt
#0 0x0000000000408074 in inferior_regcache_data (inferior=0x0) at ../../../src/gdb/gdbserver/inferiors.c:281
#1 0x000000000040840c in get_thread_regcache (thread=0x0, fetch=0) at ../../../src/gdb/gdbserver/regcache.c:31
#2 0x000000000042fb14 in is_64bit_tdesc () at ../../../src/gdb/gdbserver/linux-aarch64-low.c:84
#3 0x0000000000430098 in aarch64_supports_z_point_type (z_type=48 '0') at ../../../src/gdb/gdbserver/linux-aarch64-low.c:264
#4 0x00000000004422cc in linux_supports_z_point_type (z_type=48 '0') at ../../../src/gdb/gdbserver/linux-low.c:5629
#5 0x000000000041a0e8 in z_type_supported (z_type=48 '0') at ../../../src/gdb/gdbserver/mem-break.c:930
#6 0x000000000041a234 in check_gdb_bp_preconditions (z_type=48 '0', err=0x7fc1dcccb8) at ../../../src/gdb/gdbserver/mem-break.c:1021
#7 0x000000000041a380 in delete_gdb_breakpoint (z_type=48 '0', addr=4196520, kind=4) at ../../../src/gdb/gdbserver/mem-break.c:1093
#8 0x000000000041650c in process_serial_event () at ../../../src/gdb/gdbserver/server.c:4193
#9 0x000000000041690c in handle_serial_event (err=0, client_data=0x0) at ../../../src/gdb/gdbserver/server.c:4323
#10 0x000000000041e74c in handle_file_event (event_file_desc=4) at ../../../src/gdb/gdbserver/event-loop.c:428
#11 0x000000000041dbf8 in process_event () at ../../../src/gdb/gdbserver/event-loop.c:184
#12 0x000000000041eb64 in start_event_loop () at ../../../src/gdb/gdbserver/event-loop.c:547
#13 0x0000000000415204 in captured_main (argc=4, argv=0x7fc1dcd0e8) at ../../../src/gdb/gdbserver/server.c:3688
#14 0x0000000000415434 in main (argc=4, argv=0x7fc1dcd0e8) at ../../../src/gdb/gdbserver/server.c:3773
And that is_64bit_tdesc call was added by 6085d6f6:
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -364,6 +364,22 @@ aarch64_supports_z_point_type (char z_type)
switch (z_type)
{
case Z_PACKET_SW_BP:
+ {
+ if (!extended_protocol && is_64bit_tdesc ())
+ {
+ /* Only enable Z0 packet in non-multi-arch debugging. If
+ extended protocol is used, don't enable Z0 packet because
+ GDBserver may attach to 32-bit process. */
+ return 1;
+ }
+ else
+ {
+ /* Disable Z0 packet so that GDBserver doesn't have to handle
+ different breakpoint instructions (aarch64, arm, thumb etc)
+ in multi-arch debugging. */
+ return 0;
+ }
+ }
Now that Antoine's series that teaches gdbserver about different breakpoint
kinds is in, perhaps we could just revert 6085d6f6 now?
Thanks,
Pedro Alves