This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] remove ECOFF
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Mon, 19 Aug 2013 22:20:51 +0100
- Subject: Re: [PATCH] remove ECOFF
- References: <1376936369-30712-1-git-send-email-tromey at redhat dot com>
On Mon, 19 Aug 2013, Tom Tromey wrote:
> The others are in mips_find_abi_section. I don't know what the impact
> would be of removing this code, so I did not touch it.
The MIPS target wants to use minimal ECOFF debug information that is
stored in ELF binaries in the so called PDR or Procedure Descriptor Record
section [1]. That information comprises function address ranges and stack
frame information -- all produced by .ent, .end, .frame, .mask and .fmask
MIPS GAS pseudo-ops (produced by GCC in generated code and also present in
virtually all handcoded MIPS assembly sources). It is required for
correct frame unwinding in functions that lack debugging information (PDR
records are not normally removed by `strip'), that cannot be handled by
our heuristic unwinders that get challenged more and more by the GCC
optimiser getting more and more sophisticated (and able to produce
essentially random code in function prologues these days).
Support for PDR unwinding (mips-mdebug-tdep.[ch]) was removed a while ago
from GDB sources, perhaps due to the shortcoming of the code in the
handling of leaf frames -- while more outer frames were always accurately
handled, the leaf ones were not. The reason was the PDR format does not
record offsets into functions where individual registers are saved and the
old code had no logic to figure out where this happens. Unlike the
heuristic unwinders that have to make a full static analysis of code to
figure out the structure of a function's frame, the heuristic for the PDR
unwinder can be simple -- it's enough to recognise register stores as the
frame layout is already described by the PDR.
We have kept maintaining bare-iron MIPS PDR support in CodeBench and my
intent is to enable it for Linux MIPS targets, add the heuristic outlined
above and resurrect the old code GDB used to have with the improvements
included. Without that debugging is often a challenge -- while the
heuristic unwinders are good enough to handle stepping in to a function
that has no debug information so that it's skipped over with the usual
`step' or `next' CLI operations (and their MI equivalents), interrupting a
program randomly within a function that has no debug information -- a
common scenario e.g. where a Linux process is sleeping in a syscall
invoked from stripped libc -- provides the user with no backtrace and
therefore no access to any local state or the ability to control execution
other than by instruction-level stepping (`stepi' or `nexti').
I think this is a serious shortcoming of GDB on the MIPS target and a
good argument in favour to having this PDR unwinding support.
References:
[1] ftp://ftp.sgi.com/sgi/dev/davea/Mdebug.ps
Maciej