Commit Graph

464 Commits

Author SHA1 Message Date
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Pedro Alves 48aa3c2705 * remote.c (extended_remote_mourn_1): Always call
generic_mourn_inferior.
2008-12-12 13:45:43 +00:00
Pedro Alves 5f3563ea7a * remote.c (remote_detach_1): Don't delete the inferior here.
(process_stop_reply): Ditto.
	(extended_remote_kill): Ditto.
2008-12-12 01:08:29 +00:00
Pedro Alves ca19bf2309 * remote.c (read_ptid): If we don't know about any inferior yet,
use the pid of magic_null_ptid.
	(remote_start_remote): In the non-stop mode case, don't set
	inferior_ptid to magic_null_ptid here.
2008-12-12 00:12:03 +00:00
Jan Kratochvil 4100683baa * remote.c (remote_parse_stop_reply): Use REG only after its NULL check. 2008-12-09 16:36:15 +00:00
Vladimir Prus 07e059b5a9 Implement -list-thread-groups --available
* Makefile.in (XMLFILES): Add osdata.dtd.
        (SFILES): Add osdata.c.
        (COMMON_OBS): Add osdata.o.
        * linux-nat.c: Include pwd.h, sys/types.h, gdb_dirent.h and xml-support.h.
        (linux_nat_xfer_osdata): New function.
        (linux_xfer_partial): Handle TARGET_OBJECT_OSDATA.
        * osdata.c: New file.
        * osdata.h: New file.
        * remote.c (PACKET_qXfer_osdata): New packet enum.
        (remote_protocol_features): Add "qXfer:osdata:read".
        (remote_read_qxfer): Handle TARGET_OBJECT_OSDATA.
        (extended_remote_can_run): New.
        (init_extended_remote_ops): Set to_can_run to
        extended_remote_can_run.
        (_initialize_remote): Add packet config command for
        "qXfer:osdata:read".
        * xml-support.c (obstack_xml_printf): New function.
        * xml-support.h (obstack_xml_printf): Declare.
        * target.c (target_get_osdata): New function.
        * target.h (enum target_object): Add TARGET_OBJECT_OSDATA.
        (target_os_data): Declare.
        * features/osdata.dtd: New file.
        * mi/mi-main.c (mi_list_thread_groups): Handle the --available
        option.
2008-12-02 07:57:38 +00:00
Daniel Jacobowitz d962ef8246 PR gdb/2474
* remote.c (remote_read_description_p): New function.
	(remote_start_remote): Try to fetch the target description
	before adding shared libraries.  Try again later if the
	target is running but stopped.
	(remote_open_1): Mark extended targets as exited by default.
	(remote_read_description): Check target_has_execution.
2008-11-24 16:53:44 +00:00
Pedro Alves 6e5abd65ae * remote.c (escape_buffer): New.
(putpkt_binary, read_frame, getpkt_or_notif_sane_1): Use it.  Make
	sure debug output printing a packet buffer goes through a single
	fprintf_unfiltered call.
	* utils.c (vfprintf_unfiltered): If outputting timestamps, end
	output with a newline if it wasn't going to already.
2008-11-19 14:45:09 +00:00
Vladimir Prus 136d6dae62 Kill pthread_ops_hack
* target.h (struct target_ops): Make to_attach, to_detach,
	to_create_inferior and to_mourn_inferior accept a pointer
    	to struct target_ops.
	(target_attach, target_create_inferior, target_create_inferior):
	Convert from macros to function.  Find the right target to
	invoke a method of.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.
	* corefile.c (core_file_command): Pass target to to_detach.
	* corelow.c (core_detach): Add 'ops' parameter.
	* fork-child.c (fork_inferior): Return the pid.  Allow
	init_trace_fun to be NULL.
	* inf-ptrace (ptrace_ops_hack): Remove.
	(inf_ptrace_him): Remove, moving all logic into....
	(inf_ptrace_create_inferior): ... here.  Push the target
	passed as parameter.
	(inf_ptrace_mourn_inferior, inf_ptrace_attach, inf_ptrace_detach):
	Push/pop target passed as parameter, no ptrace_ops_hack.
	(inf_ptrace_target): Don't remember result.
	* inferior.h (fork_inferior): Adjust prototype.
	* linux-nat.c (linux_nat_create_inferior, linux_nat_attach)
	(linux_nat_detach, linux_nat_mourn_inferior): New parameter ops.
	Pass it to linux_ops target.
	* linux-thread-db.c (thread_db_detach, thread_db_mourn_inferior):
	New parameter ops. Pass it to the target beneath.
	* remote.c (remote_mourn, extended_remote_mourn, remote_detach)
	(extended_remote_create_inferior): New parameter ops. Pass it
	further.
	* target.c (debug_to_attach, debug_to_detach)
	(debug_to_mourn_inferior): New parameter ops.
	(target_create_inferior): New.
	(update_current_target): Do not inherit to_attach, to_detach,
	to_create_inferiour, to_mourn_inferior.  Do not default
	to_detach and to_mourn_inferior.
	(target_detach): Find the right target to use.
	(target_mourn_inferior): New.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.  Pass the found target when calling its method.
	(init_dummy_target): Provide fallback definition of to_detach.
	(target_attach): New.
	(debug_to_attach, debug_to_detach, debug_to_create_inferior)
	(debug_to_mourn_inferiour): New parameter ops.
        * aix-thread.c: Adjust.
        * bsd-uthread.c: Adjust.
        * gnu-nat.c: Adjust.
        * go32-nat.c: Adjust.
        * hpux-thread.c: Adjust.
        * inf-ttrace.c: Ajust.
        * monitor.c: Adjust.
        * nto-procfs.c: Adjust.
        * procfs.c: Adjust.
        * remote-m32r-sdi.c: Adjust.
        * remote-mips.c: Adjust.
        * remote-sim.c: Adjust.
        * rs6000-nat.c: Adjust.
        * sol-thread.c: Adjust.
        * win32-nat.c: Adjust.
	* dec-thread.c: Adjust.
