qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] API for single stepping an emulated CPU
@ 2012-05-02  8:32 Wacha Gábor
  2012-05-02  8:52 ` 陳韋任
  0 siblings, 1 reply; 3+ messages in thread
From: Wacha Gábor @ 2012-05-02  8:32 UTC (permalink / raw)
  To: qemu-devel

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

Dear developers,

I am designing a virtual peripheral for Qemu, for which I need to single
step through the program on the emulated CPU (my peripheral will be some
kind of a debugger). My question is: is there an API to execute exactly one
instruction in Qemu? I've already found the *_pause and *_resume functions,
but they are - as far as I know - not applicable for my task.

Regards,
Gabor Wacha
EE student at Budapest University of Technology an Economics

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

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

* Re: [Qemu-devel] API for single stepping an emulated CPU
  2012-05-02  8:32 [Qemu-devel] API for single stepping an emulated CPU Wacha Gábor
@ 2012-05-02  8:52 ` 陳韋任
  2012-05-04  5:46   ` Wacha Gábor
  0 siblings, 1 reply; 3+ messages in thread
From: 陳韋任 @ 2012-05-02  8:52 UTC (permalink / raw)
  To: Wacha G墎or; +Cc: qemu-devel

> I am designing a virtual peripheral for Qemu, for which I need to single step
> through the program on the emulated CPU (my peripheral will be some kind of a
> debugger). My question is: is there an API to execute exactly one instruction
> in Qemu? I've already found the *_pause and *_resume functions, but they are -
> as far as I know - not applicable for my task.

  Just a quick reply. QEMU system mode provides "-singlestep" option. Maybe you
can start from there, see how the singlestep is done.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

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

* Re: [Qemu-devel] API for single stepping an emulated CPU
  2012-05-02  8:52 ` 陳韋任
@ 2012-05-04  5:46   ` Wacha Gábor
  0 siblings, 0 replies; 3+ messages in thread
From: Wacha Gábor @ 2012-05-04  5:46 UTC (permalink / raw)
  To: 陳韋任; +Cc: qemu-devel

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

Yes, it seemed to be a good choice to look into, thank you.

But my problem is:
As I've seen, the single step mode generates a debug exception (EXCL_DEBUG)
after every iteration of the main loop, which will make a change in the vm
state.
I can register a vm change state handler in my peripheral and wait until my
external debugger hardware enables the program continuation.
I did exactly this (like the gdb stub), but without success. It seems that
my state change handler is never called.
It is registered in the init function of the peripheral. For now it should
only print out a debug message. When I run qemu-system-arm with the
-single-step option I can not see that particular debug message on the
console (but my other messages are there), so I think my function is not
called.

Am I missing something?

And I have another question: if I call a blocking function in the state
change handler, will it block the CPU (as it seems logical to me) or it is
in another thread?

Regards,
Gabor
 2012/5/2 陳韋任 <chenwj@iis.sinica.edu.tw>

> > I am designing a virtual peripheral for Qemu, for which I need to single
> step
> > through the program on the emulated CPU (my peripheral will be some kind
> of a
> > debugger). My question is: is there an API to execute exactly one
> instruction
> > in Qemu? I've already found the *_pause and *_resume functions, but they
> are -
> > as far as I know - not applicable for my task.
>
>   Just a quick reply. QEMU system mode provides "-singlestep" option.
> Maybe you
> can start from there, see how the singlestep is done.
>
> Regards,
> chenwj
>
> --
> Wei-Ren Chen (陳韋任)
> Computer Systems Lab, Institute of Information Science,
> Academia Sinica, Taiwan (R.O.C.)
> Tel:886-2-2788-3799 #1667
> Homepage: http://people.cs.nctu.edu.tw/~chenwj
>

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

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

end of thread, other threads:[~2012-05-04  5:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02  8:32 [Qemu-devel] API for single stepping an emulated CPU Wacha Gábor
2012-05-02  8:52 ` 陳韋任
2012-05-04  5:46   ` Wacha Gábor

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