Commit Graph

145 Commits

Author SHA1 Message Date
Pedro Alves 507a579c9a -Wpointer-sign: dwarf2-frame.c: Pass unsigned variable to safe_read_uleb128.
The 'bytes_read' change should be obvious.  As for the other hunk,
we're passing the address of the signed 'offset' to safe_read_uleb128,
which expects unsigned.  Fix it by passing the address of the unsigned
'utmp' instead, like already done on other spots in the file.

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

	* dwarf2-frame.c (execute_cfa_program): Make 'bytes_read' local
	unsigned.  Pass 'tmp' to safe_read_uleb128 instead of the signed
	'offset', and adjust.
2013-04-19 15:35:21 +00:00
Tom Tromey d521ce577a * dwarf2-frame.c (struct comp_unit) <dwarf_frame_buffer>: Now
const.
	* dwarf2read.c (struct dwarf2_section_info) <buffer>: Now const.
	(struct die_reader_specs) <buffer>: Likewise.
	(die_reader_func_ftype): Make 'info_ptr' const.
	(struct line_header) <include_dirs, statement_program_start,
	statement_program_end>: Now const.
	(struct file_entry) <name>: Likewise.
	(struct partial_die_info) <sibling>: Likewise.
	(struct dwarf_block) <data>: Likewise.
	(dwarf2_read_section): Remove cast.
	(dwarf2_get_section_info): Make 'bufp' const.
	(read_index_from_section): Constify.
	(dw2_get_file_names_reader): Make 'info_ptr' const.
	(dw2_get_primary_filename_reader): Likewise.
	(read_comp_unit_head): Make 'info_ptr' and return type const.
	(read_and_check_comp_unit_head, read_and_check_type_unit_head):
	Likewise.
	(read_abbrev_offset): Constify.
	(dwarf2_create_include_psymtab): Make 'name' const.
	(create_debug_types_hash_table): Update.
	(read_cutu_die_from_dwo): Make 'result_info_ptr' const.
	(init_cutu_and_read_dies, init_cutu_and_read_dies_no_follow):
	Constify.
	(process_psymtab_comp_unit_reader, build_type_psymtabs_reader)
	(load_partial_comp_unit_reader): Make 'info_ptr' const.
	(read_comp_units_from_section): Constify.
	(peek_abbrev_code, peek_die_abbrev, skip_children, skip_one_die)
	(locate_pdi_sibling, load_full_comp_unit_reader): Make 'info_ptr'
	const.
	(dwarf2_compute_name, setup_type_unit_groups): Constify.
	(create_dwo_debug_info_hash_table): Make 'info_ptr' const.
	(create_dwp_hash_table, dwarf2_ranges_read)
	(dwarf2_record_block_ranges): Constify.
	(read_die_and_children, read_die_and_siblings_1)
	(read_die_and_siblings): Make 'info_ptr' and 'new_info_ptr'
	const.
	(read_full_die_1, read_full_die): Make 'info_ptr' const.
	(abbrev_table_read_table): Constify.
	(load_partial_dies): Make 'info_ptr' const.
	(read_partial_die, read_attribute_value, read_attribute): Make
	'info_ptr' and return type const.
	(read_address, read_initial_length)
	(read_checked_initial_length_and_offset, read_offset)
	(read_offset_1, read_n_bytes, read_direct_string): Make 'buf'
	const.
	(read_direct_string): Make 'buf' and return type const.
	(read_indirect_string_at_offset, read_indirect_string_from_dwz)
	(read_indirect_string): Make return type const.
	(read_unsigned_leb128, read_signed_leb128): Make 'buf' const.
	(read_addr_index_from_leb128, dwarf2_read_addr_index_reader): Make
	'info_ptr' const.
	(read_str_index): Make return type const.
	(add_include_dir): Make 'include_dir' const.
	(add_file_name): Make 'name' const.
	(dwarf_decode_line_header): Constify.
	(psymtab_include_file_name): Make return type const.
	(dwarf_decode_lines_1, dwarf_decode_lines): Constify.
	(dwarf2_start_subfile): Make 'filename' const.
	(dwarf2_const_value_attr): Make 'bytes' const.
	(read_signatured_type_reader): Make 'info_ptr' const.
	(decode_locdesc): Constify.
	(skip_form_bytes): Make 'bytes', 'buffer_end', and return type
	const.
	(skip_unknown_opcode): Make 'opcode_definitions', 'mac_ptr',
	'mac_end', and return type const.
	(dwarf_parse_macro_header): Make 'mac_ptr' and return type const.
	(dwarf_decode_macro_bytes): Make 'mac_ptr', 'mac_end', and return
	type const.
	(per_cu_header_read_in): Constify.
	* symfile.h (dwarf2_get_section_info): Update.
2013-04-12 14:55:28 +00:00
Aleksandar Ristovski c656bca578 2013-01-31 Aleksandar Ristovski <aristovski@qnx.com>
* dwarf2-frame.c (dwarf2_compile_cfa_to_ax): Remove unused num_regs.
        * symtab.c (iterate_over_symtabs): Remove unused s.
        (find_pc_sect_symtab): Remove unused pspAce.
        (find_pc_sect_line): Remove unused alt_symtab.
        (find_pcs_for_symtab_line): Remove unused ix, previous_function.
        (completion_list_add_name): Remove unused newsize.

Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00764.html
2013-01-31 18:31:48 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Jan Kratochvil 74a0d9f6a5 gdb/
* configure.ac (CC_HAS_LONG_LONG): Replace by AC_MSG_ERROR.
	* defs.h (LONGEST, ULONGEST): Remove conditionalization for
	CC_HAS_LONG_LONG.
	* dwarf2-frame.c (DW64_CIE_ID): Likewise.
	* dwarf2read.c (extract_cu_value): Remove the function.
	(create_cus_from_index_list): Make the return type void, inline the
	extract_cu_value caller, include new gdb_static_assert.
	(create_cus_from_index): Make the return type void, update the function
	comment, update the create_cus_from_index_list caller.
	(create_signatured_type_table_from_index): Make the return type void,
	inline the extract_cu_value caller, include new gdb_static_assert.
	(dwarf2_read_index): Update the create_cus_from_index and
	create_signatured_type_table_from_index caller.
	* printcmd.c (ui_printf): Remove conditionalizations for
	CC_HAS_LONG_LONG.
	* config.in: Regenerate.
	* configure: Regenerate.

gdb/doc/
	* gdbint.texinfo (Host Definition): Remove CC_HAS_LONG_LONG.
2012-12-09 18:39:59 +00:00
Joel Brobecker 0c92d8c1c3 DWARF frame unwinder executes one too many rows
The problem is trying to unwind from a function where %ebp is NOT
used as the frame pointer, and the size of the frame changes over
the lifetime of that function.

