diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-05-14 14:30:37 -0600 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-12-12 22:27:31 +0100 |
commit | d064d1bef5c64c3525c01461ecd5be76c5fb0ca7 (patch) | |
tree | abcaef14b57aa2ae0097accbbe8cd1d3221b0de3 /gdb/dwarf2loc.c | |
parent | af945b753559079fe37d61917041f2217d181b86 (diff) | |
download | gdb-d064d1bef5c64c3525c01461ecd5be76c5fb0ca7.zip gdb-d064d1bef5c64c3525c01461ecd5be76c5fb0ca7.tar.gz gdb-d064d1bef5c64c3525c01461ecd5be76c5fb0ca7.tar.bz2 |
export dwarf2_reg_to_regnum_or_error
This exports a utility function, dwarf2_reg_to_regnum_or_error, that
was previously private to dwarf2loc.c.
gdb/ChangeLog
2014-12-12 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2loc.h (dwarf2_reg_to_regnum_or_error): Declare.
* dwarf2loc.c (dwarf2_reg_to_regnum_or_error): Rename from
translate_register. Now public.
(dwarf2_compile_expr_to_ax): Update.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r-- | gdb/dwarf2loc.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 3a62869..8fdb4ca 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2707,14 +2707,10 @@ unimplemented (unsigned int op) op); } -/* A helper function to convert a DWARF register to an arch register. - ARCH is the architecture. - DWARF_REG is the register. - This will throw an exception if the DWARF register cannot be - translated to an architecture register. */ +/* See dwarf2loc.h. */ -static int -translate_register (struct gdbarch *arch, int dwarf_reg) +int +dwarf2_reg_to_regnum_or_error (struct gdbarch *arch, int dwarf_reg) { int reg = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_reg); if (reg == -1) @@ -2965,14 +2961,14 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, case DW_OP_reg30: case DW_OP_reg31: dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx"); - loc->u.reg = translate_register (arch, op - DW_OP_reg0); + loc->u.reg = dwarf2_reg_to_regnum_or_error (arch, op - DW_OP_reg0); loc->kind = axs_lvalue_register; break; case DW_OP_regx: op_ptr = safe_read_uleb128 (op_ptr, op_end, ®); dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx"); - loc->u.reg = translate_register (arch, reg); + loc->u.reg = dwarf2_reg_to_regnum_or_error (arch, reg); loc->kind = axs_lvalue_register; break; @@ -3035,7 +3031,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, case DW_OP_breg30: case DW_OP_breg31: op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset); - i = translate_register (arch, op - DW_OP_breg0); + i = dwarf2_reg_to_regnum_or_error (arch, op - DW_OP_breg0); ax_reg (expr, i); if (offset != 0) { @@ -3047,7 +3043,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, { op_ptr = safe_read_uleb128 (op_ptr, op_end, ®); op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset); - i = translate_register (arch, reg); + i = dwarf2_reg_to_regnum_or_error (arch, reg); ax_reg (expr, i); if (offset != 0) { |