qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: casmac <1482995675@qq.com>
To: "Taylor Simpson" <tsimpson@quicinc.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re:RE: GDB get wrong debug infos on TI DSP architecture extension
Date: Fri, 29 May 2020 15:27:36 +0800	[thread overview]
Message-ID: <tencent_1836AC05D30788B7689AE834829AE0AD4F05@qq.com> (raw)
In-Reply-To: <BYAPR02MB4886DAC33FB41B53887E029DDEB10@BYAPR02MB4886.namprd02.prod.outlook.com>

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

Hi,&nbsp;
&nbsp; &nbsp;Thanks for the hints!! I put "-d trace:gdbstub_io_command,trace:gdbstub_io_reply" to command line, get the following from QEMU at the beginning when gdb starts, is there anything went wrong?


6792@1590734139.390330:gdbstub_io_command Received: qSupported:xmlRegisters=tivc33;QNonStop;qRelocInsn+
6792@1590734139.391330:gdbstub_io_reply Sent: PacketSize=1000;qXfer:features:read+;multiprocess+
6792@1590734139.391330:gdbstub_io_command Received: Hg0
6792@1590734139.392331:gdbstub_io_reply Sent: OK
6792@1590734139.392331:gdbstub_io_command Received: qXfer:features:read:target.xml:0,ffb
6792@1590734139.393331:gdbstub_io_command Received: qXfer:features:read:dsp-vc33-core.xml:0,ffb
6792@1590734139.399331:gdbstub_io_command Received: ?
6792@1590734139.399331:gdbstub_io_reply Sent: T05thread:01;
6792@1590734139.401331:gdbstub_io_command Received: Hc-1

&nbsp;6792@1590734139.402331:gdbstub_io_command Received: qC
6792@1590734139.402331:gdbstub_io_reply Sent: QC01
6792@1590734139.402331:gdbstub_io_command Received: qAttached
6792@1590734139.403331:gdbstub_io_reply Sent: 1
6792@1590734139.403331:gdbstub_io_command Received: qOffsets
....


&nbsp;It looks like the .xml file is working , the "info reg" command returns the registers defined for TI DSP processor:
(szdb) info reg
r0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0xc000000000&nbsp; &nbsp; &nbsp;-274877906944
r1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
r2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x2200000000&nbsp; &nbsp; &nbsp;146028888064
r3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
r4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
r5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x4100000000&nbsp; &nbsp; &nbsp;279172874240
r6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
r7&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x6800000000&nbsp; &nbsp; &nbsp;446676598784
ar0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ar7&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
dp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
ir0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
ir1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
bk&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
sp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
st&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x54&nbsp; &nbsp; &nbsp;84
ie&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
if&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
iof&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0
rs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
re&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
rc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0&nbsp; &nbsp; &nbsp; 0
pc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0xf&nbsp; &nbsp; &nbsp; 15
clk&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x0&nbsp; &nbsp; &nbsp; 0&nbsp;&nbsp;