2008-11-09 11:27:18 +00:00
Pedro Alves 29c87f7ff2 * remote.c (notice_new_inferiors): Add a new inferior only when
we're going to add a new thread.
2008-11-05 21:19:45 +00:00
Pedro Alves d3fd534293 * inf-loop.c (inferior_event_handler): On INF_ERROR and
INF_REG_EVENT throwing, don't call target_async or pop_target.
	Call pop_all_targets_above.
	* remote.c (remote_close): Call remote_terminal_ours.  Don't call
	signal or target_async.
2008-11-04 20:52:24 +00:00
Pedro Alves 50c71eaf0e * remote.c (remote_start_remote): If the solib list is global,
fetch libraries and insert breakpoints after connecting.
	* infcmd.c (post_create_inferior): If the solist is shared between
	inferiors, no need to refetch it on every new inferior.
	(detach_command): If the shared library list is shared between
	inferiors, then don't clear it on every inferior detach.
	* gdbarch.sh (has_global_solist): New.
	* i386-dicos-tdep.c (i386_dicos_init_abi): Set
	gdbarch_has_global_solist.
	* target.c (target_pre_inferior): If the shared library list is
	shared between inferiors, then don't clear it here, neither
	invalidate the memory regions or clear the target description.
	(target_detach): If the shared library list is shared between
	inferiors, then don't remove breakpoints from the target here.
	(target_disconnect): Comment.
	* solib.c (update_solib_list): Check for null_ptid.
	* breakpoint.c (insert_breakpoints, update_global_location_list):
	If the shared library list is shared between inferiors, insert
	breakpoints even if there's no execution.
	(breakpoint_init_inferior): If the shared library list is shared
	between inferiors, don't delete breakpoints or mark them
	uninserted here.

	* gdbarch.c, gdbarch.h: Regenerate.
2008-11-03 14:01:27 +00:00
Tom Tromey 7c8a8b0498 * cli/cli-script.c (do_fclose_cleanup): Remove.
(script_from_file): Use make_cleanup_fclose.
	* xml-tdesc.c (do_cleanup_fclose): Remove.
	(fetch_xml_from_file): Use make_cleanup_fclose.
	* tracepoint.c (tracepoint_save_command): Use
	make_cleanup_fclose.  Always free pathname.
	* source.c (print_source_lines_base): Use make_cleanup_fclose.
	* remote.c (fclose_cleanup): Remove.
	(remote_file_put): Use make_cleanup_fclose.
	(remote_file_get): Likewise.
	* linux-nat.c (linux_nat_find_memory_regions): Use
	make_cleanup_fclose.
	(linux_nat_info_proc_cmd): Likewise.
	(linux_proc_pending_signals): Likewise.
	* fbsd-nat.c (fbsd_find_memory_regions): Use make_cleanup_fclose.
	Free file name.
	* cli/cli-dump.c (do_fclose_cleanup): Remove.
	(make_cleanup_fclose): Remove.
	* defs.h (make_cleanup_fclose): Declare.
	* utils.c (do_fclose_cleanup): New function.
	(make_cleanup_fclose): Likewise.
2008-10-28 15:22:13 +00:00
Pedro Alves 8a30517206 * target.h (struct target_ops) <to_supports_multi_process>: New
field.
	(target_supports_multi_process): New define.
	* target.c (update_current_target): Inherit and de_fault
	to_supports_multi_process.
	* infcmd.c (attach_command): Allow attaching to multiple processes
	if the target supports it.
	(detach_command): If the target claims there is still execution,
	don't clear the thread list.
	* remote.c (remote_supports_multi_process): New.
	(init_remote_ops): Register remote_supports_multi_process.
