qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)


From: Libo Zhou
Subject: Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
Date: Wed, 11 Sep 2019 16:48:45 +0800

Reverting the commit solved my problem, although I don't know why it needed to 
be fixed to 64-bit back then. Finally I can now  single step a cross-compiled 
MIPS program on a QEMU Linux user binary and observe the register and memory 
contents.



------------------ Original ------------------
From:  "Aleksandar Markovic";<address@hidden>;
Send time: Wednesday, Sep 11, 2019 1:50 AM
To: "Libo Zhou"<address@hidden>; 
Cc: "Alex Bennée"<address@hidden>; "qemu-devel"<address@hidden>; 
Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)



10.09.2019. 19.26, address@hidden ?е написао/ла:
>
>
> 10.09.2019. 11.57, "Libo Zhou" <address@hidden> ?е написао/ла:
> >
> > 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.
> >
> > 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?
> >
>
> This is a known bug, actually in gdb, but there is a workaround is to
rollback a commit made  around a year ago in QEMU, about 64-bit FPU Mips
registers.

More previsely, reverting
https://github.com/qemu/qemu/commit/8e0b373f8aa4b9feec7b44029455587e2e3d2b0f
would most likely rrmove your problem.

Aleksandar

> Or you can fix the buffer size in gdb.
>
> Aleksandar
>
> > Cheers,
> > Libo
> >
> >
> > ------------------ Original ------------------
> > From:  "Alex Bennée";<address@hidden>;
> > Send time: Friday, Sep 6, 2019 5:19 PM
> > To: "Libo Zhou"<address@hidden>;
> > Cc: "qemu-devel"<address@hidden>; "Aleksandar Markovic"<
address@hidden>;
> > Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
> >
> >
> > Libo Zhou <address@hidden> 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";<address@hidden>;
> > > Send time: Thursday, Sep 5, 2019 8:58 PM
> > > To: "qemu-devel"<address@hidden>;
> > > Cc: "Aleksandar Markovic"<address@hidden>;
> > > Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
> > >
> > >
> > >
> > >
> > > Libo Zhou <address@hidden> 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";<address@hidden>;
> > >> Send time: Thursday, Sep 5, 2019 6:54 PM
> > >> To: "Libo Zhou"<address@hidden>;
> > >> Cc: "qemu-devel"<address@hidden>;
> > >> Subject:  Re: [Qemu-devel] QEMU as ISS (Instruction Set Simulator)
> > >>
> > >>
> > >>
> > >> 04.09.2019. 05.23, "Libo Zhou" <address@hidden> ?е написао/ла:
> > >>>
> > >>> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]