All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Brady <sdbrady@ntlworld.com>
To: Shashidhar Mysore <shashimc@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: PC traces from QEMU
Date: Fri, 30 Mar 2007 12:10:16 +0100	[thread overview]
Message-ID: <20070330111016.GA8305@miranda.arrow> (raw)
In-Reply-To: <12835c8f0703291828y31e5b962i7a52527b8db63a98@mail.gmail.com>

On Thu, Mar 29, 2007 at 06:28:14PM -0700, Shashidhar Mysore wrote:
> Hi Stuart,
> 
> Thanks for the reply, but since I'm a little new to qemu, can you please
> elaborate on how to insert the op_dump_pc function to extract the PC values?

Well, here's a patch that does it:

Index: target-i386/exec.h
===================================================================
RCS file: /sources/qemu/qemu/target-i386/exec.h,v
retrieving revision 1.31
diff -u -r1.31 exec.h
--- target-i386/exec.h	24 Sep 2006 18:40:46 -0000	1.31
+++ target-i386/exec.h	30 Mar 2007 11:02:08 -0000
@@ -146,6 +146,8 @@
 
 extern CCTable cc_table[];
 
+void helper_dump_pc(target_ulong PC);
+
 void load_seg(int seg_reg, int selector);
 void helper_ljmp_protected_T0_T1(int next_eip);
 void helper_lcall_real_T0_T1(int shift, int next_eip);
Index: target-i386/helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/helper.c,v
retrieving revision 1.74
diff -u -r1.74 helper.c
--- target-i386/helper.c	1 Feb 2007 22:12:19 -0000	1.74
+++ target-i386/helper.c	30 Mar 2007 11:02:09 -0000
@@ -30,6 +30,16 @@
 } while (0)
 #endif
 
+void helper_dump_pc(target_ulong pc)
+{
+    if (logfile)
+#ifdef TARGET_X86_64
+        fprintf(logfile, "PC = %016" PRIx64 "\n", pc);
+#else
+        fprintf(logfile, "PC = %08x\n", pc);
+#endif
+}
+
 const uint8_t parity_table[256] = {
     CC_P, 0, 0, CC_P, 0, CC_P, CC_P, 0,
     0, CC_P, CC_P, 0, CC_P, 0, 0, CC_P,
Index: target-i386/op.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/op.c,v
retrieving revision 1.47
diff -u -r1.47 op.c
--- target-i386/op.c	1 Feb 2007 22:11:07 -0000	1.47
+++ target-i386/op.c	30 Mar 2007 11:02:09 -0000
@@ -132,6 +132,11 @@
 
 #endif
 
+void OPPROTO op_dump_pc(void)
+{
+    helper_dump_pc(PARAM1);
+}
+
 /* operations with flags */
 
 /* update flags with T0 and T1 (add/sub case) */
Index: target-i386/translate.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/translate.c,v
retrieving revision 1.62
diff -u -r1.62 translate.c
--- target-i386/translate.c	16 Jan 2007 19:28:58 -0000	1.62
+++ target-i386/translate.c	30 Mar 2007 11:02:10 -0000
@@ -3155,6 +3155,7 @@
     int rex_w, rex_r;
 
     s->pc = pc_start;
+    gen_op_dump_pc(s->pc);
     prefixes = 0;
     aflag = s->code32;
     dflag = s->code32;

It's probably not the best way to do this, but it worked well enough for
my purposes.  (target-z80 -- where there is only one address space! :-)
-- 
Stuart Brady

  reply	other threads:[~2007-03-30 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 20:13 [Qemu-devel] PC traces from QEMU Shashidhar Mysore
2007-03-29 17:29 ` [Qemu-devel] " Antti P Miettinen
2007-03-29 20:37   ` Stuart Brady
2007-03-29 21:42     ` andrzej zaborowski
2007-03-30  1:28     ` Shashidhar Mysore
2007-03-30 11:10       ` Stuart Brady [this message]
2007-04-02 22:32         ` Shashidhar Mysore
2007-04-02 23:17           ` Thiemo Seufer
2007-03-30  1:25   ` Shashidhar Mysore

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=20070330111016.GA8305@miranda.arrow \
    --to=sdbrady@ntlworld.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shashimc@gmail.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.