From: Ian Campbell Subject: Re: [PATCH 22/38] arm: implement vcpu_show_execution_state Date: Wed, 20 Jun 2012 14:53:18 +0100 Message-ID: <1340200398.4906.60.camel@zakaz.uk.xensource.com> References: <1338565113.17466.141.camel@zakaz.uk.xensource.com> <1338565207-2888-1-git-send-email-ian.campbell@citrix.com> <1338565207-2888-22-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2012-06-06 at 18:26 +0100, Stefano Stabellini wrote: > > @@ -334,6 +360,26 @@ void show_execution_state(struct cpu_user_regs *regs) > > show_stack(regs); > > } > > > > +void vcpu_show_execution_state(struct vcpu *v) > > +{ > > + printk("*** Dumping Dom%d vcpu#%d state: ***\n", > > + v->domain->domain_id, v->vcpu_id); > > + > > + if ( v == current ) > > + { > > + show_execution_state(guest_cpu_user_regs()); > > + return; > > + } > > + > > + vcpu_pause(v); /* acceptably dangerous */ > > + > > + vcpu_show_registers(v); > > + if ( !usr_mode(&v->arch.cpu_info->guest_cpu_user_regs) ) > > + show_guest_stack(&v->arch.cpu_info->guest_cpu_user_regs); > > isn't the if condition inverted? I think what I'm trying to do here is only dump the stack if the guest was in one of the privileged modes (i.e. not user mode). I don't really recall why -- I guess I figured the usermode stack was not likely to be all that useful. Unless there's some reason (which I've forgotten) why we can't walk guest userspace stacks, but given that the entirety of the implementation of show_guest_stack() is: static void show_guest_stack(struct cpu_user_regs *regs) { printk("GUEST STACK GOES HERE\n"); } I guess it doesn't really matter ;-) Ian. > > > + vcpu_unpause(v); > > +} > > + > > static void do_unexpected_trap(const char *msg, struct cpu_user_regs *regs) > > { > > printk("Unexpected Trap: %s\n", msg); >