From: Zoran Zaric Date: Mon, 7 Dec 2020 19:00:25 +0000 (+0000) Subject: Move read_addr_from_reg function to frame.c X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a014570ffbf65e1e84dd392ac6ce2122840bf41;p=thirdparty%2Fbinutils-gdb.git Move read_addr_from_reg function to frame.c read_addr_from_reg function is now only called from frame.c file, this means that the function can safely be moved there. gdb/ChangeLog: * dwarf2/expr.c (read_addr_from_reg): Move function to frame.c. * dwarf2/expr.h (read_addr_from_reg): Remove function. * dwarf2/frame.c (read_addr_from_reg): Add function from expr.c. Change-Id: I15c798d3e001f56cfd78a1e96dd0d6034c844b91 --- diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index a259f5d5d5c..9f2c77197a6 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -97,17 +97,6 @@ ill_formed_expression () error (_("Ill-formed DWARF expression")); } -/* See expr.h. */ - -CORE_ADDR -read_addr_from_reg (struct frame_info *frame, int reg) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg); - - return address_from_register (regnum, frame); -} - /* Read register REGNUM's contents in a given FRAME context. The data read is offsetted by OFFSET, and the number of bytes read diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index 5fb4b0857e9..63fe7899394 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -51,10 +51,6 @@ struct value *dwarf2_eval_exp (const gdb_byte *addr, size_t len, bool as_lval, ADDR_SIZE is expected size of the type. */ struct type *address_type (struct gdbarch *gdbarch, int addr_size); -/* Return the value of register number REG (a DWARF register number), - read as an address in a given FRAME. */ -CORE_ADDR read_addr_from_reg (struct frame_info *, int); - /* Check that the current operator is either at the end of an expression, or that it is followed by a composition operator or by DW_OP_GNU_uninit (which should terminate the expression). */ diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index dd4eca9aac6..1469621133f 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -192,6 +192,18 @@ dwarf2_frame_state::dwarf2_frame_state (CORE_ADDR pc_, struct dwarf2_cie *cie) { } +/* Return the value of register number REG (a DWARF register number), + read as an address in a given FRAME. */ + +static CORE_ADDR +read_addr_from_reg (struct frame_info *frame, int reg) +{ + struct gdbarch *gdbarch = get_frame_arch (frame); + int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg); + + return address_from_register (regnum, frame); +} + /* Execute the required actions for both the DW_CFA_restore and DW_CFA_restore_extended instructions. */ static void