aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-09-02 14:53:57 +0000
committerTom Tromey <tromey@redhat.com>2009-09-02 14:53:57 +0000
commite78022079ce4c50f042bb5287665a4f38704a71b (patch)
tree76c5d22b601a7a3ab15067483733204fe114f9db /gdb/dwarf2loc.c
parentd34089166b3e7b60151752997db33c3f28016349 (diff)
downloadgdb-e78022079ce4c50f042bb5287665a4f38704a71b.zip
gdb-e78022079ce4c50f042bb5287665a4f38704a71b.tar.gz
gdb-e78022079ce4c50f042bb5287665a4f38704a71b.tar.bz2
gdb
* frame.h (frame_unwinder_is): Declare. * frame.c (frame_unwinder_is): New function. * dwarf2loc.c: Include dwarf2-frame.h. (dwarf_expr_frame_cfa): New function. (dwarf2_evaluate_loc_desc): Use it. (needs_frame_frame_cfa): New function. (dwarf2_loc_desc_needs_frame): Use it. * dwarf2expr.h (struct dwarf_expr_context) <get_frame_cfa>: New field. * dwarf2expr.c (execute_stack_op) <DW_OP_call_frame_cfa>: New case. * dwarf2-frame.h (dwarf2_frame_cfa): Declare. * dwarf2-frame.c (no_get_frame_cfa): New function. (execute_stack_op): Use it. (dwarf2_frame_cfa): New function. gdb/testsuite * gdb.dwarf2/callframecfa.exp: New file. * gdb.dwarf2/callframecfa.S: New file.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index b6c9b11..dc150a7 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -36,6 +36,7 @@
#include "dwarf2.h"
#include "dwarf2expr.h"
#include "dwarf2loc.h"
+#include "dwarf2-frame.h"
#include "gdb_string.h"
#include "gdb_assert.h"
@@ -194,6 +195,16 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length)
SYMBOL_NATURAL_NAME (framefunc));
}
+/* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for
+ the frame in BATON. */
+
+static CORE_ADDR
+dwarf_expr_frame_cfa (void *baton)
+{
+ struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+ return dwarf2_frame_cfa (debaton->frame);
+}
+
/* Using the objfile specified in BATON, find the address for the
current thread's thread-local storage with offset OFFSET. */
static CORE_ADDR
@@ -237,6 +248,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
ctx->read_reg = dwarf_expr_read_reg;
ctx->read_mem = dwarf_expr_read_mem;
ctx->get_frame_base = dwarf_expr_frame_base;
+ ctx->get_frame_cfa = dwarf_expr_frame_cfa;
ctx->get_tls_address = dwarf_expr_tls_address;
dwarf_expr_eval (ctx, data, size);
@@ -331,6 +343,16 @@ needs_frame_frame_base (void *baton, gdb_byte **start, size_t * length)
nf_baton->needs_frame = 1;
}
+/* CFA accesses require a frame. */
+
+static CORE_ADDR
+needs_frame_frame_cfa (void *baton)
+{
+ struct needs_frame_baton *nf_baton = baton;
+ nf_baton->needs_frame = 1;
+ return 1;
+}
+
/* Thread-local accesses do require a frame. */
static CORE_ADDR
needs_frame_tls_address (void *baton, CORE_ADDR offset)
@@ -363,6 +385,7 @@ dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size,
ctx->read_reg = needs_frame_read_reg;
ctx->read_mem = needs_frame_read_mem;
ctx->get_frame_base = needs_frame_frame_base;
+ ctx->get_frame_cfa = needs_frame_frame_cfa;
ctx->get_tls_address = needs_frame_tls_address;
dwarf_expr_eval (ctx, data, size);