For instance, trying to unwind past the GNAT runtime function
called system.tasking.rendezvous.timed_selective_wait on x86-linux,
one can get:

    (gdb) bt
    [...]
    #3  0x0805364b in system.tasking.rendezvous.timed_selective_wait ()
    #4  0xb7fe5068 in ?? ()
    Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Looking at the CFI, we find the following initial instructions...

>   DW_CFA_def_cfa: %esp+4 (r4 ofs 4)
>   DW_CFA_offset: %eip at cfa-4  (r8 = %eip)

... and the associated FDE:

> 00001be4 00000054 00001be8 FDE cie=00000000 pc=08053310..08053951
[...]
>   DW_CFA_advance_loc: 8 to 080534ad
>   DW_CFA_def_cfa_offset: 112
>   DW_CFA_advance_loc2: 414 to 0805364b
>   DW_CFA_def_cfa_offset: 108
[...]

The problem is that the DWARF frame unwinder executed the FDE until
the row for PC == 0x0805364b. But in reality, our program hasn't
executed the instruction at that address yet (it is the return address).
So GDB executed a little too much of the FDE, giving us the wrong
offset for the frame base, and thus the wrong address where %eip
got saved.

This patch fixes the problem by using a more correct PC as the bound
for executing the FDE.

gdb/ChangeLog:

        * dwarf2-frame.c (dwarf2_frame_cache): Use
        get_frame_address_in_block instead of get_frame_pc as
        the bound for executing the frame's FDE.

gdb/testsuite/ChangeLog:

        * gdb.ada/rdv_wait: New testcase.
2012-08-16 15:45:46 +00:00
Tom Tromey 78ac5f8316 * dwarf2-frame.c (clear_pointer_cleanup): New function.
(dwarf2_frame_cache): Use it.
	* frame-unwind.h (frame_sniffer_ftype): Document prologue
	cache initialization constraint.
2012-08-06 19:20:43 +00:00
Tom Tromey 5a1cf4d6a8 * dwarf2-frame.c (dwarf2_frame_cache): Call do_cleanups before
return.
2012-08-03 20:52:47 +00:00
Doug Evans 9fccedf760 * dwarf2-frame.c (execute_cfa_program): Update to handle long long ->
int64_t change to leb128 API.
	(read_encoded_value, decode_frame_entry_1): Ditto.
	* dwarf2expr.c (safe_read_uleb128, safe_read_sleb128): Ditto.
	(dwarf_block_to_dwarf_reg, dwarf_block_to_dwarf_reg_deref): Ditto.
	(dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): Ditto.
	(execute_stack_op): Ditto.
	* dwarf2expr.h (gdb_read_uleb128, gdb_read_sleb128): Ditto.
	(safe_read_uleb128, safe_read_sleb128): Ditto.
	* dwarf2loc.c (decode_debug_loc_dwo_addresses): Ditto.
	(dwarf2_compile_expr_to_ax): Ditto.
	(locexpr_describe_location_piece): Ditto.
	(disassemble_dwarf_expression): Ditto.
	(locexpr_describe_location_1): Ditto.
2012-05-24 01:26:15 +00:00
Doug Evans f664829eae * 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 18:45:22 +00:00
Sergio Durigan Junior 22e048c9dd 2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com>
* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c:
	* avr-tdep.c:
	* ax-gdb.c:
	* bfin-linux-tdep.c:
	* breakpoint.c:
	* c-valprint.c:
	* cli/cli-cmds.c:
	* coffread.c:
	* cp-support.c:
	* cris-tdep.c:
	* dwarf2-frame-tailcall.c:
	* dwarf2-frame.c:
	* dwarf2expr.c:
	* dwarf2loc.c:
	* dwarf2read.c:
	* elfread.c:
	* eval.c:
	* expprint.c:
	* f-valprint.c:
	* frv-tdep.c:
	* h8300-tdep.c:
	* hppa-hpux-tdep.c:
	* hppa-tdep.c:
	* hppanbsd-tdep.c:
	* i386-nto-tdep.c:
	* i386-tdep.c:
	* i387-tdep.c:
	* ia64-tdep.c:
	* jit.c:
	* linespec.c:
	* linux-tdep.c:
	* lm32-tdep.c:
	* m2-valprint.c:
	* m32c-tdep.c:
	* m32r-rom.c:
	* m32r-tdep.c:
	* m68k-tdep.c:
	* m68klinux-tdep.c:
	* mi/mi-main.c:
	* microblaze-tdep.c:
	* mips-linux-tdep.c:
	* mips-tdep.c:
	* mn10300-tdep.c:
	* p-valprint.c:
	* parse.c:
	* ppc-linux-tdep.c:
	* ppc-sysv-tdep.c:
	* printcmd.c:
	* python/py-finishbreakpoint.c:
	* python/py-inferior.c:
	* python/py-infthread.c:
	* python/py-type.c:
	* python/python.c:
	* remote-fileio.c:
	* remote-m32r-sdi.c:
	* remote-mips.c:
	* reverse.c:
	* rl78-tdep.c:
	* rs6000-aix-tdep.c:
	* rs6000-tdep.c:
	* s390-tdep.c:
	* score-tdep.c:
	* sh64-tdep.c:
	* skip.c:
	* solib-darwin.c:
	* solib-dsbt.c:
	* solib-frv.c:
	* sparc-tdep.c:
	* spu-multiarch.c:
	* spu-tdep.c:
	* stack.c:
	* symfile.c:
	* symtab.c:
	* tic6x-tdep.c:
	* tracepoint.c:
	* v850-tdep.c:
	* valarith.c:
	* valprint.c:
	* value.c:
	* xcoffread.c:
	* xtensa-tdep.c:
	* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c: Delete unused variables.
2012-05-18 21:02:52 +00:00
Doug Evans 3019eac3a2 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-28 23:22:14 +00:00
Pedro Alves c0bf857deb 2012-01-17 Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (dwarf2_frame_cfa): Throw NOT_AVAILABLE_ERROR, if
	the frame's stop reason is UNWIND_UNAVAILABLE.
2012-01-17 14:03:33 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Jan Kratochvil 111c64899c 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 19:26:44 +00:00
Jan Kratochvil 8e3b41a906 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 19:21:39 +00:00
Jan Kratochvil 181cebd4f8 gdb/
Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches.
	* dwarf2-frame.c (execute_stack_op): Initialize ctx->ref_addr_size.
	* dwarf2expr.c (execute_stack_op) <DW_OP_GNU_implicit_pointer>: Use
	ctx->ref_addr_size.  Handle its invalid value.
	* dwarf2expr.h (struct dwarf_expr_context): New field ref_addr_size.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full)
	(dwarf2_loc_desc_needs_frame): Initialize ctx->ref_addr_size.
	* dwarf2loc.h (dwarf2_per_cu_ref_addr_size): New declaration.
	* dwarf2read.c (decode_locdesc): Initialize ctx->ref_addr_size.
	(dwarf2_per_cu_ref_addr_size): New function.

