From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/8] x86/emul: Debugging improvements to the test harness
Date: Mon, 5 Dec 2016 10:09:25 +0000 [thread overview]
Message-ID: <1480932571-23547-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1480932571-23547-1-git-send-email-andrew.cooper3@citrix.com>
Disable stdout buffering, so logging gets out even if the harness crashes.
Add a verbose option (compile time disabled) which dumps all read/write calls
the harness makes
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
tools/tests/x86_emulator/test_x86_emulator.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index b54fd11..b5eca86 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -12,6 +12,8 @@
#include "x86_emulate/x86_emulate.h"
#include "blowfish.h"
+#define verbose false /* Switch to true for far more logging. */
+
static const struct {
const void *code;
size_t size;
@@ -47,6 +49,9 @@ static int read(
unsigned int bytes,
struct x86_emulate_ctxt *ctxt)
{
+ if ( verbose )
+ printf("** %s(%u, %p,, %u,)\n", __func__, seg, (void *)offset, bytes);
+
bytes_read += bytes;
memcpy(p_data, (void *)offset, bytes);
return X86EMUL_OKAY;
@@ -59,6 +64,9 @@ static int fetch(
unsigned int bytes,
struct x86_emulate_ctxt *ctxt)
{
+ if ( verbose )
+ printf("** %s(%u, %p,, %u,)\n", __func__, seg, (void *)offset, bytes);
+
memcpy(p_data, (void *)offset, bytes);
return X86EMUL_OKAY;
}
@@ -70,6 +78,9 @@ static int write(
unsigned int bytes,
struct x86_emulate_ctxt *ctxt)
{
+ if ( verbose )
+ printf("** %s(%u, %p,, %u,)\n", __func__, seg, (void *)offset, bytes);
+
memcpy((void *)offset, p_data, bytes);
return X86EMUL_OKAY;
}
@@ -82,6 +93,9 @@ static int cmpxchg(
unsigned int bytes,
struct x86_emulate_ctxt *ctxt)
{
+ if ( verbose )
+ printf("** %s(%u, %p,, %u,)\n", __func__, seg, (void *)offset, bytes);
+
memcpy((void *)offset, new, bytes);
return X86EMUL_OKAY;
}
@@ -233,6 +247,9 @@ int main(int argc, char **argv)
unsigned int bcdres_native, bcdres_emul;
#endif
+ /* Disable output buffering. */
+ setbuf(stdout, NULL);
+
ctxt.regs = ®s;
ctxt.force_writeback = 0;
ctxt.addr_size = 8 * sizeof(void *);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-12-05 10:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 10:09 [PATCH 0/8] Misc further emulation work Andrew Cooper
2016-12-05 10:09 ` [PATCH 1/8] x86/shadow: Drop stale adjustment in the PAE second-half search Andrew Cooper
2016-12-05 10:16 ` Tim Deegan
2016-12-05 13:07 ` Andrew Cooper
2016-12-05 10:09 ` Andrew Cooper [this message]
2016-12-05 12:00 ` [PATCH 2/8] x86/emul: Debugging improvements to the test harness Jan Beulich
2016-12-05 13:08 ` Andrew Cooper
2016-12-05 10:09 ` [PATCH 3/8] x86/hvm: Assert some expectations in hvm_inject_event() Andrew Cooper
2016-12-05 12:01 ` Jan Beulich
2016-12-05 10:09 ` [PATCH 4/8] x86/emul: Drop the last remaining uses of bool_t Andrew Cooper
2016-12-05 12:02 ` Jan Beulich
2016-12-05 10:09 ` [PATCH 5/8] x86/hvm: Don't raise #GP behind the emulators back for MSR accesses Andrew Cooper
2016-12-05 12:10 ` Jan Beulich
2016-12-05 16:29 ` Andrew Cooper
2016-12-05 17:08 ` Jan Beulich
2016-12-06 6:16 ` Tian, Kevin
2016-12-05 10:09 ` [PATCH 6/8] x86/emul: Support speculative MSR reads Andrew Cooper
2016-12-05 13:03 ` Paul Durrant
2016-12-05 13:25 ` Jan Beulich
2016-12-05 10:09 ` [PATCH 7/8] x86/emul: Support CPUID fauilting via a speculative MSR read Andrew Cooper
2016-12-05 13:06 ` Paul Durrant
2016-12-05 13:35 ` Jan Beulich
2016-12-05 10:09 ` [PATCH 8/8] x86/emul: Implement the STAC and CLAC instructions Andrew Cooper
2016-12-05 13:45 ` Jan Beulich
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=1480932571-23547-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.org \
/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).