All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Libo Zhou <zhlb29@foxmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Subject: Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
Date: Tue, 10 Sep 2019 13:10:51 +0100	[thread overview]
Message-ID: <87k1ag1hdg.fsf@linaro.org> (raw)
In-Reply-To: <tencent_479D109A5BEC536D64AE43BF@qq.com>


Libo Zhou <zhlb29@foxmail.com> writes:

> Hi Alex,
>
>
> gdb says remote 'g' packet reply is too long, and then prints out a
> long string of zeros and some other digits sparsely.

Sounds like your gdb isn't multiarch aware. Debian/Ubuntu have multiarch
binutils which are aware of more than just the host architecture.

>
>
> I have tried a lot of combinations of flags but I just can't get it running properly. Do you know what is causing this error?
>
>
> Cheers,
>
> Libo
>
>
>
>
>
> ------------------ Original ------------------
> From:  "Alex Bennée";<alex.bennee@linaro.org>;
> Send time: Friday, Sep 6, 2019 5:19 PM
> To: "Libo Zhou"<zhlb29@foxmail.com>;
> Cc: "qemu-devel"<qemu-devel@nongnu.org>; "Aleksandar Markovic"<aleksandar.m.mail@gmail.com>;
> Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
>
>
>
>
> Libo Zhou <zhlb29@foxmail.com> writes:
>
>> Hi Alex,
>>
>>
>> I just need to log the registers and memory after the program finishes
>> its execution. Is it possible to add this functionality myself?
>
> You'll need to set some sort of breakpoint on the last instruction so
> gdb can inspect things before the program is unloaded. I think it's
> possible to wire poweroff events to the gdbstub but I haven't looked
> into that myself.
>
>> As for the GDB option, can you tell me the specific steps to do that? I've tried it myself but I had no luck getting it running due to me being new to all this.
>>
>
> For linux-user:
>
>   $QEMU -g 1234 $PRG
>
> for system emulation
>
>   $QEMU -s -S
>
> and then on the gdb end:
>
>   gdb $BIN -ex "target remote localhost:1234"
>
> and then you can operate as you normally do with a gdb session. GDB has
> two scripting interfaces. The command mode is basically a list of gdb
> commands but might work for what you want. If you want to be a bit more
> programatic you can use python. See the example in
> tests/guest-debug/test-gdbstub.py
>
>>
>> Thanks,
>> Libo
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "Alex Bennée";<alex.bennee@linaro.org>;
>> Send time: Thursday, Sep 5, 2019 8:58 PM
>> To: "qemu-devel"<qemu-devel@nongnu.org>;
>> Cc: "Aleksandar Markovic"<aleksandar.m.mail@gmail.com>;
>> Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
>>
>>
>>
>>
>> Libo Zhou <zhlb29@foxmail.com> writes:
>>
>>> Do you know where in the source file I should look into to add my custom logging functionality?
>>>
>>>
>>> Or, would you suggest using gdb to look at my target register and memory contents? The answer in this link below looks really promising. I'm gonna give it a try first.
>>>
>>> https://stackoverflow.com/questions/39503997/how-to-run-a-single-line-of-assembly-then-see-r1-and-condition-flags
>>
>> The gdbstub should allow you do full introspection and adding
>> additional registers is fairly easy, see FOO_gdb_[set|get]_reg helpers
>> in the appropriate target/FOO directories.
>>
>>> However, if I am able to customize log, it will be super convenient.
>>
>> So you want something above what -d cpu will show you?
>>
>>>
>>>
>>>
>>> Cheers,
>>>
>>> Libo
>>>
>>>
>>>
>>> ------------------ Original ------------------
>>> From:  "Aleksandar Markovic";<aleksandar.m.mail@gmail.com>;
>>> Send time: Thursday, Sep 5, 2019 6:54 PM
>>> To: "Libo Zhou"<zhlb29@foxmail.com>;
>>> Cc: "qemu-devel"<qemu-devel@nongnu.org>;
>>> Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
>>>
>>>
>>>
>>> 04.09.2019. 05.23, "Libo Zhou" <zhlb29@foxmail.com> ?е написао/ла:
>>>>
>>>> Hi Aleksandar,
>>>>
>>>> I have spent some time looking at your MXU ASE patch. It's super helpful.
>>> I need to do exactly the same thing as you did.
>>>>
>>>> Now I just need a way to observe the memory and register file contents to
>>> debug my instruction set simulator. I played with the "-d" switch to log a
>>> bunch of information, but it seems that none of the items is of my
>>> interest. The "-d cpu_reset" option displays all zeros in the GPR log.
>>>>
>>>
>>> It looks you need a custom logging tailored to your needs, based on
>>> intercepting the instructions you added.
>>>
>>> Aleksandar
>>>
>>>> Please take your time, as I fully understand you need to work on Qemu
>>> while answering all my questions. Again, thank you very much for your help!
>>>>
>>>> Cheers,
>>>> Libo
>>>>


--
Alex Bennée


  parent reply	other threads:[~2019-09-10 12:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  3:23 [Qemu-devel] QEMU as ISS (Instruction Set Simulator) Libo Zhou
2019-09-05 10:54 ` Aleksandar Markovic
2019-09-05 11:57   ` Libo Zhou
2019-09-05 12:58     ` Alex Bennée
     [not found]       ` <tencent_541F04AB1A100DF25C334D8C@qq.com>
2019-09-06  9:19         ` Alex Bennée
     [not found]           ` <tencent_479D109A5BEC536D64AE43BF@qq.com>
2019-09-10 12:10             ` Alex Bennée [this message]
2019-09-10 17:27             ` Aleksandar Markovic
2019-09-10 17:50               ` Aleksandar Markovic
2019-09-11  8:48                 ` Libo Zhou
2019-09-11 13:09                 ` Aleksandar Markovic
2019-09-12 10:28       ` Libo Zhou
2019-09-12 11:41         ` Alex Bennée
2019-09-18  4:08           ` Libo Zhou
  -- strict thread matches above, loose matches on Subject: below --
2019-08-30  9:14 =?gb18030?B?TGlibyBaaG91?=
2019-09-03  7:07 ` Aleksandar Markovic
2019-08-20 10:11 =?gb18030?B?waI=?=
2019-08-20 10:20 ` Peter Maydell
2019-08-20 10:42 ` Aleksandar Markovic
2019-08-22  8:23 ` Aleksandar Markovic
2019-08-22 10:24   ` =?gb18030?B?waI=?=
2019-08-22 10:53     ` Aleksandar Markovic
2019-08-28  3:54       ` =?gb18030?B?TGlibyBaaG91?=
2019-08-29 14:22         ` Aleksandar Markovic

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=87k1ag1hdg.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=aleksandar.m.mail@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhlb29@foxmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.