linux-mips-fnet
[Top] [All Lists]

HELP : ptrace returns puzzling results

To: linux-mips@fnet.fr, linux@engr.sgi.com
Subject: HELP : ptrace returns puzzling results
From: Jun Sun <jsun@mvista.com>
Date: Mon, 15 May 2000 11:46:20 -0700
Sender: jsun@hermes.mvista.com
I am writing a gdbserver for linux/mips.  The server can now talk with
the gdb client, and can run to completion if you press 'c'.

However, the gdb client reads some confusing register values.  I traced
back to the gdbserver and found out that these values are returned from
ptrace(), which seem wrong.  On the other hand, the native gdb must be
using the same ptrace() to get register values.  I wonder why it works
there.

Here is a sample output from gdbserver calling ptrace.  Note that PC
value does not corresponds to the executable image.  sp also seems
wrong.

The reg # is register map viewed by gdb (gdb/config/mips/tm-mips.h). 
The $ reg# is the register map used by kernel (include/asm/ptrace.h). 
The register name is provided by gdb/config/mips/tm-linux.h.

reg #0 ($0,zero) = 0 (0x00000000)
reg #1 ($1,at) = 0 (0x00000000)
reg #2 ($2,v0) = 0 (0x00000000)
reg #3 ($3,v1) = 0 (0x00000000)
reg #4 ($4,a0) = 0 (0x00000000)
reg #5 ($5,a1) = 0 (0x00000000)
reg #6 ($6,a2) = 0 (0x00000000)
reg #7 ($7,a3) = 0 (0x00000000)
reg #8 ($8,t0) = 0 (0x00000000)
reg #9 ($9,t1) = 0 (0x00000000)
reg #10 ($10,t2) = 0 (0x00000000)
reg #11 ($11,t3) = 0 (0x00000000)
reg #12 ($12,t4) = 0 (0x00000000)
reg #13 ($13,t5) = 0 (0x00000000)
reg #14 ($14,t6) = 0 (0x00000000)
reg #15 ($15,t7) = 0 (0x00000000)
reg #16 ($16,s0) = 2147483068 (0x7ffffdbc)
reg #17 ($17,s1) = 2147483322 (0x7ffffeba)
reg #18 ($18,s2) = -1 (0xffffffff)
reg #19 ($19,s3) = 269351376 (0x100df9d0)
reg #20 ($20,s4) = 269313296 (0x100d6510)
reg #21 ($21,s5) = 0 (0x00000000)
reg #22 ($22,s6) = 0 (0x00000000)
reg #23 ($23,s7) = 269314704 (0x100d6a90)
reg #24 ($24,t8) = 0 (0x00000000)
reg #25 ($25,jp) = 0 (0x00000000)
reg #26 ($26,k0) = 0 (0x00000000)
reg #27 ($27,k1) = 0 (0x00000000)
reg #28 ($28,gp) = 0 (0x00000000)
reg #29 ($29,sp) = 2147483120 (0x7ffffdf0)
reg #30 ($30,fp) = 0 (0x00000000)
reg #31 ($31,ra) = 0 (0x00000000)
reg #32 ($0,zero) = 0 (0x00000000)
reg #33 ($68,hi) = -858993459 (0xcccccccd)
reg #34 ($67,lo) = 0 (0x00000000)
reg #35 ($66,badvaddr) = 59 (0x0000003b)
reg #36 ($65,cause) = 32800 (0x00008020)
reg #37 ($64,pc) = 263607008 (0x0fb652e0)

Does anybody have a clue here?  Thanks.

Jun

<Prev in Thread] Current Thread [Next in Thread>