public inbox for overseers@sourceware.org
 help / color / mirror / Atom feed
* Problem reporting error on bugzilla and account blocked
@ 2022-08-29 19:21 Torbjorn SVENSSON
  2022-08-29 21:15 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Torbjorn SVENSSON @ 2022-08-29 19:21 UTC (permalink / raw)
  To: overseers

Hello,

I was on IRC chatting with "simark" about and issue with remote debugging and how the "target remote"-sequence was handled in GDB.
To investigate the issue further, simark asked me to create a Bugzilla, but Bugzilla reported that my report had "inappropriate content". I have no idea what the inappropriate content is, but I've included it in the mail below.


Please let me know what I should change in order for the bug report to be accepted.

If you are unsure, yes, I am a human and have contributed to GDB in the past.
Please also restore my account.

Kind regards,
Torbjörn Svensson





The Bugzilla content that was flagged:


Product: gdb
Component: remote
Version: HEAD
Summary: Running "info threads" multiple times produce different output when target has been halted the entire time
Description:
When using 27d582267a1d06e94661979f8893799ac235a768 (master as of this writing) with SEGGER J-Link GDB server (with FreeRTOS support enabled) causes GDB to believe that there are 2 threads when there in fact is only one, but the thread changed id.

The board used is a STM3240G-EVAL board, but I'm sure the same thing can be reproduced on a native GDB server with some tweaking of the RSP replies.

The SEGGER J-Link GDB server is launched using this command:
./JLinkGDBServerCLExe -port 2331 -s -device STM32F407IG -endian little -speed 4000 -if swd -vd -rtos GDBServer/RTOSPlugin_FreeRTOS.so


The GDB client is launched using this command:
arm-none-eabi-gdb -x /tmp/segger/commands

The content of /tmp/segger/commands is:
set debug remote 1
set debug threads 1
set target-async on
file /tmp/segger/40g-eval.elf
target remote :2331
p "info1"
info threads
p "thread1"
thread
p "info2"
info threads
p "thread2"
thread
monitor reset
break main
continue
quit



The output from GDB is:
GNU gdb (GDB) 13.0.50.20220829-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.

