public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Help figuring out why `info registers` is showing <unavailable> with gdbserver target
@ 2022-03-02  6:31 William Tambe
  2022-03-02 16:50 ` Andrew Burgess
  0 siblings, 1 reply; 4+ messages in thread
From: William Tambe @ 2022-03-02  6:31 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

Regarding this issue, support for gdbserver has been implemented here:
https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdbserver/linux-pu32-low.cc

Support for gdb has been implemented here:
https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdb/pu32-tdep.c

gdb is able to successfully connect to gdbserver and start a program
on the target; however, gdb is unable to fetch registers and instead
shows <unavailable> as follow:

(gdb) info registers
r0             <unavailable>
r1             <unavailable>
r2             <unavailable>
r3             <unavailable>
r4             <unavailable>
r5             <unavailable>
r6             <unavailable>
r7             <unavailable>
r8             <unavailable>
r9             <unavailable>
r10            <unavailable>
r11            <unavailable>
r12            <unavailable>
r13            <unavailable>
r14            <unavailable>
r15            <unavailable>
pc             <unavailable>

Find attached full `gdbserver --debug --remote-debug` logs as well as gdb logs.

Any idea what might have been missed while implementing gdbserver support ?
Would you suggest ways to debug the issue ?

[-- Attachment #2: gdb.log --]
[-- Type: application/octet-stream, Size: 2759 bytes --]

tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' && -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1'
GNU gdb (GDB) 11.0.50.20210718-git
Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /home/tambewilliam/.gdbinit
line to your configuration file "/root/.config/gdb/gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/root/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
buildroot-build/staging/usr/share/buildroot/gdbinit: No such file or directory.
Remote debugging using /dev/ttyUSB2
(gdb) set remote exec-file /bin/ls
(gdb) r -l /
Starting program:  -l /
Reading /usr/bin/busybox from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /usr/bin/busybox from remote target...
Reading symbols from target:/usr/bin/busybox...
(No debugging symbols found in target:/usr/bin/busybox)
warning: Target-supplied registers are not supported by the current architecture
PC register is not available
(gdb) info registers
r0             <unavailable>
r1             <unavailable>
r2             <unavailable>
r3             <unavailable>
r4             <unavailable>
r5             <unavailable>
r6             <unavailable>
r7             <unavailable>
r8             <unavailable>
r9             <unavailable>
r10            <unavailable>
r11            <unavailable>
r12            <unavailable>
r13            <unavailable>
r14            <unavailable>
r15            <unavailable>
pc             <unavailable>
(gdb)

[-- Attachment #3: gdbserver.log --]
[-- Type: application/octet-stream, Size: 15896 bytes --]

# gdbserver --debug --remote-debug --multi /dev/ttyS1 &
[2] 94
root@buildroot:~
# sigchld_handler
sigchld_handler
sigchld_handler
sigchld_handler
sigchld_handler
Remote debugging using /dev/ttyS1

root@buildroot:~
#
root@buildroot:~
#
root@buildroot:~
#
root@buildroot:~
# handling possible serial event
[getpkt: discarding char '+']
getpkt ("qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+");  [sending ack]
[sent ack]
putpkt ("$PacketSize=47ff;QPassSignals+;QProgramSignals+;QStartupWithShell+;QEnvironmentHexEncoded+;QEnvironmentReset+;QEnvironmentUnset+;QSetWorkingDir+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;qXfer:osdata:read+;multiprocess+;fork-events+;vfork-events+;exec-events+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace-conf:bts:size+;Qbtrace:pt+;Qbtrace-conf:pt:size+;Qbtrace:off+;qXfer:btrace:read+;qXfer:btrace-conf:read+;swbreak+;hwbreak+;qXfer:exec-file:read+;vContSupported+;QThreadEvents+;no-resumed+#21"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vMustReplyEmpty");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("!");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QProgramSignals:0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("Hgp0.0");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QNonStop:0");  [sending ack]
[sent ack]
linux_async (0), previous=0
[all-stop mode enabled]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qTStatus");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("?");  [sending ack]
[sent ack]
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned -1,
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
putpkt ("$W00#b7"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QDisableRandomization:1");  [sending ack]
[sent ack]
[address space randomization disabled]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QStartupWithShell:1");  [sending ack]
[sent ack]
[Inferior will be started with shell]putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QEnvironmentReset");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QSetWorkingDir:2f");  [sending ack]
[sent ack]
[Set the inferior's current directory to /]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vRun;2f62696e2f6c73;2d6c;2f");  [sending ack]
[sent ack]
args: -l /
>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
wait_1: [Process 97]
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
sigsuspend'ing
sigchld_handler
LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
Hit a non-gdbserver trap event.
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
Checking whether LWP 97 needs to move out of the jump pad...no
wait_1 ret = LWP 97.97, 1, 5
<<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>>>> entering virtual void linux_process_target::resume(thread_resume*, size_t)
linux_resume:
already continuing LWP 97 at GDB's request
Resuming, no pending status or step over needed
linux_resume done
<<<< exiting virtual void linux_process_target::resume(thread_resume*, size_t)
>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
wait_1: [Process 97]
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
RSRL: resuming stopped-resumed LWP LWP 97.97 at 0: step=0
Resuming lwp 97 (continue, signal 0, stop not expected)
leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
sigsuspend'ing
sigchld_handler
LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
Hit a non-gdbserver trap event.
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
Checking whether LWP 97 needs to move out of the jump pad...no
wait_1 ret = LWP 97.97, 1, 5
<<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
Process /bin/ls created; pid = 97
Writing resume reply for LWP 97.97:1
putpkt ("$T0500:0*"00;0e:0*"00;0f:0*"00;10:0*"00;thread:p61.61;core:0;#90"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qAttached:61");  [sending ack]
[sent ack]
putpkt ("$0#30"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
[sent ack]
putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:setfs:0");  [sending ack]
[sent ack]
putpkt ("$F0#76"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:open:6a7573742070726f62696e67,0,1c0");  [sending ack]
[sent ack]
putpkt ("$F-1,2#02"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:setfs:61");  [sending ack]
[sent ack]
putpkt ("$F0#76"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
[sent ack]
putpkt ("$F4#7a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,0");  [sending ack]
[sent ack]
putpkt ("$F4734;ELF"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,1ce288");  [sending ack]
[sent ack]
putpkt ("$F370;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:fstat:4");  [sending ack]
[sent ack]
putpkt ("$F40;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,34");  [sending ack]
[sent ack]
putpkt ("$F4733;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,1ce1a1");  [sending ack]
[sent ack]
putpkt ("$F457;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
[sent ack]
putpkt ("$F4733;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:fstat:4");  [sending ack]
[sent ack]
putpkt ("$F40;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
[sent ack]
putpkt ("$F5#7b"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:5,47ff,0");  [sending ack]
[sent ack]
putpkt ("$F4734;ELF"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:5,47ff,1ce288");  [sending ack]
[sent ack]
putpkt ("$F370;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:fstat:5");  [sending ack]
[sent ack]
putpkt ("$F40;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:5,47ff,34");  [sending ack]
[sent ack]
putpkt ("$F4733;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:5,47ff,1ce1a1");  [sending ack]
[sent ack]
putpkt ("$F457;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:5,47ff,b4");  [sending ack]
[sent ack]
putpkt ("$F4733;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:fstat:5");  [sending ack]
[sent ack]
putpkt ("$F40;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qSymbol::");  [sending ack]
[sent ack]
Trying host libthread_db library: libthread_db.so.1.
dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
thread_db_load_search returning 0
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qSymbol::");  [sending ack]
[sent ack]
Trying host libthread_db library: libthread_db.so.1.
dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
thread_db_load_search returning 0
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
[sent ack]
putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qOffsets");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("Hgp61.61");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
[sent ack]
putpkt ("$l<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target>
  <architecture>pu32</architecture>
  <osabi>GNU/Linux</osabi>
  <feature name="org.gnu.gdb.pu32.core">
 * <reg name="sp" bitsize="32" type="uint32" regnum="0"/>
 * <reg name="r1" bitsize="32" type="uint32" regnum="1"/>
 * <reg name="r2" bitsize="32" type="uint32" regnum="2"/>
 * <reg name="r3" bitsize="32" type="uint32" regnum="3"/>
 * <reg name="r4" bitsize="32" type="uint32" regnum="4"/>
 * <reg name="r5" bitsize="32" type="uint32" regnum="5"/>
 * <reg name="r6" bitsize="32" type="uint32" regnum="6"/>
 * <reg name="r7" bitsize="32" type="uint32" regnum="7"/>
 * <reg name="r8" bitsize="32" type="uint32" regnum="8"/>
 * <reg name="r9" bitsize="32" type="uint32" regnum="9"/>
 * <reg name="r10" bitsize="32" type="uint32" regnum="10"/>
 * <reg name="r11" bitsize="32" type="uint32" regnum="11"/>
 * <reg name="r12" bitsize="32" type="uint32" regnum="12"/>
 * <reg name="r13" bitsize="32" type="uint32" regnum="13"/>
 * <reg name="r14" bitsize="32" type="uint32" regnum="14"/>
 * <reg name="r15" bitsize="32" type="uint32" regnum="15"/>
 * <reg name="pc" bitsize="32" type="uint32" regnum="16"/>
  </feature>
</target>
#ef"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
[sent ack]
putpkt ("$F4733;"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("g");  [sending ack]
[sent ack]
putpkt ("$x*}x*C#04"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:libraries-svr4:read::0,1000");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:auxv:read::0,1000");  [sending ack]
[sent ack]
putpkt ("$l"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]

root@buildroot:~

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

* Re: Help figuring out why `info registers` is showing <unavailable> with gdbserver target
  2022-03-02  6:31 Help figuring out why `info registers` is showing <unavailable> with gdbserver target William Tambe
@ 2022-03-02 16:50 ` Andrew Burgess
  2022-03-02 21:02   ` William Tambe
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Burgess @ 2022-03-02 16:50 UTC (permalink / raw)
  To: William Tambe, gdb-patches

William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:

> Regarding this issue, support for gdbserver has been implemented here:
> https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdbserver/linux-pu32-low.cc
>
> Support for gdb has been implemented here:
> https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdb/pu32-tdep.c
>
> gdb is able to successfully connect to gdbserver and start a program
> on the target; however, gdb is unable to fetch registers and instead
> shows <unavailable> as follow:
>
> (gdb) info registers
> r0             <unavailable>
> r1             <unavailable>
> r2             <unavailable>
> r3             <unavailable>
> r4             <unavailable>
> r5             <unavailable>
> r6             <unavailable>
> r7             <unavailable>
> r8             <unavailable>
> r9             <unavailable>
> r10            <unavailable>
> r11            <unavailable>
> r12            <unavailable>
> r13            <unavailable>
> r14            <unavailable>
> r15            <unavailable>
> pc             <unavailable>
>
> Find attached full `gdbserver --debug --remote-debug` logs as well as
> gdb logs.

You should consider using 'set debug remote 1' on the GDB side to
capture the remote packets from that perspective.  I'm particularlly
interested in the reply to the 'g' packet, but the complete logs would
be useful.  This information doesn't seem to be visible in the gdbserver
output (or I'm missing it).

Thanks,
Andrew

>
> Any idea what might have been missed while implementing gdbserver support ?
> Would you suggest ways to debug the issue ?
> tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' && -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1'
> GNU gdb (GDB) 11.0.50.20210718-git
> Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
> 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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
> To enable execution of this file add
>         add-auto-load-safe-path /home/tambewilliam/.gdbinit
> line to your configuration file "/root/.config/gdb/gdbinit".
> To completely disable this security protection add
>         set auto-load safe-path /
> line to your configuration file "/root/.config/gdb/gdbinit".
> For more information about this security protection see the
> "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
>         info "(gdb)Auto-loading safe path"
> buildroot-build/staging/usr/share/buildroot/gdbinit: No such file or directory.
> Remote debugging using /dev/ttyUSB2
> (gdb) set remote exec-file /bin/ls
> (gdb) r -l /
> Starting program:  -l /
> Reading /usr/bin/busybox from remote target...
> warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
> Reading /usr/bin/busybox from remote target...
> Reading symbols from target:/usr/bin/busybox...
> (No debugging symbols found in target:/usr/bin/busybox)
> warning: Target-supplied registers are not supported by the current architecture
> PC register is not available
> (gdb) info registers
> r0             <unavailable>
> r1             <unavailable>
> r2             <unavailable>
> r3             <unavailable>
> r4             <unavailable>
> r5             <unavailable>
> r6             <unavailable>
> r7             <unavailable>
> r8             <unavailable>
> r9             <unavailable>
> r10            <unavailable>
> r11            <unavailable>
> r12            <unavailable>
> r13            <unavailable>
> r14            <unavailable>
> r15            <unavailable>
> pc             <unavailable>
> (gdb)
> # gdbserver --debug --remote-debug --multi /dev/ttyS1 &
> [2] 94
> root@buildroot:~
> # sigchld_handler
> sigchld_handler
> sigchld_handler
> sigchld_handler
> sigchld_handler
> Remote debugging using /dev/ttyS1
>
> root@buildroot:~
> #
> root@buildroot:~
> #
> root@buildroot:~
> #
> root@buildroot:~
> # handling possible serial event
> [getpkt: discarding char '+']
> getpkt ("qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+");  [sending ack]
> [sent ack]
> putpkt ("$PacketSize=47ff;QPassSignals+;QProgramSignals+;QStartupWithShell+;QEnvironmentHexEncoded+;QEnvironmentReset+;QEnvironmentUnset+;QSetWorkingDir+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;qXfer:osdata:read+;multiprocess+;fork-events+;vfork-events+;exec-events+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace-conf:bts:size+;Qbtrace:pt+;Qbtrace-conf:pt:size+;Qbtrace:off+;qXfer:btrace:read+;qXfer:btrace-conf:read+;swbreak+;hwbreak+;qXfer:exec-file:read+;vContSupported+;QThreadEvents+;no-resumed+#21"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vMustReplyEmpty");  [sending ack]
> [sent ack]
> putpkt ("$#00"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("!");  [sending ack]
> [sent ack]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QProgramSignals:0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;");  [sending ack]
> [sent ack]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("Hgp0.0");  [sending ack]
> [sent ack]
> putpkt ("$E01#a6"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
> [sent ack]
> putpkt ("$E01#a6"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QNonStop:0");  [sending ack]
> [sent ack]
> linux_async (0), previous=0
> [all-stop mode enabled]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qTStatus");  [sending ack]
> [sent ack]
> putpkt ("$#00"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("?");  [sending ack]
> [sent ack]
>>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> stop_all_lwps (stop, except=none)
> wait_for_sigstop: pulling events
> LWFE: waitpid(-1, ...) returned -1,
> LLW: exit (no unwaited-for LWP)
> stop_all_lwps done, setting stopping_threads back to !stopping
> <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> putpkt ("$W00#b7"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QDisableRandomization:1");  [sending ack]
> [sent ack]
> [address space randomization disabled]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QStartupWithShell:1");  [sending ack]
> [sent ack]
> [Inferior will be started with shell]putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QEnvironmentReset");  [sending ack]
> [sent ack]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("QSetWorkingDir:2f");  [sending ack]
> [sent ack]
> [Set the inferior's current directory to /]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vRun;2f62696e2f6c73;2d6c;2f");  [sending ack]
> [sent ack]
> args: -l /
>>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> wait_1: [Process 97]
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> sigsuspend'ing
> sigchld_handler
> LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
> LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> Hit a non-gdbserver trap event.
>>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> stop_all_lwps (stop, except=none)
> wait_for_sigstop: pulling events
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> LLW: exit (no unwaited-for LWP)
> stop_all_lwps done, setting stopping_threads back to !stopping
> <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> Checking whether LWP 97 needs to move out of the jump pad...no
> wait_1 ret = LWP 97.97, 1, 5
> <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>>>>> entering virtual void linux_process_target::resume(thread_resume*, size_t)
> linux_resume:
> already continuing LWP 97 at GDB's request
> Resuming, no pending status or step over needed
> linux_resume done
> <<<< exiting virtual void linux_process_target::resume(thread_resume*, size_t)
>>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> wait_1: [Process 97]
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> RSRL: resuming stopped-resumed LWP LWP 97.97 at 0: step=0
> Resuming lwp 97 (continue, signal 0, stop not expected)
> leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> sigsuspend'ing
> sigchld_handler
> LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
> LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> Hit a non-gdbserver trap event.
>>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> stop_all_lwps (stop, except=none)
> wait_for_sigstop: pulling events
> LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> LLW: exit (no unwaited-for LWP)
> stop_all_lwps done, setting stopping_threads back to !stopping
> <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> Checking whether LWP 97 needs to move out of the jump pad...no
> wait_1 ret = LWP 97.97, 1, 5
> <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> Process /bin/ls created; pid = 97
> Writing resume reply for LWP 97.97:1
> putpkt ("$T0500:0*"00;0e:0*"00;0f:0*"00;10:0*"00;thread:p61.61;core:0;#90"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qAttached:61");  [sending ack]
> [sent ack]
> putpkt ("$0#30"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
> [sent ack]
> putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:setfs:0");  [sending ack]
> [sent ack]
> putpkt ("$F0#76"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:open:6a7573742070726f62696e67,0,1c0");  [sending ack]
> [sent ack]
> putpkt ("$F-1,2#02"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:setfs:61");  [sending ack]
> [sent ack]
> putpkt ("$F0#76"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
> [sent ack]
> putpkt ("$F4#7a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,0");  [sending ack]
> [sent ack]
> putpkt ("$F4734;ELF"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,1ce288");  [sending ack]
> [sent ack]
> putpkt ("$F370;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:fstat:4");  [sending ack]
> [sent ack]
> putpkt ("$F40;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,34");  [sending ack]
> [sent ack]
> putpkt ("$F4733;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,1ce1a1");  [sending ack]
> [sent ack]
> putpkt ("$F457;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
> [sent ack]
> putpkt ("$F4733;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:fstat:4");  [sending ack]
> [sent ack]
> putpkt ("$F40;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
> [sent ack]
> putpkt ("$F5#7b"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:5,47ff,0");  [sending ack]
> [sent ack]
> putpkt ("$F4734;ELF"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:5,47ff,1ce288");  [sending ack]
> [sent ack]
> putpkt ("$F370;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:fstat:5");  [sending ack]
> [sent ack]
> putpkt ("$F40;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:5,47ff,34");  [sending ack]
> [sent ack]
> putpkt ("$F4733;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:5,47ff,1ce1a1");  [sending ack]
> [sent ack]
> putpkt ("$F457;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:5,47ff,b4");  [sending ack]
> [sent ack]
> putpkt ("$F4733;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:fstat:5");  [sending ack]
> [sent ack]
> putpkt ("$F40;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qSymbol::");  [sending ack]
> [sent ack]
> Trying host libthread_db library: libthread_db.so.1.
> dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
> thread_db_load_search returning 0
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qSymbol::");  [sending ack]
> [sent ack]
> Trying host libthread_db library: libthread_db.so.1.
> dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
> thread_db_load_search returning 0
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
> [sent ack]
> putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qOffsets");  [sending ack]
> [sent ack]
> putpkt ("$#00"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("Hgp61.61");  [sending ack]
> [sent ack]
> putpkt ("$OK#9a"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
> [sent ack]
> putpkt ("$l<?xml version="1.0"?>
> <!DOCTYPE target SYSTEM "gdb-target.dtd">
> <target>
>   <architecture>pu32</architecture>
>   <osabi>GNU/Linux</osabi>
>   <feature name="org.gnu.gdb.pu32.core">
>  * <reg name="sp" bitsize="32" type="uint32" regnum="0"/>
>  * <reg name="r1" bitsize="32" type="uint32" regnum="1"/>
>  * <reg name="r2" bitsize="32" type="uint32" regnum="2"/>
>  * <reg name="r3" bitsize="32" type="uint32" regnum="3"/>
>  * <reg name="r4" bitsize="32" type="uint32" regnum="4"/>
>  * <reg name="r5" bitsize="32" type="uint32" regnum="5"/>
>  * <reg name="r6" bitsize="32" type="uint32" regnum="6"/>
>  * <reg name="r7" bitsize="32" type="uint32" regnum="7"/>
>  * <reg name="r8" bitsize="32" type="uint32" regnum="8"/>
>  * <reg name="r9" bitsize="32" type="uint32" regnum="9"/>
>  * <reg name="r10" bitsize="32" type="uint32" regnum="10"/>
>  * <reg name="r11" bitsize="32" type="uint32" regnum="11"/>
>  * <reg name="r12" bitsize="32" type="uint32" regnum="12"/>
>  * <reg name="r13" bitsize="32" type="uint32" regnum="13"/>
>  * <reg name="r14" bitsize="32" type="uint32" regnum="14"/>
>  * <reg name="r15" bitsize="32" type="uint32" regnum="15"/>
>  * <reg name="pc" bitsize="32" type="uint32" regnum="16"/>
>   </feature>
> </target>
> #ef"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
> [sent ack]
> putpkt ("$F4733;"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("g");  [sending ack]
> [sent ack]
> putpkt ("$x*}x*C#04"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:libraries-svr4:read::0,1000");  [sending ack]
> [sent ack]
> putpkt ("$E01#a6"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("qXfer:auxv:read::0,1000");  [sending ack]
> [sent ack]
> putpkt ("$l"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000034,20");  [sending ack]
> [sent ack]
> putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000054,20");  [sending ack]
> [sent ack]
> putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000074,20");  [sending ack]
> [sent ack]
> putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000094,20");  [sending ack]
> [sent ack]
> putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000034,20");  [sending ack]
> [sent ack]
> putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000054,20");  [sending ack]
> [sent ack]
> putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000074,20");  [sending ack]
> [sent ack]
> putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000094,20");  [sending ack]
> [sent ack]
> putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000034,20");  [sending ack]
> [sent ack]
> putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000054,20");  [sending ack]
> [sent ack]
> putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000074,20");  [sending ack]
> [sent ack]
> putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000094,20");  [sending ack]
> [sent ack]
> putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000034,20");  [sending ack]
> [sent ack]
> putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000054,20");  [sending ack]
> [sent ack]
> putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000074,20");  [sending ack]
> [sent ack]
> putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> [received '+' (0x2b)]
> handling possible serial event
> getpkt ("m50000094,20");  [sending ack]
> [sent ack]
> putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> [received '+' (0x2b)]
>
> root@buildroot:~


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

* Re: Help figuring out why `info registers` is showing <unavailable> with gdbserver target
  2022-03-02 16:50 ` Andrew Burgess
