initialize them from target PT_PHDR p_vaddr, relocate sect_addr by
pt_phdr if PT_PHDR was found.
* gdb.base/attach-pie-noexec.c: New files.
* gdb.base/attach-pie-noexec.exp: New files.
Drop lazy lm_info reading.
* solib-svr4.c (struct lm_info): Remove field lm. New fields l_addr_p,
l_addr_inferior, l_ld, l_next, l_prev and l_name.
(lm_info_read): New function.
(lm_addr_from_link_map, lm_dynamic_from_link_map): Remove.
(lm_addr_check): Use l_addr_p. No longer use lm_addr_from_link_map and
lm_dynamic_from_link_map.
(lm_next, lm_prev, lm_name): Remove.
(svr4_keep_data_in_core): Use lm_info_read, drop the lm_info entries
initialization incl. read_memory. No longer use lm_name.
(svr4_free_so): Drop lm_info->lm freeing.
(svr4_default_sos): Initialize lminfo with zeroes. Use l_addr_p. Drop
explicit lm_addr and lm initialization.
(svr4_read_so_list): Use lm_info_read, drop the initailization of
fields by hand, incl. read_memory. No longer use lm_next, lm_prev and
lm_name.
* defs.h (struct so_list): New forward declaration.
(make_cleanup_free_so): New declaration.
* solib-svr4.c (ignore_first_link_map_entry): Remove.
(svr4_free_so): Move the function here from downwards. Handle NULL
so->lm_info.
(svr4_free_library_list): New.
(svr4_read_so_list): New, moved here code from svr4_current_sos.
Use more cleanups. Use new parameter ignore_first instead of
ignore_first_link_map_entry.
(svr4_current_sos): New variable ignore_first, initialize it. New
variable back_to, use it for svr4_free_library_list protection.
(svr4_free_so): Remove - move upwards.
* utils.c: Include solist.h.
(do_free_so, make_cleanup_free_so): New functions.
* solib-svr4.c (open_symbol_file_object): Call do_cleanups on all
return paths. Defer final do_cleanups until last return.
* arm-tdep.c (arm_exidx_new_objfile): Make null cleanup after
early return.
gdb/
* solib-svr4.c (svr4_solib_create_inferior_hook): Skip setting
shared library event breakpoint if there's no execution.
gdb/testsuite/
* gdb.trace/tfile.exp: Add test that opening the basic.tf trace
file doesn't error, using MI.
* nto-tdep.c (LM_ADDR): Rename to...
(lm_addr): New function name.
(nto_relocate_section_addresses): Adapt to change above.
* solib-sunos.c (LM_ADDR): Rename to...
(lm_addr): New function name.
(LM_NEXT): Rename to...
(lm_next): New function name.
(sunos_current_sos, sunos_relocate_section_addresses): Adapt to
function name changes above.
* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Rename to...
(lm_addr_from_link_map): New function name.
(HAS_LM_DYNAMIC_FROM_LINK_MAP): Rename to...
(has_lm_dynamic_from_link_map): New function name.
(LM_DYNAMIC_FROM_LINK_MAP): Rename to...
(lm_dynamic_from_link_map): New function name.
(LM_ADDR_CHECK): Rename to...
(lm_addr_check): New function name.
(LM_NEXT): Rename to...
(lm_next): New function name.
(LM_PREV): Rename to...
(lm_prev): New function name.
(LM_NAME): Rename to...
(lm_name): New function name.
(IGNORE_FIRST_LINK_MAP_ENTRY): Rename to...
(ignore_first_link_map_entry): New function name.
(svr4_keep_data_in_core): Adapt to function name changes above.
(svr4_current_sos): Likewise.
(enable_break): Likewise.
(svr4_relocate_section_addresses): Likewise.
Fix libraries displacement if they change whether they were prelinked.
* solib-svr4.c (LM_ADDR_CHECK): Set L_ADDR even if the DYNAMIC pointer
does not match. Comment why.
gdb/testsuite/
* gdb.base/break-interp-lib.c (v, vptr): New variables.
* gdb.base/break-interp.exp (test_attach): New comment.
GDB internal type support for STT_GNU_IFUNC.
* elfread.c (record_minimal_symbol): Support mst_text_gnu_ifunc.
(elf_symtab_read): Set mst_text_gnu_ifunc for
BSF_GNU_INDIRECT_FUNCTION.
* eval.c (evaluate_subexp_standard): Support TYPE_GNU_IFUNC.
* gdbtypes.c (init_type): Support TYPE_FLAG_GNU_IFUNC,
builtin_func_func, nodebug_text_gnu_ifunc_symbol and
nodebug_got_plt_symbol.
* gdbtypes.h (enum type_flag_value): New entry TYPE_FLAG_GNU_IFUNC.
(TYPE_GNU_IFUNC): New.
(struct main_type): New field flag_gnu_ifunc.
(struct builtin_type): New field builtin_func_func.
(struct objfile_type): New fields nodebug_text_gnu_ifunc_symbol and
nodebug_got_plt_symbol.
* minsyms.c (lookup_minimal_symbol_text): Support mst_text_gnu_ifunc.
(in_gnu_ifunc_stub): New.
(prim_record_minimal_symbol, find_solib_trampoline_target): Support
mst_text_gnu_ifunc.
* parse.c (write_exp_msymbol): New variable ifunc_msym. Detect and
support mst_text_gnu_ifunc. Support mst_slot_got_plt.
* solib-svr4.c (svr4_in_dynsym_resolve_code): Return true also for
in_gnu_ifunc_stub.
* symmisc.c (dump_msymbols): Support mst_text_gnu_ifunc.
* symtab.c (search_symbols): Likewise.
* symtab.h (enum minimal_symbol_type): New fields mst_text_gnu_ifunc
and mst_slot_got_plt.
(in_gnu_ifunc_stub): New declaration.
Rename and move inferior_thread_state and inferior_status.
* gdbthread.h (struct thread_control_state): New struct, move fields
step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
trap_expected, proceed_to_finish, in_infcall, step_over_calls,
stop_step and stop_bpstat here from struct thread_info.
(struct thread_suspend_state): New struct, move field stop_signal here
from struct thread_info.
(struct thread_info): Move the fields above from this struct.
* inferior.h: Move the inferior_thread_state and inferior_status
declarations comment to their definitions at infrun.c.
(struct inferior_control_state): New struct, move field stop_soon from
struct inferior here.
(struct inferior_suspend_state): New empty struct.
(struct inferior): New fields control and suspend. Move out field
stop_soon.
* infrun.c (struct inferior_thread_state): Rename to ...
(infcall_suspend_state): ... here. Replace field stop_signal by
fields thread_suspend and inferior_suspend.
(save_inferior_thread_state): Rename to ...
(save_infcall_suspend_state): ... here. New variable inf. Update the
code for new fields.
(restore_inferior_thread_state): Rename to ...
(restore_infcall_suspend_state): ... here. New variable inf. Update
the code for new fields.
(do_restore_inferior_thread_state_cleanup): Rename to ...
(do_restore_infcall_suspend_state_cleanup): ... here.
(make_cleanup_restore_inferior_thread_state): Rename to ...
(make_cleanup_restore_infcall_suspend_state): ... here.
(discard_inferior_thread_state): Rename to ...
(discard_infcall_suspend_state): ... here.
(get_inferior_thread_state_regcache): Rename to ...
(get_infcall_suspend_state_regcache): ... here.
(struct inferior_status): Rename to ...
(struct infcall_control_state): ... here. Replace fields
step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
trap_expected, proceed_to_finish, in_infcall, step_over_calls,
stop_step, stop_bpstat and stop_soon by fields thread_control and
inferior_control.
(save_inferior_status): Rename to ...
(save_infcall_control_state): ... here. Update the code for new
fields.
(restore_inferior_status): Rename to ...
(restore_infcall_control_state): ... here. Update the code for new
fields.
(do_restore_inferior_status_cleanup): Rename to ...
(do_restore_infcall_control_state_cleanup): ... here.
(make_cleanup_restore_inferior_status): Rename to ...
(make_cleanup_restore_infcall_control_state): ... here.
(discard_inferior_status): Rename to ...
(discard_infcall_control_state): ... here.
* alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h,
exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c,
inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c,
mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the
references to the moved fields and renamed functions.
Fix attaching to re-prelinked executables on ppc64.
* solib-svr4.c (svr4_exec_displacement): New variable plt2_asect,
initialize it, try to adjust FILESZ field by it.
Fix re-run of PIE executable, PR shlibs/11776.
* solib-svr4.c (svr4_relocate_main_executable) <symfile_objfile>: Remove
the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS.
gdb/testsuite/
Fix re-run of PIE executable, PR shlibs/11776.
* gdb.base/break-interp.exp (test_ld): Turn off "disable-randomization".
Remove $displacement_main to match the solib-svr4.c change. New "kill"
and re-"run" of the inferior.
Fix attaching to PIEs prelinked on the disk after the process was
started.
* solib-svr4.c (svr4_exec_displacement): New variable arch_size.
Verify it against bfd_get_arch_size. Try to match arbitrary
displacement for the phdrs comparison.
gdb/testsuite/
* gdb.base/break-interp.exp: Run $binpie with new value "ATTACH", new
code for it. New variable relink_args.
(prelinkYES): Call prelinkNO.
(test_attach): Accept new parameter relink_args. Re-prelink the binary
in such case. Move the core code to ...
(test_attach_gdb): ... a new function. Send GDB command "file".
Extend expected "Attaching to " string.
* scm-exp.c: White space.
* scm-lang.c: White space.
* scm-valprint.c: White space.
* sentinel-frame.c: White space.
* ser-base.c: White space.
* ser-go32.c: White space.
* serial.c: White space.
* ser-mingw.c: White space.
* ser-pipe.c: White space.
* ser-tcp.c: White space.
* ser-unix.c: White space.
* solib.c: White space.
* solib-darwin.c: White space.
* solib-frv.c: White space.
* solib-irix.c: White space.
* solib-osf.c: White space.
* solib-pa64.c: White space.
* solib-som.c: White space.
* solib-spu.c: White space.
* solib-svr4.c: White space.
* solib-target.c: White space.
* source.c: White space.
* stabsread.c: White space.
* stack.c: White space.
* std-regs.c: White space.
* symfile.c: White space.
* symmisc.c: White space.
* symtab.c: White space.
Fix deadlock on looped list of loaded shared objects.
* solib-svr4.c (LM_PREV): New function.
(IGNORE_FIRST_LINK_MAP_ENTRY): Use it.
(svr4_current_sos): Check for correct l_prev. New variables prev_lm
and next_lm. Clear prev_lm for solib_svr4_r_ldsomap.
* config/djgpp/fnchange.lst: Add translation for solib-corrupted.exp.
gdb/testsuite/
Fix deadlock on looped list of loaded shared objects.
* gdb.base/solib-corrupted.exp: New.
* solib-svr4.c (LM_ADDR_CHECK) <info_verbose>: Use printf_unfiltered
for the PIC displacement, print also the displacement value.
(svr4_exec_displacement): Print DISPLACEMENT if INFO_VERBOSE.
gdb/testsuite/
* gdb.base/break-interp.exp: Create new displacement parameter value
for the test_ld calls.
(reach): New parameter displacement, verify its content. New push of
pf_prefix "reach-$func:". Import global expect_out.
(test_core): New parameter displacement, verify its content. New push
of pf_prefix "core:". New command "set verbose on". Import global
expect_out.
(test_attach): New parameter displacement, verify its content. New
push of pf_prefix "attach:". New command "set verbose on". Import
global expect_out.
(test_ld): New parameter displacement, pass it to the reach, test_core
and test_attach calls and verify its content in the "ld.so exit" test.
* gdb.base/prelink.exp: Remove gdb_exit and final return.
(prelink): Update expected text, use gdb_test.
* solib-svr4.c (svr4_exec_displacement): Return now success, new
parameter displacementp. Update comment.
(svr4_relocate_main_executable): Return if non-zero SECTION_OFFSETS
element exists. Return if svr4_exec_displacement was not successful.
Update comment.
* solib-svr4.c (read_program_header): Support type == -1 to read
all program headers.
(read_program_headers_from_bfd): New function.
(svr4_static_exec_displacement): Remove and move the comment ...
(svr4_exec_displacement): ... here. Remove variable found. New
variable displacement. Check also DYNAMIC. Verify DISPLACEMENT
alignment for ELF targets. Compare target vs. exec_bfd PHDRs for ELF
targets using read_program_headers_from_bfd. Remove the call of
svr4_static_exec_displacement.
Based on work from Daniel Jacobowitz <dan@codesourcery.com>
* c-typeprint.c (cp_type_print_method_args): For non-static methods,
print out const or volatile qualifiers, too.
(c_type_print_args): Add parameters show_artificial and language.
Skip artificial parameters when requested.
Use the appropriate language printer.
(c_type_print_varspec): Tell c_type_print_args to skip artificial
parameters and pass language_c.
* dwarf2read.c (die_list): New file global.
(struct partial_die_info): Update comments for name field.
(pdi_needs_namespace): Renamed to ...
(die_needs_namespace): ... this. Rewrite.
(dwarf2_linkage_name): Remove.
(add_partial_symbol): Do not predicate the call to
partial_die_full_name based on pdi_needs_namespace.
Remove call to cp_check_possible_namespace_symbols and associated
outdated comments.
(guess_structure_name): Do not inspect child subprogram DIEs.
(dwarf2_fullname): Update comments.
Use die_needs_namespace to assist in computing the name.
(read_func_scope): Use dwarf2_name to get the DIE's name.
Use dwarf2_physname to get the "linkage name" of the DIE.
(dwarf2_add_member_field): Use dwarf2_physname instead of
dwarf2_linkage_name.
(read_structure_type): For structs and classes, set TYPE_NAME, too.
(determine_class): Remove.
(read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages
except Ada.
(new_symbol): Unconditionally call dwarf2_name.
Compute the "linkage name" using dwarf2_physname.
Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs.
When determining to scan for anonymous C++ namespaces, ignore
the linkage name.
(dwarf2_physname): New function.
(dwarf2_full_name): Move content to new function and call
that.
(dwarf2_compute_name): "New" function.
(_initialize_dwarf2_read): Initialize die_list.
* gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable
physname.
(gnu_v3_print_method_ptr): Use the physname for virtual methods
without a demangled name.
Print out type information for non-virtual methods.
* linespec.c (decode_line_1): Force ANY string using "::" (or
"." for java) to use decode_compound, and clean up any stray quoting.
If we found a file symtab, re-evaluate whether the remainder is_quoted.
(decode_compound): Stop consuming at an open parenthesis.
Keep template parameters.
Keep any overload information.
Keep keywords like "const".
Remove paren_pointer.
Move is_quoted check from set_flags to here.
Remove #if 0 code from 2000. Ten years is long enough.
(find_method): Before comparing symbol names, canonicalize the string
from the user.
If a specific overload is requested, find it. Otherwise throw an error.
(find_method_overload_end): New function.
(set_flags): Remove.
(decode_compound): Assume that parentheses are matched.
It's a lot easier.
* symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag
to cplus_demangle.
* linespec.c (decode_line_1): Keep important keywords like
"const" and "volatile".
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove.
* typeprint.h (c_type_print_args): Add declaration.
* ui-file.c (do_ui_file_obsavestring): New function.
(ui_file_obsavestring): New function.
* ui-file.h (ui_file_obsavestring): Add declaration.
* valops.c (find_overload_match): Resolve the object to
a non-pointer type.
If the object is a data member, search the object for the member
and return with staticp set.
Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME.
Do not attempt to extract a function name from non-function types.
If the extracted function name and the original name are the same,
we don't have a C++ method.
From Jan Kratochvil <jan.kratochvil@redhat.com>:
* dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name.
* ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters
and arguments from symbol lookups.
* ax-gdb.c (gen_expr): Likewise.
* cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope,
cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type,
lookup_possible_namespace_symbol): Likewise.
* cp-support.c (read_in_psymtabs): Likewise.
* cp-support.h (cp_lookup_symbol_nonlocal): Likewise.
* language.h (la_lookup_symbol_nonlocal): Likewise.
* scm-valprint.c (scm_inferior_print): Likewise.
* solib-darwin.c (darwin_relocate_section_addresses): Likewise.
* solib-svr.c (elf_lookup_lib): Likewise.
* solib.c (show_auto_solib_add): Likewise.
* solist.h (lookup_lib_global, solib_global_lookup): Likewise.
* symmisc.c (maintenance_check_symtabs): Likewise.
* symtab.c (lookup_symbol_in_language, lookup_symbol_aux,
lookup_symbol_aux_local, lookup_symbol_aux_block,
lookup_symbol_from_objfile, lookup_symbol_aux_symtabs,
lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal,
lookup_symbol_static, lookup_symbol_global, symbol_matches_domain,
basic_lookup_transparent_type, find_main_psymtab,
lookup_block_symbol): Likewise.
* symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static,
lookup_symbol_global, lookup_symbol_aux_block,
lookup_symbol_partial_symbol, lookup_block_symbol,
lookup_global_symbol, value_maybe_namespace_elt): Likewise.
* solib-svr4.c (scan_dyntag): New variable dyn_addr. Replace gdb_assert
by a conditional setting DYN_ADDR. Use DYN_ADDR.
* config/djgpp/fnchange.lst: Add translations for
symbol-without-target_section.exp and symbol-without-target_section.c.
gdb/testsuite/
* gdb.base/symbol-without-target_section.exp,
gdb.base/symbol-without-target_section.c: New.
Support Valgrind attachments broken by the PIE support.
* auxv.c: Include gdbcore.h.
(procfs_xfer_auxv): Make static. Reduce its comment. Drop its
parameters ops, object and annex. Remove their assertions.
(ld_so_xfer_auxv, memory_xfer_auxv): New function.
* auxv.h (procfs_xfer_auxv): Remove comment. Rename to ...
(memory_xfer_auxv): ... here.
* linux-nat.c (linux_xfer_partial): Rename procfs_xfer_auxv to
memory_xfer_auxv.
* procfs.c (procfs_xfer_partial): Likewise.
* solib-svr4.c (svr4_relocate_main_executable): New prototype.
(svr4_special_symbol_handling): Call svr4_relocate_main_executable.
(svr4_solib_create_inferior_hook): Conditionalize the
svr4_relocate_main_executable call.
gdb/testsuite/
* gdb.base/valgrind-db-attach.exp, gdb.base/valgrind-db-attach.c: New.
* solib-svr4.c (scan_dyntag): Remove variable dyn_addr. New variable
target_section. Find SECT in current_target_sections, gdb_assert it.
(elf_lookup_lib_symbol): Pass the binary file if given symfile_objfile.
New variable abfd.
* symtab.c (lookup_objfile_from_block): Return the binary file instead
of separate debug info file.
gdb/testsuite/
* gdb.base/break-interp.exp (test_core): New proc.
(test_ld): Call it.
Support PIEs with no symfile_objfile.
* exec.c (print_section_info <abfd == exec_bfd>): Relocate Entry point.
* solib-svr4.c (svr4_relocate_main_executable <exec_bfd>): New block.
gdb/testsuite/
Support PIEs with no symfile_objfile.
* gdb.base/break-interp.exp: New argument at the test_ld calls.
(test_ld): New parameter trynosym.
(test_ld <$trynosym>): New block.