aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2-frame.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-07-15 20:54:32 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-07-15 20:54:32 +0000
commit9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58 (patch)
tree7df265b8f00f013025d31216b505e3e2fe7a21b8 /gdb/dwarf2-frame.c
parente9ea266294fcba2548c9b30d8229b1b430d45eee (diff)
downloadgdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.zip
gdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.tar.gz
gdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.tar.bz2
gdb/
Code cleanup. * dwarf2-frame.c (dwarf2_frame_ctx_funcs): New. (execute_stack_op): Use dwarf2_frame_ctx_funcs * dwarf2expr.c (dwarf_get_base_type): Access get_base_type via funcs. (execute_stack_op): Access read_reg, get_frame_base, read_mem, get_frame_cfa, get_tls_address and dwarf_call via funcs. * dwarf2expr.h (struct dwarf_expr_context): New forward declaration. (struct dwarf_expr_context_funcs): New, move here methods from ... (struct dwarf_expr_context): ... here. New fields funcs. * dwarf2loc.c (dwarf_expr_dwarf_call): Access get_frame_pc via funcs. (dwarf_expr_ctx_funcs): New. (dwarf2_evaluate_loc_desc_full): Use dwarf_expr_ctx_funcs. (needs_frame_dwarf_call): Access get_frame_pc via funcs. (needs_frame_ctx_funcs): New. (dwarf2_loc_desc_needs_frame): Use needs_frame_ctx_funcs.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r--gdb/dwarf2-frame.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 4791592..3d031f3 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -391,6 +391,20 @@ register %s (#%d) at %s"),
paddress (gdbarch, fs->pc));
}
+/* Virtual method table for execute_stack_op below. */
+
+static const struct dwarf_expr_context_funcs dwarf2_frame_ctx_funcs =
+{
+ read_reg,
+ read_mem,
+ no_get_frame_base,
+ no_get_frame_cfa,
+ no_get_frame_pc,
+ no_get_tls_address,
+ no_dwarf_call,
+ no_base_type
+};
+
static CORE_ADDR
execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
CORE_ADDR offset, struct frame_info *this_frame,
@@ -408,14 +422,7 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
ctx->addr_size = addr_size;
ctx->offset = offset;
ctx->baton = this_frame;
- ctx->read_reg = read_reg;
- ctx->read_mem = read_mem;
- ctx->get_frame_base = no_get_frame_base;
- ctx->get_frame_cfa = no_get_frame_cfa;
- ctx->get_frame_pc = no_get_frame_pc;
- ctx->get_tls_address = no_get_tls_address;
- ctx->dwarf_call = no_dwarf_call;
- ctx->get_base_type = no_base_type;
+ ctx->funcs = &dwarf2_frame_ctx_funcs;
dwarf_expr_push_address (ctx, initial, initial_in_stack_memory);
dwarf_expr_eval (ctx, exp, len);