From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32766 invoked by alias); 16 Nov 2013 03:51:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32755 invoked by uid 89); 16 Nov 2013 03:51:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from Unknown (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 16 Nov 2013 03:51:09 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D703E11656B; Fri, 15 Nov 2013 22:51:33 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TytYidmzlrDn; Fri, 15 Nov 2013 22:51:33 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 70A95116569; Fri, 15 Nov 2013 22:51:32 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 1E2D0E13D2; Sat, 16 Nov 2013 07:50:56 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pedro Alves Subject: [RFA] Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs Date: Sat, 16 Nov 2013 05:46:00 -0000 Message-Id: <1384573853-25378-1-git-send-email-brobecker@adacore.com> In-Reply-To: <5286326C.8010204@redhat.com> References: <5286326C.8010204@redhat.com> X-SW-Source: 2013-11/txt/msg00437.txt.bz2 Hello, This implements the suggestion discussed at: http://www.sourceware.org/ml/gdb-patches/2013-11/msg00412.html ~~~ This is to help make it slightly clearer how this method is expected to extract data from the given register. gdb/ChangeLog: * dwarf2expr.h (struct dwarf_expr_context_funcs) : Renames "read_reg". * dwarf2-frame.c (read_addr_from_reg): Renames "read_reg". Adjust comment. (dwarf2_frame_ctx_funcs, execute_stack_op, dwarf2_frame_cache): Use read_addr_from_reg in place of read_reg. * dwarf2expr.c (execute_stack_op): Use read_addr_from_reg in place of read_reg. * dwarf2loc.c (dwarf_expr_read_addr_from_reg): Renames dwarf_expr_read_reg. (dwarf_expr_ctx_funcs): Replace dwarf_expr_read_reg with dwarf_expr_read_addr_from_reg. (needs_frame_read_addr_from_reg): Renames needs_frame_read_reg. (needs_frame_ctx_funcs): Replace needs_frame_read_reg with needs_frame_read_addr_from_reg. Tested on x86_64-linux. OK to commit? Thank you, -- Joel --- gdb/dwarf2-frame.c | 13 +++++++------ gdb/dwarf2expr.c | 10 ++++++---- gdb/dwarf2expr.h | 2 +- gdb/dwarf2loc.c | 8 ++++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index b4c943e..c06c556 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -33,7 +33,7 @@ struct dwarf_expr_context_funcs { /* Return the value of register number REGNUM (a DWARF register number), read as an address. */ - CORE_ADDR (*read_reg) (void *baton, int regnum); + CORE_ADDR (*read_addr_from_reg) (void *baton, int regnum); /* Return a value of type TYPE, stored in register number REGNUM of the frame associated to the given BATON. diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index b425d94..b53c015 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -286,7 +286,7 @@ dwarf2_frame_state_free (void *p) /* Helper functions for execute_stack_op. */ static CORE_ADDR -read_reg (void *baton, int reg) +read_addr_from_reg (void *baton, int reg) { struct frame_info *this_frame = (struct frame_info *) baton; struct gdbarch *gdbarch = get_frame_arch (this_frame); @@ -301,8 +301,8 @@ read_reg (void *baton, int reg) /* Convert the register to an integer. This returns a LONGEST rather than a CORE_ADDR, but unpack_pointer does the same thing under the covers, and this makes more sense for non-pointer - registers. Maybe read_reg and the associated interfaces should - deal with "struct value" instead of CORE_ADDR. */ + registers. Maybe read_addr_from_reg and the associated interfaces + should deal with "struct value" instead of CORE_ADDR. */ return unpack_long (register_type (gdbarch, regnum), buf); } @@ -358,7 +358,7 @@ register %s (#%d) at %s"), static const struct dwarf_expr_context_funcs dwarf2_frame_ctx_funcs = { - read_reg, + read_addr_from_reg, get_reg_value, read_mem, ctx_no_get_frame_base, @@ -397,7 +397,8 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, if (ctx->location == DWARF_VALUE_MEMORY) result = dwarf_expr_fetch_address (ctx, 0); else if (ctx->location == DWARF_VALUE_REGISTER) - result = read_reg (this_frame, value_as_long (dwarf_expr_fetch (ctx, 0))); + result = read_addr_from_reg (this_frame, + value_as_long (dwarf_expr_fetch (ctx, 0))); else { /* This is actually invalid DWARF, but if we ever do run across @@ -1110,7 +1111,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) switch (fs->regs.cfa_how) { case CFA_REG_OFFSET: - cache->cfa = read_reg (this_frame, fs->regs.cfa_reg); + cache->cfa = read_addr_from_reg (this_frame, fs->regs.cfa_reg); if (fs->armcc_cfa_offsets_reversed) cache->cfa -= fs->regs.cfa_offset; else diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 25e9dc4..69c08c2 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -921,7 +921,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_breg31: { op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->funcs->read_reg) (ctx->baton, op - DW_OP_breg0); + result = (ctx->funcs->read_addr_from_reg) (ctx->baton, + op - DW_OP_breg0); result += offset; result_val = value_from_ulongest (address_type, result); } @@ -930,7 +931,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, { op_ptr = safe_read_uleb128 (op_ptr, op_end, ®); op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->funcs->read_reg) (ctx->baton, reg); + result = (ctx->funcs->read_addr_from_reg) (ctx->baton, reg); result += offset; result_val = value_from_ulongest (address_type, result); } @@ -955,8 +956,9 @@ execute_stack_op (struct dwarf_expr_context *ctx, if (ctx->location == DWARF_VALUE_MEMORY) result = dwarf_expr_fetch_address (ctx, 0); else if (ctx->location == DWARF_VALUE_REGISTER) - result = (ctx->funcs->read_reg) (ctx->baton, - value_as_long (dwarf_expr_fetch (ctx, 0))); + result = (ctx->funcs->read_addr_from_reg) + (ctx->baton, + value_as_long (dwarf_expr_fetch (ctx, 0))); else error (_("Not implemented: computing frame " "base using explicit value operator")); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 2879ead..1664f6a 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -313,7 +313,7 @@ struct dwarf_expr_baton /* Using the frame specified in BATON, return the value of register REGNUM, treated as a pointer. */ static CORE_ADDR -dwarf_expr_read_reg (void *baton, int dwarf_regnum) +dwarf_expr_read_addr_from_reg (void *baton, int dwarf_regnum) { struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; struct gdbarch *gdbarch = get_frame_arch (debaton->frame); @@ -2194,7 +2194,7 @@ static const struct lval_funcs pieced_value_funcs = { static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = { - dwarf_expr_read_reg, + dwarf_expr_read_addr_from_reg, dwarf_expr_get_reg_value, dwarf_expr_read_mem, dwarf_expr_frame_base, @@ -2441,7 +2441,7 @@ struct needs_frame_baton /* Reads from registers do require a frame. */ static CORE_ADDR -needs_frame_read_reg (void *baton, int regnum) +needs_frame_read_addr_from_reg (void *baton, int regnum) { struct needs_frame_baton *nf_baton = baton; @@ -2541,7 +2541,7 @@ needs_get_addr_index (void *baton, unsigned int index) static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = { - needs_frame_read_reg, + needs_frame_read_addr_from_reg, needs_frame_get_reg_value, needs_frame_read_mem, needs_frame_frame_base, -- 1.8.1.2