1. 15 Jan, 2019 4 commits
    • Tom Tromey's avatar
      Remove cleanup from remote.c · 8d64371b
      Tom Tromey authored
      This removes the remaining cleanup from remote.c, by changing
      remote_state::buf to be a gdb::char_vector, and then fixing up all the
      fallout.  The resulting patch is somewhat ugly, but on the other hand,
      it eliminates some possibilities for mistakes.
      
      Regression tested using the
      Fedora-x86_64-native-extended-gdbserver-m64 builder on the buildbot.
      
      gdb/ChangeLog
      2019-01-15  Tom Tromey  <tom@tromey.com>
      
      	* remote.c (class remote_state) <buf>: Now a char_vector.
      	<buf_size>: Remove.
      	(remote_target::getpkt): Change type of buf.  Remove sizeof_buf
      	parameter.
      	(remote_target::getpkt_or_notif_sane_1)
      	(remote_target::getpkt_sane)
      	(remote_target::getpkt_or_notif_sane): Likewise.
      	(class remote_target) <putpkt>: New overload.
      	(remote_target::read_frame): Change type of "buf_p".  Remove
      	sizeof_p parameter.
      	(packet_ok): New overload.
      	(packet_check_result): New overload.
      	Update all uses.
      8d64371b
    • Tom Tromey's avatar
      Constify some remote-notif functions · bb277751
      Tom Tromey authored
      This constifies the "buf" arguments to various remote-notif functions
      and updates the users.
      
      gdb/ChangeLog
      2019-01-14  Tom Tromey  <tom@tromey.com>
      
      	* remote-notif.c (handle_notification, remote_notif_ack)
      	(remote_notif_parse): Make "buf" const.
      	* remote-notif.h (struct notif_client) <parse, ack>: Make "buf"
      	const.
      	(remote_notif_parse, remote_notif_ack, handle_notification):
      	Likewise.
      	* remote.c (remote_notif_stop_parse): Make "buf" const.
      	(remote_target::remote_parse_stop_reply): Make "buf" const.
      	(remote_notif_stop_ack): Make "buf" const.
      bb277751
    • Tom Tromey's avatar
      Constify remote_console_output · 05be00a8
      Tom Tromey authored
      This constifies the parameter to remote_console_output.
      
      gdb/ChangeLog
      2019-01-14  Tom Tromey  <tom@tromey.com>
      
      	* remote.c (remote_console_output): Make parameter const.
      05be00a8
    • Tom Tromey's avatar
      Constify target_pass_signals and target_program_signals · 491adeca
      Tom Tromey authored
      This constifies the final parameter to target_pass_signals and
      target_program_signals and updates the rest of gdb.
      
      Note that I have no way to test the nto-procfs.c change.
      
      gdb/ChangeLog
      2019-01-14  Tom Tromey  <tom@tromey.com>
      
      	* target-debug.h (target_debug_print_signals): Constify.
      	* nto-procfs.c (nto_procfs_target::pass_signals): Update.
      	* procfs.c (procfs_target::pass_signals): Update.
      	* linux-nat.c (linux_nat_target::pass_signals): Update.
      	* linux-nat.h (class linux_nat_target) <pass_signals>: Update.
      	* target-delegates.c: Rebuild.
      	* remote.c (remote_target::program_signals): Update.
      	(remote_target::pass_signals): Update.
      	* target.c (target_pass_signals): Constify argument.
      	(target_program_signals): Likewise.
      	* target.h (struct target_ops) <pass_signals, program_signals>:
      	Constify argument.
      	(target_pass_signals, target_program_signals): Constify argument.
      491adeca
  2. 03 Jan, 2019 1 commit
    • Andrew Burgess's avatar
      gdb/remote: Remove a cleanup in remote_check_symbols · 66644cd3
      Andrew Burgess authored
      Convert one of the variables that requires a cleanup from a 'char *'
      to a 'gdb::char_vector' in remote_target::remote_check_symbols.
      
      Tested on x86-64/Linux with target_board native-gdbserver and
      native-extended-gdbserver.
      
      gdb/ChangeLog:
      
      	* remote.c (remote_target::remote_check_symbols): Convert `msg` to
      	gdb::char_vector, remove cleanup, and update uses of `msg`.
      66644cd3
  3. 01 Jan, 2019 1 commit
    • Joel Brobecker's avatar
      Update copyright year range in all GDB files. · 42a4f53d
      Joel Brobecker authored
      This commit applies all changes made after running the gdb/copyright.py
      script.
      
      Note that one file was flagged by the script, due to an invalid
      copyright header
      (gdb/unittests/basic_string_view/element_access/char/empty.cc).
      As the file was copied from GCC's libstdc++-v3 testsuite, this commit
      leaves this file untouched for the time being; a patch to fix the header
      was sent to gcc-patches first.
      
      gdb/ChangeLog:
      
      	Update copyright year range in all GDB files.
      42a4f53d
  4. 30 Nov, 2018 2 commits
    • Pedro Alves's avatar
      Convert default_child_has_foo functions to process_stratum_target methods · f3d11a9a
      Pedro Alves authored
      This patch converts the default_child_has_foo functions to
      process_stratum_target methods.  This simplifies "regular"
      non-inf_child process_stratum targets, since they no longer have to
      override the target_ops::has_foo methods to call the default_child_foo
      functions.  A couple targets need to override the new defaults
      (corelow and tracefiles), but it still seems like a good tradeoff,
      since those are expected to be little different (target doesn't run).
      
      gdb/ChangeLog:
      2018-11-30  Pedro Alves  <palves@redhat.com>
      
      	* corelow.c (core_target) <has_all_memory, has_execution>: New
      	overrides.
      	* inf-child.c (inf_child_target::has_all_memory)
      	(inf_child_target::has_memory, inf_child_target::has_stack)
      	(inf_child_target::has_registers)
      	(inf_child_target::has_execution): Delete.
      	* inf-child.h (inf_child_target) <has_all_memory, has_memory,
      	has_stack, has_registers, has_execution>: Delete.
      	* process-stratum-target.c
      	(process_stratum_target::has_all_memory)
      	(process_stratum_target::has_memory)
      	(process_stratum_target::has_stack)
      	(process_stratum_target::has_registers)
      	(process_stratum_target::has_execution): New.
      	* process-stratum-target.h (process_stratum_target)
      	<has_all_memory, has_memory, has_stack, has_registers,
      	has_execution>: New method overrides.
      	* ravenscar-thread.c (ravenscar_thread_target) <has_all_memory,
      	has_memory, has_stack, has_registers, has_execution>: Delete.
      	* remote-sim.c (gdbsim_target) <has_stack, has_registers,
      	has_execution>: Delete.
      	* remote.c (remote_target) <has_all_memory, has_memory, has_stack,
      	has_registers, has_execution>: Delete.
      	* target.c (default_child_has_all_memory)
      	(default_child_has_memory, default_child_has_stack)
      	(default_child_has_registers, default_child_has_execution):
      	Delete.
      	* target.h (default_child_has_all_memory)
      	(default_child_has_memory, default_child_has_stack)
      	(default_child_has_registers, default_child_has_execution):
      	Delete.
      	* tracefile.h (tracefile_target) <has_execution>: New override.
      f3d11a9a
    • Pedro Alves's avatar
      Introduce process_stratum_target · 3b3dac9b
      Pedro Alves authored
      This adds a base class that all process_stratum targets inherit from.
      
      default_thread_address_space/default_thread_architecture only make
      sense for process_stratum targets, so they are transformed to
      process_stratum_target methods/overrides.
      
      gdb/ChangeLog:
      2018-11-30  Pedro Alves  <palves@redhat.com>
      
      	* Makefile.in (COMMON_SFILES): Add process-stratum-target.c.
      	* bsd-kvm.c: Include "process-stratum-target.h".
      	(bsd_kvm_target): Now inherits from process_stratum_target.
      	(bsd_kvm_target::bsd_kvm_target): Default it.
      	* corelow.c: Include "process-stratum-target.h".
      	(core_target): Now inherits from process_stratum_target.
      	(core_target::core_target): Don't set to_stratum here.
      	* inf-child.c (inf_child_target::inf_child_target): Delete.
      	* inf-child.h: Include "process-stratum-target.h".
      	(inf_child_target): Inherit from process_stratum_target.
      	(inf_child_target) <inf_child_target>: Default it.
      	<can_async_p, supports_non_stop, supports_disable_randomization>:
      	Delete overrides.
      	* process-stratum-target.c: New file.
      	* process-stratum-target.h: New file.
      	* remote-sim.c: Include "process-stratum-target.h".
      	(gdbsim_target): Inherit from process_stratum_target.
      	<gdbsim_target>: Default it.
      	* remote.c: Include "process-stratum-target.h".
      	(remote_target): Inherit from process_stratum_target.
      	<remote_target>: Default it.
      	* target.c (default_thread_address_space)
      	(default_thread_architecture): Delete.
      	* target.h (target_ops) <thread_architecture>: Now returns NULL by
      	default.
      	<thread_address_space>: Ditto.
      	* test-target.h: Include "process-stratum-target.h" instead of
      	"target.h".
      	(test_target_ops): Inherit from process_stratum_target.
      	<test_target_ops>: Default it.
      	* tracefile.c (tracefile_target::tracefile_target): Delete.
      	* tracefile.h: Include "process-stratum-target.h".
      	(tracefile_target): Inherit from process_stratum_target.
      	<tracefile_target>: Default it.
      	* target-delegates.c: Regenerate.
      3b3dac9b
  5. 22 Nov, 2018 1 commit
    • Pedro Alves's avatar
      Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc. · 08036331
      Pedro Alves authored
      As preparation for multi-target, this patch makes each inferior have
      its own thread list.
      
      This isn't absolutely necessary for multi-target, but simplifies
      things.  It originally stemmed from the desire to eliminate the
      init_thread_list calls sprinkled around, plus it makes it more
      efficient to iterate over threads of a given inferior (no need to
      always iterate over threads of all inferiors).
      
      We still need to iterate over threads of all inferiors in a number of
      places, which means we'd need adjust the ALL_THREADS /
      ALL_NON_EXITED_THREADS macros.  However, naively tweaking those macros
      to have an extra for loop, like:
      
           #define ALL_THREADS (thr, inf) \
             for (inf = inferior_list; inf; inf = inf->next) \
      	 for (thr = inf->thread_list; thr; thr = thr->next)
      
      causes problems with code that does "break" or "continue" within the
      ALL_THREADS loop body.  Plus, we need to declare the extra "inf" local
      variable in order to pass it as temporary variable to ALL_THREADS
      (etc.)
      
      It gets even trickier when we consider extending the macros to filter
      out threads matching a ptid_t and a target.  The macros become tricker
      to read/write.  Been there.
      
      An alternative (which was my next attempt), is to replace the
      ALL_THREADS etc. iteration style with for_each_all_threads,
      for_each_non_exited_threads, etc. functions which would take a
      callback as parameter, which would usually be passed a lambda.
      However, I did not find that satisfactory at all, because the
      resulting code ends up a little less natural / more noisy to read,
      write and debug/step-through (due to use of lambdas), and in many
      places where we use "continue;" to skip to the next thread now need to
      use "return;".  (I ran into hard to debug bugs caused by a
      continue/return confusion.)
      
      I.e., before:
      
          ALL_NON_EXITED_THREADS (tp)
            {
      	if (tp->not_what_I_want)
      	  continue;
      	// do something
            }
      
      would turn into:
      
          for_each_non_exited_thread ([&] (thread_info *tp)
            {
      	if (tp->not_what_I_want)
      	  return;
      	// do something
            });
      
      Lastly, the solution I settled with was to replace the ALL_THREADS /
      ALL_NON_EXITED_THREADS / ALL_INFERIORS macros with (C++20-like) ranges
      and iterators, such that you can instead naturaly iterate over
      threads/inferiors using range-for, like e.g,.:
      
         // all threads, including THREAD_EXITED threads.
         for (thread_info *tp : all_threads ())
           { .... }
      
         // all non-exited threads.
         for (thread_info *tp : all_non_exited_threads ())
           { .... }
      
         // all non-exited threads of INF inferior.
         for (thread_info *tp : inf->non_exited_threads ())
           { .... }
      
      The all_non_exited_threads() function takes an optional filter ptid_t as
      parameter, which is quite convenient when we need to iterate over
      threads matching that filter.  See e.g., how the
      set_executing/set_stop_requested/finish_thread_state etc. functions in
      thread.c end up being simplified.
      
      Most of the patch thus is about adding the infrustructure for allowing
      the above.  Later on when we get to actual multi-target, these
      functions/ranges/iterators will gain a "target_ops *" parameter so
      that e.g., we can iterate over all threads of a given target that
      match a given filter ptid_t.
      
      The only entry points users needs to be aware of are the
      all_threads/all_non_exited_threads etc. functions seen above.  Thus,
      those functions are declared in gdbthread.h/inferior.h.  The actual
      iterators/ranges are mainly "internals" and thus are put out of view
      in the new thread-iter.h/thread-iter.c/inferior-iter.h files.  That
      keeps the gdbthread.h/inferior.h headers quite a bit more readable.
      
      A common/safe-iterator.h header is added which adds a template that
      can be used to build "safe" iterators, which are forward iterators
      that can be used to replace the ALL_THREADS_SAFE macro and other
      instances of the same idiom in future.
      
      There's a little bit of shuffling of code between
      gdbthread.h/thread.c/inferior.h in the patch.  That is necessary in
      order to avoid circular dependencies between the
      gdbthread.h/inferior.h headers.
      
      As for the init_thread_list calls sprinkled around, they're all
      eliminated by this patch, and a new, central call is added to
      inferior_appeared.  Note how also related to that, there's a call to
      init_wait_for_inferior in remote.c that is eliminated.
      init_wait_for_inferior is currently responsible for discarding skipped
      inline frames, which had to be moved elsewhere.  Given that nowadays
      we always have a thread even for single-threaded processes, the
      natural place is to delete a frame's inline frame info when we delete
      the thread.  I.e., from clear_thread_inferior_resources.
      
      gdb/ChangeLog:
      2018-11-22  Pedro Alves  <palves@redhat.com>
      
      	* Makefile.in (COMMON_SFILES): Add thread-iter.c.
      	* breakpoint.c (breakpoints_should_be_inserted_now): Replace
      	ALL_NON_EXITED_THREADS with all_non_exited_threads.
      	(print_one_breakpoint_location): Replace ALL_INFERIORS with
      	all_inferiors.
      	* bsd-kvm.c: Include inferior.h.
      	* btrace.c (btrace_free_objfile): Replace ALL_NON_EXITED_THREADS
      	with all_non_exited_threads.
      	* common/filtered-iterator.h: New.
      	* common/safe-iterator.h: New.
      	* corelow.c (core_target_open): Don't call init_thread_list here.
      	* darwin-nat.c (thread_info_from_private_thread_info): Replace
      	ALL_THREADS with all_threads.
      	* fbsd-nat.c (fbsd_nat_target::resume): Replace
      	ALL_NON_EXITED_THREADS with inf->non_exited_threads.
      	* fbsd-tdep.c (fbsd_make_corefile_notes): Replace
      	ALL_NON_EXITED_THREADS with inf->non_exited_threads.
      	* fork-child.c (postfork_hook): Don't call init_thread_list here.
      	* gdbarch-selftests.c (register_to_value_test): Adjust.
      	* gdbthread.h: Don't include "inferior.h" here.
      	(struct inferior): Forward declare.
      	(enum step_over_calls_kind): Moved here from inferior.h.
      	(thread_info::deletable): Definition moved to thread.c.
      	(find_thread_ptid (inferior *, ptid_t)): Declare.
      	(ALL_THREADS, ALL_THREADS_BY_INFERIOR, ALL_THREADS_SAFE): Delete.
      	Include "thread-iter.h".
      	(all_threads, all_non_exited_threads, all_threads_safe): New.
      	(any_thread_p): Declare.
      	(thread_list): Delete.
      	* infcmd.c (signal_command): Replace ALL_NON_EXITED_THREADS with
      	all_non_exited_threads.
      	(proceed_after_attach_callback): Delete.
      	(proceed_after_attach): Take an inferior pointer instead of an
      	integer PID.  Adjust to use range-for.
      	(attach_post_wait): Pass down inferior pointer instead of pid.
      	Use range-for instead of ALL_NON_EXITED_THREADS.
      	(detach_command): Remove init_thread_list call.
      	* inferior-iter.h: New.
      	* inferior.c (struct delete_thread_of_inferior_arg): Delete.
      	(delete_thread_of_inferior): Delete.
      	(delete_inferior, exit_inferior_1): Use range-for with
      	inf->threads_safe() instead of iterate_over_threads.
      	(inferior_appeared): Call init_thread_list here.
      	(discard_all_inferiors): Use all_non_exited_inferiors.
      	(find_inferior_id, find_inferior_pid): Use all_inferiors.
      	(iterate_over_inferiors): Use all_inferiors_safe.
      	(have_inferiors, number_of_live_inferiors): Use
      	all_non_exited_inferiors.
      	(number_of_inferiors): Use all_inferiors and std::distance.
      	(print_inferior): Use all_inferiors.
      	* inferior.h: Include gdbthread.h.
      	(enum step_over_calls_kind): Moved to gdbthread.h.
      	(struct inferior) <thread_list>: New field.
      	<threads, non_exited_threads, threads_safe>: New methods.
      	(ALL_INFERIORS): Delete.
      	Include "inferior-iter.h".
      	(ALL_NON_EXITED_INFERIORS): Delete.
      	(all_inferiors_safe, all_inferiors, all_non_exited_inferiors): New
      	functions.
      	* inflow.c (child_interrupt, child_pass_ctrlc): Replace
      	ALL_NON_EXITED_THREADS with all_non_exited_threads.
      	* infrun.c (follow_exec): Use all_threads_safe.
      	(clear_proceed_status, proceed): Use all_non_exited_threads.
      	(init_wait_for_inferior): Don't clear inline frame state here.
      	(infrun_thread_stop_requested, for_each_just_stopped_thread): Use
      	all_threads instead of ALL_NON_EXITED_THREADS.
      	(random_pending_event_thread): Use all_non_exited_threads instead
      	of ALL_NON_EXITED_THREADS.  Use a lambda for repeated code.
      	(clean_up_just_stopped_threads_fsms): Use all_non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	(handle_no_resumed): Use all_non_exited_threads instead of
      	ALL_NON_EXITED_THREADS.  Use all_inferiors instead of
      	ALL_INFERIORS.
      	(restart_threads, switch_back_to_stepped_thread): Use
      	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	* linux-nat.c (check_zombie_leaders): Replace ALL_INFERIORS with
      	all_inferiors.
      	(kill_unfollowed_fork_children): Use inf->non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	* linux-tdep.c (linux_make_corefile_notes): Use
      	inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	* linux-thread-db.c (thread_db_target::update_thread_list):
      	Replace ALL_INFERIORS with all_inferiors.
      	(thread_db_target::thread_handle_to_thread_info): Use
      	inf->non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	* mi/mi-interp.c (multiple_inferiors_p): New.
      	(mi_on_resume_1): Simplify using all_non_exited_threads and
      	multiple_inferiors_p.
      	* mi/mi-main.c (mi_cmd_thread_list_ids): Use all_non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	* nto-procfs.c (nto_procfs_target::open): Don't call
      	init_thread_list here.
      	* record-btrace.c (record_btrace_target_open)
      	(record_btrace_target::stop_recording)
      	(record_btrace_target::close)
      	(record_btrace_target::record_is_replaying)
      	(record_btrace_target::resume, record_btrace_target::wait)
      	(record_btrace_target::record_stop_replaying): Use
      	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	* record-full.c (record_full_wait_1): Use all_non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	* regcache.c (cooked_read_test): Remove reference to global
      	thread_list.
      	* remote-sim.c (gdbsim_target::create_inferior): Don't call
      	init_thread_list here.
      	* remote.c (remote_target::update_thread_list): Use
      	all_threads_safe instead of ALL_NON_EXITED_THREADS.
      	(remote_target::process_initial_stop_replies): Replace
      	ALL_INFERIORS with all_non_exited_inferiors and use
      	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	(remote_target::open_1): Don't call init_thread_list here.
      	(remote_target::append_pending_thread_resumptions)
      	(remote_target::remote_resume_with_hc): Use all_non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	(remote_target::commit_resume)
      	(remote_target::remove_new_fork_children): Replace ALL_INFERIORS
      	with all_non_exited_inferiors and use all_non_exited_threads
      	instead of ALL_NON_EXITED_THREADS.
      	(remote_target::kill_new_fork_children): Use
      	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.  Remove
      	init_thread_list and init_wait_for_inferior calls.
      	(remote_target::remote_btrace_maybe_reopen)
      	(remote_target::thread_handle_to_thread_info): Use
      	all_non_exited_threads instead of ALL_NON_EXITED_THREADS.
      	* target.c (target_terminal::restore_inferior)
      	(target_terminal_is_ours_kind): Replace ALL_INFERIORS with
      	all_non_exited_inferiors.
      	* thread-iter.c: New file.
      	* thread-iter.h: New file.
      	* thread.c: Include "inline-frame.h".
      	(thread_list): Delete.
      	(clear_thread_inferior_resources): Call clear_inline_frame_state.
      	(init_thread_list): Use all_threads_safe instead of
      	ALL_THREADS_SAFE.  Adjust to per-inferior thread lists.
      	(new_thread): Adjust to per-inferior thread lists.
      	(add_thread_silent): Pass inferior to find_thread_ptid.
      	(thread_info::deletable): New, moved from the header.
      	(delete_thread_1): Adjust to per-inferior thread lists.
      	(find_thread_global_id): Use inf->threads().
      	(find_thread_ptid): Use find_inferior_ptid and pass inferior to
      	find_thread_ptid.
      	(find_thread_ptid(inferior*, ptid_t)): New overload.
      	(iterate_over_threads): Use all_threads_safe.
      	(any_thread_p): New.
      	(thread_count): Use all_threads and std::distance.
      	(live_threads_count): Use all_non_exited_threads and
      	std::distance.
      	(valid_global_thread_id): Use all_threads.
      	(in_thread_list): Use find_thread_ptid.
      	(first_thread_of_inferior): Adjust to per-inferior thread lists.
      	(any_thread_of_inferior, any_live_thread_of_inferior): Use
      	inf->non_exited_threads().
      	(prune_threads, delete_exited_threads): Use all_threads_safe.
      	(thread_change_ptid): Pass inferior pointer to find_thread_ptid.
      	(set_resumed, set_running): Use all_non_exited_threads.
      	(is_thread_state, is_stopped, is_exited, is_running)
      	(is_executing): Delete.
      	(set_executing, set_stop_requested, finish_thread_state): Use
      	all_non_exited_threads.
      	(print_thread_info_1): Use all_inferiors and all_threads.
      	(thread_apply_all_command): Use all_non_exited_threads.
      	(thread_find_command): Use all_threads.
      	(update_threads_executing): Use all_non_exited_threads.
      	* tid-parse.c (parse_thread_id): Use inf->threads.
      	* x86-bsd-nat.c (x86bsd_dr_set): Use inf->non_exited_threads ().
      08036331
  6. 09 Nov, 2018 1 commit
    • Tom Tromey's avatar
      Remove a VEC from remote.c · eefce37f
      Tom Tromey authored
      This removes the VEC from remote_g_packet_data, replacing it with a
      std::vector.  This is a bit odd in that this object is never
      destroyed, and is obstack-allocated.  I believe a gdbarch is never
      destroyed, so this seemed ok.
      
      Tested by the buildbot.
      
      gdb/ChangeLog
      2018-11-09  Tom Tromey  <tom@tromey.com>
      
      	* remote.c (remote_g_packet_guess_s): Remove typedef and DEF_VEC.
      	(struct remote_g_packet_data): Derive from allocate_on_obstack.
      	<guesses>: Now a std::vector.
      	(remote_g_packet_data_init, register_remote_g_packet_guess):
      	Update.
      	(remote_read_description_p): Update.  Return bool.
      	(remote_target::read_description): Update.
      	(struct remote_g_packet_guess): Add constructor.
      eefce37f
  7. 10 Oct, 2018 1 commit
    • Gary Benson's avatar
      Add missing va_end found by Coverity · 33b031ce
      Gary Benson authored
      This commit adds a missing va_end found by Coverity.
      
      gdb/ChangeLog:
      
      	* remote.c (remote_target::remote_send_printf): Add
      	missing va_end found by Coverity.
      33b031ce
  8. 05 Oct, 2018 1 commit
    • Tom Tromey's avatar
      Simple -Wshadow=local fixes · b926417a
      Tom Tromey authored
      This fixes all the straightforward -Wshadow=local warnings in gdb.  A
      few standard approaches are used here:
      
      * Renaming an inner (or outer, but more commonly inner) variable;
      * Lowering a declaration to avoid a clash;
      * Moving a declaration into a more inner scope to avoid a clash,
        including the special case of moving a declaration into a loop header.
      
      I did not consider any of the changes in this patch to be particularly
      noteworthy, though of course they should all still be examined.
      
      gdb/ChangeLog
      2018-10-04  Tom Tromey  <tom@tromey.com>
      
      	* ctf.c (SET_ARRAY_FIELD): Rename "u32".
      	* p-valprint.c (pascal_val_print): Split inner "i" variable.
      	* xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop
      	header.
      	* xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in
      	more inner scope.
      	* xcoffread.c (read_xcoff_symtab): Rename inner "symbol".
      	* varobj.c (varobj_update): Rename inner "newobj",
      	"type_changed".
      	* valprint.c (generic_emit_char): Rename inner "buf".
      	* valops.c (find_overload_match): Rename inner "temp".
      	(value_struct_elt_for_reference): Declare "v" in more inner
      	scope.
      	* v850-tdep.c (v850_push_dummy_call): Rename "len".
      	* unittests/array-view-selftests.c (run_tests): Rename inner
      	"vec".
      	* tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop
      	header.
      	* tracepoint.c (merge_uploaded_trace_state_variables): Declare
      	"tsv" in more inner scope.
      	(print_one_static_tracepoint_marker): Rename inner
      	"tuple_emitter".
      	* tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower.
      	(tic6x_push_dummy_call): Don't redeclare "addr".
      	* target-float.c: Declare "dto" lower.
      	* symtab.c (lookup_local_symbol): Rename inner "sym".
      	(find_pc_sect_line): Rename inner "pc".
      	* stack.c (print_frame): Don't redeclare "gdbarch".
      	(return_command): Rename inner "gdbarch".
      	* s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner
      	"sp".
      	* rust-lang.c (rust_internal_print_type): Declare "i" in loop
      	header.
      	* rs6000-tdep.c (ppc_process_record): Rename inner "addr".
      	* riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner
      	scope.
      	* remote.c (remote_target::update_thread_list): Don't redeclare
      	"tp".
      	(remote_target::process_initial_stop_replies): Rename inner
      	"thread".
      	(remote_target::remote_parse_stop_reply): Don't redeclare "p".
      	(remote_target::wait_as): Don't redeclare "stop_reply".
      	(remote_target::get_thread_local_address): Rename inner
      	"result".
      	(remote_target::get_tib_address): Likewise.
      b926417a
  9. 16 Sep, 2018 1 commit
    • Tom Tromey's avatar
      Use GNU style for metasyntactic variables in gdb · 65e65158
      Tom Tromey authored
      I searched for other spots that did not use the GNU style for
      metasyntactic syntactic variables.  This patch fixes most of the ones
      I found in gdb proper.  There are a few remaining in MI, but I was
      unsure whether those should be touched.
      
      gdb/ChangeLog
      2018-09-16  Tom Tromey  <tom@tromey.com>
      
      	* top.c (new_ui_command): Use GNU style for metasyntactic
      	variables.
      	* breakpoint.c (stopat_command): Use GNU style for metasyntactic
      	variables.
      	* maint.c (maintenance_translate_address): Remove "<>" around
      	text.
      	* interps.c (interpreter_exec_cmd): Use GNU style for
      	metasyntactic variables.
      	* nto-procfs.c (nto_procfs_target_info): Use GNU style for
      	metasyntactic variables.
      	* tracepoint.c (tfind_range_command): Use GNU style for
      	metasyntactic variables.
      	(tfind_outside_command): Likewise.
      	(_initialize_tracepoint): Likewise.
      	* remote.c (extended_remote_target::create_inferior): Use GNU
      	style for metasyntactic variables.
      	* sparc64-tdep.c (adi_examine_command): Use GNU style for
      	metasyntactic variables.
      	(adi_assign_command): Likewise.
      
      gdb/testsuite/ChangeLog
      2018-09-16  Tom Tromey  <tom@tromey.com>
      
      	* gdb.base/new-ui.exp (do_execution_tests): Update.
      	* gdb.base/dbx.exp (test_breakpoints): Update.
      65e65158
  10. 08 Aug, 2018 1 commit
    • Szabolcs Nagy's avatar
      Fix gdb/remote.c build failure · ff36536c
      Szabolcs Nagy authored
      Add const qualifier to fix
      
      /S/gdb/common/gdb_locale.h:35:27: error: deprecated conversion from string constant to 'char*' [-Werror=write-strings]
       # define _(String) (String)
                                 ^
      /S/gdb/remote.c:12844:19: note: in expansion of macro '_'
         char *err_msg = _("Tracepoint packet too large for target.");
                         ^
      gdb/ChangeLog:
      
      	* remote.c (remote_target::download_tracepoint): Change char* to
      	const char*.
      ff36536c
  11. 06 Aug, 2018 4 commits
    • Simon Marchi's avatar
      Fix compilation failure in remote.c · a7f25a84
      Simon Marchi authored
      A recent patch introduced a few of these:
      
      /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
           error (err_msg);
                         ^
      
      Fix them by replacing the call to error with
      
        error ("%s", err_msg);
      
      gdb/ChangeLog:
      
      	* remote.c (remote_target::download_tracepoint): Fix format
      	string errors.
      a7f25a84
    • Pedro Franco de Carvalho's avatar
      Use get_remote_packet_size in download_tracepoint · 3df3a985
      Pedro Franco de Carvalho authored
      This patch changes the remote target to use the remote packet size to
      build QTDP packets, and to check if there is enough room for the
      packet.
      
      I changed the function to raise an error if the packet is too small,
      instead of aborting gdb (through xsnprintf).  It isn't clear if gdb
      will be in a consistent state with respect to the stub after this,
      since it's possible that some packets will be sent but not others, and
      there could be an incomplete tracepoint on the stub.
      
      The char array used to build the packets is changed to a
      gdb::char_vector and sized with the result from
      get_remote_packet_size.
      
      When checking if the buffer is large enough to hold the tracepoint
      condition agent expression, the length of the expression is multiplied
      by two, since it is encoded with two hex digits per expression
      byte.  For simplicity, I assume that the result won't overflow, which
      can happen for very long condition expressions.
      
      gdb/ChangeLog:
      2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
      
      	* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
      	Replace array buf with gdb::char_vector buf, of size
      	get_remote_packet_size ().  Replace references to buf and
      	BUF_SIZE to buf.data () and buf.size ().  Replace strcpy, strcat
      	and xsnprintf with snprintf.  Raise errors if the buffer is too
      	small.
      3df3a985
    • Pedro Franco de Carvalho's avatar
      Remove trailing '-' from the last QTDP action packet · aa6f3694
      Pedro Franco de Carvalho authored
      The has_more predicate in remote_target::download_tracepoint always
      evaluates to true, so the last action packet will be sent with a
      trailing '-'.  This patch changes the predicate to remove the last
      trailing '-'.
      
      gdb/ChangeLog:
      2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
      
      	* remote.c (remote_target::download_tracepoint): Fix the has_more
      	predicate in the QTDP action list iteration.
      aa6f3694
    • Pedro Franco de Carvalho's avatar
      Fix indentation in remote_target::download_tracepoint · 05abfc39
      Pedro Franco de Carvalho authored
      gdb/ChangeLog:
      2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
      
      	* remote.c (remote_target::download_tracepoint): Fix indentation
      	in for block.
      05abfc39
  12. 22 Jul, 2018 1 commit
    • Tom Tromey's avatar
      Unused variable fixes related to conditional compilation · 15766370
      Tom Tromey authored
      This patch fixes various unused variable warnings that are related to
      conditional compilation.  In these cases, either the variable is now
      protected by the same #if as its uses, or the declaration is simply
      lowered into the conditionally-compiled block.
      
      gdb/ChangeLog
      2018-07-22  Tom Tromey  <tom@tromey.com>
      
      	* windows-nat.c (saved_context): Conditionally define.
      	* remote.c (remote_target::remote_btrace_maybe_reopen):
      	Conditionally declare "warned".
      	* inflow.c (sigquit_ours): Conditionally define.
      	(new_tty): Move "tty" declaration inside #if.
      	* guile/guile.c (guile_datadir): Conditionally define.
      	* charset.c (set_be_le_names): Move some declarations inside #if.
      	* btrace.c (parse_xml_btrace): Move "errcode" declaration inside
      	#if.
      	(parse_xml_btrace_conf): Likewise.
      15766370
  13. 11 Jul, 2018 1 commit
    • Pedro Alves's avatar
      GDB: Work around D;PID handling bug in older GDBservers (PR gdb/23377) · 4c7333b3
      Pedro Alves authored
      This commit adds a GDB workaround for the GDBserver bug exposed by
      commit f2ffa92b ("gdb: Eliminate the 'stop_pc' global"), so that
      newer GDBs can continue working with older GDBservers.
      
      gdb/ChangeLog:
      2018-07-11  Pedro Alves  <palves@redhat.com>
      
      	PR gdb/23377
      	* remote.c (remote_target::remote_detach_pid): Call
      	set_current_process.
      4c7333b3
  14. 09 Jul, 2018 1 commit
    • Andrew Burgess's avatar
      gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c · 055303e2
      Andrew Burgess authored
      Switch to use add_setshow_zuinteger_unlimited_cmd for some of the
      control variables in remote.c.  The variables
      hardware-watchpoint-limit, hardware-breakpoint-limit, and
      hardware-watchpoint-length-limit are all changed.  For example, a user
      will now see this:
      
          (gdb) show remote hardware-breakpoint-limit
          The maximum number of target hardware breakpoints is unlimited.
      
      Instead of this:
      
          (gdb) show remote hardware-breakpoint-limit
          The maximum number of target hardware breakpoints is -1.
      
      And can do this:
      
          (gdb) set remote hardware-breakpoint-limit unlimited
      
      However, previously any negative value implied "unlimited", now only
      -1, or the text "unlimited" can be used for unlimited.  Any other
      negative value will give an error about invalid input.  This is a
      small change in the user interface, but, hopefully, this will not
      cause too many problems.
      
      I've also added show functions for these three variables to allow for
      internationalisation.
      
      gdb/ChangeLog:
      
      	* remote.c (show_hardware_watchpoint_limit): New function.
      	(show_hardware_watchpoint_length_limit): New function.
      	(show_hardware_breakpoint_limit): New function.
      	(_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd
      	where appropriate, update help text.
      
      gdb/doc/ChangeLog:
      
      	* gdb.texinfo (Remote Configuration): Update descriptions for
      	set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
      	and hardware-watchpoint-length-limit variables.
      055303e2
  15. 03 Jul, 2018 7 commits
    • Tom Tromey's avatar
      Remove ptid_equal · d7e15655
      Tom Tromey authored
      Remove ptid_equal in favor of using "==".
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (ptid_equal): Remove.
      	* common/ptid.h (ptid_equal): Don't declare.
      	* ada-tasks.c: Update.
      	* breakpoint.c: Update.
      	* common/agent.c: Update.
      	* corelow.c: Update.
      	* darwin-nat-info.c: Update.
      	* darwin-nat.c: Update.
      	* dcache.c: Update.
      	* dtrace-probe.c: Update.
      	* dummy-frame.c: Update.
      	* fbsd-nat.c: Update.
      	* frame.c: Update.
      	* gdbthread.h: Update.
      	* gnu-nat.c: Update.
      	* go32-nat.c: Update.
      	* inf-loop.c: Update.
      	* inf-ptrace.c: Update.
      	* infcall.c: Update.
      	* infcmd.c: Update.
      	* inflow.c: Update.
      	* infrun.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* linux-thread-db.c: Update.
      	* mi/mi-cmd-var.c: Update.
      	* mi/mi-interp.c: Update.
      	* mi/mi-main.c: Update.
      	* nto-procfs.c: Update.
      	* ppc-linux-tdep.c: Update.
      	* procfs.c: Update.
      	* python/py-inferior.c: Update.
      	* python/py-record-btrace.c: Update.
      	* python/py-record.c: Update.
      	* ravenscar-thread.c: Update.
      	* regcache.c: Update.
      	* remote-sim.c: Update.
      	* remote.c: Update.
      	* sol-thread.c: Update.
      	* solib.c: Update.
      	* target.c: Update.
      	* tui/tui-stack.c: Update.
      	* varobj.c: Update.
      	* windows-nat.c: Update.
      	* windows-tdep.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      	* lynx-low.c: Update.
      	* mem-break.c: Update.
      	* nto-low.c: Update.
      	* remote-utils.c: Update.
      	* server.c: Update.
      	* spu-low.c: Update.
      	* target.c: Update.
      	* win32-low.c: Update.
      d7e15655
    • Tom Tromey's avatar
      Remove ptid_match · 26a57c92
      Tom Tromey authored
      This removes ptid_match in favor of the ptid_t::matches method.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (ptid_match): Remove.
      	* common/ptid.h (ptid_match): Don't declare.
      	* fbsd-nat.c: Update.
      	* infcmd.c: Update.
      	* infrun.c: Update.
      	* linux-nat.c: Update.
      	* record-btrace.c: Update.
      	* regcache.c: Update.
      	* remote.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* server.c: Update.
      26a57c92
    • Tom Tromey's avatar
      Remove ptid_is_pid · 0e998d96
      Tom Tromey authored
      This removes ptid_is_pid in favor of the ptid_t::is_pid method.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (ptid_is_pid): Remove.
      	* common/ptid.h (ptid_is_pid): Don't declare.
      	* infrun.c: Update.
      	* linux-nat.c: Update.
      	* mi/mi-interp.c: Update.
      	* remote.c: Update.
      	* thread.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      0e998d96
    • Tom Tromey's avatar
      Remove ptid_get_lwp · e38504b3
      Tom Tromey authored
      This removes ptid_get_lwp in favor of calling the ptid_t::lwp method.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (ptid_get_lwp): Remove.
      	* common/ptid.h (ptid_get_lwp): Don't declare.
      	* aarch64-linux-nat.c: Update.
      	* ada-tasks.c: Update.
      	* aix-thread.c: Update.
      	* amd64-linux-nat.c: Update.
      	* arm-linux-nat.c: Update.
      	* corelow.c: Update.
      	* fbsd-nat.c: Update.
      	* fbsd-tdep.c: Update.
      	* gnu-nat.c: Update.
      	* i386-cygwin-tdep.c: Update.
      	* i386-gnu-nat.c: Update.
      	* i386-linux-nat.c: Update.
      	* ia64-linux-nat.c: Update.
      	* inf-ptrace.c: Update.
      	* infrun.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* linux-tdep.c: Update.
      	* linux-thread-db.c: Update.
      	* mips-linux-nat.c: Update.
      	* nat/aarch64-linux-hw-point.c: Update.
      	* nat/aarch64-linux.c: Update.
      	* nat/linux-btrace.c: Update.
      	* nat/linux-osdata.c: Update.
      	* nat/linux-procfs.c: Update.
      	* nat/x86-linux-dregs.c: Update.
      	* obsd-nat.c: Update.
      	* ppc-fbsd-nat.c: Update.
      	* ppc-linux-nat.c: Update.
      	* procfs.c: Update.
      	* python/py-infthread.c: Update.
      	* ravenscar-thread.c: Update.
      	* remote.c: Update.
      	* s390-linux-nat.c: Update.
      	* sol-thread.c: Update.
      	* sol2-tdep.c: Update.
      	* spu-linux-nat.c: Update.
      	* x86-linux-nat.c: Update.
      	* xtensa-linux-nat.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      	* linux-mips-low.c: Update.
      	* lynx-low.c: Update.
      	* nto-low.c: Update.
      	* remote-utils.c: Update.
      	* server.c: Update.
      	* spu-low.c: Update.
      	* target.c: Update.
      	* thread-db.c: Update.
      e38504b3
    • Tom Tromey's avatar
      Remove ptid_get_pid · e99b03dc
      Tom Tromey authored
      This removes ptid_get_pid in favor of calling the ptid_t::pid method.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (ptid_get_pid): Remove.
      	* common/ptid.h (ptid_get_pid): Don't declare.
      	* aarch64-linux-nat.c: Update.
      	* ada-lang.c: Update.
      	* aix-thread.c: Update.
      	* alpha-bsd-nat.c: Update.
      	* amd64-fbsd-nat.c: Update.
      	* amd64-linux-nat.c: Update.
      	* arm-linux-nat.c: Update.
      	* arm-nbsd-nat.c: Update.
      	* auxv.c: Update.
      	* break-catch-syscall.c: Update.
      	* breakpoint.c: Update.
      	* bsd-uthread.c: Update.
      	* corelow.c: Update.
      	* ctf.c: Update.
      	* darwin-nat.c: Update.
      	* fbsd-nat.c: Update.
      	* fbsd-tdep.c: Update.
      	* gcore.c: Update.
      	* gnu-nat.c: Update.
      	* hppa-nbsd-nat.c: Update.
      	* hppa-obsd-nat.c: Update.
      	* i386-fbsd-nat.c: Update.
      	* ia64-linux-nat.c: Update.
      	* inf-ptrace.c: Update.
      	* infcmd.c: Update.
      	* inferior.c: Update.
      	* inferior.h: Update.
      	* inflow.c: Update.
      	* infrun.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* linux-tdep.c: Update.
      	* linux-thread-db.c: Update.
      	* m68k-bsd-nat.c: Update.
      	* mi/mi-interp.c: Update.
      	* mi/mi-main.c: Update.
      	* mips-linux-nat.c: Update.
      	* mips-nbsd-nat.c: Update.
      	* mips64-obsd-nat.c: Update.
      	* nat/aarch64-linux-hw-point.c: Update.
      	* nat/aarch64-linux.c: Update.
      	* nat/linux-btrace.c: Update.
      	* nat/linux-osdata.c: Update.
      	* nat/linux-procfs.c: Update.
      	* nat/x86-linux-dregs.c: Update.
      	* nto-procfs.c: Update.
      	* obsd-nat.c: Update.
      	* ppc-linux-nat.c: Update.
      	* ppc-nbsd-nat.c: Update.
      	* ppc-obsd-nat.c: Update.
      	* proc-service.c: Update.
      	* procfs.c: Update.
      	* python/py-inferior.c: Update.
      	* python/py-infthread.c: Update.
      	* ravenscar-thread.c: Update.
      	* record.c: Update.
      	* remote-sim.c: Update.
      	* remote.c: Update.
      	* rs6000-nat.c: Update.
      	* s390-linux-nat.c: Update.
      	* sh-nbsd-nat.c: Update.
      	* sol-thread.c: Update.
      	* sparc-nat.c: Update.
      	* sparc64-tdep.c: Update.
      	* spu-linux-nat.c: Update.
      	* spu-tdep.c: Update.
      	* target-debug.h: Update.
      	* target.c: Update.
      	* thread.c: Update.
      	* tid-parse.c: Update.
      	* tracefile-tfile.c: Update.
      	* vax-bsd-nat.c: Update.
      	* windows-nat.c: Update.
      	* x86-linux-nat.c: Update.
      	* x86-nat.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      	* linux-mips-low.c: Update.
      	* lynx-low.c: Update.
      	* mem-break.c: Update.
      	* nto-low.c: Update.
      	* remote-utils.c: Update.
      	* server.c: Update.
      	* spu-low.c: Update.
      	* target.c: Update.
      	* tracepoint.c: Update.
      e99b03dc
    • Tom Tromey's avatar
      Remove pid_to_ptid · f2907e49
      Tom Tromey authored
      This removes pid_to_ptid in favor of calling the ptid_t constructor
      directly.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.c (pid_to_ptid): Remove.
      	* common/ptid.h (pid_to_ptid): Don't declare.
      	* aix-thread.c: Update.
      	* arm-linux-nat.c: Update.
      	* common/ptid.c: Update.
      	* common/ptid.h: Update.
      	* corelow.c: Update.
      	* ctf.c: Update.
      	* darwin-nat.c: Update.
      	* fbsd-nat.c: Update.
      	* fork-child.c: Update.
      	* gnu-nat.c: Update.
      	* go32-nat.c: Update.
      	* inf-ptrace.c: Update.
      	* infcmd.c: Update.
      	* inferior.c: Update.
      	* infrun.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* nat/aarch64-linux-hw-point.c: Update.
      	* nat/fork-inferior.c: Update.
      	* nat/x86-linux-dregs.c: Update.
      	* nto-procfs.c: Update.
      	* obsd-nat.c: Update.
      	* procfs.c: Update.
      	* progspace.c: Update.
      	* remote.c: Update.
      	* rs6000-nat.c: Update.
      	* s390-linux-nat.c: Update.
      	* sol-thread.c: Update.
      	* spu-linux-nat.c: Update.
      	* target.c: Update.
      	* top.c: Update.
      	* tracefile-tfile.c: Update.
      	* windows-nat.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      	* linux-ppc-low.c: Update.
      	* linux-x86-low.c: Update.
      	* proc-service.c: Update.
      	* server.c: Update.
      	* spu-low.c: Update.
      	* thread-db.c: Update.
      	* win32-low.c: Update.
      f2907e49
    • Tom Tromey's avatar
      Remove ptid_build · fd79271b
      Tom Tromey authored
      This removes ptid_build in favor of simply calling the ptid_t
      constructor directly.
      
      gdb/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* common/ptid.h (ptid_build): Don't declare.
      	* common/ptid.c (ptid_build): Remove.
      	* aix-thread.c: Update.
      	* bsd-kvm.c: Update.
      	* bsd-uthread.c: Update.
      	* common/agent.c: Update.
      	* common/ptid.c: Update.
      	* common/ptid.h: Update.
      	* corelow.c: Update.
      	* darwin-nat.c: Update.
      	* fbsd-nat.c: Update.
      	* gnu-nat.c: Update.
      	* linux-fork.c: Update.
      	* linux-nat.c: Update.
      	* linux-thread-db.c: Update.
      	* nat/linux-osdata.c: Update.
      	* nat/linux-procfs.c: Update.
      	* nto-procfs.c: Update.
      	* obsd-nat.c: Update.
      	* proc-service.c: Update.
      	* procfs.c: Update.
      	* ravenscar-thread.c: Update.
      	* remote-sim.c: Update.
      	* remote.c: Update.
      	* sol-thread.c: Update.
      	* target.c: Update.
      	* windows-nat.c: Update.
      
      gdb/gdbserver/ChangeLog
      2018-07-03  Tom Tromey  <tom@tromey.com>
      
      	* linux-low.c: Update.
      	* lynx-low.c: Update.
      	* nto-low.c: Update.
      	* remote-utils.c: Update.
      	* spu-low.c: Update.
      	* thread-db.c: Update.
      	* win32-low.c: Update.
      fd79271b
  16. 29 Jun, 2018 1 commit
    • Pedro Alves's avatar
      remote & target_extra_thread_info, use cache w/ qThreadExtraInfo and qP too · c76a8ea3
      Pedro Alves authored
      The following patch will make "info threads" call target_extra_thread_info
      more frequently.  When I looked at the remote implementation, I noticed
      that if we're not using qXfer:threads:read, then we'd be increasing the
      remote protocol traffic.  This commit prevents that from happening.
      
      Also, it removes a gratuitous local static buffer, which seems good on
      its own.
      
      gdb/ChangeLog:
      2018-06-29  Pedro Alves  <palves@redhat.com>
      
      	* remote.c (remote_target::extra_thread_info): Delete
      	'display_buf' and 'n' locals.  from the cache, regardless of
      	packet mechanims is in use.  Use cache for qThreadExtra and qP
      	methods too.
      c76a8ea3
  17. 28 Jun, 2018 1 commit
    • Pedro Alves's avatar
      gdb: Eliminate the 'stop_pc' global · f2ffa92b
      Pedro Alves authored
      In my multi-target work, I need to add a few more
      scoped_restore_current_thread and switch_to_thread calls in some
      places, and in some lower-level places I was fighting against the fact
      that switch_to_thread reads/refreshes the stop_pc global.
      
      Instead of piling on workarounds, let's just finally eliminate the
      stop_pc global.  We already have the per-thread
      thread_info->suspend.stop_pc field, so it's mainly a matter of using
      that more/instead.
      
      gdb/ChangeLog:
      2018-06-28  Pedro Alves  <palves@redhat.com>
      
      	* gdbthread.h (struct thread_suspend_state) <stop_pc>: Extend
      	comments.
      	(switch_to_thread_no_regs): Adjust comment.
      	* infcmd.c (stop_pc): Delete.
      	(post_create_inferior, info_program_command): Replace references
      	to stop_pc with references to thread_info->suspend.stop_pc.
      	* inferior.h (stop_pc): Delete declaration.
      	* infrun.c (proceed, handle_syscall_event, fill_in_stop_func)
      	(handle_inferior_event_1, handle_signal_stop)
      	(process_event_stop_test, keep_going_stepped_thread)
      	(handle_step_into_function, handle_step_into_function_backward)
      	(print_stop_location): Replace references to stop_pc with
      	references to thread_info->suspend.stop_pc.
      	(struct infcall_suspend_state) <stop_pc>: Delete field.
      	(save_infcall_suspend_state, restore_infcall_suspend_state):
      	Remove references to inf_stat->stop_pc.
      	* linux-fork.c (fork_load_infrun_state): Likewise.
      	* record-btrace.c (record_btrace_set_replay): Likewise.
      	* record-full.c (record_full_goto_entry): Likewise.
      	* remote.c (print_one_stopped_thread): Likewise.
      	* target.c (target_resume): Extend comment.
      	* thread.c (set_executing_thread): New.
      	(set_executing): Use it.
      	(switch_to_thread_no_regs, switch_to_no_thread, switch_to_thread):
      	Remove references to stop_pc.
      f2ffa92b
  18. 21 Jun, 2018 1 commit
    • Pedro Alves's avatar
      Use thread_info and inferior pointers more throughout · 00431a78
      Pedro Alves authored
      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.
      00431a78
  19. 11 Jun, 2018 1 commit
    • Tom Tromey's avatar
      Remove use of queue from remote.c · 953edf2b
      Tom Tromey authored
      This removes a use of the queue data structure (common/queue.h) from
      remote.c.
      
      The queue is replaced with a std::vector.  A queue was not needed, as
      the code never de-queued items.
      
      This removes quite a bit of boilerplate code, mostly involved with
      marshalling arguments to be passed through the queue iterator.
      
      Tested by the buildbot.
      
      gdb/ChangeLog
      2018-06-10  Tom Tromey  <tom@tromey.com>
      
      	* remote.c (stop_reply_p): Remove typedef.  Don't declare queue.
      	(class remote_state) <stop_reply_queue>: Now std::vector.
      	(remote_state::~remote_state)
      	(remote_target::stop_reply_queue_length): Update.
      	(struct queue_iter_param, remove_child_of_pending_fork)
      	(struct check_pending_event_prevents_wildcard_vcont_callback_data)
      	(check_pending_event_prevents_wildcard_vcont_callback)
      	(remove_stop_reply_for_inferior)
      	(remove_stop_reply_of_remote_state)
      	(remote_notif_remove_once_on_match)
      	(stop_reply_match_ptid_and_ws)
      	(remote_kill_child_of_pending_fork): Remove.
      	(remote_target::remove_new_fork_children)
      	(remote_target::check_pending_events_prevent_wildcard_vcont)
      	(remote_target::discard_pending_stop_replies)
      	(remote_target::discard_pending_stop_replies_in_queue)
      	(remote_target::remote_notif_remove_queued_reply)
      	(remote_target::queued_stop_reply)
      	(remote_target::push_stop_reply, remote_target::peek_stop_reply)
      	(remote_target::wait, remote_target::kill_new_fork_children)
      	(remote_target::async): Update.
      953edf2b
  20. 07 Jun, 2018 2 commits
    • Pedro Alves's avatar
      target_ops::beneath -> target_ops::beneath() · b6a8c27b
      Pedro Alves authored
      This changes target_ops::beneath from a pointer to a method, and
      adjusts all references throughout.  The idea here is to make it easier
      to change the target stack representation from an intrusive singly
      linked list to something else without leaking implementation details
      throughout.
      
      The commit does not change the representation yet, that will be done
      in a following patch.  That is why a new target_ops::m_beneath field
      appears here.  That new field isn't really documented properly or made
      private, simply because it will be removed shortly.
      
      Note that target_ops::beneath() is essentially the same as the current
      find_target_beneath routine.  The following patch will eliminate the
      latter.
      
      gdb/ChangeLog:
      2018-06-07  Pedro Alves  <palves@redhat.com>
      
      	* target.h (target_ops) <beneath>: Now a method.  All references
      	updated.
      	(target_ops) <m_beneath>: New.
      	* target.c (target_ops::beneath): New.
      	* corelow.c: Adjust all references to target_ops::beneath.
      	* linux-thread-db.c: Likewise.
      	* make-target-delegates: Likewise.
      	* record-btrace.c: Likewise.
      	* record-full.c: Likewise.
      	* remote.c: Likewise.
      	* target.c: Likewise.
      	* target-delegates.c: Regenerate.
      b6a8c27b
    • Pedro Alves's avatar
      target_stack -> current_top_target() throughout · 8b88a78e
      Pedro Alves authored
      The recent C++ification of target_ops replaced references to the old
      "current_target" squashed target throughout with references to a
      "target_stack" pointer.  I had picked the "target_stack" name very
      early in the multi-target work, and managed to stick with it, even
      though it's a bit of a misnomer, since it isn't really a "target
      stack" object, but a pointer into the current top target in the stack.
      As I'm splitting more pieces off of the multi-target branch, I've come
      to think that it's better to rename it now.  A following patch will
      introduce a new class to represent a target stack, and "target_stack"
      would be _its_ ideal name.  (In the branch, the class is called
      a_target_stack to work around the clash.)
      
      Thus this commit renames target_stack to current_top_target and
      replaces all references throughout.  Also, while at it,
      current_top_target is made a function instead of a pointer, to make it
      possible to change its internal implementation without leaking
      implementation details out.  In a couple patches, the implementation
      of the function will change to refer to a target stack object, and
      then further down the multi-target work, it'll change again to find
      the right target stack for the current inferior.
      
      gdb/ChangeLog:
      2018-06-07  Pedro Alves  <palves@redhat.com>
      
      	* target.h (target_stack): Delete.
      	(current_top_target): Declare function.
      	* target.c (target_stack): Delete.
      	(g_current_top_target): New.
      	(current_top_target): New function.
      	* auxv.c: Use current_top_target instead of target_stack
      	throughout.
      	* avr-tdep.c: Likewise.
      	* breakpoint.c: Likewise.
      	* corefile.c: Likewise.
      	* elfread.c: Likewise.
      	* eval.c: Likewise.
      	* exceptions.c: Likewise.
      	* frame.c: Likewise.
      	* gdbarch-selftests.c: Likewise.
      	* gnu-v3-abi.c: Likewise.
      	* ia64-tdep.c: Likewise.
      	* ia64-vms-tdep.c: Likewise.
      	* infcall.c: Likewise.
      	* infcmd.c: Likewise.
      	* infrun.c: Likewise.
      	* linespec.c: Likewise.
      	* linux-tdep.c: Likewise.
      	* minsyms.c: Likewise.
      	* ppc-linux-nat.c: Likewise.
      	* ppc-linux-tdep.c: Likewise.
      	* procfs.c: Likewise.
      	* regcache.c: Likewise.
      	* remote.c: Likewise.
      	* rs6000-tdep.c: Likewise.
      	* s390-linux-nat.c: Likewise.
      	* s390-tdep.c: Likewise.
      	* solib-aix.c: Likewise.
      	* solib-darwin.c: Likewise.
      	* solib-dsbt.c: Likewise.
      	* solib-spu.c: Likewise.
      	* solib-svr4.c: Likewise.
      	* solib-target.c: Likewise.
      	* sparc-tdep.c: Likewise.
      	* sparc64-tdep.c: Likewise.
      	* spu-tdep.c: Likewise.
      	* symfile.c: Likewise.
      	* symtab.c: Likewise.
      	* target-descriptions.c: Likewise.
      	* target-memory.c: Likewise.
      	* target.c: Likewise.
      	* target.h: Likewise.
      	* tracefile-tfile.c: Likewise.
      	* tracepoint.c: Likewise.
      	* valops.c: Likewise.
      	* valprint.c: Likewise.
      	* value.c: Likewise.
      	* windows-tdep.c: Likewise.
      	* mi/mi-main.c: Likewise.
      8b88a78e
  21. 30 May, 2018 4 commits
    • Simon Marchi's avatar
      Remove regcache_raw_collect · 34a79281
      Simon Marchi authored
      Remove regcache_raw_collect, update callers to use
      regcache::raw_collect.
      
      gdb/ChangeLog:
      
      	* regcache.h (regcache_raw_collect): Remove, update callers to
      	use regcache::raw_collect.
      	* regcache.c (regcache_raw_collect): Remove.
      34a79281
    • Simon Marchi's avatar
      Remove regcache_raw_supply · 73e1c03f
      Simon Marchi authored
      Remove regcache_raw_supply, update callers to use
      detached_regcache::raw_supply.
      
      gdb/ChangeLog:
      
      	* regcache.h (regcache_raw_supply): Remove, update callers to
      	use detached_regcache::raw_supply.
      	* regcache.c (regcache_raw_supply): Remove.
      73e1c03f
    • Simon Marchi's avatar
      Remove regcache_raw_update · 0b47d985
      Simon Marchi authored
      Remove regcache_raw_update, update callers to use
      readable_regcache::raw_update instead.
      
      gdb/ChangeLog:
      
      	* regcache.h (regcache_raw_update): Remove, update callers to
      	use readable_regcache::raw_update instead.
      	* regcache.c (regcache_raw_update): Remove.
      0b47d985
    • Simon Marchi's avatar
      Remove regcache_get_ptid · 222312d3
      Simon Marchi authored
      Remove regcache_get_ptid, change all callers to call the regcache method
      directly.
      
      gdb/ChangeLog:
      
      	* regcache.h (regcache_get_ptid): Remove, update all callers to
      	call regcache::ptid instead.
      	* regcache.c (regcache_get_ptid): Remove.
      222312d3
  22. 25 May, 2018 2 commits
    • Tom Tromey's avatar
      Use gdb::byte_vector in remote.c · 5ca3b260
      Tom Tromey authored
      This changes a couple of spots in remote.c to use gdb::byte_vector,
      allowing for some cleanup removal.
      
      ChangeLog
      2018-05-25  Tom Tromey  <tom@tromey.com>
      
      	* remote.c (remote_target::remote_file_get): Use
      	gdb::byte_vector.
      	(remote_target::remote_file_put): Likewise.
      5ca3b260
    • Pedro Alves's avatar
      remote_target::m_remote_state, pointer -> object · 3c69da40
      Pedro Alves authored
      The only reason remote_target::m_remote_state is a pointer is that
      struct remote_state is incomplete when struct remote_target is
      defined.
      
      This commit thus moves struct remote_state (and its dependencies)
      higher up and makes remote_target::m_remote_state an object instead of
      a pointer.
      
      gdb/ChangeLog:
      2018-05-25  Pedro Alves  <palves@redhat.com>
      
      	* remote.c (struct vCont_action_support, MAXTHREADLISTRESULTS)
      	(struct readahead_cache, struct packet_reg, struct
      	remote_arch_state, class remote_state): Move higher up in the
      	file.
      	(remote_target::m_remote_state): Now an object instead of a pointer.
      	(remote_target::get_remote_state): Adjust.
      3c69da40