Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] remove ECOFF
Date: Mon, 19 Aug 2013 21:21:00 -0000	[thread overview]
Message-ID: <alpine.DEB.1.10.1308191948550.8514@tp.orcam.me.uk> (raw)
In-Reply-To: <1376936369-30712-1-git-send-email-tromey@redhat.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


  parent reply	other threads:[~2013-08-19 21:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 18:19 Tom Tromey
2013-08-19 18:51 ` Mark Kettenis
2013-08-19 18:57   ` Tom Tromey
2013-08-19 19:02     ` Tom Tromey
2013-08-19 19:41       ` Joel Brobecker
2013-08-19 21:21 ` Maciej W. Rozycki [this message]
2013-08-19 23:22   ` Stan Shebs
2013-08-20 15:12   ` Tom Tromey
2013-08-20 15:20     ` Mark Kettenis
2013-08-20 16:19       ` Maciej W. Rozycki
2013-08-20 15:19   ` Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.10.1308191948550.8514@tp.orcam.me.uk \
    --to=macro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox