gcc-patches@gcc.gnu.org
[Top] [All Lists]

[PATCH] Preliminary DW_OP_{implicit,stack}_value support (take 2)

Subject: [PATCH] Preliminary DW_OP_{implicit,stack}_value support take 2
From: Jakub Jelinek
Date: Thu, 11 Jun 2009 16:24:59 +0200
On Thu, Jun 11, 2009 at 09:58:51AM -0300, Alexandre Oliva wrote:
> On Jun 11, 2009, Jakub Jelinek <jakub@xxxxxxxxxx> wrote:
> 
> >> DW_OP_implicit_value 0x9e
> >> DW_OP_stack_value 0x9f
> 
> > Using http://www.dwarfstd.org/doc/DWARF4-draft3-090522.pdf
> > I've drafted up a preliminary support patch for these two.
> > First patch is against trunk, second against VTA branch.
> 

Here is an updated version of the patch, which fixes
a bug reported by Alex and also handles even one var value being computable
from another value with some offset.

On Alex's
int f(int a) { int i, j, k;  i = a;  j = i + 1;  k = j - 1;  h(i, k); }
with -O2 -g the difference on VTA branch is:
 .LLST3:
        .quad   .LVL1-.Ltext0   # Location list begin address (*.LLST3)
        .quad   .LVL2-.Ltext0   # Location list end address (*.LLST3)
-       .value  0x0     # Location expression size
+       .value  0x5     # Location expression size
+       .byte   0x75    # DW_OP_breg5
+       .sleb128 1
+       .byte   0x9f    # DW_OP_stack_value
+       .byte   0x93    # DW_OP_piece
+       .uleb128 0x4
        .quad   0x0     # Location list terminator begin (*.LLST3)
        .quad   0x0     # Location list terminator end (*.LLST3)

so all of a, i, j and k should now be inspectable in the debugger.

OT, unrelated to VTA and this patch, seems we should try harder to improve
location lists start/end handling, because the testcase is:
f:
.LFB0:
        .file 1 "tt.c"
        # tt.c:1
        .loc 1 1 0
        .cfi_startproc
.LVL0:
        # basic block 2
.LVL1:
        # tt.c:1
        .loc 1 1 0
        movl    %edi, %esi
        xorl    %eax, %eax
        jmp     h
.LVL2:
        .cfi_endproc
.LFE0:
        .size   f, .-f
(note empty range from .LVL0 to .LVL1 and that .LVL0 .. .LVL2 covers
the whole function - so except for DW_OP_stack_value/DW_OP_implicit_value
which are only allowed in .debug_loc we could avoid using .debug_loc).

        Jakub

Attachment: gcc45-OP_implicit_value.patch
Description: Text document

Attachment: gcc-vta-OP_implicit_value.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>