blob: 15d892801482bc87fe30cf43a33d1ca6ea625f15 [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001#include <libdw.h>
2
3struct obstack; /* Use <obstack.h> */
4struct location; /* Opaque */
5
6
7/* Translate a C fragment for the location expression, using *INPUT
8 as the starting location, begin from scratch if *INPUT is null.
9 If DW_OP_fbreg is used, it may have a subfragment computing from
10 the FB_ATTR location expression.
11
12 On errors, exit and never return (XXX ?). On success, return the
13 first fragment created, which is also chained onto (*INPUT)->next.
14 *INPUT is then updated with the new tail of that chain.
15 *USED_DEREF is set to true iff the "deref" runtime operation
16 was used, otherwise it is not modified. */
17struct location *c_translate_location (struct obstack *, int indent,
18 Dwarf_Addr bias,
19 Dwarf_Attribute *loc_attr,
20 Dwarf_Addr address,
21 struct location **input,
22 Dwarf_Attribute *fb_attr);
23
24/* Translate a fragment to dereference the given pointer type,
25 where *INPUT is the location of the pointer with that type. */
26void c_translate_pointer (struct obstack *pool, int indent,
27 Dwarf_Addr dwbias, Dwarf_Die *typedie,
28 struct location **input);
29
30/* Translate a fragment to index an array (turning the location
31 of the array into the location of an element). If IDX is non-null,
32 it's a string of C code to emit in the fragment as the array index.
33 If the index is a known constant, IDX should be null and CONST_IDX
34 is used instead (this case can handle local arrays in registers). */
35void c_translate_array (struct obstack *pool, int indent,
36 Dwarf_Addr dwbias, Dwarf_Die *typedie,
37 struct location **input,
38 const char *idx, Dwarf_Word const_idx);
39
40/* Translate a fragment to compute the address of the input location
41 and assign it to the variable TARGET. This doesn't really do anything
42 (it always emits "TARGET = addr;"), but it will barf if the location
43 is a register or noncontiguous object. */
44void c_translate_addressof (struct obstack *pool, int indent,
45 Dwarf_Addr dwbias, Dwarf_Die *die,
46 Dwarf_Attribute *typeattr,
47 struct location **input, const char *target);
48
49/* Translate a fragment to fetch the value of variable or member DIE
50 at the *INPUT location and store it in variable TARGET.
51 This handles base integer types and bit fields. */
52void c_translate_fetch (struct obstack *pool, int indent,
53 Dwarf_Addr dwbias __attribute__ ((unused)),
54 Dwarf_Die *die, Dwarf_Attribute *typeattr,
55 struct location **input, const char *target);
56
57/* Emit the C fragment built up at LOC (i.e., the return value from the
58 first c_translate_location call made). INDENT should match that
59 passed to c_translate_* previously.
60
61 Writes complete lines of C99, code forming a complete C block, to STREAM.
62 Return value is true iff that code uses the `deref' runtime macros. */
63bool c_emit_location (FILE *stream, struct location *loc, int indent);