summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2003-02-28 20:03:18 +0000
committerDaniel Jacobowitz <dan@debian.org>2003-02-28 20:03:18 +0000
commite8d91888b3b455fd94b590d43cbc4c97c6002018 (patch)
tree0a781ebdc342f3f8dabf97da4279117405ccca64
parent498ded9ab2fc770c02287e306c3d88573af1e4c7 (diff)
downloadgdb-e8d91888b3b455fd94b590d43cbc4c97c6002018.tar.gz
* Makefile.in (dwarf2loc.o): Update dependencies.
* ax-gdb.c (gen_var_ref): Handle LOC_COMPUTED and LOC_COMPUTED_ARG. * dwarf2expr.c (read_uleb128, read_sleb128): Make non-static. * dwarf2expr.h (read_uleb128, read_sleb128): Add prototypes. * dwarf2loc.c: Include "ax.h" and "ax-gdb.h". (locexpr_tracepoint_var_ref): New function. (dwarf2_locexpr_funcs): Add locexpr_tracepoint_var_ref.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/ax-gdb.c5
-rw-r--r--gdb/dwarf2expr.c4
-rw-r--r--gdb/dwarf2expr.h6
-rw-r--r--gdb/dwarf2loc.c66
6 files changed, 89 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 07f4fba809b..f40b5bf9ad1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2003-02-28 Daniel Jacobowitz <drow@mvista.com>
+
+ * Makefile.in (dwarf2loc.o): Update dependencies.
+ * ax-gdb.c (gen_var_ref): Handle LOC_COMPUTED and LOC_COMPUTED_ARG.
+ * dwarf2expr.c (read_uleb128, read_sleb128): Make non-static.
+ * dwarf2expr.h (read_uleb128, read_sleb128): Add prototypes.
+ * dwarf2loc.c: Include "ax.h" and "ax-gdb.h".
+ (locexpr_tracepoint_var_ref): New function.
+ (dwarf2_locexpr_funcs): Add locexpr_tracepoint_var_ref.
+
2003-02-28 Andrew Cagney <cagney@redhat.com>
* regcache.c (register_size): New function.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 02e160e23cb..c63f2fb69a0 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1640,7 +1640,7 @@ dwarf2expr.o: dwarf2expr.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) \
$(gdbcore_h) $(dwarf2expr_h)
dwarf2loc.o: dwarf2loc.c $(defs_h) $(ui_out_h) $(value_h) $(frame_h) \
$(gdbcore_h) $(target_h) $(inferior_h) $(dwarf2expr_h) \
- $(dwarf2loc_h) $(gdb_string_h)
+ $(dwarf2loc_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h)
dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
$(symfile_h) $(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) \
$(demangle_h) $(expression_h) $(filenames_h) $(macrotab_h) \
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index e5f3048c0bf..253636973d5 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -618,6 +618,11 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
}
break;
+ case LOC_COMPUTED:
+ case LOC_COMPUTED_ARG:
+ (*SYMBOL_LOCATION_FUNCS (var)->tracepoint_var_ref) (var, ax, value);
+ break;
+
case LOC_OPTIMIZED_OUT:
error ("The variable `%s' has been optimized out.",
SYMBOL_PRINT_NAME (var));
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 02e246f6d58..df6fc73ceb7 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -115,7 +115,7 @@ dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
by R, and return the new value of BUF. Verify that it doesn't extend
past BUF_END. */
-static unsigned char *
+unsigned char *
read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r)
{
unsigned shift = 0;
@@ -141,7 +141,7 @@ read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r)
by R, and return the new value of BUF. Verify that it doesn't extend
past BUF_END. */
-static unsigned char *
+unsigned char *
read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r)
{
unsigned shift = 0;
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index e8cc489dcf6..3d0fcb33e7b 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -94,4 +94,10 @@ void dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
size_t len);
CORE_ADDR dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n);
+
+unsigned char *read_uleb128 (unsigned char *buf, unsigned char *buf_end,
+ ULONGEST * r);
+unsigned char *read_sleb128 (unsigned char *buf, unsigned char *buf_end,
+ LONGEST * r);
+
#endif
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 330765d556a..55de8dae74e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -26,6 +26,8 @@
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
+#include "ax.h"
+#include "ax-gdb.h"
#include "elf/dwarf2.h"
#include "dwarf2expr.h"
@@ -277,11 +279,73 @@ locexpr_describe_location (struct symbol *symbol, struct ui_file *stream)
return 1;
}
+
+/* Describe the location of SYMBOL as an agent value in VALUE, generating
+ any necessary bytecode in AX.
+
+ NOTE drow/2003-02-26: This function is extremely minimal, because
+ doing it correctly is extremely complicated and there is no
+ publicly available stub with tracepoint support for me to test
+ against. When there is one this function should be revisited. */
+
+void
+locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
+ struct axs_value * value)
+{
+ struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
+ if (dlbaton->size == 0)
+ error ("Symbol \"%s\" has been optimized out.",
+ SYMBOL_PRINT_NAME (symbol));
+
+ if (dlbaton->size == 1
+ && dlbaton->data[0] >= DW_OP_reg0
+ && dlbaton->data[0] <= DW_OP_reg31)
+ {
+ value->kind = axs_lvalue_register;
+ value->u.reg = dlbaton->data[0] - DW_OP_reg0;
+ }
+ else if (dlbaton->data[0] == DW_OP_regx)
+ {
+ ULONGEST reg;
+ read_uleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
+ &reg);
+ value->kind = axs_lvalue_register;
+ value->u.reg = reg;
+ }
+ else if (dlbaton->data[0] == DW_OP_fbreg)
+ {
+ /* And this is worse than just minimal; we should honor the frame base
+ as above. */
+ int frame_reg;
+ LONGEST frame_offset;
+ unsigned char *buf_end;
+
+ buf_end = read_sleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
+ &frame_offset);
+ if (buf_end != dlbaton->data + dlbaton->size)
+ error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".",
+ SYMBOL_PRINT_NAME (symbol));
+
+ TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
+ ax_reg (ax, frame_reg);
+ ax_const_l (ax, frame_offset);
+ ax_simple (ax, aop_add);
+
+ ax_const_l (ax, frame_offset);
+ ax_simple (ax, aop_add);
+ value->kind = axs_lvalue_memory;
+ }
+ else
+ error ("Unsupported DWARF opcode in the location of \"%s\".",
+ SYMBOL_PRINT_NAME (symbol));
+}
+
/* The set of location functions used with the DWARF-2 expression
evaluator. */
struct location_funcs dwarf2_locexpr_funcs = {
locexpr_read_variable,
locexpr_read_needs_frame,
locexpr_describe_location,
- NULL
+ locexpr_tracepoint_var_ref
};