@ 2022-03-02 21:02   ` William Tambe
  2022-03-03 12:23     ` Andrew Burgess
  0 siblings, 1 reply; 4+ messages in thread
From: William Tambe @ 2022-03-02 21:02 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 22970 bytes --]

On Wed, Mar 2, 2022 at 10:50 AM Andrew Burgess <aburgess@redhat.com> wrote:
>
> William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> > Regarding this issue, support for gdbserver has been implemented here:
> > https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdbserver/linux-pu32-low.cc
> >
> > Support for gdb has been implemented here:
> > https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdb/pu32-tdep.c
> >
> > gdb is able to successfully connect to gdbserver and start a program
> > on the target; however, gdb is unable to fetch registers and instead
> > shows <unavailable> as follow:
> >
> > (gdb) info registers
> > r0             <unavailable>
> > r1             <unavailable>
> > r2             <unavailable>
> > r3             <unavailable>
> > r4             <unavailable>
> > r5             <unavailable>
> > r6             <unavailable>
> > r7             <unavailable>
> > r8             <unavailable>
> > r9             <unavailable>
> > r10            <unavailable>
> > r11            <unavailable>
> > r12            <unavailable>
> > r13            <unavailable>
> > r14            <unavailable>
> > r15            <unavailable>
> > pc             <unavailable>
> >
> > Find attached full `gdbserver --debug --remote-debug` logs as well as
> > gdb logs.
>
> You should consider using 'set debug remote 1' on the GDB side to
> capture the remote packets from that perspective.  I'm particularlly
> interested in the reply to the 'g' packet, but the complete logs would
> be useful.  This information doesn't seem to be visible in the gdbserver
> output (or I'm missing it).

Please, find attached similar gdb and gdbserver logs; with `set debug
remote 1` used on the GDB side.

>
> Thanks,
> Andrew
>
> >
> > Any idea what might have been missed while implementing gdbserver support ?
> > Would you suggest ways to debug the issue ?
> > tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' && -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1'
> > GNU gdb (GDB) 11.0.50.20210718-git
> > Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
> > 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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
> > To enable execution of this file add
> >         add-auto-load-safe-path /home/tambewilliam/.gdbinit
> > line to your configuration file "/root/.config/gdb/gdbinit".
> > To completely disable this security protection add
> >         set auto-load safe-path /
> > line to your configuration file "/root/.config/gdb/gdbinit".
> > For more information about this security protection see the
> > "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
> >         info "(gdb)Auto-loading safe path"
> > buildroot-build/staging/usr/share/buildroot/gdbinit: No such file or directory.
> > Remote debugging using /dev/ttyUSB2
> > (gdb) set remote exec-file /bin/ls
> > (gdb) r -l /
> > Starting program:  -l /
> > Reading /usr/bin/busybox from remote target...
> > warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
> > Reading /usr/bin/busybox from remote target...
> > Reading symbols from target:/usr/bin/busybox...
> > (No debugging symbols found in target:/usr/bin/busybox)
> > warning: Target-supplied registers are not supported by the current architecture
> > PC register is not available
> > (gdb) info registers
> > r0             <unavailable>
> > r1             <unavailable>
> > r2             <unavailable>
> > r3             <unavailable>
> > r4             <unavailable>
> > r5             <unavailable>
> > r6             <unavailable>
> > r7             <unavailable>
> > r8             <unavailable>
> > r9             <unavailable>
> > r10            <unavailable>
> > r11            <unavailable>
> > r12            <unavailable>
> > r13            <unavailable>
> > r14            <unavailable>
> > r15            <unavailable>
> > pc             <unavailable>
> > (gdb)
> > # gdbserver --debug --remote-debug --multi /dev/ttyS1 &
> > [2] 94
> > root@buildroot:~
> > # sigchld_handler
> > sigchld_handler
> > sigchld_handler
> > sigchld_handler
> > sigchld_handler
> > Remote debugging using /dev/ttyS1
> >
> > root@buildroot:~
> > #
> > root@buildroot:~
> > #
> > root@buildroot:~
> > #
> > root@buildroot:~
> > # handling possible serial event
> > [getpkt: discarding char '+']
> > getpkt ("qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+");  [sending ack]
> > [sent ack]
> > putpkt ("$PacketSize=47ff;QPassSignals+;QProgramSignals+;QStartupWithShell+;QEnvironmentHexEncoded+;QEnvironmentReset+;QEnvironmentUnset+;QSetWorkingDir+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;qXfer:osdata:read+;multiprocess+;fork-events+;vfork-events+;exec-events+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace-conf:bts:size+;Qbtrace:pt+;Qbtrace-conf:pt:size+;Qbtrace:off+;qXfer:btrace:read+;qXfer:btrace-conf:read+;swbreak+;hwbreak+;qXfer:exec-file:read+;vContSupported+;QThreadEvents+;no-resumed+#21"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vMustReplyEmpty");  [sending ack]
> > [sent ack]
> > putpkt ("$#00"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("!");  [sending ack]
> > [sent ack]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QProgramSignals:0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;");  [sending ack]
> > [sent ack]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("Hgp0.0");  [sending ack]
> > [sent ack]
> > putpkt ("$E01#a6"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$E01#a6"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QNonStop:0");  [sending ack]
> > [sent ack]
> > linux_async (0), previous=0
> > [all-stop mode enabled]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qTStatus");  [sending ack]
> > [sent ack]
> > putpkt ("$#00"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("?");  [sending ack]
> > [sent ack]
> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> > stop_all_lwps (stop, except=none)
> > wait_for_sigstop: pulling events
> > LWFE: waitpid(-1, ...) returned -1,
> > LLW: exit (no unwaited-for LWP)
> > stop_all_lwps done, setting stopping_threads back to !stopping
> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> > putpkt ("$W00#b7"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QDisableRandomization:1");  [sending ack]
> > [sent ack]
> > [address space randomization disabled]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QStartupWithShell:1");  [sending ack]
> > [sent ack]
> > [Inferior will be started with shell]putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QEnvironmentReset");  [sending ack]
> > [sent ack]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("QSetWorkingDir:2f");  [sending ack]
> > [sent ack]
> > [Set the inferior's current directory to /]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vRun;2f62696e2f6c73;2d6c;2f");  [sending ack]
> > [sent ack]
> > args: -l /
> >>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> > wait_1: [Process 97]
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> > sigsuspend'ing
> > sigchld_handler
> > LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
> > LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > Hit a non-gdbserver trap event.
> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> > stop_all_lwps (stop, except=none)
> > wait_for_sigstop: pulling events
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> > LLW: exit (no unwaited-for LWP)
> > stop_all_lwps done, setting stopping_threads back to !stopping
> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> > Checking whether LWP 97 needs to move out of the jump pad...no
> > wait_1 ret = LWP 97.97, 1, 5
> > <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> >>>>> entering virtual void linux_process_target::resume(thread_resume*, size_t)
> > linux_resume:
> > already continuing LWP 97 at GDB's request
> > Resuming, no pending status or step over needed
> > linux_resume done
> > <<<< exiting virtual void linux_process_target::resume(thread_resume*, size_t)
> >>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> > wait_1: [Process 97]
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > RSRL: resuming stopped-resumed LWP LWP 97.97 at 0: step=0
> > Resuming lwp 97 (continue, signal 0, stop not expected)
> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> > sigsuspend'ing
> > sigchld_handler
> > LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
> > LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > Hit a non-gdbserver trap event.
> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
> > stop_all_lwps (stop, except=none)
> > wait_for_sigstop: pulling events
> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
> > LLW: exit (no unwaited-for LWP)
> > stop_all_lwps done, setting stopping_threads back to !stopping
> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
> > Checking whether LWP 97 needs to move out of the jump pad...no
> > wait_1 ret = LWP 97.97, 1, 5
> > <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
> > Process /bin/ls created; pid = 97
> > Writing resume reply for LWP 97.97:1
> > putpkt ("$T0500:0*"00;0e:0*"00;0f:0*"00;10:0*"00;thread:p61.61;core:0;#90"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qAttached:61");  [sending ack]
> > [sent ack]
> > putpkt ("$0#30"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:setfs:0");  [sending ack]
> > [sent ack]
> > putpkt ("$F0#76"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:open:6a7573742070726f62696e67,0,1c0");  [sending ack]
> > [sent ack]
> > putpkt ("$F-1,2#02"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:setfs:61");  [sending ack]
> > [sent ack]
> > putpkt ("$F0#76"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
> > [sent ack]
> > putpkt ("$F4#7a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,0");  [sending ack]
> > [sent ack]
> > putpkt ("$F4734;ELF"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,1ce288");  [sending ack]
> > [sent ack]
> > putpkt ("$F370;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:fstat:4");  [sending ack]
> > [sent ack]
> > putpkt ("$F40;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,34");  [sending ack]
> > [sent ack]
> > putpkt ("$F4733;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,1ce1a1");  [sending ack]
> > [sent ack]
> > putpkt ("$F457;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
> > [sent ack]
> > putpkt ("$F4733;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:fstat:4");  [sending ack]
> > [sent ack]
> > putpkt ("$F40;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
> > [sent ack]
> > putpkt ("$F5#7b"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:5,47ff,0");  [sending ack]
> > [sent ack]
> > putpkt ("$F4734;ELF"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:5,47ff,1ce288");  [sending ack]
> > [sent ack]
> > putpkt ("$F370;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:fstat:5");  [sending ack]
> > [sent ack]
> > putpkt ("$F40;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:5,47ff,34");  [sending ack]
> > [sent ack]
> > putpkt ("$F4733;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:5,47ff,1ce1a1");  [sending ack]
> > [sent ack]
> > putpkt ("$F457;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:5,47ff,b4");  [sending ack]
> > [sent ack]
> > putpkt ("$F4733;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:fstat:5");  [sending ack]
> > [sent ack]
> > putpkt ("$F40;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qSymbol::");  [sending ack]
> > [sent ack]
> > Trying host libthread_db library: libthread_db.so.1.
> > dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
> > thread_db_load_search returning 0
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qSymbol::");  [sending ack]
> > [sent ack]
> > Trying host libthread_db library: libthread_db.so.1.
> > dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
> > thread_db_load_search returning 0
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qOffsets");  [sending ack]
> > [sent ack]
> > putpkt ("$#00"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("Hgp61.61");  [sending ack]
> > [sent ack]
> > putpkt ("$OK#9a"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$l<?xml version="1.0"?>
> > <!DOCTYPE target SYSTEM "gdb-target.dtd">
> > <target>
> >   <architecture>pu32</architecture>
> >   <osabi>GNU/Linux</osabi>
> >   <feature name="org.gnu.gdb.pu32.core">
> >  * <reg name="sp" bitsize="32" type="uint32" regnum="0"/>
> >  * <reg name="r1" bitsize="32" type="uint32" regnum="1"/>
> >  * <reg name="r2" bitsize="32" type="uint32" regnum="2"/>
> >  * <reg name="r3" bitsize="32" type="uint32" regnum="3"/>
> >  * <reg name="r4" bitsize="32" type="uint32" regnum="4"/>
> >  * <reg name="r5" bitsize="32" type="uint32" regnum="5"/>
> >  * <reg name="r6" bitsize="32" type="uint32" regnum="6"/>
> >  * <reg name="r7" bitsize="32" type="uint32" regnum="7"/>
> >  * <reg name="r8" bitsize="32" type="uint32" regnum="8"/>
> >  * <reg name="r9" bitsize="32" type="uint32" regnum="9"/>
> >  * <reg name="r10" bitsize="32" type="uint32" regnum="10"/>
> >  * <reg name="r11" bitsize="32" type="uint32" regnum="11"/>
> >  * <reg name="r12" bitsize="32" type="uint32" regnum="12"/>
> >  * <reg name="r13" bitsize="32" type="uint32" regnum="13"/>
> >  * <reg name="r14" bitsize="32" type="uint32" regnum="14"/>
> >  * <reg name="r15" bitsize="32" type="uint32" regnum="15"/>
> >  * <reg name="pc" bitsize="32" type="uint32" regnum="16"/>
> >   </feature>
> > </target>
> > #ef"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
> > [sent ack]
> > putpkt ("$F4733;"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("g");  [sending ack]
> > [sent ack]
> > putpkt ("$x*}x*C#04"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:libraries-svr4:read::0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$E01#a6"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("qXfer:auxv:read::0,1000");  [sending ack]
> > [sent ack]
> > putpkt ("$l"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000034,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000054,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000074,20");  [sending ack]
> > [sent ack]
> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000094,20");  [sending ack]
> > [sent ack]
> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000034,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000054,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000074,20");  [sending ack]
> > [sent ack]
> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000094,20");  [sending ack]
> > [sent ack]
> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000034,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000054,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000074,20");  [sending ack]
> > [sent ack]
> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000094,20");  [sending ack]
> > [sent ack]
> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000034,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000054,20");  [sending ack]
> > [sent ack]
> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000074,20");  [sending ack]
> > [sent ack]
> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
> > [received '+' (0x2b)]
> > handling possible serial event
> > getpkt ("m50000094,20");  [sending ack]
> > [sent ack]
> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
> > [received '+' (0x2b)]
> >
> > root@buildroot:~
>

[-- Attachment #2: gdb.txt --]
[-- Type: text/plain, Size: 8534 bytes --]

tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x ~/Documents/buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'cd /home/tambewilliam/Documents/buildroot-build/staging/' -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1' -ex 'set debug remote 1'
GNU gdb (GDB) 11.0.50.20210718-git
Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /home/tambewilliam/.gdbinit
line to your configuration file "/root/.config/gdb/gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/root/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
Working directory /home/tambewilliam/Documents/buildroot-build/staging
 (canonically /home/tambewilliam/Documents/buildroot-build/host/pu32-buildroot-linux-gnu/sysroot).
Remote debugging using /dev/ttyUSB2
Debug output enabled.
Protocol debug output enabled.
(gdb) set remote exec-file bin/ls
(gdb) file bin/ls
Reading symbols from bin/ls...
(gdb)
(gdb) r -l /
Starting program: /home/tambewilliam/Documents/buildroot-build/host/pu32-buildroot-linux-gnu/sysroot/usr/bin/ls -l /
[remote] Sending packet: $QDisableRandomization:1#cf
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $QStartupWithShell:1#43
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $QEnvironmentReset#e9
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $QSetWorkingDir:2f#4f
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $vRun;62696e2f6c73;2d6c;2f#30
[remote] Received Ack
[remote] Packet received: T0500:00000000;0e:00000000;0f:00000000;10:00000000;thread:p5b.5b;core:0;
[remote] packet_ok: Packet vRun (run) is supported
[remote] Sending packet: $qAttached:5b#60
[remote] Received Ack
[remote] Packet received: 0
[remote] packet_ok: Packet qAttached (query-attached) is supported
[remote] Sending packet: $qXfer:exec-file:read:5b:0,1000#b0
[remote] Received Ack
[remote] Packet received: l/usr/bin/busybox
[remote] Sending packet: $qOffsets#4b
[remote] Received Ack
[remote] Packet received:
[remote] Sending packet: $Hgp5b.5b#7b
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $qXfer:features:read:target.xml:0,1000#0c
[remote] Received Ack
[remote] Packet received: l<?xml version="1.0"?>\n<!DOCTYPE target SYSTEM "gdb-target.dtd">\n<target>\n  <architecture>pu32</architecture>\n  <osabi>GNU/Linux</osabi>\n  <feature name="org.gnu.gdb.pu32.core">\n    <reg name="sp" bitsize="32" type="uint32" regnum="0"/>\n    <reg name="r1" bitsize="32" type="uint32" regnum="1"/>\n    <reg name="r2" bitsize="32" type="uint32" regnum="2"/>\n    <reg name="r3" bitsize="32" type="uint32" regnum="3"/>\n    <reg name="r4" bitsize="32" type="uint32" regnum="4"/>\n    <reg name="r5" bitsize="32" type="u [705 bytes omitted]
warning: Target-supplied registers are not supported by the current architecture
[remote] Sending packet: $g#67
[remote] Received Ack
[remote] Packet received: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[remote] Sending packet: $qXfer:libraries-svr4:read::0,1000#20
[remote] Received Ack
[remote] Packet received: E01
[remote] Sending packet: $qXfer:auxv:read::0,1000#6b
[remote] Received Ack
[remote] Packet received: l\020\000\000\000\000\000\000\000\006\000\000\000\000\020\000\000\021\000\000\000d\000\000\000\003\000\000\0004\000\000P\004\000\000\000 \000\000\000\005\000\000\000\004\000\000\000\a\000\000\000\000\000\000\000\b\000\000\000\000\000\000\000\t\000\000\000`\003\000P\013\000\000\000\000\000\000\000\f\000\000\000\000\000\000\000\r\000\000\000\000\000\000\000\016\000\000\000\000\000\000\000\027\000\000\000\000\000\000\000\031\000\000\000�_��\037\000\000\000�_��\000\000\000\000\000\000\000\000
[remote] Sending packet: $m50000034,20#87
[remote] Received Ack
[remote] Packet received: 01000000000000000000005000000050f9cb1c00f9cb1c000500000000100000
[remote] Sending packet: $m50000054,20#89
[remote] Received Ack
[remote] Packet received: 01000000fccb1c00fcdb1c50fcdb1c50a51500001c3700000600000000100000
[remote] Sending packet: $m50000074,20#8b
[remote] Received Ack
[remote] Packet received: 04000000b4000000b4000050b400005020000000200000000400000004000000
[remote] Sending packet: $m50000094,20#8d
[remote] Received Ack
[remote] Packet received: 07000000fccb1c00fcdb1c50fcdb1c5018000000540000000400000004000000
[remote] Sending packet: $m50000034,20#87
[remote] Received Ack
[remote] Packet received: 01000000000000000000005000000050f9cb1c00f9cb1c000500000000100000
[remote] Sending packet: $m50000054,20#89
[remote] Received Ack
[remote] Packet received: 01000000fccb1c00fcdb1c50fcdb1c50a51500001c3700000600000000100000
[remote] Sending packet: $m50000074,20#8b
[remote] Received Ack
[remote] Packet received: 04000000b4000000b4000050b400005020000000200000000400000004000000
[remote] Sending packet: $m50000094,20#8d
[remote] Received Ack
[remote] Packet received: 07000000fccb1c00fcdb1c50fcdb1c5018000000540000000400000004000000
[remote] Sending packet: $m50000034,20#87
[remote] Received Ack
[remote] Packet received: 01000000000000000000005000000050f9cb1c00f9cb1c000500000000100000
[remote] Sending packet: $m50000054,20#89
[remote] Received Ack
[remote] Packet received: 01000000fccb1c00fcdb1c50fcdb1c50a51500001c3700000600000000100000
[remote] Sending packet: $m50000074,20#8b
[remote] Received Ack
[remote] Packet received: 04000000b4000000b4000050b400005020000000200000000400000004000000
[remote] Sending packet: $m50000094,20#8d
[remote] Received Ack
[remote] Packet received: 07000000fccb1c00fcdb1c50fcdb1c5018000000540000000400000004000000
[remote] Sending packet: $m501d0634,4#94
[remote] Received Ack
[remote] Packet received: 00000000
[remote] Sending packet: $m501d0630,4#90
[remote] Received Ack
[remote] Packet received: 00000000
[remote] Sending packet: $m501d0634,4#94
[remote] Received Ack
[remote] Packet received: 00000000
[remote] Sending packet: $m50000034,20#87
[remote] Received Ack
[remote] Packet received: 01000000000000000000005000000050f9cb1c00f9cb1c000500000000100000
[remote] Sending packet: $m50000054,20#89
[remote] Received Ack
[remote] Packet received: 01000000fccb1c00fcdb1c50fcdb1c50a51500001c3700000600000000100000
[remote] Sending packet: $m50000074,20#8b
[remote] Received Ack
[remote] Packet received: 04000000b4000000b4000050b400005020000000200000000400000004000000
[remote] Sending packet: $m50000094,20#8d
[remote] Received Ack
[remote] Packet received: 07000000fccb1c00fcdb1c50fcdb1c5018000000540000000400000004000000
[remote] Sending packet: $m501425b4,2#92
[remote] Received Ack
[remote] Packet received: d1ff
[remote] Sending packet: $m50197ce2,2#cb
[remote] Received Ack
[remote] Packet received: d1ff
PC register is not available
(gdb) [remote] wait: enter
[remote] wait: exit

(gdb) info registers
r0             <unavailable>
r1             <unavailable>
r2             <unavailable>
r3             <unavailable>
r4             <unavailable>
r5             <unavailable>
r6             <unavailable>
r7             <unavailable>
r8             <unavailable>
r9             <unavailable>
r10            <unavailable>
r11            <unavailable>
r12            <unavailable>
r13            <unavailable>
r14            <unavailable>
r15            <unavailable>
pc             <unavailable>
(gdb)

[-- Attachment #3: gdbserver.txt --]
[-- Type: text/plain, Size: 13314 bytes --]

root@buildroot:~
# gdbserver --debug --remote-debug --multi /dev/ttyS1 &
[2] 87
root@buildroot:~
#
root@buildroot:~
#
root@buildroot:~
#
root@buildroot:~
# sigchld_handler
sigchld_handler
sigchld_handler
sigchld_handler
sigchld_handler
Remote debugging using /dev/ttyS1

root@buildroot:~
# handling possible serial event
[getpkt: discarding char '+']
getpkt ("qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+");  [sending ack]
[sent ack]
putpkt ("$PacketSize=47ff;QPassSignals+;QProgramSignals+;QStartupWithShell+;QEnvironmentHexEncoded+;QEnvironmentReset+;QEnvironmentUnset+;QSetWorkingDir+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;qXfer:osdata:read+;multiprocess+;fork-events+;vfork-events+;exec-events+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace-conf:bts:size+;Qbtrace:pt+;Qbtrace-conf:pt:size+;Qbtrace:off+;qXfer:btrace:read+;qXfer:btrace-conf:read+;swbreak+;hwbreak+;qXfer:exec-file:read+;vContSupported+;QThreadEvents+;no-resumed+#21"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vMustReplyEmpty");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("!");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QProgramSignals:0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("Hgp0.0");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QNonStop:0");  [sending ack]
[sent ack]
linux_async (0), previous=0
[all-stop mode enabled]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qTStatus");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("?");  [sending ack]
[sent ack]
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned -1,
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
putpkt ("$W00#b7"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qRcmd,7365742064656275672031");  [sending ack]
[sent ack]
putpkt ("$O4465627567206f757470757420656e61626c65642e0a#43"); [looking for ack]
[received '+' (0x2b)]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qRcmd,7365742072656d6f74652d64656275672031");  [sending ack]
[sent ack]
putpkt ("$O50726f746f636f6c206465627567206f757470757420656e61626c65642e0a#b6"); [looking for ack]
[received '+' (0x2b)]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]

root@buildroot:~
# handling possible serial event
getpkt ("QDisableRandomization:1");  [sending ack]
[sent ack]
[address space randomization disabled]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QStartupWithShell:1");  [sending ack]
[sent ack]
[Inferior will be started with shell]putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QEnvironmentReset");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("QSetWorkingDir:2f");  [sending ack]
[sent ack]
[Set the inferior's current directory to /]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("vRun;62696e2f6c73;2d6c;2f");  [sending ack]
[sent ack]
args: -l /
>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
wait_1: [Process 91]
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=91, leader_lp!=NULL=1, num_lwps=1, zombie=0
sigsuspend'ing
sigchld_handler
LWFE: waitpid(-1, ...) returned 91, ERRNO-OK
LLW: waitpid 91 received SIGTRAP - Trace/breakpoint trap (stopped)
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
Hit a non-gdbserver trap event.
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=91, leader_lp!=NULL=1, num_lwps=1, zombie=0
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
Checking whether LWP 91 needs to move out of the jump pad...no
wait_1 ret = LWP 91.91, 1, 5
<<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>>>> entering virtual void linux_process_target::resume(thread_resume*, size_t)
linux_resume:
already continuing LWP 91 at GDB's request
Resuming, no pending status or step over needed
linux_resume done
<<<< exiting virtual void linux_process_target::resume(thread_resume*, size_t)
>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
wait_1: [Process 91]
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
RSRL: resuming stopped-resumed LWP LWP 91.91 at 0: step=0
Resuming lwp 91 (continue, signal 0, stop not expected)
leader_pid=91, leader_lp!=NULL=1, num_lwps=1, zombie=0
sigsuspend'ing
sigchld_handler
LWFE: waitpid(-1, ...) returned 91, ERRNO-OK
LLW: waitpid 91 received SIGTRAP - Trace/breakpoint trap (stopped)
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
Hit a non-gdbserver trap event.
>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
stop_all_lwps (stop, except=none)
wait_for_sigstop: pulling events
LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
leader_pid=91, leader_lp!=NULL=1, num_lwps=1, zombie=0
LLW: exit (no unwaited-for LWP)
stop_all_lwps done, setting stopping_threads back to !stopping
<<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
Checking whether LWP 91 needs to move out of the jump pad...no
wait_1 ret = LWP 91.91, 1, 5
<<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
Process bin/ls created; pid = 91
Writing resume reply for LWP 91.91:1
putpkt ("$T0500:0*"00;0e:0*"00;0f:0*"00;10:0*"00;thread:p5b.5b;core:0;#f0"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qAttached:5b");  [sending ack]
[sent ack]
putpkt ("$0#30"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:exec-file:read:5b:0,1000");  [sending ack]
[sent ack]
putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qOffsets");  [sending ack]
[sent ack]
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("Hgp5b.5b");  [sending ack]
[sent ack]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
[sent ack]
putpkt ("$l<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target>
  <architecture>pu32</architecture>
  <osabi>GNU/Linux</osabi>
  <feature name="org.gnu.gdb.pu32.core">
 * <reg name="sp" bitsize="32" type="uint32" regnum="0"/>
 * <reg name="r1" bitsize="32" type="uint32" regnum="1"/>
 * <reg name="r2" bitsize="32" type="uint32" regnum="2"/>
 * <reg name="r3" bitsize="32" type="uint32" regnum="3"/>
 * <reg name="r4" bitsize="32" type="uint32" regnum="4"/>
 * <reg name="r5" bitsize="32" type="uint32" regnum="5"/>
 * <reg name="r6" bitsize="32" type="uint32" regnum="6"/>
 * <reg name="r7" bitsize="32" type="uint32" regnum="7"/>
 * <reg name="r8" bitsize="32" type="uint32" regnum="8"/>
 * <reg name="r9" bitsize="32" type="uint32" regnum="9"/>
 * <reg name="r10" bitsize="32" type="uint32" regnum="10"/>
 * <reg name="r11" bitsize="32" type="uint32" regnum="11"/>
 * <reg name="r12" bitsize="32" type="uint32" regnum="12"/>
 * <reg name="r13" bitsize="32" type="uint32" regnum="13"/>
 * <reg name="r14" bitsize="32" type="uint32" regnum="14"/>
 * <reg name="r15" bitsize="32" type="uint32" regnum="15"/>
 * <reg name="pc" bitsize="32" type="uint32" regnum="16"/>
  </feature>
</target>
#ef"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("g");  [sending ack]
[sent ack]
putpkt ("$x*}x*C#04"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:libraries-svr4:read::0,1000");  [sending ack]
[sent ack]
putpkt ("$E01#a6"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("qXfer:auxv:read::0,1000");  [sending ack]
[sent ack]
putpkt ("$l"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m501d0634,4");  [sending ack]
[sent ack]
putpkt ("$0*"00#dc"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m501d0630,4");  [sending ack]
[sent ack]
putpkt ("$0*"00#dc"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m501d0634,4");  [sending ack]
[sent ack]
putpkt ("$0*"00#dc"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000034,20");  [sending ack]
[sent ack]
putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000054,20");  [sending ack]
[sent ack]
putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000074,20");  [sending ack]
[sent ack]
putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50000094,20");  [sending ack]
[sent ack]
putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m501425b4,2");  [sending ack]
[sent ack]
putpkt ("$d1ff#61"); [looking for ack]
[received '+' (0x2b)]
handling possible serial event
getpkt ("m50197ce2,2");  [sending ack]
[sent ack]
putpkt ("$d1ff#61"); [looking for ack]
[received '+' (0x2b)]

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

* Re: Help figuring out why `info registers` is showing <unavailable> with gdbserver target
  2022-03-02 21:02   ` William Tambe
@ 2022-03-03 12:23     ` Andrew Burgess
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Burgess @ 2022-03-03 12:23 UTC (permalink / raw)
  To: William Tambe; +Cc: gdb-patches

William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:

> On Wed, Mar 2, 2022 at 10:50 AM Andrew Burgess <aburgess@redhat.com> wrote:
>>
>> William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> > Regarding this issue, support for gdbserver has been implemented here:
>> > https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdbserver/linux-pu32-low.cc
>> >
>> > Support for gdb has been implemented here:
>> > https://github.com/fontamsoc/binutils-gdb/blob/b2eeeae0/gdb/pu32-tdep.c
>> >
>> > gdb is able to successfully connect to gdbserver and start a program
>> > on the target; however, gdb is unable to fetch registers and instead
>> > shows <unavailable> as follow:
>> >
>> > (gdb) info registers
>> > r0             <unavailable>
>> > r1             <unavailable>
>> > r2             <unavailable>
>> > r3             <unavailable>
>> > r4             <unavailable>
>> > r5             <unavailable>
>> > r6             <unavailable>
>> > r7             <unavailable>
>> > r8             <unavailable>
>> > r9             <unavailable>
>> > r10            <unavailable>
>> > r11            <unavailable>
>> > r12            <unavailable>
>> > r13            <unavailable>
>> > r14            <unavailable>
>> > r15            <unavailable>
>> > pc             <unavailable>
>> >
>> > Find attached full `gdbserver --debug --remote-debug` logs as well as
>> > gdb logs.
>>
>> You should consider using 'set debug remote 1' on the GDB side to
>> capture the remote packets from that perspective.  I'm particularlly
>> interested in the reply to the 'g' packet, but the complete logs would
>> be useful.  This information doesn't seem to be visible in the gdbserver
>> output (or I'm missing it).
>
> Please, find attached similar gdb and gdbserver logs; with `set debug
> remote 1` used on the GDB side.
>
>>
>> Thanks,
>> Andrew
>>
>> >
>> > Any idea what might have been missed while implementing gdbserver support ?
>> > Would you suggest ways to debug the issue ?
>> > tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' && -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1'
>> > GNU gdb (GDB) 11.0.50.20210718-git
>> > Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
>> > 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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
>> > To enable execution of this file add
>> >         add-auto-load-safe-path /home/tambewilliam/.gdbinit
>> > line to your configuration file "/root/.config/gdb/gdbinit".
>> > To completely disable this security protection add
>> >         set auto-load safe-path /
>> > line to your configuration file "/root/.config/gdb/gdbinit".
>> > For more information about this security protection see the
>> > "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
>> >         info "(gdb)Auto-loading safe path"
>> > buildroot-build/staging/usr/share/buildroot/gdbinit: No such file or directory.
>> > Remote debugging using /dev/ttyUSB2
>> > (gdb) set remote exec-file /bin/ls
>> > (gdb) r -l /
>> > Starting program:  -l /
>> > Reading /usr/bin/busybox from remote target...
>> > warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
>> > Reading /usr/bin/busybox from remote target...
>> > Reading symbols from target:/usr/bin/busybox...
>> > (No debugging symbols found in target:/usr/bin/busybox)
>> > warning: Target-supplied registers are not supported by the current architecture
>> > PC register is not available
>> > (gdb) info registers
>> > r0             <unavailable>
>> > r1             <unavailable>
>> > r2             <unavailable>
>> > r3             <unavailable>
>> > r4             <unavailable>
>> > r5             <unavailable>
>> > r6             <unavailable>
>> > r7             <unavailable>
>> > r8             <unavailable>
>> > r9             <unavailable>
>> > r10            <unavailable>
>> > r11            <unavailable>
>> > r12            <unavailable>
>> > r13            <unavailable>
>> > r14            <unavailable>
>> > r15            <unavailable>
>> > pc             <unavailable>
>> > (gdb)
>> > # gdbserver --debug --remote-debug --multi /dev/ttyS1 &
>> > [2] 94
>> > root@buildroot:~
>> > # sigchld_handler
>> > sigchld_handler
>> > sigchld_handler
>> > sigchld_handler
>> > sigchld_handler
>> > Remote debugging using /dev/ttyS1
>> >
>> > root@buildroot:~
>> > #
>> > root@buildroot:~
>> > #
>> > root@buildroot:~
>> > #
>> > root@buildroot:~
>> > # handling possible serial event
>> > [getpkt: discarding char '+']
>> > getpkt ("qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+");  [sending ack]
>> > [sent ack]
>> > putpkt ("$PacketSize=47ff;QPassSignals+;QProgramSignals+;QStartupWithShell+;QEnvironmentHexEncoded+;QEnvironmentReset+;QEnvironmentUnset+;QSetWorkingDir+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;qXfer:osdata:read+;multiprocess+;fork-events+;vfork-events+;exec-events+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace-conf:bts:size+;Qbtrace:pt+;Qbtrace-conf:pt:size+;Qbtrace:off+;qXfer:btrace:read+;qXfer:btrace-conf:read+;swbreak+;hwbreak+;qXfer:exec-file:read+;vContSupported+;QThreadEvents+;no-resumed+#21"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vMustReplyEmpty");  [sending ack]
>> > [sent ack]
>> > putpkt ("$#00"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("!");  [sending ack]
>> > [sent ack]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QProgramSignals:0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;");  [sending ack]
>> > [sent ack]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("Hgp0.0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$E01#a6"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$E01#a6"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QNonStop:0");  [sending ack]
>> > [sent ack]
>> > linux_async (0), previous=0
>> > [all-stop mode enabled]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qTStatus");  [sending ack]
>> > [sent ack]
>> > putpkt ("$#00"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("?");  [sending ack]
>> > [sent ack]
>> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > stop_all_lwps (stop, except=none)
>> > wait_for_sigstop: pulling events
>> > LWFE: waitpid(-1, ...) returned -1,
>> > LLW: exit (no unwaited-for LWP)
>> > stop_all_lwps done, setting stopping_threads back to !stopping
>> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > putpkt ("$W00#b7"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QDisableRandomization:1");  [sending ack]
>> > [sent ack]
>> > [address space randomization disabled]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QStartupWithShell:1");  [sending ack]
>> > [sent ack]
>> > [Inferior will be started with shell]putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QEnvironmentReset");  [sending ack]
>> > [sent ack]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("QSetWorkingDir:2f");  [sending ack]
>> > [sent ack]
>> > [Set the inferior's current directory to /]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vRun;2f62696e2f6c73;2d6c;2f");  [sending ack]
>> > [sent ack]
>> > args: -l /
>> >>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>> > wait_1: [Process 97]
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
>> > sigsuspend'ing
>> > sigchld_handler
>> > LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
>> > LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > Hit a non-gdbserver trap event.
>> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > stop_all_lwps (stop, except=none)
>> > wait_for_sigstop: pulling events
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
>> > LLW: exit (no unwaited-for LWP)
>> > stop_all_lwps done, setting stopping_threads back to !stopping
>> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > Checking whether LWP 97 needs to move out of the jump pad...no
>> > wait_1 ret = LWP 97.97, 1, 5
>> > <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>> >>>>> entering virtual void linux_process_target::resume(thread_resume*, size_t)
>> > linux_resume:
>> > already continuing LWP 97 at GDB's request
>> > Resuming, no pending status or step over needed
>> > linux_resume done
>> > <<<< exiting virtual void linux_process_target::resume(thread_resume*, size_t)
>> >>>>> entering ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>> > wait_1: [Process 97]
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > RSRL: resuming stopped-resumed LWP LWP 97.97 at 0: step=0
>> > Resuming lwp 97 (continue, signal 0, stop not expected)
>> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
>> > sigsuspend'ing
>> > sigchld_handler
>> > LWFE: waitpid(-1, ...) returned 97, ERRNO-OK
>> > LLW: waitpid 97 received SIGTRAP - Trace/breakpoint trap (stopped)
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > Hit a non-gdbserver trap event.
>> >>>>> entering void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > stop_all_lwps (stop, except=none)
>> > wait_for_sigstop: pulling events
>> > LWFE: waitpid(-1, ...) returned 0, ERRNO-OK
>> > leader_pid=97, leader_lp!=NULL=1, num_lwps=1, zombie=0
>> > LLW: exit (no unwaited-for LWP)
>> > stop_all_lwps done, setting stopping_threads back to !stopping
>> > <<<< exiting void linux_process_target::stop_all_lwps(int, lwp_info*)
>> > Checking whether LWP 97 needs to move out of the jump pad...no
>> > wait_1 ret = LWP 97.97, 1, 5
>> > <<<< exiting ptid_t linux_process_target::wait_1(ptid_t, target_waitstatus*, target_wait_flags)
>> > Process /bin/ls created; pid = 97
>> > Writing resume reply for LWP 97.97:1
>> > putpkt ("$T0500:0*"00;0e:0*"00;0f:0*"00;10:0*"00;thread:p61.61;core:0;#90"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qAttached:61");  [sending ack]
>> > [sent ack]
>> > putpkt ("$0#30"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:setfs:0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F0#76"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:open:6a7573742070726f62696e67,0,1c0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F-1,2#02"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:setfs:61");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F0#76"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4#7a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4734;ELF"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,1ce288");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F370;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:fstat:4");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F40;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,34");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4733;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,1ce1a1");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F457;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4733;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:fstat:4");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F40;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:open:2f7573722f62696e2f62757379626f78,0,0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F5#7b"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:5,47ff,0");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4734;ELF"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:5,47ff,1ce288");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F370;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:fstat:5");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F40;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:5,47ff,34");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4733;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:5,47ff,1ce1a1");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F457;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:5,47ff,b4");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4733;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:fstat:5");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F40;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qSymbol::");  [sending ack]
>> > [sent ack]
>> > Trying host libthread_db library: libthread_db.so.1.
>> > dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
>> > thread_db_load_search returning 0
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qSymbol::");  [sending ack]
>> > [sent ack]
>> > Trying host libthread_db library: libthread_db.so.1.
>> > dlopen failed: libthread_db.so.1: cannot open shared object file: No such file or directory.
>> > thread_db_load_search returning 0
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:exec-file:read:61:0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$l/usr/bin/busybox#98"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qOffsets");  [sending ack]
>> > [sent ack]
>> > putpkt ("$#00"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("Hgp61.61");  [sending ack]
>> > [sent ack]
>> > putpkt ("$OK#9a"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:features:read:target.xml:0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$l<?xml version="1.0"?>
>> > <!DOCTYPE target SYSTEM "gdb-target.dtd">
>> > <target>
>> >   <architecture>pu32</architecture>
>> >   <osabi>GNU/Linux</osabi>
>> >   <feature name="org.gnu.gdb.pu32.core">
>> >  * <reg name="sp" bitsize="32" type="uint32" regnum="0"/>
>> >  * <reg name="r1" bitsize="32" type="uint32" regnum="1"/>
>> >  * <reg name="r2" bitsize="32" type="uint32" regnum="2"/>
>> >  * <reg name="r3" bitsize="32" type="uint32" regnum="3"/>
>> >  * <reg name="r4" bitsize="32" type="uint32" regnum="4"/>
>> >  * <reg name="r5" bitsize="32" type="uint32" regnum="5"/>
>> >  * <reg name="r6" bitsize="32" type="uint32" regnum="6"/>
>> >  * <reg name="r7" bitsize="32" type="uint32" regnum="7"/>
>> >  * <reg name="r8" bitsize="32" type="uint32" regnum="8"/>
>> >  * <reg name="r9" bitsize="32" type="uint32" regnum="9"/>
>> >  * <reg name="r10" bitsize="32" type="uint32" regnum="10"/>
>> >  * <reg name="r11" bitsize="32" type="uint32" regnum="11"/>
>> >  * <reg name="r12" bitsize="32" type="uint32" regnum="12"/>
>> >  * <reg name="r13" bitsize="32" type="uint32" regnum="13"/>
>> >  * <reg name="r14" bitsize="32" type="uint32" regnum="14"/>
>> >  * <reg name="r15" bitsize="32" type="uint32" regnum="15"/>
>> >  * <reg name="pc" bitsize="32" type="uint32" regnum="16"/>
>> >   </feature>
>> > </target>
>> > #ef"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("vFile:pread:4,47ff,b4");  [sending ack]
>> > [sent ack]
>> > putpkt ("$F4733;"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("g");  [sending ack]
>> > [sent ack]
>> > putpkt ("$x*}x*C#04"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:libraries-svr4:read::0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$E01#a6"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("qXfer:auxv:read::0,1000");  [sending ack]
>> > [sent ack]
>> > putpkt ("$l"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000034,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000054,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000074,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000094,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000034,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000054,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000074,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000094,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000034,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000054,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000074,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000094,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000034,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*050*"050f9cb1c00f9cb1c00050*"0010*!#ce"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000054,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$010*"fccb1c00fcdb1c50fcdb1c50a5150* 1c370*!60*"0010*!#1c"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000074,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$040*"b40*"b40* 50b40* 5020*"020*"0040*"040*"#58"); [looking for ack]
>> > [received '+' (0x2b)]
>> > handling possible serial event
>> > getpkt ("m50000094,20");  [sending ack]
>> > [sent ack]
>> > putpkt ("$070*"fccb1c00fcdb1c50fcdb1c50180*"540*"040*"040*"#ff"); [looking for ack]
>> > [received '+' (0x2b)]
>> >
>> > root@buildroot:~
>>
> tambewilliam@kubuntu20200502:~$ sudo /opt/pu32-toolchain/bin/pu32-elf-gdb -x ~/Documents/buildroot-build/staging/usr/share/buildroot/gdbinit -ex 'cd /home/tambewilliam/Documents/buildroot-build/staging/' -ex 'target extended-remote /dev/ttyUSB2' -ex 'set cwd /' -ex 'monitor set debug 1' -ex 'monitor set remote-debug 1' -ex 'set debug remote 1'
> GNU gdb (GDB) 11.0.50.20210718-git
> Copyright (C) 2021 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-pc-linux-gnu --target=pu32-elf".
> 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: File "/home/tambewilliam/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
> To enable execution of this file add
>         add-auto-load-safe-path /home/tambewilliam/.gdbinit
> line to your configuration file "/root/.config/gdb/gdbinit".
> To completely disable this security protection add
>         set auto-load safe-path /
> line to your configuration file "/root/.config/gdb/gdbinit".
> For more information about this security protection see the
> "Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
>         info "(gdb)Auto-loading safe path"
> Working directory /home/tambewilliam/Documents/buildroot-build/staging
>  (canonically /home/tambewilliam/Documents/buildroot-build/host/pu32-buildroot-linux-gnu/sysroot).
> Remote debugging using /dev/ttyUSB2
> Debug output enabled.
> Protocol debug output enabled.
> (gdb) set remote exec-file bin/ls
> (gdb) file bin/ls
> Reading symbols from bin/ls...
> (gdb)
> (gdb) r -l /
> Starting program: /home/tambewilliam/Documents/buildroot-build/host/pu32-buildroot-linux-gnu/sysroot/usr/bin/ls -l /
> [remote] Sending packet: $QDisableRandomization:1#cf
> [remote] Received Ack
> [remote] Packet received: OK
> [remote] Sending packet: $QStartupWithShell:1#43
> [remote] Received Ack
> [remote] Packet received: OK
> [remote] Sending packet: $QEnvironmentReset#e9
> [remote] Received Ack
> [remote] Packet received: OK
> [remote] Sending packet: $QSetWorkingDir:2f#4f
> [remote] Received Ack
> [remote] Packet received: OK
> [remote] Sending packet: $vRun;62696e2f6c73;2d6c;2f#30
> [remote] Received Ack
> [remote] Packet received: T0500:00000000;0e:00000000;0f:00000000;10:00000000;thread:p5b.5b;core:0;
> [remote] packet_ok: Packet vRun (run) is supported
> [remote] Sending packet: $qAttached:5b#60
> [remote] Received Ack
> [remote] Packet received: 0
> [remote] packet_ok: Packet qAttached (query-attached) is supported
> [remote] Sending packet: $qXfer:exec-file:read:5b:0,1000#b0
> [remote] Received Ack
> [remote] Packet received: l/usr/bin/busybox
> [remote] Sending packet: $qOffsets#4b
> [remote] Received Ack
> [remote] Packet received:
> [remote] Sending packet: $Hgp5b.5b#7b
> [remote] Received Ack
> [remote] Packet received: OK
> [remote] Sending packet: $qXfer:features:read:target.xml:0,1000#0c
> [remote] Received Ack
> [remote] Packet received: l<?xml version="1.0"?>\n<!DOCTYPE target SYSTEM "gdb-target.dtd">\n<target>\n  <architecture>pu32</architecture>\n  <osabi>GNU/Linux</osabi>\n  <feature name="org.gnu.gdb.pu32.core">\n    <reg name="sp" bitsize="32" type="uint32" regnum="0"/>\n    <reg name="r1" bitsize="32" type="uint32" regnum="1"/>\n    <reg name="r2" bitsize="32" type="uint32" regnum="2"/>\n    <reg name="r3" bitsize="32" type="uint32" regnum="3"/>\n    <reg name="r4" bitsize="32" type="uint32" regnum="4"/>\n    <reg name="r5" bitsize="32" type="u [705 bytes omitted]
> warning: Target-supplied registers are not supported by the current architecture
> [remote] Sending packet: $g#67
> [remote] Received Ack
> [remote] Packet received: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This appears to be your problem.  See:

  https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#Packets

For a description of the 'g' packet, but the xs here indicate that the
register contents are not avaialble.  For every register.

So GDB is asking for the registers, but the remote is not sending back
any useful information.

Hope this helps narrow down your debugging a little.

Thanks,
Andrew


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

end of thread, other threads:[~2022-03-03 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  6:31 Help figuring out why `info registers` is showing <unavailable> with gdbserver target William Tambe
2022-03-02 16:50 ` Andrew Burgess
2022-03-02 21:02   ` William Tambe
2022-03-03 12:23     ` Andrew Burgess

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