2008-10-27 12:43:24 +00:00
Pedro Alves 74531fed1f Remote non-stop mode support.
* remote.c (pending_stop_reply): New.
	(struct remote_state) <non_stop_aware, support_vCont_t>: New
	fields.
	(remote_async_inferior_event_token)
	(remote_async_get_pending_events_token): New.
	(notice_new_inferiors): New, abstracted out from record_currthread.
	(record_currthread): Call it.
	(remote_threads_info): Default threads to running in non-stop
	mode.  In non-stop mode, only qfThreadInfo is supported.
	(remote_close): Discard all pending stop_replies.  Close the event
	sources.
	(set_stop_requested_callback): New.
	(remote_start_remote): Implement non-stop mode startup.  In
	all-stop, don't clear the thread list here.
	(remote_non_stop_feature): New.
	(remote_protocol_features): Add a "QNonStop" feature.
	(remote_open_1): Clear cached_wait_status and non_stop_aware.
	Clear the thread list here.
	(remote_detach_1): Discard pending stop replies of the process we
	detached from.
	(extended_remote_attach_1): Implement non-stop mode.
	(remote_vcont_probe): Recognize `vCont;t'.
	(remote_vcont_resume): Implement non-stop mode.
	(remote_resume): Don't set waiting_for_stop_reply in non-stop
	mode.
	(remote_stop_ns): New.
	(remote_stop): Rename to ...
	(remote_stop_as): ... this.  If we have a cached wait status,
	don't bother interrupting the remote.
	(remote_stop): Reimplement as wrapper around remote_stop_as and
	remote_stop_ns.
	(interrupt_query): Don't query in async mode.
	(struct cached_reg, cahed_reg_t): New.
	(struct stop_reply): New.
	(stop_reply_queue): New.
	(stop_reply_xmalloc, stop_reply_xfree)
	(discard_pending_stop_replies, do_stop_reply_xfree)
	(queued_stop_reply, push_stop_reply, peek_stop_reply)
	(remote_parse_stop_reply, remote_get_pending_stop_replies)
	(process_stop_reply): New.
	(remote_wait_ns): New.
	(remote_wait_as): Use remote_parse_stop_reply.  Invalidate the
	notion of current general thread is a process exit was reported.
	(remote_wait): Call remote_wait_ns in non-stop mode.
	(handle_notification): New.
	(putpkt_binary): Handle notifications.  Don't care for
	waiting_for_stop_reply in non-stop mode.
	(getpkt_sane): Rename to ...
	(getpkt_or_notif_sane_1): ... this.  Add `expecting_notif'
	argument.  Handle it.  Handle notifications.
	(getpkt_sane): Reimplement as wrapper around getpkt_or_notif_sane_1.
	(getpkt_or_notif_sane): New.
	(select_new_thread_callback): Check for exited state instead of
	comparing the ptid against minus_one_ptid.
	(extended_remote_create_inferior_1): Query the remote about the
	current thread.
	(remote_supports_non_stop): New.
	(init_remote_ops): Register it.
	(remote_async_inferior_event_handler): New.
	(remote_async_get_pending_events_handler): New.

	* infcmd.c (proceed_thread_callback): Comment.
	(proceed_after_attach_callback, proceed_after_attach): New.
	(attach_command_post_wait): In background attach, resume all
	threads, but only if they are unsignalled, and not explicitly
	stopped.  In foreground attach, in non-stop mode, make sure to
	stop all threads of the just attached to process.
	(attach_command): In non-stop mode: If doing a background attach,
	stop at least one thread.  If a foreground attach, stop all
	threads.