gdb/testsuite/
	Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches.
	* gdb.dwarf2/implptr-64bit.S: New file.
	* gdb.dwarf2/implptr-64bit.exp: New file.
2011-10-09 18:46:41 +00:00
Jan Kratochvil 523f3620b8 gdb/
* dwarf2-frame.c (no_get_frame_base, no_get_frame_cfa, no_get_frame_pc)
	(no_get_tls_address, no_dwarf_call, no_base_type): Move to the other
	file.
	(dwarf2_frame_ctx_funcs): Reference the renamed functions.
	* dwarf2expr.c (ctx_no_get_frame_base, ctx_no_get_frame_cfa)
	(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
	(ctx_no_get_base_type): Move the functions here.
	* dwarf2expr.h (ctx_no_get_frame_base, ctx_no_get_frame_cfa)
	(ctx_no_get_frame_pc, ctx_no_get_tls_address, ctx_no_dwarf_call)
	(ctx_no_get_base_type): New declarations.
2011-07-27 17:06:13 +00:00
Jan Kratochvil 9e8b7a03dd gdb/
Code cleanup.
	* dwarf2-frame.c (dwarf2_frame_ctx_funcs): New.
	(execute_stack_op): Use dwarf2_frame_ctx_funcs
	* dwarf2expr.c (dwarf_get_base_type): Access get_base_type via funcs.
	(execute_stack_op): Access read_reg, get_frame_base, read_mem,
	get_frame_cfa, get_tls_address and dwarf_call via funcs.
	* dwarf2expr.h (struct dwarf_expr_context): New forward declaration.
	(struct dwarf_expr_context_funcs): New, move here methods from ...
	(struct dwarf_expr_context): ... here.  New fields funcs.
	* dwarf2loc.c (dwarf_expr_dwarf_call): Access get_frame_pc via funcs.
	(dwarf_expr_ctx_funcs): New.
	(dwarf2_evaluate_loc_desc_full): Use dwarf_expr_ctx_funcs.
	(needs_frame_dwarf_call): Access get_frame_pc via funcs.
	(needs_frame_ctx_funcs): New.
	(dwarf2_loc_desc_needs_frame): Use needs_frame_ctx_funcs.
2011-07-15 20:54:32 +00:00
Fawzi Mohamed 8bd908398f 2011-07-15 Fawzi Mohamed <fawzi.mohamed@nokia.com>
* dwarf2-frame.c (decode_frame_entry, decode_frame_entry_1): Ensure
	that CIE pointer of an FDE really points to a CIE .
2011-07-15 15:01:04 +00:00
Joel Brobecker d40102a141 Do not load .eh_frame section from separete object files
We don't need to read the .eh_frame section from the separate
object files, because this data is already present in the
main executable (it needs to, or the program wouldn't work).

We discovered this investigating a problem with the 'next' command,
which was due to unwind failures, which came from the fact that
the .eh_frame was incorrectly relocated.

gdb/ChangeLog (Tristan Gingold):

    * dwarf2-frame.c (dwarf2_build_frame_info): Do not load .eh_frame
    section in separate object files.
2011-07-04 16:30:09 +00:00
Tristan Gingold 3017a00367 2011-05-24 Tristan Gingold <gingold@adacore.com>
* symfile.h (enum dwarf2_section_enum): New type.
	(dwarf2_get_section_info): New prototype.
	* dwarf2read.c (dwarf2_get_section_info): Replace parameter
	section_name by sect.  Use a switch to select the info.
	* dwarf2-frame.c (warf2_get_section_info): Remove prototype.
	(dwarf2_build_frame_info): Adjust calls to dwarf2_get_section_info.
2011-05-24 12:40:17 +00:00
Tom Tromey 72fc29ff12 * utils.c (do_value_free): New function.
(make_cleanup_value_free): Likewise.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Handle value
	freeing correctly.
	(dwarf2_loc_desc_needs_frame): Call
	make_cleanup_value_free_to_mark.
	* dwarf2expr.h (struct dwarf_expr_context) <mark>: Remove field.
	* dwarf2expr.c (free_dwarf_expr_context): Don't call
	value_free_to_mark.
	(new_dwarf_expr_context): Don't call value_mark.
	* dwarf2-frame.c (execute_stack_op): Call
	make_cleanup_value_free_to_mark.
	* defs.h (make_cleanup_value_free): Declare.
2011-05-13 15:44:49 +00:00
Tom Tromey 8a9b8146fd 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 17:40:55 +00:00
Pedro Alves 8fbca658f0 gdb/
* frame.c (frame_unwind_register): Throw an error if unwinding the
	register failed.
	* get_prev_frame_1 (get_prev_frame_1): Ask the unwinder if there's
	an unwind stop reason.
	(frame_stop_reason_string): Handle UNWIND_UNAVAILABLE.
	* frame.h (enum unwind_stop_reason) <UNWIND_OUTERMOST,
	UNWIND_UNAVAILABLE>: New.
	* inline-frame.c (inline_frame_unwind): Install
	default_frame_unwind_stop_reason.
	* frame-unwind.c: Include "exceptions.h".
	(frame_unwind_find_by_frame): Swallow NOT_AVAILABLE_ERROR errors.
	(default_frame_unwind_stop_reason): New.
	* frame-unwind.h (frame_unwind_stop_reason_ftype): New typedef.
	(default_frame_unwind_stop_reason): Declare.
	(struct frame_unwind) <stop_reason>: New function pointer.

	* dummy-frame.c: Install default_frame_unwind_stop_reason.
	* dwarf2-frame.c: Include exceptions.h.
	(struct dwarf2_frame_cache) <unavailable_retaddr>: New field.
	(dwarf2_frame_cache): Swallow NOT_AVAILABLE_ERROR errors when
	computing the CFA.  If such an error was thrown, set
	unavailable_retaddr.
	(dwarf2_frame_unwind_stop_reason): New.
	(dwarf2_frame_this_id): Don't build a frame id if the CFA was
	unavailable.
	(dwarf2_frame_unwind): Install dwarf2_frame_unwind_stop_reason.
	(dwarf2_signal_frame_unwind): Ditto.

	* amd64-tdep.c: Include "exceptions.h".
	(struct amd64_frame_cache): New field "base_p".
	(amd64_init_frame_cache): Clear it.
	(amd64_frame_cache_1): New, factored out from amd64_frame_cache.
	Avoid reading registers with functions that throw if the register
	is not necessary to compute the frame base.
	(amd64_frame_cache): Reimplement wrapping amd64_frame_cache_1, and
	swallowing NOT_AVAILABLE_ERROR.
	(amd64_frame_unwind_stop_reason): New.
	(amd64_frame_this_id): Don't build a frame id if the frame base
	was unavailable.
	(amd64_frame_unwind): Install amd64_frame_unwind_stop_reason.
	(amd64_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
	base_p if the frame base was computable.
	(amd64_sigtramp_frame_unwind_stop_reason): New.
	(amd64_sigtramp_frame_this_id): Don't build a frame id if the
	frame base was unavailable.
	(amd64_sigtramp_frame_unwind): Install
	amd64_sigtramp_frame_unwind_stop_reason.
	(amd64_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
	base_p if the frame base was computable.
	(amd64_epilogue_frame_unwind_stop_reason): New.
	(amd64_epilogue_frame_this_id): Don't build a frame id if the
	frame base was unavailable.
	(amd64_epilogue_frame_unwind): Install
	amd64_epilogue_frame_unwind_stop_reason.
	* i386-tdep.c: Include "exceptions.h".
	(struct i386_frame_cache): New field "base_p".
	(i386_init_frame_cache): Clear it.
	(i386_frame_cache_1): New, factored out from amd64_frame_cache.
	Avoid reading registers with functions that throw if the register
	is not necessary to compute the frame base.
	(i386_frame_cache): Reimplement wrapping amd64_frame_cache_1, and
	swallowing NOT_AVAILABLE_ERROR.
	(i386_frame_unwind_stop_reason): New.
	(i386_frame_this_id): Don't build a frame id if the frame base was
	unavailable.
	(i386_frame_prev_register): Handle unavailable SP.
	(i386_frame_unwind): Install i386_frame_unwind_stop_reason.
	(i386_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
	base_p if the frame base was computable.
	(i386_epilogue_frame_unwind_stop_reason): New.
	(i386_epilogue_frame_this_id): Don't build a frame id if the frame
	base was unavailable.
	(i386_epilogue_frame_unwind): Install
	i386_epilogue_frame_unwind_stop_reason.
	(i386_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
	base_p if the frame base was computable.
	(i386_sigtramp_frame_unwind_stop_reason): New.
	(i386_sigtramp_frame_this_id): Don't build a frame id if the frame
	base was unavailable.
	(i386_sigtramp_frame_unwind): Install
	i386_sigtramp_frame_unwind_stop_reason.
	* sentinel-frame.c (sentinel_frame_prev_register): Use the value
	type's size, not the register's.
	(sentinel_frame_unwind): Install default_frame_unwind_stop_reason.

	* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind): Install
	default_frame_unwind_stop_reason.
	* alpha-tdep.c (alpha_sigtramp_frame_unwind)
	(alpha_heuristic_frame_unwind): Ditto.
	* amd64obsd-tdep.c (amd64obsd_trapframe_unwind): Ditto.
	* arm-tdep.c (arm_prologue_unwind, arm_stub_unwind): Ditto.
	* avr-tdep.c (avr_frame_unwind): Ditto.
	* cris-tdep.c (cris_sigtramp_frame_unwind, cris_frame_unwind):
	Ditto.
	* frv-linux-tdep.c (frv_linux_sigtramp_frame_unwind): Ditto.
	* frv-tdep.c (frv_frame_unwind): Ditto.
	* h8300-tdep.c (h8300_frame_unwind): Ditto.
	* hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind): Ditto.
	* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind): Ditto.
	* hppa-tdep.c (hppa_frame_unwind, hppa_fallback_frame_unwind)
	(hppa_stub_frame_unwind): Ditto.
	* i386obsd-tdep.c (i386obsd_trapframe_unwind): Ditto.
	* ia64-tdep.c (ia64_frame_unwind, ia64_sigtramp_frame_unwind)
	(ia64_libunwind_frame_unwind)
	(ia64_libunwind_sigtramp_frame_unwind): Ditto.
	* iq2000-tdep.c (iq2000_frame_unwind): Ditto.
	* lm32-tdep.c (lm32_frame_unwind): Ditto.
	* m32c-tdep.c (m32c_unwind): Ditto.
	* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_unwind): Ditto.
	* m32r-tdep.c (m32r_frame_unwind): Ditto.
	* m68hc11-tdep.c (m68hc11_frame_unwind): Ditto.
	* m68k-tdep.c (m68k_frame_unwind): Ditto.
	* m68klinux-tdep.c (m68k_linux_sigtramp_frame_unwind): Ditto.
	* m88k-tdep.c (m88k_frame_unwind): Ditto.
	* mep-tdep.c (mep_frame_unwind): Ditto.
	* microblaze-tdep.c (microblaze_frame_unwind): Ditto.
	* mips-tdep.c (mips_insn16_frame_unwind, mips_insn32_frame_unwind)
	(mips_stub_frame_unwind): Ditto.
	* mn10300-tdep.c (mn10300_frame_unwind): Ditto.
	* moxie-tdep.c (moxie_frame_unwind): Ditto.
	* mt-tdep.c (mt_frame_unwind): Ditto.
	* ppc-linux-tdep.c (ppu2spu_unwind): Ditto.
	* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_unwind): Ditto.
	* rs6000-tdep.c (rs6000_frame_unwind): Ditto.
	* s390-tdep.c (s390_frame_unwind, s390_stub_frame_unwind)
	(s390_sigtramp_frame_unwind): Ditto.
	* score-tdep.c (score_prologue_unwind): Ditto.
	* sh-tdep.c (sh_frame_unwind): Ditto.
	* sh64-tdep.c (sh64_frame_unwind): Ditto.
	* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_unwind): Ditto.
	* sparc-tdep.c (sparc32_frame_unwind): Ditto.
	* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_unwind): Ditto.
	* sparc64-tdep.c (sparc64_frame_unwind): Ditto.
	* sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_unwind): Ditto.
	* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_unwind): Ditto.
	* sparc64obsd-tdep.c (sparc64obsd_frame_unwind)
	(sparc64obsd_trapframe_unwind): Ditto.
	* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_unwind): Ditto.
	* sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_unwind): Ditto.
	* spu-tdep.c (spu_frame_unwind, spu2ppu_unwind): Ditto.
	* v850-tdep.c (v850_frame_unwind): Ditto.
	* vax-tdep.c (vax_frame_unwind): Ditto.
	* vaxobsd-tdep.c (vaxobsd_sigtramp_frame_unwind): Ditto.
	* xstormy16-tdep.c (frame_unwind xstormy16_frame_unwind): Ditto.
	* xtensa-tdep.c (xtensa_unwind): Ditto.
