This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC, PATCH] gdb/arm-tdep.c: Add sanity check on fp before trying to, access memory.


On 27 May 2013 10:46, Joel Brobecker <brobecker@adacore.com> wrote:

Hi Joel,

>> I'm not sure if this is the right approach to the problem, but if
>> anyone has any better ideas I would be interested.
>
> As you said, I suspect that this is not the right place for fixing
> the problem. I think something wrong happened, and my first instinct
> is that this should be caught earlier.
>
> We'd need more info as to why you get there...

The call stack to get here is:

#2 0x001c69c2 in read_memory_unsigned_integer (memaddr=936, len=4,
byte_order=BFD_ENDIAN_LITTLE) at /root/gdb-7.5/gdb/corefile.c:312
#3 0x0004c3ea in arm_analyze_prologue (gdbarch=0x4c5690,
prologue_start=936, prologue_end=1000, cache=0x4c9950) at
/root/gdb-7.5/gdb/arm-tdep.c:1695
#4 0x0004cf1e in arm_scan_prologue (this_frame=0x3f9cf0,
cache=0x4c9950) at /root/gdb-7.5/gdb/arm-tdep.c:1998
#5 0x0004cf4c in arm_make_prologue_cache (this_frame=0x3f9cf0) at
/root/gdb-7.5/gdb/arm-tdep.c:2011
#6 0x0004cffe in arm_prologue_this_id (this_frame=0x3f9cf0,
this_cache=0x3f9cfc, this_id=0x3f9d20) at
/root/gdb-7.5/gdb/arm-tdep.c:2041
#7 0x0021ee44 in get_frame_id (fi=0x3f9cf0) at /root/gdb-7.5/gdb/frame.c:338
#8 0x00108c80 in value_of_register (regnum=15, frame=0x3f9cf0) at
/root/gdb-7.5/gdb/findvar.c:298

There are no symbols available (this is the KVM stub) so
find_pc_partial_function fails, which drops us into the else in
arm_scan_prologue. At which point the code tries to unwind using the
frame pointer. However there is no guarantee that the frame pointer is
valid here as far as I can tell - in the case I have seen it is 0, but
it could be any value.

The worst case is the frame pointer is not valid and we get an error
printed. This is not the end of the world, but seems a bit excessive
when all we tried to do was "print $pc".

--
Will Newton
Toolchain Working Group, Linaro


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]