[remote] start_remote_1: enter
  [remote] Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec
  [remote] Received Ack
  [remote] Packet received: PacketSize=4000;qXfer:memory-map:read-;QStartNoAckMode+;hwbreak+;qXfer:features:read+
  [remote] packet_ok: Packet qSupported (supported-packets) is supported
  [remote] Sending packet: $vMustReplyEmpty#3a
  [remote] Received Ack
  [remote] Packet received:
  [remote] Sending packet: $QStartNoAckMode#b0
  [remote] Received Ack
  [remote] Packet received: OK
  [remote] Sending packet: $Hg0#df
  [remote] Packet received: OK
  [remote] Sending packet: $qXfer:features:read:target.xml:0,1000#0c
  [remote] Packet received: m<?xml version="1.0"?>\n<!-- Copyright (C) 2008 Free Software Foundation, Inc.\n\n     Copying and distribution of this file, with or without modification,\n     are permitted in any medium without royalty provided the copyright\n     notice and this notice are preserved.  -->\n\n<!DOCTYPE feature SYSTEM "gdb-target.dtd">\n<target version="1.0">\n  <architecture>arm</architecture>\n  <feature name="org.gnu.gdb.arm.m-profile">\n    <reg name="r0" bitsize="32" regnum="0" type="uint32" group="general"/>\n    <reg name="r1 [3568 bytes omitted]
  [remote] Sending packet: $qXfer:features:read:target.xml:fef,1000#0d
  [remote] Packet received: lg name="s23" bitsize="32" regnum="56" type="float" group="float"/>\n    <reg name="s24" bitsize="32" regnum="57" type="float" group="float"/>\n    <reg name="s25" bitsize="32" regnum="58" type="float" group="float"/>\n    <reg name="s26" bitsize="32" regnum="59" type="float" group="float"/>\n    <reg name="s27" bitsize="32" regnum="60" type="float" group="float"/>\n    <reg name="s28" bitsize="32" regnum="61" type="float" group="float"/>\n    <reg name="s29" bitsize="32" regnum="62" type="float" group="float"/>\n [1442 bytes omitted]
  [remote] Sending packet: $qTStatus#49
  [remote] Packet received:
  [remote] packet_ok: Packet qTStatus (trace-status) is NOT supported
  [remote] Sending packet: $?#3f
  [remote] Packet received: S05
  [remote] Sending packet: $qfThreadInfo#bb
  [remote] Packet received: m0000dead
  [remote] Sending packet: $qsThreadInfo#c8
  [remote] Packet received: l
  [remote] Sending packet: $qAttached#8f
  [remote] Packet received:
  [remote] packet_ok: Packet qAttached (query-attached) is NOT supported
  [threads] add_thread_silent: add thread to inferior 1, ptid 42000.57005.0, target remote
  [threads] new_thread: creating a new thread object, inferior 1, ptid 42000.57005.0
  [remote] Sending packet: $Hc-1#09
  [remote] Packet received: OK
  [remote] Sending packet: $qC#b4
  [remote] Packet received:
  [remote] start_remote_1: warning: couldn't determine remote current thread; picking first in list.
  [remote] Sending packet: $qOffsets#4b
  [remote] Packet received:
  [remote] wait: enter
    [remote] select_thread_for_ambiguous_stop_reply: enter
      [remote] select_thread_for_ambiguous_stop_reply: process_wide_stop = 0
      [remote] select_thread_for_ambiguous_stop_reply: first resumed thread is Thread 57005
      [remote] select_thread_for_ambiguous_stop_reply: is this guess ambiguous? = 0
    [remote] select_thread_for_ambiguous_stop_reply: exit
  [remote] wait: exit
  [remote] Sending packet: $g#67
  [remote] Packet received: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000220ffffffff2817000800000001
  [remote] Sending packet: $qfThreadInfo#bb
  [remote] Packet received: m0000dead
  [remote] Sending packet: $qsThreadInfo#c8
  [remote] Packet received: l
  [remote] Sending packet: $m8001728,4#37
  [remote] Packet received: fff7fcbf
  [remote] Sending packet: $m8001728,2#35
  [remote] Packet received: fff7
  [remote] Sending packet: $m800172a,2#5e
  [remote] Packet received: fcbf
Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
63      ../Core/Startup/startup_stm32f407ighx.s: No such file or directory.
  [remote] Sending packet: $qSymbol::#5b
  [remote] Packet received: qSymbol:707843757272656e74544342
  [remote] packet_ok: Packet qSymbol (symbol-lookup) is supported
  [remote] Sending packet: $qSymbol:20000fd8:707843757272656e74544342#71
  [remote] Packet received: qSymbol:707852656164795461736b734c69737473
  [remote] Sending packet: $qSymbol:20000fdc:707852656164795461736b734c69737473#e4
  [remote] Packet received: qSymbol:7844656c617965645461736b4c69737431
  [remote] Sending packet: $qSymbol:2000143c:7844656c617965645461736b4c69737431#b0
  [remote] Packet received: qSymbol:7844656c617965645461736b4c69737432
  [remote] Sending packet: $qSymbol:20001450:7844656c617965645461736b4c69737432#80
  [remote] Packet received: qSymbol:707844656c617965645461736b4c697374
  [remote] Sending packet: $qSymbol:20001464:707844656c617965645461736b4c697374#87
  [remote] Packet received: qSymbol:70784f766572666c6f7744656c617965645461736b4c697374
  [remote] Sending packet: $qSymbol:20001468:70784f766572666c6f7744656c617965645461736b4c697374#75
  [remote] Packet received: qSymbol:7850656e64696e6752656164794c697374
  [remote] Sending packet: $qSymbol:2000146c:7850656e64696e6752656164794c697374#c4
  [remote] Packet received: qSymbol:785461736b7357616974696e675465726d696e6174696f6e
  [remote] Sending packet: $qSymbol:20001480:785461736b7357616974696e675465726d696e6174696f6e#12
  [remote] Packet received: qSymbol:7853757370656e6465645461736b4c697374
  [remote] Sending packet: $qSymbol:20001498:7853757370656e6465645461736b4c697374#f9
  [remote] Packet received: qSymbol:757843757272656e744e756d6265724f665461736b73
  [remote] Sending packet: $qSymbol:200014ac:757843757272656e744e756d6265724f665461736b73#54
  [remote] Packet received: qSymbol:7578546f70557365645072696f72697479
  [remote] Sending packet: $qSymbol::7578546f70557365645072696f72697479#d7
  [remote] Packet received: qSymbol:7578546f7052656164795072696f72697479
  [remote] Sending packet: $qSymbol:200014b4:7578546f7052656164795072696f72697479#fe
  [remote] Packet received: qSymbol:76506f7274456e61626c65564650
  [remote] Sending packet: $qSymbol:800d814:76506f7274456e61626c65564650#47
  [remote] Packet received: qSymbol:4672656552544f534465627567436f6e666967
  [remote] Sending packet: $qSymbol::4672656552544f534465627567436f6e666967#d0
  [remote] Packet received: qSymbol:785363686564756c657252756e6e696e67
  [remote] Sending packet: $qSymbol:200014b8:785363686564756c657252756e6e696e67#f8
  [remote] Packet received: OK
