Commit Graph

523 Commits

Author SHA1 Message Date
Ralf Wildenhues 96e946ca9a sim/
* Makefile.in (datarootdir): New variable.

sim/common/
	* Makefile.in (datarootdir): New variable.

sim/igen/
	* Makefile.in (datarootdir): New variable.

sim/ppc/
	* Makefile.in (datarootdir): New variable.

readline/
	* Makefile.in (datarootdir): New variable.
	* doc/Makefile.in (datarootdir): New variable.
	* shlib/Makefile.in (datarootdir): New variable.

gdb/gdbserver/
	* Makefile.in (datarootdir): New variable.
2009-07-30 22:53:18 +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
Aleksandar Ristovski ac8c974e4f Adding Neutrino gdbserver.
* configure: Regenerated.
	* configure.ac: Add case for srv_qnx and set LIBS accordingly.
	* configure.srv (i[34567]86-*-nto*): New target.
	* nto-low.c, nto-low.h, nto-x86-low.c: New files.
	* remote-utils.c [__QNX__]: Include sys/iomgr.h
	(nto_comctrl) [__QNX__]: New function.
	(enable_async_io, disable_async_io) [__QNX__]: Call nto_comctrl.
2009-07-06 18:31:20 +00:00
Pedro Alves 4424e0c3c0 Ooops. Fix date. 2009-07-05 22:58:53 +00:00
Pedro Alves 7437790a92 * configure.srv (i[34567]86-*-mingw32ce*): Add i386-low.o to
srv_tgtobj.
2009-07-05 19:30:09 +00:00
Pedro Alves 912cf4ba32 * win32-i386-low.c (i386_get_thread_context): Handle systems that
don't support CONTEXT_EXTENDED_REGISTERS.
	(i386_win32_breakpoint, i386_win32_breakpoint_len): New.
	(the_low_target): Install them.
	* win32-low.c (get_child_debug_event): Handle WaitForDebugEvent
	failing with ERROR_PIPE_NOT_CONNECTED.
2009-07-04 18:13:28 +00:00
Doug Evans e6f9de8791 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 21:31:32 +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
Pierre Muller 0f54c268db * server.c (handle_v_kill): Pass signal_pid to
kill_inferior if multi_process is zero.
2009-06-24 15:23:32 +00:00
Aleksandar Ristovski c631402292 * server.c (process_serial_event): Add support for Z0 and Z1 packet.
* target.h (target_ops): Comment for *_watchpoint to make it clear
the functions can get types '0' and '1'.
2009-06-23 15:12:44 +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 e09875d410 gdb:
Global renaming of find_thread_pid to find_thread_ptid.
	* gdbthread.h (find_thread_ptid): Renamed from find_thread_pid.
	* thread.c (find_thread_ptid): Renamed from find_thread_pid.
	All callers updated.
gdbserver:
	Global renaming of find_thread_pid to find_thread_ptid.
	* server.h (find_thread_ptid): Renamed from find_thread_pid.
	* inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
	All callers updated.
2009-05-24 21:06:53 +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 9f1036c17f * linux-x86-low.c: Don't include assert.h.
(x86_siginfo_fixup): Use fatal, not assert.
	(x86_arch_setup): Fix comment.
2009-05-13 19:11:04 +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 ba42693bb4 Fix braino. 2009-05-06 17:34:13 +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 9f76782569 * inferiors.c (started_inferior_callback): New function.
(attached_inferior_callback): New function.
	(have_started_inferiors_p, have_attached_inferiors_p): New functions.
	* server.c (print_started_pid, print_attached_pid): New functions.
	(detach_or_kill_for_exit): New function.
	(main): Call it instead of for_each_inferior (kill_inferior_callback).
	* server.h (have_started_inferiors_p): Declare.
	(have_attached_inferiors_p): Declare.
2009-04-30 22:21:06 +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 155c8968d9 2009-04-19 Danny Backx <dannybackx@users.sourceforge.net>
* configure.srv: Add x86 Windows CE target.
2009-04-19 17:54:52 +00:00
Ulrich Weigand 7fe519cb21 * inferiors.c (get_thread_process): Make global.
* server.h (get_thread_process): Add prototype.
	* thread-db.c (find_one_thread): Use get_thread_process
	instead of current_process.
	(thread_db_get_tls_address): Do not crash if called when
	thread layer is not yet initialized.
2009-04-03 20:15:51 +00:00
Ulrich Weigand 5472f405e2 * remote-utils.c (prepare_resume_reply): Null-terminate packet.
* spu-low.c (current_tid): Rename to ...
	(current_ptid): ... this.
	(fetch_ppc_register, fetch_ppc_memory, store_ppc_memory,
	spu_proc_xfer_spu, spu_resume, spu_request_interrupt): Use
	ptid_get_lwp (current_ptid) instead of current_tid.
	(spu_kill, spu_detach, spu_join, spu_wait): Use pid argument
	instead of current_tid.  Use find_process_pid to verify pid
	argument is valid.  Pass proper argument to remove_process.
	(spu_thread_alive): Compare current_ptid instead of current_tid.
	(spu_resume): Likewise.
2009-04-03 14:38:39 +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 0a59d50b2d * server.c (main): After the inferior having exited, call
remote_close before exiting gdbserver.
2009-03-31 22:46:36 +00:00
Thiago Jung Bauermann f04c6d38e2 gdb/
Fix size of FPSCR in Power 7 processors.
	* ppc-linux-nat.c (PPC_FEATURE_ARCH_2_05): Remove #define.
	(PPC_FEATURE_HAS_DFP): New #define.
	(ppc_linux_read_description): Check for DFP feature instead of
	ISA 2.05 to decide on size of the FPSCR.

gdbserver/
	Fix size of FPSCR in Power 7 processors.
	* linux-ppc-low.c (PPC_FEATURE_ARCH_2_05): Remove #define.
	(PPC_FEATURE_HAS_DFP): New #define.
	(ppc_arch_setup): Check for DFP feature instead of ISA 2.05 to decide on
	size of the FPSCR.
