From: Daniel Jacobowitz <drow@mvista.com>
To: Don Bowman <don@sandvine.com>
Cc: "'gdb@sources.redhat.com '" <gdb@sources.redhat.com>
Subject: Re: MIPS stack tracing
Date: Wed, 06 Feb 2002 16:45:00 -0000 [thread overview]
Message-ID: <20020206194518.B20568@nevyn.them.org> (raw)
In-Reply-To: <FE045D4D9F7AED4CBFF1B3B813C853371BC219@mail.sandvine.com>
On Wed, Feb 06, 2002 at 12:40:18PM -0500, Don Bowman wrote:
>
> > From: Don Bowman
> >
> > I'm going to give dwarf2 a try (as suggested in the thread
> > @ http://sources.redhat.com/ml/crossgcc/2001-12/msg00039.html)
> >
>
> To summarise:
>
> So the dwarf-2 gives the same affect, stack traces do not work
> on mips with gcc 3.0.3 and binutils 2.11.2. The root of the
> problem is that the multiple returns per function exist as
> of the new version of gcc, and there is no .mdebug section
> anymore. gdb doesn't read the .pdr section which is emitted
> with the information on how to unwind the stack, so it
> switches to its heuristic, which is now broken because of the
> multiple returns.
>
> Upon examination of gas, the .pdr section is only emitted if
> MIPS_STABS_ELF is defined. Am I to assume that if I'm using
> DWARF2 this won't occur? The code which actually emits it
> seems to be in ecoff.c.
No. It should be emitted unless we are emitting .mdebug, which we
don't do any more for mips-*-linux.
> Am I correct that the .pdr section is an array of:
>
> /*
> * Procedure Descriptor
> *
> * There is one of these for EVERY TEXT LABEL.
> * If a procedure is in a file with full symbols, then isym
> * will point to the PROC symbols, else it will point to the
> * global symbol for the label.
> */
>
> typedef struct pdr {
> bfd_vma adr; /* memory address of start of procedure */
> long isym; /* start of local symbol entries */
> long iline; /* start of line number entries*/
> long regmask; /* save register mask */
> long regoffset; /* save register offset */
> long iopt; /* start of optimization symbol entries*/
> long fregmask; /* save floating point register mask */
> long fregoffset; /* save floating point register offset */
> long frameoffset; /* frame size */
> short framereg; /* frame pointer register */
> short pcreg; /* offset or reg of return pc */
> long lnLow; /* lowest line in the procedure */
> long lnHigh; /* highest line in the procedure */
> bfd_vma cbLineOffset; /* byte offset for this procedure from the
> fd base */
> /* These fields are new for 64 bit ECOFF. */
> unsigned gp_prologue : 8; /* byte size of GP prologue */
> unsigned gp_used : 1; /* true if the procedure uses GP */
> unsigned reg_frame : 1; /* true if register frame procedure */
> unsigned prof : 1; /* true if compiled with -pg */
> unsigned reserved : 13; /* reserved: must be zero */
> unsigned localoff : 8; /* offset of local variables from vfp */
> } PDR, *pPDR;
> #define cbPDR sizeof(PDR)
I don't think that's the right one. The code in gas to emit them:
subseg_set (pdr_seg, 0);
/* Write the symbol. */
exp.X_op = O_symbol;
exp.X_add_symbol = p;
exp.X_add_number = 0;
emit_expr (&exp, 4);
fragp = frag_more (7 * 4);
md_number_to_chars (fragp, (valueT) cur_proc_ptr->reg_mask, 4);
md_number_to_chars (fragp + 4, (valueT) cur_proc_ptr->reg_offset, 4);
md_number_to_chars (fragp + 8, (valueT) cur_proc_ptr->fpreg_mask, 4);
md_number_to_chars (fragp + 12, (valueT) cur_proc_ptr->fpreg_offset, 4);
md_number_to_chars (fragp + 16, (valueT) cur_proc_ptr->frame_offset, 4);
md_number_to_chars (fragp + 20, (valueT) cur_proc_ptr->frame_reg, 4);
md_number_to_chars (fragp + 24, (valueT) cur_proc_ptr->pc_reg, 4);
subseg_set (saved_seg, saved_subseg);
So that is: symbol, regmask, regoffset, fpregmask, fpregoffset,
frameoffset, framereg, pcreg, and broken for 64-bit targets. Feh, I'll
have to fix that last one.
> This doesn't seem right to me, if I dump my .pdr section I get:
> Contents of section .pdr:
> 0000 00400080 00000000 00000000 00000000 .@..............
> 0010 00000000 00000000 00000000 00000000 ................
> 0020 74430080 00000000 00000000 00000000 tC..............
> 0030 00000000 00000000 00000000 00000000 ................
> 0040 b8430080 00000000 00000000 00000000 .C..............
> ...
>
> But all of my addresses start @ 0x80000000.
Careful, it has relocations if you look at it in an object. Also
careful, you have a host-target endian mismatch. That first word is
0x80000400.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-02-07 0:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-06 9:40 Don Bowman
2002-02-06 16:45 ` Daniel Jacobowitz [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-07 6:56 Don Bowman
2002-02-07 7:30 ` Daniel Jacobowitz
2002-02-04 9:22 David Anderson
2002-02-03 15:49 Don Bowman
2002-02-03 12:29 Don Bowman
2002-02-03 12:29 ` Daniel Jacobowitz
2002-02-03 12:29 ` Andrew Cagney
2002-02-03 12:13 ` Daniel Jacobowitz
2002-02-03 12:29 ` Andrew Cagney
2002-02-02 12:14 Don Bowman
2002-02-02 14:45 ` Daniel Jacobowitz
2002-02-02 11:26 Don Bowman
2002-02-02 12:11 ` Stan Shebs
2002-02-02 10:58 David Anderson
2002-02-02 9:57 David Anderson
2002-02-01 10:15 Don Bowman
2002-02-01 11:32 ` Daniel Jacobowitz
2002-02-02 11:16 ` Greg McGary
2002-01-31 14:27 Don Bowman
2002-02-01 9:37 ` Daniel Jacobowitz
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=20020206194518.B20568@nevyn.them.org \
--to=drow@mvista.com \
--cc=don@sandvine.com \
--cc=gdb@sources.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