[remote] start_remote_1: exit
$1 = "info1"
[remote] Sending packet: $qfThreadInfo#bb
[remote] Packet received: m00000000
[remote] Sending packet: $qsThreadInfo#c8
[remote] Packet received: l
[threads] add_thread_silent: add thread to inferior 1, ptid 42000.0.0, target remote
[threads] new_thread: creating a new thread object, inferior 1, ptid 42000.0.0
[New Remote target]
[remote] Sending packet: $qThreadExtraInfo,dead#13
[remote] Packet received:
[remote] Sending packet: $qP0000001f000000000000dead#46
[remote] Packet received:
  Id   Target Id         Frame
* 1    [remote] Sending packet: $qP0000001f000000000000dead#46
[remote] Packet received:
Thread 57005      [remote] Sending packet: $m8001728,4#37
[remote] Packet received: fff7fcbf
[remote] Sending packet: $m8001728,2#35
[remote] Packet received: fff7
[remote] Sending packet: $m800172a,2#5e
[remote] Packet received: fcbf
Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
  2    Remote target     [remote] Sending packet: $Hg0#df
[remote] Packet received: OK
[remote] Sending packet: $g#67
[remote] Packet received: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000220ffffffff2817000800000001
[remote] Sending packet: $m8001728,4#37
[remote] Packet received: fff7fcbf
[remote] Sending packet: $m8001728,2#35
[remote] Packet received: fff7
[remote] Sending packet: $m800172a,2#5e
[remote] Packet received: fcbf
Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
$2 = "thread1"
[Current thread is 1 (Thread 57005)]
$3 = "info2"
[remote] Sending packet: $qfThreadInfo#bb
[remote] Packet received: m00000000
[remote] Sending packet: $qsThreadInfo#c8
[remote] Packet received: l
[threads] delete_thread_1: deleting thread 42000.57005.0, silent = 0
  Id   Target Id         Frame
  2    Remote target     [remote] Sending packet: $m8001728,4#37
[remote] Packet received: fff7fcbf
[remote] Sending packet: $m8001728,2#35
[remote] Packet received: fff7
[remote] Sending packet: $m800172a,2#5e
[remote] Packet received: fcbf
Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63

The current thread <Thread ID 1> has terminated.  See `help thread'.
$4 = "thread2"
[Current thread is 1 (Thread 57005) (exited)]
[remote] Sending packet: $qRcmd,7265736574#37
[remote] Packet received: 526573657474696e67207461726765740D0A
Resetting target
[remote] Sending packet: $m80004c0,40#8c
[remote] Packet received: 023b614432e7304609e76444023842e7704700bf80b500af01f050f900f02af800f02cfa00f096f800f0e6f800f00ef900f034f900f0b6fb00f07cf900f0a8f9
[remote] Sending packet: $m80004d8,2#63
[remote] Packet received: 01f0
Breakpoint 1 at 0x80004d8: file ../Core/Src/main.c, line 118.
/tmp/segger/commands:22: Error in sourced command file:
Cannot execute this command without a live selected thread.
(gdb)


As can be seen in the RSP, the thread is first named "0000dead" and later renamed to "00000000". While "00000000" might not be a good id, the problem is still present even if the id is overridden to something else, like "42".


The same sequence, but without "set debug remote 1"-line:
GNU gdb (GDB) 13.0.50.20220829-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.

[threads] add_thread_silent: add thread to inferior 1, ptid 42000.57005.0, target remote
[threads] new_thread: creating a new thread object, inferior 1, ptid 42000.57005.0
Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
63      ../Core/Startup/startup_stm32f407ighx.s: No such file or directory.
$1 = "info1"
[threads] add_thread_silent: add thread to inferior 1, ptid 42000.0.0, target remote
[threads] new_thread: creating a new thread object, inferior 1, ptid 42000.0.0
[New Remote target]
  Id   Target Id         Frame
* 1    Thread 57005      Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
  2    Remote target     Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63
$2 = "thread1"
[Current thread is 1 (Thread 57005)]
$3 = "info2"
[threads] delete_thread_1: deleting thread 42000.57005.0, silent = 0
  Id   Target Id         Frame
  2    Remote target     Reset_Handler () at ../Core/Startup/startup_stm32f407ighx.s:63

The current thread <Thread ID 1> has terminated.  See `help thread'.
$4 = "thread2"
[Current thread is 1 (Thread 57005) (exited)]
Resetting target
Breakpoint 1 at 0x80004d8: file ../Core/Src/main.c, line 118.
/tmp/segger/commands:22: Error in sourced command file:
Cannot execute this command without a live selected thread.