2011-03-18 18:52:32 +00:00
Tom Tromey 9f6f94ff25 * dwarf2loc.h (dwarf2_compile_expr_to_ax): Declare.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Rename from
	compile_dwarf_to_ax.  No longer static.  Call
	dwarf2_compile_cfa_to_ax.
	(locexpr_tracepoint_var_ref): Update.
	(loclist_tracepoint_var_ref): Update.
	* dwarf2-frame.h (dwarf2_compile_cfa_to_ax): Declare.
	* dwarf2-frame.c (execute_cfa_program): Remove 'this_frame'
	argument; add 'gdbarch' and 'pc'.
	(dwarf2_compile_cfa_to_ax): New function.
	(dwarf2_frame_cache): Update.
2011-02-17 16:20:44 +00:00
Michael Snyder 0963b4bd45 2011-01-07 Michael Snyder <msnyder@vmware.com>
* ada-lang.c: Comment cleanup, mostly periods and spaces.
	* ada-lang.h: Ditto.
	* ada-tasks.c: Ditto.
	* ada-valprint.c: Ditto.
	* aix-threads.c: Ditto.
	* alpha-linux-nat.c: Ditto.
	* alpha-linux-tdep.c: Ditto.
	* alpha-mdebug-tdep.c: Ditto.
	* alpha-nat.c: Ditto.
	* alpha-osf1-tdep.c: Ditto.
	* alpha-tdep.c: Ditto.
	* alphabsd-nat.c: Ditto.
	* alphabsd-tdep.c: Ditto.
	* amd64-darwin-tdep.c: Ditto.
	* amd64-linux-nat.c: Ditto.
	* amd64-linux-tdep.c: Ditto.
	* amd64-sol2-tdep.c: Ditto.
	* amd64-tdep.c: Ditto.
	* amd64-fbsd-tdep.c: Ditto.
	* amd64-nbsd-tdep.c: Ditto.
	* amd64-obsd-tdep.c: Ditto.
	* amd64-linux-nat.c: Ditto.
	* amd64-linux-tdep.c: Ditto.
	* arm-tdep.c: Ditto.
	* arm-tdep.h: Ditto.
	* armnbsd-nat.c: Ditto.
	* avr-tdep.c: Ditto.
	* bfin-tdep.c: Ditto.
	* bsd-kvm.c: Ditto.
	* c-typeprintc: Ditto.
	* c-valprint.c: Ditto.
	* coff-pe-read.h: Ditto.
	* coffreead.c: Ditto.
	* cris-tdep.c: Ditto.
	* d-lang.c: Ditto.
	* darwin-nat-info.c: Ditto.
	* darwin-nat.c: Ditto.
	* dbug-rom.c: Ditto.
	* dbxread.c: Ditto.
	* dcache.c: Ditto.
	* dcache.h: Ditto.
	* dec-thread.c: Ditto.
	* defs.h: Ditto.
	* demangle.c: Ditto.
	* dicos-tdep.c: Ditto.
	* dictionary.c: Ditto.
	* dictionary.h: Ditto.
	* dink32-rom.c: Ditto.
	* disasm.c: Ditto.
	* doublest.c: Ditto.
	* dsrec.c: Ditto.
	* dummy-frame.c: Ditto.
	* dwarf2-frame.c: Ditto.
	* dwarf2expr.c: Ditto.
	* dwarf2loc.c: Ditto.
	* dwarf2read.c: Ditto.
	* elfread.c: Ditto.
	* environ.c: Ditto.
	* eval.c: Ditto.
	* event-top.h: Ditto.
	* exceptions.c: Ditto.
	* exceptions.h: Ditto.
	* exec.c: Ditto.
	* expprint.c: Ditto.
	* expression.h: Ditto.
	* f-exp.y: Ditto.
	* f-lang.c: Ditto.
	* f-lang.h: Ditto.
	* f-typeprint.c: Ditto.
	* f-valprint.c: Ditto.
	* fbsd-nat.c: Ditto.
	* findvar.c: Ditto.
	* fork-child.c: Ditto.
	* frame.c: Ditto.
	* frame.h: Ditto.
	* frv-linux-tdep.c: Ditto.
	* frv-tdep.c: Ditto.
	* gcore.c: Ditto.
	* gdb-stabs.h: Ditto.
	* gdb_assert.h: Ditto.
	* gdb_string.h: Ditto.
	* gdb_thread_db.h: Ditto.
	* gdb_wait.h: Ditto.
	* gdbarch.sh: Ditto.
	* gdbcore.h: Ditto.
	* gdbthread.h: Ditto.
	* gdbtypes.c: Ditto.
	* gdbtypes.h: Ditto.
	* gnu-nat.c: Ditto.
	* gnu-nat.h: Ditto.
	* gnu-v2-abi.c: Ditto.
	* gnu-v3-abi.c: Ditto.
	* go32-nat.c: Ditto.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
