[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/8] x86/emul: Debugging improvements to the test harness
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@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- 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@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |