binutils-gdb/gdb/dwarf2loc.h

255 lines
8.9 KiB
C
Raw Normal View History

* dwarf2expr.h: Tweak comment. (struct dwarf_expr_context): Use `gdb_byte *' in read_mem and get_frame_base function pointers. (read_uleb128, read_sleb128): Change return type and types of first two arguments to `gdb_byte *'. (dwarf2_read_address): Change types of first two arguments to `gdb_byte *'. * dwarf2expr.c: Tweak comment. (dwarf_expr_eval): Change type of second argument to `gdb_byte *'. (read_uleb128, read_sleb128): Change return type and types of first two arguments to `gdb_byte *'. (dwarf2_read_address): Change types of first two arguments to `gdb_byte *'. (execute_stack_op): Change types of last two arguments to `gdb_byte *'. Use `gdb_byte *' for byte buffers. * dwarf2loc.h: Tweak comment. (struct dwarf2_locexpr_baton, struct dwarf2_loclist_baton): Use `gdb_byte *' for byte buffers. * dwarf2loc.c (find_location_expression): Change return type to `gdb_byte *'. Use `gdb_byte *' for byte buffers. Change length to `unsigned int'. (dwarf_expr_read_reg): Use `gdb_byte *' for byte buffer. Remove bogus cast. (dwarf_expr_read_mem): Change type of second argument to `gdb_byte *'. (dwarf_expr_frame_base): Change type of second argument to `gdb_byte **'. (dwarf2_evaluate_loc_desc): Change type of third argument to `gdb_byte *'. (needs_frame_read_mem): Change type of second argument to `gdb_byte *'. (needs_frame_frame_base): Change type of second argument `gdb_byte **'. Use gdb_byte for lit0. (dwarf2_tracepoint_var_ref): Change type of fourth argument to `gdb_byte *'. Use `gdb_byte *' for byte buffer. (loclist_read_variable, loclist_tracepoint_var_ref): Use `gdb_byte *' for byte buffer. * dwarf2-frame.c (struct dwarf2_cie, struct dwarf2_fde) (struct dwarf2_frame_state): Use gdb_byte instead of `unsigned char'. (read_reg): Use `gdb_byte *' for byte buffers. Remove redundant cast. (read_mem): Change second argument to `gdb_byte *'. (no_get_frame_base): Change second argument to `gdb_byte **'. (execute_stack_op): Change first argument to `gdb_byte *'. (execute_cfa_program): Change first two arguments to `gdb_byte *'. Use gdb_byte instead of `unsigned int'. Use temprorary variable to store result of read_uleb128. (struct comp_unit): Use `gdb_byte *' for byte buffers. (read_1_byte, read_4_bytes, read_8_bytes): Change last argument to `gdb_byte *'. (read_unsigned_leb128, read_signed_leb128): Change second argument to `gdb_byte *'. Use gdb_byte instead of `unsigned char'. (read_initial_length): Change second argument to `gdb_byte *'. Remove redundant casts. (read_encoded_value): Use gdb_byte instead of `unsigned char'. Remove bogus casts. (decode_frame_entry_1): Change return type and second argument to `gdb_byte *'. Use `gdb_byte *' for byte buffers. Use gdb_byte instead of `unsigned char'. (decode_frame_entry): Change return type and second argument to `gdb_byte *'. Use `gdb_byte *' for byte buffers. (dwarf2_build_frame_info): Use `gdb_byte *' for byte buffers.
2005-07-12 15:06:54 +02:00
/* DWARF 2 location expression support for GDB.
Copyright (C) 2003-2014 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !defined (DWARF2LOC_H)
#define DWARF2LOC_H
gdb/ Code cleanupp: Use cu_offset and sect_offset compile time type checking. * dwarf2expr.c (add_piece, dwarf_get_base_type, execute_stack_op) (ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2expr.h (cu_offset, sect_offset): New types. (struct dwarf_expr_context_funcs) <dwarf_call> (struct dwarf_expr_context_funcs) <get_base_type>: Use cu_offset and sect_offset. (struct dwarf_expr_context) <len>: Improve the comment. (struct dwarf_expr_piece, ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call) (dwarf_expr_get_base_type, needs_frame_dwarf_call) (dwarf2_compile_expr_to_ax, disassemble_dwarf_expression): Likewise. * dwarf2loc.h: Include dwarf2expr.h. (dwarf2_fetch_die_location_block, dwarf2_get_die_type): Use cu_offset and sect_offset. * dwarf2read.c (struct dwarf2_per_objfile) <debug_types_type_hash>: Improve the comment. (struct comp_unit_head, struct dwarf2_cu, struct dwarf2_per_cu_data) (struct signatured_type, struct line_header, struct partial_die_info) (struct die_info, find_partial_die, dwarf2_get_ref_die_offset) (lookup_signatured_type_at_offset, dwarf2_find_containing_comp_unit) (get_die_type_at_offset, create_cus_from_index) (create_signatured_type_table_from_index, dw2_get_file_names) (offset_in_cu_p, read_comp_unit_head, error_check_comp_unit_head) (read_and_check_comp_unit_head, read_and_check_type_unit_head) (create_debug_types_hash_table, process_psymtab_comp_unit) (load_partial_comp_unit, create_all_comp_units) (partial_die_parent_scope, partial_die_full_name, skip_one_die) (load_full_comp_unit, dwarf2_physname, read_import_statement) (inherit_abstract_dies, read_func_scope, read_call_site_scope) (dwarf2_add_member_fn, process_enumeration_scope, read_module_type) (read_typedef, die_hash, die_eq, read_full_die, dwarf2_read_abbrevs) (load_partial_dies, read_partial_die, find_partial_die_in_comp_unit) (find_partial_die, read_attribute_value, lookup_die_type) (dump_die_shallow, store_in_ref_table): Use cu_offset and sect_offset. (is_ref_attr): New function comment. (dwarf2_get_ref_die_offset): New function comment, new variable retval. Use cu_offset and sect_offset. (follow_die_offset, follow_die_ref, dwarf2_fetch_die_location_block) (dwarf2_get_die_type, follow_die_sig, lookup_signatured_type_at_offset) (load_full_type_unit, read_signatured_type, per_cu_header_read_in) (dwarf2_find_containing_comp_unit, struct dwarf2_offset_and_type) (offset_and_type_hash, offset_and_type_eq, set_die_type) (get_die_type_at_offset, partial_die_hash, partial_die_eq) (write_one_signatured_type, write_psymtabs_to_index): Use cu_offset and sect_offset.
2012-03-19 20:59:19 +01:00
#include "dwarf2expr.h"
* symtab.h: Rename SYMBOL_OPS to SYMBOL_COMPUTED_OPS. * ax-gdb.c (gen_var_ref): Likewise. * findvar.c (read_var_value, symbol_read_needs_frame): Likewise. * printcmd.c (address_info): Likewise. * dwarf2loc.c (dwarf_expr_frame_base): Likewise. * dwarf2read.c (dwarf2_symbol_mark_computed): Likewise. * symtab.h: Rename struct symbol_ops to struct symbol_computed_ops. * dwarf2loc.h: Likewise. * dwarf2loc.c (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Likewise. * symtab.h: (struct symbol_register_ops): New struct definition. (struct symbol): Make "ops" member a union of symbol_computed_ops and symbol_register_ops callback pointers. (SYMBOL_REGISTER_OPS): New macro. * tracepoint.c: Include "objfiles.h". (scope_info, collect_symbol): Use SYMBOL_REGISTER_OPS register_number callback to retrieve register numbers. * ax-gdb.c (gen_var_ref): Likewise. * findvar.c (read_var_value): Likewise. * printcmd.c (address_info): Likewise. * coffread.c (coff_reg_to_regnum): New function. (coff_register_funcs): New static variable. (process_coff_symbol): Do not call gdbarch_sdb_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks. * mdebugread.c (mdebug_reg_to_regnum): New function. (mdebug_register_funcs): New static variable. (parse_symbol): Do not call gdbarch_ecoff_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks. * stabsread.c (stab_reg_to_regnum): New function. (stab_register_funcs): New static variable. (define_symbol): Do not call gdbarch_stab_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks.
2009-06-04 14:28:39 +02:00
struct symbol_computed_ops;
2008-03-18 Ulrich Weigand <uweigand@de.ibm.com> Jim Blandy <jimb@codesourcery.com> Daniel Jacobowitz <drow@false.org> * dwarf2expr.h (struct dwarf_expr_context): Add ADDR_SIZE member. (dwarf2_read_address): Update prototype. * dwarf2expr.c (unsigned_address_type): Add ADDR_SIZE parameter. (signed_address_type): Likewise. (dwarf2_read_address): Replace BYTES_READ parameter with ADDR_SIZE. (execute_stack_op): Update calls to unsigned_address_type, signed_address_type and dwarf2_read_address. Fix implementation of DW_OP_deref_size. * dwarf2loc.h (dwarf2_per_cu_objfile): Add prototype. (dwarf2_per_cu_addr_size): Likewise. (struct dwarf2_locexpr_baton): Replace OBJFILE with PER_CU. (struct dwarf2_loclist_baton): Likewise. * dwarf2loc.c (find_location_expression): Update calls to dwarf2_read_address. Use dwarf2_per_cu_objfile and dwarf2_per_cu_addr_size to retrieve PER_CU parameters. (locexpr_describe_location): Likewise. (dwarf2_evaluate_loc_desc): Replace OBJFILE with PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (dwarf2_loc_desc_needs_frame): Add PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (locexpr_read_variable): Update dwarf2_evaluate_loc_desc call. (loclist_read_variable): Likewise. (locexpr_read_needs_frame): Update dwarf2_loc_desc_needs_frame call. * dwarf2read.c (dwarf2_symbol_mark_computed): Set baton->per_cu instead of baton->objfile. (dwarf2_per_cu_obfile): New function. (dwarf2_per_cu_addr_size): Likewise. * dwarf2-frame.c (struct comp_unit): Move higher. (struct dwarf2_cie): Add UNIT and ADDR_SIZE members. (execute_stack_op): Add ADDR_SIZE parameter; set ctx->addr_size. (execute_cfa_program): Add FDE parameter. Replace EH_FRAME_P parameter by using fde->eh_frame_p. Use read_encoded_value to implement DW_CFA_set_loc. (struct dwarf2_frame_cache): Add ADDR_SIZE member. (dwarf2_frame_cache): Set cache->addr_size. Update calls to execute_stack_op and execute_cfa_program. (dwarf2_frame_prev_register): Update calls to execute_stack_op. (size_of_encoded_value): Remove. (read_encoded_value): Add PTR_LEN and FUNC_BASE parameters. Remove call to size_of_encoded_value. Implement DW_EH_PE_funcrel. (add_cie): Set cie->unit backlink. (decode_frame_entry_1): Set cie->addr_size. Update calls to read_encoded_value. (dwarf2_build_frame_info): Allocate UNIT on objfile obstack.
2008-03-18 20:40:47 +01:00
struct objfile;
struct dwarf2_per_cu_data;
gdb * opencl-lang.c (lval_func_check_synthetic_pointer): New function. * value.h (struct lval_funcs) <indirect, check_synthetic_pointer>: New fields. (value_bits_synthetic_pointer): Declare. * value.c (value_bits_synthetic_pointer): New function. * valprint.c (valprint_check_validity): Handle synthetic pointers. * valops.c (value_ind): Use new 'indirect' lval_funcs method. * valarith.c (value_ptradd): Use set_value_component_location. * p-valprint.c (pascal_object_print_value_fields): Handle synthetic pointers. * jv-valprint.c (java_print_value_fields): Handle synthetic pointers. * dwarf2read.c (dwarf_stack_op_name): Add DW_OP_GNU_implicit_pointer. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. Handle location lists. (fill_in_loclist_baton): New function. (dwarf2_symbol_mark_computed): Use it. * dwarf2loc.h (dwarf2_find_location_expression): Declare. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. * dwarf2loc.c (dwarf2_find_location_expression): Rename from find_location_expression. No longer static. Update all callers. (dwarf_expr_frame_pc): New function. (per_cu_dwarf_call): Add get_frame_pc, baton arguments. Update all callers. (struct piece_closure) <per_cu>: New field. (allocate_piece_closure): Add per_cu argument. (read_pieced_value): Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_bits): Remove validity argument, add check_for argument. Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_validity, check_pieced_value_invalid): Update. (check_pieced_synthetic_pointer): New function. (get_frame_address_in_block_wrapper): New function. (indirect_pieced_value): New function. (pieced_value_funcs): Update. (invalid_synthetic_pointer): New function. (dwarf2_evaluate_loc_desc_full): Rename from dwarf2_evaluate_loc_desc. Add byte_offset argument. (dwarf2_evaluate_loc_desc): Rewrite. (dwarf2_loc_desc_needs_frame): Set new field on context. (get_ax_pc): New function. (disassemble_dwarf_expression): Handle DW_OP_GNU_implicit_pointer. * dwarf2expr.h (enum dwarf_value_location) <DWARF_VALUE_IMPLICIT_POINTER>: New constant. (struct dwarf_expr_context) <get_frame_pc>: New field. (struct dwarf_expr_piece) <v.ptr>: New field. * dwarf2expr.c (add_piece): Handle DWARF_VALUE_IMPLICIT_POINTER. (execute_stack_op): Handle DW_OP_GNU_implicit_pointer. * dwarf2-frame.c (no_get_frame_pc): New function. (execute_stack_op): Set new field on context. * cp-valprint.c (cp_print_value_fields): Handle synthetic pointers. gdb/testsuite * gdb.dwarf2/implptr.exp: New file. * gdb.dwarf2/implptr.c: New file. * gdb.dwarf2/implptr.S: New file.
2010-11-29 22:18:16 +01:00
struct dwarf2_loclist_baton;
struct agent_expr;
struct axs_value;
/* This header is private to the DWARF-2 reader. It is shared between
dwarf2read.c and dwarf2loc.c. */
gdb/ Implement basic support for DW_TAG_GNU_call_site. * block.c: Include gdbtypes.h and exceptions.h. (call_site_for_pc): New function. * block.h (call_site_for_pc): New declaration. * defs.h: Include hashtab.h. (make_cleanup_htab_delete, core_addr_hash, core_addr_eq): New declarations. * dwarf2-frame.c (dwarf2_frame_ctx_funcs): Install ctx_no_push_dwarf_reg_entry_value. * dwarf2expr.c (read_uleb128, read_sleb128): Support R as NULL. (dwarf_block_to_dwarf_reg): New function. (execute_stack_op) <DW_OP_GNU_entry_value>: Implement it. (ctx_no_push_dwarf_reg_entry_value): New function. * dwarf2expr.h (struct dwarf_expr_context_funcs): New field push_dwarf_reg_entry_value. (ctx_no_push_dwarf_reg_entry_value, dwarf_block_to_dwarf_reg): New declarations. * dwarf2loc.c: Include gdbcmd.h. (dwarf_expr_ctx_funcs): New forward declaration. (entry_values_debug, show_entry_values_debug, call_site_to_target_addr) (dwarf_expr_reg_to_entry_parameter) (dwarf_expr_push_dwarf_reg_entry_value): New. (dwarf_expr_ctx_funcs): Install dwarf_expr_push_dwarf_reg_entry_value. (dwarf2_evaluate_loc_desc_full): Handle NO_ENTRY_VALUE_ERROR. (needs_dwarf_reg_entry_value): New function. (needs_frame_ctx_funcs): Install it. (_initialize_dwarf2loc): New function. * dwarf2loc.h (entry_values_debug): New declaration. * dwarf2read.c (struct dwarf2_cu): New field call_site_htab. (read_call_site_scope): New forward declaration. (process_full_comp_unit): Copy call_site_htab. (process_die): Support DW_TAG_GNU_call_site. (read_call_site_scope): New function. (dwarf2_get_pc_bounds): Support NULL HIGHPC. (dwarf_tag_name): Support DW_TAG_GNU_call_site. (cleanup_htab): Delete. (write_psymtabs_to_index): Use make_cleanup_htab_delete instead of it. * exceptions.h (enum errors): New NO_ENTRY_VALUE_ERROR. * gdb-gdb.py (StructMainTypePrettyPrinter): Support FIELD_LOC_KIND_DWARF_BLOCK. * gdbtypes.h (enum field_loc_kind): New entry FIELD_LOC_KIND_DWARF_BLOCK. (struct main_type): New loc entry dwarf_block. (struct call_site, FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK) (TYPE_FIELD_DWARF_BLOCK): New. * python/py-type.c: Include dwarf2loc.h. (check_types_equal): Support FIELD_LOC_KIND_DWARF_BLOCK. New internal_error call on unknown FIELD_LOC_KIND. * symtab.h (struct symtab): New field call_site_htab. * utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete) (core_addr_hash, core_addr_eq): New functions. gdb/testsuite/ Implement basic support for DW_TAG_GNU_call_site. * gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value. * gdb.arch/amd64-entry-value.cc: New file. * gdb.arch/amd64-entry-value.exp: New file.
2011-10-09 21:21:39 +02:00
/* `set debug entry-values' setting. */
gdb/ * dwarf2loc.c (entry_values_debug): Add 'unsigned'. (_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * dwarf2loc.h: Update the declaration of 'entry_values_debug'. * dwarf2read.c (dwarf2_die_debug): Add 'unsigned'. (_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'. (_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.c (frame_debug): Add 'unsigned'. (_intialize_frame): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.h: Update the declaration of 'frame_debug'. * gdbtypes.c (overload_debug): Add 'unsigned'. (_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * inferior.h: Update declaration of 'debug_infrun'. * infrun.c (debug_infrun): Add 'unsigned'. (_initialize_infrun): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * jit.c (jit_debug): Add 'unsigned'. (_initialize_jit): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-nat.c (debug_linux_nat): Add 'unsigned'. (_initialize_linux_nat): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-thread-db.c (libthread_db_debug): Add 'unsigned'. (_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * machoread.c (mach_o_debug_level): Add 'unsigned'. (_initialize_machoread): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'. * microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'. (_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd intead of add_setshow_zinteger_cmd. * mips-tdep.c (mips_debug): Add 'unsigned'. (_initialize_mips_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * monitor.c (monitor_debug): Add 'unsigned'. (_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * observer.c (observer_debug): Add 'unsigned'. (_initialize_observer): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * parse.c (expressiondebug): Add 'unsigned'. (_initialize_parse): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.c (record_debug): Add 'unsigned'. (_initialize_record): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.h: Update the declaration of 'record_debug'. * stap-probe.c (stap_expression_debug): Add 'unsigned'. (_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * serial.c (global_serial_debug_p): Add 'unsigned'. (_initialize_serial): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'. (_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-frv.c (solib_frv_debug): Add 'unsigned'. (_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * target.c (targetdebug): Add 'unsigned'. (initialize_targets): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * valops.c (overload_debug): Add 'unsigned'. * varobj.c (varobjdebug): Add 'unsigned'. (_initialize_varobj): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'. (_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * arch-utils.h: Remove the declaration of 'gdbarch_debug'. * gdbarch.sh (gdbarch_debug): Add 'unsigned'. (extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 11:36:40 +02:00
extern unsigned int entry_values_debug;
gdb/ Implement basic support for DW_TAG_GNU_call_site. * block.c: Include gdbtypes.h and exceptions.h. (call_site_for_pc): New function. * block.h (call_site_for_pc): New declaration. * defs.h: Include hashtab.h. (make_cleanup_htab_delete, core_addr_hash, core_addr_eq): New declarations. * dwarf2-frame.c (dwarf2_frame_ctx_funcs): Install ctx_no_push_dwarf_reg_entry_value. * dwarf2expr.c (read_uleb128, read_sleb128): Support R as NULL. (dwarf_block_to_dwarf_reg): New function. (execute_stack_op) <DW_OP_GNU_entry_value>: Implement it. (ctx_no_push_dwarf_reg_entry_value): New function. * dwarf2expr.h (struct dwarf_expr_context_funcs): New field push_dwarf_reg_entry_value. (ctx_no_push_dwarf_reg_entry_value, dwarf_block_to_dwarf_reg): New declarations. * dwarf2loc.c: Include gdbcmd.h. (dwarf_expr_ctx_funcs): New forward declaration. (entry_values_debug, show_entry_values_debug, call_site_to_target_addr) (dwarf_expr_reg_to_entry_parameter) (dwarf_expr_push_dwarf_reg_entry_value): New. (dwarf_expr_ctx_funcs): Install dwarf_expr_push_dwarf_reg_entry_value. (dwarf2_evaluate_loc_desc_full): Handle NO_ENTRY_VALUE_ERROR. (needs_dwarf_reg_entry_value): New function. (needs_frame_ctx_funcs): Install it. (_initialize_dwarf2loc): New function. * dwarf2loc.h (entry_values_debug): New declaration. * dwarf2read.c (struct dwarf2_cu): New field call_site_htab. (read_call_site_scope): New forward declaration. (process_full_comp_unit): Copy call_site_htab. (process_die): Support DW_TAG_GNU_call_site. (read_call_site_scope): New function. (dwarf2_get_pc_bounds): Support NULL HIGHPC. (dwarf_tag_name): Support DW_TAG_GNU_call_site. (cleanup_htab): Delete. (write_psymtabs_to_index): Use make_cleanup_htab_delete instead of it. * exceptions.h (enum errors): New NO_ENTRY_VALUE_ERROR. * gdb-gdb.py (StructMainTypePrettyPrinter): Support FIELD_LOC_KIND_DWARF_BLOCK. * gdbtypes.h (enum field_loc_kind): New entry FIELD_LOC_KIND_DWARF_BLOCK. (struct main_type): New loc entry dwarf_block. (struct call_site, FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK) (TYPE_FIELD_DWARF_BLOCK): New. * python/py-type.c: Include dwarf2loc.h. (check_types_equal): Support FIELD_LOC_KIND_DWARF_BLOCK. New internal_error call on unknown FIELD_LOC_KIND. * symtab.h (struct symtab): New field call_site_htab. * utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete) (core_addr_hash, core_addr_eq): New functions. gdb/testsuite/ Implement basic support for DW_TAG_GNU_call_site. * gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value. * gdb.arch/amd64-entry-value.cc: New file. * gdb.arch/amd64-entry-value.exp: New file.
2011-10-09 21:21:39 +02:00
/* Return the OBJFILE associated with the compilation unit CU. If CU
came from a separate debuginfo file, then the master objfile is
returned. */
2008-03-18 Ulrich Weigand <uweigand@de.ibm.com> Jim Blandy <jimb@codesourcery.com> Daniel Jacobowitz <drow@false.org> * dwarf2expr.h (struct dwarf_expr_context): Add ADDR_SIZE member. (dwarf2_read_address): Update prototype. * dwarf2expr.c (unsigned_address_type): Add ADDR_SIZE parameter. (signed_address_type): Likewise. (dwarf2_read_address): Replace BYTES_READ parameter with ADDR_SIZE. (execute_stack_op): Update calls to unsigned_address_type, signed_address_type and dwarf2_read_address. Fix implementation of DW_OP_deref_size. * dwarf2loc.h (dwarf2_per_cu_objfile): Add prototype. (dwarf2_per_cu_addr_size): Likewise. (struct dwarf2_locexpr_baton): Replace OBJFILE with PER_CU. (struct dwarf2_loclist_baton): Likewise. * dwarf2loc.c (find_location_expression): Update calls to dwarf2_read_address. Use dwarf2_per_cu_objfile and dwarf2_per_cu_addr_size to retrieve PER_CU parameters. (locexpr_describe_location): Likewise. (dwarf2_evaluate_loc_desc): Replace OBJFILE with PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (dwarf2_loc_desc_needs_frame): Add PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (locexpr_read_variable): Update dwarf2_evaluate_loc_desc call. (loclist_read_variable): Likewise. (locexpr_read_needs_frame): Update dwarf2_loc_desc_needs_frame call. * dwarf2read.c (dwarf2_symbol_mark_computed): Set baton->per_cu instead of baton->objfile. (dwarf2_per_cu_obfile): New function. (dwarf2_per_cu_addr_size): Likewise. * dwarf2-frame.c (struct comp_unit): Move higher. (struct dwarf2_cie): Add UNIT and ADDR_SIZE members. (execute_stack_op): Add ADDR_SIZE parameter; set ctx->addr_size. (execute_cfa_program): Add FDE parameter. Replace EH_FRAME_P parameter by using fde->eh_frame_p. Use read_encoded_value to implement DW_CFA_set_loc. (struct dwarf2_frame_cache): Add ADDR_SIZE member. (dwarf2_frame_cache): Set cache->addr_size. Update calls to execute_stack_op and execute_cfa_program. (dwarf2_frame_prev_register): Update calls to execute_stack_op. (size_of_encoded_value): Remove. (read_encoded_value): Add PTR_LEN and FUNC_BASE parameters. Remove call to size_of_encoded_value. Implement DW_EH_PE_funcrel. (add_cie): Set cie->unit backlink. (decode_frame_entry_1): Set cie->addr_size. Update calls to read_encoded_value. (dwarf2_build_frame_info): Allocate UNIT on objfile obstack.
2008-03-18 20:40:47 +01:00
struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu);
/* Return the address size given in the compilation unit header for CU. */
int dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu);
2008-03-18 Ulrich Weigand <uweigand@de.ibm.com> Jim Blandy <jimb@codesourcery.com> Daniel Jacobowitz <drow@false.org> * dwarf2expr.h (struct dwarf_expr_context): Add ADDR_SIZE member. (dwarf2_read_address): Update prototype. * dwarf2expr.c (unsigned_address_type): Add ADDR_SIZE parameter. (signed_address_type): Likewise. (dwarf2_read_address): Replace BYTES_READ parameter with ADDR_SIZE. (execute_stack_op): Update calls to unsigned_address_type, signed_address_type and dwarf2_read_address. Fix implementation of DW_OP_deref_size. * dwarf2loc.h (dwarf2_per_cu_objfile): Add prototype. (dwarf2_per_cu_addr_size): Likewise. (struct dwarf2_locexpr_baton): Replace OBJFILE with PER_CU. (struct dwarf2_loclist_baton): Likewise. * dwarf2loc.c (find_location_expression): Update calls to dwarf2_read_address. Use dwarf2_per_cu_objfile and dwarf2_per_cu_addr_size to retrieve PER_CU parameters. (locexpr_describe_location): Likewise. (dwarf2_evaluate_loc_desc): Replace OBJFILE with PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (dwarf2_loc_desc_needs_frame): Add PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (locexpr_read_variable): Update dwarf2_evaluate_loc_desc call. (loclist_read_variable): Likewise. (locexpr_read_needs_frame): Update dwarf2_loc_desc_needs_frame call. * dwarf2read.c (dwarf2_symbol_mark_computed): Set baton->per_cu instead of baton->objfile. (dwarf2_per_cu_obfile): New function. (dwarf2_per_cu_addr_size): Likewise. * dwarf2-frame.c (struct comp_unit): Move higher. (struct dwarf2_cie): Add UNIT and ADDR_SIZE members. (execute_stack_op): Add ADDR_SIZE parameter; set ctx->addr_size. (execute_cfa_program): Add FDE parameter. Replace EH_FRAME_P parameter by using fde->eh_frame_p. Use read_encoded_value to implement DW_CFA_set_loc. (struct dwarf2_frame_cache): Add ADDR_SIZE member. (dwarf2_frame_cache): Set cache->addr_size. Update calls to execute_stack_op and execute_cfa_program. (dwarf2_frame_prev_register): Update calls to execute_stack_op. (size_of_encoded_value): Remove. (read_encoded_value): Add PTR_LEN and FUNC_BASE parameters. Remove call to size_of_encoded_value. Implement DW_EH_PE_funcrel. (add_cie): Set cie->unit backlink. (decode_frame_entry_1): Set cie->addr_size. Update calls to read_encoded_value. (dwarf2_build_frame_info): Allocate UNIT on objfile obstack.
2008-03-18 20:40:47 +01:00
/* Return the DW_FORM_ref_addr size given in the compilation unit header for
CU. */
int dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *cu);
/* Return the offset size given in the compilation unit header for CU. */
int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu);
/* Return the text offset of the CU. The returned offset comes from
this CU's objfile. If this objfile came from a separate debuginfo
file, then the offset may be different from the corresponding
offset in the parent objfile. */
CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu);
gdb * opencl-lang.c (lval_func_check_synthetic_pointer): New function. * value.h (struct lval_funcs) <indirect, check_synthetic_pointer>: New fields. (value_bits_synthetic_pointer): Declare. * value.c (value_bits_synthetic_pointer): New function. * valprint.c (valprint_check_validity): Handle synthetic pointers. * valops.c (value_ind): Use new 'indirect' lval_funcs method. * valarith.c (value_ptradd): Use set_value_component_location. * p-valprint.c (pascal_object_print_value_fields): Handle synthetic pointers. * jv-valprint.c (java_print_value_fields): Handle synthetic pointers. * dwarf2read.c (dwarf_stack_op_name): Add DW_OP_GNU_implicit_pointer. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. Handle location lists. (fill_in_loclist_baton): New function. (dwarf2_symbol_mark_computed): Use it. * dwarf2loc.h (dwarf2_find_location_expression): Declare. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. * dwarf2loc.c (dwarf2_find_location_expression): Rename from find_location_expression. No longer static. Update all callers. (dwarf_expr_frame_pc): New function. (per_cu_dwarf_call): Add get_frame_pc, baton arguments. Update all callers. (struct piece_closure) <per_cu>: New field. (allocate_piece_closure): Add per_cu argument. (read_pieced_value): Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_bits): Remove validity argument, add check_for argument. Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_validity, check_pieced_value_invalid): Update. (check_pieced_synthetic_pointer): New function. (get_frame_address_in_block_wrapper): New function. (indirect_pieced_value): New function. (pieced_value_funcs): Update. (invalid_synthetic_pointer): New function. (dwarf2_evaluate_loc_desc_full): Rename from dwarf2_evaluate_loc_desc. Add byte_offset argument. (dwarf2_evaluate_loc_desc): Rewrite. (dwarf2_loc_desc_needs_frame): Set new field on context. (get_ax_pc): New function. (disassemble_dwarf_expression): Handle DW_OP_GNU_implicit_pointer. * dwarf2expr.h (enum dwarf_value_location) <DWARF_VALUE_IMPLICIT_POINTER>: New constant. (struct dwarf_expr_context) <get_frame_pc>: New field. (struct dwarf_expr_piece) <v.ptr>: New field. * dwarf2expr.c (add_piece): Handle DWARF_VALUE_IMPLICIT_POINTER. (execute_stack_op): Handle DW_OP_GNU_implicit_pointer. * dwarf2-frame.c (no_get_frame_pc): New function. (execute_stack_op): Set new field on context. * cp-valprint.c (cp_print_value_fields): Handle synthetic pointers. gdb/testsuite * gdb.dwarf2/implptr.exp: New file. * gdb.dwarf2/implptr.c: New file. * gdb.dwarf2/implptr.S: New file.
2010-11-29 22:18:16 +01:00
/* Find a particular location expression from a location list. */
const gdb_byte *dwarf2_find_location_expression
(struct dwarf2_loclist_baton *baton,
size_t *locexpr_length,
CORE_ADDR pc);
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off
(sect_offset offset_in_cu, struct dwarf2_per_cu_data *per_cu,
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton);
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off
gdb/ Code cleanupp: Use cu_offset and sect_offset compile time type checking. * dwarf2expr.c (add_piece, dwarf_get_base_type, execute_stack_op) (ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2expr.h (cu_offset, sect_offset): New types. (struct dwarf_expr_context_funcs) <dwarf_call> (struct dwarf_expr_context_funcs) <get_base_type>: Use cu_offset and sect_offset. (struct dwarf_expr_context) <len>: Improve the comment. (struct dwarf_expr_piece, ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call) (dwarf_expr_get_base_type, needs_frame_dwarf_call) (dwarf2_compile_expr_to_ax, disassemble_dwarf_expression): Likewise. * dwarf2loc.h: Include dwarf2expr.h. (dwarf2_fetch_die_location_block, dwarf2_get_die_type): Use cu_offset and sect_offset. * dwarf2read.c (struct dwarf2_per_objfile) <debug_types_type_hash>: Improve the comment. (struct comp_unit_head, struct dwarf2_cu, struct dwarf2_per_cu_data) (struct signatured_type, struct line_header, struct partial_die_info) (struct die_info, find_partial_die, dwarf2_get_ref_die_offset) (lookup_signatured_type_at_offset, dwarf2_find_containing_comp_unit) (get_die_type_at_offset, create_cus_from_index) (create_signatured_type_table_from_index, dw2_get_file_names) (offset_in_cu_p, read_comp_unit_head, error_check_comp_unit_head) (read_and_check_comp_unit_head, read_and_check_type_unit_head) (create_debug_types_hash_table, process_psymtab_comp_unit) (load_partial_comp_unit, create_all_comp_units) (partial_die_parent_scope, partial_die_full_name, skip_one_die) (load_full_comp_unit, dwarf2_physname, read_import_statement) (inherit_abstract_dies, read_func_scope, read_call_site_scope) (dwarf2_add_member_fn, process_enumeration_scope, read_module_type) (read_typedef, die_hash, die_eq, read_full_die, dwarf2_read_abbrevs) (load_partial_dies, read_partial_die, find_partial_die_in_comp_unit) (find_partial_die, read_attribute_value, lookup_die_type) (dump_die_shallow, store_in_ref_table): Use cu_offset and sect_offset. (is_ref_attr): New function comment. (dwarf2_get_ref_die_offset): New function comment, new variable retval. Use cu_offset and sect_offset. (follow_die_offset, follow_die_ref, dwarf2_fetch_die_location_block) (dwarf2_get_die_type, follow_die_sig, lookup_signatured_type_at_offset) (load_full_type_unit, read_signatured_type, per_cu_header_read_in) (dwarf2_find_containing_comp_unit, struct dwarf2_offset_and_type) (offset_and_type_hash, offset_and_type_eq, set_die_type) (get_die_type_at_offset, partial_die_hash, partial_die_eq) (write_one_signatured_type, write_psymtabs_to_index): Use cu_offset and sect_offset.
2012-03-19 20:59:19 +01:00
(cu_offset offset_in_cu, struct dwarf2_per_cu_data *per_cu,
gdb * opencl-lang.c (lval_func_check_synthetic_pointer): New function. * value.h (struct lval_funcs) <indirect, check_synthetic_pointer>: New fields. (value_bits_synthetic_pointer): Declare. * value.c (value_bits_synthetic_pointer): New function. * valprint.c (valprint_check_validity): Handle synthetic pointers. * valops.c (value_ind): Use new 'indirect' lval_funcs method. * valarith.c (value_ptradd): Use set_value_component_location. * p-valprint.c (pascal_object_print_value_fields): Handle synthetic pointers. * jv-valprint.c (java_print_value_fields): Handle synthetic pointers. * dwarf2read.c (dwarf_stack_op_name): Add DW_OP_GNU_implicit_pointer. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. Handle location lists. (fill_in_loclist_baton): New function. (dwarf2_symbol_mark_computed): Use it. * dwarf2loc.h (dwarf2_find_location_expression): Declare. (dwarf2_fetch_die_location_block): Add get_frame_pc, baton arguments. * dwarf2loc.c (dwarf2_find_location_expression): Rename from find_location_expression. No longer static. Update all callers. (dwarf_expr_frame_pc): New function. (per_cu_dwarf_call): Add get_frame_pc, baton arguments. Update all callers. (struct piece_closure) <per_cu>: New field. (allocate_piece_closure): Add per_cu argument. (read_pieced_value): Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_bits): Remove validity argument, add check_for argument. Handle DWARF_VALUE_IMPLICIT_POINTER. (check_pieced_value_validity, check_pieced_value_invalid): Update. (check_pieced_synthetic_pointer): New function. (get_frame_address_in_block_wrapper): New function. (indirect_pieced_value): New function. (pieced_value_funcs): Update. (invalid_synthetic_pointer): New function. (dwarf2_evaluate_loc_desc_full): Rename from dwarf2_evaluate_loc_desc. Add byte_offset argument. (dwarf2_evaluate_loc_desc): Rewrite. (dwarf2_loc_desc_needs_frame): Set new field on context. (get_ax_pc): New function. (disassemble_dwarf_expression): Handle DW_OP_GNU_implicit_pointer. * dwarf2expr.h (enum dwarf_value_location) <DWARF_VALUE_IMPLICIT_POINTER>: New constant. (struct dwarf_expr_context) <get_frame_pc>: New field. (struct dwarf_expr_piece) <v.ptr>: New field. * dwarf2expr.c (add_piece): Handle DWARF_VALUE_IMPLICIT_POINTER. (execute_stack_op): Handle DW_OP_GNU_implicit_pointer. * dwarf2-frame.c (no_get_frame_pc): New function. (execute_stack_op): Set new field on context. * cp-valprint.c (cp_print_value_fields): Handle synthetic pointers. gdb/testsuite * gdb.dwarf2/implptr.exp: New file. * gdb.dwarf2/implptr.c: New file. * gdb.dwarf2/implptr.S: New file.
2010-11-29 22:18:16 +01:00
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton);
extern const gdb_byte *dwarf2_fetch_constant_bytes (sect_offset,
struct dwarf2_per_cu_data *,
struct obstack *,
LONGEST *);
gdb/ Code cleanupp: Use cu_offset and sect_offset compile time type checking. * dwarf2expr.c (add_piece, dwarf_get_base_type, execute_stack_op) (ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2expr.h (cu_offset, sect_offset): New types. (struct dwarf_expr_context_funcs) <dwarf_call> (struct dwarf_expr_context_funcs) <get_base_type>: Use cu_offset and sect_offset. (struct dwarf_expr_context) <len>: Improve the comment. (struct dwarf_expr_piece, ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call) (dwarf_expr_get_base_type, needs_frame_dwarf_call) (dwarf2_compile_expr_to_ax, disassemble_dwarf_expression): Likewise. * dwarf2loc.h: Include dwarf2expr.h. (dwarf2_fetch_die_location_block, dwarf2_get_die_type): Use cu_offset and sect_offset. * dwarf2read.c (struct dwarf2_per_objfile) <debug_types_type_hash>: Improve the comment. (struct comp_unit_head, struct dwarf2_cu, struct dwarf2_per_cu_data) (struct signatured_type, struct line_header, struct partial_die_info) (struct die_info, find_partial_die, dwarf2_get_ref_die_offset) (lookup_signatured_type_at_offset, dwarf2_find_containing_comp_unit) (get_die_type_at_offset, create_cus_from_index) (create_signatured_type_table_from_index, dw2_get_file_names) (offset_in_cu_p, read_comp_unit_head, error_check_comp_unit_head) (read_and_check_comp_unit_head, read_and_check_type_unit_head) (create_debug_types_hash_table, process_psymtab_comp_unit) (load_partial_comp_unit, create_all_comp_units) (partial_die_parent_scope, partial_die_full_name, skip_one_die) (load_full_comp_unit, dwarf2_physname, read_import_statement) (inherit_abstract_dies, read_func_scope, read_call_site_scope) (dwarf2_add_member_fn, process_enumeration_scope, read_module_type) (read_typedef, die_hash, die_eq, read_full_die, dwarf2_read_abbrevs) (load_partial_dies, read_partial_die, find_partial_die_in_comp_unit) (find_partial_die, read_attribute_value, lookup_die_type) (dump_die_shallow, store_in_ref_table): Use cu_offset and sect_offset. (is_ref_attr): New function comment. (dwarf2_get_ref_die_offset): New function comment, new variable retval. Use cu_offset and sect_offset. (follow_die_offset, follow_die_ref, dwarf2_fetch_die_location_block) (dwarf2_get_die_type, follow_die_sig, lookup_signatured_type_at_offset) (load_full_type_unit, read_signatured_type, per_cu_header_read_in) (dwarf2_find_containing_comp_unit, struct dwarf2_offset_and_type) (offset_and_type_hash, offset_and_type_eq, set_die_type) (get_die_type_at_offset, partial_die_hash, partial_die_eq) (write_one_signatured_type, write_psymtabs_to_index): Use cu_offset and sect_offset.
2012-03-19 20:59:19 +01:00
struct type *dwarf2_get_die_type (cu_offset die_offset,
gdb PR gdb/12617: * value.h (value_from_contents): Declare. * value.c (value_from_contents): New function. * dwarf2read.c (dwarf_stack_op_name): Add new values. (dwarf2_get_die_type): New function. * dwarf2loc.c (dwarf_expr_get_base_type): New function. (allocate_piece_closure): Acquire reference to values. (read_pieced_value): Update for value-based expressions. (write_pieced_value): Likewise. (free_pieced_value_closure): Call value_free as needed. (dwarf2_evaluate_loc_desc_full): Set get_base_type field. Update for value-based expressions. * dwarf2loc.h (dwarf2_get_die_type): Declare. * dwarf2expr.h (struct dwarf_stack_value) <value>: Change type. <get_base_type>: New field. (struct dwarf_expr_piece) <v.value>: Change type. <v.regno>: New field. (struct dwarf_expr_context) <mark>: New field. (dwarf_expr_piece, dwarf_expr_fetch): Update. (dwarf_expr_pop, dwarf_expr_push): Remove. (dwarf_expr_push_address): Declare. * dwarf2expr.c (dwarf_arch_cookie): New global. (struct dwarf_gdbarch_types): New. (dwarf_gdbarch_types_init, dwarf_expr_address_type): New functions. (dwarf_expr_push): Change type of 'value' argument. Update. Now static. (dwarf_expr_push_address): New function. (dwarf_expr_pop): Now static. (dwarf_expr_fetch): Change return type. (dwarf_require_integral): New function. (dwarf_expr_fetch): Simplify. (add_piece): Update. (base_types_equal_p, dwarf_get_base_type, get_unsigned_type): New functions. (execute_stack_op) <sign_ext>: Remove. Use values for DWARF stack. <DW_OP_GNU_const_type, DW_OP_GNU_deref_type, DW_OP_GNU_regval_type, DW_OP_GNU_convert, DW_OP_GNU_reinterpret>: New cases. (_initialize_dwarf2expr): New function. (add_piece): Update. (new_dwarf_expr_context): Set new field. (free_dwarf_expr_context): Call value_free_to_mark. * dwarf2-frame.c (no_base_type): New function. (execute_stack_op): Set get_base_type field. Update. gdb/testsuite * gdb.dwarf2/typeddwarf.S: New file. * gdb.dwarf2/typeddwarf.c: New file. * gdb.dwarf2/typeddwarf.exp: New file.
2011-05-12 19:40:55 +02:00
struct dwarf2_per_cu_data *per_cu);
/* Find the frame base information for FRAMEFUNC at PC. START is an
out parameter which is set to point to the DWARF expression to
compute. LENGTH is an out parameter which is set to the length of
the DWARF expression. This throws an exception on error or if an
expression is not found; the returned length will never be
zero. */
extern void func_get_frame_base_dwarf_block (struct symbol *framefunc,
CORE_ADDR pc,
const gdb_byte **start,
size_t *length);
/* Evaluate a location description, starting at DATA and with length
SIZE, to find the current location of variable of TYPE in the context
of FRAME. */
struct value *dwarf2_evaluate_loc_desc (struct type *type,
struct frame_info *frame,
const gdb_byte *data,
size_t size,
struct dwarf2_per_cu_data *per_cu);
/* Converts a dynamic property into a static one. ADDRESS is the address
of the object currently being evaluated and might be nedded.
Returns 1 if PROP could be converted and the static value is passed back
into VALUE, otherwise returns 0. */
int dwarf2_evaluate_property (const struct dynamic_prop *prop,
CORE_ADDR address,
CORE_ADDR *value);
the "compile" command This final patch adds the new "compile" command and subcommands, and all the machinery needed to make it work. A shared library supplied by gcc is used for all communications with gcc. Types and most aspects of symbols are provided directly by gdb to the compiler using this library. gdb provides some information about the user's code using plain text. Macros are emitted this way, and DWARF location expressions (and bounds for VLA) are compiled to C code. This hybrid approach was taken because, on the one hand, it is better to provide global declarations and such on demand; but on the other hand, for local variables, translating DWARF location expressions to C was much simpler than exporting a full compiler API to gdb -- the same result, only easier to implement, understand, and debug. In the ordinary mode, the user's expression is wrapped in a dummy function. After compilation, gdb inserts the resulting object code into the inferior, then calls this function. Access to local variables is provided by noting which registers are used by location expressions, and passing a structure of register values into the function. Writes to registers are supported by copying out these values after the function returns. This approach was taken so that we could eventually implement other more interesting features based on this same infrastructure; for example, we're planning to investigate inferior-side breakpoint conditions. gdb/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * NEWS: Update. * symtab.h (struct symbol_computed_ops) <generate_c_location>: New field. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_get_compile_instance, la_compute_program>: New fields. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * jv-lang.c (java_language_defn): Update. * go-lang.c (go_language_defn): Update. * f-lang.c (f_language_defn): Update. * dwarf2loc.h (dwarf2_compile_property_to_c): Declare. * dwarf2loc.c (dwarf2_compile_property_to_c) (locexpr_generate_c_location, loclist_generate_c_location): New functions. (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Update. * defs.h (enum compile_i_scope_types): New. (enum command_control_type) <compile_control>: New constant. (struct command_line) <control_u>: New field. * d-lang.c (d_language_defn): Update. * compile/compile.c: New file. * compile/compile-c-support.c: New file. * compile/compile-c-symbols.c: New file. * compile/compile-c-types.c: New file. * compile/compile.h: New file. * compile/compile-internal.h: New file. * compile/compile-loc2c.c: New file. * compile/compile-object-load.c: New file. * compile/compile-object-load.h: New file. * compile/compile-object-run.c: New file. * compile/compile-object-run.h: New file. * cli/cli-script.c (multi_line_command_p, print_command_lines) (execute_control_command, process_next_line) (recurse_read_control_structure): Handle compile_control. * c-lang.h (c_get_compile_context, c_compute_program): Declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-lang.c (ada_language_defn): Update. * Makefile.in (SUBDIR_GCC_COMPILE_OBS, SUBDIR_GCC_COMPILE_SRCS): New variables. (SFILES): Add SUBDIR_GCC_COMPILE_SRCS. (HFILES_NO_SRCDIR): Add compile.h. (COMMON_OBS): Add SUBDIR_GCC_COMPILE_OBS. (INIT_FILES): Add SUBDIR_GCC_COMPILE_SRCS. (compile.o, compile-c-types.o, compile-c-symbols.o) (compile-object-load.o, compile-object-run.o, compile-loc2c.o) (compile-c-support.o): New targets. gdb/doc/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Altering): Update. (Compiling and Injecting Code): New node. gdb/testsuite/ChangeLog 2014-12-12 Phil Muldoon <pmuldoon@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * configure.ac: Add gdb.compile/. * configure: Regenerate. * gdb.compile/Makefile.in: New file. * gdb.compile/compile-ops.exp: New file. * gdb.compile/compile-ops.c: New file. * gdb.compile/compile-tls.c: New file. * gdb.compile/compile-tls.exp: New file. * gdb.compile/compile-constvar.S: New file. * gdb.compile/compile-constvar.c: New file. * gdb.compile/compile-mod.c: New file. * gdb.compile/compile-nodebug.c: New file. * gdb.compile/compile-setjmp-mod.c: New file. * gdb.compile/compile-setjmp.c: New file. * gdb.compile/compile-setjmp.exp: New file. * gdb.compile/compile-shlib.c: New file. * gdb.compile/compile.c: New file. * gdb.compile/compile.exp: New file. * lib/gdb.exp (skip_compile_feature_tests): New proc.
2014-05-14 22:35:45 +02:00
/* A helper for the compiler interface that compiles a single dynamic
property to C code.
STREAM is where the C code is to be written.
RESULT_NAME is the name of the generated variable.
GDBARCH is the architecture to use.
REGISTERS_USED is a bit-vector that is filled to note which
registers are required by the generated expression.
PROP is the property for which code is generated.
ADDRESS is the address at which the property is considered to be
evaluated.
SYM the originating symbol, used for error reporting. */
void dwarf2_compile_property_to_c (struct ui_file *stream,
const char *result_name,
struct gdbarch *gdbarch,
unsigned char *registers_used,
const struct dynamic_prop *prop,
CORE_ADDR address,
struct symbol *sym);
Initial support for Fission. http://gcc.gnu.org/wiki/DebugFission * symfile.c (default_symfile_relocate): Use sectp->owner instead of objfile->obfd. * symfile.h (dwarf2_debug_sections): New member addr. * dwarf2expr.c (execute_stack_op): New case DW_OP_GNU_addr_index. (ctx_no_get_addr_index): New function. * dwarf2expr.h (dwarf_expr_context_funcs): New member get_addr_index. (ctx_no_get_addr_index): Declare. * dwarf2-frame.c (dwarf2_frame_ctx_funcs): Update. * dwarf2loc.c (dwarf_expr_get_addr_index): New function. (dwarf_expr_ctx_funcs): Update. (needs_get_addr_index): New function. (needs_frame_ctx_funcs): Update. * dwarf2loc.h (dwarf2_read_addr_index): Declare. * dwarf2read.c: #include "gdbcore.h". (dwarf2_per_objfile): New members addr, dwo_files. (dwarf2_elf_names): Add entry for addr. (struct dwo_section_names): New type. (dwo_section_names): New static global. (dwarf2_cu): New members dwo_unit, addr_base, have_addr_base. (dwarf2_per_cu_data): New member is_debug_types, all boolean uses of old debug_types_section member updated to use this. Rename member debug_types_section to info_or_types_section, all uses updated. (signatured_type): Rename member type_offset to type_offset_in_tu, all uses updated. New member type_offset_in_section. (struct dwo_sections): New type. (struct dwo_unit): New type. (struct dwo_file): New type. (die_reader_specs): New member dwo_file. (dwarf2_locate_sections): Watch for .debug_addr. (zlib_decompress_section): Use sectp->owner instead of objfile->obfd. (dwarf2_read_section): Get bfd of section from bfd's asection, instead of objfile. (create_cus_from_index): Initialize the_cu->info_or_types_section. (create_signatured_type_table_from_index): Initialize sig_type->info_or_types_section. (dw2_get_file_names): Statement lists for type units with DWO files live in the DWO file. (create_debug_types_hash_table): New function. (create_all_type_units): Rewrite. (init_cu_die_reader): New arg dwo_file, all callers updated. (init_and_read_dies_worker): Get section from this_cu->info_or_types_section. Set sig_type->type_offset_in_section. Watch for DW_AT_GNU_dwo_name and if present lookup the file and continue reading the CU/TU from there. (init_cutu_and_read_dies_no_follow): New arg dwo_file, all callers updated. Get section from this_cu->info_or_types_section. (create_all_comp_units): Initialize this_cu->info_or_types_section. (skip_one_die): New cases DW_FORM_GNU_addr_index, DW_FORM_GNU_str_index. (hash_dwo_file, eq_dwo_file): New functions. (allocate_dwo_file_hash_table): New function. (hash_dwo_unit, eq_dwo_unit): New functions. (allocate_dwo_unit_table): New function. (dwarf2_locate_dwo_sections): New function. (struct create_dwo_info_table_data): New type. (create_debug_info_hash_table_reader): New function. (create_debug_info_hash_table): New function. (try_open_dwo_file, open_dwo_file, init_dwo_file): New function. (lookup_dwo_file): New function. (lookup_dwo_comp_unit, lookup_dwo_type_unit): New functions. (free_dwo_file, free_dwo_file_cleanup): New functions. (free_dwo_file_from_slot, free_dwo_files): New functions. (dwarf2_get_pc_bounds): Handle DW_FORM_GNU_addr_index. (dwarf2_record_block_ranges): Ditto. (read_partial_die): Ditto. (process_enumeration_scope): Update to use type_offset_in_section. (read_full_die_1): New function. (read_full_die): Rewrite. (read_attribute_value): New cases DW_FORM_GNU_addr_index, DW_FORM_GNU_str_index. (read_addr_index_1, read_addr_index): New functions. (read_addr_index_from_leb128): New function. (struct dwarf2_read_addr_index_data): New type. (dwarf2_read_addr_index_reader): New function. (dwarf2_read_addr_index): New function. (read_str_index): New function. (leb128_size): New function. (dwarf_decode_line_header): Delete arg abfd, all callers updated. If processing a type unit from a DWO file, get the line section from the DWO file. (var_decode_location): Watch for DW_OP_GNU_addr_index. (dwarf2_const_value_attr): New cases DW_FORM_GNU_addr_index, DW_FORM_GNU_str_index. (lookup_die_type): Check whether section offset of type's die is known before looking it up. Remove assert. Condition can legimately happen for inter-cu type references. (dwarf_attr_name): Handle Fission attributes. (dwarf_form_name): Handle Fission forms. (dump_die_shallow): New cases DW_FORM_GNU_addr_index, DW_FORM_GNU_str_index. (follow_die_sig): Update to use type_offset_in_section. (decode_locdesc): New case DW_OP_GNU_addr_index. (skip_form_bytes): New cases DW_FORM_GNU_addr_index, DW_FORM_GNU_str_index. (cu_debug_loc_section): New function. (fill_in_loclist_baton, dwarf2_symbol_mark_computed): Call it. (dwarf2_per_objfile_free): Unmap .debug_addr section. Free DWO files if present. * xcoffread.c (dwarf2_xcoff_names): Add .debug_addr. testsuite/ * gdb.dwarf2/dw2-intercu.S (.Ltype_int2_in_cu2): Renamed from .Ltype_int_in_cu2. Use name "int2" instead of "int". All uses updated. * gdb.dwarf2/dw2-intercu.exp: Add "ptype int2" ahead of "ptype func_cu1" to expand cu2 before cu1.
2012-04-29 01:22:14 +02:00
CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
unsigned int addr_index);
/* The symbol location baton types used by the DWARF-2 reader (i.e.
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
dwarf2_locexpr_baton" is for a symbol with a single location
expression; "struct dwarf2_loclist_baton" is for a symbol with a
location list. */
struct dwarf2_locexpr_baton
{
/* Pointer to the start of the location expression. Valid only if SIZE is
not zero. */
const gdb_byte *data;
/* Length of the location expression. For optimized out expressions it is
zero. */
size_t size;
2008-03-18 Ulrich Weigand <uweigand@de.ibm.com> Jim Blandy <jimb@codesourcery.com> Daniel Jacobowitz <drow@false.org> * dwarf2expr.h (struct dwarf_expr_context): Add ADDR_SIZE member. (dwarf2_read_address): Update prototype. * dwarf2expr.c (unsigned_address_type): Add ADDR_SIZE parameter. (signed_address_type): Likewise. (dwarf2_read_address): Replace BYTES_READ parameter with ADDR_SIZE. (execute_stack_op): Update calls to unsigned_address_type, signed_address_type and dwarf2_read_address. Fix implementation of DW_OP_deref_size. * dwarf2loc.h (dwarf2_per_cu_objfile): Add prototype. (dwarf2_per_cu_addr_size): Likewise. (struct dwarf2_locexpr_baton): Replace OBJFILE with PER_CU. (struct dwarf2_loclist_baton): Likewise. * dwarf2loc.c (find_location_expression): Update calls to dwarf2_read_address. Use dwarf2_per_cu_objfile and dwarf2_per_cu_addr_size to retrieve PER_CU parameters. (locexpr_describe_location): Likewise. (dwarf2_evaluate_loc_desc): Replace OBJFILE with PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (dwarf2_loc_desc_needs_frame): Add PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (locexpr_read_variable): Update dwarf2_evaluate_loc_desc call. (loclist_read_variable): Likewise. (locexpr_read_needs_frame): Update dwarf2_loc_desc_needs_frame call. * dwarf2read.c (dwarf2_symbol_mark_computed): Set baton->per_cu instead of baton->objfile. (dwarf2_per_cu_obfile): New function. (dwarf2_per_cu_addr_size): Likewise. * dwarf2-frame.c (struct comp_unit): Move higher. (struct dwarf2_cie): Add UNIT and ADDR_SIZE members. (execute_stack_op): Add ADDR_SIZE parameter; set ctx->addr_size. (execute_cfa_program): Add FDE parameter. Replace EH_FRAME_P parameter by using fde->eh_frame_p. Use read_encoded_value to implement DW_CFA_set_loc. (struct dwarf2_frame_cache): Add ADDR_SIZE member. (dwarf2_frame_cache): Set cache->addr_size. Update calls to execute_stack_op and execute_cfa_program. (dwarf2_frame_prev_register): Update calls to execute_stack_op. (size_of_encoded_value): Remove. (read_encoded_value): Add PTR_LEN and FUNC_BASE parameters. Remove call to size_of_encoded_value. Implement DW_EH_PE_funcrel. (add_cie): Set cie->unit backlink. (decode_frame_entry_1): Set cie->addr_size. Update calls to read_encoded_value. (dwarf2_build_frame_info): Allocate UNIT on objfile obstack.
2008-03-18 20:40:47 +01:00
/* The compilation unit containing the symbol whose location
we're computing. */
struct dwarf2_per_cu_data *per_cu;
};
struct dwarf2_loclist_baton
{
/* The initial base address for the location list, based on the compilation
unit. */
CORE_ADDR base_address;
/* Pointer to the start of the location list. */
const gdb_byte *data;
/* Length of the location list. */
size_t size;
2008-03-18 Ulrich Weigand <uweigand@de.ibm.com> Jim Blandy <jimb@codesourcery.com> Daniel Jacobowitz <drow@false.org> * dwarf2expr.h (struct dwarf_expr_context): Add ADDR_SIZE member. (dwarf2_read_address): Update prototype. * dwarf2expr.c (unsigned_address_type): Add ADDR_SIZE parameter. (signed_address_type): Likewise. (dwarf2_read_address): Replace BYTES_READ parameter with ADDR_SIZE. (execute_stack_op): Update calls to unsigned_address_type, signed_address_type and dwarf2_read_address. Fix implementation of DW_OP_deref_size. * dwarf2loc.h (dwarf2_per_cu_objfile): Add prototype. (dwarf2_per_cu_addr_size): Likewise. (struct dwarf2_locexpr_baton): Replace OBJFILE with PER_CU. (struct dwarf2_loclist_baton): Likewise. * dwarf2loc.c (find_location_expression): Update calls to dwarf2_read_address. Use dwarf2_per_cu_objfile and dwarf2_per_cu_addr_size to retrieve PER_CU parameters. (locexpr_describe_location): Likewise. (dwarf2_evaluate_loc_desc): Replace OBJFILE with PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (dwarf2_loc_desc_needs_frame): Add PER_CU parameter. Set ctx->addr_size to dwarf2_per_cu_addr_size (per_cu). (locexpr_read_variable): Update dwarf2_evaluate_loc_desc call. (loclist_read_variable): Likewise. (locexpr_read_needs_frame): Update dwarf2_loc_desc_needs_frame call. * dwarf2read.c (dwarf2_symbol_mark_computed): Set baton->per_cu instead of baton->objfile. (dwarf2_per_cu_obfile): New function. (dwarf2_per_cu_addr_size): Likewise. * dwarf2-frame.c (struct comp_unit): Move higher. (struct dwarf2_cie): Add UNIT and ADDR_SIZE members. (execute_stack_op): Add ADDR_SIZE parameter; set ctx->addr_size. (execute_cfa_program): Add FDE parameter. Replace EH_FRAME_P parameter by using fde->eh_frame_p. Use read_encoded_value to implement DW_CFA_set_loc. (struct dwarf2_frame_cache): Add ADDR_SIZE member. (dwarf2_frame_cache): Set cache->addr_size. Update calls to execute_stack_op and execute_cfa_program. (dwarf2_frame_prev_register): Update calls to execute_stack_op. (size_of_encoded_value): Remove. (read_encoded_value): Add PTR_LEN and FUNC_BASE parameters. Remove call to size_of_encoded_value. Implement DW_EH_PE_funcrel. (add_cie): Set cie->unit backlink. (decode_frame_entry_1): Set cie->addr_size. Update calls to read_encoded_value. (dwarf2_build_frame_info): Allocate UNIT on objfile obstack.
2008-03-18 20:40:47 +01:00
/* The compilation unit containing the symbol whose location
we're computing. */
struct dwarf2_per_cu_data *per_cu;
* dwarf2-frame.c (struct dwarf2_cie): Make initial_instructions, end "const gdb_byte *". (struct dwarf2_fde): Make instructions, end "const gdb_byte *". (execute_cfa_program): Update to match API of leb128 functions. (read_1_byte, read_4_bytes, read_8_bytes): Make buf parameter "const gdb_byte *". (read_unsigned_leb128, read_signed_leb128): Delete. (read_initial_length): Change type of buf argument to "const gdb_byte *". (read_encoded_value): Update to match API of leb128 functions. (decode_frame_entry): Change result to "const gdb_byte *", and similarly for "start" parameter. (decode_frame_entry_1): Ditto. Use new leb128 reader functions. (dwarf2_build_frame_info): Change local frame_ptr to "const gdb_byte *". * dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Replaces read_uleb128, read_sleb128. All callers updated. (safe_skip_leb128): New function. (dwarf_block_to_dwarf_reg): Update to match API of leb128 functions. Call gdb_read_uleb128, gdb_skip_leb128 instead of read_uleb128. (dwarf_block_to_dwarf_reg_deref): Update to match API of leb128 functions. Call gdb_read_uleb128, gdb_read_sleb128 instead of read_uleb128, read_sleb128. (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto. (execute_stack_op): Update to match API of leb128 functions. * dwarf2expr.h: #include "leb128.h". (read_uleb128, read_sleb128): Delete. (gdb_read_uleb128, gdb_read_sleb128, gdb_skip_leb128): New functions. (safe_read_uleb128, safe_read_sleb128, safe_skip_leb128): Declare. * dwarf2loc.c (debug_loc_kind): New enum. (decode_debug_loc_addresses): New function. (decode_debug_loc_dwo_addresses): New function. (dwarf2_find_location_expression): Rewrite. (dwarf2_compile_expr_to_ax): Update to match API of leb128 functions. (locexpr_describe_location_piece): Ditto. (disassemble_dwarf_expression): Ditto. (locexpr_describe_location_1): Ditto. (loclist_describe_location): Rewrite. * dwarf2loc.h (dwarf2_loclist_baton): New member "from_dwo". * dwarf2read.c (die_reader_specs): New member "buffer_end". (dwarf2_section_buffer_overflow_complaint): Renamed from dwarf2_macros_too_long_complaint. All callers updated. (skip_leb128): Delete. (init_cu_die_reader): Initialize reader->buffer_end. (skip_one_die): Replace call to skip_leb128 with safe_skip_leb128. (skip_form_bytes): New arg buffer_end. All callers updated. Replace call to skip_leb128 with gdb_skip_leb128. (skip_unknown_opcode): New arg mac_end. All callers updated. (fill_in_loclist_baton): Initialize baton->from_dwo.
2012-05-22 20:45:22 +02:00
/* Non-zero if the location list lives in .debug_loc.dwo.
The format of entries in this section are different. */
unsigned char from_dwo;
};
/* A dynamic property is either expressed as a single location expression
or a location list. If the property is an indirection, pointing to
another die, keep track of the targeted type in REFERENCED_TYPE. */
struct dwarf2_property_baton
{
/* If the property is an indirection, we need to evaluate the location
LOCEXPR or LOCLIST in the context of the type REFERENCED_TYPE.
If NULL, the location is the actual value of the property. */
struct type *referenced_type;
union
{
/* Location expression. */
struct dwarf2_locexpr_baton locexpr;
/* Location list to be evaluated in the context of REFERENCED_TYPE. */
struct dwarf2_loclist_baton loclist;
};
};
* symtab.h: Rename SYMBOL_OPS to SYMBOL_COMPUTED_OPS. * ax-gdb.c (gen_var_ref): Likewise. * findvar.c (read_var_value, symbol_read_needs_frame): Likewise. * printcmd.c (address_info): Likewise. * dwarf2loc.c (dwarf_expr_frame_base): Likewise. * dwarf2read.c (dwarf2_symbol_mark_computed): Likewise. * symtab.h: Rename struct symbol_ops to struct symbol_computed_ops. * dwarf2loc.h: Likewise. * dwarf2loc.c (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Likewise. * symtab.h: (struct symbol_register_ops): New struct definition. (struct symbol): Make "ops" member a union of symbol_computed_ops and symbol_register_ops callback pointers. (SYMBOL_REGISTER_OPS): New macro. * tracepoint.c: Include "objfiles.h". (scope_info, collect_symbol): Use SYMBOL_REGISTER_OPS register_number callback to retrieve register numbers. * ax-gdb.c (gen_var_ref): Likewise. * findvar.c (read_var_value): Likewise. * printcmd.c (address_info): Likewise. * coffread.c (coff_reg_to_regnum): New function. (coff_register_funcs): New static variable. (process_coff_symbol): Do not call gdbarch_sdb_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks. * mdebugread.c (mdebug_reg_to_regnum): New function. (mdebug_register_funcs): New static variable. (parse_symbol): Do not call gdbarch_ecoff_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks. * stabsread.c (stab_reg_to_regnum): New function. (stab_register_funcs): New static variable. (define_symbol): Do not call gdbarch_stab_reg_to_regnum. Install SYMBOL_REGISTER_OPS callbacks.
2009-06-04 14:28:39 +02:00
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
extern const struct symbol_computed_ops dwarf2_loclist_funcs;
2013-03-20 Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> PR symtab/8421: * coffread.c (coff_register_index): New global. (process_coff_symbol, coff_read_enum_type): Set SYMBOL_ACLASS_INDEX. (_initialize_coffread): Initialize new global. * dwarf2loc.c (locexpr_find_frame_base_location) (dwarf2_block_frame_base_locexpr_funcs) (loclist_find_frame_base_location) (dwarf2_block_frame_base_loclist_funcs): New. (dwarf_expr_frame_base_1): Call SYMBOL_BLOCK_OPS, remove internal_error. (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Add location_has_loclist. * dwarf2loc.h (dwarf2_block_frame_base_locexpr_funcs) (dwarf2_block_frame_base_loclist_funcs): New. * dwarf2read.c (dwarf2_locexpr_index, dwarf2_loclist_index) (dwarf2_locexpr_block_index, dwarf2_loclist_block_index): New globals. (read_func_scope): Update. (fixup_go_packaging, mark_common_block_symbol_computed) (var_decode_location, new_symbol_full, dwarf2_const_value): Set SYMBOL_ACLASS_INDEX. (dwarf2_symbol_mark_computed): Likewise. Add 'is_block' argument. (_initialize_dwarf2_read): Initialize new globals. * jit.c (finalize_symtab): Set SYMBOL_ACLASS_INDEX. * jv-lang.c (add_class_symbol): Set SYMBOL_ACLASS_INDEX. * mdebugread.c (mdebug_register_index, mdebug_regparm_index): New globals. (parse_symbol, psymtab_to_symtab_1): Set SYMBOL_ACLASS_INDEX. (_initialize_mdebugread): Initialize new globals. * psympriv.h (struct partial_symbol) <aclass>: Update comment. * stabsread.c (patch_block_stabs): Set SYMBOL_ACLASS_INDEX. (stab_register_index, stab_regparm_index): New globals. (define_symbol, read_enum_type, common_block_end): Set SYMBOL_ACLASS_INDEX. (_initialize_stabsread): Initialize new globals. * symtab.c (next_aclass_value, symbol_impl, symbol_impls): New globals. (MAX_SYMBOL_IMPLS): New define. (register_symbol_computed_impl, register_symbol_block_impl) (register_symbol_register_impl) (initialize_ordinary_address_classes): New functions. (_initialize_symtab): Call initialize_ordinary_address_classes. * symtab.h (enum address_class) <LOC_FINAL_VALUE>: New constant. (struct symbol_impl): New. (SYMBOL_ACLASS_BITS): New define. (struct symbol) <aclass, ops>: Remove fields. <aclass_index>: New field. (symbol_impls): Declare. (SYMBOL_CLASS, SYMBOL_COMPUTED_OPS, SYMBOL_REGISTER_OPS): Redefine. (SYMBOL_IMPL, SYMBOL_ACLASS_INDEX): New defines. (register_symbol_computed_impl, register_symbol_block_impl) (register_symbol_register_impl): Declare. (struct symbol_computed_ops): Add location_has_loclist. (struct symbol_block_ops): New. (SYMBOL_BLOCK_OPS): New. * xcoffread.c (process_xcoff_symbol): Set SYMBOL_ACLASS_INDEX.
2013-03-20 19:33:05 +01:00
extern const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs;
extern const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs;
/* Compile a DWARF location expression to an agent expression.
EXPR is the agent expression we are building.
LOC is the agent value we modify.
ARCH is the architecture.
ADDR_SIZE is the size of addresses, in bytes.
OP_PTR is the start of the location expression.
OP_END is one past the last byte of the location expression.
This will throw an exception for various kinds of errors -- for
example, if the expression cannot be compiled, or if the expression
is invalid. */
extern void dwarf2_compile_expr_to_ax (struct agent_expr *expr,
struct axs_value *loc,
struct gdbarch *arch,
unsigned int addr_size,
const gdb_byte *op_ptr,
const gdb_byte *op_end,
struct dwarf2_per_cu_data *per_cu);
gdb/ Recognize virtual tail call frames. * Makefile.in (SFILES): Add dwarf2-frame-tailcall.c. (HFILES_NO_SRCDIR): Add dwarf2-frame-tailcall.h. (COMMON_OBS): Add dwarf2-frame-tailcall.o. * dwarf2-frame-tailcall.c: New file. * dwarf2-frame-tailcall.h: New file. * dwarf2-frame.c: Include dwarf2-frame-tailcall.h. (execute_cfa_program): New function comment. Return INSN_PTR. Reset REGS.PREV only after CIE execution. (struct dwarf2_frame_cache): New field tailcall_cache. (dwarf2_frame_cache): New variables entry_pc, entry_cfa_sp_offset, entry_cfa_sp_offset_p and instr. Execute FDE instructions in two parts, try to find entry_cfa_sp_offset. Call dwarf2_tailcall_sniffer_first. (dwarf2_frame_prev_register): Call dwarf2_tailcall_prev_register_first when appropriate. (dwarf2_frame_dealloc_cache): New function. (dwarf2_frame_sniffer): Preinitialize cache by dwarf2_frame_cache. (dwarf2_frame_unwind): Install dwarf2_frame_dealloc_cache. (dwarf2_signal_frame_unwind): Do not install dwarf2_frame_dealloc_cache. (dwarf2_append_unwinders): Add dwarf2_tailcall_frame_unwind. (dwarf2_frame_cfa): Support also dwarf2_tailcall_frame_unwind. * dwarf2loc.c (func_addr_to_tail_call_list) (tailcall_dump, call_sitep, VEC (call_sitep), chain_candidate) (call_site_find_chain_1, call_site_find_chain): New. * dwarf2loc.h (struct call_site_chain): New. (call_site_find_chain): New declaration. * frame.c (get_frame_address_in_block): Support also TAILCALL_FRAME. * frame.h (enum frame_type): New entry TAILCALL_FRAME. * python/py-frame.c (gdbpy_initialize_frames): Add TAILCALL_FRAME. * stack.c (frame_info): Support also TAILCALL_FRAME. gdb/doc/ Recognize virtual tail call frames. * gdb.texinfo (Optimized Code): Add reference to Tail Call Frames. (Tail Call Frames): New node. (Frames In Python): Add gdb.TAILCALL_FRAME. gdb/testsuite/ Recognize virtual tail call frames. * gdb.arch/amd64-entry-value.cc (c, a, b, amb_z, amb_y, amb_x, amb) (amb_b, amb_a): New. (main): Call a and b. * gdb.arch/amd64-entry-value.exp (tailcall: breakhere, tailcall: bt) (tailcall: p i, tailcall: p j, set $sp0=$sp, up, p $sp0 == $sp, frame 3) (p $sp0 + sizeof (void *) == $sp, ambiguous: breakhere, ambiguous: bt): New tests.
2011-10-09 21:26:44 +02:00
/* Determined tail calls for constructing virtual tail call frames. */
struct call_site_chain
{
/* Initially CALLERS == CALLEES == LENGTH. For partially ambiguous result
CALLERS + CALLEES < LENGTH. */
int callers, callees, length;
/* Variably sized array with LENGTH elements. Later [0..CALLERS-1] contain
top (GDB "prev") sites and [LENGTH-CALLEES..LENGTH-1] contain bottom
(GDB "next") sites. One is interested primarily in the PC field. */
struct call_site *call_site[1];
};
struct call_site_stuff;
extern struct call_site_chain *call_site_find_chain (struct gdbarch *gdbarch,
CORE_ADDR caller_pc,
CORE_ADDR callee_pc);
/* A helper function to convert a DWARF register to an arch register.
ARCH is the architecture.
DWARF_REG is the register.
This will throw an exception if the DWARF register cannot be
translated to an architecture register. */
extern int dwarf2_reg_to_regnum_or_error (struct gdbarch *arch, int dwarf_reg);
* dwarf2expr.h: Tweak comment. (struct dwarf_expr_context): Use `gdb_byte *' in read_mem and get_frame_base function pointers. (read_uleb128, read_sleb128): Change return type and types of first two arguments to `gdb_byte *'. (dwarf2_read_address): Change types of first two arguments to `gdb_byte *'. * dwarf2expr.c: Tweak comment. (dwarf_expr_eval): Change type of second argument to `gdb_byte *'. (read_uleb128, read_sleb128): Change return type and types of first two arguments to `gdb_byte *'. (dwarf2_read_address): Change types of first two arguments to `gdb_byte *'. (execute_stack_op): Change types of last two arguments to `gdb_byte *'. Use `gdb_byte *' for byte buffers. * dwarf2loc.h: Tweak comment. (struct dwarf2_locexpr_baton, struct dwarf2_loclist_baton): Use `gdb_byte *' for byte buffers. * dwarf2loc.c (find_location_expression): Change return type to `gdb_byte *'. Use `gdb_byte *' for byte buffers. Change length to `unsigned int'. (dwarf_expr_read_reg): Use `gdb_byte *' for byte buffer. Remove bogus cast. (dwarf_expr_read_mem): Change type of second argument to `gdb_byte *'. (dwarf_expr_frame_base): Change type of second argument to `gdb_byte **'. (dwarf2_evaluate_loc_desc): Change type of third argument to `gdb_byte *'. (needs_frame_read_mem): Change type of second argument to `gdb_byte *'. (needs_frame_frame_base): Change type of second argument `gdb_byte **'. Use gdb_byte for lit0. (dwarf2_tracepoint_var_ref): Change type of fourth argument to `gdb_byte *'. Use `gdb_byte *' for byte buffer. (loclist_read_variable, loclist_tracepoint_var_ref): Use `gdb_byte *' for byte buffer. * dwarf2-frame.c (struct dwarf2_cie, struct dwarf2_fde) (struct dwarf2_frame_state): Use gdb_byte instead of `unsigned char'. (read_reg): Use `gdb_byte *' for byte buffers. Remove redundant cast. (read_mem): Change second argument to `gdb_byte *'. (no_get_frame_base): Change second argument to `gdb_byte **'. (execute_stack_op): Change first argument to `gdb_byte *'. (execute_cfa_program): Change first two arguments to `gdb_byte *'. Use gdb_byte instead of `unsigned int'. Use temprorary variable to store result of read_uleb128. (struct comp_unit): Use `gdb_byte *' for byte buffers. (read_1_byte, read_4_bytes, read_8_bytes): Change last argument to `gdb_byte *'. (read_unsigned_leb128, read_signed_leb128): Change second argument to `gdb_byte *'. Use gdb_byte instead of `unsigned char'. (read_initial_length): Change second argument to `gdb_byte *'. Remove redundant casts. (read_encoded_value): Use gdb_byte instead of `unsigned char'. Remove bogus casts. (decode_frame_entry_1): Change return type and second argument to `gdb_byte *'. Use `gdb_byte *' for byte buffers. Use gdb_byte instead of `unsigned char'. (decode_frame_entry): Change return type and second argument to `gdb_byte *'. Use `gdb_byte *' for byte buffers. (dwarf2_build_frame_info): Use `gdb_byte *' for byte buffers.
2005-07-12 15:06:54 +02:00
#endif /* dwarf2loc.h */