| #ifndef LOC2STAP_H |
| #define LOC2STAP_H 1 |
| |
| #include "staptree.h" |
| #include <elfutils/libdw.h> |
| |
| enum location_type |
| { |
| loc_address, loc_register, loc_noncontiguous, loc_unavailable, |
| loc_value, loc_constant, loc_implicit_pointer, |
| loc_decl, loc_fragment, loc_final |
| }; |
| |
| struct location |
| { |
| location_type type; |
| unsigned byte_size; |
| |
| |
| expression *program; |
| |
| |
| unsigned int regno; |
| |
| |
| location *pieces; |
| location *piece_next; |
| |
| |
| const void *constant_block; |
| |
| |
| location *target; |
| |
| |
| Dwarf_Word offset; |
| |
| location(location_type t = loc_unavailable) |
| : type(t), byte_size(0), program(0), regno(0), pieces(0), |
| piece_next(0), constant_block(0), target(0), offset(0) |
| { } |
| }; |
| |
| class dwflpp; |
| class location_context |
| { |
| public: |
| const target_symbol *e_orig; |
| target_symbol *e; |
| |
| |
| |
| vardecl *pointer; |
| std::vector<vardecl *> indicies; |
| vardecl *value; |
| |
| Dwarf_Attribute *attr; |
| Dwarf_Addr dwbias; |
| Dwarf_Addr pc; |
| Dwarf_Attribute *fb_attr; |
| const Dwarf_Op *cfa_ops; |
| dwflpp *dw; |
| |
| |
| symbol *frame_base; |
| std::vector<vardecl *> locals; |
| std::vector<statement *> evals; |
| |
| std::vector<vardecl *> globals; |
| std::map<Dwarf_Addr, block *> entry_probes; |
| |
| Dwarf_Die *function; |
| Dwarf_Die *parameter_ref; |
| std::vector<location_context> call_site_values; |
| int param_ref_depth; |
| |
| |
| |
| |
| |
| |
| std::vector<location *> locations; |
| |
| |
| bool userspace_p; |
| |
| location *new_location(location_type); |
| location *new_location(const location &old); |
| |
| symbol *new_symref(vardecl *var); |
| symbol *new_local(const char *namebase); |
| expression *new_target_reg(unsigned regno); |
| expression *new_plus_const(expression *, int64_t); |
| expression *save_expression(expression *); |
| symbol *frame_location(); |
| void adapt_pointer_to_bpf(int size, int offset, bool is_signed); |
| expression *handle_GNU_entry_value(Dwarf_Op expr); |
| expression *handle_GNU_parameter_ref(Dwarf_Op expr); |
| |
| location *translate(const Dwarf_Op *expr, size_t len, size_t start, |
| location *input, bool may_use_fb, bool computing_value); |
| location *location_from_address (const Dwarf_Op *expr, size_t len, |
| location *input); |
| location *translate_offset (const Dwarf_Op *expr, size_t len, size_t i, |
| location *input, Dwarf_Word offset); |
| location *location_relative (const Dwarf_Op *expr, size_t len, |
| location *input); |
| location *translate_array_1(Dwarf_Die *anydie, Dwarf_Word stride, |
| location *loc, expression *index); |
| |
| public: |
| location_context(target_symbol *, expression * = NULL); |
| |
| expression *translate_address(Dwarf_Addr a); |
| location *translate_constant(Dwarf_Attribute *a); |
| location *translate_location(const Dwarf_Op *locexpr, |
| size_t locexprlen, location *input); |
| location *translate_argument (expression *value); |
| location *translate_argument (vardecl *var); |
| location *translate_array(Dwarf_Die *typedie, location *, expression *); |
| location *translate_array_pointer(Dwarf_Die *typedie, location *input, |
| expression *index); |
| location *translate_array_pointer (Dwarf_Die *, location *input, |
| vardecl *index); |
| location *discontiguify(location *loc, Dwarf_Word total_bytes, |
| Dwarf_Word max_piece_bytes); |
| |
| }; |
| |
| #endif |