]>
sourceware.org Git - systemtap.git/blob - loc2c.h
1 #include <elfutils/libdw.h>
3 struct obstack
; /* Use <obstack.h> */
4 struct location
; /* Opaque */
6 /* G++ 3.3 doesn't seem to like the __attribute__ constructs below. */
7 #if (__GNUG__ == 3) && (__GNUC_MINOR__ == 3)
8 #define __attribute__(x) /* nothing */
11 /* Translate a C fragment for the location expression, using *INPUT
12 as the starting location, begin from scratch if *INPUT is null.
13 If DW_OP_fbreg is used, it may have a subfragment computing from
14 the FB_ATTR location expression. The call_frame might need to be
15 calculated by the cfa_ops for the given pc_address. If known the
16 locattr provides the attribute from which the locexpr array was
19 On errors, call FAIL, which should not return. Any later errors will use
20 FAIL and FAIL_ARG from the first c_translate_location call.
22 On success, return the first fragment created, which is also chained
23 onto (*INPUT)->next. *INPUT is then updated with the new tail of that
25 struct location
*c_translate_location (struct obstack
*,
26 void (*fail
) (void *arg
,
28 __attribute__ ((noreturn
,
29 format (printf
, 2, 3))),
31 void (*emit_address
) (void *fail_arg
,
36 Dwarf_Addr pc_address
,
37 Dwarf_Attribute
*attr
,
38 const Dwarf_Op
*locexpr
,
40 struct location
**input
,
41 Dwarf_Attribute
*fb_attr
,
42 const Dwarf_Op
*cfa_ops
);
44 /* Translate a fragment for a compile-time constant from DW_AT_const_value.
46 struct location
*c_translate_constant (struct obstack
*,
47 void (*fail
) (void *arg
,
49 __attribute__ ((noreturn
,
50 format (printf
, 2, 3))),
52 void (*emit_address
) (void *fail_arg
,
55 int indent
, Dwarf_Addr dwbias
,
56 Dwarf_Attribute
*attr
);
58 /* Translate a fragment to dereference the given DW_TAG_pointer_type DIE,
59 where *INPUT is the location of the pointer with that type. */
60 void c_translate_pointer (struct obstack
*pool
, int indent
,
61 Dwarf_Addr dwbias
, Dwarf_Die
*typedie
,
62 struct location
**input
);
64 /* Translate a fragment to index a DW_TAG_array_type DIE (turning the location
65 of the array into the location of an element). If IDX is non-null,
66 it's a string of C code to emit in the fragment as the array index.
67 If the index is a known constant, IDX should be null and CONST_IDX
68 is used instead (this case can handle local arrays in registers). */
69 void c_translate_array (struct obstack
*pool
, int indent
,
70 Dwarf_Addr dwbias
, Dwarf_Die
*typedie
,
71 struct location
**input
,
72 const char *idx
, Dwarf_Word const_idx
);
74 /* Translate a pointer as if it were an array, for cases where we have an
75 address and pointee type DIE, but perhaps don't have a pointer DIE. */
76 void c_translate_array_pointer (struct obstack
*pool
, int indent
,
77 Dwarf_Die
*typedie
, struct location
**input
,
78 const char *idx
, Dwarf_Word const_idx
);
80 /* Translate a fragment to compute the address of the input location
81 and assign it to the variable TARGET. This doesn't really do anything
82 (it always emits "TARGET = addr;"), but it will barf if the location
83 is a register or noncontiguous object. */
84 void c_translate_addressof (struct obstack
*pool
, int indent
,
85 Dwarf_Addr dwbias
, Dwarf_Die
*die
,
87 struct location
**input
, const char *target
);
89 /* Translate a fragment to fetch the value of variable or member DIE
90 at the *INPUT location and store it in lvalue TARGET.
91 This handles base integer types and bit fields, i.e. DW_TAG_base_type. */
92 void c_translate_fetch (struct obstack
*pool
, int indent
,
93 Dwarf_Addr dwbias
__attribute__ ((unused
)),
94 Dwarf_Die
*die
, Dwarf_Die
*typedie
,
95 struct location
**input
, const char *target
);
97 /* Translate a fragment to locate the value of variable or member DIE
98 at the *INPUT location and set it to the C expression RVALUE.
99 This handles base integer types and bit fields, i.e. DW_TAG_base_type. */
100 void c_translate_store (struct obstack
*pool
, int indent
,
101 Dwarf_Addr dwbias
__attribute__ ((unused
)),
102 Dwarf_Die
*die
, Dwarf_Die
*typedie
,
103 struct location
**input
, const char *rvalue
);
105 /* Translate a fragment to write the given pointer value,
106 where *INPUT is the location of the pointer with that type. */
108 c_translate_pointer_store (struct obstack
*pool
, int indent
,
109 Dwarf_Addr dwbias
__attribute__ ((unused
)),
110 Dwarf_Die
*typedie
, struct location
**input
,
113 /* Translate a C fragment for a direct argument VALUE. On errors, call FAIL,
114 which should not return. Any later errors will use FAIL and FAIL_ARG from
115 this translate call. On success, return the fragment created. */
116 struct location
*c_translate_argument (struct obstack
*,
117 void (*fail
) (void *arg
,
118 const char *fmt
, ...)
119 __attribute__ ((noreturn
,
120 format (printf
, 2, 3))),
122 void (*emit_address
) (void *fail_arg
,
125 int indent
, const char *value
);
129 /* Emit the C fragment built up at LOC (i.e., the return value from the
130 first c_translate_location call made). INDENT should match that
131 passed to c_translate_* previously.
133 Writes complete lines of C99, code forming a complete C block, to STREAM.
134 Return value is true iff that code uses the `deref' runtime macros. */
135 bool c_emit_location (FILE *stream
, struct location
*loc
, int indent
,
136 unsigned int *max_stack
);
138 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.04241 seconds and 5 git commands to generate.