2009-03-25 21:15:04 +00:00
Pedro Alves 78e5cee680 * server.c (handle_query) Whitespace and formatting. 2009-03-23 00:22:54 +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 a07b2135db * inferiors.c (find_inferior): Make it safe for the callback
function to delete the currently iterated inferior.
2009-03-22 22:34:04 +00:00
Pedro Alves 67cc2626af * Makefile.in (linuw_low_h): Move higher.
(thread-db.o): Depend on $(linux_low_h).
2009-03-22 22:19:34 +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 0b16c5cfaf 2009-03-14 Pedro Alves <pedro@codesourcery.com>
gdb/
	* remote.c (PACKET_qAttached): New.
	(remote_query_attached): New.
	(remote_add_inferior): Add new `attached' argument.  Handle it.
	(remote_notice_new_inferior, remote_start_remote): Adjust to pass
	-1 to remote_add_inferior in new parameter.
	(extended_remote_attach_1): Adjust to pass 1 to
	remote_add_inferior in the new parameter.
	(extended_remote_create_inferior_1): Adjust to pass 0 to
	remote_add_inferior in the new parameter.
	(_initialize_remote): Add "set/show remote query-attached-packet"
	commands.

2009-03-14  Pedro Alves  <pedro@codesourcery.com>

	gdb/gdbserver/
	* server.c (handle_query): Handle "qAttached".

2009-03-14  Pedro Alves  <pedro@codesourcery.com>

	gdb/doc/
	* gdb.texinfo (Remote Configuration): Document query-attached.
        (General Query Packets): Document qAttached.
2009-03-14 01:38:08 +00:00
Nathan Sidwell 32de4b9db9 * Makefile.in, hostio-errno.c, errno.c, xtensa-xtregs.c: Change to
GPLv3, update license URL.
2009-03-13 07:57:47 +00:00
Doug Evans 93efd30205 Clean up last entry. 2009-03-02 22:39:44 +00:00
Doug Evans 2aecd87f56 * Makefile.in (GDB_CFLAGS): Add -I$(srcdir)/common.
(init.c): signals/ -> common/.
	(signals.o): Update.
	* target.h (target_signal_to_string,target_signal_to_string)
	(target_signal_from_name,target_signal_to_host_p)
	(target_signal_from_host,target_signal_to_host): Move to ...
	* common/gdb_signals.h: ... here.  New file.
	* common/signals.c: Moved here from signals/signals.c.
	#include gdb_signals.h, remove #include of target.h in gdb case.
	(target_signal_from_command,default_target_signal_to_host)
	(default_target_signal_from_host): Move inside #ifndef GDBSERVER.

	* gdbserver/Makefile.in (INCLUDE_CFLAGS): Add -I$(srcdir)/../common.
	(server_h): Add gdb_signals.h.
	(signals.o): Update.
	* server.h (target_signal_from_host,target_signal_to_host_p)
	(target_signal_to_host,target_signal_to_name): Moved to gdb_signals.h.
2009-03-02 00:45:13 +00:00
Pierre Muller 86b1f9c56c * remote-utils.c (getpkt): Also generate remote-debug
information if noack_mode is set.
2009-02-14 00:07:51 +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
Pedro Alves 62709adfbe gdb/gdbserver/
* server.c (gdbserver_usage): Mention --remote-debug.
	(main): Accept '--remote-debug' switch.

gdb/doc/
	* gdb.texinfo (Using the `gdbserver' Program): Document
	--remote-debug.
2009-01-26 16:16:48 +00:00
Doug Evans aef93bd75f * regcache.c (new_register_cache): No need to check result of xcalloc.
* server.c (handle_search_memory): Back out calls to xmalloc,
	result is checked and error is returned to user upon failure.
	(handle_query): Ditto.  Add more checks for result of malloc.
	(handle_v_cont): Check result of malloc, report error back to
	user upon failure.
	(handle_v_run): Ditto.  Call freeargv.
	* server.h (freeargv): Declare.
	* utils.c (freeargv): New fn.
2009-01-19 00:16:46 +00:00
Doug Evans 0842e7871a fix another cut-n-paste error 2009-01-15 22:18:54 +00:00
Doug Evans f626972c20 fix cut-n-paste errors in previous checkin 2009-01-15 22:10:05 +00:00
Doug Evans 5436304513 * target.h (target_signal_to_string): Make return type const char *.
(target_signal_to_name): Ditto.
	(target_signal_from_name): Make arg const char *.
	* thread-db.c (thread_db_err_str): Make return type const char *.
	* utils.c (perror_with_name): Make arg const char *.
	* infrun.c (sig_print_info): Update.

	* signals/signals.c (signals): Make array and struct members const.
	(target_signal_to_string): Make return type const char *.
	(target_signal_to_name): Ditto.
	(target_signal_from_name): Make arg const char *.

	* gdbserver/gdbreplay.c (perror_with_name): Make arg const char *.
	* gdbserver/server.h (target_signal_to_name): Make return type
	const char *.
2009-01-15 22:07:20 +00:00
Pedro Alves 18aae69934 * win32-low.c (get_child_debug_event): Issue a final DBG_CONTINUE
when handling a EXIT_PROCESS_DEBUG_EVENT.
2009-01-14 13:42:27 +00:00
Joel Brobecker ff703abe64 * gdbreplay.c (gdbreplay_version): Update copyright year.
* server.c (gdbserver_version): Likewise.
2009-01-06 04:49:29 +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
Doug Evans e3b886f8c3 * linux-low.h (struct process_info): Delete member tid, unused.
* thread-db.c (find_one_thread): Update.
	(maybe_attach_thread): Update.
2008-12-09 18:52: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
Doug Evans 4cab47abf7 * Makefile.in (VERSION,DIST,LINT,LINTFLAGS): Delete, unused. 2008-11-24 21:01:36 +00:00
Daniel Jacobowitz f142445f87 * server.c (handle_v_run): Always use the supplied argument list. 2008-11-24 18:05:02 +00:00
Bob Wilson d0107bb6ae gdb/
* xtensa-config.c (rmap): Remove entries for ar32 through ar63.  Add
	threadptr, scompare1, mmid, epc5, epc6, epc7, eps5, eps6, eps7,
	excsave5, excsave6, excsave7, cpenable, and vecbase registers.
	(xtensa_submask0, xtensa_submask1, xtensa_submask2)
	(xtensa_submask3, xtensa_submask4, xtensa_submask5, xtensa_submask6)
	(xtensa_submask7, xtensa_submask8, xtensa_submask9, xtensa_submask10)
	(xtensa_submask11, xtensa_submask12, xtensa_submask13, xtensa_submask14)
	(xtensa_submask15): Adjust register numbers.
	* xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4.
	(xtensa_regmap_table): Add entry for scompare1.
	* regformats/reg-xtensa.dat: Remove ar32 through ar63.  Add threadptr
	and scompare1.
gdb/gdbserver/
	* xtensa-xtregs.c (XTENSA_ELF_XTREG_SIZE): Change to 4.
	(xtensa_regmap_table): Add entry for scompare1.