2008-10-24 20:38:26 +00:00
Michael Snyder b2175913c5 2008-10-17 Michael Snyder <msnyder@vmware.com>
Target interface for reverse debugging.
	* target.h (enum target_waitkind):
	Add new wait event, TARGET_WAITKIND_NO_HISTORY.
	(struct target_ops): New method to_can_execute_reverse.
	(target_can_execute_reverse): New macro.
	* target.c (update_current_target): Inherit to_can_execute_reverse.

	Remote interface for reverse debugging.
	* remote.c (remote_can_execute_reverse): New target method.
	(remote_resume): Check for reverse exec direction, and send
	appropriate command to target.
	(remote_wait_as): Check target response for NO_HISTORY status.
	Also check for empty reply (target doesn't understand "bs" or "bc).
	(remote_vcont_resume): Jump out if attempting reverse execution.

	Event handling interface for reverse debugging.
	* infrun.c (execution_direction): New state variable.
	(enum inferior_stop_reason): Add NO_HISTORY reason.
	(handle_inferior_event): Handle TARGET_WAITKIND_NO_HISTORY.
	Handle stepping over a function call in reverse.
	Handle stepping thru a line range in reverse.
	Handle setting a step-resume breakpoint in reverse.
	Handle stepping into a function in reverse.
	Handle stepping between line ranges in reverse.
	(print_stop_reason): Print reason for NO_HISTORY.
	(step_into_function): Rename to handle_step_into_function.
	(handle_step_into_function_backward): New function.
	(set_exec_direction_func, show_exec_direction_func): New funcs.
	(proceed): No need to singlestep over a breakpoint
	when resuming in reverse.

	* inferior.h (enum exec_direction_kind): New enum.
	(execution_direction): Export new execution state variable.

	* breakpoint.c (make_breakpoint_silent): New function.
	* breakpoint.h (make_breakpoint_silent): Export.
	* infcmd.c (finish_command): Check for reverse exec direction.
	(finish_backward): New function, handle finish cmd in reverse.

	User interface for reverse execution.
	* Makefile.in (reverse.c): New file.
	* reverse.c: New file.  User interface for reverse execution.
2008-10-17 19:43:47 +00:00
Pedro Alves 153ccabd86 * remote.c (record_currthread): Add inferior before child threads.
(remote_threads_info): Check for exited threads.  Mention
	notification order.
2008-10-17 01:08:08 +00:00
Pedro Alves 3c9c4b83df * remote.c (set_general_process): New.
(remote_check_symbols): Use it.
2008-10-16 14:39:54 +00:00
Pedro Alves 5c952c9bcb * remote.c (push_remote_target): Delete.
* target.h (push_remote_target): Delete declaration.
2008-10-16 14:03:18 +00:00
Pedro Alves ce5ce7eded * remote.c (remote_close): Unregister remote_desc from the event
loop.  Always restore the SIGINT handler.  Discard all inferiors
	here.
	(remote_detach_1, remote_disconnect): Don't unregister the file
	descriptor from the event loop here.
	(interrupt_query, readchar, getpkt_sane): Pop the target instead
	of morning the current inferior.
	(remote_kill): Don't unregister the file descriptor from the event
	loop here.
	(remote_mourn_1): Don't discard inferiors here.
2008-10-15 21:39:53 +00:00
Pedro Alves 5fe0451782 * remote.c (remote_start_remote): Always tell the stub if we're in
extended-remote.
2008-10-10 14:46:31 +00:00
Pedro Alves c8e38a496b * remote.c (remote_wait): Rename to...
(remote_wait_as): ... this.  Don't loop here.  If the remote
	didn't stop, return TARGET_WAITKIND_IGNORE.
	(remote_wait): New, reimplemented on top of remote_wait_as.
2008-10-09 18:45:44 +00:00
Pedro Alves c8d104ad69 * remote.c (remote_open_1): Move acknowledging any pending ack,
querying supported features, activating noack mode, finding the
	target description, enabling extended remote, and checking remote
	symbols from here ...
	(remote_start_remote): ... to here.
	(remote_open_1): Don't pop the target if it is already gone.
	* target.c (unpush_target): Check for the dummy target.
2008-10-09 03:24:51 +00:00
Pedro Alves e24a49d86d * remote.c (struct remote_state) <waiting_for_stop_reply>: New
field.
	(remote_open_1): Clear waiting_for_stop_reply.
	(remote_resume): Set waiting_for_stop_reply.
	(remote_wait): Clear or set waiting_for_stop_reply accordingly.
	(putpkt_binary): If we're in async mode and waiting for a stop
	reply, bail out with an error.
	(extended_remote_mourn_1): Clear waiting_for_stop_reply.
2008-10-08 19:16:31 +00:00
Pedro Alves 3084dd775a * remote.c (remote_get_thread_info): If the remote doesn't support
the query, bail out.
2008-10-08 15:00:29 +00:00
Paul Pluzhnikov d1a4106143 2008-10-03 Paul Pluzhnikov <ppluzhnikov@google.com>
* utils.c, defs.h (gdb_buildargv): New fn. Wrap buildargv
	and check for out-of-memory condition.
	* exec.c (exec_file_command): Call it.
	* infrun.c (handle_command, xdb_handle_command): Likewise.
	* interps.c (interpreter_exec_cmd): Likewise.
	* linux-nat.c (linux_nat_info_proc_cmd): Likewise.
	* procfs.c (info_proc_cmd): Likewise.
	* remote-mips.c (common_open): Likewise.
	* remote-sim.c (gdbsim_kill, gdbsim_create_inferior)
	(gdbsim_open): Likewise.
	* remote.c (extended_remote_run, remote_put_command)
	(remote_get_command, remote_delete_command): Likewise.
	* ser-mingw.c (pipe_windows_open): Likesise.
	* source.c (add_path, show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Likewise.
	* stack.c (backtrace_command): Likewise.
	* symfile.c (symbol_file_command, generic_load)
	(add_symbol_file_command): Likesise.
	* symmisc.c (maintenance_print_symbols, maintenance_print_psymbols)
	(maintenance_print_msymbols): Likewise.
2008-10-03 16:36:10 +00:00
Pedro Alves 181e7f9393 Remove the attach_flag global, and make it per-inferior.
* inferior.h (attach_flag): Delete.
	(inferior_process): Declare.
	* solib.c (update_solib_list): Adjust.
	* gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust.
	* inf-ptrace.c (inf_ptrace_detach): Adjust.
	(inf_ptrace_files_info): Get it from the current inferior.
	* inf-ttrace.c (inf_ttrace_attach): Adjust.
	(inf_ttrace_files_info): Get it from the current
	inferior.
	* inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap)
	(clear_sigint_trap): Get it from the current process.
	* remote.c (extended_remote_attach_1)
	(extended_remote_create_inferior_1): Adjust.
	* top.c (quit_confirm, quit_target): Get it from the current inferior.
	* procfs.c (do_detach): Adjust.
	(procfs_wait): Get it from the event inferior.
	(procfs_files_info): Get it from the current inferior.
	* nto-procfs.c (procfs_files_info): Likewise.
	(procfs_attach): Adjust.  Set the attach_flag here.
	(do_attach): Don't set it here.
	(procfs_detach): Don't clear it.
	(procfs_mourn_inferior): Don't clear it.
	* solib-osf.c (osf_solib_create_inferior_hook): Adjust.
	* target.c (attach_flag): Delete.
	(generic_mourn_inferior): Don't clear it.
	* win32-nat.c (get_win32_debug_event): Get it from the event
	process.
	(do_initial_win32_stuff): Add attaching argument.  Set attach_flag
	in the inferior accordingly.
	(win32_attach): Don't set the attach_flag here.  Pass 1 to
	do_intial_win32_stuff.
	(win32_files_info): Get it from the current inferior.
	(win32_create_inferior): Dont clear attach_flag here.  Pass 0 to
	do_intial_win32_stuff.
2008-09-22 15:21:30 +00:00
Pedro Alves 82f7388440 Implement remote multi-process extensions.
* remote.c (struct remote_state): Add extended and
	multi_process_aware fields.
	(remote_multi_process_p): New.
	(PACKET_vKill): New.
	(record_currthread): Use thread_change_ptid.  Notice new
	inferiors.
	(set_thread, remote_thread_alive): Use write_ptid.
	(write_ptid, read_ptid): New.
	(remote_current_thread, remote_threads_extra_info): Use them.
	(remote_threads_info): Likewise.  Detect new inferiors.
	(remote_start_remote): Add inferior to inferior list.
	(remote_multi_process_feature): New.
	(remote_protocol_features): Add "multiprocess" feature.
	(remote_query_supported): Pass "multiprocess+" as supported
	features.
	(remote_open_1): Clear multi_process_aware.  Set extended
	accordingly.
	(remote_detach_1): Detach current process.  Use extended packet
	format for extended-remote multi-process.  Detach process from the
	inferior list.  Only mourn after printing output.
	(extended_remote_attach_1): Add process to the inferior list.
	(remote_vcont_resume): Use write_ptid to pass the thread ids.
	(remote_wait): Use read_ptid.  Implement the extended
	multi-process extension format of the 'W' and 'X' reply packets.
	Remove exited inferiors from inferior list.
	(remote_xfer_memory): Set general thread.
	(remote_vkill): New.
	(extended_remote_kill): New.
	(remote_mourn_1): Discard all inferiors.
	(select_new_thread_callback): New.
	(extended_remote_mourn_1): If there are more processes to debug,
	switch to a thread in another process, and don't pop the target.
	(extended_remote_create_inferior_1): Add the new process to the
	inferior list.
	(remote_stopped_by_watchpoint): Indenting.
	(remote_xfer_partial): Set the general thread.
	(remote_pid_to_str): If the remote is multi-process aware, print
	the process id as well as the thread id.
	(remote_get_thread_local_address): Use write_ptid.
	(init_extended_remote_ops): Register extended_remote_kill.
	(_initialize_remote): Register new packets.  Change
	magic_null_ptid's, not_sent_ptid's and any_thread_ptid's pid
	member to 42000.

	* thread.c (thread_change_ptid): Also account for the inferior pid
	changing.

	* inferior.h (discard_all_inferiors): Declare.
	* inferior.c (discard_all_inferiors): New.
2008-09-22 15:18:30 +00:00
Ulrich Weigand 3e88cf8dfb * remote.c: Include "gdb_stat.h". 2008-08-27 13:25:21 +00:00
Ulrich Weigand f1838a9841 ChangeLog:
* remote.h (remote_filename_p, remote_bfd_open): Add prototypes.
	* remote.c (remote_bfd_iovec_open, remote_bfd_iovec_close,
	remote_bfd_iovec_pread, remote_bfd_iovec_stat, remote_filename_p,
	remote_bfd_open): New functions.
	(remote_hostio_send_command): Fail safely if remote connection
	is not set up.

	* solist.h (solib_open): Remove prototype.
	(solib_bfd_open): Add prototype.
	* solib.c: Include "remote.h".
	(solib_open): Remove, replace by ...
	(solib_bfd_open): ... this new function.  Handle remote BFDs.
	(solib_map_sections): Replace solib_open by solib_bfd_open.
	* solib-frv.c: Include "exceptions.h".
	(enable_break2): Replace solib_open by solib_bfd_open.
	* solib-svr4.c: Include "exceptions.h".
	(enable_break): Replace solib_open by solib_bfd_open.

	* symfile.c: Include "remote.h".
	(build_id_verify): Handle remote BFDs.
	(separate_debug_file_exists): Use BFD to access file.  Handle
	remote BFDs.
	(symfile_bfd_open): Handle remote BFDs.
	(reread_symbols): Handle remote BFDs.

	* NEWS: Mention "remote:" argument prefix to "set sysroot".

doc/ChangeLog:

	* gdb.texinfo (Commands to Specify Files): Document "remote:"
	argument prefix to "set sysroot".
2008-08-26 17:30:35 +00:00
Ulrich Weigand 1cf3db46a6 * gdbarch.sh (target_gdbarch): New global variable.
(deprecated_current_gdbarch_select_hack): Set it.
	* gdbarch.c, gdbarch.h: Regenerate.

	* arch-utils.c (gdbarch_update_p): Use target_gdbarch instead
	of current_gdbarch.
	* target-descriptions.c (target_find_description): Likewise.
	* arm-tdep.c (arm_update_current_architecture): Likewise.
	(show_fp_model, arm_show_abi, arm_show_fallback_mode,
	arm_show_force_mode): Likewise.
	* mips-tdep.c (show_mask_address, show_mipsfpu_command,
	show_mips_abi): Likewise.
	* mep-tdep.c (me_module_register_set, current_me_module): Likewise.

	* target.c (target_translate_tls_address): Use target_gdbarch
	instead of current_gdbarch.
	* remote.c (struct packet_reg): Likewise.
	(get_remote_arch_state, packet_reg_from_regnum,
	packet_reg_from_pnum, remote_check_symbols, remote_wait,
	remote_address_masked, remote_insert_breakpoint,
	remote_insert_hw_breakpoint, remote_read_description): Likewise.
	* remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise.
	* remote-mips.c (mips_open, mips_common_breakpoint): Likewise.
	* cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise.

	* solib.c (solib_open, solib_map_sections, solib_read_symbols,
	solib_add, info_sharedlibrary_command, solib_address,
	solib_create_inferior_hook, in_solib_dynsym_resolve_code,
	solib_global_lookup): Likewise.
	* solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise.
	* solib-irix.c (irix_current_sos, irix_open_symbol_file_object):
	Likewise.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Likewise.
	* solib-svr4.c (exec_entry_point, enable_break, svr4_free_so,
	set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets):
	Likewise.
	* nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix,
	nto_truncate_ptr): Likewise.
	* mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 17:21:29 +00:00
