mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
bitkeeper revision 1.1189 (420d52d34bmxozCOzbUs5pmo2zfT-w)
Subject: [PATCH] xenctx.patch
Does this sound interesting? I found it useful to debug looping guests.
A gdb stub would be nicer - but this one is lighter weight.
-Arun
Tool for dumping the cpu context
# xenctx 1 0
eip: c01dfeab esp: c1603c98
eax: 00000020 ebx: c0432e10 ecx: 00000ee6 edx: 000001f7
esi: c0432d60 edi: 00000296 ebp: c0432d60
cs: 00000060 ds: 00000068 fs: 00000000 gs: 00000033
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Signed-off-by: ian@xensource.com
This commit is contained in:
1 parent
a9170d6352
commit
ec12127c4e
3 files changed
+91
No files matched your search
@@ -846,6 +846,7 @@
|
||||
41d58ba6ijEF6fedqRO5vFu7uCirZg tools/xcs/xcsdump.c
|
||||
403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
|
||||
40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats
|
||||
420d52d2_znVbT4JAPIU36vQOme83g tools/xentrace/xenctx.c
|
||||
4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
|
||||
403a3edbVpV2E_wq1zeEkJ_n4Uu2eg tools/xentrace/xentrace.c
|
||||
403a3edblCUrzSj0mmKhO5HOPrOrSQ tools/xentrace/xentrace_format
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/******************************************************************************
|
||||
* tools/xentrace/xenctx.c
|
||||
*
|
||||
* Tool for dumping the cpu context
|
||||
*
|
||||
* Copyright (C) 2005 by Intel Corp
|
||||
*
|
||||
* Author: Arun Sharma <arun.sharma@intel.com>
|
||||
* Date: February 2005
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <argp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "xc.h"
|
||||
|
||||
#ifdef __i386__
|
||||
void
|
||||
print_ctx(full_execution_context_t *ctx1)
|
||||
{
|
||||
execution_context_t *ctx = &ctx1->cpu_ctxt;
|
||||
|
||||
printf("eip: %08lx\t", ctx->eip);
|
||||
printf("esp: %08lx\n", ctx->esp);
|
||||
|
||||
printf("eax: %08lx\t", ctx->eax);
|
||||
printf("ebx: %08lx\t", ctx->ebx);
|
||||
printf("ecx: %08lx\t", ctx->ecx);
|
||||
printf("edx: %08lx\n", ctx->edx);
|
||||
|
||||
printf("esi: %08lx\t", ctx->esi);
|
||||
printf("edi: %08lx\t", ctx->edi);
|
||||
printf("ebp: %08lx\n", ctx->ebp);
|
||||
|
||||
printf(" cs: %08lx\t", ctx->cs);
|
||||
printf(" ds: %08lx\t", ctx->ds);
|
||||
printf(" fs: %08lx\t", ctx->fs);
|
||||
printf(" gs: %08lx\n", ctx->gs);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void dump_ctx(u32 domid, u32 vcpu)
|
||||
{
|
||||
int ret;
|
||||
xc_domaininfo_t info;
|
||||
full_execution_context_t ctx;
|
||||
|
||||
int xc_handle = xc_interface_open(); /* for accessing control interface */
|
||||
|
||||
ret = xc_domain_getfullinfo(xc_handle, domid, vcpu, &info, &ctx);
|
||||
if (ret != 0) {
|
||||
perror("xc_domain_getfullinfo");
|
||||
exit(-1);
|
||||
}
|
||||
print_ctx(&ctx);
|
||||
xc_interface_close(xc_handle);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int vcpu = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("usage: xenctx <domid> <optional vcpu>\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (argc == 3)
|
||||
vcpu = atoi(argv[2]);
|
||||
|
||||
dump_ctx(atoi(argv[1]), vcpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -348,11 +348,17 @@ void arch_getdomaininfo_ctxt(
|
||||
struct exec_domain *ed, full_execution_context_t *c)
|
||||
{
|
||||
int i;
|
||||
unsigned long vmx_domain = ed->arch.arch_vmx.flags;
|
||||
extern void save_vmx_execution_context(execution_context_t *);
|
||||
|
||||
c->flags = 0;
|
||||
memcpy(&c->cpu_ctxt,
|
||||
&ed->arch.user_ctxt,
|
||||
sizeof(ed->arch.user_ctxt));
|
||||
|
||||
if (vmx_domain)
|
||||
save_vmx_execution_context(&c->cpu_ctxt);
|
||||
|
||||
if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) )
|
||||
c->flags |= ECF_I387_VALID;
|
||||
if ( KERNEL_MODE(ed, &ed->arch.user_ctxt) )
|
||||
|
||||