This is the mail archive of the gdb@sourceware.cygnus.com 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]

Re: ARM/linux gdb stops and gives no info


> > Thanks for the tip: yes, that works.  However, I still think that "info
> > reg" should display the raw registers if there is no valid stack frame.
> > 
> 
> Peter Schauer added the test for NULL frames in there back in 1995.  I believe
> it was causing core dumps, but I am not sure as the ChangeLog entry does not give
> the motive (we nowadays make sure it does, but that was not always true at the time):
> 
>      * infcmd.c (registers_info):  Error out if selected_frame is NULL.

It was a safety measure to avoid GDB core dumps if selected_frame == NULL.
If you really want to reproduce the original problem, get gdb-4.15.1, build
it on sparc Solaris and (mostly from the original bug report):

        ./gdb ./gdb     <- Freshly compiled 4.15.1 on itself
	set auto 0	(to avoid problems with /usr/platform/* sym reading)
        run
        info            <- pops you back to top level gdb
        info stack      <- Shows frames
        info registers  <- Kuh-BOOM, monster core dump in progress.

Back then, info stack left selected_frame == NULL, and then GDB crashed in

#0  0x70ef4 in get_saved_register (raw_buffer=0xeffff030 "ïÿï°",
    optimized=0xefffefa4, addrp=0x0, frame=0x0, regnum=0x0, lval=0x0)
    at ../../gdb-4.15.1/gdb/sparc-tdep.c:610
#1  0x30a80 in read_relative_register_raw_bytes (regnum=0x0,
    myaddr=0xeffff030 "ïÿï°") at ../../gdb-4.15.1/gdb/findvar.c:433
#2  0x6137c in do_registers_info (regnum=0xffffffff, fpregs=0x0)
    at ../../gdb-4.15.1/gdb/infcmd.c:980
#3  0x61734 in registers_info (addr_exp=0x0, fpregs=0x0)

> I believe the default gdb routine (if the target does not define DO_REGISTERS_INFO)
> does not depend on selected_frame but I can't be sure about all targets.
> I quickly created the patch below.  I have no time to test it these days.

With CVS GDB, do_registers_info calls read_relative_register_raw_bytes
which in turn calls read_relative_register_raw_bytes_for_frame with
selected_frame.

So even nowadays generic do_registers_info might need a valid selected_frame,
and your proposed patch would not help.

I'd prefer to keep the selected_frame != NULL check in registers_info
and rather make sure that selected_frame is not NULL in Richard's case,
although I do not know if this can be done for the ARM.

On the other hand we could remove the check in registers_info and wait for
bug reports with GDB crashing in registers_info due to selected_frame == NULL
and fix their cause.

Has to be decided by the maintainer of infcmd.c (Fernando ? :-).

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de

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