Vladimir Prus c6ebd6cf99 * target.c (target_async_permitted, target_async_permitted_1)
(set_maintenance_target_async_permitted)
        (show_maintenance_target_async_permitted): New.
        (initialize_targets): Register 'set target-async'.
        * target.h (target_async_permitted): Declare.
        * linux-nat.c (linux_nat_async_enabled)
        (linux_nat_async_permitted, set_maintenance_linux_async_permitted)
        (show_maintenance_linux_async_permitted): Remove.
        (sigchld_handler, linux_nat_is_async_p, linux_nat_can_async_p)
        (get_pending_events, linux_nat_async): Use target_async_permitted.
        (linux_nat_set_async_mode): Remove, moving the only used bits
        into...
        (linux_nat_setup_async): This.
        (_initialize_linux_nat): Do not register 'maint set linux-async'.
        Use linux_nat_setup_async.
        * remote.c (remote_async_permitted, remote_async_permitted_set)
        (set_maintenance_remote_async_permitted)
        (show_maintenance_remote_async_permitted): Remove.
        (remote_open_1, remote_terminal_inferior, remote_can_async_p)
        (remote_is_async_p): Use target_async_permitted.
        (_initialize_remote): Don't register 'main set remote-async'.
        * mi/mi-cmds.c (mi_cmds): Register -list-target-features.
        * mi/mi-cmds.h (mi_cmd_list_target_features): New.
        * mi/mi-main.c (mi_cmd_list_target_features): New.
