This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: ARM/linux gdb stops and gives no info
- To: rearnsha at arm dot com
- Subject: Re: ARM/linux gdb stops and gives no info
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Tue, 30 May 2000 09:47:06 -0400
- CC: Nicolas dot Thery at Symbian dot com, gdb at sourceware dot cygnus dot com
- Organization: Red Hat , Inc. - Toronto
- References: <200005300948.KAA21133@cam-mail2.cambridge.arm.com>
Richard Earnshaw wrote:
>
> >
> > Richard Earnshaw <rearnsha@arm.com> wrote:
> >
> > > I can understand not being able to unpick the stack frame if I've jumped
> > > to never-never land, but to not even be able to display the registers
> > > makes the debugger useless.
> >
> > Have you tried "print $pc", "print $r1", ... to get the register contents?
> >
>
> 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.
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.
If you care applying it to your sources and trying I would appreciate.
Otherwise it goes in my 25 pages long TODO list.. ;-)
Regards,
Fernando
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.1.1.17
diff -c -p -r1.1.1.17 infcmd.c
*** infcmd.c 2000/02/03 04:14:31 1.1.1.17
--- infcmd.c 2000/05/30 13:42:23
*************** char *gdb_register_names[] = REGISTER_NA
*** 1494,1501 ****
is required, (eg, for MIPS or Pyramid 90x, which both have
lots of regs), or there is an existing convention for showing
all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
! to provide that format. */
#if !defined (DO_REGISTERS_INFO)
#define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
--- 1494,1504 ----
is required, (eg, for MIPS or Pyramid 90x, which both have
lots of regs), or there is an existing convention for showing
all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
! to provide that format.
+ This default routine must work even if there is no selected_frame (== NULL).
+ Please don't add any dependencies on that being defined. */
+
#if !defined (DO_REGISTERS_INFO)
#define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
*************** registers_info (addr_exp, fpregs)
*** 1617,1624 ****
--- 1620,1633 ----
if (!target_has_registers)
error ("The program has no registers now.");
+
+ #if !defined (DO_REGISTERS_INFO)
+ /* The default do_registers_info() does not need the selected_frame
+ so we don't test for it not being NULL. Tagets that define
+ DO_REGISTERS_INFO may rely on that, so we make sure it is valid. */
if (selected_frame == NULL)
error ("No selected frame.");
+ #endif
if (!addr_exp)
{