public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-jankratochvil-entryval: more entryval kinds
@ 2011-07-11 11:55 jkratoch
0 siblings, 0 replies; only message in thread
From: jkratoch @ 2011-07-11 11:55 UTC (permalink / raw)
To: archer-commits
The branch, archer-jankratochvil-entryval has been updated
via f15cec06e871b143722a75ae8bf4f6fb72c16b55 (commit)
from 1309005ec8e9efab0e1713fbc7db6d391de4cdfd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit f15cec06e871b143722a75ae8bf4f6fb72c16b55
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jul 11 13:55:21 2011 +0200
more entryval kinds
-----------------------------------------------------------------------
Summary of changes:
gdb/dwarf2expr.c | 127 ++++++------
gdb/dwarf2expr.h | 7 +-
gdb/dwarf2loc.c | 14 +--
gdb/testsuite/gdb.arch/amd64-entry-value.cc | 2 +
gdb/testsuite/gdb.arch/amd64-entry-value.exp | 1 +
gdb/testsuite/gdb.arch/amd64-entry-value.s | 276 ++++++++++++++------------
6 files changed, 223 insertions(+), 204 deletions(-)
First 500 lines of diff:
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index da7bf0e..329c131 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -507,6 +507,63 @@ dwarf_block_to_dwarf_reg (const gdb_byte *buf, const gdb_byte *buf_end)
return dwarf_reg;
}
+/* If <BUF..BUF_END] contains DW_FORM_block* with just DW_OP_breg*(0) and
+ DW_OP_deref* return the register number. Otherwise return -1.
+ DEREF_SIZE_RETURN contains -1 for DW_OP_deref or the size from
+ DW_OP_deref_size. */
+
+int
+dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf, const gdb_byte *buf_end,
+ CORE_ADDR *deref_size_return)
+{
+ ULONGEST dwarf_reg;
+ LONGEST offset;
+
+ if (buf_end <= buf)
+ return -1;
+ if (*buf >= DW_OP_breg0 && *buf <= DW_OP_breg31)
+ {
+ dwarf_reg = *buf - DW_OP_breg0;
+ buf++;
+ }
+ else if (*buf == DW_OP_bregx)
+ {
+ buf++;
+ buf = read_uleb128 (buf, buf_end, &dwarf_reg);
+ if ((int) dwarf_reg != dwarf_reg)
+ return -1;
+ }
+ else
+ return -1;
+
+ buf = read_sleb128 (buf, buf_end, &offset);
+ if (offset != 0)
+ return -1;
+
+ if (buf >= buf_end)
+ return -1;
+
+ if (*buf == DW_OP_deref)
+ {
+ buf++;
+ *deref_size_return = -1;
+ }
+ if (*buf == DW_OP_deref_size)
+ {
+ buf++;
+ if (buf >= buf_end)
+ return -1;
+ *deref_size_return = *buf++;
+ }
+ else
+ return -1;
+
+ if (buf != buf_end)
+ return -1;
+
+ return dwarf_reg;
+}
+
/* If <BUF..BUF_END] contains DW_FORM_block* with single DW_OP_bregSP(X) fill
in SP_OFFSET_RETURN with the X offset and return 1. Otherwise return 0. */
@@ -567,65 +624,6 @@ dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end,
return 1;
}
-#if 0
-/* If <BUF..BUF_END] contains DW_FORM_block* with just DW_OP_breg*(0) and
- DW_OP_deref* return the register number. Otherwise return -1.
- *DEREF_SIZE_RETURN contains -1 for DW_OP_deref or the size from
- DW_OP_deref_size. */
-
-int
-dwarf_block_to_regnum_deref (const gdb_byte *buf, const gdb_byte *buf_end,
- CORE_ADDR *deref_size_return)
-{
- ULONGEST regnum;
- LONGEST offset;
-
- if (buf_end <= buf)
- return -1;
- if (*buf >= DW_OP_breg0 && *buf <= DW_OP_breg31)
- {
- regnum = *buf - DW_OP_breg0;
- buf++;
- }
- else if (*buf == DW_OP_bregx)
- {
- buf++;
- buf = read_uleb128 (buf, buf_end, ®num);
- if ((int) regnum != regnum)
- return -1;
- }
- else
- return -1;
-
- buf = read_sleb128 (buf, buf_end, &offset);
- if (offset != 0)
- return -1;
-
- if (buf >= buf_end)
- return -1;
-
- if (*buf == DW_OP_deref)
- {
- buf++;
- *deref_size_return = -1;
- }
- if (*buf == DW_OP_deref_size)
- {
- buf++;
- if (buf >= buf_end)
- return -1;
- *deref_size_return = *buf++;
- }
- else
- return -1;
-
- if (buf != buf_end)
- return -1;
-
- return regnum;
-}
-#endif
-
/* The engine for the expression evaluator. Using the context in CTX,
evaluate the expression between OP_PTR and OP_END. */
@@ -1347,18 +1345,17 @@ execute_stack_op (struct dwarf_expr_context *ctx,
goto no_push;
}
-#if 0
- dwarf_reg = dwarf_block_to_regnum_deref (op_ptr, op_ptr + len,
- &deref_size);
- if (regnum != -1)
+ dwarf_reg = dwarf_block_to_dwarf_reg_deref (op_ptr, op_ptr + len,
+ &deref_size);
+ if (dwarf_reg != -1)
{
if (deref_size == -1)
deref_size = ctx->addr_size;
op_ptr += len;
- ctx->push_regnum_entry_value (ctx, regnum, deref_size);
+ ctx->push_dwarf_reg_entry_value (ctx, dwarf_reg, 0 /* unused */,
+ deref_size);
goto no_push;
}
-#endif
error (_("DWARF-2 expression error: DW_OP_GNU_entry_value is "
"supported only for single DW_OP_reg* "
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index df7ca0a..41741d9 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -259,9 +259,8 @@ int dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf,
int dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end,
CORE_ADDR *fb_offset_return);
-#if 0
-int dwarf_block_to_regnum_deref (const gdb_byte *buf, const gdb_byte *buf_end,
- CORE_ADDR *deref_size_return);
-#endif
+int dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf,
+ const gdb_byte *buf_end,
+ CORE_ADDR *deref_size_return);
#endif /* dwarf2expr.h */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 0e6ec104..c1804df 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -3448,18 +3448,8 @@ loclist_read_variable_at_entry (struct symbol *symbol, struct frame_info *frame)
return value_of_dwarf_reg_entry_value (SYMBOL_TYPE (symbol), frame,
-1, fb_offset, -1);
-#if 0
- dwarf_reg = dwarf_block_to_dwarf_reg_deref (data, data + size, &deref_size);
- if (dwarf_reg != -1)
- {
- if (deref_size == -1)
- deref_size = dwarf2_per_cu_addr_size (dlbaton->per_cu);
- return value_of_dwarf_reg_entry_value (SYMBOL_TYPE (symbol), frame,
- dwarf_reg, deref_size);
- }
-#endif
-
- return allocate_optimized_out_value (SYMBOL_TYPE (symbol));
+ error (_("DWARF-2 expression error: DW_OP_GNU_entry_value is supported only "
+ "for single DW_OP_reg* or for DW_OP_fbreg(*)"));
}
/* Return non-zero iff we need a frame to evaluate SYMBOL. */
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.cc b/gdb/testsuite/gdb.arch/amd64-entry-value.cc
index f0dffd7..c5d0018 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.cc
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.cc
@@ -126,6 +126,8 @@ asm ("breakhere_stacktest:");
static void __attribute__((noinline, noclone))
reference (int &refparam)
{
+ int refcopy = refparam;
+
refparam = 10;
asm ("breakhere_reference:");
e (v);
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index f1be80c..9cdb12e 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -72,6 +72,7 @@ gdb_continue_to_breakpoint "entry_reference: breakhere_reference"
gdb_test "bt full"
gdb_test "p refparam" " = (.*@0x\[0-9a-f\]+: )?10" "entry_reference: p refparam"
gdb_test "p refparam@entry" " = (.*@0x\[0-9a-f\]+: )?5" "entry_reference: p refparam@entry"
+gdb_test "p refcopy" " = 5" "entry_reference: p refcopy"
# Test virtual tail call frames.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.s b/gdb/testsuite/gdb.arch/amd64-entry-value.s
index 1faef36..bbb4c9f 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.s
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.s
@@ -411,23 +411,25 @@ _ZL9referenceRi:
.LVL49:
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (fallthru)
- # gdb.arch/amd64-entry-value.cc:129
- .loc 1 129 0
+.LBB2:
+ # gdb.arch/amd64-entry-value.cc:131
+ .loc 1 131 0
movl $10, (%rdi)
- # gdb.arch/amd64-entry-value.cc:130
- .loc 1 130 0
+ # gdb.arch/amd64-entry-value.cc:132
+ .loc 1 132 0
#APP
-# 130 "gdb.arch/amd64-entry-value.cc" 1
+# 132 "gdb.arch/amd64-entry-value.cc" 1
breakhere_reference:
# 0 "" 2
- # gdb.arch/amd64-entry-value.cc:131
- .loc 1 131 0
+ # gdb.arch/amd64-entry-value.cc:133
+ .loc 1 133 0
#NO_APP
movl _ZL1v(%rip), %edi
.LVL50:
jmp _ZL1ei
# SUCC: EXIT [100.0%] (ab,sibcall)
.LVL51:
+.LBE2:
.cfi_endproc
.LFE14:
.size _ZL9referenceRi, .-_ZL9referenceRi
@@ -437,22 +439,22 @@ _ZL9referenceRi:
.type main, @function
main:
.LFB15:
- # gdb.arch/amd64-entry-value.cc:136
- .loc 1 136 0
+ # gdb.arch/amd64-entry-value.cc:138
+ .loc 1 138 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (fallthru)
subq $40, %rsp
.LCFI4:
.cfi_def_cfa_offset 48
-.LBB2:
- # gdb.arch/amd64-entry-value.cc:139
- .loc 1 139 0
+.LBB3:
+ # gdb.arch/amd64-entry-value.cc:141
+ .loc 1 141 0
movl $30, %edi
call _ZL1di
.LVL52:
- # gdb.arch/amd64-entry-value.cc:140
- .loc 1 140 0
+ # gdb.arch/amd64-entry-value.cc:142
+ .loc 1 142 0
movl $6, %r9d
movl $5, %r8d
movl $4, %ecx
@@ -463,27 +465,27 @@ main:
movl $11, (%rsp)
call _ZL9stacktestiiiiiiii
.LVL53:
- # gdb.arch/amd64-entry-value.cc:143
- .loc 1 143 0
+ # gdb.arch/amd64-entry-value.cc:145
+ .loc 1 145 0
leaq 28(%rsp), %rdi
- # gdb.arch/amd64-entry-value.cc:142
- .loc 1 142 0
+ # gdb.arch/amd64-entry-value.cc:144
+ .loc 1 144 0
movl $5, 28(%rsp)
.LVL54:
- # gdb.arch/amd64-entry-value.cc:143
- .loc 1 143 0
- call _ZL9referenceRi
-.LVL55:
# gdb.arch/amd64-entry-value.cc:145
.loc 1 145 0
+ call _ZL9referenceRi
+.LVL55:
+ # gdb.arch/amd64-entry-value.cc:147
+ .loc 1 147 0
movl _ZL1v(%rip), %eax
testl %eax, %eax
# SUCC: 5 [39.0%] (can_fallthru) 3 [61.0%] (fallthru,can_fallthru)
jne .L24
# BLOCK 3 freq:6100 seq:1
# PRED: 2 [61.0%] (fallthru,can_fallthru)
- # gdb.arch/amd64-entry-value.cc:148
- .loc 1 148 0
+ # gdb.arch/amd64-entry-value.cc:150
+ .loc 1 150 0
movl $5, %edi
call _ZL1bi
# SUCC: 4 [100.0%] (fallthru,can_fallthru)
@@ -491,19 +493,19 @@ main:
# BLOCK 4 freq:10000 seq:2
# PRED: 3 [100.0%] (fallthru,can_fallthru) 5 [100.0%]
.L23:
- # gdb.arch/amd64-entry-value.cc:149
- .loc 1 149 0
+ # gdb.arch/amd64-entry-value.cc:151
+ .loc 1 151 0
movl $100, %edi
call _ZL5amb_ai
.LVL57:
- # gdb.arch/amd64-entry-value.cc:150
- .loc 1 150 0
+ # gdb.arch/amd64-entry-value.cc:152
+ .loc 1 152 0
movl $200, %edi
call _ZL4selfi
.LVL58:
-.LBE2:
- # gdb.arch/amd64-entry-value.cc:152
- .loc 1 152 0
+.LBE3:
+ # gdb.arch/amd64-entry-value.cc:154
+ .loc 1 154 0
xorl %eax, %eax
addq $40, %rsp
.LCFI5:
@@ -516,15 +518,15 @@ main:
.L24:
.LCFI6:
.cfi_restore_state
-.LBB3:
- # gdb.arch/amd64-entry-value.cc:146
- .loc 1 146 0
+.LBB4:
+ # gdb.arch/amd64-entry-value.cc:148
+ .loc 1 148 0
movl $1, %edi
call _ZL1ai
.LVL59:
# SUCC: 4 [100.0%]
jmp .L23
-.LBE3:
+.LBE4:
.cfi_endproc
.LFE15:
.size main, .-main
@@ -534,15 +536,15 @@ main:
.Letext0:
.section .debug_info,"",@progbits
.Ldebug_info0:
- .long 0x5ff # Length of Compilation Unit Info
+ .long 0x624 # Length of Compilation Unit Info
.value 0x2 # DWARF version number
.long .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x8 # Pointer Size (in bytes)
.uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
- .long .LASF11 # DW_AT_producer: "GNU C++ 4.7.0 20110709 (experimental)"
+ .long .LASF12 # DW_AT_producer: "GNU C++ 4.7.0 20110711 (experimental)"
.byte 0x4 # DW_AT_language
- .long .LASF12 # DW_AT_name: "gdb.arch/amd64-entry-value.cc"
- .long .LASF13 # DW_AT_comp_dir: ""
+ .long .LASF13 # DW_AT_name: "gdb.arch/amd64-entry-value.cc"
+ .long .LASF14 # DW_AT_comp_dir: ""
.long .Ldebug_ranges0+0x30 # DW_AT_ranges
.quad 0 # DW_AT_low_pc
.quad 0 # DW_AT_entry_pc
@@ -1066,106 +1068,123 @@ main:
.byte 0x77 # DW_OP_breg7
.sleb128 8
.byte 0x1 # DW_AT_GNU_all_call_sites
- .long 0x4de # DW_AT_sibling
+ .long 0x503 # DW_AT_sibling
.uleb128 0xe # (DIE (0x4c0) DW_TAG_formal_parameter)
.long .LASF9 # DW_AT_name: "refparam"
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.cc)
.byte 0x7f # DW_AT_decl_line
- .long 0x4de # DW_AT_type
+ .long 0x503 # DW_AT_type
.long .LLST21 # DW_AT_location
- .uleb128 0x9 # (DIE (0x4cf) DW_TAG_GNU_call_site)
+ .uleb128 0xf # (DIE (0x4cf) DW_TAG_lexical_block)
+ .quad .LBB2 # DW_AT_low_pc
+ .quad .LBE2 # DW_AT_high_pc
+ .uleb128 0x10 # (DIE (0x4e0) DW_TAG_variable)
+ .long .LASF10 # DW_AT_name: "refcopy"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.cc)
+ .byte 0x81 # DW_AT_decl_line
+ .long 0x5a # DW_AT_type
+ .byte 0x7 # DW_AT_location
+ .byte 0xf3 # DW_OP_GNU_entry_value
+ .uleb128 0x4
+ .byte 0x75 # DW_OP_breg5
+ .sleb128 0
+ .byte 0x94 # DW_OP_deref_size
+ .byte 0x4
+ .byte 0x9f # DW_OP_stack_value
+ .uleb128 0x9 # (DIE (0x4f3) DW_TAG_GNU_call_site)
.quad .LVL51 # DW_AT_low_pc
.byte 0x1 # DW_AT_GNU_tail_call
.long 0x31 # DW_AT_abstract_origin
+ .byte 0 # end of children of DIE 0x4cf
.byte 0 # end of children of DIE 0x4a1
- .uleb128 0xf # (DIE (0x4de) DW_TAG_const_type)
- .long 0x4e3 # DW_AT_type
- .uleb128 0x10 # (DIE (0x4e3) DW_TAG_reference_type)
+ .uleb128 0x11 # (DIE (0x503) DW_TAG_const_type)
+ .long 0x508 # DW_AT_type
+ .uleb128 0x12 # (DIE (0x508) DW_TAG_reference_type)
.byte 0x8 # DW_AT_byte_size
.long 0x5a # DW_AT_type
- .uleb128 0x11 # (DIE (0x4e9) DW_TAG_subprogram)
+ .uleb128 0x13 # (DIE (0x50e) DW_TAG_subprogram)
.byte 0x1 # DW_AT_external
- .long .LASF14 # DW_AT_name: "main"
+ .long .LASF15 # DW_AT_name: "main"
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.cc)
- .byte 0x87 # DW_AT_decl_line
+ .byte 0x89 # DW_AT_decl_line
.long 0x5a # DW_AT_type
.quad .LFB15 # DW_AT_low_pc
.quad .LFE15 # DW_AT_high_pc
.long .LLST22 # DW_AT_frame_base
.byte 0x1 # DW_AT_GNU_all_call_sites
- .long 0x5ea # DW_AT_sibling
- .uleb128 0x12 # (DIE (0x50e) DW_TAG_lexical_block)
+ .long 0x60f # DW_AT_sibling
+ .uleb128 0x14 # (DIE (0x533) DW_TAG_lexical_block)
.long .Ldebug_ranges0+0 # DW_AT_ranges
- .uleb128 0x13 # (DIE (0x513) DW_TAG_variable)
- .long .LASF10 # DW_AT_name: "refvar"
+ .uleb128 0x10 # (DIE (0x538) DW_TAG_variable)
+ .long .LASF11 # DW_AT_name: "refvar"
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.cc)
- .byte 0x89 # DW_AT_decl_line
+ .byte 0x8b # DW_AT_decl_line
.long 0x5a # DW_AT_type
.byte 0x2 # DW_AT_location
.byte 0x91 # DW_OP_fbreg
.sleb128 -20
- .uleb128 0x6 # (DIE (0x521) DW_TAG_GNU_call_site)
+ .uleb128 0x6 # (DIE (0x546) DW_TAG_GNU_call_site)
.quad .LVL52 # DW_AT_low_pc
.long 0x61 # DW_AT_abstract_origin
- .long 0x538 # DW_AT_sibling
- .uleb128 0x7 # (DIE (0x532) DW_TAG_GNU_call_site_parameter)
+ .long 0x55d # DW_AT_sibling
+ .uleb128 0x7 # (DIE (0x557) DW_TAG_GNU_call_site_parameter)
.byte 0x1 # DW_AT_location
.byte 0x55 # DW_OP_reg5
.byte 0x1 # DW_AT_GNU_call_site_value
.byte 0x4e # DW_OP_lit30
- .byte 0 # end of children of DIE 0x521
- .uleb128 0x6 # (DIE (0x538) DW_TAG_GNU_call_site)
+ .byte 0 # end of children of DIE 0x546
+ .uleb128 0x6 # (DIE (0x55d) DW_TAG_GNU_call_site)
.quad .LVL53 # DW_AT_low_pc
.long 0x3f6 # DW_AT_abstract_origin
- .long 0x574 # DW_AT_sibling
- .uleb128 0x7 # (DIE (0x549) DW_TAG_GNU_call_site_parameter)
+ .long 0x599 # DW_AT_sibling
+ .uleb128 0x7 # (DIE (0x56e) DW_TAG_GNU_call_site_parameter)
.byte 0x1 # DW_AT_location
.byte 0x55 # DW_OP_reg5
.byte 0x1 # DW_AT_GNU_call_site_value
.byte 0x31 # DW_OP_lit1
- .uleb128 0x7 # (DIE (0x54e) DW_TAG_GNU_call_site_parameter)
+ .uleb128 0x7 # (DIE (0x573) DW_TAG_GNU_call_site_parameter)
.byte 0x1 # DW_AT_location
.byte 0x54 # DW_OP_reg4
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-07-11 11:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 11:55 [SCM] archer-jankratochvil-entryval: more entryval kinds jkratoch
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).