public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Bob Zulawnik <bob.zulawnik@cportcorp.com>
To: tpeng@metrowerks.com
Cc: gdb@sourceware.cygnus.com, binutils@sourceware.cygnus.com,
	bob.zulawnik@cportcorp.com
Subject: Re: Questions about GCC MIPS R5900's mdebug section
Date: Fri, 19 Nov 1999 08:13:00 -0000	[thread overview]
Message-ID: <38357724.BF944599@cportcorp.com> (raw)

Here is what appears to be a problem when running gdb
on MIPS executables that use stabs for debug info (e.g.
ECOFF/stabs or ELF/stabs), rather than 'original'
ECOFF/mdebug format. If somebody could confirm/refute
this, it would be very helpful indeed.

When unwinding stack (or on other occasions) find_proc_desc()
will be called with a particular PC value. It will first
attempt to do it 'in a scientific way' by calling
non_heuristic_proc_desc() (both defined in mips-tdep.c).
non_heuristic_proc_desc() will look for a block that
that particular PC values falls into (block_for_pc(pc))
and then it will attempt to find a particular symbol
for than block :

    sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b,
                         LABEL_NAMESPACE, 0, NULL);

where MIPS_EFI_SYMBOL_NAME is defined this way in
config/mips/tm-mips.h :

    #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"


This particular symbol ("__GDB_EFI_INFO__") will not
be found for the files with stabs debug info (ECOFF/stabs,
ELF/stabs), as it is only created when reading in
debug info from an ECOFF/mdebug executable. It is
built based upon info in PDRs (Procedure Description
Records) that live in .mdebug section. From mdebugread.c :

/* Parse a procedure descriptor record PR.  Note that the procedure
   is parsed _after_ the local symbols, now we just insert the extra
   information we need into a MIPS_EFI_SYMBOL_NAME symbol
   that has already been placed in the procedure's main block. ...
   ...
    parse_symbol (..) {
    ...
    /* Make up special symbol to contain procedure specific
       info */
     s = new_symbol (MIPS_EFI_SYMBOL_NAME);

The problem as I understand it is that these symbols
(__GDB_EFI_INFO__) are not created when reading in stabs
because stabs sections simply do not contain all that info
(gathered in one record, no less) that a PDR has (e.g. things like
frame size, register mask etc).

What happens next is that find_proc_desc() reverts to
heuristics :

    proc_desc =
        heuristic_proc_desc (startaddr, pc, next_frame);

which means that it starts reading function prologue
(i.e. it reads instructions from inferior's memory) and it
attempts to figure out information about it that way.
While inelegant, it might work OK in native configurations
(i.e. when gdb and inferior are running on the same host).
However, the biggest problem will occur in remote configurations,
where those memory reads have go through remote link. (A hack
would make gdb read the executable file on the host side,
rather than inferior's memory in a situation like that, just
for speed's sake).

As mips-tdep.c contains MIPS target-dependent code, regardless
of the particulars of debug info scheme in use, I would guess
that the same problem should affect MIPS ELF/Dwarf files ? Or
am I totally confused here ?

Regards,
Bob Zulawnik

             reply	other threads:[~1999-11-19  8:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-19  8:13 Bob Zulawnik [this message]
1999-11-19 13:57 ` Stan Shebs
  -- strict thread matches above, loose matches on Subject: below --
1999-11-18 20:21 David B Anderson
1999-11-18 14:23 Thomas Peng
1999-11-18 23:23 ` Ian Lance Taylor

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=38357724.BF944599@cportcorp.com \
    --to=bob.zulawnik@cportcorp.com \
    --cc=binutils@sourceware.cygnus.com \
    --cc=gdb@sourceware.cygnus.com \
    --cc=tpeng@metrowerks.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).