]>
Commit | Line | Data |
---|---|---|
7a053d3b | 1 | #include <elfutils/libdw.h> |
77de5e9e GH |
2 | |
3 | struct obstack; /* Use <obstack.h> */ | |
4 | struct location; /* Opaque */ | |
5 | ||
112b531a FCE |
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 */ | |
9 | #endif | |
77de5e9e GH |
10 | |
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. | |
15 | ||
ccc358b1 RM |
16 | On errors, call FAIL, which should not return. Any later errors will use |
17 | FAIL and FAIL_ARG from the first c_translate_location call. | |
18 | ||
19 | On success, return the first fragment created, which is also chained | |
20 | onto (*INPUT)->next. *INPUT is then updated with the new tail of that | |
b075db48 | 21 | chain. */ |
ccc358b1 RM |
22 | struct location *c_translate_location (struct obstack *, |
23 | void (*fail) (void *arg, | |
24 | const char *fmt, ...) | |
25 | __attribute__ ((noreturn, | |
26 | format (printf, 2, 3))), | |
27 | void *fail_arg, | |
4b1ad75e RM |
28 | void (*emit_address) (void *fail_arg, |
29 | struct obstack *, | |
30 | Dwarf_Addr), | |
ccc358b1 | 31 | int indent, |
77de5e9e | 32 | Dwarf_Addr bias, |
d1531387 RM |
33 | Dwarf_Addr pc_address, |
34 | const Dwarf_Op *locexpr, | |
35 | size_t locexprlen, | |
77de5e9e GH |
36 | struct location **input, |
37 | Dwarf_Attribute *fb_attr); | |
38 | ||
d50f5149 | 39 | /* Translate a fragment to dereference the given DW_TAG_pointer_type DIE, |
77de5e9e GH |
40 | where *INPUT is the location of the pointer with that type. */ |
41 | void c_translate_pointer (struct obstack *pool, int indent, | |
42 | Dwarf_Addr dwbias, Dwarf_Die *typedie, | |
43 | struct location **input); | |
44 | ||
d50f5149 | 45 | /* Translate a fragment to index a DW_TAG_array_type DIE (turning the location |
77de5e9e GH |
46 | of the array into the location of an element). If IDX is non-null, |
47 | it's a string of C code to emit in the fragment as the array index. | |
48 | If the index is a known constant, IDX should be null and CONST_IDX | |
49 | is used instead (this case can handle local arrays in registers). */ | |
50 | void c_translate_array (struct obstack *pool, int indent, | |
51 | Dwarf_Addr dwbias, Dwarf_Die *typedie, | |
52 | struct location **input, | |
53 | const char *idx, Dwarf_Word const_idx); | |
54 | ||
55 | /* Translate a fragment to compute the address of the input location | |
56 | and assign it to the variable TARGET. This doesn't really do anything | |
57 | (it always emits "TARGET = addr;"), but it will barf if the location | |
58 | is a register or noncontiguous object. */ | |
59 | void c_translate_addressof (struct obstack *pool, int indent, | |
60 | Dwarf_Addr dwbias, Dwarf_Die *die, | |
f0df19a2 | 61 | Dwarf_Die *typedie, |
77de5e9e GH |
62 | struct location **input, const char *target); |
63 | ||
64 | /* Translate a fragment to fetch the value of variable or member DIE | |
2413637c | 65 | at the *INPUT location and store it in lvalue TARGET. |
d50f5149 | 66 | This handles base integer types and bit fields, i.e. DW_TAG_base_type. */ |
77de5e9e GH |
67 | void c_translate_fetch (struct obstack *pool, int indent, |
68 | Dwarf_Addr dwbias __attribute__ ((unused)), | |
d50f5149 | 69 | Dwarf_Die *die, Dwarf_Die *typedie, |
77de5e9e GH |
70 | struct location **input, const char *target); |
71 | ||
2413637c RM |
72 | /* Translate a fragment to locate the value of variable or member DIE |
73 | at the *INPUT location and set it to the C expression RVALUE. | |
d50f5149 | 74 | This handles base integer types and bit fields, i.e. DW_TAG_base_type. */ |
2413637c RM |
75 | void c_translate_store (struct obstack *pool, int indent, |
76 | Dwarf_Addr dwbias __attribute__ ((unused)), | |
d50f5149 | 77 | Dwarf_Die *die, Dwarf_Die *typedie, |
2413637c RM |
78 | struct location **input, const char *rvalue); |
79 | ||
77de5e9e GH |
80 | /* Emit the C fragment built up at LOC (i.e., the return value from the |
81 | first c_translate_location call made). INDENT should match that | |
82 | passed to c_translate_* previously. | |
83 | ||
84 | Writes complete lines of C99, code forming a complete C block, to STREAM. | |
85 | Return value is true iff that code uses the `deref' runtime macros. */ | |
86 | bool c_emit_location (FILE *stream, struct location *loc, int indent); |