From 55be5ef5064e87136980febf6241be046ceabda8 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Wed, 2 Dec 1998 23:22:58 +0000 Subject: Wed Dec 2 15:11:38 1998 Michael Snyder * tracepoint.c: Move default definition of TARGET_VIRTUAL_FRAME_POINTER from here to target.h. * target.h: Add default definition of TARGET_VIRTUAL_FRAME_POINTER. * ax-gdb.c (gen_frame_args_address, gen_frame_locals_address): use TARGET_VIRTUAL_FRAME_POINTER to determine frame pointer. (gen_trace_for_expr): new argument, address of tracepoint, gets passed to new_agent_expr and added to struct agent_expr. (is_nontrivial_conversion): call to new_agent_expr now requires a dummy argument. (agent_command): use get_current_frame() to get current PC scope; pass it to gen_trace_for_expr. * ax-general.c (new_agent_expr): new argument, address of tracepoint; store it in new field of struct agent_expr. * ax.h (struct agent_expr): add new field for tracepoint address. * ax-gdb.h: change prototypes to match above changes. --- gdb/ChangeLog | 22 ++++++++++++++++++++++ gdb/ax-gdb.c | 33 ++++++++++++++++++++++----------- gdb/tracepoint.c | 22 +++++----------------- 3 files changed, 49 insertions(+), 28 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9edd842..959e85d5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Wed Dec 2 15:11:38 1998 Michael Snyder + + * tracepoint.c: Move default definition of + TARGET_VIRTUAL_FRAME_POINTER from here to target.h. + * target.h: Add default definition of TARGET_VIRTUAL_FRAME_POINTER. + * ax-gdb.c (gen_frame_args_address, gen_frame_locals_address): + use TARGET_VIRTUAL_FRAME_POINTER to determine frame pointer. + (gen_trace_for_expr): new argument, address of tracepoint, + gets passed to new_agent_expr and added to struct agent_expr. + (is_nontrivial_conversion): call to new_agent_expr now requires + a dummy argument. (agent_command): use get_current_frame() to + get current PC scope; pass it to gen_trace_for_expr. + * ax-general.c (new_agent_expr): new argument, address of + tracepoint; store it in new field of struct agent_expr. + * ax.h (struct agent_expr): add new field for tracepoint address. + * ax-gdb.h: change prototypes to match above changes. + +Tue Dec 1 10:59:00 1998 Andrew Cagney + + * ocd.c (remote_timeout), (BDM_BREAKPOINT), monitor.c (readchar), + remote.c: Cleanup closing of open comments. + Mon Nov 30 16:04:03 1998 Doug Evans * config/fr30/tm-fr30.h (INNER_THAN): Add parameters. diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index de6f870..cf2d90e 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "expression.h" #include "command.h" #include "gdbcmd.h" +#include "frame.h" #include "ax.h" #include "ax-gdb.h" @@ -47,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Static forward declarations */ +/* Prototypes for local functions. */ /* There's a standard order to the arguments of these functions: union exp_element ** --- pointer into expression @@ -66,7 +67,7 @@ static void gen_fetch PARAMS ((struct agent_expr *, struct type *)); static void gen_left_shift PARAMS ((struct agent_expr *, int)); -static void gen_frame_args_address PARAMS ((struct agent_expr *)); +static void gen_frame_args_address PARAMS ((struct agent_expr *)); static void gen_frame_locals_address PARAMS ((struct agent_expr *)); static void gen_offset PARAMS ((struct agent_expr *ax, int offset)); static void gen_sym_offset PARAMS ((struct agent_expr *, struct symbol *)); @@ -146,6 +147,7 @@ static void gen_sizeof PARAMS ((union exp_element **pc, static void gen_expr PARAMS ((union exp_element **pc, struct agent_expr *ax, struct axs_value *value)); + static void print_axs_value PARAMS ((GDB_FILE *f, struct axs_value *value)); static void agent_command PARAMS ((char *exp, int from_tty)); @@ -475,8 +477,11 @@ static void gen_frame_args_address (ax) struct agent_expr *ax; { - /* FIXME: I'm sure this is wrong for processors other than the 68k. */ - ax_reg (ax, FP_REGNUM); + long frame_reg, frame_offset; + + TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset); + ax_reg (ax, frame_reg); + gen_offset (ax, frame_offset); } @@ -486,8 +491,11 @@ static void gen_frame_locals_address (ax) struct agent_expr *ax; { - /* FIXME: I'm sure this is wrong for processors other than the 68k. */ - ax_reg (ax, FP_REGNUM); + long frame_reg, frame_offset; + + TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset); + ax_reg (ax, frame_reg); + gen_offset (ax, frame_offset); } @@ -822,7 +830,7 @@ static int is_nontrivial_conversion (from, to) struct type *from, *to; { - struct agent_expr *ax = new_agent_expr (); + struct agent_expr *ax = new_agent_expr (0); int nontrivial; /* Actually generate the code, and see if anything came out. At the @@ -1768,6 +1776,7 @@ gen_expr (pc, ax, value) +#if 0 /* not used */ /* Generating bytecode from GDB expressions: driver */ /* Given a GDB expression EXPR, produce a string of agent bytecode @@ -1820,7 +1829,7 @@ expr_to_address_and_size (expr) return ax; } - +#endif /* 0 */ /* Given a GDB expression EXPR, return bytecode to trace its value. The result will use the `trace' and `trace_quick' bytecodes to @@ -1828,11 +1837,12 @@ expr_to_address_and_size (expr) caller can then use the ax_reqs function to discover which registers it relies upon. */ struct agent_expr * -gen_trace_for_expr (expr) +gen_trace_for_expr (scope, expr) + CORE_ADDR scope; struct expression *expr; { struct cleanup *old_chain = 0; - struct agent_expr *ax = new_agent_expr (); + struct agent_expr *ax = new_agent_expr (scope); union exp_element *pc; struct axs_value value; @@ -1893,6 +1903,7 @@ agent_command (exp, from_tty) struct expression *expr; struct agent_expr *agent; struct agent_reqs reqs; + struct frame_info *fi = get_current_frame (); /* need current scope */ /* We don't deal with overlay debugging at the moment. We need to think more carefully about this. If you copy this code into @@ -1906,7 +1917,7 @@ agent_command (exp, from_tty) expr = parse_expression (exp); old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr); - agent = gen_trace_for_expr (expr); + agent = gen_trace_for_expr (fi->pc, expr); make_cleanup ((make_cleanup_func) free_agent_expr, agent); ax_print (gdb_stdout, agent); ax_reqs (agent, &reqs); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 3b911a8..ff475a1 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -970,7 +970,7 @@ validate_actionline (line, t) /* we have something to collect, make sure that the expr to bytecode translator can handle it and that it's not too long */ - aexpr = gen_trace_for_expr(exp); + aexpr = gen_trace_for_expr (t->address, exp); (void) make_cleanup ((make_cleanup_func) free_agent_expr, aexpr); if (aexpr->len > MAX_AGENT_EXPR_LEN) @@ -1438,18 +1438,6 @@ free_actions_list(actions_list) free(actions_list); } -#ifndef TARGET_VIRTUAL_FRAME_POINTER -/* If anybody else ever uses this macro, then move this - default definition into some global header file such as defs.h. - - FIXME: GDB's whole scheme for dealing with "frames" and - "frame pointers" needs a serious shakedown. - */ - -#define TARGET_VIRTUAL_FRAME_POINTER(ADDR, REGP, OFFP) \ - do { *(REGP) = FP_REGNUM; *(OFFP) = 0; } while (0) -#endif - /* render all actions into gdb protocol */ static void encode_actions (t, tdp_actions, stepping_actions) @@ -1559,7 +1547,7 @@ encode_actions (t, tdp_actions, stepping_actions) break; default: /* full-fledged expression */ - aexpr = gen_trace_for_expr (exp); + aexpr = gen_trace_for_expr (t->address, exp); old_chain1 = make_cleanup ((make_cleanup_func) free_agent_expr, aexpr); @@ -2322,7 +2310,7 @@ scope_info (args, from_tty) struct minimal_symbol *msym; struct block *block; char **canonical, *symname, *save_args = args; - int i, nsyms, count = 0; + int i, j, nsyms, count = 0; if (args == 0 || *args == 0) error ("requires an argument (function, line or *addr) to define a scope"); @@ -2365,9 +2353,9 @@ scope_info (args, from_tty) case LOC_CONST_BYTES: printf_filtered ("constant bytes: "); if (SYMBOL_TYPE (sym)) - for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (sym)); i++) + for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++) fprintf_filtered (gdb_stdout, " %02x", - (unsigned) SYMBOL_VALUE_BYTES (sym) [i]); + (unsigned) SYMBOL_VALUE_BYTES (sym) [j]); break; case LOC_STATIC: printf_filtered ("in static storage at address "); -- cgit v1.1