Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Timothy J. Wood" <tjw@omnigroup.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: law@cygnus.com, gcc@gcc.gnu.org, gdb@sourceware.cygnus.com
Subject: Re: More than one stabn for the same PC
Date: Mon, 29 Nov 1999 23:54:00 -0000	[thread overview]
Message-ID: <9911292354.AA301641@electabuzz> (raw)
In-Reply-To: <19991129232529S.mitchell@codesourcery.com>

  These extra stabs can actually allow you to do something more interesting 
that simply setting breakpoints, though.  Say I use the example:

int i;

static inline void f()
{
  i = 3;
}

static inline void g()
{
  f();
}

void h()
{
  g();
}


  Then on MacOS X Server PPC (which uses a mangled version of 2.7.2.1, but 
this should be applicable to other platforms), I get the following (cc 
-static -O2 -g -S test.c)


.globl _h
_h:
        .stabd 68,0,15
        stwu r1,-32(r1)
        .stabd 68,0,16
LBB2:
LBB3:
        .stabd 68,0,11
LBB4:
LBB5:
        .stabd 68,0,6
        addis r9,0,ha16(_i)
        addi r9,r9,lo16(_i)
        li r0,3
        stw r0,0(r9)
        .stabd 68,0,7
LBE5:
        .stabd 68,0,12
LBE4:
LBE3:
        .stabd 68,0,17
LBE2:
        addi r1,r1,32
        blr
.stabs "h:F19",36,0,15,_h
.stabn 192,0,0,LBB2
.stabn 192,0,0,LBB3
.stabn 192,0,0,LBB4
.stabn 192,0,0,LBB5
.stabn 224,0,0,LBE5
.stabn 224,0,0,LBE4
.stabn 224,0,0,LBE3
.stabn 224,0,0,LBE2


  If my program is stopped at the 'li r0,3' (i.e, the 'i = 3') line, then 
the debugger could construct a pseudo BACKTRACE from that point by searching 
backwards looking at the line numbers for the N_LBRAC stabs.  The debugger 
could then have the notion that the code on that line had a backtrace like:


  ??   test.c  line 6  (inlined)
  ??   test.c, line 11 (inlined)
  h()  test.c, line 16

  For non-static inlines, it could potentially track down the name of the 
function that was inlined.  For inlines included from other files, it could 
use the N_SOL stabs to find the right file name.


-tim


      reply	other threads:[~1999-11-29 23:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-29 16:59 Mark Mitchell
     [not found] ` <27496.943925188@upchuck>
1999-11-29 22:37   ` Mark Mitchell
     [not found]     ` <28295.943945638@upchuck>
1999-11-29 23:25       ` Mark Mitchell
1999-11-29 23:54         ` Timothy J. Wood [this message]

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=9911292354.AA301641@electabuzz \
    --to=tjw@omnigroup.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sourceware.cygnus.com \
    --cc=law@cygnus.com \
    --cc=mark@codesourcery.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