On line 22 in /tmp/segger/commands, the command is "continue".

As can be seen, the "continue" command fails due to that GDB gets confused by the thread ids.

Looking at the RSP, I can see a few things that might be the root cause of the problem.
1. Why is the thread list requested prior to running the qSymbols dance? If it's delayed until after the qSymbols, then the "0000dead" would never be received by the GDB client.
2. It looks like a new thread is detected on the 1st "info threads", but the old thread is removed on the 2nd "info threads". I suppose both the removal and the creation should be done in the 1st "info threads", or even better, just update the id of the remote thread.
Is there any reason to remove thread 1 and create thread 2 when GDB thought there was one thread and after the qfThreadInfo RSP-command, there is still only one thread, but with different id?


The problems above has been seen with various released versions of GDB too, so it's not a regression. It's also present in all-stop mode. I've not checked if the same problem is visible in non-stop mode and SEGGER J-Link GDB server does not support non-stop mode.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem reporting error on bugzilla and account blocked
  2022-08-29 19:21 Problem reporting error on bugzilla and account blocked Torbjorn SVENSSON
@ 2022-08-29 21:15 ` Mark Wielaard
  2022-08-30  8:25   ` Torbjorn SVENSSON
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2022-08-29 21:15 UTC (permalink / raw)
  To: Overseers mailing list; +Cc: Torbjorn SVENSSON

Hi Tobjorn,

On Mon, Aug 29, 2022 at 07:21:59PM +0000, Torbjorn SVENSSON via Overseers wrote:

> I was on IRC chatting with "simark" about and issue with remote
> debugging and how the "target remote"-sequence was handled in GDB.
> To investigate the issue further, simark asked me to create a
> Bugzilla, but Bugzilla reported that my report had "inappropriate
> content". I have no idea what the inappropriate content is, but I've
> included it in the mail below.
> 
> Please let me know what I should change in order for the bug report to be accepted.

I think the gdb remote protocol dump looks like spam to bugzilla.
I suggest putting the command file and gdb output in separate attachments.

> If you are unsure, yes, I am a human and have contributed to GDB in the past.
> Please also restore my account.

Restored! Sorry for the inconvenience.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Problem reporting error on bugzilla and account blocked
  2022-08-29 21:15 ` Mark Wielaard
@ 2022-08-30  8:25   ` Torbjorn SVENSSON
  0 siblings, 0 replies; 3+ messages in thread
From: Torbjorn SVENSSON @ 2022-08-30  8:25 UTC (permalink / raw)
  To: Mark Wielaard, Overseers mailing list

Hello,

Thanks for the fast reply.

I was able to create the Bugzilla entry (https://sourceware.org/bugzilla/show_bug.cgi?id=29538) after moving the output from GDB with the RSP to an attachment.

Kind regards,
Torbjörn

> -----Original Message-----
> From: Mark Wielaard <mark@klomp.org>
> Sent: den 29 augusti 2022 23:15
> To: Overseers mailing list <overseers@sourceware.org>
> Cc: Torbjorn SVENSSON <torbjorn.svensson@st.com>
> Subject: Re: Problem reporting error on bugzilla and account blocked
> 
> Hi Tobjorn,
> 
> On Mon, Aug 29, 2022 at 07:21:59PM +0000, Torbjorn SVENSSON via Overseers
> wrote:
> 
> > I was on IRC chatting with "simark" about and issue with remote
> > debugging and how the "target remote"-sequence was handled in GDB.
> > To investigate the issue further, simark asked me to create a
> > Bugzilla, but Bugzilla reported that my report had "inappropriate
> > content". I have no idea what the inappropriate content is, but I've
> > included it in the mail below.
> >
> > Please let me know what I should change in order for the bug report to be
> accepted.
> 
> I think the gdb remote protocol dump looks like spam to bugzilla.
> I suggest putting the command file and gdb output in separate attachments.
> 
> > If you are unsure, yes, I am a human and have contributed to GDB in the
> past.
> > Please also restore my account.
> 
> Restored! Sorry for the inconvenience.
> 
> Cheers,
> 
> Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-30  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 19:21 Problem reporting error on bugzilla and account blocked Torbjorn SVENSSON
2022-08-29 21:15 ` Mark Wielaard
2022-08-30  8:25   ` Torbjorn SVENSSON

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).