Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Josef Zlomek <josef.zlomek@email.cz>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb@sources.redhat.com
Subject: Re: Problem with location lists and variables on stack
Date: Wed, 01 Oct 2003 17:41:00 -0000	[thread overview]
Message-ID: <20031001174142.GA21499@artax.karlin.mff.cuni.cz> (raw)
In-Reply-To: <20031001162255.GA25428@nevyn.them.org>

> What makes you believe that GDB is the problem?  Here's the debug info
> for argument "g":
> 
>  <2><8e>: Abbrev Number: 3 (DW_TAG_formal_parameter)
>      DW_AT_name        : g      
>      DW_AT_decl_file   : 1      
>      DW_AT_decl_line   : 4      
>      DW_AT_type        : <ab>   
>      DW_AT_location    : 315    (location list)
> 
> Here's the location list:
>     0000013b 00000000 00000017 (DW_OP_fbreg: 28)
>     0000013b 00000017 00000083 (DW_OP_reg3)
>     0000013b 00000083 00000087 (DW_OP_fbreg: 28)
> 
> Here's the beginning of func1:
> 0x8048320 <func1>:      push   %ebp
> 0x8048321 <func1+1>:    push   %edi
> 0x8048322 <func1+2>:    push   %esi
> 0x8048323 <func1+3>:    push   %ebx
> 0x8048324 <func1+4>:    sub    $0x10,%esp
> 0x8048327 <func1+7>:    mov    0x24(%esp,1),%eax
> 0x804832b <func1+11>:   mov    0x2c(%esp,1),%edi
> 0x804832f <func1+15>:   mov    0x38(%esp,1),%esi
> 
> i.e. those pushes are not accounted for in the debug info.  This is
> something that GCC must do when using -fomit-frame-pointer.

I did not write the part generating the location lists, I do not know DRARF
much.  I thought that the labels LCFIx after each push mean adjustment of the
frame pointer.

.LVL0:
        # basic block 0
        pushl   %ebp
.LCFI0:
        pushl   %edi
.LCFI1:
        pushl   %esi

> To quote from the DWARF spec:
> 
>    The DW_OP_fbreg operation provides a signed LEB128 offset from the
>    address specified by the location description in the
>    DW_AT_frame_base attribute of the current function. (This is
>    typically a "stack pointer" register plus or minus some offset. On
>    more sophisticated systems it might be a location list that adjusts
>    the offset according to changes in the stack pointer as the PC
>    changes.)
> 
> The frame base is evaluated in the function's current context, not via
> unwinding.  So if GCC is using the CFA, then it needs to say so
> somehow.  It would be nice if it could reference the parent's stack
> pointer somehow and save duplication.  A mostly-relevant quote from the
> spec:
> 
>   In the context of supporting nested subroutines, the DW_AT_frame_base
>   attribute value should obey the following constraints:
> 
>   1. It should compute a value that does not change during the life of
>   the procedure, and

So shall the location for all variables located on stack be reemitted with the
changed offset after each push/pop? That would mean longer debug info.
I thought better idea would be adjusting the offsets from frame base in GDB.

Josef


  reply	other threads:[~2003-10-01 17:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01 14:43 Josef Zlomek
2003-10-01 14:49 ` Daniel Jacobowitz
2003-10-01 15:21   ` Josef Zlomek
2003-10-01 15:44   ` Josef Zlomek
2003-10-01 15:54     ` Daniel Jacobowitz
2003-10-01 16:03       ` Josef Zlomek
2003-10-01 16:22         ` Daniel Jacobowitz
2003-10-01 17:41           ` Josef Zlomek [this message]
2003-10-01 17:44             ` Daniel Jacobowitz
2003-10-01 17:48               ` Josef Zlomek
2003-10-06  6:22               ` Richard Henderson
2003-10-06  6:40                 ` Josef Zlomek
2003-10-06 13:46                   ` Daniel Jacobowitz
2003-10-06 14:49                     ` Daniel Berlin
2003-10-07 21:48                       ` Daniel Jacobowitz
2003-10-08  5:09                         ` Josef Zlomek

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=20031001174142.GA21499@artax.karlin.mff.cuni.cz \
    --to=josef.zlomek@email.cz \
    --cc=drow@mvista.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