* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
[deliverable/binutils-gdb.git] / gdb / ax-gdb.h
CommitLineData
c906108c 1/* GDB-specific functions for operating on agent expressions
28e7fd62 2 Copyright (C) 1998-2013 Free Software Foundation, Inc.
c906108c 3
c5aa993b 4 This file is part of GDB.
c906108c 5
c5aa993b
JM
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
c5aa993b 9 (at your option) any later version.
c906108c 10
c5aa993b
JM
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
c906108c 15
c5aa993b 16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c 18
c906108c
SS
19#ifndef AX_GDB_H
20#define AX_GDB_H
da3331ec
AC
21
22struct expression;
c5aa993b 23
c906108c
SS
24/* Types and enums */
25
26/* GDB stores expressions in the form of a flattened tree (struct
27 expression), so we just walk that tree and generate agent bytecodes
28 as we go along.
29
30 GDB's normal evaluation uses struct value, which contains the
31 expression's value as well as its address or the register it came
32 from. The `+' operator uses the value, whereas the unary `&'
33 operator will use the address portion. The `=' operator will use
34 the address or register number of its left hand side.
35
36 The issues are different when generating agent bytecode. Given a
37 variable reference expression, we should not necessarily generate
38 code to fetch its value, because the next operator may be `=' or
39 unary `&'. Instead, when we recurse on a subexpression, we
40 indicate whether we want that expression to produce an lvalue or an
41 rvalue. If we requested an lvalue, then the recursive call tells
42 us whether it generated code to compute an address on the stack, or
43 whether the lvalue lives in a register.
44
45 The `axs' prefix here means `agent expression, static', because
46 this is all static analysis of the expression, i.e. analysis which
47 doesn't depend on the contents of memory and registers. */
48
49
50/* Different kinds of agent expression static values. */
c5aa993b
JM
51enum axs_lvalue_kind
52 {
53 /* We generated code to compute the subexpression's value.
54 Constants and arithmetic operators yield this. */
55 axs_rvalue,
56
57 /* We generated code to yield the subexpression's value's address on
58 the top of the stack. If the caller needs an rvalue, it should
59 call require_rvalue to produce the rvalue from this address. */
60 axs_lvalue_memory,
61
62 /* We didn't generate any code, and the stack is undisturbed,
63 because the subexpression's value lives in a register; u.reg is
64 the register number. If the caller needs an rvalue, it should
65 call require_rvalue to produce the rvalue from this register
66 number. */
67 axs_lvalue_register
68 };
c906108c
SS
69
70/* Structure describing what we got from a subexpression. Think of
71 this as parallel to value.h's enum lval_type, except that we're
72 describing a value which will exist when the expression is
73 evaluated in the future, not a value we have in our hand. */
c5aa993b
JM
74struct axs_value
75 {
76 enum axs_lvalue_kind kind; /* see above */
77
78 /* The type of the subexpression. Even if lvalue == axs_lvalue_memory,
79 this is the type of the value itself; the value on the stack is a
0e2de366 80 "pointer to" an object of this type. */
c5aa993b
JM
81 struct type *type;
82
400c6af0
SS
83 /* If nonzero, this is a variable which does not actually exist in
84 the program. */
85 char optimized_out;
86
c5aa993b
JM
87 union
88 {
89 /* if kind == axs_lvalue_register, this is the register number */
90 int reg;
91 }
92 u;
93 };
c906108c 94\f
c5aa993b 95
c906108c
SS
96/* Translating GDB expressions into agent expressions. */
97
c906108c
SS
98/* Given a GDB expression EXPR, return bytecode to trace its value.
99 The result will use the `trace' and `trace_quick' bytecodes to
100 record the value of all memory touched by the expression, and leave
101 no values on the stack. The caller can then use the ax_reqs
102 function to discover which registers the expression uses. */
92bc6a20
TT
103extern struct agent_expr *gen_trace_for_expr (CORE_ADDR, struct expression *,
104 int);
c906108c 105
400c6af0 106extern struct agent_expr *gen_trace_for_var (CORE_ADDR, struct gdbarch *,
92bc6a20 107 struct symbol *, int);
0936ad1d 108
6710bf39 109extern struct agent_expr *gen_trace_for_return_address (CORE_ADDR,
92bc6a20
TT
110 struct gdbarch *,
111 int);
6710bf39 112
782b2b07
SS
113extern struct agent_expr *gen_eval_for_expr (CORE_ADDR, struct expression *);
114
55aa24fb
SDJ
115extern void gen_expr (struct expression *exp, union exp_element **pc,
116 struct agent_expr *ax, struct axs_value *value);
117
118extern void require_rvalue (struct agent_expr *ax, struct axs_value *value);
119
d3ce09f5
SS
120struct format_piece;
121extern struct agent_expr *gen_printf (CORE_ADDR, struct gdbarch *,
741d92cf 122 CORE_ADDR, LONGEST, const char *, int,
d3ce09f5
SS
123 struct format_piece *,
124 int, struct expression **);
125
c906108c 126#endif /* AX_GDB_H */
This page took 0.966099 seconds and 4 git commands to generate.