2008-11-19 18:29:47 +00:00
Thiago Jung Bauermann 2c4ad78125 gdb/
* features/Makefile (rs6000/powerpc-isa205-32l-expedite,
	rs6000/powerpc-isa205-altivec32l-expedite,
	powerpc-isa205-vsx32l-expedite, rs6000/powerpc-isa205-64l-expedite,
	rs6000/powerpc-isa205-altivec64l-expedite,
	powerpc-isa205-vsx64l-expedite): New variables.
	* regformats/rs6000/powerpc-isa205-32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-altivec32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-vsx32l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-64l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-altivec64l.dat: Generate.
	* regformats/rs6000/powerpc-isa205-vsx64l.dat: Generate.

gdbserver/
	* Makefile.in (powerpc-isa205-32l.o, powerpc-isa205-32l.c,
	powerpc-isa205-altivec32l.o, powerpc-isa205-altivec32l.c,
	powerpc-isa205-vsx32l.o, powerpc-isa205-vsx32l.c,
	powerpc-isa205-64l.o, powerpc-isa205-64l.c,
	powerpc-isa205-altivec64l.o, powerpc-isa205-altivec64l.c,
	powerpc-isa205-vsx64l.o, powerpc-isa205-vsx64l.c): New targets.
	* configure.srv (powerpc*-*-linux*): Add ISA 2.05 object files and
	XML target descriptions.
	* linux-ppc-low.c (ppc_arch_setup): Init registers with 64-bit FPSCR
	when inferior is running on an ISA 2.05 or later processor.  Add
	special case to return offset for full 64-bit slot of FPSCR when
	in 32-bits.
2008-11-18 21:48:48 +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
Doug Evans 66b6e1dd14 * Makefile.in (BFD_DIR,BFD,BFD_SRC,BFD_CFLAGS): Delete.
(READLINE_DIR,READLINE_DEP): Delete.
	(INTERNAL_CFLAGS): Update.
	(LINTFLAGS): Update.
2008-10-21 21:22:53 +00:00
Pedro Alves 9b710a4294 * server.c (handle_v_run): If GDB didn't specify an argv, use the
whole argv from the last run, not just argv[0].
2008-10-10 14:06:05 +00:00
Pedro Alves 5822d809e7 * regcache.c (new_register_cache): Return NULL if the register
cache size isn't known yet.
	(free_register_cache): Avoid dereferencing a NULL regcache.
2008-09-08 21:16:18 +00:00
Daniel Jacobowitz 74aac56ff7 * configure.srv: Merge MIPS and MIPS64. 2008-09-04 17:05:24 +00:00
Maciej W. Rozycki 400b20f5ec * Makefile.in (uninstall): Apply $(EXEEXT) too. 2008-08-24 18:40:37 +00:00
Luis Machado 677c5bb1ab * doc/gdb.texinfo (PowerPC): Mention Extended FPR's for POWER7.
(PowerPC features): Mention feature set for VSX registers.

	* gdbserver/Makefile.in: Add required vsx dependencies.

	* gdbserver/linux-ppc-low: Define PPC_FEATURE_HAS_VSX.
	Declare init_registers_powerpc_vsx32l.
	Declare init_registers_powerpc_vsx64l.
	Define PTRACE_GETVSXREGS and PTRACE_SETVSXREGS.
	(ppc_arch_setup): Check for VSX in hwcap.
	(ppc_fill_vsxregset): New function.
	(ppc_store_vsxregset): New function.
	Add new VSX entry in regset_info target_regsets.

	* gdbserver/configure.srv: Add new VSX dependencies.
2008-08-18 15:46:08 +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
Ralf Wildenhues a417dc5696 gdb/
* aclocal.m4, configure: Rebuild.
	* configure.in: Call ZW_CREATE_DEPDIR,
	ZW_PROG_COMPILER_DEPENDENCIES, AC_PROG_MAKE_SET.
	(MAKE, GMAKE): New substs.
	* acinclude.m4: Include depstand.m4.
	* Makefile.in (DEPMODE, DEPDIR, COMPILE.post, COMPILE.pre,
	COMPILE, POSTCOMPILE, depcomp): New variables.
	Remove all _h variables.
	Remove many .o targets.
	($(srcdir)/copying.c): avoid backslash-newline after comment
	sign (@maintainer_mode_true@).
	(HFILES_NO_SRCDIR): Regenerate.
	(generated_files): New variable.
	(all_gdbtk_cflags): Likewise.
	(.c.o): Rewrote.
	(init.o, version.o, copying.o): Remove.
	(distclean): Remove DEPDIR.
	(test-cp-name-parser.o, hpux-thread.o, main.o, monitor.o,
	printcmd.o, procfs.o, v850ice.o): Rewrite.
	(cli-cmds.o, cli-decode.o, cli-dump.o, cli-interp.o, cli-logging.o,
	cli-script.o, cli-setshow.o, cli-utils.o): Likewise.
	(gdbtk.o, gdbtk-bp.o, gdbtk-cmds.o, gdbtk-hooks.o, gdbtk-interp.o,
	gdbtk-main.o, gdbtk-register.o, gdbtk-stack.o, gdbtk-varobj.o,
	gdbtk-wrapper.o): Likewise.
	(mi-cmd-break.o, mi-cmd-disas.o, mi-cmd-env.o, mi-cmd-file.o,
	mi-cmds.o, mi-cmd-stack.o, mi-cmd-target.o, mi-cmd-var.o,
	mi-console.o, mi-getopt.o, mi-interp.o, mi-main.o, mi-out.o,
	mi-parse.o, mi-symbol-cmds.o, mi-common.o, signals.o, tui.o,
	tui-command.o, tui-data.o, tui-disasm.o, tui-file.o, tui-hooks.o,
	tui-interp.o, tui-io.o, tui-layout.o, tui-main.o, tui-out.o,
	tui-regs.o, tui-source.o, tui-stack.o, tui-win.o, tui-windata.o,
	tui-wingeneral.o, tui-winsource.o): Likewise.
	(all_object_files): New variable.
	($(all_object_files)): New target.
	Include dependency files, when using GNU Make.

gdb/gdbserver/
	* Makefile.in (GDBREPLAY_OBS): New variable.
	(gdbreplay$(EXEEXT)): Use it to avoid unportable $^.
2008-08-07 22:49:10 +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
Pedro Alves ec56be1b4d * configure.ac: Check for memmem declaration.
* server.c [HAVE_MALLOC_H]: Include malloc.h.
	(disable_packet_vCont, disable_packet_Tthread, disable_packet_qC)
	(disable_packet_qfThreadInfo): Unconditionally compile.
	* server.h [!HAVE_DECL_MEMMEM]: Declare memmem.
	* configure, config.in: Regenerate.
