qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@googlemail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: Single stepping MIPS in GDB
Date: Wed, 29 Mar 2006 15:40:35 +0200	[thread overview]
Message-ID: <442A8E53.1030503@gmail.com> (raw)
In-Reply-To: <442A408B.90702@gmail.com>

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 <reset>
>> 0x80010004 <_start+4>:  nop
>> (gdb) si
>> 0x00000000 in ?? ()
>> (gdb) p/x $pc
>> $2 = 0x0
>> (gdb)

      reply	other threads:[~2006-03-29 13:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-27 17:53 [Qemu-devel] Single stepping MIPS in GDB Dirk Behme
2006-03-29  8:08 ` [Qemu-devel] " Dirk Behme
2006-03-29 13:40   ` Dirk Behme [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=442A8E53.1030503@gmail.com \
    --to=dirk.behme@googlemail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).