gdb 6.x 'next' does not work on mips-linux/mipsel-linux

Atsushi Nemoto
2004-12-24T09:32:52Z

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