2008-07-31 17:46:33 +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
Pedro Alves aeba519e76 * server.c (handle_v_attach): Inhibit reporting dll changes. 2008-07-07 23:00:11 +00:00
Pedro Alves db42f21025 * remote-utils.c (prepare_resume_reply): If requested, don't
output "thread:TID" in the T stop reply.

	* server.c (disable_packet_vCont, disable_packet_Tthread)
	(disable_packet_qC, disable_packet_qfThreadInfo): New globals.
	(handle_query): If requested, disable support for qC, qfThreadInfo
	and qsThreadInfo.
	(handle_v_requests): If requested, disable support for vCont.
	(gdbserver_show_disableable): New.
	(main): Handle --disable-packet and --disable-packet=LIST.

	* server.h (disable_packet_vCont, disable_packet_Tthread)
	(disable_packet_qC, disable_packet_qfThreadInfo): Declare.
2008-06-27 13:22:15 +00:00
Carlos O'Donell 8e4c5421d9 gdb/gdbserver/
2008-06-20  Carlos O'Donell  <carlos@codesourcery.com>

	* server.c (gdbserver_usage): Mention --version.
2008-06-20 16:01:42 +00:00
Daniel Jacobowitz 6e23a804c1 * Makefile.in (gdbreplay.o): New rule. 2008-06-06 22:19:50 +00:00
Joseph Myers 90aa6a4044 * gdbreplay.c (gdbreplay_version): Say gdbreplay in version
message, not gdbserver.
2008-06-06 20:38:35 +00:00
Joseph Myers c16158bc9c 2008-06-05 Vladimir Prus <vladimir@codesourcery.com>
Nathan Sidwell  <nathan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* acinclude.m4: Include ../config/acx.m4.
	* configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
	* configure, config.in: Regenerate.
	* main.c (print_gdb_help): Use REPORT_BUGS_TO for bug-reporting
	address.
	* top.c (print_gdb_version): Use PKGVERSION and REPORT_BUGS_TO.

doc:
2008-06-05  Vladimir Prus  <vladimir@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* configure.ac: Include ../../config/acx.m4.  Use ACX_PKGVERSION
	and ACX_BUGURL.
	* configure: Regenerate.
	* Makefile.in (PKGVERSION, BUGURL_TEXI): Define.
	(GDBvn.texi): Define VERSION_PACKAGE, BUGURL and BUGURL_DEFAULT.
	* gdb.texinfo: Use VERSION_PACKAGE and BUGURL.  Remove
	mailing-list-specific text about bug reporting unless
	BUGURL_DEFAULT.

gdbserver:
2008-06-05  Vladimir Prus  <vladimir@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* acinclude.m4: Include ../../config/acx.m4.
	* configure.ac: Use ACX_PKGVERSION and ACX_BUGURL.
	* configure, config.in: Regenerate.
	* Makefile.in (gdbreplay$(EXEEXT)): Add version.o.
	* server.c (gdbserver_version): Print PKGVERSION.
	(gdbsrever_usage): Add stream parameter.  Print REPORT_BUGS_TO.
	(main): Adjust gdbserver_usage calls.
	* gdbreplay.c (version, host_name): Add declarations.
	(gdbreplay_version, gdbreplay_usage): New.
	(main): Accept --version and --help options.
2008-06-05 22:36:57 +00:00
Daniel Jacobowitz aeb75bf598 * linux-arm-low.c (thumb_breakpoint, thumb_breakpoint_len): New.
(arm_breakpoint_at): Handle Thumb.
	(the_low_target): Add comment.
2008-06-04 19:51:51 +00:00
Ulrich Weigand 76b233ddaa * linux-ppc-low.c (ppc_collect_ptrace_register): Clear buffer. 2008-05-29 11:53:12 +00:00
Doug Evans a3c83fae41 remove cruft from previous checkin 2008-05-09 18:08:56 +00:00
Doug Evans 5e1471f57f * error.c (parse_find_args): Fix capitalization in previous patch.
(find_command): Ditto.
	* target.c (simple_search_memory): Ditto.
	* gdbserver/server.c (handle_search_memory_1): Ditto.
	(handle_search_memory): Ditto.
2008-05-09 17:37:36 +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 bb9c3d36f1 * regcache.c (registers_length): Remove.
(set_register_cache): Verify that PBUFSIZ is large enough to hold a
	full register packet.
	* regcache.h (registers_length): Remove prototype.
	* server.h (PBUFSIZ): Define to 16384.
