From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FOaut-0006qH-V7 for qemu-devel@nongnu.org; Wed, 29 Mar 2006 08:40:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FOauo-0006hd-Qv for qemu-devel@nongnu.org; Wed, 29 Mar 2006 08:40:55 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FOauo-0006hP-N0 for qemu-devel@nongnu.org; Wed, 29 Mar 2006 08:40:50 -0500 Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FOawl-0006yF-MK for qemu-devel@nongnu.org; Wed, 29 Mar 2006 08:42:51 -0500 Received: from [64.233.184.235] (helo=wproxy.gmail.com) by mx20.gnu.org with esmtp (Exim 4.52) id 1FOauj-0001CJ-PN for qemu-devel@nongnu.org; Wed, 29 Mar 2006 08:40:45 -0500 Received: by wproxy.gmail.com with SMTP id i3so457210wra for ; Wed, 29 Mar 2006 05:40:33 -0800 (PST) Message-ID: <442A8E53.1030503@gmail.com> Date: Wed, 29 Mar 2006 15:40:35 +0200 MIME-Version: 1.0 References: <4428267D.6030707@gmail.com> <442A408B.90702@gmail.com> In-Reply-To: <442A408B.90702@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Dirk Behme Subject: [Qemu-devel] Re: Single stepping MIPS in GDB Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, answering to myself again ;) Now, I found where the PC is wrongly set to 0x0: In translate-all.c, end of function cpu_restore_state() (lines with '+' are debug output added): #elif defined(TARGET_MIPS) + printf("PC before: 0x%08x, j: %d, OPC_BUF_SIZE: %d\n", env->PC, j, OPC_BUF_SIZE); + for(c = 0; c < OPC_BUF_SIZE; c++) + printf("OPC %03d: 0x%08x\n", c, gen_opc_pc[c]); env->PC = gen_opc_pc[j]; + printf("PC after: 0x%08x\n", env->PC); env->hflags &= ~MIPS_HFLAG_BMASK; env->hflags |= gen_opc_hflags[j]; #endif results in the following output (0x80010400 is the correct one): PC before: 0x80010400, j: -8185, OPC_BUF_SIZE: 512 OPC 000: 0x00000000 OPC 001: 0x00000000 ... OPC 510: 0x00000000 OPC 511: 0x00000000 PC after: 0x00000000 If I temporarily delete the line "env->PC = gen_opc_pc[j];" single stepping seems to work. Seems that gen_opc_pc is all 0, and j looks strange. But I don't know whats wrong here? ;( Best regards Dirk Dirk Behme wrote: >> I try to debug some low level system init code on MIPS >> as well. For this, I use qemu-snapshot-2006-03-21_23 because this >> already includes little endian MIPS (--target-list=mipsel-softmmu). I >> can load my program to MIPS default start address 0x80010000, use >> mipsel-linux-gdb to attach to it and load symbols. Start address is >> set correctly. But seems that I have trouble single stepping (si). I >> would assume that with first si system should jump to 0x80010400 >> (please find some debug output below). Instead, PC is set to 0x0. >> *1* Debug output for single step at startup. PC is set to 0x0 instead >> to next command at 0x80010400 >> >> _start () >> at uboot/u-boot-1.1.4/cpu/mips/start.S:43 >> 43 RVECENT(reset,0) /* U-boot entry point */ >> (gdb) p/x $pc >> $1 = 0x80010000 >> (gdb) x/2i $pc >> 0x80010000 <_start>: b 0x80010400 >> 0x80010004 <_start+4>: nop >> (gdb) si >> 0x00000000 in ?? () >> (gdb) p/x $pc >> $2 = 0x0 >> (gdb)