Commit Graph

842 Commits

Author SHA1 Message Date
Doug Evans 6ac97d4cc6 symtab/15652
* dwarf2read.c (try_open_dwop_file): New arg search_cwd.
	All callers updated.
	(open_dwp_file): If we can't find the dwp file, search the basename
	in debug-file-directory.
2013-06-20 22:16:28 +00:00
Doug Evans 9341788208 * dwarf2read.c (struct dwp_file): Fix comment.
(open_and_init_dwp_file): Set dwp_file->name to bfd's file name.
2013-06-20 21:58:58 +00:00
Doug Evans 3190f0c611 * dwarf2read.c (dw2_symtab_iter_next): Check value of cu_index
before using it.
	(dw2_expand_symtabs_matching): Fix symbol kind validity check.
	Move test of cu_index closer to use.  Print complaint if cu_index
	is bad.
2013-06-19 04:38:51 +00:00
Joel Brobecker 59b0c7c17a do not use dwarf2_per_objfile in dwarf2_per_objfile_free.
This patch fixes a case of multiple calls freeing the same data
while free-ing objfiles that have child objfiles (separate debug
info, as is the case on Darwin targets).

Following the code, free_objfile_separate_debug iterates over
all child objfiles of the parent objfile, calling free_objfile:

  for (child = objfile->separate_debug_objfile; child;)
    {
      struct objfile *next_child = child->separate_debug_objfile_link;
      free_objfile (child);
      child = next_child;
    }

This causes, among other things, the free'ing of the child objfile's
private data:

  /* Discard any data modules have associated with the objfile.  The function
     still may reference objfile->obfd.  */
  objfile_free_data (objfile);

This indirectly calls(back) dwarf2_per_objfile_free, which tries
to free the dwarf2read-specific data by using the dwarf2_per_objfile
global, eg:

  for (ix = 0; ix < dwarf2_per_objfile->n_comp_units; ++ix)

Even if we were lucky enough the first time around that this global
actually corresponds to the objfile being destroyed, the global
will still have the same value at the second iteration, and thus
become dangling. Indeed, after dwarf2_per_objfile_free returns
eventually back to free_objfile, free_objfile then deallocates
its objfile_obstack, where the dwarf2_per_objfile is allocated.

Ironically, there should be no need to access that global at all,
here, since the data is passed as an argument of the callback.
And it looks like the dwo/dwp/[...]-handling code is in fact already
using that argument, rather than the global.

This patch thus fixes the problem by doing the same, replacing
all references to DWARF2_PER_OBJFILE by uses of DATA instead.

gdb/ChangeLog:

        * dwarf2read.c (dwarf2_per_objfile): Replace uses of
        DWARF2_PER_OBJFILE by uses of DATA instead.
2013-06-18 23:35:24 +00:00
Jan Kratochvil 92fac8075a gdb/
* dwarf2read.c (write_psymtabs_to_index): Ignore NULL PSYMTAB.
2013-06-18 15:50:33 +00:00
Doug Evans 9c02c12947 * dwarf2read.c (try_open_dwop_file): Work around behaviour of
OPF_TRY_CWD_FIRST to not search path if the file contains a '/'.
2013-06-13 23:01:37 +00:00
Doug Evans d2415c6cf4 * dwarf2read.c: Whitespace fixes for DWP file format documentation,
and fix header docs.
2013-06-06 23:51:09 +00:00
Pedro Alves 21aa081e21 dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.
Building gdb on GNU/Linux, for --host=i586-pc-msdosdjgpp, I get:

 ../../src/gdb/dwarf2read.c: In function 'create_dwp_hash_table':
 ../../src/gdb/dwarf2read.c:8626:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c:8632:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'create_dwo_in_dwp':
 ../../src/gdb/dwarf2read.c:8754:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format]
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format]