2008-05-08 19:46:56 +00:00
Ulrich Weigand 7284e1bed8 ChangeLog:
* Makefile.in (ppc_linux_tdep_h): New macro.
	(powerpc_32l_c, powerpc_altivec32_c, powerpc_altivec32l_c): Likewise.
	(powerpc_64l_c, powerpc_altivec64_c, powerpc_altivec64l_c): Likewise.
	(powerpc_e500l_c): Likewise.
	(ppc-linux-nat.o): Update dependencies.
	(ppc-linux-tdep.o): Update dependencies.
	(rs6000-tdep.o): Update dependencies.

	* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Remove.
	(ppc_linux_svr4_fetch_link_map_offsets): Remove.
	(ppc_linux_gregset, ppc_linux_fpregset): Move to ppc-linux-tdep.h
	(ppc_supply_reg, ppc_collect_reg): Add prototypes.
	(tdesc_powerpc_e500): Remove.

	* rs6000.c: Include "features/rs6000/powerpc-altivec32.c"
	and "features/rs6000/powerpc-altivec64.c".
	(ppc_supply_reg, ppc_collect_reg): Make global.
	(variants): Use tdesc_powerpc_32 for "powerpc" and
	tdesc_powerpc_altivec64 for "powerpc64".
	(_initialize_rs6000_tdep): Initialize AltiVec descriptions.

	* ppc-linux-tdep.h: New file.

	* ppc-linux-tdep.c: Include "ppc-linux-tdep.c".
	Include "features/rs6000/powerpc-32l.c".
	Include "features/rs6000/powerpc-altivec32l.c".
	Include "features/rs6000/powerpc-64l.c".
	Include "features/rs6000/powerpc-altivec64l.c".
	Include "features/rs6000/powerpc-e500l.c".
	(ppc_linux_supply_gregset): New function.
	(ppc_linux_collect_gregset): Handle orig_r3 and trap registers.
	(ppc32_linux_gregset): Use ppc_linux_supply_gregset.
	(ppc64_linux_gregset): Likewise.
	(ppc_linux_sigtramp_cache): Handle orig_r3 and trap registers.
	(ppc_linux_trap_reg_p): New function.
	(ppc_linux_write_pc): New function.
	(ppc_linux_core_read_description): New function.
	(ppc_linux_init_abi): Install ppc_linux_write_pc and
	ppc_linux_core_read_description.  Install orig_r3 and trap
	registers if present in the target description.
	(_initialize_ppc_linux_tdep): Initialize Linux target descriptions.

	* ppc-linux-nat.c: Include "ppc-linux-tdep.h".
	(PT_ORIG_R3, PT_TRAP): Define if necessary.
	(ppc_register_u_addr): Handle orig_r3 and trap registers.
	(fetch_ppc_registers): Likewise.
	(store_ppc_registers): Likewise.
	(store_register): Likewise.
	(ppc_linux_read_description): Check whether AltiVec is supported.
	Check whether inferior is 32-bit or 64-bit.  Return the appropriate
	Linux target description.

	* features/Makefile (WHICH): Use rs6000/powerpc-32l and
	rs6000/powerpc-altivec32l instead of rs6000/powerpc-32.
	Use rs6000/powerpc-64l and rs6000/powerpc-altivec64l instead
	of rs6000/powerpc-64.  Use rs6000/powerpc-e500l instead of
	rs6000/powerpc-e500.  Update -expedite variables accordingly.

	* features/rs6000/power-spe.xml: Use regnum 73 for "acc".
	* features/rs6000/powerpc-32.xml: Do not include power-altivec.xml.
	* features/rs6000/powerpc-64.xml: Do not include power-altivec.xml.
	* features/rs6000/powerpc-e500.c: Regenerate.
	* features/rs6000/powerpc-32.c: Regenerate.
	* features/rs6000/powerpc-64.c: Regenerate.

	* features/rs6000/power-linux.xml: New file.
	* features/rs6000/power64-linux.xml: New file.
	* features/rs6000/powerpc-32l.xml: New file.
	* features/rs6000/powerpc-altivec32l.xml: New file.
	* features/rs6000/powerpc-64l.xml: New file.
	* features/rs6000/powerpc-altivec64l.xml: New file.
	* features/rs6000/powerpc-e500l.xml: New file.
	* features/rs6000/powerpc-32l.c: New (generated) file.
	* features/rs6000/powerpc-altivec32l.c: New (generated) file.
	* features/rs6000/powerpc-64l.c: New (generated) file.
	* features/rs6000/powerpc-altivec64l.c: New (generated) file.
	* features/rs6000/powerpc-e500l.xml: New (generated) file.

	* regformats/reg-ppc.dat: Remove.
	* regformats/reg-ppc64.dat: Remove.
	* regformats/rs6000/powerpc-32.dat: Remove.
	* regformats/rs6000/powerpc-64.dat: Remove.
	* regformats/rs6000/powerpc-e500.dat: Remove.
	* regformats/rs6000/powerpc-32l.dat: New (generated) file.
	* regformats/rs6000/powerpc-altivec32l.dat: New (generated) file.
	* regformats/rs6000/powerpc-64l.dat: New (generated) file.
	* regformats/rs6000/powerpc-altivec64l.dat: New (generated) file.
	* regformats/rs6000/powerpc-e500l.dat: New (generated) file.

gdbserver/ChangeLog:

	* configure.srv (powerpc*-*-linux*): Set srv_regobj to
	powerpc-32l.o, powerpc-altivec32l.o, powerpc-e500l.o,
	powerpc-64l.o, and powerpc-altivec64l.o.
	Remove rs6000/powerpc-32.xml, rs6000/powerpc-64.xml, and
	rs6000/powerpc-e500.xml; add rs6000/powerpc-32l.xml,
	rs6000/powerpc-altivec32l.xml, rs6000/powerpc-e500l.xml,
	rs6000/powerpc-64l.xml, rs6000/powerpc-altivec64l.xml,
	rs6000/power-linux.xml, and rs6000/power64-linux.xml
	to srv_xmlfiles.

	* Makefile.in (reg-ppc.o, reg-ppc.c): Remove, replace by ...
	(powerpc-32l.o, powerpc-32l.c): ... these new rules.
	(powerpc-32.o, powerpc-32.c): Remove, replace by ...
	(powerpc-altivec32l.o, powerpc-altivec32l.c): ... these new rules.
	(powerpc-e500.o, powerpc-e500.c): Remove, replace by ...
	(powerpc-e500l.o, powerpc-e500l.c): ... these new rules.
	(reg-ppc64.o, reg-ppc64.c): Remove, replace by ...
	(powerpc-64l.o, powerpc-64l.c): ... these new rules.
	(powerpc-64.o, powerpc-64.c): Remove, replace by ...
	(powerpc-altivec64l.o, powerpc-altivec64l.c): ... these new rules.
	(clean): Update.

	* linux-ppc-low.c (init_registers_ppc): Remove, replace by ...
	(init_registers_powerpc_32l): ... this new prototype.
	(init_registers_powerpc_32): Remove, replace by ...
	(init_registers_powerpc_altivec32l): ... this new prototype.
	(init_registers_powerpc_e500): Remove, replace by ...
	(init_registers_powerpc_e500l): ... this new prototype.
	(init_registers_ppc64): Remove, replace by ...
	(init_registers_powerpc_64l): ... this new prototype.
	(init_registers_powerpc_64): Remove, replace by ...
	(init_registers_powerpc_altivec64l): ... this new prototype.
	(ppc_num_regs): Set to 73.
	(PT_ORIG_R3, PT_TRAP): Define if necessary.
	(ppc_regmap, ppc_regmap_e500): Add values for orig_r3 and trap.
	(ppc_cannot_store_register): Handle orig_r3 and trap.
	(ppc_arch_setup): Update init_registers_... calls.
	(ppc_fill_gregset): Handle orig_r3 and trap.

	* inferiors.c (clear_inferiors): Reset current_inferior.
2008-05-03 17:16:44 +00:00
Paolo Bonzini fdc5970995 gdb:
2008-04-23  Paolo Bonzini  <bonzini@gnu.org>

        * acinclude.m4: Add override.m4.
        * configure: Regenerate.

gdb/gdbserver:
2008-04-23  Paolo Bonzini  <bonzini@gnu.org>

        * acinclude.m4: Add override.m4.
        * configure: Regenerate.

gdb/testsuite:
2008-04-23  Paolo Bonzini  <bonzini@gnu.org>

        * aclocal.m4: Add override.m4.
        * configure: Regenerate.
2008-04-23 12:21:50 +00:00
Ulrich Weigand c9b2f845a5 * linux-ppc-low.c (ppc_arch_setup): Reset ppc_hwcap after the
initial call to init_register_ppc64.
2008-04-21 20:31:22 +00:00
Ulrich Weigand 550512b831 * configure.srv (powerpc64-*-linux*, powerpc-*-linux*): Merge into single
powerpc*-*-linux* case.
	(s390-*-linux*, s390x-*-linux*): Merge into single s390*-*-linux* case.