2011-01-07 19:36:19 +00:00
Michael Snyder 3e43a32aaa 2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns.
	* arch-utils.c: Ditto.
	* arch-utils.h: Ditto.
	* ax-gdb.c: Ditto.
	* ax-general.c: Ditto.
	* bcache.c: Ditto.
	* blockframe.c: Ditto.
	* breakpoint.c: Ditto.
	* buildsym.c: Ditto.
	* c-lang.c: Ditto.
	* c-typeprint.c: Ditto.
	* charset.c: Ditto.
	* coffread.c: Ditto.
	* command.h: Ditto.
	* corelow.c: Ditto.
	* cp-abi.c: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* dbug-rom.c: Ditto.
	* dbxread.c: Ditto.
	* defs.h: Ditto.
	* dfp.c: Ditto.
	* dfp.h: Ditto.
	* dictionary.c: Ditto.
	* disasm.c: Ditto.
	* doublest.c: Ditto.
	* dwarf2-frame.c: Ditto.
	* dwarf2expr.c: Ditto.
	* dwarf2loc.c: Ditto.
	* dwarf2read.c: Ditto.
	* elfread.c: Ditto.
	* eval.c: Ditto.
	* event-loop.c: Ditto.
	* event-loop.h: Ditto.
	* exceptions.h: Ditto.
	* exec.c: Ditto.
	* expprint.c: Ditto.
	* expression.h: Ditto.
	* f-lang.c: Ditto.
	* f-valprint.c: Ditto.
	* findcmd.c: Ditto.
	* frame-base.c: Ditto.
	* frame-unwind.c: Ditto.
	* frame-unwind.h: Ditto.
	* frame.c: Ditto.
	* frame.h: Ditto.
	* gcore.c: Ditto.
	* gdb-stabs.h: Ditto.
	* gdb_assert.h: Ditto.
	* gdb_dirent.h: Ditto.
	* gdb_obstack.h: Ditto.
	* gdbcore.h: Ditto.
	* gdbtypes.c: Ditto.
	* gdbtypes.h: Ditto.
	* inf-ttrace.c: Ditto.
	* infcall.c: Ditto.
	* infcmd.c: Ditto.
	* inflow.c: Ditto.
	* infrun.c: Ditto.
	* inline-frame.h: Ditto.
	* language.c: Ditto.
	* language.h: Ditto.
	* libunwind-frame.c: Ditto.
	* libunwind-frame.h: Ditto.
	* linespec.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-nat.h: Ditto.
	* linux-thread-db.c: Ditto.
	* machoread.c: Ditto.
	* macroexp.c: Ditto.
	* macrotab.c: Ditto.
	* main.c: Ditto.
	* maint.c: Ditto.
	* mdebugread.c: Ditto.
	* memattr.c: Ditto.
	* minsyms.c: Ditto.
	* monitor.c: Ditto.
	* monitor.h: Ditto.
	* objfiles.c: Ditto.
	* objfiles.h: Ditto.
	* osabi.c: Ditto.
	* p-typeprint.c: Ditto.
	* p-valprint.c: Ditto.
	* parse.c: Ditto.
	* printcmd.c: Ditto.
	* proc-events.c: Ditto.
	* procfs.c: Ditto.
	* progspace.c: Ditto.
	* progspace.h: Ditto.
	* psympriv.h: Ditto.
	* psymtab.c: Ditto.
	* record.c: Ditto.
	* regcache.c: Ditto.
	* regcache.h: Ditto.
	* remote-fileio.c: Ditto.
	* remote.c: Ditto.
	* ser-mingw.c: Ditto.
	* ser-tcp.c: Ditto.
	* ser-unix.c: Ditto.
	* serial.c: Ditto.
	* serial.h: Ditto.
	* solib-frv.c: Ditto.
	* solib-irix.c: Ditto.
	* solib-osf.c: Ditto.
	* solib-pa64.c: Ditto.
	* solib-som.c: Ditto.
	* solib-sunos.c: Ditto.
	* solib-svr4.c: Ditto.
	* solib-target.c: Ditto.
	* solib.c: Ditto.
	* somread.c: Ditto.
	* source.c: Ditto.
	* stabsread.c: Ditto.
	* stabsread.c: Ditto.
	* stack.c: Ditto.
	* stack.h: Ditto.
	* symfile-mem.c: Ditto.
	* symfile.c: Ditto.
	* symfile.h: Ditto.
	* symmisc.c: Ditto.
	* symtab.c: Ditto.
	* symtab.h: Ditto.
	* target-descriptions.c: Ditto.
	* target-memory.c: Ditto.
	* target.c: Ditto.
	* target.h: Ditto.
	* terminal.h: Ditto.
	* thread.c: Ditto.
	* top.c: Ditto.
	* tracepoint.c: Ditto.
	* tracepoint.h: Ditto.
	* ui-file.c: Ditto.
	* ui-file.h: Ditto.
	* ui-out.h: Ditto.
	* user-regs.c: Ditto.
	* user-regs.h: Ditto.
	* utils.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vec.h: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xcoffsolib.h: Ditto.
	* xml-syscall.c: Ditto.
	* xml-tdesc.c: Ditto.
