From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUgar-0002Fk-6K for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUgal-0003o4-11 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:05:57 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:38543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUgak-0003nv-OY for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:05:50 -0400 Received: by mail-lb0-f180.google.com with SMTP id 10so5925616lbg.25 for ; Mon, 31 Mar 2014 11:05:49 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Mon, 31 Mar 2014 19:05:29 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] When are register values committed to CPUARMState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gaurav Sharma Cc: QEMU-DEVEL On 31 March 2014 18:59, Gaurav Sharma wrote: > I am trying to build a register trace for ARM target. > I am trying to just log the register values, for that I added TCG ops to > generate a helper function that dumps the register values in CPUARMState. > This helper function i have called at the end of disas_arm_state function, > so that if enabled i get a trace for each instruction. > However, the register values that are dumped do not seem to be correct, it > always the register at the 0th index that seems to have any value, even > though the disassembly indicates otherwise. > I want to know, when are the register values committed to CPUARMState > structure ? When they need to be. Mostly we keep register values in TCG globals, which means they're held in host registers except when calling helpers which might read or write globals, or for doing guest memory accesses, or at branches. Thumb condexec bits (in the CPSR) are only written back at the point where we leave a translation block. The PC is a special case which we don't update very often at all. > Is there any way , i could find out the register values that > have changed for any instruction ? Not conveniently. We optimise for speed of execution, not for transparency of what is happening to the guest CPU. (It can be done, and people have done it, but none of this support is upstream, because it's usually a lot of local and special-purpose hacks.) You might consider just connecting to the gdbstub and singlestepping the CPU and using the gdbstub protocol to read register values. thanks -- PMM