2008-04-21 14:55:50 +00:00
Ulrich Weigand b6430ec3fe * configure.srv [powerpc64-*-linux*]: Remove powerpc-e500.o from
srv_regobj.  Remove rs6000/powerpc-e500.xml and rs6000/power-spe.xml
	from reg_xmlfiles.
	* linux-ppc-low.c: Include <elf.h>.
	(PPC_FEATURE_HAS_ALTIVEC, PPC_FEATURE_HAS_SPE): Define.
	(ppc_hwcap): New global variable.
	(ppc_regmap): Remove __SPE__ #ifdef sections.
	(ppc_regmap_e500): New global variable.
	(ppc_cannot_store_register): Update __SPE__ special case.
	(ppc_get_hwcap): New function.
	(ppc_arch_setup): Use it to determine whether inferior supports
	AltiVec or SPE registers.  Set the_low_target.regmap if appropriate.
	(ppc_fill_vrregset, ppc_store_vrregset): Define unconditionally.
	Do not access registers if target does not support AltiVec.
	(ppc_fill_evrregset, ppc_store_evrregset): Define unconditionally.
	Do not access registers if target does not support SPE.
	(target_regsets): Unconditionally include AltiVec and SPE regsets.
2008-04-17 21:22:41 +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
Daniel Jacobowitz e28b33320c * Makefile.in (LIBGNU, INCGNU): Define.
(INTERNAL_CFLAGS_BASE): Add INCGNU.
	(INTERNAL_LIBS, CLIBS, CDEPS): Add LIBGNU.
	(CLEANDIRS): New.
	($(LIBGNU), all-lib): New rules.
	(clean, distclean, do-maintainer-clean): Use CLEANDIRS.
	* configure.ac: Use gl_EARLY, gl_INIT, and AM_INIT_AUTOMAKE.
	Simplify AC_CONFIG_AUX_DIR.  Generate gnulib/Makefile.
	* gnulib: New directory, from gnulib-tool.
	* configure, aclocal.m4: Regenerated.

	* Makefile.in (LIBOBJS): New.
	(OBS): Use LIBOBJS.
	(memmem.o): New rule.
	* configure.ac: Use AC_CONFIG_LIBOBJ_DIR and check for memmem.
	* configure: Regenerated.
2008-04-14 18:04:00 +00:00
Ulrich Weigand 4536995d8b * server.c (handle_query): Never return "unsupported" for
qXfer:features:read queries.
2008-04-04 19:19:11 +00:00
Ulrich Weigand 221c031fac ChangeLog:
* features/Makefile (%.dat): Set xmltarget to the base filename
	of the XML source, without subdirectory.
	* regformats/rs6000/powerpc-32.dat: Regenerate.
	* regformats/rs6000/powerpc-64.dat: Regenerate.
	* regformats/rs6000/powerpc-e500.dat: Regenerate.

gdbserver/ChangeLog:

	* server.c (get_features_xml): Fix inverted condition.
	(handle_query): Always support qXfer:feature:read.
2008-03-27 13:11:52 +00:00
Daniel Jacobowitz ccd213ac7e * Makefile.in (fork-child.o): Update.
* NEWS: Document "set exec-wrapper" and the gdbserver --wrapper
	argument.  Gather all gdbserver features together.
	* fork-child.c (exec_wrapper): New variable.
	(fork_inferior): Use it.
	(startup_inferior): Skip an extra trap if using "set exec-wrapper".
	(unset_exec_wrapper_command, _initialize_fork_child): New.

	* gdb.texinfo (Starting): Document "set exec-wrapper".
	(Server): Document gdbserver --wrapper.

	* server.c (wrapper_argv): New.
	(start_inferior): Handle wrapper_argv.  If set, expect an extra
	trap.
	(gdbserver_usage): Document --wrapper.
	(main): Parse --wrapper.
2008-03-10 23:14:06 +00:00
Ulrich Weigand 6fe305f7fb ChangeLog:
* regformats/reg-ppc.dat: Rename "ps" to "msr".
	* regformats/reg-ppc64.dat: Likewise.

gdbserver/ChangeLog:

	* configure.srv [powerpc64-*-linux*]: Add all files mentioned for
	powerpc-*-linux* to srv_regobj and reg_xmlfiles.
	* linux-ppc-low.c (ppc_get_pc): Support bi-arch operation.
	(ppc_set_pc): Likewise.
	(ppc_arch_setup): New function.
	(ppc_fill_gregset): Call ppc_collect_ptrace_register instead
	of collect_register.
	(the_low_target): Use ppc_arch_setup as arch_setup initializer.
2008-02-28 05:57:45 +00:00
Ulrich Weigand 5b0a002e22 * configure.srv [powerpc64-*-linux*]: Use linux-ppc-low.o
instead of linux-ppc64-low.o.
	* linux-ppc64-low.c: Remove file.
	* Makefile.in (SFILES): Remove linux-ppc64-low.c.
	(linux-ppc64-low.o): Remove rule.

	* linux-ppc-low.c (init_registers_ppc64): Add prototype.
	(init_registers_powerpc_64): Likewise.
	(ppc_regmap): Conditionally define depending on __powerpc64__.
	(ppc_cannot_store_register): Do not special-case "fpscr" when
	compiled on __powerpc64__.
	(ppc_collect_ptrace_register): New function.
	(ppc_supply_ptrace_register): New function.
	(ppc_breakpoint): Change type to "unsigned int".
	(ppc_breakpoint_at): Change type of "insn" to "unsigned int".
	(the_low_target): Conditionally provide initializers for the
	arch_setup member depending on __powerpc64__.  Install
	collect_ptrace_register and supply_ptrace_register members.
2008-02-28 05:55:55 +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 fd96d2509c doc/
* gdb.texinfo (vAttach, vRun): Remove requirement of the stub
	killing the inferior when it is already debugging a process.

gdbserver/
	* server.c (handle_v_requests): When handling the vRun and vAttach
	packets, if already debugging a process, don't kill it.  Return an
	error instead.
2008-02-19 21:36:54 +00:00
Daniel Jacobowitz d41b6bb462 * server.c (handle_query): Correct length check. 2008-02-17 15:26:17 +00:00
Pedro Alves 5ac588cfb0 * win32-low.c (do_initial_child_stuff): Add process handle
parameter.  Set current_process_handle and current_process_id from the
	parameters. Clear globals.
	(win32_create_inferior): Don't set current_process_handle and
	current_process_id here.  Instead pass them on the call to
	do_initial_child_stuff.
	(win32_attach): Likewise.
	(win32_clear_inferiors): New.
	(win32_kill): Don't close the current process handle or the
	current thread handle here.  Instead call win32_clear_inferiors.
	(win32_detach): Don't open a new handle to the process.  Call
	win32_clear_inferiors.
	(win32_join): Don't rely on current_process_handle; open a new
	handle using the process id.
	(win32_wait): Call win32_clear_inferiors when the inferior process
	has exited.