2011-01-05 22:22:53 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Tom Tromey 8cf6f0b103 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 21:18:16 +00:00
Corinna Vinschen 8da614df64 * dwarf2-frame.c (struct dwarf2_cie): Add ptr_size member.
Throughout, call read_encoded_value with ptr_size rather than addr_size.
	(decode_frame_entry_1): Remove redundant setting of
	addr_size.  Call gdbarch_dwarf2_addr_size rather than gdbarch_ptr_bit
	to determine addr_size in Dwarf versions < 4.  Set ptr_size dependent
	on examined frame section.  Add comment to explain why.
	* gdbarch.sh (dwarf2_addr_size): Define as variable.  Add lengthy
	comment to explain usage.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.

	* xstormy16-tdep.c (xstormy16_gdbarch_init): Set dwarf2_addr_size to 4.
2010-08-06 19:02:15 +00:00
Tom Tromey ac56253dde * dwarf2read.c (dwarf2_const_value) <DW_form_addr>: Create a
LOC_COMPUTED symbol.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Set new field.
	(dwarf2_loc_desc_needs_frame): Likewise.
	(compile_dwarf_to_ax) <DW_OP_addr>: Use offset.
	* dwarf2expr.h (struct dwarf_expr_context) <offset>: New field.
	* dwarf2expr.c (execute_stack_op) <DW_OP_addr>: Use offset.
	* dwarf2-frame.c (execute_stack_op): Set 'offset' field.  Add
	'offset' argument.
	(struct dwarf2_frame_cache) <text_offset>: New field.
	(dwarf2_frame_cache): Set new field.
	(dwarf2_frame_prev_register): Update.
	(dwarf2_frame_sniffer): Update.
	(dwarf2_frame_base_sniffer): Update.
	(dwarf2_frame_find_fde): Add 'out_offset' argument.
2010-07-07 17:26:38 +00:00
Ulrich Weigand f2c7657e9a ChangeLog:
* dwarf2expr.h (struct dwarf_value_location): Use ULONGEST as type
	of stack values.
	(struct dwarf_expr_piece): Rename "expr" member to "mem".  Add new
	"value" member.
	(dwarf_expr_push): Change input type to ULONGEST.
	(dwarf_expr_fetch): Change return type to ULONGEST.
	(dwarf_expr_fetch_address): Add prototype.
	(dwarf2_read_address): Remove prototype.
	* dwarf2expr.c (dwarf_expr_push): Use ULONGEST as type of stack values.
	Truncate stack values to ctx->addr_size bytes.
	(dwarf_expr_fetch): Change return value to ULONGEST.
	(dwarf_expr_fetch_address): New function.
	(add_piece): Use dwarf_expr_fetch_address instead of dwarf_expr_fetch
	when appropriate.  Update for struct dwarf_expr_piece changes.
	(dwarf2_read_address): Remove.
	(unsigned_address_type): Remove.
	(signed_address_type): Remove.
	(execute_stack_op): Use dwarf_expr_fetch_address instead of
	dwarf_expr_fetch when appropriate.  Use ULONGEST as type of stack
	values.  Perform operations on ULONGEST instead of on GDB values,
	sign-extending from ctx->addr_size bytes as needed.  Read DW_OP_addr
	values and DW_OP_deref results as unsigned integers.
	* dwarf2loc.c (read_pieced_value): Update for struct dwarf_expr_piece
	changes.
	(write_pieced_value): Likewise.
	(dwarf2_evaluate_loc_desc): Use dwarf_expr_fetch_address instead of
	dwarf_expr_fetch when appropriate.
	(compile_dwarf_to_ax): Read DW_OP_addr values as unsigned integers.
	* dwarf2-frame.c (execute_stack_op): Use dwarf_expr_fetch_address
	instead of dwarf_expr_fetch when appropriate.

