BFD recently got a few functions related to "dwz" files. This patch
changes gdb to use them, just to share a bit more code.
This changes dwarf2_get_dwz_file to possibly return NULL. This
simplified a bit of code elsewhere.
Built and regtested on x86-64 Fedora 18. I specifically regtested it
using my pending dwz test case.
* dwarf2read.c (dwarf2_get_dwz_file): Return NULL if
.gnu_debugaltlink not found. Use bfd_get_alt_debug_link_info.
(dwarf2_read_index, create_all_comp_units): Update.
* 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.
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.
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.
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.
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.
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.
(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.
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 *'.
-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.
(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.
(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.
* 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.
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.
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.
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.
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.
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.
(compute_symtab_includes): Remove unnecessary forward declaration.
(die_needs_namespace): Add comment marking group of functions for
dwarf2 name computation.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Put continue after
any successful compare_filenames_for_search or FILENAME_CMP.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symtab.c (iterate_over_some_symtabs): Likewise.
Fix entry-values in C++ across CUs.
* dwarf2loc.c (call_site_to_target_addr) <FIELD_LOC_KIND_PHYSNAME>: Use
lookup_minimal_symbol. Add a comment.
* dwarf2read.c
(read_call_site_scope) <is_ref_attr> <die_is_declaration>: Prefer
DW_AT_linkage_name.
gdb/testsuite/
Fix entry-values in C++ across CUs.
* gdb.arch/amd64-tailcall-cxx.exp: New file.
* gdb.arch/amd64-tailcall-cxx1.S: New file.
* gdb.arch/amd64-tailcall-cxx1.cc: New file.
* gdb.arch/amd64-tailcall-cxx2.S: New file.
* gdb.arch/amd64-tailcall-cxx2.cc: New file.
* dwarf2read.c (file_file_name): New function with code from
file_full_name.
(file_full_name): Move most of the code to file_file_name.
(macro_start_file): Rename variable full_name to file_name and use
file_file_name for it. Add comp_dir parameter to new_macro_table.
* macrocmd.c (show_pp_source_pos): New variable fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
* macroscope.c (_initialize_macroscope): Update the new_macro_table
caller.
* macrotab.c (struct macro_table): New field comp_dir.
(macro_include): New variables link_fullname and source_fullname.
Replace any macro_source_file->filename access by macro_source_fullname
call.
(macro_lookup_inclusion): Remove the partial filenames checking code.
(check_for_redefinition): New variables source_fullname and
found_key_fullname. Replace any macro_source_file->filename access by
macro_source_fullname call.
(macro_undef): New variables source_fullname and key_fullname. Replace
any macro_source_file->filename access by macro_source_fullname call.
(macro_lookup_definition): New variables retval and source_fullname.
Replace any macro_source_file->filename access by macro_source_fullname
call.
(foreach_macro): New variable key_fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
(foreach_macro_in_scope): New variable datum_fullname. Replace any
macro_source_file->filename access by macro_source_fullname call.
(new_macro_table): Add parameter comp_dir. Initialize T with it.
(macro_source_fullname): New function.
* macrotab.h (struct macro_source_file): Extent the filename field
comment.
(new_macro_table): New parameter comp_dir, add a comment for it.
(macro_source_fullname): new declaration.
gdb/testsuite/
* gdb.linespec/base/one/header.h: New file.
* gdb.linespec/base/two/header.h: New file.
* gdb.linespec/macro-relative.c: New file.
* gdb.linespec/macro-relative.exp: New file.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Move variable
this_real_name to outer block. Use it also for
compare_filenames_for_search.
(dw2_expand_symtabs_matching): New variable this_real_name. Use it
with dw2_get_real_path for file_matcher, considering also
BASENAMES_MAY_DIFFER.
(file_full_name): Prepend COMP_DIR even for relative lh->INCLUDE_DIRS.
* dwarf2read.c (dw2_expand_symtabs_matching): Add basenames parameter
to the file_matcher parameter. Pass 0 to it.
(dwarf2_create_include_psymtab): Copy also DIRNAME.
* psymtab.c (partial_map_symtabs_matching_filename): Drop handling of
NULL psymtab_to_fullname result.
(psymtab_to_fullname): Remove variable r. Never return NULL, assemble
an expected filename instead.
(expand_symtabs_matching_via_partial): Add basenames parameter to the
file_matcher parameter. Call also psymtab_to_fullname, after newly
considering BASENAMES_MAY_DIFFER.
* source.c (rewrite_source_path): Remove static.
* source.h (rewrite_source_path): New declaration.
* symfile.h (struct quick_symbol_functions): Add basenames parameter to
the expand_symtabs_matching field. Comment it.
* symtab.c (file_matches): New function comment. Add parameter
basenames, implement it.
(search_symbols_file_matches): Add basenames parameter. Update the
file_matches caller.
(search_symbols): Match FILES also against symtab_to_fullname.
Optimize it for BASENAMES_MAY_DIFFER.
gdb/testsuite/
* gdb.base/fullpath-expand-func.c: New file.
* gdb.base/fullpath-expand.c: New file.
* gdb.base/fullpath-expand.exp: New file.
* gdb.base/realname-expand-real.c: New file.
* gdb.base/realname-expand.c: New file.
* gdb.base/realname-expand.exp: New file.
* ada-lang.c (user_select_syms): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
* breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise.
(clear_command): New variable sal_fullname, initialize it. Replace
compare_filenames_for_search by filename_cmp with sal_fullname.
(say_where, update_static_tracepoint): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
* cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec):
Likewise.
* dwarf2read.c: Include source.h.
(fixup_go_packaging): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* linespec.c (add_sal_to_sals): Rename variable filename to fullname.
Replace symtab->filename refererences by symtab_to_filename_for_display
calls.
(create_sals_line_offset, convert_linespec_to_sals): New variable
fullname, initialize it, replace symtab->filename reference by the
variable.
* linux-fork.c: Include source.h.
(info_checkpoints_command): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* macroscope.c (sal_macro_scope): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
* mdebugread.c: Include source.h.
(psymtab_to_symtab_1): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(mi_cmd_file_list_exec_source_files): Likewise.
* printcmd.c: Include source.h.
(build_address_symbolic): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* psymtab.c (partial_map_symtabs_matching_filename)
(read_psymtabs_with_fullname): Call compare_filenames_for_search also
with psymtab_to_fullname.
* python/py-symtab.c (stpy_str): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
(stpy_get_filename): New variable filename, initialize it, use instead
of symtab->filename refererences.
(salpy_str): Make variable filename const char *. Replace
symtab->filename refererences by symtab_to_filename_for_display calls.
* skip.c: Include source.h and filenames.h.
(skip_file_command): Remove const from the symtab variable. Replace
symtab->filename refererences by symtab_to_fullname call.
(function_name_is_marked_for_skip): New variables searched_for_fullname
and fullname. Use them to search also with symtab's fullname.
* source.c (find_source_lines): Replace symtab->filename refererences
by symtab_to_filename_for_display calls.
(print_source_lines_base): New variable filename, use it instead of
symtab->filename. Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
(line_info, forward_search_command): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
(reverse_search_command): Replace symtab->filename refererences by
symtab_to_filename_for_display calls. New variable filename for it.
* stack.c (frame_info): Likewise.
* symmisc.c: Include source.h.
(dump_objfile, dump_symtab_1, maintenance_print_symbols)
(maintenance_info_symtabs): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
* symtab.c (iterate_over_some_symtabs): Call
compare_filenames_for_search also with symtab_to_fullname.
(lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace
symtab->filename refererences by symtab_to_filename_for_display calls.
(find_line_symtab): Replace symtab->filename refererences by
symtab_to_filename_for_display calls.
(file_matches): Replace filename_cmp by compare_filenames_for_search.
(print_symbol_info): Make the last parameter const char *. New
variable s_filename. Use it in the function.
(symtab_symbol_info): Make the last_filename variable const char *.
Replace symtab->filename refererences by symtab_to_filename_for_display
calls.
(rbreak_command): New variable fullname. Use it. Replace
symtab->filename refererence by symtab_to_filename_for_display call.
* tracepoint.c (set_traceframe_context, trace_find_line_command)
(print_one_static_tracepoint_marker): Replace symtab->filename
refererences by symtab_to_filename_for_display calls.
* tui/tui-source.c (tui_set_source_content): New variables filename and
s_filename. Replace symtab->filename refererences by this variable.
Replace other symtab->filename refererences by
symtab_to_filename_for_display calls.
Code cleanup.
* dwarf2read.c (dw2_expand_symtabs_with_filename): Rename to ...
(dw2_expand_symtabs_with_fullname): ... here. Rename parameter
filename to fullname. Rename variable this_name to this_fullname.
Lowercase FILENAME_CMP call.
(dw2_find_symbol_file): New comment for the returned string.
(dwarf2_gdb_index_functions): Rename the function to
dw2_expand_symtabs_with_fullname.
* psymtab.c (read_psymtabs_with_filename): Rename to ...
(read_psymtabs_with_fullname): ... here. Rename parameter filename to
fullname.
(psym_functions): Rename the function to read_psymtabs_with_fullname.
* symfile.h (struct quick_symbol_functions): Rename field
expand_symtabs_with_filename to expand_symtabs_with_fullname and its
parameter filename to fullname. Document returned string meaning for
find_symbol_file.
* symtab.c (find_line_symtab): Rename the called function to
expand_symtabs_with_fullname.
Code cleanup.
* breakpoint.c (clear_command): Remove variable is_abs, unify the
call of filename_cmp with compare_filenames_for_search.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
is_abs, unify the call of FILENAME_CMP with
compare_filenames_for_search. New gdb_asserts for real_path and name.
Unify the call of compare_filenames_for_search with FILENAME_CMP.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symfile.h (struct quick_symbol_functions): Extend the comment for
map_symtabs_matching_filename.
* symtab.c (compare_filenames_for_search): Remove the function comment
relative path requirement. Handle absolute filenames, with a comment.
(iterate_over_some_symtabs): Remove variable is_abs, unify the call of
FILENAME_CMP with compare_filenames_for_search. New gdb_asserts for
real_path and name. Unify the call of compare_filenames_for_search
with FILENAME_CMP.
(iterate_over_symtabs): New gdb_assert on REAL_PATH.
gdb/testsuite/
* gdb.mi/mi-fullname-deleted.exp: Use double last slash for $srcfileabs.
(compare_filenames_for_search does not match)
(compare_filenames_for_search does match): New tests.
Replace xfullpath calls by gdb_realpath calls.
* cli/cli-cmds.c (find_and_open_script): Remove xfullpath from the
function comment.
* dwarf2read.c (dw2_map_expand_apply): Remove parameter full_path.
Remove it from the iterate_over_some_symtabs call.
(dw2_map_symtabs_matching_filename): Remove parameter full_path.
Remove it from the dw2_map_expand_apply calls, remove a block handling
it.
* psymtab.c (partial_map_expand_apply): Remove parameter full_path.
Remove it from the iterate_over_some_symtabs call.
(partial_map_symtabs_matching_filename): Remove parameter full_path.
Remove it from the partial_map_expand_apply calls, remove a block
handling it. Drop gdb_realpath call and cleanups from the real_path
handling.
* source.c (openp): Drop the comment part about xfullpath. Replace
xfullpath calls by gdb_realpath calls.
(find_and_open_source): Replace xfullpath call by gdb_realpath call.
* symfile.h (struct quick_symbol_functions): Remove parameter full_path
from method map_symtabs_matching_filename and its comment.
* symmisc.c (maintenance_print_msymbols): Replace xfullpath call by
gdb_realpath call.
* symtab.c (iterate_over_some_symtabs): Remove parameter full_path,
remove it also from the function comment, remove a block handling it.
Drop gdb_realpath call and cleanups from the real_path handling.
(iterate_over_symtabs): Drop variable full_path and its use.
* symtab.h (iterate_over_some_symtabs): Remove parameter full_path.
* utils.c (xfullpath): Remove.
* utils.h (xfullpath): Remove.
gdb/testsuite/
* gdb.gdb/xfullpath.exp: Replace xfullpath calls by gdb_realpath calls.
* dwarf2read.c (dwarf2_per_cu_data): Split imported_symtabs and
type_unit_group out of union s. All uses updated.
(read_index_from_section): Watch for index version 8.
(follow_die_sig): If using .gdb_index version <= 7, record the TU as
an imported symtab.
(write_psymtabs_to_index): Increment version number to 8.
doc/
* gdb.texinfo (Index Section Format): Document .gdb_index version 8.
* symfile.c (obsavestring): Remove.
* ada-exp.y: Use obstack_copy0, not obsavestring.
* ada-lang.c: Use obstack_copy0, not obsavestring.
* coffread.c: Use obstack_copy0, not obsavestring.
* cp-namespace.c: Use obstack_copy0, not obsavestring.
* dbxread.c: Use obstack_copy0, not obsavestring.
* dwarf2read.c: Use obstack_copy0, not obsavestring.
* jit.c: Use obstack_copy0, not obsavestring.
* mdebugread.c: Use obstack_copy0, not obsavestring.
* psymtab.c: Use obstack_copy0, not obsavestring.
* stabsread.c: Use obstack_copy0, not obsavestring.
* xcoffread.c: Use obstack_copy0, not obsavestring.
Fix gdb.fortran/common-block.exp crash in PIE mode.
* dwarf2read.c (new_symbol_full) <DW_TAG_common_block>: Use
LOC_COMMON_BLOCK.
* f-valprint.c (info_common_command_for_block): Expect
LOC_COMMON_BLOCK in gdb_assert.
* symtab.h (struct general_symbol_info): Update comment for the
common_block member.
(domain_enum): Extend comment for the COMMON_BLOCK_DOMAIN member.
(enum address_class): New member LOC_COMMON_BLOCK.
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.
Code cleanup.
* dwarf2read.c (fixup_go_packaging): Do not check symtab->FILENAME for
NULL.
* linespec.c (add_sal_to_sals): Likewise.
* psympriv.h (allocate_psymtab): Add ATTRIBUTE_NONNULL.
* stack.c (print_frame): Do not check symtab->FILENAME for NULL.
* symfile.h (allocate_symtab): Add ATTRIBUTE_NONNULL.
* symtab.h (struct symtab): Add comment it is never NULL for filename.
* tracepoint.c (set_traceframe_context): Do not check symtab->FILENAME
for NULL.
* tui/tui-source.c (tui_set_source_content): Likewise.
Code cleanup.
* breakpoint.c (clear_command): Remove variable sal_name_len and its
initialization, remove it from the compare_filenames_for_search call.
* dwarf2read.c (dw2_map_symtabs_matching_filename): Remove variable
name_len and its initialization, remove it from the
compare_filenames_for_search calls.
* psymtab.c (partial_map_symtabs_matching_filename): Likewise.
* symtab.c (compare_filenames_for_search): Remove the search_len
parameter, update the function comment, new variable search_len
initialized from SEARCH_NAME.
(iterate_over_some_symtabs): Remove variable name_len and its
initialization, remove it from the compare_filenames_for_search calls.
* symtab.h (compare_filenames_for_search): Remove the search_len
parameter,
* 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.
* dwarf2read.c (struct dwarf2_cu): New field producer_is_gcc_lt_4_3.
Update the comment for checked_producer.
(check_producer): New forward declaration.
(producer_is_gcc_lt_4_3): New function.
(find_file_and_directory): Simulate *COMP_DIR only for gcc < 4.3.
(check_producer): Initialize also PRODUCER_IS_GCC_LT_4_3.
gdb/testsuite/
* gdb.dwarf2/dw2-compdir-oldgcc.S: New file.
* gdb.dwarf2/dw2-compdir-oldgcc.exp: New file.