2008-02-14 22:41:39 +00:00
Daniel Jacobowitz ecd7ecbca2 * server.c (monitor_show_help): Add "exit". 2008-02-14 16:42:55 +00:00
Maxim Grigoriev 1525d5452d 2008-02-11 Maxim Grigoriev <maxim2405@gmail.com>
* gdbserver/Makefile.in (SFILES): Add linux-xtensa-low.c.
	(clean): Add reg-xtensa.c.
	(linux-xtensa-low.o, reg-xtensa.o, reg-xtensa.c): New dependencies.
	* gdbserver/configure.srv (xtensa*-*-linux*) New target.
	* gdbserver/linux-xtensa-low.c: New.
	* gdbserver/xtensa-xtregs.c: New.
2008-02-11 22:00:31 +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 4e79934594 * configure.ac: Check for pread and pwrite.
* hostio.c (handle_pread): Fall back to lseek and read.
	(handle_pwrite): Fall back to lseek and write.
	* config.in, configure: Regenerated.
2007-12-16 21:50:05 +00:00
Daniel Jacobowitz 27524b67e1 * server.c (myresume): Add own_buf argument.
(main): Update calls.
2007-12-07 14:00:37 +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 b79d787e44 2007-12-06 Mick Davis <mickd@goanna.iinet.net.au>
* remote-utils.c (readchar): Allow binary data in received messages.
2007-12-06 14:21:26 +00:00
Pedro Alves d97903b290 * win32-low.c (attaching): New global.
(win32_create_inferior): Clear the `attaching' global.
	(win32_attach): Set the `attaching' global.
	(get_child_debug_event) [_WIN32_WCE]: Stop the inferior when
	attaching.  Only set a breakpoint at the entry point if not
	attaching.
2007-12-03 01:42:06 +00:00
Pedro Alves 311de42358 * server.c (main): Don't report dll events on the initial
connection on attaches.
2007-12-03 01:38:09 +00:00
Pedro Alves 6c2d16d2d3 * server.c (main): Relax numerical bases supported for the pid of
the --attach command line argument.
2007-12-03 01:34:09 +00:00
Pedro Alves 5ca906e670 * win32-low.c (win32_attach): Call OpenProcess before
DebugActiveProcess, not after.  Add last error output to error
	call.