&nbsp; &nbsp; But GDB still complains&nbsp; "warning: Target-supplied registers are not supported by the current architecture" and an unkown symbol:&nbsp;
atexit (
&nbsp; &nbsp; fun=<error reading variable: Unknown argument list address for `fun'.&gt;)
&nbsp; &nbsp; at exit.c:44
44&nbsp; &nbsp; &nbsp; exit.c: No such file or directory.
&nbsp; &nbsp; &nbsp;Another problem is that DSP processor addresses memory by word(4 bytes), the starting entry address from the executable is 0xF, which will fail the 4-byte alignment assertion, so the instruction retrieved does not look right. We are going to fix it.
&nbsp; &nbsp;thanks .
xiaolei&nbsp;
------------------&nbsp;Origina,l&nbsp;------------------
From:&nbsp;"Taylor Simpson"<tsimpson@quicinc.com&gt;;
Date:&nbsp;Thu, May 28, 2020 05:41 AM
To:&nbsp;"Philippe Mathieu-Daud "<f4bug@amsat.org&gt;;"casmac"<1482995675@qq.com&gt;;"qemu-devel"<qemu-devel@nongnu.org&gt;;
Cc:&nbsp;"Alex Benn e"<alex.bennee@linaro.org&gt;;"Luc Michel"<luc.michel@greensocs.com&gt;;
Subject:&nbsp;RE: GDB get wrong debug infos on TI DSP architecture extension



For Hexagon, we have LLDB, not GDB.&nbsp; I tinkered with getting LLDB to talk to qemu but never got if fully functional.&nbsp; I'm planning to get back to it at some point.

With that caveat, I'll try to answer Xiaolei's questions
- The xml file is returned from qemu to gdb in response to the Xfer:features:read command.&nbsp; Providing it should be optional unless your debugger requires the target to support that command.&nbsp; If the target doesn't support this command, the debugger will generally use the qRegisterInfo command.
- I don't think get_phys_page_debug is used for gdb debugging.&nbsp; Which mode are you implementing?&nbsp; In linux-user mode, it's not needed.&nbsp; In softmmu mode, it is used when you use "-d in_asm" to find the memory to disassemble.&nbsp; If you have an MMU, you need to map the virtual address passed in to the physical address or return -1 if there is no mapping.&nbsp; If there isn't a MMU, return the virtual address.
- The error you are getting from gdb sounds like a mismatch between the version of the processor that qemu is emulating and gdb thinks it is debugging.&nbsp; In other words, qemu thinks there is a register that gdb know about.&nbsp; To see what's going on, try adding "-d trace:gdbstub_io_command,trace:gdbstub_io_reply" to your qemu command line.&nbsp; This will show you the commands from gdb and qemu's response.&nbsp; Look for the commands I described above and see if qemu is giving a register that doesn't exist.

HTH,
Taylor


&gt; -----Original Message-----
&gt; From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com&gt; On
&gt; Behalf Of Philippe Mathieu-Daudé
&gt; Sent: Wednesday, May 27, 2020 2:20 AM
&gt; To: casmac <1482995675@qq.com&gt;; qemu-devel <qemu-
&gt; devel@nongnu.org&gt;
&gt; Cc: Luc Michel <luc.michel@greensocs.com&gt;; Alex Bennée
&gt; <alex.bennee@linaro.org&gt;; Taylor Simpson <tsimpson@quicinc.com&gt;
&gt; Subject: Re: GDB get wrong debug infos on TI DSP architecture extension
&gt;
&gt;
&gt; Hi Xiaolei,
&gt;
&gt; Cc'ing more developers who might answer you.
&gt;
&gt; On 5/27/20 8:48 AM, casmac wrote:
&gt; &gt; Hi all,
&gt; &gt;&nbsp;&nbsp;&nbsp; I am working on a TI DSP architecture extension for QEMU.
&gt;
&gt; FYI you can find the TI TMS320C6x target implemented here:
&gt; https://github.com/philmd/qemu/releases/tag/target-c6x-2.4
&gt;
&gt; I started rebasing it to QEMU 4.2 but then got distracted.
&gt;
&gt; &gt; Now, we are
&gt; &gt; adding GDB debugging features.
&gt; &gt;&nbsp;&nbsp;&nbsp; We have done the following, but not sure we are on the right track :
&gt; &gt;&nbsp;&nbsp;&nbsp; - add a xml description file in gdb-xml, without understanding the
&gt; &gt; purpose of the file, why some architectures don't provide such xml file?
&gt; &gt;&nbsp;&nbsp;&nbsp; - add ***_cpu_gdb_read_register(), ***_cpu_gdb_write_register();
&gt; &gt;&nbsp;&nbsp;&nbsp; - added&nbsp; dsp_cpu_get_phys_page_attrs_debug(), but uncertain about
&gt; &gt; what to return
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dsp_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr,
&gt; &gt; MemTxAttrs *attrs)
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return addr &amp; TARGET_PAGE_MASK;
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; We run QEMU with the these arguments
&gt; &gt;&nbsp;&nbsp;&nbsp; qemu-system-dsp ... -kernel filename.out -S -s
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; It turns out that gdb reads incorrect register values, and complains
&gt; &gt; : "warning: Target-supplied registers are not supported by the current
&gt; &gt; architecture".
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; Something is missing here, or we do it in a wrong way.&nbsp; Any advise
&gt; &gt; would be helpful to us.
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; Thanks.
&gt; &gt;
&gt; &gt; xiaolei
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; ----- ti_dsp.xml&nbsp; -----
&gt; &gt;
&gt; &gt;&nbsp;&nbsp;&nbsp; <?xml version="1.0"?&gt;
&gt; &gt; <!DOCTYPE feature SYSTEM "gdb-target.dtd"&gt;
&gt; &gt; <feature name="org.gnu.gdb.tic3x.core"&gt;
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; <reg name="r0"&nbsp; bitsize="32"&gt;</reg&gt;
&gt; &gt;&nbsp; <reg name="r1"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="r2"&nbsp; bitsize="32"&gt;</reg&gt;
&gt; &gt;&nbsp; <reg name="r3"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="r4"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="r5"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="r6"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="r7"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar0" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar1" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar2" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar3" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar4" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar5" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar6" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ar7" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="dp"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ir0" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="ir1" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="bk"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="sp"&nbsp; bitsize="32" type="data_ptr"/&gt;
&gt; &gt;&nbsp; <reg name="st"&nbsp; bitsize="32"&gt;</reg&gt;
&gt; &gt;&nbsp; <reg name="ie"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="if"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="iof" bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="rs"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="re"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="rc"&nbsp; bitsize="32"/&gt;
&gt; &gt;&nbsp; <reg name="pc"&nbsp; bitsize="32" type="data_ptr"/&gt;
&gt; &gt;&nbsp; <reg name="clk"&nbsp; bitsize="32"/&gt;
&gt; &gt; </feature&gt;
&gt; &gt;
&gt;

[-- Attachment #2: Type: text/html, Size: 11940 bytes --]

  reply	other threads:[~2020-05-29  7:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27  6:48 GDB get wrong debug infos on TI DSP architecture extension casmac
2020-05-27  7:19 ` Philippe Mathieu-Daudé
2020-05-27 21:41   ` Taylor Simpson
2020-05-29  7:27     ` casmac [this message]
2020-05-29 15:19       ` Taylor Simpson
2020-05-28  1:16   ` casmac
2020-05-28  8:34     ` Alex Bennée
2020-05-28  9:49       ` =?gb18030?B?u9i4tKO6IEdEQiBnZXQgd3JvbmcgZGVidWcgaW5mb3Mgb24gVEkgRFNQIGFyY2hpdGVjdHVyZSBleHRlbnNpb24=?= =?gb18030?B?eGlhb2xlaQ==?=
2020-05-27  9:11 ` GDB get wrong debug infos on TI DSP architecture extension Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_1836AC05D30788B7689AE834829AE0AD4F05@qq.com \
    --to=1482995675@qq.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tsimpson@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).