static void dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, gdb_byte **start, size_t *length) { if (SYMBOL_LOCATION_BATON (framefunc) == NULL) *start = NULL; else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) { struct dwarf2_loclist_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = find_location_expression (symbaton, length, pc); } else { struct dwarf2_locexpr_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); if (symbaton != NULL) { *length = symbaton->size; *start = symbaton->data; } else *start = NULL; } if (*start == NULL) error (_("Could not find the frame base for \"%s\"."), SYMBOL_NATURAL_NAME (framefunc)); }
/* Using the frame specified in BATON, find the location expression describing the frame base. Return a pointer to it in START and its length in LENGTH. */ static void dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length) { /* FIXME: cagney/2003-03-26: This code should be using get_frame_base_address(), and then implement a dwarf2 specific this_base method. */ struct symbol *framefunc; struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; framefunc = get_frame_function (debaton->frame); if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs) { struct dwarf2_loclist_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = find_location_expression (symbaton, length, get_frame_pc (debaton->frame)); } else { struct dwarf2_locexpr_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); *length = symbaton->size; *start = symbaton->data; } if (*start == NULL) error ("Could not find the frame base for \"%s\".", SYMBOL_NATURAL_NAME (framefunc)); }
/* Return non-zero iff we need a frame to evaluate SYMBOL. */ static int locexpr_read_needs_frame (struct symbol *symbol) { struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size, dlbaton->per_cu); }
/* Using the frame specified in BATON, find the location expression describing the frame base. Return a pointer to it in START and its length in LENGTH. */ static void dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length) { /* FIXME: cagney/2003-03-26: This code should be using get_frame_base_address(), and then implement a dwarf2 specific this_base method. */ struct symbol *framefunc; struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; /* Use block_linkage_function, which returns a real (not inlined) function, instead of get_frame_function, which may return an inlined function. */ framefunc = block_linkage_function (get_frame_block (debaton->frame, NULL)); /* If we found a frame-relative symbol then it was certainly within some function associated with a frame. If we can't find the frame, something has gone wrong. */ gdb_assert (framefunc != NULL); if (SYMBOL_LOCATION_BATON (framefunc) == NULL) *start = NULL; else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) { struct dwarf2_loclist_baton *symbaton; struct frame_info *frame = debaton->frame; symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = find_location_expression (symbaton, length, get_frame_address_in_block (frame)); } else { struct dwarf2_locexpr_baton *symbaton; symbaton = SYMBOL_LOCATION_BATON (framefunc); if (symbaton != NULL) { *length = symbaton->size; *start = symbaton->data; } else *start = NULL; } if (*start == NULL) error (_("Could not find the frame base for \"%s\"."), SYMBOL_NATURAL_NAME (framefunc)); }
static void locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, struct axs_value * value) { struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); dwarf2_tracepoint_var_ref (symbol, ax, value, dlbaton->data, dlbaton->size); }
/* Return the value of SYMBOL in FRAME using the DWARF-2 expression evaluator to calculate the location. */ static struct value * locexpr_read_variable (struct symbol *symbol, struct frame_info *frame) { struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct value *val; val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size, dlbaton->objfile); return val; }
/* Print a natural-language description of SYMBOL to STREAM. */ static int locexpr_describe_location (struct symbol *symbol, struct ui_file *stream) { /* FIXME: be more extensive. */ struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); int addr_size = dwarf2_per_cu_addr_size (dlbaton->per_cu); if (dlbaton->size == 1 && dlbaton->data[0] >= DW_OP_reg0 && dlbaton->data[0] <= DW_OP_reg31) { struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); struct gdbarch *gdbarch = get_objfile_arch (objfile); int regno = gdbarch_dwarf2_reg_to_regnum (gdbarch, dlbaton->data[0] - DW_OP_reg0); fprintf_filtered (stream, "a variable in register %s", gdbarch_register_name (gdbarch, regno)); return 1; } /* The location expression for a TLS variable looks like this (on a 64-bit LE machine): DW_AT_location : 10 byte block: 3 4 0 0 0 0 0 0 0 e0 (DW_OP_addr: 4; DW_OP_GNU_push_tls_address) 0x3 is the encoding for DW_OP_addr, which has an operand as long as the size of an address on the target machine (here is 8 bytes). 0xe0 is the encoding for DW_OP_GNU_push_tls_address. The operand represents the offset at which the variable is within the thread local storage. */ if (dlbaton->size > 1 && dlbaton->data[dlbaton->size - 1] == DW_OP_GNU_push_tls_address) if (dlbaton->data[0] == DW_OP_addr) { struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); struct gdbarch *gdbarch = get_objfile_arch (objfile); CORE_ADDR offset = dwarf2_read_address (gdbarch, &dlbaton->data[1], &dlbaton->data[dlbaton->size - 1], addr_size); fprintf_filtered (stream, "a thread-local variable at offset %s in the " "thread-local storage for `%s'", paddr_nz (offset), objfile->name); return 1; } fprintf_filtered (stream, "a variable with complex or multiple locations (DWARF2)"); return 1; }
/* Describe the location of SYMBOL as an agent value in VALUE, generating any necessary bytecode in AX. */ static void loclist_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, struct axs_value * value) { struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); gdb_byte *data; size_t size; data = find_location_expression (dlbaton, &size, ax->scope); if (data == NULL) error (_("Variable \"%s\" is not available."), SYMBOL_NATURAL_NAME (symbol)); dwarf2_tracepoint_var_ref (symbol, ax, value, data, size); }
/* Return the value of SYMBOL in FRAME using the DWARF-2 expression evaluator to calculate the location. */ static struct value * loclist_read_variable (struct symbol *symbol, struct frame_info *frame) { struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct value *val; unsigned char *data; size_t size; data = find_location_expression (dlbaton, &size, frame ? get_frame_pc (frame) : 0); if (data == NULL) error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol)); val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, dlbaton->objfile); return val; }
/* Return the value of SYMBOL in FRAME using the DWARF-2 expression evaluator to calculate the location. */ static struct value * loclist_read_variable (struct symbol *symbol, struct frame_info *frame) { struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct value *val; gdb_byte *data; size_t size; data = find_location_expression (dlbaton, &size, frame ? get_frame_address_in_block (frame) : 0); if (data == NULL) { val = allocate_value (SYMBOL_TYPE (symbol)); VALUE_LVAL (val) = not_lval; set_value_optimized_out (val, 1); } else val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, dlbaton->objfile); return val; }