From patchwork Wed Oct 8 16:57:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 3139 Received: (qmail 4138 invoked by alias); 8 Oct 2014 16:57:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3982 invoked by uid 89); 8 Oct 2014 16:57:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 08 Oct 2014 16:57:28 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s98GvOZB014311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 8 Oct 2014 12:57:24 -0400 Received: from host2.jankratochvil.net (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s98GvIJK014856 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 8 Oct 2014 12:57:21 -0400 Date: Wed, 8 Oct 2014 18:57:18 +0200 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Gary Benson , Eli Zaretskii , dje@google.com, tromey@redhat.com, Pedro Alves Subject: Re: [PATCH v2 10/14] make dwarf_expr_frame_base_1 public Message-ID: <20141008165718.GA17704@host2.jankratochvil.net> References: <1403279874-23781-1-git-send-email-tromey@redhat.com> <1403279874-23781-11-git-send-email-tromey@redhat.com> <20140623081815.GA16611@blade.nx> <83ha3bsmgf.fsf@gnu.org> <20140624101851.GA9726@blade.nx> <53A9772E.5090205@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53A9772E.5090205@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Tue, 24 Jun 2014 15:03:42 +0200, Pedro Alves wrote: > On 06/24/2014 11:18 AM, Gary Benson wrote: > > In any event, I don't think any non-static function should be called > > "_1". > > Yeah, ideally when exporting a function we come up with a clearer name. Updated. Thanks, Jan This exports dwarf_expr_frame_base_1 so that other code can use it. 2014-10-07 Tom Tromey Jan Kratochvil * dwarf2loc.c (dwarf_expr_frame_base_1): Remove declaration. (dwarf_expr_frame_base): Update caller. (dwarf_expr_frame_base_1): Rename to ... (func_get_frame_base_dwarf_block): ... this and make it public. (dwarf2_compile_expr_to_ax, locexpr_describe_location_piece): Update callers. * dwarf2loc.h (func_get_frame_base_dwarf_block): New declaration. --- gdb/ChangeLog | 11 +++++++++++ gdb/dwarf2loc.c | 23 +++++++++++------------ gdb/dwarf2loc.h | 12 ++++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f14e48b..9077fe0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,15 @@ 2014-10-07 Tom Tromey + Jan Kratochvil + + * dwarf2loc.c (dwarf_expr_frame_base_1): Remove declaration. + (dwarf_expr_frame_base): Update caller. + (dwarf_expr_frame_base_1): Rename to ... + (func_get_frame_base_dwarf_block): ... this and make it public. + (dwarf2_compile_expr_to_ax, locexpr_describe_location_piece): Update + callers. + * dwarf2loc.h (func_get_frame_base_dwarf_block): New declaration. + +2014-10-07 Tom Tromey * dwarf2loc.c (dwarf2_compile_expr_to_ax) : Update. diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index b314817..3f51250 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -41,9 +41,6 @@ extern int dwarf2_always_disassemble; -static void dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - const gdb_byte **start, size_t *length); - static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs; static struct value *dwarf2_evaluate_loc_desc_full (struct type *type, @@ -366,9 +363,9 @@ dwarf_expr_frame_base (void *baton, const gdb_byte **start, size_t * length) something has gone wrong. */ gdb_assert (framefunc != NULL); - dwarf_expr_frame_base_1 (framefunc, - get_frame_address_in_block (debaton->frame), - start, length); + func_get_frame_base_dwarf_block (framefunc, + get_frame_address_in_block (debaton->frame), + start, length); } /* Implement find_frame_base_location method for LOC_BLOCK functions using @@ -412,9 +409,11 @@ const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs = loclist_find_frame_base_location }; -static void -dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - const gdb_byte **start, size_t *length) +/* See dwarf2loc.h. */ + +void +func_get_frame_base_dwarf_block (struct symbol *framefunc, CORE_ADDR pc, + const gdb_byte **start, size_t *length) { if (SYMBOL_BLOCK_OPS (framefunc) != NULL) { @@ -3072,8 +3071,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, if (!framefunc) error (_("No function found for block")); - dwarf_expr_frame_base_1 (framefunc, expr->scope, - &datastart, &datalen); + func_get_frame_base_dwarf_block (framefunc, expr->scope, + &datastart, &datalen); op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset); dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart, @@ -3569,7 +3568,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, error (_("No function found for block for symbol \"%s\"."), SYMBOL_PRINT_NAME (symbol)); - dwarf_expr_frame_base_1 (framefunc, addr, &base_data, &base_size); + func_get_frame_base_dwarf_block (framefunc, addr, &base_data, &base_size); if (base_data[0] >= DW_OP_breg0 && base_data[0] <= DW_OP_breg31) { diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index 96925e4..082ccfa 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -80,6 +80,18 @@ extern const gdb_byte *dwarf2_fetch_constant_bytes (sect_offset, struct type *dwarf2_get_die_type (cu_offset die_offset, struct dwarf2_per_cu_data *per_cu); +/* Find the frame base information for FRAMEFUNC at PC. START is an + out parameter which is set to point to the DWARF expression to + compute. LENGTH is an out parameter which is set to the length of + the DWARF expression. This throws an exception on error or if an + expression is not found; the returned length will never be + zero. */ + +extern void func_get_frame_base_dwarf_block (struct symbol *framefunc, + CORE_ADDR pc, + const gdb_byte **start, + size_t *length); + /* Evaluate a location description, starting at DATA and with length SIZE, to find the current location of variable of TYPE in the context of FRAME. */