aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-06-26Support ptype/o in RustTom Tromey6-20/+106
This adds support for ptype/o to the Rust language code. By default, the Rust compiler reorders fields to reduce padding. So, the Rust language code sorts the fields by offset before printing. This may yield somewhat odd-looking results, but it is faithful to "what really happens", and might be useful when doing lower-level debugging. The reordering can be disabled using #[repr(c)]; ptype/o might be more useful in this case. gdb/ChangeLog 2018-06-26 Tom Tromey <tom@tromey.com> PR rust/22574: * typeprint.c (whatis_exp): Allow ptype/o for Rust. * rust-lang.c (rust_print_struct_def): Add podata parameter. Update. (rust_internal_print_type): Add podata parameter. (rust_print_type): Update. gdb/testsuite/ChangeLog 2018-06-26 Tom Tromey <tom@tromey.com> PR rust/22574: * gdb.rust/simple.exp (test_one_slice): Add ptype/o tests. * gdb.rust/simple.rs (struct SimpleLayout): New.
2018-06-26Move ptype/o printing code to typeprint.cTom Tromey4-156/+176
This moves the hole-printing support code for ptype/o from c-typeprint.c to be methods on print_offset_data. This allows the code to be used from non-C languages. gdb/ChangeLog 2018-06-26 Tom Tromey <tom@tromey.com> * typeprint.h (struct print_offset_data) <update, finish, maybe_print_hole>: New methods. <indentation>: New constant. * typeprint.c (print_offset_data::indentation): Define. (print_offset_data::maybe_print_hole, print_offset_data::update) (print_offset_data::finish): Move from c-typeprint.c and rename. * c-typeprint.c (OFFSET_SPC_LEN): Remove. (print_spaces_filtered_with_print_options): Update. (c_print_type_union_field_offset, maybe_print_hole) (c_print_type_struct_field_offset): Move to typeprint.c and rename. (c_type_print_base_struct_union): Update.
2018-06-26Updated translations.Nick Clifton15-13873/+18582
gas * po/uk.po: Updated Ukranian translation. bfd * po/uk.po: Updated Ukranian translation. ld * po/uk.po: Updated Ukranian translation. gold * po/uk.po: Updated Ukranian translation. opcodes * po/uk.po: Updated Ukranian translation. * po/de.po: Updated German translation. * po/pt_BR.po: Updated Brazilian Portuguese translation. binutils* po/sv.po: Updated Swedish translation. * po/uk.po: Updated Ukranian translation.
2018-06-26Fix the MSP430 assembler's parsing of register names.Nick Clifton3-133/+150
PR 23335 * config/tc-msp430.c (check_reg): Only accept register name strings that do not end in an alphanumeric character. * testsuite/gas/msp430/msp430x.d: Update expected disassembly.
2018-06-26PR23169 bogus testAlan Modra2-1/+20
The testcase isn't valid. If it happens to run on your target, you're lucky. PR 23169 * testsuite/ld-ifunc/ifunc.exp: Don't run pr23169 tests on powerpc. Comment.
2018-06-26Fix parens in ld bootstrap.expAlan Modra2-2/+9
Seen with tcl 8.5.13: ERROR: tcl error sourcing .../ld/testsuite/ld-bootstrap/bootstrap.exp. ERROR: expected boolean value but got " [istarget ia64-*-elf*] || [istarget ia64-*-linux*" while executing "if { "$flags" == "--static" && { [istarget ia64-*-elf*] || [istarget ia64-*-linux*] } || [istarget mips*-*-linux*] } { # On ia64 and mips, tmpdir/l..." * testsuite/ld-bootstrap/bootstrap.exp: Use parentheses rather than curly braces in logical expression.
2018-06-26Revert "Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non ↵Alan Modra2-3/+5
SHT_NOBITS" This reverts commit 57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.
2018-06-26Fix spelling mistakes.Nick Clifton9-8/+23
opcodes * nfp-dis.c: Fix spelling mistake. ld * emultempl/aarch64elf.em: Fix spelling mistake. * emultempl/avrelf.em: Likewise. * emultempl/elf32.em: Likewise. binutils* doc/binutils.texi: Fix spelling mistakes. * README--how-to-make-a-release: Likewise.
2018-06-26Automatic date update in version.inGDB Administrator1-1/+1
2018-06-25gdb: For macOS, s/thread_info/struct thread_info/Pedro Alves3-15/+27
The macOS build currently fails with several instances of this problem: In file included from ../../src/gdb/darwin-nat.h:22:0, from ../../src/gdb/i386-darwin-nat.c:37: ../../src/gdb/gdbthread.h:376:59: error: type/value mismatch at argument 1 in template parameter list for 'template<class T, class Policy> class gdb::ref_ptr' = gdb::ref_ptr<thread_info, refcounted_object_ref_policy>; ^ ../../src/gdb/gdbthread.h:376:59: note: expected a type, got 'thread_info' ../../src/gdb/gdbthread.h:396:28: error: variable or field 'delete_thread' declared void extern void delete_thread (thread_info *thread); ^ (...) This is because there's a thread_info function in the Darwin/XNU/mach API: http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html Fix this in the same way it had been fixed in commit 7aabaf9d4ad5 ("Create private_thread_info hierarchy"), by adding an explicit "struct" keyword. gdb/ChangeLog: 2018-06-25 Pedro Alves <palves@redhat.com> * gdbthread.h (thread_info_ref, delete_thread) (delete_thread_silent, first_thread_of_inferior) (any_thread_of_inferior, switch_to_thread) (enable_thread_stack_temporaries) (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (get_last_thread_stack_temporary) (value_in_thread_stack_temporaries, can_access_registers_thread): Spell out "struct thread_info" instead of just "thread_info". * inferior.h (notice_new_inferior): Likewise.
2018-06-25gdb: Fix build on several hosts/portsPedro Alves9-13/+39
Commit 00431a78b28f ("Use thread_info and inferior pointers more throughout") missed updating some callers, like e.g.,: gdb/remote-sim.c: In member function 'virtual void gdbsim_target::mourn_inferior()': gdb/remote-sim.c:1198:50: error: cannot convert 'ptid_t' to 'thread_info*' for argument '1' to 'void delete_thread_silent(thread_info*)' delete_thread_silent (sim_data->remote_sim_ptid); gdb/mygit/src/gdb/procfs.c: In member function ‘virtual void procfs_target::detach(inferior*, int)’: gdb/mygit/src/gdb/procfs.c:1931:23: error: invalid conversion from ‘int’ to ‘inferior*’ [-fpermissive] detach_inferior (pid); ^ In file included from gdb/mygit/src/gdb/procfs.c:24:0: gdb/mygit/src/gdb/inferior.h:476:13: note: initializing argument 1 of ‘void detach_inferior(inferior*)’ etc. This fixes it. The delete_thread_silent calls in both go32-nat.c and remote-sim.c are unnecessary because generic_mourn_inferior calls exit_inferior, which deletes the inferior's threads. gdb/ChangeLog: 2018-06-25 Pedro Alves <palves@redhat.com> * windows-nat.c (windows_delete_thread): Use find_thread_ptid and pass thread_info pointer to delete_thread. (windows_nat_target::detach): Pass inferior pointer to detach_inferior. * aix-thread.c (sync_threadlists): Pass thread_info pointer to delete_thread. * bsd-kvm.c (bsd_kvm_target::close): Use discard_all_inferiors. * darwin-nat.c (darwin_check_new_threads): Use find_thread_ptid and pass a thread_info pointer to delete_thread. * fbsd-nat.c (fbsd_nat_target::wait): Use find_thread_ptid and pass thread_info pointer to delete_thread. * go32-nat.c (go32_nat_target::mourn_inferior): Remove delete_thread_silent call. * procfs.c (procfs_target::detach): Pass inferior pointer to detach_inferior. (procfs_target::wait): Pass thread_info pointer to delete_thread. * remote-sim.c (gdbsim_target::mourn_inferior): Remove delete_thread_silent call. * windows-nat.c (windows_delete_thread): Use find_thread_ptid and pass thread_info pointer to delete_thread. (windows_nat_target::detach): Pass inferior pointer to delete_inferior.
2018-06-25Add a syntax table to dwarf-mode.elTom Tromey2-1/+15
This adds a syntax table for dwarf-mode to dwarf-mode.el. I noticed the need for this when trying to use mark-sexp (C-M-SPC) on a hex number -- it copied the trailing ">" as well, which isn't desirable. I've also bumped the version number to make this simpler to install via the Emacs package system. Tested locally. I'm checking this in. binutils/ChangeLog 2018-06-25 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf-mode-syntax-table): New variable. Bump version number.
2018-06-25Fix compile time warning message for the AArch64 BFD backend, about a ↵Nick Clifton2-3/+12
possible attempt to call sprintf on a NULL buffer pointer. * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check for malloc returning NULL. (_bfd_aarch64_erratum_843419_fixup): Check for _bfd_aarch64_erratum_835769_stub_name returning NULL.
2018-06-25Automatic date update in version.inGDB Administrator1-1/+1
2018-06-24Add more updated to release notesNick Clifton1-41/+56
2018-06-24Regenerate configure and pot files with updated binutils version number.Nick Clifton22-6332/+10761
2018-06-24Update version number on development (aka HEAD) branch.Nick Clifton3-11/+16
2018-06-24Add 2.30 branch notes to ChangeLogs and NEWS files.Nick Clifton14-2/+47
2018-06-24Automatic date update in version.inGDB Administrator1-1/+1
2018-06-23Bump version number and summarize new features in 1.16.Cary Coutant3-1/+24
gold/ * version.cc (version_string): Bump to 1.16. * NEWS: Add new features in 1.16.
2018-06-23Fix "may be used uninitialized" warning.Cary Coutant2-1/+6
gold/ PR gold/22914 * x86_64.cc (Target_x86_64::record_gnu_property): Initialize val.
2018-06-23Add x86-64 support for Indirect Branch Tracking (IBT).Cary Coutant2-4/+497
gold/ PR gold/22915 * x86_64.cc (Output_data_plt_x86_64_ibt): New class. (Target_x86_64::do_make_data_plt): (All instantiations) Check for IBT feature bit and create IBT PLTs.
2018-06-22Update support for .note.gnu.property sections.Cary Coutant9-83/+320
The original patch did not give the target enough hooks to discover that an input object file does not have a particular property. For the GNU_PROPERTY_X86_FEATURE_1_AND property, for example, where a missing property should be assumed to be all zeroes, and ANDed with other object modules, this is essential. We now store the target-specific properties locally in the Target structure as native uint32_t fields, then AND the per-object feature bits with the program's feature bits when we're finished processing each input object file. The target-specific properties are then added back to the output note section during finalization. gold/ PR gold/22914 * layout.cc (read_sized_value): Fix spelling of section name. (Layout::layout_gnu_property): Call Sized_target::record_gnu_property for target-specific properties; don't store them with target-independent properties yet. (Layout::merge_gnu_properties): New method. (Layout::add_gnu_property): New method. (Layout::create_gnu_properties_note): Call target to finalize target-specific properties. Fix spelling of output section name. * layout.h (Layout::merge_gnu_properties): New method. (Layout::add_gnu_property): New method. * object.cc (Sized_relobj_file::do_layout): Call Layout::merge_gnu_properties. * target.h (Target::merge_gnu_property): Remove. (Target::finalize_gnu_properties): New method. (Target::do_merge_gnu_property): Move to Sized_target and rename. (Target::do_finalize_gnu_properties): New virtual method. (Sized_target::record_gnu_property): Moved and renamed from Target::do_merge_gnu_property. (Sized_target::merge_gnu_properties): New virtual method. * x86_64.cc (Target_x86_64::isa_1_used_, isa_1_needed_) (feature_1_, object_feature_1_, seen_first_object_): New data members. (Target_x86_64::do_merge_gnu_property): Rename to ... (Target_x86_64::record_gnu_property): ... this. Save target-specific properties in Target class object. (Target_x86_64::merge_gnu_properties): New method. (add_property): New static inline function. (Target_x86_64::do_finalize_gnu_properties): New method. * testsuite/Makefile.am (gnu_property_test): Remove C source file; link directly without compiler driver. * testsuite/Makefile.in: Regenerate. * testsuite/gnu_property_a.S: Add _start.
2018-06-22Silence GCC 9 error about deprecated implicit copy constructor.Cary Coutant3-0/+19
Replacing push_back() with emplace_back() eliminates the calls to the copy constructor, but I still had to provide explicit copy constructors because of the call to vector::reserve(), which tries to instantiate them even though they'll never actually be called when reserve() is called on an empty vector. gold/ * incremental.cc (Sized_incremental_binary::setup_readers): Use emplace_back for GCC 5 and later. * incremental.h (Incremental_binary::Input_reader): Provide copy constructor. (Sized_incremental_binary::Sized_input_reader): Likewise.
2018-06-23Automatic date update in version.inGDB Administrator1-1/+1
2018-06-22Fix "info registers" regexes in gdb.base/jit-reader.expSimon Marchi2-27/+32
Commit e813d34 ("Align natural-format register values to the same column") changed the output of "info registers" (tabs to spaces), but didn't update gdb.base/jit-reader.exp. Update the regexes to expect spaces instead. gdb/testsuite/ChangeLog: * gdb.base/jit-reader.exp (jit_reader_test): Expect spaces in "info registers" output.
2018-06-22Add support for .note.gnu.property sections.Cary Coutant17-38/+693
elfcpp/ PR gold/22914 * elfcpp.h (NT_GNU_PROPERTY_TYPE_0): New note type. (GNU_PROPERTY_*): New Gnu property types. * x86_64.h (GNU_PROPERTY_X86_FEATURE_1_IBT) (GNU_PROPERTY_X86_FEATURE_1_SHSTK): New x86 feature bits. gold/ PR gold/22914 * layout.cc (Layout::Layout): Initialize gnu_properties_. (read_sized_value, write_sized_value): New functions. (Layout::layout_gnu_property): New method. (Layout::create_notes): Call create_gnu_properties_note. (Layout::create_gnu_properties_note): New method. * layout.h (Layout::layout_gnu_property): New method. (Layout::create_gnu_properties_note): New method. (Layout::Gnu_property, Layout::Gnu_properties): New types. (Layout::gnu_properties_): New data member. * object.cc (Sized_relobj_file::layout_gnu_property_section): New method. (Sized_relobj_file::do_layout): Handle .note.gnu.property sections. * object.h (Sized_relobj_file::layout_gnu_property_section): New method. * target.h (Target::merge_gnu_property): New method. (Target::do_merge_gnu_property): New virtual method. * x86_64.cc (Target_x86_64::do_merge_gnu_property): New method. * testsuite/Makefile.am (gnu_property_test): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/gnu_property_a.S: New source file. * testsuite/gnu_property_b.S: New source file. * testsuite/gnu_property_c.S: New source file. * testsuite/gnu_property_main.c: New source file. * testsuite/gnu_property_test.sh: New test script.
2018-06-22Use partial register read/writes in transfer_regsetAlan Hayward3-25/+142
This avoids assert failures when the register is bigger than the slot size. This happens on Aarch64 when truncating Z registers into an fpsimd structure. This can be triggered by running gdb command "generate-core-file". Also, when the register is smaller then the slot size, then zero pad when writing to the slot, and truncate when writing to the regcache. This happens on Aarch64 with the CPSR register. Continue to ensure registers are invalidated when both buffers are null. gdb/ * regcache.c (readable_regcache::read_part): Fix asserts. (reg_buffer::raw_collect_part): New function. (regcache::write_part): Fix asserts. (reg_buffer::raw_supply_part): New function. (regcache::transfer_regset_register): New helper function. (regcache::transfer_regset): Call new functions. (regcache_supply_regset): Use gdb_byte*. (regcache::supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache::collect_regset): Likewise. * regcache.h (reg_buffer::raw_collect_part): New declaration. (reg_buffer::raw_supply_part): Likewise. (regcache::transfer_regset_register): Likewise. (regcache::transfer_regset): Use gdb_byte*.
2018-06-22Correct negs aliasing on AArch64.Tamar Christina7-5/+191
This patch fixes a disassembly issue with the aliases to subs with a shifted register. The subs instruction with the zero register as destination is supposed to alias to cmp and when the first input register is the zero register the subs is supposed to be aliased to negs. This means that a subs with destination and first input registers the zero register is supposed to be a cmp. This is done by raising the priority of the cmp alias. opcodes/ * aarch64-tbl.h (aarch64_opcode_table): Fix alias flag for negs * aarch64-asm-2.c: Regenerate. * aarch64-dis-2.c: Likewise. gas/ * testsuite/gas/aarch64/addsub.s: Add negs to zero reg test. * testsuite/gas/aarch64/addsub.d: Likewise.
2018-06-22Fix up HAS_SVE_STATE macroAlan Hayward2-1/+5
Prevents build break on aarch64 Suse. 2018-06-22 Alan Hayward <alan.hayward@arm.com> gdb/ * nat/aarch64-sve-linux-ptrace.h (HAS_SVE_STATE): Use &.
2018-06-22Automatic date update in version.inGDB Administrator1-1/+1
2018-06-21MIPS/opcodes: Fix a typo in `-M ginv' option descriptionMaciej W. Rozycki2-1/+6
opcodes/ * mips-dis.c (print_mips_disassembler_options): Fix a typo in `-M ginv' option description.
2018-06-21Fix treatment of symbol versions with unused as-needed libraries.Cary Coutant11-35/+246
When we have a weak reference to a symbol defined in an as-needed library, and that library ends up not-needed, gold simply clears the version information in the symbol table, even if the symbol could have been resolved by a needed library later in the link order. This results in a loss of version information, which can cause the program to bind to the wrong version at run time. This patch lets a dynamic definition override an earlier one if the earlier one is from a not-needed library, so that we can retain the version information from the binding to the needed library. In order to do that, the tracking of needed/not-needed had to be moved up to symbol resolution time, instead of during Symbol_table::set_dynsym_indexes(). In cases where we still end up discarding version information, I've added a warning. For the original problem report and discussion, see: https://stackoverflow.com/questions/50751421/undefined-behavior-in-shared-lib-using-libpthread-but-not-having-it-in-elf-as-d gold/ * resolve.cc (Symbol_table::resolve): Rename tobinding to orig_tobinding. Call set_is_needed() for objects that resolve non-weak references. (Symbol_table::should_override): Allow a dynamic definition to override an earlier one in a not-needed library. * symtab.cc (Symbol_table::set_dynsym_indexes): Remove separate processing for as-needed symbols. Add warning when discarding version informatin. * testsuite/Makefile.am (weak_as_needed): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/weak_as_needed.sh: New test script. * testsuite/weak_as_needed_a.c: New source file. * testsuite/weak_as_needed_b.c: New source file. * testsuite/weak_as_needed_b.script: New version script. * testsuite/weak_as_needed_c.c: New source file. * testsuite/weak_as_needed_c.script: New version script.
2018-06-21MIPS/BFD: Correct formatting of compact EH backend methodsMaciej W. Rozycki2-2/+9
Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and `_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79 columns. bfd/ * elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding) (_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
2018-06-21MIPS/BFD: Keep EI_ABIVERSION setting togetherMaciej W. Rozycki2-2/+7
Shuffle code in `_bfd_mips_post_process_headers' so that the setting of the EI_ABIVERSION ELF file header field is complete before calling `_bfd_elf_post_process_headers'. This used to be the case, but was changed with commit 351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and FP64A ABI extensions") for no reason. bfd/ * elfxx-mips.c (_bfd_mips_post_process_headers): Keep EI_ABIVERSION setting together.
2018-06-21MIPS/BFD: Use enumeration constants for EI_ABIVERSIONMaciej W. Rozycki2-2/+22
Define enumeration constants based on generated `libc-abis.h' from GNU libc, adding a MIPS_ prefix as these are port-specific. Use them to replace magic numbers stored in the EI_ABIVERSION field of the ELF file header. bfd/ * elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT) (MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64) (MIPS_LIBC_ABI_MAX): New enumeration constants. (_bfd_mips_post_process_headers): Use them in place of magic numbers.
2018-06-21RISC-V: Fix 3 PIE related ld testsuite failures.Jim Wilson2-4/+10
bfd/ * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment. Use SYMBOL_REFERENCES_LOCAL. Add asserts for h->got.offset.
2018-06-21Use thread_info and inferior pointers more throughoutPedro Alves71-993/+1198
This is more preparation bits for multi-target support. In a multi-target scenario, we need to address the case of different processes/threads running on different targets that happen to have the same PID/PTID. E.g., we can have both process 123 in target 1, and process 123 in target 2, while they're in reality different processes running on different machines. Or maybe we've loaded multiple instances of the same core file. Etc. To address this, in my WIP multi-target branch, threads and processes are uniquely identified by the (process_stratum target_ops *, ptid_t) and (process_stratum target_ops *, pid) tuples respectively. I.e., each process_stratum instance has its own thread/process number space. As you can imagine, that requires passing around target_ops * pointers in a number of functions where we're currently passing only a ptid_t or an int. E.g., when we look up a thread_info object by ptid_t in find_thread_ptid, the ptid_t alone isn't sufficient. In many cases though, we already have the thread_info or inferior pointer handy, but we "lose" it somewhere along the call stack, only to look it up again by ptid_t/pid. Since thread_info or inferior objects know their parent target, if we pass around thread_info or inferior pointers when possible, we avoid having to add extra target_ops parameters to many functions, and also, we eliminate a number of by ptid_t/int lookups. So that's what this patch does. In a bit more detail: - Changes a number of functions and methods to take a thread_info or inferior pointer instead of a ptid_t or int parameter. - Changes a number of structure fields from ptid_t/int to inferior or thread_info pointers. - Uses the inferior_thread() function whenever possible instead of inferior_ptid. - Uses thread_info pointers directly when possible instead of the is_running/is_stopped etc. routines that require a lookup. - A number of functions are eliminated along the way, such as: int valid_gdb_inferior_id (int num); int pid_to_gdb_inferior_id (int pid); int gdb_inferior_id_to_pid (int num); int in_inferior_list (int pid); - A few structures and places hold a thread_info pointer across inferior execution, so now they take a strong reference to the (refcounted) thread_info object to avoid the thread_info pointer getting stale. This is done in enable_thread_stack_temporaries and in the infcall.c code. - Related, there's a spot in infcall.c where using a RAII object to handle the refcount would be handy, so a gdb::ref_ptr specialization for thread_info is added (thread_info_ref, in gdbthread.h), along with a gdb_ref_ptr policy that works for all refcounted_object types (in common/refcounted-object.h). gdb/ChangeLog: 2018-06-21 Pedro Alves <palves@redhat.com> * ada-lang.h (ada_get_task_number): Take a thread_info pointer instead of a ptid_t. All callers adjusted. * ada-tasks.c (ada_get_task_number): Likewise. All callers adjusted. (print_ada_task_info, display_current_task_id, task_command_1): Adjust. * breakpoint.c (watchpoint_in_thread_scope): Adjust to use inferior_thread. (breakpoint_kind): Adjust. (remove_breakpoints_pid): Rename to ... (remove_breakpoints_inf): ... this. Adjust to take an inferior pointer. All callers adjusted. (bpstat_clear_actions): Use inferior_thread. (get_bpstat_thread): New. (bpstat_do_actions): Use it. (bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust to take a thread_info pointer. All callers adjusted. (set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint) (breakpoint_re_set_thread): Use inferior_thread. * breakpoint.h (struct inferior): Forward declare. (bpstat_stop_status): Update. (remove_breakpoints_pid): Delete. (remove_breakpoints_inf): New. * bsd-uthread.c (bsd_uthread_target::wait) (bsd_uthread_target::update_thread_list): Use find_thread_ptid. * btrace.c (btrace_add_pc, btrace_enable, btrace_fetch) (maint_btrace_packet_history_cmd) (maint_btrace_clear_packet_history_cmd): Adjust. (maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use inferior_thread. * cli/cli-interp.c: Include "inferior.h". * common/refcounted-object.h (struct refcounted_object_ref_policy): New. * compile/compile-object-load.c: Include gdbthread.h. (store_regs): Use inferior_thread. * corelow.c (core_target::close): Use current_inferior. (core_target_open): Adjust to use first_thread_of_inferior and use the current inferior. * ctf.c (ctf_target::close): Adjust to use current_inferior. * dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ... <thread>: ... this new field. All references adjusted. (dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor): Take a thread_info pointer instead of a ptid_t. * dummy-frame.h (dummy_frame_push, dummy_frame_pop) (dummy_frame_discard, register_dummy_frame_dtor): Take a thread_info pointer instead of a ptid_t. * elfread.c: Include "inferior.h". (elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop): Use inferior_thread. * eval.c (evaluate_subexp): Likewise. * frame.c (frame_pop, has_stack_frames, find_frame_sal): Use inferior_thread. * gdb_proc_service.h (struct thread_info): Forward declare. (struct ps_prochandle) <ptid>: Delete, replaced by ... <thread>: ... this new field. All references adjusted. * gdbarch.h, gdbarch.c: Regenerate. * gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a 'thread' parameter. All implementations and callers adjusted. * gdbthread.h (thread_info) <set_running>: New method. (delete_thread, delete_thread_silent): Take a thread_info pointer instead of a ptid. (global_thread_id_to_ptid, ptid_to_global_thread_id): Delete. (first_thread_of_process): Delete, replaced by ... (first_thread_of_inferior): ... this new function. All callers adjusted. (any_live_thread_of_process): Delete, replaced by ... (any_live_thread_of_inferior): ... this new function. All callers adjusted. (switch_to_thread, switch_to_no_thread): Declare. (is_executing): Delete. (enable_thread_stack_temporaries): Update comment. <enable_thread_stack_temporaries>: Take a thread_info pointer instead of a ptid_t. Incref the thread. <~enable_thread_stack_temporaries>: Decref the thread. <m_ptid>: Delete <m_thr>: New. (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (get_last_thread_stack_temporary) (value_in_thread_stack_temporaries, can_access_registers_thread): Take a thread_info pointer instead of a ptid_t. All callers adjusted. * infcall.c (get_call_return_value): Use inferior_thread. (run_inferior_call): Work with thread pointers instead of ptid_t. (call_function_by_hand_dummy): Work with thread pointers instead of ptid_t. Use thread_info_ref. * infcmd.c (proceed_thread_callback): Access thread's state directly. (ensure_valid_thread, ensure_not_running): Use inferior_thread, access thread's state directly. (continue_command): Use inferior_thread. (info_program_command): Use find_thread_ptid and access thread state directly. (proceed_after_attach_callback): Use thread state directly. (notice_new_inferior): Take a thread_info pointer instead of a ptid_t. All callers adjusted. (exit_inferior): Take an inferior pointer instead of a pid. All callers adjusted. (exit_inferior_silent): New. (detach_inferior): Delete. (valid_gdb_inferior_id, pid_to_gdb_inferior_id) (gdb_inferior_id_to_pid, in_inferior_list): Delete. (detach_inferior_command, kill_inferior_command): Use find_inferior_id instead of valid_gdb_inferior_id and gdb_inferior_id_to_pid. (inferior_command): Use inferior and thread pointers. * inferior.h (struct thread_info): Forward declare. (notice_new_inferior): Take a thread_info pointer instead of a ptid_t. All callers adjusted. (detach_inferior): Delete declaration. (exit_inferior, exit_inferior_silent): Take an inferior pointer instead of a pid. All callers adjusted. (gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list) (valid_gdb_inferior_id): Delete. * infrun.c (follow_fork_inferior, proceed_after_vfork_done) (handle_vfork_child_exec_or_exit, follow_exec): Adjust. (struct displaced_step_inferior_state) <pid>: Delete, replaced by ... <inf>: ... this new field. <step_ptid>: Delete, replaced by ... <step_thread>: ... this new field. (get_displaced_stepping_state): Take an inferior pointer instead of a pid. All callers adjusted. (displaced_step_in_progress_any_inferior): Adjust. (displaced_step_in_progress_thread): Take a thread pointer instead of a ptid_t. All callers adjusted. (displaced_step_in_progress, add_displaced_stepping_state): Take an inferior pointer instead of a pid. All callers adjusted. (get_displaced_step_closure_by_addr): Adjust. (remove_displaced_stepping_state): Take an inferior pointer instead of a pid. All callers adjusted. (displaced_step_prepare_throw, displaced_step_prepare) (displaced_step_fixup): Take a thread pointer instead of a ptid_t. All callers adjusted. (start_step_over): Adjust. (infrun_thread_ptid_changed): Remove bit updating ptids in the displaced step queue. (do_target_resume): Adjust. (fetch_inferior_event): Use inferior_thread. (context_switch, get_inferior_stop_soon): Take an execution_control_state pointer instead of a ptid_t. All callers adjusted. (switch_to_thread_cleanup): Delete. (stop_all_threads): Use scoped_restore_current_thread. * inline-frame.c: Include "gdbthread.h". (inline_state) <inline_state>: Take a thread pointer instead of a ptid_t. All callers adjusted. <ptid>: Delete, replaced by ... <thread>: ... this new field. (find_inline_frame_state): Take a thread pointer instead of a ptid_t. All callers adjusted. (skip_inline_frames, step_into_inline_frame) (inline_skipped_frames, inline_skipped_symbol): Take a thread pointer instead of a ptid_t. All callers adjusted. * inline-frame.h (skip_inline_frames, step_into_inline_frame) (inline_skipped_frames, inline_skipped_symbol): Likewise. * linux-fork.c (delete_checkpoint_command): Adjust to use thread pointers directly. * linux-nat.c (get_detach_signal): Likewise. * linux-thread-db.c (thread_from_lwp): New 'stopped' parameter. (thread_db_notice_clone): Adjust. (thread_db_find_new_threads_silently) (thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take a thread pointer instead of a ptid_t. All callers adjusted. * mi/mi-cmd-var.c: Include "inferior.h". (mi_cmd_var_update_iter): Update to use thread pointers. * mi/mi-interp.c (mi_new_thread): Update to use the thread's inferior directly. (mi_output_running_pid, mi_inferior_count): Delete, bits factored out to ... (mi_output_running): ... this new function. (mi_on_resume_1): Adjust to use it. (mi_user_selected_context_changed): Adjust to use inferior_thread. * mi/mi-main.c (proceed_thread): Adjust to use thread pointers directly. (interrupt_thread_callback): : Adjust to use thread and inferior pointers. * proc-service.c: Include "gdbthread.h". (ps_pglobal_lookup): Adjust to use the thread's inferior directly. * progspace-and-thread.c: Include "inferior.h". * progspace.c: Include "inferior.h". * python/py-exitedevent.c (create_exited_event_object): Adjust to hold a reference to an inferior_object. * python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use inferior_thread. * python/py-inferior.c (struct inferior_object): Give the type a tag name instead of a typedef. (python_on_normal_stop): No need to check if the current thread is listed. (inferior_to_inferior_object): Change return type to inferior_object. All callers adjusted. (find_thread_object): Delete, bits factored out to ... (thread_to_thread_object): ... this new function. * python/py-infthread.c (create_thread_object): Use inferior_to_inferior_object. (thpy_is_stopped): Use thread pointer directly. (gdbpy_selected_thread): Use inferior_thread. * python/py-record-btrace.c (btpy_list_object) <ptid>: Delete field, replaced with ... <thread>: ... this new field. All users adjusted. (btpy_insn_or_gap_new): Drop const. (btpy_list_new): Take a thread pointer instead of a ptid_t. All callers adjusted. * python/py-record.c: Include "gdbthread.h". (recpy_insn_new, recpy_func_new): Take a thread pointer instead of a ptid_t. All callers adjusted. (gdbpy_current_recording): Use inferior_thread. * python/py-record.h (recpy_record_object) <ptid>: Delete field, replaced with ... <thread>: ... this new field. All users adjusted. (recpy_element_object) <ptid>: Delete field, replaced with ... <thread>: ... this new field. All users adjusted. (recpy_insn_new, recpy_func_new): Take a thread pointer instead of a ptid_t. All callers adjusted. * python/py-threadevent.c: Include "gdbthread.h". (get_event_thread): Use thread_to_thread_object. * python/python-internal.h (struct inferior_object): Forward declare. (find_thread_object, find_inferior_object): Delete declarations. (thread_to_thread_object, inferior_to_inferior_object): New declarations. * record-btrace.c: Include "inferior.h". (require_btrace_thread): Use inferior_thread. (record_btrace_frame_sniffer) (record_btrace_tailcall_frame_sniffer): Use inferior_thread. (get_thread_current_frame): Use scoped_restore_current_thread and switch_to_thread. (get_thread_current_frame): Use thread pointer directly. (record_btrace_replay_at_breakpoint): Use thread's inferior pointer directly. * record-full.c: Include "inferior.h". * regcache.c: Include "gdbthread.h". (get_thread_arch_regcache): Use the inferior's address space directly. (get_thread_regcache, registers_changed_thread): New. * regcache.h (get_thread_regcache(thread_info *thread)): New overload. (registers_changed_thread): New. (remote_target) <remote_detach_1>: Swap order of parameters. (remote_add_thread): <remote_add_thread>: Return the new thread. (get_remote_thread_info(ptid_t)): New overload. (remote_target::remote_notice_new_inferior): Use thread pointers directly. (remote_target::process_initial_stop_replies): Use thread_info::set_running. (remote_target::remote_detach_1, remote_target::detach) (extended_remote_target::detach): Adjust. * stack.c (frame_show_address): Use inferior_thread. * target-debug.h (target_debug_print_thread_info_pp): New. * target-delegates.c: Regenerate. * target.c (default_thread_address_space): Delete. (memory_xfer_partial_1): Use current_inferior. (target_detach): Use current_inferior. (target_thread_address_space): Delete. (generic_mourn_inferior): Use current_inferior. * target.h (struct target_ops) <thread_address_space>: Delete. (target_thread_address_space): Delete. * thread.c (init_thread_list): Use ALL_THREADS_SAFE. Use thread pointers directly. (delete_thread_1, delete_thread, delete_thread_silent): Take a thread pointer instead of a ptid_t. Adjust all callers. (ptid_to_global_thread_id, global_thread_id_to_ptid): Delete. (first_thread_of_process): Delete, replaced by ... (first_thread_of_inferior): ... this new function. All callers adjusted. (any_thread_of_process): Rename to ... (any_thread_of_inferior): ... this, and take an inferior pointer. (any_live_thread_of_process): Rename to ... (any_live_thread_of_inferior): ... this, and take an inferior pointer. (thread_stack_temporaries_enabled_p, push_thread_stack_temporary) (value_in_thread_stack_temporaries) (get_last_thread_stack_temporary): Take a thread pointer instead of a ptid_t. Adjust all callers. (thread_info::set_running): New. (validate_registers_access): Use inferior_thread. (can_access_registers_ptid): Rename to ... (can_access_registers_thread): ... this, and take a thread pointer. (print_thread_info_1): Adjust to compare thread pointers instead of ptids. (switch_to_no_thread, switch_to_thread): Make extern. (scoped_restore_current_thread::~scoped_restore_current_thread): Use m_thread pointer directly. (scoped_restore_current_thread::scoped_restore_current_thread): Use inferior_thread. (thread_command): Use thread pointer directly. (thread_num_make_value_helper): Use inferior_thread. * top.c (execute_command): Use inferior_thread. * tui/tui-interp.c: Include "inferior.h". * varobj.c (varobj_create): Use inferior_thread. (value_of_root_1): Use find_thread_global_id instead of global_thread_id_to_ptid.
2018-06-21Avoid memcpys in regcache read_part/write_part for full registers.Alan Hayward3-50/+76
Additionally, tidy up the functions: Remove asserts, use gdb_byte, update comments. gdb/ * regcache.c (readable_regcache::read_part): Avoid memcpy when possible. (regcache::write_part): Likewise. (readable_regcache::cooked_read_part): Update comment. (readable_regcache::cooked_write_part): Likewise. * regcache.h: (readable_regcache::read_part): Likewise. (regcache::write_part): Likewise.
2018-06-21Regen doc/Makefile.inAlan Modra11-13/+32
Also make the automake strictness "foreign". My regeneration of the three doc/Makefile.in files already had --foreign in the automake invocation, so this just makes it explicit. bfd/ * doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign". * doc/Makefile.in: Regenerate. binutils/ * doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign". * doc/Makefile.in: Regenerate. gas/ * doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign". * doc/Makefile.in: Regenerate. zlib/ * Makefile.in: Regenerate.
2018-06-21Enable hardware watchpoints on attach for aarch64Richard Bunt5-0/+145
This commit fixes a bug whereby hardware watchpoints are not used on aarch64 when attaching to a target. The fix adds an aarch64 specialization of post_attach which records the number of available hardware debug registers using aarch64_linux_get_debug_reg_capacity. This implementation mirrors that of aarch64_linux_child_post_startup_inferior which successfully enables the use of hardware watchpoints when launching the target under the debugger. gdb/ChangeLog: * aarch64-linux-nat.c (post_attach): New. (aarch64_linux_nat_target::post_attach): Override post_attach to record the number of hardware debug registers. gdb/testsuite/ChangeLog: * gdb.base/watchpoint-hw-attach.c: New test. * gdb.base/watchpoint-hw-attach.exp: New file.
2018-06-21Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITSAlan Hayward2-1/+8
For sections that are not SHT_NOBITS, use sh_offset and p_offset instead of sh_addr and p_vaddr when calculating if a section fits in a segment. Both methods are valid when using the GNU linker. include/ * elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses for non SHT_NOBITS.
2018-06-20Fix a memory leak in py-param.cTom Tromey2-11/+14
Mark Wielaard pointed out this memory leak to me: ==17633== 775 bytes in 1 blocks are definitely lost in loss record 13,346 of 13,967 ==17633== at 0x4C2DB6B: malloc (vg_replace_malloc.c:299) ==17633== by 0x6652B7: xmalloc (common-utils.c:45) ==17633== by 0xC4C889: xstrdup (xstrdup.c:34) ==17633== by 0x5A71FD: unicode_to_encoded_string(_object*, char const*) (py-utils.c:81) ==17633== by 0x5A73EB: python_string_to_host_string(_object*) (py-utils.c:158) ==17633== by 0x59CC6C: get_doc_string(_object*, _object*) (py-param.c:334) ==17633== by 0x59D2AA: parmpy_init(_object*, _object*, _object*) (py-param.c:728) The bug here is that parmpy_init is written as though add_setshow_generic takes ownership of its doc-string arguments. However, it does not. This patch fixes the bug in a straightforward way and also applies some missing constification to make the problem more apparent. Tested on x86-64 Fedora 26. gdb/ChangeLog 2018-06-20 Tom Tromey <tom@tromey.com> * python/py-param.c (add_setshow_generic): Make parameters const. (parmpy_init): Update.
2018-06-21Automatic date update in version.inGDB Administrator1-1/+1
2018-06-20Rename regcache_cooked_read_ftype and make a function_viewSimon Marchi5-38/+47
regcache_cooked_read_ftype can be converted to a function_view, which allows us to use lambda functions and therefore avoid having to pass an opaque pointer parameter. Adjusting the fallouts showed that the "const regcache &" passed to the readonly_detached_regcache constructor is cast to non-const in do_cooked_read. I changed the constructor parameter to be non-const. Finally, I renamed the typedef from regcache_cooked_read_ftype to register_read_ftype, since there is nothing that forces us to use it only for regcaches nor cooked registers. gdb/ChangeLog: * regcache.h (regcache_cooked_read_ftype): Rename to... (register_read_ftype): ...this, change type to function_view. (class reg_buffer) <save>: Remove src parameter. (readonly_detached_regcache) <readonly_detached_regcache>: Make parameter non-const in first overload. Remove src parameter in second overload. * regcache.c (do_cooked_read): Remove. (readonly_detached_regcache::readonly_detached_regcache): Make parameter non-const, adjust call to other constructor. (reg_buffer::save): Remove src parameter. * frame.c (do_frame_register_read): Remove. (frame_save_as_regcache): Use lambda function. * ppc-linux-tdep.c (ppu2spu_unwind_register): Change type of src parameter to ppu2spu_data *. (ppu2spu_sniffer): Use lambda function.
2018-06-20testsuite: Fix cc-with-tweaks.sh being executed in the wrong shellSimon Marchi4-6/+13
The cc-with-tweaks.sh script needs to be executed with bash. When trying to run this: make check RUNTESTFLAGS="--target_board=dwarf4-gdb-index" TESTS="gdb.base/return.exp" I get: gdb compile failed, /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: 174: /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: Bad substitution The reason is that the board files execute cc-with-tweaks.sh using /bin/sh, which points to dash on my machine. Remove the /bin/sh part and let the shebang choose the right interpreter. gdb/testsuite/ChangeLog: * boards/cc-with-tweaks.exp: Don't call cc-with-tweaks.sh through /bin/sh. * boards/dwarf4-gdb-index.exp: Likewise. * boards/fission-dwp.exp: Likewise.
2018-06-20Remove struct keyword in range-based for-loopSimon Marchi2-1/+6
Fix this with gcc 6.3.0, and make the loop variable const while at it: /home/simark/src/binutils-gdb/gdb/record-full.c: In member function 'virtual int record_full_target::insert_breakpoint(gdbarch*, bp_target_info*)': /home/simark/src/binutils-gdb/gdb/record-full.c:1789:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct record_full_breakpoint &bp : record_full_breakpoints) gdb/ChangeLog: * record-full.c (record_full_target::insert_breakpoint): Remove "struct" keyword, add const.
2018-06-20Fix potential illegal memroy access when using a build-id note with a ↵Nick Clifton2-1/+8
negative size. PR 23316 * opncls.c (get_build_id): Check for a negative or excessive data size in the build-id note.
2018-06-20Improve gdb.base/float128.exp failure messageUlrich Weigand2-1/+20
If the "print large128" sub-test fails in a manner that typically indicates internal overflow due to GDB being built without MPFR support, explicitly state this in the failure message. gdb/testsuite/ChangeLog: 2018-06-20 Ulrich Weigand <uweigand@de.ibm.com> * gdb.base/float128.exp: Add comment and improved fail message to the failure case of "print large128" test.
2018-06-20[BFD][AARCH64]Properly truncate no overflow checking relocation value for ↵Renlin Li6-11/+29
load/store immediate. bfd/ChangeLog: 2018-06-20 Renlin Li <renlin.li@arm.com> * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use PG_OFFSET to resolve BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC. ld/ChangeLog: 2018-06-20 Renlin Li <renlin.li@arm.com> * testsuite/ld-aarch64/emit-relocs-115.d: Update test with new value. * testsuite/ld-aarch64/emit-relocs-534.d: Likewise. * testsuite/ld-aarch64/emit-relocs-555.d: Likewise.