testsuite/ChangeLog:

	* gdb.cell/dwarfaddr.exp: New file.
	* gdb.cell/dwarfaddr.S: New file.
2010-06-25 13:00:33 +00:00
Jan Kratochvil 5c631832c1 gdb/
Fix PR 10640.
	* dwarf2-frame.c (no_dwarf_call): New function.
	(execute_stack_op): Set CTX->DWARF_CALL.
	* dwarf2expr.c (execute_stack_op) <DW_OP_call2, DW_OP_call4>: New.
	* dwarf2expr.h (struct dwarf_expr_context) <dwarf_call>: New.
	(struct dwarf_expr_context) <get_subr>: Remove the #if0-ed field.
	* dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call): New functions.
	(dwarf2_evaluate_loc_desc): Initialize CTX->DWARF_CALL.
	(needs_frame_dwarf_call): New function.
	(dwarf2_loc_desc_needs_frame): Initialize CTX->DWARF_CALL.
	* dwarf2read.c (follow_die_offset): Based on former follow_die_ref.
	Update the comment.  Move variables die, offset and error call to ...
	(follow_die_ref): ... a new function.
	(dwarf2_fetch_die_location_block): New function.
	* dwarf2loc.h (dwarf2_fetch_die_location_block): New prototype.

gdb/testsuite/
	Test PR 10640.
	* gdb.dwarf2/dw2-op-call.exp, gdb.dwarf2/dw2-op-call.S: New.
2010-06-07 19:55:33 +00:00
Tom Tromey 0d45f56e47 * dwarf2loc.c (dwarf_expr_frame_base): Constify.
(dwarf_expr_frame_base_1): Likewise.
	(read_pieced_value): Update.
	(needs_frame_frame_base): Constify.
	(dwarf2_tracepoint_var_loc): Likewise.
	(dwarf2_tracepoint_var_access): Likewise.
	(locexpr_describe_location_piece): Likewise.
	(locexpr_describe_location_1): Likewise.
	* dwarf2expr.h (struct dwarf_expr_context) <get_frame_base>:
	Constify.
	(data): Now const.
	(struct dwarf_expr_piece) <v.literal.data>: Likewise.
	(dwarf_expr_eval, read_uleb128, read_sleb128)
	(dwarf2_read_address): Update.
	* dwarf2expr.c (dwarf_expr_eval): Constify.
	(read_uleb128): Likewise.
	(read_sleb128): Likewise.
	(dwarf2_read_address): Likewise.
	(require_composition): Likewise.
	(execute_stack_op): Likewise.
	* dwarf2-frame.h (struct dwarf2_frame_state_reg) <loc.exp>: Now a
	"const gdb_byte *".
	* dwarf2-frame.c (struct dwarf2_frame_state_reg_info) <cfa_exp>:
	Now const.
	(no_get_frame_base): Constify.
	(execute_stack_op): Likewise.
	(execute_cfa_program): Likewise.
	(read_encoded_value): Likewise.
2010-05-25 16:41:46 +00:00
Michael Snyder 9a619af0d3 2010-05-14 Michael Snyder <msnyder@vmware.com>
* dbxread.c: White space.
	* dcache.c: White space.
	* disasm.c: White space.
	* doublest.c: White space.
	* dsrec.c: White space.
	* dummy-frame.c: White space.
	* dwarf2expr.c: White space.
	* dwarf2-frame.c: White space.
	* dwarf2loc.c: White space.
	* dwarf2read.c: White space.
2010-05-14 17:53:16 +00:00
Michael Snyder 4fc06681d3 2010-05-06 Michael Snyder <msnyder@vmware.com>
* objfiles.c (objfile_relocate): Delete unused variable.
	* maint.c (_initialize_maint_cmds): Delete unused variable.
	* demangle.c (_initialize_demangler): Delete unused variable.
	* corefile.c (reopen_exec_file): Delete unused variable.
	* dwarf2expr.c (dwarf2_read_address): Delete unused variable.
	* dwarf2-frame.c (decode_frame_entry): Delete unused variable.
