public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-entryval: full PASS now Date: Thu, 14 Jul 2011 00:23:00 -0000 [thread overview] Message-ID: <20110714002354.1663.qmail@sourceware.org> (raw) The branch, archer-jankratochvil-entryval has been updated via 2b5e6833b8b56703332fea7955f6fd43ec5dfc11 (commit) via c59a3bdd5a7387b565444b21c4c5ba4d270671ad (commit) from 290289dd1b2623b33273ceb69f3e072b4f29f37c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 2b5e6833b8b56703332fea7955f6fd43ec5dfc11 Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Thu Jul 14 02:23:35 2011 +0200 full PASS now commit c59a3bdd5a7387b565444b21c4c5ba4d270671ad Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Wed Jul 13 21:34:17 2011 +0200 Fix DWARF block lifetime. ----------------------------------------------------------------------- Summary of changes: gdb/c-exp.y | 2 +- gdb/dwarf2loc.c | 70 ++++++++++++++++++++++++-- gdb/dwarf2read.c | 46 ++++++++--------- gdb/testsuite/gdb.arch/amd64-entry-value.exp | 21 +++++++- 4 files changed, 106 insertions(+), 33 deletions(-) First 500 lines of diff: diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 5b40002..b4757c2 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -768,7 +768,7 @@ variable: name_not_typename '@' ENTRY if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym) || !symbol_read_needs_frame (sym)) error (_("@entry can be used only for function " - "parameters, not for %s"), + "parameters, not for \"%s\""), copy_name ($1.stoken)); write_exp_elt_opcode (OP_VAR_ENTRY_VALUE); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index bf55eb9..829058b 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -3493,6 +3493,7 @@ value_of_dwarf_reg_entry_value (struct type *type, struct frame_info *frame, struct dwarf2_locexpr_baton *dwarf_block; struct frame_info *caller_frame = get_prev_frame (frame); gdb_byte *data; + struct value *val; dwarf_block = dwarf_expr_dwarf_reg_entry_value (frame, dwarf_reg, fb_offset, deref_size); @@ -3507,6 +3508,67 @@ value_of_dwarf_reg_entry_value (struct type *type, struct frame_info *frame, dwarf_block->size + 1, dwarf_block->per_cu); } +static struct value * +value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame, + int dwarf_reg, CORE_ADDR fb_offset) +{ + struct type *checked_type = check_typedef (type); + struct value *outer_val, *target_val; + volatile struct gdb_exception e; + + outer_val = value_of_dwarf_reg_entry_value (type, frame, dwarf_reg, fb_offset, + -1 /* deref_size */); + + if ((TYPE_CODE (checked_type) == TYPE_CODE_PTR + || TYPE_CODE (checked_type) == TYPE_CODE_REF) + && TYPE_TARGET_TYPE (checked_type) != NULL) + { + struct type *target_type = TYPE_TARGET_TYPE (checked_type); + + TRY_CATCH (e, RETURN_MASK_ERROR) + { + int target_length = TYPE_LENGTH (target_type); + + target_val = value_of_dwarf_reg_entry_value (target_type, frame, + dwarf_reg, fb_offset, + target_length); + } + if (e.reason < 0) + { + if (e.error == NOT_FOUND_ERROR) + { + if (info_verbose) + exception_print (gdb_stdout, e); + } + else + throw_exception (e); + } + else + { + CORE_ADDR addr; + + gdb_assert (VALUE_LVAL (target_val) == not_lval); + gdb_assert (VALUE_LVAL (outer_val) == not_lval); + + /* value_as_address dereferences TYPE_CODE_REF. */ + addr = extract_typed_address (value_contents (outer_val), + checked_type); + + /* This is not fully correct. Instead of a pointer/reference which + would dereference the target entry value we provide an already + dereferenced value with the valid address. It would need new + lval_computed kind to make @entry fully transparent. */ + + VALUE_LVAL (target_val) = lval_memory; + set_value_address (target_val, addr); + + return target_val; + } + } + + return outer_val; +} + /* Read variable by like loclist_read_variable at FRAME's function entry. */ static struct value * @@ -3528,12 +3590,12 @@ loclist_read_variable_at_entry (struct symbol *symbol, struct frame_info *frame) dwarf_reg = dwarf_block_to_dwarf_reg (data, data + size); if (dwarf_reg != -1) - return value_of_dwarf_reg_entry_value (SYMBOL_TYPE (symbol), frame, - dwarf_reg, 0 /* unused */, -1); + return value_of_dwarf_reg_entry (SYMBOL_TYPE (symbol), frame, dwarf_reg, + 0 /* unused */); if (dwarf_block_to_fb_offset (data, data + size, &fb_offset)) - return value_of_dwarf_reg_entry_value (SYMBOL_TYPE (symbol), frame, - -1, fb_offset, -1); + return value_of_dwarf_reg_entry (SYMBOL_TYPE (symbol), frame, -1, + fb_offset); error (_("DWARF-2 expression error: DW_OP_GNU_entry_value is supported only " "for single DW_OP_reg* or for DW_OP_fbreg(*)")); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e9a98f0..2fbc4a4 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6102,6 +6102,21 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) using_directives = new->using_directives; } +static struct dwarf2_locexpr_baton * +dlbaton_obstack_copy (const struct dwarf_block *blk, struct dwarf2_cu *cu) +{ + struct objfile *objfile = cu->objfile; + struct dwarf2_locexpr_baton *dlbaton; + + dlbaton = obstack_alloc (&objfile->objfile_obstack, sizeof (*dlbaton)); + dlbaton->data = obstack_copy (&objfile->objfile_obstack, blk->data, + blk->size); + dlbaton->size = blk->size; + dlbaton->per_cu = cu->per_cu; + + return dlbaton; +} + /* Read in DW_TAG_GNU_call_site's PC and create the block and symbol for it. */ @@ -6205,15 +6220,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) if (!attr || (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0)) /* Keep NULL DWARF_BLOCK. */; else if (attr_form_is_block (attr)) - { - struct dwarf2_locexpr_baton *dlbaton; - - dlbaton = obstack_alloc (&objfile->objfile_obstack, sizeof (*dlbaton)); - dlbaton->data = DW_BLOCK (attr)->data; - dlbaton->size = DW_BLOCK (attr)->size; - dlbaton->per_cu = cu->per_cu; - SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton); - } + SET_FIELD_DWARF_BLOCK (call_site->target, + dlbaton_obstack_copy (DW_BLOCK (attr), cu)); else if (is_ref_attr (attr)) { struct objfile *objfile = cu->objfile; @@ -6308,14 +6316,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) "DW_FORM_block* DW_AT_GNU_call_site_value"), child_die->offset); else - { - dlbaton = obstack_alloc (&objfile->objfile_obstack, - sizeof (*dlbaton)); - dlbaton->data = DW_BLOCK (attr)->data; - dlbaton->size = DW_BLOCK (attr)->size; - dlbaton->per_cu = cu->per_cu; - parameter->call_site_value = dlbaton; - } + parameter->call_site_value = dlbaton_obstack_copy (DW_BLOCK (attr), + cu); } attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu); @@ -6327,14 +6329,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"), child_die->offset, cu->objfile->name); else - { - dlbaton = obstack_alloc (&objfile->objfile_obstack, - sizeof (*dlbaton)); - dlbaton->data = DW_BLOCK (attr)->data; - dlbaton->size = DW_BLOCK (attr)->size; - dlbaton->per_cu = cu->per_cu; - parameter->call_site_data_value = dlbaton; - } + parameter->call_site_data_value + = dlbaton_obstack_copy (DW_BLOCK (attr), cu); } if (parameter->call_site_value == NULL diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index 9cdb12e..e19d931 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -68,10 +68,25 @@ gdb_test "p s2@entry" " = 12" "entry_stack: p s2@entry" gdb_continue_to_breakpoint "entry_reference: breakhere_reference" # (gdb) bt full -# FIXME +# #0 reference (refparam=@0x7fffffffdc3c) at gdb.arch/amd64-entry-value.cc:133 +# refcopy = 5 +# #1 0x0000000000400424 in main () at gdb.arch/amd64-entry-value.cc:145 +# refvar = 10 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 "ptype refparam" " = int &" + +set test "entry_reference: p refparam" +set addr "" +gdb_test_multiple "p refparam" $test { + -re " = \\(int &\\) @(0x\[0-9a-f\]+): 10\r\n$gdb_prompt $" { + set addr $expect_out(1,string) + pass $test + } +} + +gdb_test "ptype refparam@entry" " = int" +gdb_test "p refparam@entry" " = 5" "entry_reference: p refparam@entry" +gdb_test "p &refparam@entry" " = \\(int \\*\\) $addr" "entry_reference: p &refparam@entry" gdb_test "p refcopy" " = 5" "entry_reference: p refcopy" hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2011-07-14 0:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110714002354.1663.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).