2008-08-19 13:05:02 +00:00
Sandra Loosemore a6f3e723d3 gdb/doc/
2008-08-12  Sandra Loosemore  <sandra@codesourcery.com>

	* gdb.texinfo (Remote Configuration): Document set remote noack-packet.
	(Remote Protocol): Add Packet Acknowledgment to menu.
	(Overview): Mention +/- can be disabled, and point to new section
	where this is discussed in detail.
	(General Query Packets): Document QStartNoAckMode packet, and
	corresponding qSupported reply.
	(Packet Acknowledgment): New section.

gdb/
2008-08-12  Pedro Alves  <pedro@codesourcery.com>

	Add no-ack mode to the remote protocol --- optionally stop ACKing
	packets and responses when we have a reliable communication
	medium.

	Based on Apple's GDB, by Jason Molenda <jmolenda@apple.com>

	* remote.c (struct remote_state): Add noack_mode field.
	(PACKET_QStartNoAckMode): New.
	(remote_start_remote): Don't any outstanding packet here.
	(remote_open_1): Clear noack_mode.  Ack any outstanding packet
	here.  Activate noack mode if requested.
	(remote_protocol_features): Add QStartNoAckMode.
	(remote_open_1):
	(putpkt_binary): Don't send ack in noack mode.
	(read_frame): Don't recompute the checksum in noack mode.
	(getpkt_sane): Skip sending ack if in noack mode.
	(_initialize_remote): Add set/show remote noack mode.
	* NEWS:  Note the new features.

gdb/gdbserver/
2008-08-12  Pedro Alves  <pedro@codesourcery.com>

	* remote-utils.c (noack_mode, transport_is_reliable): New globals.
	(remote_open): Set or clear transport_is_reliable.
	(putpkt_binary): Don't expect acks in noack mode.
	(getpkt): Don't send ack/nac in noack mode.
	* server.c (handle_general_set): Handle QStartNoAckMode.
	(handle_query): If connected by tcp pass QStartNoAckMode+ in
	qSupported.
	(main): Reset noack_mode on every connection.
	* server.h (noack_mode): Declare.
