diff options
author | Tom Tromey <tromey@redhat.com> | 2014-05-14 14:25:01 -0600 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2014-12-12 22:26:57 +0100 |
commit | a8fd55897077beda3717e0672807c1b2940e330a (patch) | |
tree | 5d9eaf4c263980c04f456ca021c7a66f645ed59d /gdb/dwarf2-frame.c | |
parent | ed12ef62ccad3b86e25ec3b042d8bf7f15c75909 (diff) | |
download | gdb-a8fd55897077beda3717e0672807c1b2940e330a.zip gdb-a8fd55897077beda3717e0672807c1b2940e330a.tar.gz gdb-a8fd55897077beda3717e0672807c1b2940e330a.tar.bz2 |
split dwarf2_fetch_cfa_info from dwarf2_compile_expr_to_ax
This removes dwarf2_compile_expr_to_ax, replacing it with a utility
function that fetches the CFA data and adding the code to actually
compile to an agent expression directly into
dwarf2_compile_expr_to_ax. This refactoring lets a later patch reuse
the new dwarf2_fetch_cfa_info.
gdb/ChangeLog
2014-12-12 Tom Tromey <tromey@redhat.com>
* dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_call_frame_cfa>:
Update.
* dwarf2-frame.c (dwarf2_fetch_cfa_info): New function, based on
dwarf2_compile_cfa_to_ax.
(dwarf2_compile_cfa_to_ax): Remove.
* dwarf2-frame.h (dwarf2_fetch_cfa_info): Declare.
(dwarf2_compile_cfa_to_ax): Remove.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r-- | gdb/dwarf2-frame.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 8747f4c..199ccea 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -882,11 +882,15 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs, } -void -dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc, - struct gdbarch *gdbarch, - CORE_ADDR pc, - struct dwarf2_per_cu_data *data) +/* See dwarf2-frame.h. */ + +int +dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc, + struct dwarf2_per_cu_data *data, + int *regnum_out, LONGEST *offset_out, + CORE_ADDR *text_offset_out, + const gdb_byte **cfa_start_out, + const gdb_byte **cfa_end_out) { struct dwarf2_fde *fde; CORE_ADDR text_offset; @@ -932,26 +936,20 @@ dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc, if (regnum == -1) error (_("Unable to access DWARF register number %d"), (int) fs.regs.cfa_reg); /* FIXME */ - ax_reg (expr, regnum); - if (fs.regs.cfa_offset != 0) - { - if (fs.armcc_cfa_offsets_reversed) - ax_const_l (expr, -fs.regs.cfa_offset); - else - ax_const_l (expr, fs.regs.cfa_offset); - ax_simple (expr, aop_add); - } + *regnum_out = regnum; + if (fs.armcc_cfa_offsets_reversed) + *offset_out = -fs.regs.cfa_offset; + else + *offset_out = fs.regs.cfa_offset; + return 1; } - break; case CFA_EXP: - ax_const_l (expr, text_offset); - dwarf2_compile_expr_to_ax (expr, loc, gdbarch, addr_size, - fs.regs.cfa_exp, - fs.regs.cfa_exp + fs.regs.cfa_exp_len, - data); - break; + *text_offset_out = text_offset; + *cfa_start_out = fs.regs.cfa_exp; + *cfa_end_out = fs.regs.cfa_exp + fs.regs.cfa_exp_len; + return 0; default: internal_error (__FILE__, __LINE__, _("Unknown CFA rule.")); |