public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: gdb 6.x 'next' does not work on mips-linux/mipsel-linux
@ 2005-04-22 22:39 John Van Horne
  2005-04-25  6:22 ` Atsushi Nemoto
  0 siblings, 1 reply; 13+ messages in thread
From: John Van Horne @ 2005-04-22 22:39 UTC (permalink / raw)
  To: gdb

I just posted a note on PR 1716 about my experience with this problem. Basically,
"next" on a dynamically linked library function fails for me using gdb 6.2.1, 6.3
and 6.3.50.20050420. I saw the previous posts in this thread that made it sound as
though this was fixed in the 20050104 snapshot. However I couldn't find that snapshot,
and the latest failed for me.

I've got gdb configured for mips-linux-gnu, and I'm using gcc-3.3.4 and binutils-2.15.
As a test I'm using testsuite/gdb.base/call-strs.exp. Version 6.3.50.20050420 fails
on the "next" at line 73 (strcpy) with this message:

warning: GDB can't find the start of the function at 0x400cf0.

    GDB is unable to find the start of the function at 0x400cf0
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
    This problem is most likely caused by an invalid program counter or
stack pointer.
    However, if you think GDB should simply search farther back
from 0x400cf0 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
warning: GDB can't find the start of the function at 0x400cf0.
?? ()
 
The failure occurs both with native and remote debugging.
There's no failure when I "step" into "strcpy" and then finish it.

I'd be happy to provide any more information and would like to know if anyone's
working on this.

Thanks,
-John Van Horne
(not on mailing list, please cc jvh@tivo.com)

^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: gdb 6.x 'next' does not work on mips-linux/mipsel-linux
@ 2005-04-27 16:36 John Van Horne
  0 siblings, 0 replies; 13+ messages in thread
From: John Van Horne @ 2005-04-27 16:36 UTC (permalink / raw)
  To: Daniel Jacobowitz, Atsushi Nemoto, gdb

Daniel,

I applied your patch to my copy of 6.3.50.20050420, ran testsuite/gdb.base/call-strs.exp,
and it passed. Thanks. This is great.

-John

> -----Original Message-----
> From: Daniel Jacobowitz [mailto:drow@false.org]
> Sent: Wednesday, April 27, 2005 7:17 AM
> To: Atsushi Nemoto; John Van Horne; gdb@sources.redhat.com
> Subject: Re: gdb 6.x 'next' does not work on mips-linux/mipsel-linux
> 
> 
> On Wed, Apr 27, 2005 at 09:43:06AM -0400, Daniel Jacobowitz wrote:
> > Hmm, no step into the lazy resolution stub; it's already 
> been resolved
> > to strcpy.  The system I'm doing all my testing on 
> apparently does not
> > do lazy binding :-(  Looks like a binutils problem - I believe I
> > remember fixing this bug some time after binutils 2.14 was released.
> > 
> > I'll keep trying to reproduce this.
> 
> Got it.  Could either of you please test this patch?  Without 
> it, I get
> failures in call-strs.exp; with it, everything passes.
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 
> 2005-04-27  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* mips-tdep.c (mips_stub_frame_sniffer): Handle .MIPS.stubs
> 	section like .plt.
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /big/fsf/rsync/src-cvs/src/gdb/mips-tdep.c,v
> retrieving revision 1.379
> diff -u -p -r1.379 mips-tdep.c
> --- mips-tdep.c	17 Mar 2005 18:07:46 -0000	1.379
> +++ mips-tdep.c	27 Apr 2005 14:12:21 -0000
> @@ -2091,11 +2091,21 @@ static const struct frame_unwind mips_st
>  static const struct frame_unwind *
>  mips_stub_frame_sniffer (struct frame_info *next_frame)
>  {
> +  struct obj_section *s;
>    CORE_ADDR pc = frame_pc_unwind (next_frame);
> +
>    if (in_plt_section (pc, NULL))
>      return &mips_stub_frame_unwind;
> -  else
> -    return NULL;
> +
> +  /* Binutils for MIPS puts lazy resolution stubs into 
> .MIPS.stubs.  */
> +  s = find_pc_section (pc);
> +
> +  if (s != NULL
> +      && strcmp (bfd_get_section_name (s->objfile->obfd, 
> s->the_bfd_section),
> +		 ".MIPS.stubs") == 0)
> +    return &mips_stub_frame_unwind;
> +
> +  return NULL;
>  }
>  
>  static CORE_ADDR
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread
* gdb 6.x 'next' does not work on mips-linux/mipsel-linux
@ 2004-12-24  9:32 Atsushi Nemoto
  2005-01-04 20:30 ` Andrew Cagney
  0 siblings, 1 reply; 13+ messages in thread
From: Atsushi Nemoto @ 2004-12-24  9:32 UTC (permalink / raw)
  To: gdb

Hi.  I noticed gdb 6.3 'next' command does not work (even for the
"hello world" program) on mips-linux/mipsel-linux.  It works well for
statically linked programs.

I found PR#1716 (for gdb 6.1.1).  Is this solved on gdb 6.3?

Also I found discussions in this ML (Subject: "Unable to step over (n
and ni) on mipsel-linux...")  but can not see final solution.

Here is my inspection:

When 'next' failed, following call (infrun.c:1772) stores 0 in
ecs->stop_func_start.

  find_pc_partial_function (stop_pc, &ecs->stop_func_name,
			    &ecs->stop_func_start, &ecs->stop_func_end);

More exactly, following call (blockframe.c:211) returned NULL.

  msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);

'mapped_pc' was an address of a STUB section to the libc function
(printf) and 'section' was ".MIPS.stubs".

When I tried gdb 5.3, the 'section' variable was NULL in that point.

So I suppose something wrong with ".MIPS.stubs" section handling.

With this quick and dirty hack, 'next' command works well.

--- gdb-6.3.org/gdb/blockframe.c	2004-09-01 23:13:31.000000000 +0900
+++ gdb-6.3/gdb/blockframe.c	2004-12-24 17:50:27.747543472 +0900
@@ -199,6 +199,10 @@
 	section = NULL;
       else
 	section = obj_section->the_bfd_section;
+#if 1	/* dirty hack... */
+      if (section && strcmp(section->name, ".MIPS.stubs") == 0)
+	section = NULL;
+#endif
     }
 
   mapped_pc = overlay_mapped_address (pc, section);


I do not think this hack is correct at all, but hope it helps fixing
the real problem.

Thank you.


P.S.  I'm not on this ML.  Please CC to me.
---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-05-09  3:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-22 22:39 gdb 6.x 'next' does not work on mips-linux/mipsel-linux John Van Horne
2005-04-25  6:22 ` Atsushi Nemoto
2005-04-25 13:05   ` Daniel Jacobowitz
2005-04-27 14:18     ` Daniel Jacobowitz
2005-04-27 16:00       ` Daniel Jacobowitz
2005-04-28 15:16         ` Atsushi Nemoto
2005-05-09  3:16         ` Atsushi Nemoto
2005-05-09  3:36           ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2005-04-27 16:36 John Van Horne
2004-12-24  9:32 Atsushi Nemoto
2005-01-04 20:30 ` Andrew Cagney
2005-01-06 10:37   ` Atsushi Nemoto
2005-01-07  1:12     ` Daniel Jacobowitz

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 read-only IMAP folder(s) and NNTP newsgroup(s).