And:

 $ grep uint32_t /usr/i586-pc-msdosdjgpp/sys-include/*
 /usr/i586-pc-msdosdjgpp/sys-include/stdint.h:typedef unsigned long uint32_t;

As decided on the discussion at
<http://sourceware.org/ml/gdb-patches/2013-05/msg00788.html>, use
pulongest rather than PRIu32.

Tested on F17.  Also confirmed GDB still builds OK with
--host=i686-w64-mingw32.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

	* dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
	(open_and_init_dwp_file): Use %s/pulongest instead of %u for
	printing uint32_t variables.
2013-05-23 18:31:29 +00:00
Doug Evans a2ce51a0ef When reading CU, stay in DWO. Be more tolerent of bad debug info.
For Fission.
	* dwarf2read.c (struct dwarf2_per_cu_data): New member
	reading_dwo_directly.
	(struct signatured_type): New member dwo_unit.
	(struct die_reader_specs): New member comp_dir.
	(create_signatured_type_table_from_index): Use malloc for
	all_type_units instead of objfile's obstack.
	(create_all_type_units): Ditto.
	(fill_in_sig_entry_from_dwo_entry): New function.
	(add_type_unit): New function.
	(lookup_dwo_signatured_type): New function.
	(lookup_dwp_signatured_type): New function.
	(lookup_signatured_type): New arg cu.  All callers updated.
	(init_cu_die_reader): Initialize comp_dir.
	(read_cutu_die_from_dwo): New arg stub_comp_dir.  All callers updated.
	Change assert of matching type signatures to call error on mismatch.
	(lookup_dwo_unit): Add assert.
	(init_tu_and_read_dwo_dies): New function.
	(init_cutu_and_read_dies): Call it.
	(build_type_unit_groups): Handle case of no type unit groups created.
	(hash_dwo_file, eq_dwo_file): Handle missing comp_dir.
	(lookup_dwo_cutu): Tweak complaint.
	(dwarf2_free_abbrev_table): Check for NULL abbrev_table.
	(dwarf2_per_objfile_free): Free all_type_units.
2013-05-20 17:24:21 +00:00
Joel Brobecker 4d804846db [dwarf] Mark all functions as prototyped except C functions.
This makes sure that the types of the arguments are taken into account
when performing an inferior function call to a non-C (or C-like)
function.  In particular, this makes sure that the arguments are
appropriatly converted to the correct type.

For instance, on x86_64-linux, with the following Ada code:

   procedure Set_Float (F : Float) is
   begin
      Global_Float := F;
   end Set_Float;

The following sequence shows that Float arguments are incorrectly
passed (Ada's Float type is the equivalent of type "float" in C):

    (gdb) call set_float (2.0)
    (gdb) print global_float
    $1 = 0.0

Putting a breakpoint inside set_float to inspect the value of
register xmm0 gives the first hint of the problem:

    (gdb) p $xmm0
    $2 = (v4_float => (0 => 0.0, 2.0, 0.0, 0.0),
          v2_double => (0 => 2.0, 0.0),
    [...]

It shows that the argument was passed as a double.

The code responsible for doing appropriate type conversions
for the arguments (value_arg_coerce) found that our function
was not prototyped, and thus could not use typing information
for the arguments. Instead, it defaulted to the value of "set
coerce-float-to-double", which by default is true, to determine
the argument type.

This patch fixes the problem by setting the PROTOTYPE flag
for all functions of any language except C and Objective C.

gdb/ChangeLog:

        * dwarf2read.c (prototyped_function_p): New function.
        (read_subroutine_type): Use it.

gdb/testsuite/ChangeLog:

        * gdb.ada/float_param: New testcase.
2013-05-20 09:45:13 +00:00
Joel Brobecker d1be32476e [dwarf]: Add DW_LANG_UPC support in set_cu_language.
gdb/ChangeLog:

        * dwarf2read.c (set_cu_language): Add DW_LANG_UPC handling.
2013-05-16 07:39:43 +00:00
Tom Tromey d62bfeaff5 PR gdb/15538:
* dwarf2read.c (dwarf2_record_block_ranges): Ensure that the
	ranges section has been read.
2013-05-13 16:56:09 +00:00
Tom Tromey b6807d988a * dwarf2loc.c (invalid_synthetic_pointer): Move earlier.
(indirect_pieced_value): Call dwarf2_fetch_constant_bytes
	if needed.
	* dwarf2loc.h (dwarf2_fetch_constant_bytes): Declare.
	* dwarf2read.c (write_constant_as_bytes)
	(dwarf2_fetch_constant_bytes): New functions.
gdb/testsuite
	* gdb.dwarf2/implptrconst.c: New file.
	* gdb.dwarf2/implptrconst.exp: New file.
	* lib/dwarf.exp (Dwarf::_nz_quote): New proc.
	(Dwarf::_handle_DW_FORM): Handle DW_FORM_block1.
	(Dwarf::_location): Handle DW_OP_GNU_implicit_pointer.
2013-05-06 19:44:04 +00:00
Tom Tromey 3aef2284c6 * dwarf2read.c (dwarf2_const_value_data): Remove unused
parameters.
	(dwarf2_const_value_attr): Update.
2013-05-06 19:39:09 +00:00
Tom Tromey 7919a97345 * dwarf2read.c (dwarf2_const_value_attr): Use 'obstack', not
objfile's obstack.
2013-05-06 19:28:36 +00:00
Doug Evans 3189cb1297 * dbxread.c (process_one_symbol): Constify section_offsets parameter.
* stabsread.h (process_one_symbol): Update declaration.
	* dwarf2read.c (dw2_relocate): Constify new_offsets, delta parameters.
	* elfread.c (elf_symfile_relocate_probe): Ditto.
	* psymtab.c (relocate_psymtabs): Ditto.
	* objfiles.c (objfile_relocate1): Constify new_offsets parameter.
	(objfile_relocate): Ditto.
	* objfiles.h (objfile_relocate): Update declaration.
	* symfile.c (relative_addr_info_to_section_offsets): Constify
	addrs parameter.
	(default_symfile_offsets): Ditto.
	(syms_from_objfile_1): Constify offsets parameter.
	(syms_from_objfile): Ditto.
	(symbol_file_add_with_addrs_or_offsets): Ditto.
	(symfile_map_offsets_to_segments): Constify data parameter.
	* symfile.h (struct quick_symbol_functions): Constify new_offsets,
	delta parameters of member relocate.
	(struct sym_probe_fns): Constify new_offsets,
	delta parameters of member sym_relocate_probe.
	(struct sym_fns): Constify section_addr_info parameter of member
	sym_offsets.
	(relative_addr_info_to_section_offsets): Update declaration.
	(default_symfile_offsets): Ditto.
	(syms_from_objfile): Ditto.
	(symfile_map_offsets_to_segments): Ditto.
2013-05-06 19:15:17 +00:00
Doug Evans 6a506a2dcb * dwarf2read.c (lookup_dwo_unit): Return NULL if DWO not found.
(init_cutu_and_read_dies): Flag a complaint, not error, for bad
	DWO stub.  If DWO isn't found, just use stub.
	(lookup_dwo_cutu): Don't try DWO if there's a DWP file.
2013-04-30 23:19:41 +00:00
Doug Evans a98c29a089 * dwarf2read.c (dw2_find_symbol_file): Initialize filename before
calling init_cutu_and_read_dies.
2013-04-30 21:11:50 +00:00
Pierre Muller b385a60dc4 * dwarf2read.c (handle_DW_AT_stmt_list): Avoid ARI warning for
editCase function rule.
	(get_DW_AT_signature_type): Likewise.
2013-04-29 09:52:07 +00:00
Joel Brobecker 9056882e81 Add ARI marker to get_DW_AT_signature_type.
gdb/ChangeLog:

        * dwarf2read.c (get_DW_AT_signature_type): Add ARI marker.
2013-04-29 05:05:44 +00:00
Tom Tromey ff54693587 PR corefiles/14983:
* dwarf2read.c (process_full_comp_unit): Always create a static
	block.
gdb/testsuite
	* gdb.dwarf2/nostaticblock.exp: New file.
2013-04-25 16:25:37 +00:00
Doug Evans 74e04d1ccf * dwarf2read.c (setup_type_unit_groups): Fix comment. 2013-04-24 19:12:26 +00:00
Tom Tromey 614c279dda PR gdb/7912:
* Makefile.in (SFILES): Add filestuff.c
	(COMMON_OBS): Add filestuff.o.
	(filestuff.o): New target.
	* auto-load.c (auto_load_objfile_script_1): Use
	gdb_fopen_cloexec.
	* auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec.
	* cli/cli-cmds.c (shell_escape): Call close_most_fds.
	* cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec.
	* common/agent.c (gdb_connect_sync_socket): Use
	gdb_socket_cloexec.
	* common/filestuff.c: New file.
	* common/filestuff.h: New file.
	* common/linux-osdata.c (linux_common_core_of_thread)
	(command_from_pid, commandline_from_pid, print_source_lines)
	(linux_xfer_osdata_shm, linux_xfer_osdata_sem)
	(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use
	gdb_fopen_cloexec.
	* common/linux-procfs.c (linux_proc_get_int)
	(linux_proc_pid_has_state): Use gdb_fopen_cloexec.
	* config.in, configure: Rebuild.
	* configure.ac: Don't check for sys/socket.h.  Check for
	fdwalk, pipe2.
	* corelow.c (core_open): Use gdb_open_cloexec.
	* dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec.
	* fork-child.c (fork_inferior): Call close_most_fds.
	* gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec.
	* inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec.
	* linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals):
	Use gdb_fopen_cloexec.
	(linux_proc_xfer_partial, linux_proc_xfer_spu): Use
	gdb_open_cloexec.
	(linux_async_pipe): Use gdb_pipe_cloexec.
	* remote-fileio.c (remote_fileio_func_open): Use
	gdb_open_cloexec.
	* remote.c (remote_file_put, remote_file_get): Use
	gdb_fopen_cloexec.
	* ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec,
	close_most_fds.
	* ser-tcp.c (net_open): Use gdb_socket_cloexec.
	* ser-unix.c (hardwire_open): Use gdb_open_cloexec.
	* solib.c (solib_find): Use gdb_open_cloexec.
	* source.c (openp, find_and_open_source): Use gdb_open_cloexec.
	* tracepoint.c (tfile_start): Use gdb_fopen_cloexec.
	(tfile_open): Use gdb_open_cloexec.
	* tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec.
	* ui-file.c (gdb_fopen): Use gdb_fopen_cloexec.
	* xml-support.c (xml_fetch_content_from_file): Use
	gdb_fopen_cloexec.
	* main.c (captured_main): Call notice_open_fds.
gdbserver
	* Makefile.in (SFILES): Add filestuff.c.
	(OBS): Add filestuff.o.
	(filestuff.o): New target.
	* config.in, configure: Rebuild.
	* configure.ac: Check for fdwalk, pipe2.
2013-04-22 16:46:15 +00:00
Pedro Alves f9d83a0bd6 -Wpointer-sign: dwarf2read.c.
This fixes the remaining issues necessary to make the DWARF reader
-Wpointer-sign clean.  The 'filename' bit should be obvious.
'constant_pool' holds the contents of an obstack, which are 'char *'.
gdb_byte would work too, but it'd need more casts elsewhere, so I just
chose the minimal approach.  Any way would be fine with me.

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

	* dwarf2read.c (dwarf2_get_dwz_file): Add cast to const char *.
	(read_index_from_section): Add cast to 'char *'.
2013-04-19 15:34:46 +00:00
Pedro Alves 948f8e3d72 -Wpointer-sign: char -> gdb_byte.
-Wpointer-sign catches all these cases across the codebase that should
be using gdb_byte for raw target bytes.  I think these are all
obvious, hence I've collapsed into a single patch.

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

	* aarch64-tdep.c (aarch64_default_breakpoint): Change type to
	gdb_byte[].
	(aarch64_breakpoint_from_pc): Change return type to gdb_byte *.
	* ada-lang.c (ada_value_assign): Use gdb_byte.
	* alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[].
	(alphanbsd_sigtramp_offset): Use gdb_byte.
	* arm-linux-tdep.c (arm_linux_arm_le_breakpoint)
	(arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint)
	(eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint)
	(arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint)
	(arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[].
	* arm-tdep.c (arm_stub_unwind_sniffer)
	(arm_displaced_init_closure): Use gdb_byte.
	(arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint)
	(arm_default_thumb_le_breakpoint)
	(arm_default_thumb_be_breakpoint): Change type to gdb_byte[].
	* arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint,
	thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *.
	* arm-wince-tdep.c (arm_wince_le_breakpoint)
	(arm_wince_thumb_le_breakpoint): Change type to gdb_byte[].
	* armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint)
	(arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint)
	(arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[].
	* armobsd-tdep.c (arm_obsd_thumb_le_breakpoint)
	(arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[].
	* cris-tdep.c (push_stack_item, cris_push_dummy_call)
	(cris_store_return_value, cris_extract_return_value): Use
	gdb_byte.
	(constraint): Change type of parameter to char * from signed
	char*.  Use gdb_byte.
	* dwarf2loc.c (read_pieced_value, write_pieced_value): Change type
	of local buffer to gdb_byte *.
	* dwarf2read.c (read_index_from_section): Use gdb_byte.
	(create_dwp_hash_table): Change type of locals to gdb_byte *.
	(add_address_entry): Change type of local buffer to gdb_byte[].
	* frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr)
	(frv_push_dummy_call): Use gdb_byte.
	* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code)
	(hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide)
	(hppa_hpux_supply_save_state): Use gdb_byte.
	* hppa-tdep.c (hppa32_push_dummy_call)
	(hppa64_convert_code_addr_to_fptr): Use gdb_byte.
	* ia64-tdep.c (extract_bit_field, replace_bit_field)
	(slotN_contents, replace_slotN_contents): Change type of parameter
	to gdb_byte *.
	(fetch_instruction, ia64_pseudo_register_write)
	(ia64_register_to_value, ia64_value_to_register)
	(ia64_extract_return_value, ia64_store_return_value)
	(ia64_push_dummy_call): Use gdb_byte.
	* m32c-tdep.c (m32c_return_value): Remove cast.
	* m68hc11-tdep.c (m68hc11_pseudo_register_write)
	(m68hc11_push_dummy_call, m68hc11_store_return_value): Use
	gdb_byte.
	* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte.
	* mn10300-tdep.c (mn10300_store_return_value)
	(mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use
	gdb_byte.
	* moxie-tdep.c (moxie_process_readu): Use gdb_byte.
	(moxie_process_record): Remove casts.
	* ppc-ravenscar-thread.c (supply_register_at_address)
	(ppc_ravenscar_generic_store_registers): Use gdb_byte.
	* ravenscar-thread.c (get_running_thread_id): Use gdb_byte.
	* remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte.
	* remote-mips.c (mips_xfer_memory): Use gdb_byte.
	* remote.c (compare_sections_command): Use gdb_byte.
	* score-tdep.c (score7_free_memblock): Change type of parameter to
	gdb_byte *.
	* sh-tdep.c (sh_justify_value_in_reg): Change return type to
	gdb_byte *.  Use gdb_byte.
	(sh_push_dummy_call_fpu): Use gdb_byte.
	(sh_extract_return_value_nofpu, sh_extract_return_value_fpu)
	(sh_store_return_value_nofpu, sh_store_return_value_fpu)
	(sh_register_convert_to_virtual, sh_register_convert_to_raw):
	Change parameter type to 'gdb_byte *'.  Use gdb_byte.
	(sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte.
	* sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte.
	(sh64_store_return_value, sh64_register_convert_to_virtual):
	Change parameter type to 'gdb_byte *'.  Use gdb_byte.
	(sh64_pseudo_register_write): Use gdb_byte.
	* solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'.
	* solib-irix.c (fetch_lm_info): Likewise.  Use gdb_byte for byte
	buffer.
	(irix_current_sos): Use gdb_byte.
	* solib-som.c (som_current_sos): Use gdb_byte.
	* sparc-ravenscar-thread.c (supply_register_at_address)
	(sparc_ravenscar_generic_store_registers): Use gdb_byte.
	* spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'.
	* spu-tdep.c (spu_get_overlay_table): Use gdb_byte.
	* tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to
	'gdb_byte *'.
	* tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to
	'gdb_byte *'.
	* tracepoint.c (tfile_fetch_registers): Use gdb_byte.
	* xstormy16-tdep.c (xstormy16_extract_return_value)
	(xstormy16_store_return_value): Change parameter type to
	'gdb_byte *'.  Adjust.
	(xstormy16_push_dummy_call): Use gdb_byte.
	* xtensa-tdep.c (xtensa_scan_prologue, call0_ret)
	(call0_analyze_prologue, execute_code): Use gdb_byte.
2013-04-19 15:09:46 +00:00
Doug Evans ac9ec31b3e * dwarf2read.c (struct signatured_type): New member type.
(struct attribute): Replace member signatured_type with signature.
	(DW_SIGNATURE): Replaces DW_SIGNATURE_TYPE.
	(read_call_site_scope): Call follow_die_ref instead of
	follow_die_ref_or_sig.
	(read_structure_type): Rewrite handling of signatured types.
	(read_enumeration_type): Ditto.
	(read_attribute_value): Update.
	(build_error_marker_type): New function.
	(lookup_die_type): Add assert.  Rewrite handling of signatured types.
	Don't call error for bad types, just build an error marker type.
	(dump_die_shallow): Update.
	(follow_die_sig_1): Renamed from follow_die_sig.
	Don't call error for bad types, instead return NULL.
	(follow_die_sig): New function.
	(get_signatured_type, get_DW_AT_signature_type): New functions.
2013-04-17 17:09:30 +00:00
Doug Evans 19c3d4c935 * dwarf2read.c (struct dwo_file): Replace member "cus" with "cu".
(struct create_dwo_cu_data): Renamed from create_dwo_info_table_data.
	(create_dwo_cu_reader): Renamed from
	create_dwo_debug_info_hash_table_reader.
	(create_dwo_cu): Renamed from create_dwo_debug_info_hash_table.
	Remove support for multiple CUs in a DWO file.
	(open_and_init_dwo_file, lookup_dwo_cutu): Update.
2013-04-15 23:53:38 +00:00
Doug Evans 4031ecc58a * dwarf2read.c (create_debug_types_hash_table): Use hex_string
instead of phex.
	(lookup_dwo_unit, create_dwo_debug_info_hash_table_reader): Ditto.
	(create_dwo_in_dwp): Ditto.
2013-04-15 22:14:40 +00:00
Tom Tromey 8de20a37d6 PR c++/11990:
* c-lang.c (cplus_language_defn): Use gdb_demangle.
	* c-typeprint.c (c_type_print_base): Use gdb_demangle.
	* cp-support.c (mangled_name_to_comp): Use gdb_demangle.
	(gdb_demangle): New function.
	* cp-support.h (gdb_demangle): Declare.
	* dwarf2read.c (dwarf2_physname, fixup_partial_die)
	(dwarf2_name): Use gdb_demangle.
	* gdbtypes.c (check_stub_method): Use gdb_demangle.
	* gnu-v3-abi.c (gnuv3_rtti_type): Strip @plt and version
	suffixes from name.
	(gnuv3_print_method_ptr): Use gdb_demangle.
	* jv-lang.c (java_demangle): Use gdb_demangle.
	* jv-typeprint.c (java_type_print_base): Use gdb_demangle.
	* language.c (unk_lang_demangle): Use gdb_demangle.
	* symtab.c (symbol_find_demangled_name)
	(demangle_for_lookup): Use gdb_demangle.
2013-04-15 17:30:36 +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
Tom Tromey f85f34ede8 * ada-lang.c (ada_decode_symbol): Check and set 'ada_mangled'.
Use symbol's obstack, not an objfile.
	* coffread.c (process_coff_symbol): Update.
	* dwarf2read.c (fixup_go_packaging, new_symbol_full): Update.
	* jv-lang.c (add_class_symbol): Update.
	* mdebugread.c (new_symbol): Update.
	* minsyms.c (prim_record_minimal_symbol_full)
	(terminate_minimal_symbol_table): Update.
	* psymtab.c (add_psymbol_to_bcache): Clear entire symbol.  Update.
	* stabsread.c (define_symbol, read_enum_type): Update.
	* symtab.c (symbol_set_demangled_name, symbol_get_demangled_name):
	Handle Ada specially.
	(symbol_set_language): Add 'obstack' argument.
	(symbol_set_names): Update.
	(symbol_natural_name, symbol_demangled_name): Always use
	ada_decode_symbol.
	* symtab.h (struct general_symbol_info)
	<language_specific::obstack>: New field.
	<ada_mangled>: New field.
	(SYMBOL_SET_LANGUAGE): Add 'obstack' argument.
	(symbol_set_language): Update.
2013-04-08 19:56:03 +00:00
Tom Tromey e623cf5da2 * coffread.c (process_coff_symbol, coff_read_enum_type): Call
allocate_symbol.
	* dwarf2read.c (fixup_go_packaging): Call allocate_symbol.
	(read_func_scope): Call allocate_template_symbol.
	(new_symbol_full): Call allocate_symbol.
	* jit.c (finalize_symtab): Call allocate_symbol.
	* jv-lang.c (add_class_symbol): Call allocate_symbol.
	* mdebugread.c (parse_symbol, new_block): Call allocate_symbol.
	* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
	(common_block_end): Call allocate_symbol.
	* symtab.c (allocate_symbol, initialize_symbol)
	(allocate_template_symbol): New functions.
	* symtab.c (allocate_symbol, initialize_symbol)
	(allocate_template_symbol): Declare.
	* xcoffread.c (process_xcoff_symbol): Call initialize_symbol.
2013-04-08 19:48:30 +00:00
Doug Evans 02142a6c8b * dwarf2read.c (struct dwarf2_per_objfile): Tweak comment.
(read_cutu_die_from_dwo): Add comments.
	(read_structure_type): Update comment.
	(read_enumeration_type, read_namespace_type): Update comment.
	(read_die_type, get_die_type_at_offset, get_die_type): Update comment.
2013-04-05 21:48:25 +00:00
Doug Evans bf6af49608 * dwarf2read.c (read_die_and_siblings_1): Renamed from
read_die_and_siblings.
	(read_die_and_siblings): New function.
	(read_cutu_die_from_dwo): Dump die if requested.
	(read_die_and_children): Call read_full_die_1 and
	read_die_and_siblings_1.
	(read_full_die): Dump die if requested.

	* dwarf2read.c (read_comp_units_from_section): Add debugging printf.
2013-04-03 19:45:00 +00:00
Doug Evans 0ac5b59e25 * dwarf2read.c (struct dwo_file): New member comp_dir.
Rename member name to dwo_name.  All uses updated.
	(hash_dwo_file): Include comp_dir in computation.
	(eq_dwo_file): Ditto.
	(lookup_dwo_file_slot): New arg comp_dir.  All callers updated.
	(create_dwo_in_dwp, lookup_dwo_in_dwp, open_and_init_dwo_file): Ditto.
2013-04-03 19:11:01 +00:00
Doug Evans 3d1d5ea371 * dwarf2read.c (read_structure_type): Fix typo in comment. 2013-04-02 21:18:40 +00:00
Doug Evans c0f78cd41b * dwarf2read.c (lookup_signatured_type_at_offset): Delete.
(process_enumeration_scope): Simplify.
2013-04-01 23:17:40 +00:00
Doug Evans 0186c6a733 * dwarf2read.c (struct dwarf2_per_cu_data): Move member
type_unit_group ...
	(struct signatured_type): ... to here.
	(sig_type_ptr): New typedef.
	(type_unit_group): Delete member 't.first_cu'.  Move member 'tus'
	out of union 't'.  All uses updated.
	(dw2_get_file_names_reader): Assert not called for a type unit.
	(dw2_get_file_names): Assert not called for a type unit or type
	unit group.
	(build_type_psymtabs_reader): Assert called for a type unit.
	(build_type_psymtab_dependencies): Assert called for a type unit group.
2013-04-01 22:36:08 +00:00
Doug Evans 5c6fa7ab3b * dwarf2read.c (free_dwo_file): Add comment.
(dwarf2_per_objfile_free): Unref dwp bfd.
2013-04-01 16:42:15 +00:00
Doug Evans ab5088bf32 * dwarf2read.c (open_dwo_file): Renamed from open_dwop_file.
Delete arg is_dwp.  All callers updated.
	(open_dwp_file): New function.
	(open_and_init_dwp_file): Call it.
	(get_dwp_file): New function.
	(lookup_dwo_cutu): Call it.
2013-03-29 21:47:51 +00:00
Doug Evans a8ad1e578d * dwarf2read.c (open_and_init_dwp_file): Remove incorrect, and
unnecessary, cleanup.
2013-03-29 21:42:04 +00:00
Doug Evans 6296d8c13f * dwarf2read.c (lookup_dwo_cutu): Improve complaint text. 2013-03-29 18:46:07 +00:00
Doug Evans b0c7bfa934 * dwarf2read.c (read_cutu_die_from_dwo): New function.
(lookup_dwo_unit): New function.
	(init_cutu_and_read_dies): Move DWO handling to new functions.
2013-03-29 17:48:48 +00:00
Doug Evans c88ee1f032 * dwarf2read.c (struct signatured_type): Tweak comment.
(struct dwo_unit): Tweak comment.
	(create_debug_types_hash_table): Tweak comment.  Reformat long line.
	(create_dwo_debug_info_hash_table): Tweak comment.
	(dwarf2_per_cu_offset_and_type): Tweak comment.
2013-03-29 16:55:57 +00:00
Doug Evans 5a8b3f62be * dwarf2read.c (lookup_signatured_type): Remove complaint about
missing .debug_types section.
2013-03-29 16:38:52 +00:00
Doug Evans 0349ea227a * dwarf2read.c (create_debug_types_hash_table): Don't allocate the
types hash table until we know we need it.
2013-03-29 00:35:20 +00:00
Doug Evans f652bce2ee * dwarf2read.c (create_addrmap_from_index): Complain about bad CU
index numbers.
2013-03-29 00:18:32 +00:00
Doug Evans e4a48d9d49 * dwarf2read.c (dw2_get_file_names): Delete arg "objfile".
All callers updated.
	(dw2_print_stats): Print #read CUs too.
	(dump_die_shallow): Print signatured types better.

	testsuite/
	* gdb.base/maint.exp (maint print statistics): Update expected output.
2013-03-29 00:11:10 +00:00
Doug Evans 8a0459fdd5 * dwarf2read.c (struct dwarf2_per_cu_data): Rename member
info_or_types_section to section.  All uses updated.
	(struct dwo_unit): Ditto.
2013-03-28 22:59:47 +00:00
Doug Evans 0018ea6f8f * dwarf2read.c (create_partial_symtab): Add forward decl.
(create_partial_symtab): Move to be closer to other psymtab functions.
	(process_psymtab_comp_unit_reader, process_psymtab_comp_unit): Ditto.
2013-03-28 17:41:03 +00:00