2007-12-03 01:30:59 +00:00
Pedro Alves 9c6c819469 * win32-low.c (win32_get_thread_context)
(win32_set_thread_context): New functions.
	(thread_rec): Use win32_get_thread_context.
	(continue_one_thread, win32_resume): Use win32_set_thread_context.
	* win32-low.h (win32_thread_info) [_WIN32_WCE]: Add `base_context'
	field.
2007-12-03 01:27:19 +00:00
Pedro Alves 4d5d1aaa19 * win32-low.c (soft_interrupt_requested, faked_breakpoint): New
global variables.
	(child_add_thread): Minor cleanup.
	(child_continue): Resume artificially suspended threads before
	calling ContinueDebugEvent.
	(suspend_one_thread): New.
	(fake_breakpoint_event): New.
	(get_child_debug_event): Change return type to int.  Check here if
	gdb sent an interrupt request.  If a soft interrupt was requested,
	fake a breakpoint event.  Return 0 if there is no event to handle,
	and 1 otherwise.
	(win32_wait): Don't check here if gdb sent an interrupt request.
	Ensure there is a valid event to handle.
	(win32_request_interrupt): Add soft interruption method as last
	resort.
2007-12-03 01:18:49 +00:00
Pedro Alves c436e841ff * win32-low.h (win32_thread_info): Add descriptions to the
structure members.  Replace `suspend_count' counter by a
	`suspended' flag.
	* win32-low.c (thread_rec): Update condition of when to get the
	context from the inferior.  Rely on ContextFlags being set if it
	has already been retrieved.  Only suspend the inferior thread if
	we haven't already.  Warn if that fails.
	(continue_one_thread): s/suspend_count/suspended/.  Only call
	ResumeThread once.  Warn if that fails.
2007-12-03 01:10:30 +00:00
Pedro Alves e7b5fa67ed * win32-low.c (win32_wait): Don't read from the inferior when it
has already exited.
2007-12-02 23:40:17 +00:00
Pedro Alves a385171d78 * Makefile.in (win32_low_h): New variable.
(win32-low.o): Add dependency on $(win32_low_h).
	(win32-arm-low.o, win32-i386-low.o): New rules.
2007-12-02 23:33:26 +00:00
Daniel Jacobowitz f80c84b330 * hostio.c: Correct copyright year. 2007-12-01 05:00:04 +00:00
Daniel Jacobowitz a6b151f187 * remote.c (remote_cmdlist): New variable.
(PACKET_vFile_open, PACKET_vFile_pread, PACKET_vFile_pwrite)
	(PACKET_vFile_close, PACKET_vFile_unlink): New constants.
	(remote_buffer_add_string, remote_buffer_add_bytes)
	(remote_buffer_add_int, remote_hostio_parse_result)
	(remote_hostio_send_command, remote_hostio_open, remote_hostio_pwrite)
	(remote_hostio_pread, remote_hostio_close, remote_hostio_unlink)
	(remote_fileio_errno_to_host, remote_hostio_error, fclose_cleanup)
	(remote_hostio_close_cleanup, remote_file_put, remote_file_get)
	(remote_file_delete, remote_put_command, remote_get_command)
	(remote_delete_command, remote_command): New functions.
	(_initialize_remote): Register new packets and commands.
	* Makefile.in (gdb_fileio_h): New variable.
	(remote.o): Update.
	(SUBDIR_MI_OBS): Add mi-cmd-target.o.
	(SUBDIR_MI_SRCS): Add mi/mi-cmd-target.c.
	(mi-cmd-target.o): New rule.
	* mi/mi-cmd-target.c: New file.
	* mi/mi-cmds.c (mi_cmds): Add target-file-delete, target-file-get,
	and target-file-put.
	* mi/mi-cmds.h (mi_cmd_target_file_get, mi_cmd_target_file_put)
	(mi_cmd_target_file_delete): Declare.
	* remote.h (remote_file_put, remote_file_get, remote_file_delete):
	Declare.
	* NEWS: Describe new file transfer support.

	* gdb.texinfo (Debugging Programs with Multiple Processes): Correct
	formatting.
	(Remote Debugging): Add File Transfer section.
	(Remote Configuration): Document Host I/O packets.
	(GDB/MI): Add GDB/MI File Transfer Commands section.
	(Remote Protocol): Add Host I/O Packets section.
	(Packets): Add vFile.

	* Makefile.in (OBS): Add hostio.o.
	(hostio.o): New rule.
	* server.h (handle_vFile): Declare.
	* hostio.c: New file.
	* server.c (handle_v_requests): Take packet_len and new_packet_len
	for binary packets.  Call handle_vFile.
	(main): Update call to handle_v_requests.

	* gdb.server/file-transfer.exp, gdb.server/transfer.txt,
	gdb.mi/mi-file-transfer.exp: New.
2007-11-30 21:50:19 +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
Joel Brobecker 75f831630e * Makefile.in: Use $(SHELL) instead of "sh" to call regdat.sh. 2007-10-31 21:39:14 +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 30ed0a8f0b * Makefile.in (clean): Remove new files.
(powerpc-32.o, powerpc-32.c, powerpc-e500.o, powerpc-e500.c)
	(powerpc-64.o, powerpc-64.c): New rules.
	* configure.srv: Use alternate register sets for powerpc64-*-linux*
	with AltiVec, powerpc-*-linux* with AltiVec, and powerpc-*-linux*
	with SPE.
	* linux-ppc-low.c (ppc_regmap): Do not fetch the FP registers for
	SPE targets.
	(ppc_cannot_store_register): Do not check for FPSCR for SPE targets.
	(PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, ppc_fill_vrregset)
	(ppc_store_vrregset, PTRACE_GETEVRREGS, PTRACE_SETEVRREGS)
	(struct gdb_evrregset_t, ppc_fill_evrregset, ppc_store_evrregset): New.
	(target_regsets): Add AltiVec and SPE register sets.
	* configure.ac: Check for AltiVec and SPE.
	* linux-ppc64-low.c (PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS)
	(ppc_fill_vrregset, ppc_store_vrregset): New.
	(target_regsets): Add AltiVec register set.
	* configure: Regenerated.

	* features/Makefile (WHICH): Add PowerPC register definitions.
	(rs6000/powerpc-32-expedite, rs6000/powerpc-e500-expedite)
	(rs6000/powerpc-64-expedite): New macros.
	($(outdir)/%.dat): Handle subdirectories.
	* regformats/rs6000/powerpc-32.dat, regformats/rs6000/powerpc-64.dat,
	regformats/rs6000/powerpc-e500.dat: New generated files.
2007-10-15 19:58:17 +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
Pedro Alves aec18585f0 * win32-low.c (create_process): New.
(win32_create_inferior): Use create_process instead of
	CreateProcess.  If create_process failed retry appending an ".exe"
	suffix.  Store the GetLastError result immediatelly after
	create_process calls and use it on the call to error.
2007-09-03 22:17:27 +00:00
Pedro Alves 34d86dddf2 * win32-low.c (handle_load_dll): Don't use toolhelp when waiting. 2007-09-03 22:04:02 +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
Joel Brobecker 5a0e3bd0ac * configure.ac: Switch license to GPLv3. 2007-08-23 17:58:44 +00:00
Michael Snyder f88c79e6bb 2007-08-01 Michael Snyder <msnyder@access-company.com>
* remote-utils.c (putpkt_binary): Memory leak, free buf2.
2007-08-01 20:34:36 +00:00
Pedro Alves 6b3d9b8313 * win32-low.c (winapi_CloseToolhelp32Snapshot) [_WIN32_WCE]: New
typedef.
	(win32_CloseToolhelp32Snapshot) [_WIN32_WCE]: New global var.
	(load_toolhelp) [_WIN32_WCE]: Load TOOLHELP.DLL.  Get
	CloseToolhelp32Snapshot.
	(toolhelp_get_dll_name) [_WIN32_WCE]: Close the snapshot with
	CloseToolhelp32Snapshot.
2007-07-31 13:58:19 +00:00
Michael Snyder c588c53caf 2007-07-27 Michael Snyder <michael.snyder@access-company.com>
* server.c (main): Check for inferior exit before main loop.
2007-07-27 18:44:40 +00:00
Pedro Alves aa0403d920 * remote-utils.c (remote_open): Set SO_KEEPALIVE on remote_desc
instead of on tmp_desc.
2007-07-18 12:36:51 +00:00
Daniel Jacobowitz 255e7678a9 2007-07-17 Pedro Alves <pedro_alves@portugalmail.pt>
Daniel Jacobowitz  <dan@codesourcery.com>

	* config/i386/cygwin.mt (TDEPFILES): Add solib-target.o.
	* coff-pe-read.c (read_pe_exported_syms): Delete verbose
	printf.
	* NEWS: Mention gdbserver DLL support.

	* gdb.base/unload.c (dlopen, dlsym, dlclose, dlerror): Define
	for __WIN32__.
	(SHLIB_NAME): Delete definition.  Always pass dlerror to fprintf.
	* gdb.base/unload.exp: Use shared library test routines.

	* inferiors.c (all_dlls, dlls_changed, get_dll): New.
	(add_thread): Minor cleanups.
	(clear_inferiors): Move lower in the file.  Clear the DLL
	list.
	(free_one_dll, match_dll, loaded_dll, unloaded_dll, clear_list): New.
	* remote-utils.c (prepare_resume_reply): Check dlls_changed.
	(xml_escape_text): New.
	* server.c (handle_query): Handle qXfer:libraries:read.  Report it
	for qSupported.
	(handle_v_cont): Report errors.
	(gdbserver_version): Update.
	(main): Correct size of own_buf.  Do not report initial DLL events.
	* server.h (struct dll_info, all_dlls, dlls_changed, loaded_dll)
	(unloaded_dll, xml_escape_text): New.
	* win32-low.c (enum target_waitkind): Update comments.
	(win32_add_one_solib, get_image_name, winapi_EnumProcessModules)
	(winapi_GetModuleInformation, winapi_GetModuleFileNameExA)
	(win32_EnumProcessModules, win32_GetModuleInformation)
	(win32_GetModuleFileNameExA, load_psapi, psapi_get_dll_name)
	(winapi_CreateToolhelp32Snapshot, winapi_Module32First)
	(winapi_Module32Next, win32_CreateToolhelp32Snapshot)
	(win32_Module32First, win32_Module32Next, load_toolhelp)
	(toolhelp_get_dll_name, handle_load_dll, handle_unload_dll): New.
	(get_child_debug_event): Handle DLL events.
	(win32_wait): Likewise.
2007-07-17 12:51:41 +00:00