2010-05-06 22:50:09 +00:00
Tom Tromey 2dc7f7b33b * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
(struct dwarf2_cie) <segment_size>: New field.
	* dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
	(skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
	DW_FORM_exprloc.
	(read_attribute_value): Handle DW_FORM_flag_present,
	DW_FORM_sec_offset, DW_FORM_exprloc.
	(dump_die_shallow): Likewise.
	(attr_form_is_section_offset): Handle DW_FORM_sec_offset.
	(dwarf2_const_value): Handle DW_FORM_exprloc.
	(attr_form_is_block): Likewise.
	(struct line_header) <maximum_ops_per_instruction>: New field.
	(dwarf_decode_line_header): Set new field.
	(dwarf_decode_lines): Handle new field.
2010-04-20 17:33:14 +00:00
Daniel Jacobowitz a6c727b2f1 * dwarf2-frame.c (dwarf2_frame_find_quirks): Use producer_is_realview.
* dwarf2read.c (load_full_comp_unit): Read DW_AT_producer.
	(read_structure_type): For RealView, set TYPE_STUB on structures with
	no byte size and no children.
	(read_subroutine_type): Mark functions as prototyped by default.
	* symtab.c (producer_is_realview): New function.
	* symtab.h (expand_line_sal): Fix declaration formatting.
	(producer_is_realview): Declare.

	testsuite/
	* gdb.base/callfuncs.exp (do_function_calls): Add XFAILs for RealView.
	* gdb.base/ptype.exp (ptype_maybe_prototyped): Add overprototyped
	argument.  Handle "short" and "long".
	(Top level): Pass overprototyped output for old_fptr and xptr.
2010-03-24 21:06:33 +00:00
Tom Tromey be391dcafc * elfread.c (elf_symfile_read): Don't call
dwarf2_build_frame_info.
	* dwarf2read.c (struct dwarf2_section_info) <readin>: New field.
	(struct dwarf2_per_objfile) <objfile>: New field.
	(dwarf2_has_info): Now idempotent.  Set objfile field.
	(dwarf2_read_section): Check and set readin field.  Call
	posix_madvise.
	(dwarf2_build_psymtabs): Don't read all sections.
	(read_type_comp_unit_head): Read types section.
	(create_debug_types_hash_table): Likewise.
	(init_cu_die_reader): Add asserts.
	(process_type_comp_unit): Add assert.
	(dwarf2_build_psymtabs_hard): Read info section.
	(load_partial_comp_unit): Add assert.
	(create_all_comp_units): Read info section.
	(load_full_comp_unit): Likewise.
	(dwarf2_ranges_read): Read ranges section.
	(dwarf2_record_block_ranges): Add assert.
	(dwarf2_read_abbrevs): Read abbrev section.
	(read_indirect_string): Read str section.
	(dwarf_decode_line_header): Read line section.
	(read_signatured_type_at_offset): Read types section.
	(dwarf_decode_macros): Read macinfo section.
	(dwarf2_symbol_mark_computed): Read loc section.
	* dwarf2-frame.c (dwarf2_frame_find_fde): Call
	dwarf2_build_frame_info.
	(dwarf2_build_frame_info): Unconditionally set
	dwarf2_frame_objfile_data on the objfile.
	* configure.ac: Check for posix_madvise.
	* config.in, configure: Rebuild.
2010-03-10 18:37:24 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Pedro Alves 875cdfbb54 * dwarf2-frame.c (dwarf2_build_frame_info): Discard --gc-section
leftover FDEs.
2009-10-28 19:28:57 +00:00
Pedro Alves 1a587334a9 Revert previous patch. Applied an old version by mistake. 2009-10-28 19:01:16 +00:00
Pedro Alves 917bdf821d * dwarf2-frame.c (dwarf2_build_frame_info): Discard --gc-section
leftover FDEs.
2009-10-28 18:37:11 +00:00
Paul Pluzhnikov 65a97ab329 2009-10-22 Paul Pluzhnikov <ppluzhnikov@google.com>
PR gdb/10819
	* dwarf2-frame.c (find_cie): Don't call bsearch on empty cie_table.
	* objfiles.c (find_pc_section): Likewise.
	(update_section_map): Don't allocate empty table.
2009-10-22 20:20:27 +00:00
Pierre Muller 905e0470f4 ARI fix: OP eol rule.
* doublest.c (floatformat_from_length): Avoid operator at end of line.
	* dwarf2-frame.c (dwarf2_build_frame_info): Idem.
	* dwarf2read.c (read_array_order, dwarf_decode_macros): Idem.
	* eval.c (evaluate_subexp_standard): Idem.
	* event-loop.c (create_timer, handle_timer_event): Idem.
	* expprint.c (print_subexp_standard): Idem.
	* f-exp.y (variable): Idem.
	* f-typeprint.c (f_print_type): Idem.
2009-10-06 23:27:05 +00:00
Doug Evans 44353522ec * dwarf2expr.h (dwarf_value_location): Add more comments describing
enum values.
	(struct dwarf_stack_value): New struct.
	(struct dwarf_expr_context): Change type of `stack' from CORE_ADDR*
	to struct dwarf_stack_value*.
	(struct dwarf_expr_piece): Move `v.value' into its own struct, v.expr,
	all uses updated.  Add v.expr.in_stack_memory.
	(dwarf_expr_push): Update declaration.
	(dwarf_expr_fetch_in_stack_memory): Declare.
	* dwarf2expr.c (dwarf_expr_grow_stack): Update calculation of
	size of stack value.
	(dwarf_expr_push): New arg in_stack_memory, all callers updated.
	(dwarf_expr_fetch_in_stack_memory): New function.
	(add_piece): Set in_stack_memory for non-literal values.
	(execute_stack_op): Allow ops to specify whether the value is on the
	program's stack.
	(execute_stack_op, case DW_OP_fbreg): Mark value as in stack memory.
	(execute_stack_op, case DW_OP_call_frame_cfa): Ditto.
	(execute_stack_op, case DW_OP_dup): Copy in_stack_memory flag.
	(execute_stack_op, cases DW_OP_pick, DW_OP_over): Ditto.
	(execute_stack_op, cases DW_OP_swap, DW_OP_rot): Update type of
	dwarf stack value.
	* dwarf2loc.c (read_pieced_value): Call read_stack for values known
	to be on the program's stack.
	(dwarf2_evaluate_loc_desc, case DWARF_VALUE_MEMORY): Call
	set_value_stack only for objects known to be in stack memory.
	* dwarf2-frame.c (execute_stack_op): New arg initial_in_stack_memory,
	all callers updated.
2009-09-15 16:20:53 +00:00
Tom Tromey cec03d703f gdb
* dwarf2loc.c (struct piece_closure) <arch>: New field.
	(dwarf2_evaluate_loc_desc): Update.
	(dwarf2_loc_desc_needs_frame): Likewise.
	(allocate_piece_closure): Initialize new field.
	(read_pieced_value): Update.
	(write_pieced_value): Update.
	(copy_pieced_value_closure): Update.
	* dwarf2expr.h (enum dwarf_value_location): New.
	(struct dwarf_expr_context) <in_reg>: Remove.
	<location, len, data>: New fields.
	(struct dwarf_expr_piece) <in_reg, value>: Remove.
	<location, v>: New fields.
	* dwarf2expr.c (add_piece): Remove in_reg, value arguments.
	Update.
	(require_composition): New function.
	(execute_stack_op): Update.
	<DW_OP_implicit_value, DW_OP_stack_value>: New cases.
	<DW_OP_reg0>: Set location, not in_reg.
	<DW_OP_regx>: Likewise.  Use require_composition.
	<DW_OP_fbreg>: Update.
	<DW_OP_piece>: Likewise.
	* dwarf2-frame.c (execute_stack_op): Update.
gdb/testsuite
	* gdb.dwarf2/valop.S: New file.
	* gdb.dwarf2/valop.exp: New file.
2009-09-11 18:38:39 +00:00
Tom Tromey e78022079c gdb
* frame.h (frame_unwinder_is): Declare.
	* frame.c (frame_unwinder_is): New function.
	* dwarf2loc.c: Include dwarf2-frame.h.
	(dwarf_expr_frame_cfa): New function.
	(dwarf2_evaluate_loc_desc): Use it.
	(needs_frame_frame_cfa): New function.
	(dwarf2_loc_desc_needs_frame): Use it.
	* dwarf2expr.h (struct dwarf_expr_context) <get_frame_cfa>: New
	field.
	* dwarf2expr.c (execute_stack_op) <DW_OP_call_frame_cfa>: New
	case.
	* dwarf2-frame.h (dwarf2_frame_cfa): Declare.
	* dwarf2-frame.c (no_get_frame_cfa): New function.
	(execute_stack_op): Use it.
	(dwarf2_frame_cfa): New function.
gdb/testsuite
	* gdb.dwarf2/callframecfa.exp: New file.
	* gdb.dwarf2/callframecfa.S: New file.
2009-09-02 14:53:57 +00:00
Tom Tromey 4a22739830 * dwarf2loc.c (dwarf2_evaluate_loc_desc): Make a cleanup.
(dwarf2_loc_desc_needs_frame): Likewise.
	* dwarf2expr.h (make_cleanup_free_dwarf_expr_context): Declare.
	* dwarf2expr.c (free_dwarf_expr_context_cleanup): New function.
	(make_cleanup_free_dwarf_expr_context): Likewise.
	* dwarf2-frame.c (execute_stack_op): Make a cleanup.
2009-08-11 20:36:49 +00:00