2008-08-12 15:18:31 +00:00
Pedro Alves 60e569b986 * remote.c (remote_threads_extra_info): Don't query the remote
server about info on the internally added main thread.
2008-07-24 15:28:42 +00:00
Pedro Alves 94cc34afe2 Non-stop inferior control.
* infrun.c (resume): In non-stop mode, always resume just one
	thread.
	(proceed): Don't call prepare_to_proceed in non-stop mode.
	(fetch_inferior_event): In non-stop mode, switch context before
	handling the event.
	(error_is_running, ensure_not_running): New.
	(handle_inferior_event): In non-stop mode: Mark only the event
	thread as stopped.  Require that the target module manages adding
	threads to the thread list.  Assert that there isn't a
	deferred_step_ptid set.  Don't switch to infwait_thread_hop_state.
	(normal_stop): Only mark not-running if inferior hasn't exited.
	In non-stop mode, only mark the event thread.

	* thread.c:Include "cli/cli-decode.h".
	(print_thread_info): Don't read from a running thread.
	Output "(running)" if thread is running.
	(switch_to_thread): Don't read stop_pc if thread is executing.
	(do_restore_current_thread_cleanup): Don't write to a running
	thread.
	(thread_apply_all_command): Don't read from a running thread.  In
	non-stop mode, do a full context-switch instead of just switching
	threads.
	(thread_apply_command): In non-stop mode, do a full context-switch
	instead of just switching threads.
	(do_captured_thread_select): Likewise.  Inform user if selected
	thread is running.
	(_initialize_thread): Mark "info threads" and "thread" and
	async_ok.

	* inf-loop.c (inferior_event_handler): In non-stop mode, don't
	unregister the target from the event loop.

	* infcmd.c (continue_command, step_1, jump_command)
	(signal_command): Ensure the selected thread isn't running.
	(interrupt_target_command): In non-stop mode, interrupt only the
	selected thread.

	* inferior.h (error_is_running, ensure_not_running): Declare.

	* target.h (struct target_ops): Add ptid argument to the to_stop
	member.
	(target_stop): Add ptid_t argument.

	* target.c (update_current_target): Add ptid argument to to_stop's
	type.
	(debug_to_stop): Add ptid_t argument.
	(debug_to_rcmd): Set to_stop_ptid.

	* remote.c (remote_stop): Add ptid_t argument.
	(async_remote_interrupt): Add inferior_ptid to target_stop.
	* inf-ptrace.c (inf_ptrace_stop): Add ptid argument.

	* Makefile.in (thread.o): Depend on $(cli_decode_h).
2008-07-09 22:42:43 +00:00
Pedro Alves 8ea051c51f Add "executing" property to threads.
* inferior.h (target_executing): Delete.
	* gdbthread.h (struct thread_info): Add executing_ field.
	(set_executing, is_executing): New.
	* thread.c (main_thread_executing): New.
	(init_thread_list): Clear it and also main_thread_running.
	(is_running): Return false if target has no execution.
	(any_running, is_executing, set_executing): New.

	* top.c: Include "gdbthread.h".
	(target_executing): Delete.
	(execute_command): Replace target_executing check by any_running.
	* event-top.c: Include "gdbthread.h".
	(display_gdb_prompt, command_handler): Replace target_executing by
	is_running.
	* inf-loop.c: Include "gdbthread.h".  Don't mark as not executing
	here.  Replace target_executing by is_running.
	* infrun.c (handle_inferior_event): Mark all threads as
	not-executing.
	* linux-nat.c (linux_nat_resume): Don't mark thread as executing
	here.
	* stack.c (get_selected_block): Return null if inferior is
	executing.
	* target.c (target_resume): Mark resumed ptid as executing.
	* breakpoint.c (until_break_command): Replace target_executing
	check by is_executing.
	* remote.c (remote_async_resume): Don't mark inferior as executing
	here.
	* mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing
	by any_running.

	* mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute)
	(mi_execute_async_cli_command): Replace target_executing by
	is_running.

	* frame.c (get_current_frame): Error out if the current thread is
	executing.
	(has_stack_frames): New.
	(get_selected_frame, deprecated_safe_get_selected_frame): Check
	has_stack_frames.

	* Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on
	$(gdbthread_h).
2008-07-09 22:16:15 +00:00
Jonathan Larmour 7c0f6dcc1a * remote.c (remote_insert_breakpoint): Ensure that if Z0
unsupported and we fall back to memory_insert_breakpoint, we
        use the unmodified requested address.
2008-06-27 18:56:34 +00:00
Pedro Alves c0a2216eb3 * infrun.c (start_remote): Don't clear thread list here.
* monitor.c (monitor_open): Include "gdbthread.h".  Clear thread
	list here.
	* remote.c (record_currthread): Upgrade the main thread and its
	entry in the thread list if this is the first time we hear about
	threads.
	(remote_thread_alive): Consider magic_null_ptid or a ptid without
	a tid member always alive.
	(remote_find_new_threads): Don't update the main thread here.
	(remote_start_remote): Clear thread list here.  Always add the
	main thread.
	(extended_remote_attach_1): Add the main thread here.
	(extended_remote_mourn_1): Re-add the main thread here.
	(extended_remote_create_inferior_1): Add a main thread.

	* Makefile.in (monitor.o): Depend on $(gdbthread_h).
2008-06-27 11:54:21 +00:00
Pedro Alves 79d7f22901 Use ptid_t.tid to store thread ids instead of ptid_t.pid.
* remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): New
	globals.
	(general_thread, continue_thread): Change type to ptid_t.
	(record_currthread): Take a ptid_t parameter instead of an
	integer.
	(MAGIC_NULL_PID): Delete.
	(set_thread): Take a ptid_t parameter and adjust.
	(set_general_thread, set_continue_thread): New.
	(remote_thread_alive, remote_newthread_step)
	(remote_current_thread, remote_find_new_threads)
	(remote_threads_info, remote_start_remote, remote_vcont_resume)
	(remote_resume_1, remote_wait, extended_remote_create_inferior_1)
	(threadalive_test, remote_pid_to_str)
	(remote_get_thread_local_address): Adjust.
	(_initialize_remote): Initialize magic_null_ptid, not_sent_ptid
	and any_thread_ptid.
