Commit Graph

172 Commits

Author SHA1 Message Date
Vladimir Prus dc146f7c09 Implement core awareness.
* bcache.c (compare_ints): Remove
	(print_percentage): Use compare_positive_ints.
	* defs.h (compare_positive_ints): Declare.
	* linux-nat.h (struct lin_lwp): New field core.
	(linux_nat_core_of_thread_1): Declare.
	* linux-nat.c (add_lwp): Init the 'core' field.
	(linux_nat_wait_1): Record the core.
	(linux_nat_core_of_thread_1, linux_nat_core_of_thread): New.
	(linux_nat_add_target): Register the above.
	* linux-thread-db.c (update_thread_core): New.
	(thread_db_find_new_threads): Update core information for
	every thread.
	* remote.c (struct private_thread_info): New.
	(free_private_thread_info, demand_private_info): New.
	(PACKET_qXfer_threads, use_osdata_threads): New.
	(struct thread_item, threads_parsing_context
	(start_thread, end_thread, thread_attributes)
	(thread_children, threads_children, threads_elements): New.
	(remote_threads_info): Try qXfer:threads before anything
	else.
	(remote_protocol_packets): Register qXfer:threads.
	(remote_open_1): Init use_osdata_threads.
	(struct stop_reply): New field 'core'.
	(remote_parse_stop_reply): Parse core number.
	(process_stop_reply): Record core number.
	(remote_xfer_partial): Handle qXfer:threads.
	(remote_core_of_thread): New.
	(init_remote_ops): Register remote_core_of_thread.
	(_initialize_remote): Register qXfer:read.
	* target.c (target_core_of_thread): New
	* target.h (enum target_object): New value TARGET_OBJECT_THREADS.
	(struct target_ops): New field to_core_of_threads.
	(target_core_of_thread): Declare.
	* gdbthread.h (struct thread_info): New field private_dtor.
	* thread.c (print_thread_info): Report the core.
	* ui-out.c (MAX_UI_OUT_LEVELS): Increase.
	* utils.c (compare_positive_ints): New.
	* features/threads.dtd: New.
	* mi/mi-interp.c (mi_on_normal_stop): Report the core.
	* mi/mi-main.c (struct collect_cores_data, collect_cores)
	(do_nothing, free_vector_of_osdata_items)
	(splay_tree_int_comparator, free_splay_tree): New.
	(print_one_inferior_data): Implemented printing of selected
	inferiors.  Collect and print cores.
	(output_cores): New.
	(mi_cmd_list_thread_groups): Support --recurse.  Permit specifying
	thread groups together with --available.
2010-01-12 21:40:25 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Doug Evans 957f3f49de * linux-low.c: Delete inclusion of ansidecl.h, elf/common.h,
elf/external.h.  Include <elf.h> instead but only if necessary.
2009-12-28 19:45:56 +00:00
Pedro Alves ca5c370d27 * linux-low.c (linux_remove_process): Remove `detaching'
parameter.  Don't release/detach from thread_db here.
	(linux_kill): Release/detach from thread_db here, ...
	(linux_detach): ... and here, before actually detaching.
	(linux_wait_1): ... and here, when a process exits.
	* thread-db.c (any_thread_of): New.
	(thread_db_free): Switch the current inferior to a thread of the
	passed in process.
2009-12-28 16:09:27 +00:00
Doug Evans c5f62d5ff9 gdb/
* linux-nat.c (kill_lwp): Minor cleanup, move definition of
	tkill_failed into ifdef HAVE_TKILL_SYSCALL.  Move setting of errno
	there too.  Delete unnecessary resetting of errno after syscall.
	Minor comment changes to match gdbserver/linux-low.c:kill_lwp.

	gdbserver/
	* linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill.
	Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc
	warning ifndef __NR_tkill.  Move setting of errno there too.
	Delete unnecessary resetting of errno after syscall.
	Minor comment changes to match gdb/linux-nat.c:kill_lwp.
2009-12-21 21:23:43 +00:00
Doug Evans 4ee62156d9 * linux-low.c (my_waitpid): Delete unnecessary prototype. 2009-12-21 17:54:03 +00:00
Doug Evans 07d4f67e9d * linux-low.c (my_waitpid): Move definition away from being in
between linux_tracefork_child/linux_test_for_tracefork.
2009-12-19 01:16:23 +00:00
Doug Evans 1de1badb7a * linux-low.c (linux_read_memory): Fix argument to read. 2009-12-16 21:23:34 +00:00
Pedro Alves fd7dd3e67a * linux-low.c (linux_remove_process): Add `detaching' parameter.
Pass it to thread_db_free.
	(linux_kill, linux_detach, linux_wait_1): Adjust to pass the
	proper `detaching' argument to linux_remove_process.
	* linux-low.h (thread_db_free): Add `detaching' parameter.
	* thread-db.c (thread_db_init): Pass false as `detaching' argument
	to thread_db_free.
	(thread_db_free): Add `detaching' parameter.  Only
	call td_ta_clear_event if detaching from process.
2009-11-16 18:15:05 +00:00
Paul Pluzhnikov cdbfd4198e doc/
2009-10-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.texinfo (Server): Document libthread-db-search-path.

gdbserver/
2009-10-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* acinclude.m4: (SRV_CHECK_THREAD_DB, SRV_CHECK_TLS_GET_ADDR): Remove.
	* configure.ac: Adjust.
	* linux-low.h (struct process_info_private): Move members to struct
	thread_db.
	(thread_db_free, thread_db_handle_monitor_command): New prototype.
	* linux-low.c (linux_remove_process): Adjust.
	(linux_wait_for_event_1, linux_look_up_symbols): Likewise.
	* server.c (handle_query): Move code ...
	(handle_monitor_command): ... here. New function.
	* target.h (struct target_ops): New member.
	* thread-db.c (struct thread_db): New.
	(libthread_db_search_path): New variable.
	(thread_db_create_event, thread_db_enable_reporting)
	(find_one_thread, maybe_attach_thread, find_new_threads_callback)
	(thread_db_find_new_threads, (thread_db_get_tls_address): Adjust.
	(try_thread_db_load_1, dladdr_to_soname): New functions.
	(try_thread_db_load, thread_db_load_search): New functions.
	(thread_db_init): Search for libthread_db.
	(thread_db_free): New function.
	(thread_db_handle_monitor_command): Likewise.
	* config.in: Regenerate.
	* configure: Regenerate.
2009-10-09 00:31:01 +00:00
Ulrich Weigand efcbbd1428 ChangeLog:
* linux-nat.c: Include <sys/vfs.h>.
	(SPUFS_MAGIC): Define.
	(spu_enumerate_spu_ids): New function.
	(linux_proc_xfer_spu): New function.
	(linux_xfer_partial): Handle TARGET_OBJECT_SPU.

	(iterate_over_spus): New function.
	(struct linux_spu_corefile_data): New data type.
	(linux_spu_corefile_callback): New function.
	(linux_spu_make_corefile_notes): New function.
	(linux_nat_make_corefile_notes): Call it.

	* corelow.c (struct spuid_list): New data type.
	(add_to_spuid_list): New function.
	(core_xfer_partial): Handle TARGET_OBJECT_SPU.

gdbserver/ChangeLog:

	* linux-low.c: Include <sys/stat.h> and <sys/vfs.h>.
	(SPUFS_MAGIC): Define.
	(spu_enumerate_spu_ids): New function.
	(linux_qxfer_spu): New function.
	(linux_target_ops): Install linux_qxfer_spu.
2009-07-31 15:25:22 +00:00
Daniel Jacobowitz 58d6951de5 * NEWS: Mention ARM VFP support.
* target-descriptions.c (tdesc_register_type): Make public.
	(tdesc_unnumbered_register): New function.
	(tdesc_register_reggroup_p): Allow missing
	pseudo_register_reggroup_p.
	* target-descriptions.h (tdesc_register_type): Declare.
	(tdesc_unnumbered_register): Declare.
	* arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions.
	(arm_push_dummy_call): Use arm_neon_quad_write.
	(arm_neon_double_type, arm_neon_quad_type): New functions.
	(arm_register_type): Handle VFP and NEON registers.  Override the
	types of double-precision registers for NEON.  Disable FPA registers
	if they are not present.
	(arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers.
	(arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read.
	(arm_register_name): Handle VFP single and NEON quad registers.
	(arm_pseudo_read, arm_pseudo_write): New functions.
	(arm_gdbarch_init): Check for VFP and NEON in the target description.
	Assign numbers to double-precision registers.  Register VFP and NEON
	pseudo registers.  Remove a shadowed "i" variable.
	* arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and
	ARM_D31_REGNUM.
	(struct gdbarch_tdep): Add have_neon_pseudos, have_neon,
	have_vfp_registers, have_vfp_pseudos, neon_double_type,
	and neon_quad_type.

	* features/Makefile: Make expedite settings only architecture
	specific.
	(WHICH): Add new ARM descriptions.
	* features/arm-with-neon.xml, features/arm-with-vfpv2.c,
	features/arm-with-vfpv3.c, features/arm-vfpv2.xml,
	features/arm-vfpv3.xml, features/arm-with-vfpv2.xml,
	features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files.
	* regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat,
	regformats/arm-with-vfpv3.dat: Generate.

	doc/
	* gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and
	org.gnu.gdb.arm.neon.

	gdbserver/
	* linux-low.c (linux_write_memory): Update debugging output.
	* Makefile.in (clean): Add new descriptions.
	(arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o)
	(arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules.
	* configure.srv: Add new files for arm*-*-linux*.
	* linux-arm-low.c: Add new declarations.
	(PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined.
	(arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3)
	(HWCAP_VFPv3D16): New.
	(arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT
	instead of __IWMMXT__.
	(arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap)
	(arm_arch_setup): New.
	(target_regsets): Remove #ifdef.  Add VFP regset.
	(the_low_target): Use arm_arch_setup.

	testsuite/
	* gdb.base/float.exp: Handle VFP registers.
2009-07-28 18:26:51 +00:00
Daniel Jacobowitz 12b42a1250 * linux-low.c (linux_kill_one_lwp): Adjust kernel workaround to skip
the main thread again.
2009-07-28 17:44:29 +00:00
Doug Evans aa5ca48fad Add h/w watchpoint support to x86-linux, win32-i386.
* Makefile.in (SFILES): Add i386-low.c
	(i386_low_h): Define.
	(i386-low.o): Add dependencies.
	(linux-x86-low.o): Add i386-low.h dependency.
	(win32-i386-low.o): Ditto.
	* i386-low.c: New file.
	* i386-low.h: New file.
	* configure.srv (i[34567]86-*-cygwin*): Add i386-low.o to srv_tgtobj.
	(i[34567]86-*-linux*, i[34567]86-*-mingw*, x86_64-*-linux*): Ditto.
	* linux-low.c (linux_add_process): Initialize arch_private.
	(linux_remove_process): Free arch_private.
	(add_lwp): Initialize arch_private.
	(delete_lwp): Free arch_private.
	(linux_resume_one_lwp): Call the_low_target.prepare_to_resume if
	provided.
	* linux-low.h (process_info_private): New member arch_private.
	(lwp_info): New member arch_private.
	(linux_target_ops): New members new_process, new_thread,
	prepare_to_resume.
	(ptid_of): New macro.
	* linux-x86-low.c: Include stddef.h, i386-low.h.
	(arch_process_info): New struct.
	(arch_lwp_info): New struct.
	(x86_linux_dr_get, x86_linux_dr_set): New functions.
	(i386_dr_low_set_addr, i386_dr_low_set_control): New functions.
	(i386_dr_low_get_status): New function.
	(x86_insert_point, x86_remove_point): New functions.
	(x86_stopped_by_watchpoint): New function.
	(x86_stopped_data_address): New function.
	(x86_linux_new_process, x86_linux_new_thread): New functions.
	(x86_linux_prepare_to_resume): New function.
	(the_low_target): Add entries for insert_point, remove_point,
	stopped_by_watchpoint, stopped_data_address, new_process, new_thread,
	prepare_to_resume.
	* server.c (debug_hw_points): New global.
	(monitor_show_help): Document set debug-hw-points.
	(handle_query): Process "set debug-hw-points".
	* server.h (debug_hw_points): Declare.
	(paddress): Declare.
	* utils.c (NUMCELLS, CELLSIZE): New macros.
	(get_sell, xsnprintf, paddress): New functions.
	* win32-arm-low.c (the_low_target): Add entries for insert_point,
	remove_point, stopped_by_watchpoint, stopped_data_address.
	* win32-i386-low.c: Include i386-low.h.
	(debug_reg_state): Replaces dr.
	(i386_dr_low_set_addr, i386_dr_low_set_control): New functions.
	(i386_dr_low_get_status): New function.
	(i386_insert_point, i386_remove_point): New functions.
	(i386_stopped_by_watchpoint): New function.
	(i386_stopped_data_address): New function.
	(i386_initial_stuff): Update.
	(get_thread_context,set_thread_context,i386_thread_added): Update.
	(the_low_target): Add entries for insert_point,
	remove_point, stopped_by_watchpoint, stopped_data_address.
	* win32-low.c (win32_insert_watchpoint): New function.
	(win32_remove_watchpoint): New function.
	(win32_stopped_by_watchpoint): New function.
	(win32_stopped_data_address): New function.
	(win32_target_ops): Add entries for insert_watchpoint,
	remove_watchpoint, stopped_by_watchpoint, stopped_data_address.
	* win32-low.h (win32_target_ops): New members insert_point,
	remove_point, stopped_by_watchpoint, stopped_data_address.
2009-06-30 16:35:25 +00:00
Pedro Alves d993e290c9 * server.c (process_serial_event): Re-return unsupported, not
error, if the type isn't recognized.  Re-allow supporting only
	insert or remove packets.  Also call require_running for
	breakpoints.  Add missing break statement to default case.  Tidy.
	* target.h (struct target_ops): Rename insert_watchpoint to
	insert_point, and remove_watchpoint to remove_point.

	* linux-low.h (struct linux_target_ops): Likewise.
	* linux-low.c (linux_insert_watchpoint): Rename to ...
	(linux_insert_point): ... this.  Adjust.
	(linux_remove_watchpoint): Rename to ...
	(linux_remove_point): ... this.  Adjust.
	(linux_target_ops): Adjust.
	* linux-crisv32-low.c (cris_insert_watchpoint): Rename to ...
	(cris_insert_point): ... this.
	(cris_remove_watchpoint): Rename to ...
	(cris_remove_point): ... this.
	(the_low_target): Adjust.
2009-06-25 22:13:53 +00:00
Aleksandar Ristovski 4463ce244d * linux-low.c (usr_fetch_inferior_registers): Remove check for regno 0.
* proc-service.c (ps_lgetregs): Pass -1 to fetch all registers.
	* regcache.c (get_regcache): Likewise.
	* spu-low.c (spu_fetch_registers): Remove 0 to -1 conversion.
	* win32-low.c (child_fetch_inferior_registers): Remove check for
	regno 0.
2009-06-22 19:33:41 +00:00
Pedro Alves cf8fd78b38 2009-06-19 Aleksandar Ristovski <aristovski@qnx.com>
Pedro Alves <pedro@codesourcery.com>

	* target.h (struct target_ops) <supports_multi_process>: New
	callback.
	(target_supports_multi_process): New.
	* server.c (handle_query): Even if GDB reports support, only
	enable multi-process if the target also supports it.  Report
	multi-process support only if the target backend supports it.
	* linux-low.c (linux_supports_multi_process): New function.
	(linux_target_ops): Install it as target_supports_multi_process
	callback.
2009-06-19 13:35:35 +00:00
Doug Evans e27d73f6b0 * linux-low.c (handle_extended_wait): Use linux_resume_one_lwp
to resume the newly created thread, don't call ptrace (PTRACE_CONT)
	directly.
2009-05-24 17:44:19 +00:00
Doug Evans 47c0c97542 * linux-low.c (get_stop_pc): Print pc if debug_threads.
(check_removed_breakpoint, linux_wait_for_lwp): Ditto.
	(linux_resume_one_lwp): Ditto.
2009-05-24 17:37:34 +00:00
Doug Evans 2acc282a5a * linux-low.c (linux_resume_one_lwp): Change type of first arg
from struct inferior_list_entry * to struct lwp_info *.
	All callers updated.
2009-05-24 01:09:22 +00:00
Doug Evans 3da9440a2c (linux_test_for_tracefork): Back out turd from previous check-in. 2009-05-13 17:17:22 +00:00
Doug Evans d0722149ad Biarch support for i386/amd64 gdbserver.
* Makefile.in (SFILES): Remove linux-i386-low.c, linux-x86-64-low.c.
	Add linux-x86-low.c.
	(linux-i386-low.o, linux-x86-64-low.o): Delete.
	(linux-x86-low.o): Add.
	* linux-x86-64-low.c: Delete.
	* linux-i386-low.c: Delete.
	* linux-x86-low.c: New file.
	* configure.srv (i?86-linux srv_tgtobj): Replace linux-i386-low.o with
	linux-x86-low.o.
	(x86_64-linux srv_tgtobj): Replace linux-x86-64-low.o with
	linux-x86-low.o.
	(x86_64-linux srv_regobj): Add reg-i386-linux.o.
	* linux-low.c: Include ansidecl.h, elf/common.h, elf/external.h.
	(linux_child_pid_to_exec_file): New function.
	(elf_64_header_p, elf_64_file_p): New functions.
	(siginfo_fixup): New function.
	(linux_xfer_siginfo): New local inf_siginfo.  Call siginfo_fixup to
	give target a chance to convert layout.
	* linux-low.h (linux_target_ops): New member siginfo_fixup.
	(linux_child_pid_to_exec_file, elf_64_file_p): Declare.
2009-05-12 22:25:00 +00:00
Doug Evans fdeb2a1249 * linux-low.c (regsets_fetch_inferior_registers): Fix memory leak.
(regsets_store_inferior_registers): Ditto.
2009-05-07 23:29:25 +00:00
Pedro Alves a6dbe5dfa5 PR server/10048
* linux-low.c (must_set_ptrace_flags): Delete.
	(linux_create_inferior): Set `lwp->must_set_ptrace_flags' instead
	of the global.
	(linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here.  Set
	`lwp->must_set_ptrace_flags' instead.
	(linux_wait_for_event_1): If ptrace options here.
	(linux_wait_1): ... not here.
2009-05-06 17:32:59 +00:00
Doug Evans 5091eb23aa * inferiors.c (remove_process): Fix memory leak, free process.
* linux-low.c (linux_remove_process): New function.
	(linux_kill): Call it instead of remove_process.
	(linux_detach, linux_wait_1): Ditto.
2009-04-30 18:35:55 +00:00
Pedro Alves 55ac2b9961 * linux-low.c (usr_store_inferior_registers): Declare local `pid'
variable.
2009-04-03 11:40:02 +00:00
Pedro Alves 95954743cb 2009-04-01 Pedro Alves <pedro@codesourcery.com>
Implement the multiprocess extensions, and add linux multiprocess
	support.

	* server.h (ULONGEST): Declare.
	(struct ptid, ptid_t): New.
	(minus_one_ptid, null_ptid): Declare.
	(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
	(ptid_get_tid, ptid_equal, ptid_is_pid): Declare.
	(struct inferior_list_entry): Change `id' type from unsigned from
	to ptid_t.
	(struct sym_cache, struct breakpoint, struct
	process_info_private): Forward declare.
	(struct process_info): Declare.
	(current_process): Declare.
	(all_processes): Declare.
	(initialize_inferiors): Declare.
	(add_thread): Adjust to use ptid_t.
	(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): Ditto.
	(add_process, remove_process, find_thread_pid): Declare.
	(find_inferior_id): Adjust to use ptid_t.
	(cont_thread, general_thread, step_thread): Change type to ptid_t.
	(multi_process): Declare.
	(push_event): Adjust to use ptid_t.
	(read_ptid, write_ptid): Declare.
	(prepare_resume_reply): Adjust to use ptid_t.
	(clear_symbol_cache): Declare.
	* inferiors.c (all_processes): New.
	(null_ptid, minus_one_ptid): New.
	(ptid_build, pid_to_ptid, ptid_get_pid, ptid_get_lwp)
	(ptid_get_tid, ptid_equal, ptid_is_pid): New.
	(add_thread): Change unsigned long to ptid.  Remove gdb_id
	parameter.  Adjust.
	(thread_id_to_gdb_id, thread_to_gdb_id): Change unsigned long to ptid.
	(gdb_id_to_thread): Rename to ...
	(find_thread_pid): ... this.  Change unsigned long to ptid.
	(gdb_id_to_thread_id, find_inferior_id): Change unsigned long to ptid.
	(loaded_dll, pull_pid_from_list): Adjust.
	(add_process, remove_process, find_process_pid)
	(get_thread_process, current_process, initialize_inferiors): New.
	* target.h (struct thread_resume) <thread>: Change type to ptid_t.
	(struct target_waitstatus) <related_pid>: Ditto.
	(struct target_ops) <kill, detach>: Add `pid' argument.  Change
	return type to int.
	(struct target_ops) <join>: Add `pid' argument.
	(struct target_ops) <thread_alive>: Change pid's type to ptid_t.
	(struct target_ops) <wait>: Add `ptid' field.  Change return type
	to ptid.
	(kill_inferior, detach_inferior, join_inferior): Add `pid' argument.
	(mywait): Add `ptid' argument.  Change return type to ptid_t.
	(target_pid_to_str): Declare.
	* target.c (set_desired_inferior): Adjust to use ptids.
	(mywait): Add new `ptid' argument.  Adjust.
	(target_pid_to_str): New.
	* mem-break.h (free_all_breakpoints): Declare.
	* mem-break.c (breakpoints): Delelete.
	(set_breakpoint_at, delete_breakpoint, find_breakpoint_at)
	(check_mem_read, check_mem_write, delete_all_breakpoints): Adjust
	to use per-process breakpoint list.
	(free_all_breakpoints): New.
	* remote-utils.c (struct sym_cache) <name>: Drop `const'.
	(symbol_cache, all_symbols_looked_up): Delete.
	(hexchars): New.
	(ishex, unpack_varlen_hex, write_ptid, hex_or_minus_one,
	read_ptid): New.
	(prepare_resume_reply): Change ptid argument's type from unsigned
	long to ptid_t.  Adjust.  Implement W;process and X;process.
	(free_sym_cache, clear_symbol_cache): New.
	(look_up_one_symbol): Adjust to per-process symbol cache.  *
	* server.c (cont_thread, general_thread, step_thread): Change type
	to ptid_t.
	(attached): Delete.
	(multi_process): New.
	(last_ptid): Change type to ptid_t.
	(struct vstop_notif) <ptid>: Change type to ptid_t.
	(queue_stop_reply, push_event): Change `ptid' argument's type to
	ptid_t.
	(discard_queued_stop_replies): Add `pid' argument.
	(start_inferior): Adjust to use ptids.  Adjust to mywait interface
	changes.  Don't reference the `attached' global.
	(attach_inferior): Adjust to mywait interface changes.
	(handle_query): Adjust to use ptids.  Parse GDB's qSupported
	features.  Handle and report "multiprocess+".  Handle
	"qAttached:PID".
	(handle_v_cont): Adjust to use ptids.  Adjust to mywait interface
	changes.
	(handle_v_kill): New.
	(handle_v_stopped): Adjust to use target_pid_to_str.
	(handle_v_requests): Allow multiple attaches and runs when
	multiprocess extensions are in effect.  Handle "vKill".
	(myresume): Adjust to use ptids.
	(queue_stop_reply_callback): Add `arg' parameter.  Handle it.
	(handle_status): Adjust to discard_queued_stop_replies interface
	change.
	(first_thread_of, kill_inferior_callback)
	(detach_or_kill_inferior_callback, join_inferiors_callback): New.
	(main): Call initialize_inferiors.  Adjust to use ptids, killing
	and detaching from all inferiors.  Handle multiprocess packet
	variants.
	* linux-low.h: Include gdb_proc_service.h.
	(struct process_info_private): New.
	(struct linux_target_ops) <pid_of>: Use ptid_get_pid.
	<lwpid_of>: Use ptid_get_lwp.
	(get_lwp_thread): Adjust.
	(struct lwp_info): Add `dead' member.
	(find_lwp_pid): Declare.
	* linux-low.c (thread_db_active): Delete.
	(new_inferior): Adjust comment.
	(inferior_pid): Delete.
	(linux_add_process): New.
	(handle_extended_wait): Adjust.
	(add_lwp): Change unsigned long to ptid.
	(linux_create_inferior): Add process to processes table.  Adjust
	to use ptids.  Don't set new_inferior here.
	(linux_attach_lwp): Rename to ...
	(linux_attach_lwp_1): ... this.  Add `initial' argument.  Handle
	it.  Adjust to use ptids.
	(linux_attach_lwp): New.
	(linux_attach): Add process to processes table.  Don't set
	new_inferior here.
	(struct counter): New.
	(second_thread_of_pid_p, last_thread_of_process_p): New.
	(linux_kill_one_lwp): Add `args' parameter.  Handle it.  Adjust to
	multiple processes.
	(linux_kill): Add `pid' argument.  Handle it.  Adjust to multiple
	processes.  Remove process from process table.
	(linux_detach_one_lwp): Add `args' parameter.  Handle it.  Adjust
	to multiple processes.
	(any_thread_of): New.
	(linux_detach): Add `pid' argument, and handle it.  Remove process
	from processes table.
	(linux_join): Add `pid' argument.  Handle it.
	(linux_thread_alive): Change unsighed long argument to ptid_t.
	Consider dead lwps as not being alive.
	(status_pending_p): Rename `dummy' argument to `arg'.  Filter out
	threads we're not interested in.
	(same_lwp, find_lwp_pid): New.
	(linux_wait_for_lwp): Change `pid' argument's type from int to
	ptid_t.  Adjust.
	(linux_wait_for_event): Rename to ...
	(linux_wait_for_event_1): ... this.  Change `pid' argument's type
	from int to ptid_t.  Adjust.
	(linux_wait_for_event): New.
	(linux_wait_1): Add `ptid' argument.  Change return type to
	ptid_t.  Adjust.  Use last_thread_of_process_p.  Remove processes
	that exit from the process table.
	(linux_wait): Add `ptid' argument.  Change return type to ptid_t.
	Adjust.
	(mark_lwp_dead): New.
	(wait_for_sigstop): Adjust to use ptids.  If a process exits while
	stopping all threads, mark its main lwp as dead.
	(linux_set_resume_request, linux_resume_one_thread): Adjust to use
	ptids.
	(fetch_register, usr_store_inferior_registers)
	(regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers, linux_read_memory)
	(linux_write_memory): Inline `inferior_pid'.
	(linux_look_up_symbols): Adjust to use per-process
	`thread_db_active'.
	(linux_request_interrupt): Adjust to use ptids.
	(linux_read_auxv): Inline `inferior_pid'.
	(initialize_low): Don't reference thread_db_active.
	* gdb_proc_service.h (struct ps_prochandle) <pid>: Remove.
	* proc-service.c (ps_lgetregs): Use find_lwp_pid.
	(ps_getpid): Return the pid of the current inferior.
	* thread-db.c (proc_handle, thread_agent): Delete.
	(thread_db_create_event, thread_db_enable_reporting): Adjust to
	per-process data.
	(find_one_thread): Change argument type to ptid_t.  Adjust to
	per-process data.
	(maybe_attach_thread): Adjust to per-process data and ptids.
	(thread_db_find_new_threads): Ditto.
	(thread_db_init): Ditto.
	* spu-low.c (spu_create_inferior, spu_attach): Add process to
	processes table.  Adjust to use ptids.
	(spu_kill, spu_detach): Adjust interface.  Remove process from
	processes table.
	(spu_join, spu_thread_alive): Adjust interface.
	(spu_wait): Adjust interface.  Remove process from processes
	table.  Adjust to use ptids.
	* win32-low.c (current_inferior_tid): Delete.
	(current_inferior_ptid): New.
	(debug_event_ptid): New.
	(thread_rec): Take a ptid.  Adjust.
	(child_add_thread): Add `pid' argument.  Adjust to use ptids.
	(child_delete_thread): Ditto.
	(do_initial_child_stuff): Add `attached' argument.  Add process to
	processes table.
	(child_fetch_inferior_registers, child_store_inferior_registers):
	Adjust.
	(win32_create_inferior): Pass 0 to do_initial_child_stuff.
	(win32_attach): Pass 1 to do_initial_child_stuff.
	(win32_kill): Adjust interface.  Remove process from processes
	table.
	(win32_detach): Ditto.
	(win32_join): Adjust interface.
	(win32_thread_alive): Take a ptid.
	(win32_resume): Adjust to use ptids.
	(get_child_debug_event): Ditto.
	(win32_wait): Adjust interface.  Remove exiting process from
	processes table.
2009-04-01 22:50:24 +00:00
Pedro Alves bd99dc8583 Non-stop mode support.
* server.h (non_stop): Declare.
	(gdb_client_data, handler_func): Declare.
	(delete_file_handler, add_file_handler, start_event_loop):
	Declare.
	(handle_serial_event, handle_target_event, push_event)
	(putpkt_notif): Declare.
	* target.h (enum resume_kind): New.
	(struct thread_resume): Replace `step' field by `kind' field.
	(TARGET_WNOHANG): Define.
	(struct target_ops) <wait>: Add `options' argument.
	<supports_non_stop, async, start_non_stop>: New fields.
	(target_supports_non_stop, target_async): New.
	(start_non_stop): Declare.
	(mywait): Add `options' argument.
	* target.c (mywait): Add `options' argument.  Print child exit
	notifications here.
	(start_non_stop): New.
	* server.c (non_stop, own_buf, mem_buf): New globals.
	(struct vstop_notif): New.
	(notif_queue): New global.
	(queue_stop_reply, push_event, discard_queued_stop_replies)
	(send_next_stop_reply): New.
	(start_inferior): Adjust to use resume_kind.  Adjust to mywait
	interface changes.
	(attach_inferior): In non-stop mode, don't wait for the target
	here.
	(handle_general_set): Handle QNonStop.
	(handle_query): When handling qC, return the current general
	thread, instead of the first thread of the list.
	(handle_query): If the backend supports non-stop mode, include
	QNonStop+ in the qSupported query response.
	(handle_v_cont): Adjust to use resume_kind.  Handle resume_stop
	and non-stop mode.
	(handle_v_attach, handle_v_run): Handle non-stop mode.
	(handle_v_stopped): New.
	(handle_v_requests): Report support for vCont;t.  Handle vStopped.
	(myresume): Adjust to use resume_kind.  Handle non-stop.
	(queue_stop_reply_callback): New.
	(handle_status): Handle non-stop mode.
	(main): Clear non_stop flag on reconnection.  Use the event-loop.
	Refactor serial protocol handling from here ...
	(process_serial_event): ... to this new function.  When GDB
	selects any thread, select one here.  In non-stop mode, wait until
	GDB acks all pending events before exiting.
	(handle_serial_event, handle_target_event): New.
	* remote-utils.c (remote_open): Install remote_desc in the event
	loop.
	(remote_close): Remove remote_desc from the event loop.
	(putpkt_binary): Rename to...
	(putpkt_binary_1): ... this.  Add `is_notic' argument.  Handle it.
	(putpkt_binary): New as wrapper around putpkt_binary_1.
	(putpkt_notif): New.
	(prepare_resume_reply): In non-stop mode, don't change the
	general_thread.
	* event-loop.c: New.
	* Makefile.in (OBJ): Add event-loop.o.
	(event-loop.o): New rule.

	* linux-low.h (pid_of): Moved here.
	(lwpid_of): New.
	(get_lwp_thread): Use lwpid_of.
	(struct lwp_info): Delete `lwpid' field.  Add `suspended' field.
	* linux-low.c (pid_of): Delete.
	(inferior_pid): Use lwpid_of.
	(linux_event_pipe): New.
	(target_is_async_p): New.
	(delete_lwp): New.
	(handle_extended_wait): Use lwpid_of.
	(add_lwp): Don't set lwpid field.
	(linux_attach_lwp): Adjust debug output.  Use lwpid_of.
	(linux_kill_one_lwp): If killing a running lwp, stop it first.
	Use lwpid_of.  Adjust to linux_wait_for_event interface changes.
	(linux_detach_one_lwp): If detaching from a running lwp, stop it
	first.  Adjust to linux_wait_for_event interface changes.  Use
	lwpid_of.
	(linux_detach): Don't delete the main lwp here.
	(linux_join): Use my_waitpid.  Avoid signal_pid.  Use lwpid_of.
	(status_pending_p): Don't consider explicitly suspended lwps.
	(linux_wait_for_lwp): Take an integer pid instead of a lwp_info
	pointer.  Add OPTIONS argument.  Change return type to int.  Use
	my_waitpid instead of sleeping.  Handle WNOHANG.  Use lwpid_of.
	(linux_wait_for_event): Take an integer pid instead of a lwp_info
	pointer.  Add status pointer argument.  Return a pid instead of a
	status.  Use lwpid_of.  Adjust to linux_wait_for_lwp interface
	changes.  In non-stop mode, don't switch to a random thread.
	(linux_wait): Rename to...
	(linux_wait_1): ... this.  Add target_options argument, and handle
	it.  Adjust to use resume_kind.  Use lwpid_of.  In non-stop mode,
	don't handle the continue thread.  Handle TARGET_WNOHANG.  Merge
	clean exit and signal exit code.  Don't stop all threads in
	non-stop mode.  In all-stop mode, only stop all threads when
	reporting a stop to GDB.  Handle explicit thread stop requests.
	(async_file_flush, async_file_mark): New.
	(linux_wait): New.
	(send_sigstop): Use lwpid_of.
	(wait_for_sigstop): Use lwpid_of.  Adjust to linux_wait_for_event
	interface changes.  In non-stop mode, don't switch to a random
	thread.
	(linux_resume_one_lwp): Use lwpid_of.
	(linux_continue_one_thread, linux_queue_one_thread): Merge into ...
	(linux_resume_one_thread): ... this.  Handle resume_stop.  In
	non-stop mode, don't look for pending flag in all threads.
	(resume_status_pending_p): Don't consider explicitly suspended
	threads.
	(my_waitpid): Reimplement.  Emulate __WALL.
	(linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo):
	Use lwpid_of.
	(sigchld_handler, linux_supports_non_stop, linux_async)
	(linux_start_non_stop): New.
	(linux_target_ops): Register linux_supports_non_stop, linux_async
	and linux_start_non_stop.
	(initialize_low): Install SIGCHLD handler.
	* thread-db.c (thread_db_create_event, find_one_thread)
	(thread_db_get_tls_address): Use lwpid_of.
	* win32-low.c (win32_detach): Adjust to use resume_kind.
	(win32_wait): Add `options' argument.
	* spu-low.c (spu_resume): Adjust to use resume_kind.
	(spu_wait): Add `options' argument.
2009-04-01 22:48:05 +00:00
Pedro Alves 5b1c542ea1 Decouple target code from remote protocol.
* target.h (enum target_waitkind): New.
	(struct target_waitstatus): New.
	(struct target_ops) <wait>: Return an unsigned long.  Take a
	target_waitstatus pointer instead of a char pointer.
	(mywait): Likewise.
	* target.c (mywait): Change prototype to return an unsigned long.
	Take a target_waitstatus pointer instead of a char pointer.  Adjust.
	* server.h (thread_from_wait, old_thread_from_wait): Delete
	declarations.
	(prepare_resume_reply): Change prototype to take a
	target_waitstatus.
	* server.c (thread_from_wait, old_thread_from_wait): Delete.
	(last_status, last_ptid): New.
	(start_inferior): Remove "statusptr" argument.  Adjust.  Return a
	pid instead of a signal.
	(attach_inferior): Remove "status" and "signal" parameters.
	Adjust.
	(handle_query): For qGetTLSAddr, parse the thread id with strtol,
	not as an address.
	(handle_v_cont, handle_v_attach, handle_v_run, handle_v_kill)
	(handle_v_requests, myresume): Remove "status" and "signal"
	parameters.  Adjust.
	(handle_status): New.
	(main): Delete local `status'.  Adjust.
	* remote-utils.c: Include target.h.
	(prepare_resume_reply): Change prototype to take a
	target_waitstatus.  Adjust.

	* linux-low.c (linux_wait): Adjust to new target_ops->wait
	interface.
	* spu-low.c (spu_wait): Adjust.
	* win32-low.c (enum target_waitkind, struct target_waitstatus):
	Delete.
	(win32_wait): Adjust.
2009-04-01 22:31:45 +00:00
Pedro Alves 2bd7c093f6 * target.h (struct thread_resume): Delete leave_stopped member.
(struct target_ops): Add a `n' argument to the `resume' callback.
	* server.c (start_inferior): Adjust.
	(handle_v_cont, myresume): Adjust.
	* linux-low.c (check_removed_breakpoint): Adjust to resume
	interface change, and to removed leave_stopped field.
	(resume_ptr): Delete.
	(struct thread_resume_array): New.
	(linux_set_resume_request): Add new `arg' parameter.  Adjust to
	resume interface change.
	(linux_continue_one_thread, linux_queue_one_thread)
	(resume_status_pending_p): Check if the resume field is NULL
	instead of checking the leave_stopped member.
	(linux_resume): Adjust to the target resume interface change.
	* spu-low.c (spu_resume): Adjust to the target resume interface
	change.
	* win32-low.c (win32_detach, win32_resume): Ditto.
2009-04-01 22:29:33 +00:00
Pedro Alves c35fafde7c gdb/gdbserver/
* linux-low.c (linux_wait_for_event): Don't clear the `stepping'
	flag.
	(wait_for_sigstop): Don't leave a finished single-step SIGTRAP
	pending.
	(linux_continue_one_thread): Only preserve the stepping flag if
	there's a pending breakpoint.

gdb/testsuite/

	* gdb.threads/pending-step.c, gdb.threads/pending-step.exp: New.
2009-04-01 22:25:44 +00:00
Pedro Alves 1b3f60162b * i387-fp.c, linux-arm-low.c, linux-cris-low.c,
linux-crisv32-low.c, linux-i386-low.c, linux-low.c,
	linux-mips-low.c, linux-s390-low.c, linux-sparc-low.c,
	linux-x86-64-low.c, linux-xtensa-low.c, proc-service.c,
	regcache.c, remote-utils.c, server.c, spu-low.c, target.h,
	thread-db.c, win32-low.c, xtensa-xtregs.c, gdbreplay.c,
	Makefile.in, configure.ac: Fix whitespace throughout.
	* configure: Regenerate.
2009-03-22 23:57:10 +00:00
Pedro Alves 54a0b537b8 Rename "process" to "lwp" throughout.
* linux-low.c (all_processes): Rename to...
	(all_lwps): ... this.
	(inferior_pid, handle_extended_wait, get_stop_pc): Adjust.
	(add_process): Rename to ...
	(add_lwp): ... this.  Adjust.
	(linux_create_inferior): Adjust.
	(linux_attach_lwp): Adjust.
	(linux_attach): Adjust.
	(linux_kill_one_process): Rename to ...
	(linux_kill_one_lwp): ... this.  Adjust.
	(linux_kill): Adjust.
	(linux_detach_one_process): Rename to ...
	(linux_detach_one_lwp): ... this.  Adjust.
	(linux_detach): Adjust.
	(check_removed_breakpoint): Adjust.
	(status_pending_p): Adjust.
	(linux_wait_for_process): Rename to ...
	(linux_wait_for_lwp): ... this.  Adjust.
	(linux_wait_for_event): Adjust.
	(send_sigstop): Adjust.
	(wait_for_sigstop): Adjust.
	(stop_all_processes): Rename to ...
	(stop_all_lwps): ... this.
	(linux_resume_one_process): Rename to ...
	(linux_resume_one_lwp): ... this.  Adjust.
	(linux_set_resume_request, linux_continue_one_thread)
	(linux_queue_one_thread, resume_status_pending_p)
	(usr_store_inferior_registers, regsets_store_inferior_registers)
	(linux_request_interrupt, linux_read_offsets, linux_xfer_siginfo):
	Adjust.
	* linux-low.h (get_process): Rename to ...
	(get_lwp): ... this.  Adjust.
	(get_thread_process): Rename to ...
	(get_thread_lwp): ... this.  Adjust.
	(get_process_thread): Rename to ...
	(get_lwp_thread): ... this.  Adjust.
	(struct process_info): Rename to ...
	(struct lwp_info): ... this.
	(all_processes): Rename to ...
	(all_lwps): ... this.
	* proc-service.c (ps_lgetregs): Adjust.
	* thread-db.c (thread_db_create_event, find_one_thread)
	(maybe_attach_thread, thread_db_get_tls_address): Adjust.
2009-03-17 20:25:35 +00:00
Pedro Alves 4aa995e123 2009-02-06 Pedro Alves <pedro@codesourcery.com>
gdb/
	* target.h (enum target_object): Add new TARGET_OBJECT_SIGNAL_INFO.
	* infrun.c (siginfo_value_read, siginfo_value_write): New.
	(siginfo_value_funcs): New.
	(siginfo_make_value): New.
	(_initialize_infrun): Create the $_siginfo convenience variable.
	* gdbtypes.h (append_composite_type_field_aligned): Declare.
	* gdbtypes.c (append_composite_type_field): Rename to...
	(append_composite_type_field_aligned): ... this.  Add ALIGNMENT
	argument.  Handle it.
	(append_composite_type_field): Rewrite on top of
	append_composite_type_field_aligned.
	* value.h (internalvar_make_value): New typedef.
	(struct internalvar) <make_value>: New field.
	(create_internalvar_type_lazy): Declare.
	* value.c (create_internalvar): Clear make_value.
	(create_internalvar_type_lazy): New.
	(value_of_internalvar): If make_value is set use it.
	(preserve_values): Skip internal variables that don't have a
	value.
	* gdbarch.sh (get_siginfo_type): New.
	* gdbarch.h, gdbarch.c: Regenerate.

	* linux-tdep.h, linux-tdep.c: New.
	* amd64-linux-tdep.c: Include "linux-tdep.h".
	(amd64_linux_init_abi): Register linux_get_siginfo_type and
	linux_get_siginfo_mapper.
	* i386-linux-tdep.c: Include "linux-tdep.h".
	(i386_linux_init_abi): Register linux_get_siginfo_type and
	linux_get_siginfo_mapper.
	* arm-linux-tdep.c: Include "linux-tdep.h".
	(i386_linux_init_abi): Register linux_get_siginfo_type and
	linux_get_siginfo_mapper.

	* linux-nat.c (linux_xfer_siginfo): New.
	(linux_nat_xfer_partial): Handle TARGET_OBJECT_SIGNAL_INFO.
	* remote.c (PACKET_qXfer_siginfo_read)
	(PACKET_qXfer_siginfo_write): New.
	(feature remote_protocol_features): Add "qXfer:siginfo:read" and
	"qXfer:siginfo:write" features.
	(remote_xfer_partial): Handle TARGET_OBJECT_SIGNAL_INFO.
	(_initialize_remote): Add "set/show remote read-siginfo-object"
	and "set/show remote write-siginfo-object" commands.

	* Makefile.in (ALL_TARGET_OBS): Add linux-tdep.o.
	(HFILES_NO_SRCDIR): Add linux-tdep.h.
	(ALLDEPFILES): Add linux-tdep.c.

	* configure.tgt (arm*-*-linux* | arm*-*-uclinux*)
	(i[34567]86-*-linux*, x86_64-*-linux*): Add linux-tdep.o to
	gdb_target_obs.

2009-02-06  Pedro Alves  <pedro@codesourcery.com>

	gdb/gdbserver/
	* server.c (handle_query): Report qXfer:siginfo:read and
	qXfer:siginfo:write as supported and handle them.
	* target.h (struct target_ops) <qxfer_siginfo>: New field.
	* linux-low.c (linux_xfer_siginfo): New.
	(linux_target_ops): Set it.

2009-02-06  Pedro Alves  <pedro@codesourcery.com>

	gdb/doc/
	* gdb.texinfo (Signals): Document $_siginfo.
	(Convenience Variables): Mention $_siginfo.
	(Remote Configuration): Document qXfer:siginfo:read,
	qXfer:siginfo:write packets, and the read-siginfo-object,
	write-siginfo-object commands.

2009-02-06  Pedro Alves  <pedro@codesourcery.com>

	gdb/testsuite/
	* gdb.base/siginfo-obj.c, gdb.base/siginfo-obj.exp: New.
2009-02-06 22:59:01 +00:00
Doug Evans f21cc1a2b7 * ChangeLog: Fix date of last entry.
* linux-low.c (handle_extended_wait): Improve comment.
2009-01-06 00:20:44 +00:00
Doug Evans 0e21c1ec8e * linux-low.c (linux_attach_lwp): Add some comments/fixmes. 2009-01-05 23:11:48 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Doug Evans bca929d3a6 * utils.c (xmalloc,xcalloc,xstrdup): New fns.
* server.h (ATTR_MALLOC): New macro.
	(xmalloc,xcalloc,xstrdup): Declare.
	* hostio.c: Replace malloc,calloc,strdup with xmalloc,xcalloc,xstrdup.
	* inferiors.c: Ditto.
	* linux-low.c: Ditto.
	* mem-break.c: Ditto.
	* regcache.c: Ditto.
	* remote-utils.c: Ditto.
	* server.c: Ditto.
	* target.c: Ditto.
	* win32-low.c: Ditto.
2008-12-14 20:51:04 +00:00
Doug Evans 896c7fbbd4 * linux-low.c (linux_wait_for_process): Don't clobber current_inferior
in debugging printf.
2008-12-12 23:14:28 +00:00
Doug Evans 97438e3f62 * linux-low.c (handle_extended_wait): Simplify, use my_waitpid. 2008-12-12 23:13:20 +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 dfb64f85d3 2008-11-14 Daniel Gutson <dgutson@codesourcery.com>
* configure.tgt (sparc64-*-linux*): Added gdbserver support.
	* regformats/reg-sparc64.dat: New file.

gdbserver/
2008-11-14  Daniel Gutson  <dgutson@codesourcery.com>

	* Makefile.in (SFILES, clean): Added sparc64 files.
	(reg-sparc64.o, reg-sparc64.c): New.
	* configure.srv (sparc*-*-linux*): New configuration.
	* linux-low.c (regsets_fetch_inferior_registers): Swap ptrace
	syscall arguments for SPARC.
	(regsets_store_inferior_registers): Likewise.
	* linux-sparc-low.c: New file.
2008-11-14 22:06:41 +00:00
Ulrich Weigand 3221518cf2 * linux-low.c (linux_resume_one_process): Ignore ESRCH.
(usr_store_inferior_registers): Likewise.
	(regsets_store_inferior_registers): Likewise.
2008-08-05 22:13:23 +00:00
Doug Evans 2fe5e3ffed * linux-low.c (sys/dir.h, sys/user.h): Remove includes.
(linux_write_memory): Remove declaration of errno.
2008-07-28 18:28:56 +00:00
Ulrich Weigand 836acd6d9a * linux-low.c (handle_extended_wait): Do not use "status"
variable uninitialized.
2008-07-12 22:22:42 +00:00
Ulrich Weigand 52fa2412d2 2008-04-17 Daniel Jacobowitz <dan@codesourcery.com>
* linux-low.c (disabled_regsets, num_regsets): New.
	(use_regsets_p): Delete.
	(linux_wait_for_process): Clear disabled_regsets.
	(regsets_fetch_inferior_registers): Check and set it.
	(regsets_store_inferior_registers): Likewise.
	(linux_fetch_registers, linux_store_registers): Do not use
	use_regsets_p.
	(initialize_low): Allocate disabled_regsets.
2008-04-17 21:21:38 +00:00
Ulrich Weigand 9b4b61c8db ChangeLog:
* features/Makefile (%.dat): Emit xmltarget statement.

	* regformats/regdat.sh: Support xmltarget and xmlarch statments.
	Generate code to set gdbserver_xmltarget in init_registers_${name}.

	* regformats/arm-with-iwmmxt.dat: Regenerate.
	* regformats/mips64-linux.dat: Regenerate.
	* regformats/mips-linux.dat: Regenerate.
	* regformats/rs6000/powerpc-32.dat: Regenerate.
	* regformats/rs6000/powerpc-64.dat: Regenerate.
	* regformats/rs6000/powerpc-e500.dat: Regenerate.

	* regformats/reg-arm.dat: Add xmlarch statement.
	* regformats/reg-i386.dat: Likewise.
	* regformats/reg-i386-linux.dat: Likewise.
	* regformats/reg-x86-64-linux.dat: Likewise.
	* regformats/reg-spu.dat: Likewise.

gdbserver/ChangeLog:

	* regcache.h (gdbserver_xmltarget): Add extern declaration.
	* server.c (gdbserver_xmltarget): Define.
	(get_features_xml): Use it to replace "target.xml" and arch_string.

	* configure.srv: Remove srv_xmltarget.  Add XML files that were
	mentioned there to srv_xmlfiles instead.  Remove conditional tests
	on gdb_cv_arm_iwmmxt, gdb_cv_ppc_altivec, gdb_cv_ppc_spe; set
	srv_xmlfiles and srv_regobj to include all possible choices.
	* configure.ac (srv_xmltarget): Remove.
	(srv_xmlfiles): Do not add "target.xml".
	(gdb_cv_arm_iwmmxt, gdb_cv_ppc_altivec, gdb_cv_ppc_spe): Remove
	checks for supplementary target information.
	* configure: Regenerate.
	* Makefile.in (XML_TARGET): Remove.
	(target.xml): Remove rule.
	(clean): Do not clean up target.xml.
	(.PRECIOUS): Do not mention target.xml.

	* target.h (struct target_ops): Remove arch_string member.
	* linux-low.c (linux_arch_string): Remove.
	(linux_target_ops): Remove arch_string initializer.
	* linux-low.h (struct linux_target_ops): Remove arch_string member.
	* linux-i386-low.c (the_low_target): Remove arch_string initializer.
	* linux-x86-64-low.c (the_low_target): Remove arch_string initializer.
	* spu-low.c (spu_arch_string): Remove.
	(spu_target_ops): Remove arch_string initializer.
	* win32-low.c (win32_arch_string): Remove.
	(win32_target_ops): Remove arch_string initializer.
	* win32-low.h (struct win32_target_ops): Remove arch_string member.
	* win32-arm-low.c (the_low_target): Remove arch_string initializer.
	* win32-i368-low.c (the_low_target): Remove arch_string initializer.
2008-02-28 05:54:10 +00:00
Ulrich Weigand ee1a7ae440 * linux-low.h (struct linux_target_ops): Replace left_pad_xfer field
by collect_ptrace_register and supply_ptrace_register hooks.
	* linux-low.c (fetch_register): Use supply_ptrace_register callback
	instead of checking for the_low_target.left_pad_xfer.
	(usr_store_inferior_registers): Use collect_ptrace_register callback
	instead of checking for the_low_target.left_pad_xfer.

	* linux-s390-low.c (s390_collect_ptrace_register): New function.
	(s390_supply_ptrace_register): Likewise.
	(s390_fill_gregset): Call s390_collect_ptrace_register.
	(the_low_target): Update.

	* linux-ppc64-low.c (ppc_collect_ptrace_register): New function.
	(ppc_supply_ptrace_register): Likewise.
	(the_low_target): Update.

	* linux-i386-low.c (the_low_target): Update.
	* linux-x86-64-low.c (the_low_target): Update.
2008-02-27 03:33:07 +00:00
Ulrich Weigand d61ddec435 * configure.srv [s390x-*-linux*]: Set srv_regobj to include both
reg-s390.o and reg-s390x.o.

	* linux-low.c (new_inferior): New global variable.
	(linux_create_inferior, linux_attach): Set it.
	(linux_wait_for_process): Call the_low_target.arch_setup after the
	target has stopped for the first time.
	(initialize_low): Do not call the_low_target.arch_setup.

	* linux-s390-low.c (s390_get_pc): Support bi-arch operation.
	(s390_set_pc): Likewise.
	(s390_arch_setup): New function.
	(the_low_target): Use s390_arch_setup as arch_setup routine.

	* regcache.c (realloc_register_cache): New function.
	(set_register_cache): Call it for each existing regcache.
2008-02-27 03:31:05 +00:00
Ulrich Weigand d05b4ac3aa gdb/ChangeLog:
* regformats/regdat.sh: Rename init_registers function in
	generated file to init_registers_${name}.

	* regformats/reg-crisv32.dat: Set "name" to crisv32.
	* regformats/reg-ppc64.dat: Set "name" to ppc64.
	* regformats/reg-s390x.dat: Set "name" to s390x.

gdbserver/ChangeLog:

	* server.h (init_registers): Remove prototype.

	* linux-low.h (struct linux_target_ops): Add arch_setup field.
	* linux-low.c (initialize_low): Call the_low_target.arch_setup ()
	instead of init_registers ().
	* linux-arm-low.c (init_registers_arm): Add prototype.
	(init_registers_arm_with_iwmmxt): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-cris-low.c (init_registers_cris): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-crisv32-low.c (init_registers_crisv32): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-i386-low.c (init_registers_i386_linux): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ia64-low.c (init_registers_ia64): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-m32r-low.c (init_registers_m32r): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-m68k-low.c (init_registers_m68k): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-mips-low.c (init_registers_mips_linux): Add prototype.
	(init_registers_mips64_linux): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ppc-low.c (init_registers_ppc): Add prototype.
	(init_registers_powerpc_32, init_registers_powerpc_e500): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-ppc64-low.c (init_registers_ppc64): Add prototype.
	(init_registers_powerpc_64): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-s390-low.c (init_registers_s390): Add prototype.
	(init_registers_s390x): Likewise.
	(the_low_target): Add initializer for arch_setup field.
	* linux-sh-low.c (init_registers_sh): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-x86-64-low.c (init_registers_x86_64_linux): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* linux-xtensa-low.c (init_registers_xtensa): Add prototype.
	(the_low_target): Add initializer for arch_setup field.

	* win32-low.h (struct win32_target_ops): Add arch_setup field.
	* win32-low.c (initialize_low): Call the_low_target.arch_setup ()
	instead of init_registers ().
	* win32-arm-low.c (init_registers_arm): Add prototype.
	(the_low_target): Add initializer for arch_setup field.
	* win32-i386-low.c (init_registers_i386): Add prototype.
	(the_low_target): Add initializer for arch_setup field.

	* spu-low.c (init_registers_spu): Add prototype.
	(initialize_low): Call initialie_registers_spu () instead of
	initialize_registers ().
2008-02-27 03:27:40 +00:00
Pedro Alves 59a016f09f * hostio.c: Don't include errno.h.
(errno_to_fileio_errno): Move to hostio-errno.
	* hostio.c: (hostio_error): Remove the error parameter.  Defer the
	error number outputting to the target->hostio_last_error callback.
	(hostio_packet_error): Use FILEIO_EINVAL directly.
	(handle_open, handle_pread, hostio_error, handle_unlink): Update
	calls to hostio_error.
	* hostio-errno.c: New.
	* server.h (hostio_last_error_from_errno): Declare.
	* target.h (target_ops): Add hostio_last_error member.
	* linux-low.c (linux_target_op): Register hostio_last_error_from_errno
	as hostio_last_error handler.
	* spu-low.c (spu_target_ops): Likewise.
	* win32-low.c [_WIN32_WCE] (win32_error_to_fileio_error)
	(wince_hostio_last_error): New functions.
	(win32_target_ops) [_WIN32_WCE]: Register wince_hostio_last_error
	as hostio_last_error handler.
	(win32_target_ops) [!_WIN32_WCE]: Register
	hostio_last_error_from_errno as hostio_last_error handler.
	* Makefile.in (SFILES): Add hostio.c and hostio-errno.c.
	(hostio-errno.o): New rule.
	* configure.ac (GDBSERVER_DEPFILES): Add $srv_hostio_err_objs.
	* configure.srv (srv_hostio_err_objs): New variable.  Default to
	hostio-errno.o.
	(arm*-*-mingw32ce*): Set srv_hostio_err_objs to "".
	* configure: Regenerate.
2008-02-01 00:08:25 +00:00
Daniel Jacobowitz 2d717e4f8a * linux-low.c (linux_attach_lwp): Do not _exit after errors.
(linux_kill, linux_detach): Clean up the process list.
	* remote-utils.c (remote_open): Improve port number parsing.
	(putpkt_binary, input_interrupt): Only send interrupts if the target
	is running.
	* server.c (extended_protocol): Make static.
	(attached): Define earlier.
	(exit_requested, response_needed, program_argv): New variables.
	(target_running): New.
	(start_inferior): Clear attached here.
	(attach_inferior): Set attached here.
	(require_running): Define.
	(handle_query): Use require_running and target_running.  Implement
	"monitor exit".
	(handle_v_attach, handle_v_run): New.
	(handle_v_requests): Use require_running.  Handle vAttach and vRun.
	(gdbserver_usage): Update.
	(main): Redo argument parsing.  Handle --debug and --multi.  Handle
	--attach along with other options or after the port.  Save
	program_argv.  Support no initial program.  Resynchronize
	communication with GDB after an error.  Handle "monitor exit".
	Use require_running and target_running.  Always allow the extended
	protocol.  Do not error out for Hc0 or Hc-1.  Do not automatically
	restart in extended mode.
	* README: Refer to the GDB manual.  Update --attach usage.

	* remote.c (struct remote_state): Add cached_wait_status.
	(remote_exec_file): New variable.
	(PACKET_vAttach, PACKET_vRun): New constants.
	(extended_remote_restart): Do not query for status.
	(struct start_remote_args): New.
	(remote_start_remote): Take it as a second argument.  Check
	whether the target is running.  Issue an error for non-running
	non-extended targets.  Cache the wait status.  Set inferior_ptid
	here.
	(remote_open_1): Prompt to disconnect non-running targets.  Make
	sure the target is marked running.  Do not set inferior_ptid here.
	Update call to remote_start_remote.  Do not call remote_check_symbols
	if the target is not running.
	(remote_detach_1): Rename from remote_detach.  Take an EXTENDED
	argument.  Handle a non-running target.
	(remote_detach): Use it.
	(extended_remote_detach): New.
	(remote_disconnect): Fix typo.  Use remoute_mourn_1.
	(extended_remote_attach_1, extended_remote_attach)
	(extended_async_remote_attach): New.
	(remote_vcont_resume): Remove unused variable.
	(remote_wait, remote_async_wait): Use any cached wait status.
	(putpkt_binary, getpkt): Clear any cached wait status.
	(extended_remoute_mourn_1): New.
	(extended_remote_mourn): Use it.
	(extended_async_remote_mourn, extended_remote_run): New.
	(extended_remote_create_inferior_1): New.
	(extended_remote_create_inferior): Use it.
	(extended_remote_async_create_inferior): Likewise.
	(remote_xfer_partial): Skip for non-executing targets.
	(init_extended_remote_ops): Set to_detach and to_attach.
	(init_extended_async_remote_ops): Likewise.  Use
	extended_async_remote_mourn.
	(_initialize_remote): Register vAttach, vRun, and
	set remote exec-file.
	* NEWS: Mention vAttach, vRun, and gdbserver extended-remote support.

	* gdb.server/ext-attach.c, gdb.server/ext-attach.exp,
	gdb.server/ext-run.exp: New files.
	* lib/gdbserver-support.exp (gdbserver_download): New.
	(gdbserver_start): New.  Update gdbserver expected
	output.
	(gdbserver_spawn): Use them.
	(gdbserver_start_extended): New.

	* gdb.texinfo (Using the `gdbserver' Program): Add security
	warning.  Rearrange into subsections and subsubsections.  Document
	--multi and --debug.  Correct --with-sysroot typo.  Update --attach
	usage.  Make load reference clearer.  Document monitor exit.
	(Remote Configuration): Document set remote exec-file, attach-packet,
	and run-packet.
	(Packets): Document vAttach and vRun.
2008-01-30 00:51:50 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00
Andreas Schwab 7407e2de24 * linux-low.c (STACK_SIZE): Define.
(linux_tracefork_child): Use it.  Use __clone2 on ia64.
	(linux_test_for_tracefork): Likewise.
2007-12-21 16:04:27 +00:00
Daniel Jacobowitz b65d95c576 * linux-low.c (linux_wait_for_event): Update messages. Do not
reinsert auto-delete breakpoints.
	* mem-break.c (struct breakpoint): Change return type of handler to
	int.
	(set_breakpoint_at): Update handler type.
	(reinsert_breakpoint_handler): Return 1 instead of calling
	delete_breakpoint.
	(reinsert_breakpoint_by_bp): Check for the original breakpoint before
	setting a new one.
	(check_breakpoints): Delete auto-delete breakpoints and return 2.
	* mem-break.h (set_breakpoint_at): Update handler type.
	* thread-db.c (thread_db_create_event, thread_db_create_event): Update.
	* win32-low.c (auto_delete_breakpoint): New.
	(get_child_debug_event): Use it.
2007-12-18 21:58:01 +00:00
Daniel Jacobowitz a20d5e98e5 * linux-low.c (linux_wait, linux_resume): Do not handle async I/O.
* remote-utils.c (remote_open): Do not call disable_async_io.
	(block_async_io): Delete.
	(unblock_async_io): Make static.
	(initialize_async_io): New.
	* server.c (handle_v_cont): Handle async I/O here.
	(myresume): Likewise.  Move other common resume tasks here...
	(main): ... from here.  Call initialize_async_io.  Disable async
	I/O before the main loop.
	* server.h (initialize_async_io): Declare.
	(block_async_io, unblock_async_io): Delete prototypes.
	* spu-low.c (spu_resume, spu_wait): Do not handle async I/O here.
2007-12-07 01:41:29 +00:00
Daniel Jacobowitz f9387fc3b0 * linux-low.c: Include <sched.h>. 2007-11-05 19:22:08 +00:00
Daniel Jacobowitz 51c2684ec1 * linux-low.c (linux_tracefork_grandchild): New.
(linux_tracefork_child): Use clone.
	(linux_test_for_tracefork): Use clone; allocate and free a stack.
2007-11-01 19:19:39 +00:00
Daniel Jacobowitz da5898cee8 * linux-low.c (handle_extended_wait): Handle unexpected signals. 2007-10-24 13:27:01 +00:00
Daniel Jacobowitz 24a09b5f37 * inferiors.c (change_inferior_id): Delete.
(add_pid_to_list, pull_pid_from_list): New.
	* linux-low.c (PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG)
	(PTRACE_O_TRACESYSGOOD, PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK)
	(PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC, PTRACE_O_TRACEVFORKDONE)
	(PTRACE_O_TRACEEXIT, PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK)
	(PTRACE_EVENT_CLONE, PTRACE_EVENT_EXEC, PTRACE_EVENT_VFORK_DONE)
	(PTRACE_EVENT_EXIT, __WALL): Provide default definitions.
	(stopped_pids, thread_db_active, must_set_ptrace_flags): New variables.
	(using_threads): Always set to 1.
	(handle_extended_wait): New.
	(add_process): Do not set TID.
	(linux_create_inferior): Set must_set_ptrace_flags.
	(linux_attach_lwp): Remove TID argument.  Do not check using_threads.
	Use PTRACE_SETOPTIONS.  Call new_thread_notify.  Update all callers.
	(linux_thread_alive): Rename TID argument to LWPID.
	(linux_wait_for_process): Handle unknown processes.  Do not use TID.
	(linux_wait_for_event): Do not use TID or check using_threads.  Update
	call to dead_thread_notify.  Call handle_extended_wait.
	(linux_create_inferior): Use PTRACE_SETOPTIONS.
	(send_sigstop): Delete sigstop_sent.
	(wait_for_sigstop): Avoid TID.
	(linux_supports_tracefork_flag, linux_tracefork_child, my_waitpid)
	(linux_test_for_tracefork): New.
	(linux_lookup_signals): Use thread_db_active and
	linux_supports_tracefork_flag.
	(initialize_low): Use thread_db_active and linux_test_for_tracefork.
	* linux-low.h (get_process_thread): Avoid TID.
	(struct process_ifo): Move thread_known and tid to the end.  Remove
	sigstop_sent.
	(linux_attach_lwp, thread_db_init): Update prototypes.
	* server.h (change_inferior_id): Delete prototype.
	(add_pid_to_list, pull_pid_from_list): New prototypes.
	* thread-db.c (thread_db_use_events): New.
	(find_first_thread): Rename to...
	(find_one_thread): ...this.  Update callers and messages.  Do not
	call fatal.  Check thread_db_use_events.  Do not call
	change_inferior_id or new_thread_notify.
	(maybe_attach_thread): Update.  Do not call new_thread_notify.
	(thread_db_init): Set thread_db_use_events.  Check use_events.
	* utils.c (fatal, warning): Correct message prefix.
2007-10-23 20:05:03 +00:00
Daniel Jacobowitz fd462a6189 * linux-low.c (O_LARGEFILE): Define.
(linux_read_memory): Use /proc/PID/mem.
	* configure.ac: Use AC_GNU_SOURCE.  Check for pread64.
	* configure, config.in: Regenerated.
2007-09-19 14:41:50 +00:00
Daniel Jacobowitz 69f223edd7 * linux-low.c (linux_wait_for_event): Do not pass signals while
single-stepping.
2007-09-04 21:30:23 +00:00
Joel Brobecker a9762ec78a Switch the license of all .c files to GPLv3.
Switch the license of all .h files to GPLv3.
        Switch the license of all .cc files to GPLv3.
2007-08-23 18:08:50 +00:00
Daniel Jacobowitz ae13219ef8 * inferiors.c (change_inferior_id): Add comment.
* linux-low.c (check_removed_breakpoint): Add an early
	prototype.  Improve debug output.
	(linux_attach): Doc update.
	(linux_detach_one_process, linux_detach): Clean up before releasing
	each process.
	(send_sigstop, wait_for_sigstop): Improve comments and debug output.
	* linux-low.h (struct process_info): Doc improvement.
	* mem-break.c (delete_all_breakpoints): New.
	* mem-break.h (delete_all_breakpoints): New prototype.
	* thread-db.c (find_first_thread): New.
	(thread_db_create_event): Call it instead of
	thread_db_find_new_threads.  Clean up unused variables.
	(maybe_attach_thread): Remove first thread handling.
	(thread_db_find_new_threads): Use find_first_thread.
	(thread_db_get_tls_address): Likewise.
2007-07-02 15:35:36 +00:00
Daniel Jacobowitz 2b876972d0 * linux-low.c (linux_create_inferior): Try execv before execvp.
* spu-low.c (spu_create_inferior): Likewise.
2007-06-20 18:54:21 +00:00
Daniel Jacobowitz 7a245884a8 2007-06-13 Mike Frysinger <vapier@gentoo.org>
* linux-low.c (linux_create_inferior): Change execv to execvp.
	* spu-low.c (spu_create_inferior): Likewies.
2007-06-13 21:03:38 +00:00
Pedro Alves dd6953e1f3 * linux-low.c (linux_detach): Change return type to int. Return 0.
* spu-low.c (spu_detach): Likewise.
2007-05-10 21:33:31 +00:00
Pedro Alves 444d61395b * target.h (target_ops): Change return type of detach to int.
Add join.
	(join_inferior): New.
	* server.c (main): Don't skip detach support on mingw32.
	If the inferior doesn't support detaching return error.
	Call join_inferior instead of using waitpid.
	* linux-low.c (linux_join): New.
	(linux_target_op): Add linux_join.
	* spu-low.c (spu_join): New.
	(spu_target_ops): Add spu_join.
	* win32-low.c (win32_detach): Adapt to new interface.
	Reopen current_process_handle before detaching.  Issue a child
	resume before detaching.
	(win32_join): New.
	(win32_target_op): Add win32_join.
2007-05-10 21:05:15 +00:00
Daniel Jacobowitz 42c81e2acb 2007-03-27 Jon Ringle <jon@ringle.org>
* linux-low.c: Check __ARCH_HAS_MMU__ also.
2007-03-27 18:32:01 +00:00
Daniel Jacobowitz c74d0ad827 * gdb.texinfo (Monitor commands for gdbserver): New subsection.
* remote-utils.c (monitor_output): New function.
	* server.c (debug_threads): Define here.
	(monitor_show_help): New function.
	(handle_query): Handle qRcmd.
	(main): Do not handle 'd' packet.
	* server.h (debug_threads, remote_debug, monitor_output): Declare.
	* linux-low.c, spu-low.c, win32-i386-low.c: Remove definitions
	of debug_threads.

	* gdb.server/server-mon.exp: New test.
2007-02-26 20:10:18 +00:00
Pedro Alves ef57601be4 * target.h (target_ops): Rename send_signal to request_interrupt,
and remove enum target_signal parameter.
	* linux-low.c (linux_request_interrupt): Rename from
	linux_send_signal, and always send SIGINT.
	* spu-low.c (spu_request_interrupt): Rename from spu_send_signal,
	and always send SIGINT.
	* remote-utils.c (putpkt_binary): Call request_interrupt, instead
	of send_signal.
	(input_interrupt): Likewise.
2007-02-25 17:59:43 +00:00
Daniel Jacobowitz 23181151a2 XML feature description support.
* NEWS: Mention target descriptions, "set tdesc filename",
	"unset tdesc filename", "show tdesc filename", and
	qXfer:features:read.
	* arch-utils.c (choose_architecture_for_target): New function.
	(gdbarch_info_fill): Call it.
	* target-descriptions.c (struct property): Make members non-const.
	(struct target_desc): Add arch member.
	(target_description_filename): New variable.
	(target_find_description): Try via XML first.
	(tdesc_architecture): New.
	(free_target_description, make_cleanup_free_target_description): New.
	(set_tdesc_property): Call xstrdup.
	(set_tdesc_architecture, tdesc_set_cmdlist, tdesc_show_cmdlist)
	(tdesc_unset_cmdlist, unset_tdesc_cmd, unset_tdesc_filename_cmd)
	(set_tdesc_cmd, show_tdesc_cmd, set_tdesc_filename_cmd)
	(show_tdesc_filename_cmd, _initialize_target_descriptions): New.
	* target-descriptions.h (tdesc_architecture)
	(make_cleanup_free_target_description, set_tdesc_architecture): New
	prototypes.
	* Makefile.in (SFILES): Add xml-tdesc.c.
	(COMMON_OBS): Add xml-tdesc.o.
	(target-descriptions.o): Update.
	(xml-tdesc.o): New rule.
	* xml-tdesc.c, xml-tdesc.h: New files.
	* remote.c (PACKET_qXfer_features): New enum.
	(remote_protocol_features): Add qXfer:features:read.
	(remote_xfer_partial): Handle TARGET_OBJECT_AVAILABLE_FEATURES.
	(_initialize_remote): Register qXfer:features:read.
	* target.h (enum target_object): Add TARGET_OBJECT_AVAILABLE_FEATURES.
	* features/gdb-target.dtd: New file.

	* linux-i386-low.c (the_low_target): Set arch_string.
	* linux-x86-64-low.c (the_low_target): Likewise.
	* linux-low.c (linux_arch_string): New.
	(linux_target_ops): Add it.
	* linux-low.h (struct linux_target_ops): Add arch_string.
	* server.c (write_qxfer_response): Use const void * for DATA.
	(get_features_xml): New.
	(handle_query): Handle qXfer:features:read.  Report it for qSupported.
	* target.h (struct target_ops): Add arch_string method.

	* gdb.texinfo (Target Descriptions): New section.
	(General Query Packets): Add QPassSignals anchor.  Mention
	qXfer:features:read under qSupported.  Expand mentions of
	qXfer:memory-map:read and QPassSignals.  Document
	qXfer:features:read.
2007-01-09 22:55:10 +00:00
Daniel Jacobowitz 6aba47ca06 Copyright updates for 2007. 2007-01-09 17:59:20 +00:00
Daniel Jacobowitz 9d6063994f * linux-low.c (linux_kill): Handle being called with no threads.
* win32-i386-low.c (win32_kill): Likewise.
	(get_child_debug_event): Clear current_process_handle.
2007-01-03 17:57:16 +00:00
Daniel Jacobowitz 89be209149 gdb/
* remote.c (PACKET_QPassSignals): New.
	(last_pass_packet, remote_pass_signals): New.
	(remote_protocol_features): Add QPassSignals.
	(remote_query_supported): Correct an infinite loop.
	(remote_open_1): Reset last_pass_packet.
	(remote_resume): Call remote_pass_signals.
	(_initialize_remote): Register "set remote pass-signals".
gdb/doc/
	* gdb.texinfo (Remote configuration): Mention
	"pass-signals-packet".
	(General Query Packets): Document QPassSignals.  Fix
	a typo.
gdb/gdbserver/
	* linux-low.c (linux_wait_for_event): Reformat.  Use the
	pass_signals array.
	* remote-utils.c (decode_address_to_semicolon): New.
	* server.c (pass_signals, handle_general_set): New.
	(handle_query): Mention QPassSignals for qSupported.
	(main): Call handle_general_set.
	* server.h (pass_signals, decode_address_to_semicolon): New.
2006-11-16 15:08:25 +00:00
Daniel Jacobowitz dae5f5cf4b * acinclude.m4 (SRV_CHECK_TLS_GET_ADDR): New.
* configure.ac: Use it.  Define HAVE_TD_THR_TLS_GET_ADDR.
	* config.in, configure: Regenerated.
	* inferiors.c (gdb_id_to_thread): New function.
	(gdb_id_to_thread_id): Use it.
	* linux-low.c (linux_target_ops): Use thread_db_get_tls_address.
	* linux-low.h (struct process_info): Add th member.
	(thread_db_get_tls_address): New prototype.
	* remote-utils.c (decode_address): Make non-static.
	* server.c (handle_query): Handle qGetTLSAddr.
	* server.h (gdb_id_to_thread, decode_address): New prototypes.
	* target.h (struct target_ops): Add get_tls_address.
	* thread-db.c (maybe_attach_thread): Save the thread handle.
	(thread_db_get_tls_address): New.
2006-10-17 16:02:27 +00:00
Daniel Jacobowitz 32ca6d6157 * linux-low.c (PTRACE_GETSIGINFO, PTRACE_SETSIGINFO): Define.
(linux_resume_one_process): Take a siginfo_t *.  Update all
	callers.  Queue it if necessary.  Use PTRACE_SETSIGINFO.
	(struct pending_signals): Add a siginfo_t.
	(linux_wait_for_process): Always set last_status.
	(linux_wait_for_event): Use PTRACE_GETSIGINFO.
	(linux_queue_one_thread): Use PTRACE_GETSIGINFO.
	* linux-low.h (struct process_info): Add last_status.
2006-09-28 22:46:29 +00:00
Daniel Jacobowitz b80864fbe5 gdb/
* configure.tgt: Build gdbserver for Cygwin and mingw32.
gdb/gdbserver/
	* configure.ac: Check for more headers which are missing on
	Windows.  Automatically supply -lwsock32 and USE_WIN32API.
	* configure.srv: Add Cygwin and mingw32.
	* remote-utils.c: Don't include headers unconditionally which
	are missing on mingw32.  Include <winsock.h> for mingw32.
	(remote_open): Adjust for mingw32 support.  Flush
	standard error after writing to it.
	(remote_close, putpkt_binary, input_interrupt, block_async_io)
	(unblock_async_io, enable_async_io, disable_async_io)
	(readchar, getpkt): Update for Winsock support.
	(prepare_resume_reply): Expect a protocol signal number.
	* server.c: Disable <sys/wait.h> on mingw32.
	(start_inferior): Adjust for mingw32 support.  Flush
	standard error after writing to it.
	(attach_inferior): Likewise.  Use protocol signal
	numbers.
	(main): Skip 'D' packet on mingw32.  Use protocol signal numbers
	and names.
	* win32-i386-low.c: New file.
	* Makefile.in (XM_CLIBS): Set.
	(gdbserver, gdbreplay): Use $(INTERNAL_CFLAGS).
	(win32-i386-low.o): New dependency rule.
	* linux-low.c (linux_wait): Use target signal numbers.
	* target.h (struct target_ops): Doc fix.
	* server.h (target_signal_to_name): New prototype.
	* gdbreplay.c: Don't include headers unconditionally which
	are missing on mingw32.  Include <winsock.h> for mingw32.
	(remote_close, remote_open): Adjust for Winsock support.
	* configure, config.in: Regenerated.
2006-07-23 03:52:15 +00:00
Nathan Sidwell 52fb643739 * configure.srv (m68k*-*-uclinux*): New target.
* linux-low.c (linux_create_inferior): Use vfork on mmuless systems.
	(linux_resume_one_process): Remove extraneous cast.
	(linux_read_offsets): New.
	(linux_target_op): Add linux_read_offsets on mmuless systems.
	* server.c (handle_query): Add qOffsets logic.
	* target.h (struct target_ops): Add read_offsets.
2006-05-09 15:21:19 +00:00
Daniel Jacobowitz 545587ee60 * linux-low.c (regsets_store_inferior_registers): Read the regset
from the target before filling it.
2006-02-15 14:36:32 +00:00
Eli Zaretskii 6f0f660e7b * linux-arm-low.c:
* linux-cris-low.c:
	* inferiors.c:
	* i387-fp.h:
	* i387-fp.c:
	* gdbreplay.c:
	* regcache.c:
	* proc-service.c:
	* mem-break.h:
	* mem-break.c:
	* linux-x86-64-low.c:
	* linux-sh-low.c:
	* linux-s390-low.c:
	* linux-ppc64-low.c:
	* linux-ppc-low.c:
	* linux-mips-low.c:
	* linux-m68k-low.c:
	* linux-m32r-low.c:
	* linux-low.h:
	* linux-low.c:
	* linux-ia64-low.c:
	* linux-i386-low.c:
	* linux-crisv32-low.c:
	* thread-db.c:
	* terminal.h:
	* target.h:
	* target.c:
	* server.h:
	* server.c:
	* remote-utils.c:
	* regcache.h:
	* utils.c:
	* Makefile.in:
	* configure.ac:
	* gdbserver.1: Add (C) after Copyright.  Update the FSF
	address.
2005-12-23 18:11:55 +00:00
Daniel Jacobowitz e9d25b9800 * configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
is not available.  Define HAVE_PTRACE_GETREGS if it is.
	* config.in, configure: Regenerated.
	* configure.srv: Set srv_linux_regsets for PowerPC and PowerPC64.
	* linux-i386-low.c, linux-m68k-low.c: Update to use
	HAVE_PTRACE_GETREGS.
	* linux-low.c (regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers): Only return 0 if we processed
	GENERAL_REGS.
	* linux-ppc-low.c (ppc_fill_gregset, target_regsets): New.
	* linux-ppc64-low.c (ppc_fill_gregset, target_regsets): New.
2005-07-13 15:21:02 +00:00
Daniel Jacobowitz a06660f799 * inferiors.c (struct thread_info): Add gdb_id.
(add_thread): Add gdb_id argument.
	(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New.
	* linux-low.c (linux_create_inferior, linux_attach_lwp): Update
	calls to add_thread.
	* remote-utils.c (prepare_resume_reply: Use thread_to_gdb_id.
	* server.c (handle_query): Use thread_to_gdb_id.
	(handle_v_cont, main): Use gdb_id_to_thread_id.
	* server.h (add_thread): Update prototype.
	(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New
	prototypes.
2005-07-13 15:02:49 +00:00
Daniel Jacobowitz 5a1f5858d4 * linux-low.c (fetch_register, usr_store_inferior_registers): Handle
left-padded registers.
	* linux-low.h (struct linux_target_ops): Add left_pad_xfer.
	* linux-ppc64-low.c (the_low_target): Set left_pad_xfer.
2005-07-13 14:48:58 +00:00
Daniel Jacobowitz d592fa2f7f * linux-low.c (linux_wait, linux_send_signal): Don't test
an unsigned long variable for > 0 if it could be MAX_ULONG.
	* server.c (myresume): Likewise.
	* target.c (set_desired_inferior): Likewise.
2005-06-17 04:01:05 +00:00
Daniel Jacobowitz f450004a28 * acconfig.h: Remove.
* configure.ac: Add a test for socklen_t.  Use three-argument
	AC_DEFINE throughout.
	* config.in: Regenerated using autoheader 2.59.
	* configure: Regenerated.

	* gdbreplay.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	* remote-utils.c (socklen_t): Provide a default.
	(remote_open): Use socklen_t.
	(convert_int_to_ascii, convert_ascii_to_int, decode_M_packet): Use
	unsigned char.

	* i387-fp.c (struct i387_fsave, struct i387_fxsave): Use unsigned
	char for buffers.
	* linux-low.c (linux_read_memory, linux_write_memory)
	(linux_read_auxv): Likewise.
	* mem-break.c (breakpoint_data, set_breakpoint_data, check_mem_read)
	(check_mem_write): Likewise.
	* mem-break.h (set_breakpoint_data, check_mem_read, check_mem_write):
	Likewise.
	* regcache.c (struct inferior_rgcache_data, registers_to_string)
	(registers_from_string, register_data): Likewise.
	* server.c (handle_query, main): Likewise.
	* server.h (convert_ascii_to_int, convert_int_to_ascii)
	(decode_M_packet): Likewise.
	* target.c (read_inferior_memory, write_inferior_memory): Likewise.
	* target.h (struct target_ops): Update read_memory, write_memory,
	and read_auxv.
	(read_inferior_memory, write_inferior_memory): Update.
	* linux-low.h (struct linux_target_ops): Change type of breakpoint
	to unsigned char *.
	* linux-arm-low.c, linux-cris-low.c, linux-crisv32-low.c,
	linux-i386-low.c, linux-m32r-low.c, linux-m68k-low.c,
	linux-mips-low.c, linux-ppc-low.c, linux-ppc64-low.c,
	linux-s390-low.c, linux-sh-low.c: Update for changes in
	read_inferior_memory and the_low_target->breakpoint.
2005-06-13 01:59:22 +00:00
Ulrich Weigand 48d93c7500 * linux-low.c (fetch_register): Ensure buffer size is a multiple
of sizeof (PTRACE_XFER_TYPE).
	(usr_store_inferior_registers): Likewise.  Zero out excess bytes.
2005-05-16 10:24:37 +00:00
Orjan Friberg e013ee27c9 2005-05-12 Orjan Friberg <orjanf@axis.com>
* target.h (struct target_ops): Add insert_watchpoint,
	remove_watchpoint, stopped_by_watchpoint, stopped_data_address function
	pointers for hardware watchpoint support.
	* linux-low.h (struct linux_target_ops): Ditto.
	* linux-low.c (linux_insert_watchpoint, linux_remove_watchpoint)
	(linux_stopped_by_watchpoint, linux_stopped_data_address): New.  Add
	to linux_target_ops.
	* remote-utils.c (prepare_resume_reply): Add watchpoint information to
	reply packet.
	* server.c (main): Recognize 'Z' and 'z' packets.
2005-05-12 12:14:23 +00:00
Daniel Jacobowitz a1928bada5 * inferiors.c (change_inferior_id, add_thread, find_inferior_id):
Take unsigned long arguments for PIDs.
	* linux-low.c (add_process, linux_attach_lwp, linux_attach)
	(linux_thread_alive, linux_wait_for_event, kill_lwp, send_sigstop)
	(wait_for_sigstop, linux_resume_one_process)
	(regsets_fetch_inferior_registers, linux_send_signal)
	(linux_read_auxv): Likewise.  Update the types of variables holding
	PIDs.  Update format string specifiers.
	* linux-low.h (struct process_info, linux_attach_lwp): Likewise.
	* remote-utils.c (prepare_resume_reply): Likewise.
	* server.c (cont_thread, general_thread, step_thread)
	(thread_from_wait, old_thread_from_wait, signal_pid): Change type to
	unsigned long.
	(handle_query): Update format specifiers.
	(handle_v_cont, main): Use strtoul for thread IDs.
	* server.h (struct inferior_list_entry): Use unsigned long for ID.
	(add_thread, find_inferior_id, change_inferior_id, cont_thread)
	(general_thread, step_thread, thread_from_wait)
	(old_thread_from_wait): Update.
	* target.h (struct thread_resume): Use unsigned long for THREAD.
	(struct target_ops): Use unsigned long for arguments to attach and
	thread_alive.
2005-03-03 16:56:53 +00:00
Daniel Jacobowitz fd5008162e * linux-i386-low.c (ps_get_thread_area): New.
* linux-x86-64-low.c (ps_get_thread_area): New.
	* linux-low.c: Include <sys/syscall.h>.
	(linux_kill_one_process): Don't kill the first thread here.
	(linux_kill): Kill the first thread here.
	(kill_lwp): New function.
	(send_sigstop, linux_send_signal): Use it.
	* proc-service.c: Clean up #ifdefs.
	(fpregset_info): Delete.
	(ps_lgetregs): Update and enable implementation.
	(ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs): Remove disabled
	implementations.
	* remote-utils.c (struct sym_cache, symbol_cache): New.
	(input_interrupt): Print a clearer message.
	(async_io_enabled): New variable.
	(enable_async_io, disable_async_io): Use it.  Update comments.
	(look_up_one_symbol): Use the symbol cache.
	* thread-db.c (thread_db_look_up_symbols): New function.
	(thread_db_init): Update comments.  Call thread_db_look_up_symbols.
2004-10-16 17:42:00 +00:00
Daniel Jacobowitz 075b3282ba * linux-low.c (linux_wait): Clear all_processes list also. 2004-03-23 21:14:24 +00:00
Daniel Jacobowitz fa6a77dc8f * linux-low.c: Include <errno.h>. Remove extern declaration of
errno.
2004-03-12 20:51:50 +00:00
Daniel Jacobowitz c3e735a6a3 * linux-low.c (linux_read_memory): Change return type to
int.  Check for and return error from ptrace().
	* target.c (read_inferior_memory): Change return type to int.  Pass
	back return status from the_target->read_memory().
	* target.h (struct target_ops): Adapt *read_memory() prototype.
	Update comment.
	(read_inferior_memory): Adapt prototype.
	* server.c (main): Return an error packet if
	read_inferior_memory() returns an error.
2004-03-05 03:43:19 +00:00
Daniel Jacobowitz 62ea82f508 * linux-low.c (linux_wait): Unblock async I/O.
(linux_resume): Block and enable async I/O.
	* remote-utils.c (block_async_io, unblock_async_io): New functions.
	* server.h (block_async_io, unblock_async_io): Add prototypes.
2004-02-29 16:47:15 +00:00
Roland McGrath aa691b87c2 2004-02-25 Roland McGrath <roland@redhat.com>
* target.h (struct target_ops): New member `read_auxv'.
	* server.c (handle_query): Handle qPart:auxv:read: query using that.
	* linux-low.c (linux_read_auxv): New function.
	(linux_target_ops): Initialize `read_auxv' member to that.
2004-02-25 20:41:29 +00:00
Daniel Jacobowitz 5544ad8993 * linux-low.c: Update copyright year.
(check_removed_breakpoint): Clear pending_is_breakpoint.
	(linux_set_resume_request, linux_queue_one_thread)
	(resume_status_pending_p): New functions.
	(linux_continue_one_thread): Use process->resume.
	(linux_resume): Only resume threads if there are no pending events.
	* linux-low.h (struct process_info): Add resume request
	pointer.
2004-01-31 22:19:32 +00:00
Daniel Jacobowitz 64386c31df * linux-low.c (linux_resume): Take a struct thread_resume *
argument.
	(linux_wait): Update call.
	(resume_ptr): New static variable.
	(linux_continue_one_thread): Renamed from
	linux_continue_one_process.  Use resume_ptr.
	(linux_resume): Use linux_continue_one_thread.
	* server.c (handle_v_cont, handle_v_requests): New functions.
	(myresume): New function.
	(main): Handle 'v' case.
	* target.h (struct thread_resume): New type.
	(struct target_ops): Change argument of "resume" to struct
	thread_resume *.
	(myresume): Delete macro.
2003-10-13 16:17:21 +00:00
Daniel Jacobowitz 43d5792ce1 * configure.in: Check whether we need to prototype strerror.
* server.h: Optionally prototype strerror.
	* gdbreplay.c (perror_with_name): Use strerror.
	* linux-low.c (linux_attach_lwp): Use strerror.
	* utils.c (perror_with_name): Use strerror.
	* config.in, configure: Regenerated.
2003-06-29 04:01:39 +00:00
Daniel Jacobowitz 6ad8ae5c57 gdb/
* NEWS: Mention gdbserver detach change and "disconnect" command.
        * infcmd.c (disconnect_command): New function.
        (_initialize_infcmd): Add ``disconnect'' command.
        * remote.c (remote_async_detach): Delete.
        (remote_detach): Merge remote_async_detach.
        (remote_disconnect): New.
        (init_remote_ops): Set to_disconnect.
        (init_remote_cisco_ops): Likewise.
        (init_remote_async_ops): Likewise.  Use remote_detach.
        * target.c (cleanup_target): Default to_disconnect.
        (update_current_target): Inherit to_disconnect.
        (target_disconnect, debug_to_disconnect): New functions.
        (setup_target_debug): Set to_disconnect.
        * target.h (struct target_ops): Add to_disconnect.
        (target_disconnect): Add prototype.
gdbserver/
	* linux-low.c: Move comment to linux_thread_alive where it belonged.
	(linux_detach_one_process, linux_detach): New functions.
	(linux_target_ops): Add linux_detach.
	* server.c (main): Handle 'D' packet.
	* target.h (struct target_ops): Add "detach" member.
	(detach_inferior): Define.
mi/
        * mi-cmds.c (mi_cmds): Add "-target-disconnect".
2003-06-17 20:28:14 +00:00
Daniel Jacobowitz e5379b03cf * linux-low.c (linux_wait_for_event): Correct comment typos.
(linux_resume_one_process): Call check_removed_breakpoint.
	(linux_send_signal): New function.
	(linux_target_ops): Add linux_send_signal.
	* remote-utils.c (putpkt, input_interrupt): Use send_signal instead
	of kill.
	* target.h (struct target_ops): Add send_signal.
2003-06-05 14:26:58 +00:00