2008-06-27 11:31:40 +00:00
Pedro Alves 060871df59 * NEWS: Mention support removal of undocumented S AA p PID stop
reply packet.

	* remote.c (remote_wait): Remove undocumented S AA p PID support.
2008-06-11 12:56:36 +00:00
Doug Evans b4f62b573f * remote.c (remote_wait): Include beginning of malformed packet
in error output.
2008-06-09 20:43:48 +00:00
Pedro Alves 75c9938534 Replace 'target async' by 'maintenance set remote-async' and
'target remote' combination.

	* remote.c (remote_async_wait): Merge into remote_wait, and
	remove.
	(remote_async_permitted, remote_async_permitted_set): New
	variables.
	(set_maintenance_remote_async_permitted)
	(show_maintenance_remote_async_permitted): New functions.
	(remote_async_ops, extended_async_remote_ops): Delete.
	(remote_async_open, extended_remote_async_open): Delete.
	(remote_open_1): Drop async_p parameter.  Update callers.  Replace
	async_p with remote_async_permitted checks.
	(extended_async_remote_attach): Delete.
	(remote_resume, remote_async_resume): Merge and leave remote_resume.
	(remote_async_terminal_inferior): Rename to...
	(remote_terminal_inferior): ... this, and add
	remote_async_termitted check.
	(remote_async_terminal_ours): Rename to...
	(remote_terminal_ours): ... this, and add remote_async_termitted
	check.
	(remote_wait, remote_async_wait): Merge and leave remote_wait
	only.
	(remote_kill, remote_async_kill): Merge and leave remote_kill
	only.
	(remote_async_mourn, extended_async_remote_mourn): Delete.
	(extended_remote_create_inferior_1): Drop async_p parameter.
	Update callers.  Always use extended_remote_ops.
	(extended_remote_async_create_inferior): Delete.
	(remote_return_zero): Delete.
	(init_remote_ops): Register remote_can_async_p, remote_async,
	remote_async_mask, remote_terminal_inferior and
	remote_terminal_ours.
	(remote_can_async_p, remote_is_async_p): Check for
	remote_async_permitted.
	(init_remote_async_ops, init_extended_async_remote_ops): Remove.
	(set_remote_cmd): Don't add async and extended-async targets.
	(_initialize_remote): Add set/show remote-async maintenance
	commands.

	gdb/doc/
	* gdb.texinfo (-target-select): Remove reference to target async.
	(Maintenance Commands): Document "maint set/show remote-async".
2008-06-05 21:35:00 +00:00
Pedro Alves cf30943b93 * remote.c (kill_kludge): Delete.
(remote_wait, remote_async_wait): Don't set it.
	(remote_kill, remote_async_kill): Don't do anything with it.
2008-06-05 21:13:58 +00:00
Daniel Jacobowitz 8d38543126 * remote.c (get_offsets): Handle a single segment.
* symfile.c (symfile_map_offsets_to_segments): Allow more bases
	than segments.
2008-06-05 16:17:54 +00:00
Pedro Alves 39237dd126 * remote.c (init_extended_remote_ops): Fix typo. 2008-05-17 11:28:30 +00:00
Doug Evans 10e0fa18cb * remote.c (remote_search_memory): Fix capilization in error messages. 2008-05-09 17:45:58 +00:00
Doug Evans 08388c79d5 New "find" command.
* NEWS: Document find command and qSearch:memory packet.
	* Makefile.in (SFILES): Add findcmd.c.
	(COMMON_OBJS): Add findcmd.o.
	(findcmd.o): New rule.
	* findcmd.c: New file.
	* target.h (target_ops): New member to_search_memory.
	(simple_search_memory): Declare.
	(target_search_memory): Declare.
	* target.c (simple_search_memory): New fn.
	(target_search_memory): New fn.
	* remote.c (PACKET_qSearch_memory): New packet kind.
	(remote_search_memory): New fn.
	(init_remote_ops): Init to_search_memory.
	(init_extended_remote_ops): Ditto.
	(_initialize_remote): Add qSearch:memory packet config command.

	* gdbserver/server.h (decode_search_memory_packet): Declare.
	* gdbserver/remote-utils.c (decode_search_memory_packet): New fn.
	* gdbserver/server.c (handle_search_memory_1): New fn.
	(handle_search_memory): New fn.
	(handle_query): Process qSearch:memory packets.

	* doc/gdb.texinfo: Document "find" command, qSearch:memory packet.

	* testsuite/gdb.base/find.exp: New file.
	* testsuite/gdb.base/find.c: New file.
2008-05-09 17:02:03 +00:00
Ulrich Weigand 96ef33845a * remote.c (extended_remote_attach_1): Call target_find_description. 2008-05-08 19:48:55 +00:00
Daniel Jacobowitz 45280a5259 * remote.c (extended_remote_create_inferior_1): Clean up
before marking the target running.
2008-05-08 16:08:10 +00:00
Jie Zhang 4fff24118a * remote.c (remote_insert_breakpoint): Call get_remote_state
after gdbarch_breakpoint_from_pc is called.
	(remote_insert_hw_breakpoint): Likewise.
2008-05-07 11:54:41 +00:00