Commit Graph

491 Commits

Author SHA1 Message Date
Pedro Alves fc7238bbba * inferiors.c (add_thread): Set last_status kind to
TARGET_WAITKIND_IGNORE.
	* linux-low.c (cancel_breakpoint): Remove unnecessary regcache
	fetch.  Use ptid_of.  Avoid unnecessary get_lwp_thread calls.
	(linux_wait_1): Move `thread' local definition to block that uses
	it.  Don't NULL initialize `event_child'.
	(linux_resume_one_thread): Avoid unnecessary get_lwp_thread calls.
	Alway set the thread's last_status to TARGET_WAITKIND_IGNORE.
	* linux-x86-low.c (x86_breakpoint_at): Read raw memory.
2010-04-03 23:14:18 +00:00
Pedro Alves bdabb07895 * linux-low.c (get_stop_pc): Don't adjust the PC if stopped with
an extended waitstatus, or by a watchpoint.
	(cancel_breakpoints_callback): Don't cancel a breakpoint if the
	thread was stepping or has been stopped by a watchpoint.
2010-04-01 15:31:26 +00:00
Pedro Alves d3bbe7a0c8 * mem-break.c (struct raw_breakpoint): New field shlib_disabled.
(set_gdb_breakpoint_at): If GDB is inserting a breakpoint on top
	of another, then delete the previous, and validate all
	breakpoints.
	(validate_inserted_breakpoint): New.
	(delete_disabled_breakpoints): New.
	(validate_breakpoints): New.
	(check_mem_read): Validate breakpoints before trusting their
	shadow.  Delete disabled breakpoints.
	(check_mem_write): Validate breakpoints before trusting they
	should be inserted.  Delete disabled breakpoints.
	* mem-break.h (validate_breakpoints):
	* server.c (handle_query): Validate breakpoints when we see a
	qSymbol query.
2010-04-01 14:26:53 +00:00
Pedro Alves 8b07ae33f0 * linux-low.c (linux_wait_1): Avoid setting need_step_over is
there's a GDB breakpoint at stop_pc.  Always report a trap to GDB
	if we could tell there's a GDB breakpoint at stop_pc.
	(need_step_over_p): Don't do a step over if we find a GDB
	breakpoint at the resume PC.

	* mem-break.c (struct raw_breakpoint): New.
	(enum bkpt_type): New type `gdb_breakpoint'.
	(struct breakpoint): Delete the `PC', `old_data' and `inserted'
	fields.  New field `raw'.
	(find_raw_breakpoint_at): New.
	(set_raw_breakpoint_at): Handle refcounting.  Create a raw
	breakpoint instead.
	(set_breakpoint_at): Adjust.
	(delete_raw_breakpoint): New.
	(release_breakpoint): New.
	(delete_breakpoint): Rename to...
	(delete_breakpoint_1): ... this.  Add proc parameter.  Use
	release_breakpoint.  Return ENOENT.
	(delete_breakpoint): Reimplement.
	(find_breakpoint_at): Delete.
	(find_gdb_breakpoint_at): New.
	(delete_breakpoint_at): Delete.
	(set_gdb_breakpoint_at): New.
	(delete_gdb_breakpoint_at): New.
	(gdb_breakpoint_here): New.
	(set_reinsert_breakpoint): Use release_breakpoint.
	(uninsert_breakpoint): Rename to ...
	(uninsert_raw_breakpoint): ... this.
	(uninsert_breakpoints_at): Adjust to handle raw breakpoints.
	(reinsert_raw_breakpoint): Change parameter type to
	raw_breakpoint.
	(reinsert_breakpoints_at): Adjust to handle raw breakpoints
	instead.
	(check_breakpoints): Adjust.  Use release_breakpoint.
	(breakpoint_here): Rewrite using find_raw_breakpoint_at.
	(breakpoint_inserted_here): Ditto.
	(check_mem_read): Adjust to iterate over raw breakpoints instead.
	Don't trust the breakpoint's shadow if it is not inserted.
	(check_mem_write): Adjust to iterate over raw breakpoints instead.
	(delete_all_breakpoints): Adjust.
	(free_all_breakpoints): Mark all breakpoints as uninserted, and
	use delete_breakpoint_1.

	* mem-break.h (breakpoints_supported): Delete declaration.
	(set_gdb_breakpoint_at): Declare.
	(gdb_breakpoint_here): Declare.
	(delete_breakpoint_at): Delete.
	(delete_gdb_breakpoint_at): Declare.

	* server.h (struct raw_breakpoint): Forward declare.
	(struct process_info): New field `raw_breakpoints'.

	* linux-x86-low.c (x86_insert_point, x86_remote_point): Handle Z0
	breakpoints.
2010-04-01 14:25:34 +00:00
Pedro Alves 6bf5e0ba81 * linux-low.c (status_pending_p_callback): Fix comment.
(linux_wait_for_event_1): Move most of the internal breakpoint
	handling from here...
	(linux_wait_1): ... to here.
	(count_events_callback): New.
	(select_singlestep_lwp_callback): New.
	(select_event_lwp_callback): New.
	(cancel_breakpoints_callback): New.
	(select_event_lwp): New.
	(linux_wait_1): Simplify internal breakpoint handling.  Give equal
	priority to all LWPs that have had events that should be reported
	to the client.  Cancel breakpoints when about to reporting the
	event to the client, not while stopping lwps.  No longer cancel
	finished single-steps here.
	(cancel_finished_single_step): Delete.
	(cancel_finished_single_steps): Delete.
2010-03-24 21:12:45 +00:00
Pedro Alves 414a389f5c * mem-break.c (enum bkpt_type): New.
(struct breakpoint): New field `type'.
	(set_breakpoint_at): Change return type to struct breakpoint
	pointer.  Set type to `other_breakpoint' by default.
	(delete_breakpoint): Rewrite, supporting more than one breakpoint
	in the breakpoint list.
	(delete_reinsert_breakpoints): Only delete reinsert breakpoints.
	(reinsert_breakpoint): Rename to ...
	(reinsert_raw_breakpoint): ... this.
	(reinsert_breakpoints_at): Adjust.
	* mem-break.h (struct breakpoint): Declare.
	(set_breakpoint_at): Change return type to struct breakpoint
	pointer.
2010-03-24 21:11:25 +00:00
Pedro Alves 2280c721d8 * server.c (handle_query): Assign, not compare. 2010-03-24 00:14:54 +00:00
Pedro Alves d50171e439 Teach linux gdbserver to step-over-breakpoints.
* linux-low.c (can_hardware_single_step): New.
	(supports_breakpoints): New.
	(handle_extended_wait): If stopping threads, read the stop pc of
	the new cloned LWP.
	(get_pc): New.
	(get_stop_pc): Add `lwp' parameter.  Handle it.  Bail out if the
	low target doesn't support retrieving the PC.
	(add_lwp): Set last_resume_kind to resume_continue.
	(linux_attach_lwp_1): Adjust comments.  Always set stop_expected.
	(linux_attach): Don't clear stop_expected.  Set the lwp's
	last_resume_kind to resume_stop.
	(linux_detach_one_lwp): Don't check for removed breakpoints.
	(check_removed_breakpoint): Delete.
	(status_pending_p): Rename to ...
	(status_pending_p_callback): ... this.  Don't check for removed
	breakpoints.  Don't consider threads that are stopped from GDB's
	perspective.
	(linux_wait_for_lwp): Always read the stop_pc here.
	(cancel_breakpoint): New.
	(step_over_bkpt): New global.
	(linux_wait_for_event_1): Implement stepping over breakpoints.
	(gdb_wants_lwp_stopped): New.
	(gdb_wants_all_stopped): New.
	(linux_wait_1): Tag threads as gdb-wants-stopped.  Cancel finished
	single-step traps here.  Store the thread's last reported target
	wait status.
	(send_sigstop): Don't clear stop_expected.  Always set it,
	instead.
	(mark_lwp_dead): Remove reference to pending_is_breakpoint.
	(cancel_finished_single_step): New.
	(cancel_finished_single_steps): New.
	(wait_for_sigstop): Don't cancel finished single-step traps here.
	(linux_resume_one_lwp): Don't check for removed breakpoints.
	Don't set `step' on non-hardware step archs.
	(linux_set_resume_request): Ignore resume_stop requests if already
	stopping or stopped.  Set the lwp's last_resume_kind.
	(resume_status_pending_p): Don't check for removed breakpoints.
	(need_step_over_p): New.
	(start_step_over): New.
	(finish_step_over): New.
	(linux_resume_one_thread): Always queue a sigstop for resume_stop
	requests.  Clear the thread's last reported target waitstatus.
	Don't use the `suspended' flag.  Don't consider pending breakpoints.
	(linux_resume): Start a step-over if necessary.
	(proceed_one_lwp): New.
	(proceed_all_lwps): New.
	(unstop_all_lwps): New.
	* linux-low.h (struct lwp_info): Rewrite comment for the
	`suspended' flag.  Add the `stop_pc' field.  Delete the
	`pending_stop_pc' field.  Tweak the `stepping' flag's comment.
	Add `'last_resume_kind' and `need_step_over' fields.
	* inferiors.c (struct thread_info): Delete, moved elsewhere.
	* mem-break.c (struct breakpoint): Delete `reinserting' flag.
	Delete `breakpoint_to_reinsert' field.  New flag `inserted'.
	(set_raw_breakpoint_at): New.
	(set_breakpoint_at): Rewrite to use it.
	(reinsert_breakpoint_handler): Delete.
	(set_reinsert_breakpoint): New.
	(reinsert_breakpoint_by_bp): Delete.
	(delete_reinsert_breakpoints): New.
	(uninsert_breakpoint): Rewrite.
	(uninsert_breakpoints_at): New.
	(reinsert_breakpoint): Rewrite.
	(reinsert_breakpoints_at): New.
	(check_breakpoints): Rewrite.
	(breakpoint_here): New.
	(breakpoint_inserted_here): New.
	(check_mem_read): Adjust.
	* mem-break.h (breakpoints_supported, breakpoint_here)
	(breakpoint_inserted_here, set_reinsert_breakpoint): Declare.
	(reinsert_breakpoint_by_bp): Delete declaration.
	(delete_reinsert_breakpoints): Declare.
	(reinsert_breakpoint): Delete declaration.
	(reinsert_breakpoints_at): Declare.
	(uninsert_breakpoint): Delete declaration.
	(uninsert_breakpoints_at): Declare.
	(check_breakpoints): Adjust prototype.
	* server.h: Adjust include order.
	(struct thread_info): Declare here.  Add a `last_status' field.
2010-03-24 00:05:03 +00:00
Michael Snyder 30ba68cb7e 2010-03-23 Michael Snyder <msnyder@vmware.com>
* server.c (crc32): New function.
	(handle_query): Add handling for 'qCRC:' request.
2010-03-23 22:43:50 +00:00
Pedro Alves b9a881c2d2 * linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR6 if the
lwp had been stopped by a watchpoint.
2010-03-23 18:00:57 +00:00
Pedro Alves e92d13d5bc gdb/gdbserver/
* server.h (internal_error): Declare.
	(gdb_assert, ASSERT_FUNCTION, gdb_assert_fail): Define.
	* utils.c (internal_error): New function.
2010-03-16 17:47:52 +00:00
Andreas Schwab 64daa791ab * configure.srv: Fix typo setting srv_regobj. 2010-03-15 16:35:29 +00:00
Pedro Alves f52cd8cdd8 * linux-low.c (fetch_register): Avoid passing a non string literal
format to `error'.
	(usr_store_inferior_registers): Ditto.
2010-03-15 00:31:16 +00:00
Pedro Alves 93ae6fdc31 * linux-low.c (linux_write_memory): Bail out early if peeking
memory failed.
2010-03-14 19:34:47 +00:00
Pedro Alves c3adc08c6f * linux-low.h (struct lwp_info): New fields
`stopped_by_watchpoint' and `stopped_data_address'.
	* linux-low.c (linux_wait_for_lwp): Check for watchpoint triggers
	here, and cache them in the lwp object.
	(wait_for_sigstop): Check stopped_by_watchpoint lwp field
	directly.
	(linux_resume_one_lwp): Clear the lwp's stopped_by_watchpoint
	field.
	(linux_stopped_by_watchpoint): Rewrite.
	(linux_stopped_data_address): Rewrite.
2010-03-14 18:46:40 +00:00
Pedro Alves bce522a260 2010-03-06 Simo Melenius <simo.melenius@iki.fi>
* linux-low.c (linux_wait_for_lwp): Fetch the regcache after
	switching the current inferior, not before.
2010-03-06 00:11:42 +00:00
H.J. Lu 90884b2b1f Enable XML target descriptions for x86.
gdb/

2010-03-01  H.J. Lu  <hongjiu.lu@intel.com>

	* amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New.
	(amd64_linux_read_description): Likewise.
	(_initialize_amd64_linux_nat): Set to_read_description to
	amd64_linux_read_description.

	* amd64-linux-tdep.c: Include "features/i386/amd64-linux.c".
	(amd64_linux_register_name): Removed.
	(amd64_linux_register_type): Likewise.
	(amd64_linux_core_read_description): New.
	(amd64_linux_init_abi): Set target description to
	tdesc_amd64_linux if needed.  Support orig_rax in target
	description.  Don't call set_gdbarch_register_name nor
	set_gdbarch_register_type.  Call
	set_gdbarch_core_read_description.
	(_initialize_amd64_linux_tdep): Call
	initialize_tdesc_amd64_linux.

	* amd64-linux-tdep.h (tdesc_amd64_linux): New.

	* amd64-tdep.c:  Include "features/i386/amd64.c".
	(amd64_register_names): Removed.
	(amd64_register_name): Likewise.
	(amd64_register_type): Likewise.
	(amd64_init_abi):  Set num_core_regs and register_names.  Set
	target description to tdesc_amd64 if needed.  Don't call
	set_gdbarch_register_name nor set_gdbarch_register_type.
	(_initialize_amd64_tdep): New.

	* i386-linux-nat.c (i386_linux_read_description): New.
	(_initialize_i386_linux_nat): Set to_read_description to
	i386_linux_read_description.

	* i386-linux-tdep.c: Include "features/i386/i386-linux.c".
	(i386_linux_register_name): Removed.
	(i386_linux_core_read_description): New.
	(i386_linux_read_description): Likewise.
	(i386_linux_init_abi): Don't call set_gdbarch_register_name.
	Set target description to tdesc_i386_linux if needed.  Support
	orig_eax.  Set register_reggroup_p.  Call
	set_gdbarch_core_read_description.
	(_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux.

	* i386-linux-tdep.h (tdesc_i386_linux): New.

	* i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS
	with I387_NUM_REGS.

	* i386-tdep.c: Include "features/i386/i386.c".
	(i386_register_names): Make it const.
	(i386_mmx_names): Likewise.
	(i386_num_register_names): Removed.
	(i386_register_name): Likewise.
	(i386_eflags_type): Likewise.
	(i386_mxcsr_type): Likewise.
	(i386_sse_type): Likewise.
	(i386_register_type): Likewise.
	(i387_ext_type): Call tdesc_find_type instead of arch_float_type.
	(i386_pseudo_register_name): New.
	(i386_pseudo_register_type): Likewise.
	(i386_mmx_type): Make it static.
	(i386_gdbarch_init): Check arch.  Replace I386_NUM_FREGS with
	I387_NUM_REGS.  Set num_core_regs and register_names.  Don't
	call set_gdbarch_register_name nor set_gdbarch_register_type.
	Set register_reggroup_p.  Set target description to tdesc_i386
	if needed.  Call set_tdesc_pseudo_register_type,
	set_tdesc_pseudo_register_name and tdesc_use_registers.
	(_initialize_i386_tdep): Call initialize_tdesc_i386.
	initialize_tdesc_x86_64.

	* i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type,
	i386_mxcsr_type and i386_sse_type.  Add num_core_regs,
	register_names, tdesc and register_reggroup_p.
	(I386_NUM_FREGS): Removed.
	(i386_eflags_type): Likewise.
	(i386_mxcsr_type): Likewise.
	(i386_mmx_type): Likewise.
	(i386_sse_type): Likewise.
	(i386_register_name): Likewise.
	(i386_regnum): Add I386_MXCSR_REGNUM.
	(I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM.

	* i387-tdep.h (I387_NUM_REGS): New.

	* regformats/i386/i386-linux.dat: Generated.
	* regformats/i386/i386.dat: Likewise.
	* regformats/i386/amd64-linux.dat: Likewise.
	* regformats/i386/amd64.dat: Likewise.

	* regformats/reg-i386-linux.dat: Removed.
	* regformats/reg-i386.dat: Likewise.
	* regformats/reg-x86-64-linux.dat: Likewise.
	* regformats/reg-x86-64.dat: Likewise.

gdb/gdbserver/

2010-03-01  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c,
	reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c,
	i386-linux.c and amd64-linux.c.
	(reg-i386.o): Removed.
	(reg-i386.c): Likewise.
	(reg-i386-linux.o): Likewise.
	(reg-i386-linux.c): Likewise.
	(reg-x86-64.o): Likewise.
	(reg-x86-64.c): Likewise.
	(reg-x86-64-linux.o): Likewise.
	(reg-x86-64-linux.c): Likewise.
	(i386.o): New.
	(i386.c): Likewise.
	(i386-linux.o): Likewise.
	(i386-linux.c): Likewise.
	(amd64.o): Likewise.
	(amd64.c): Likewise.
	(amd64-linux.o): Likewise.
	(amd64-linux.c): Likewise.

	* configure.srv (srv_i386_regobj): New.
	(srv_i386_linux_regobj): Likewise.
	(srv_amd64_regobj): Likewise.
	(srv_amd64_linux_regobj): Likewise.
	(srv_i386_32bit_xmlfiles): Likewise.
	(srv_i386_64bit_xmlfiles): Likewise.
	(srv_i386_xmlfiles): Likewise.
	(srv_amd64_xmlfiles): Likewise.
	(srv_i386_linux_xmlfiles): Likewise.
	(srv_amd64_linux_xmlfiles): Likewise.
	(i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj.  Set
	srv_xmlfiles to $srv_i386_xmlfiles.
	(i[34567]86-*-mingw32ce*): Likewise.
	(i[34567]86-*-mingw*): Likewise.
	(i[34567]86-*-nto*): Likewise.
	(i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj
	and $srv_amd64_linux_regobj.  Set srv_xmlfiles to
	$srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles.
	(x86_64-*-linux*): Likewise.

	* linux-x86-low.c (init_registers_x86_64_linux): Removed.
	(init_registers_amd64_linux): New.
	(x86_arch_setup): Replace init_registers_x86_64_linux with
	init_registers_amd64_linux.

gdb/testsuite/

2010-03-01  H.J. Lu  <hongjiu.lu@intel.com>

	* gdb.xml/tdesc-regs.exp (architecture): New.  Set it for x86.
	(load_description): Set architecture if defined.
2010-03-01 15:33:32 +00:00
Maxim Kuvyrkov 193f13e68b * configure.ac: Check for libdl. If it is not available link against
static libthread_db.
	* configure: Regenerate.
2010-02-23 19:16:16 +00:00
Pedro Alves 85d721b88f 2010-02-22 Pedro Alves <pedro@codesourcery.com>
PR9605

	gdb/
	* breakpoint.c (insert_bp_location): If inserting the read
	watchpoint failed, fallback to an access watchpoint.
	(bpstat_check_watchpoint): Stop for read watchpoint triggers even
	if the value changed, if not watching the same memory for writes.
	(watchpoint_locations_match): Add comment.
	(update_global_location_list): Copy the location's watchpoint type.
	* i386-nat.c (i386_length_and_rw_bits): It's an internal error to
	handle read watchpoints here.
	(i386_insert_watchpoint): Read watchpoints aren't supported.
	* remote.c (remote_insert_watchpoint): Return 1 for unsupported
	packets.
	* target.h (target_insert_watchpoint): Update description.

2010-02-22  Pedro Alves  <pedro@codesourcery.com>

	PR9605

	gdbserver/
	* i386-low.c (i386_length_and_rw_bits): Throw a fatal error if
	handing a read watchpoint.
	(i386_low_insert_watchpoint): Read watchpoints aren't supported.

2010-02-22  Pedro Alves  <pedro@codesourcery.com>

	PR9605

	gdb/testsuite/
	* gdb.base/watch-read.c, gdb.base/watch-read.exp: New files.
2010-02-22 23:35:17 +00:00
Doug Evans 6076632b70 * linux-low.c (linux_supports_tracefork_flag): Document.
(linux_look_up_symbols): Add comment.
2010-02-13 01:13:54 +00:00
H.J. Lu 3327ccf795 2010-02-03 H.J. Lu <hongjiu.lu@intel.com>
* regcache.c (supply_register): Clear regcache if buf is NULL.
2010-02-03 18:20:21 +00:00
Joel Brobecker 0718675c76 gdbserver crash when running 32bits exes on x64 Windows.
* inferiors.c (find_inferior): Add function documentation.
        (unloaded_dll): Handle the case where the unloaded dll has not
        been previously registered in the dll list.
2010-02-02 04:24:26 +00:00
Jan Kratochvil e4b7f41c57 gdb/
PR libc/11214:
	* linux-low.c (linux_tracefork_child) [!(__UCLIBC__ && HAS_NOMMU)]: New.
	(linux_test_for_tracefork): Move `stack' into [__UCLIBC__ && HAS_NOMMU].
	(linux_test_for_tracefork) [!(__UCLIBC__ && HAS_NOMMU)]: New.

gdb/testsuite/
	PR libc/11214:
	* gdb.threads/current-lwp-dead.c: Include features.h.
	(HAS_NOMMU): New.
	(fn, main): Move CLONE_VM into [__UCLIBC__ && HAS_NOMMU].
2010-02-01 20:19:06 +00:00
Daniel Jacobowitz 177321bd85 * arm-linux-tdep.c (arm_linux_thumb2_be_breakpoint)
(arm_linux_thumb2_le_breakpoint): New constants.
	(arm_linux_init_abi): Set thumb2_breakpoint and
	thumb2_breakpoint_size.
	* arm-tdep.c (thumb_insn_size, thumb_advance_itstate): New functions.
	(thumb_get_next_pc): Add a comment.  Rename IT to ITSTATE.
	Implement support for single stepping through IT blocks if
	a 32-bit Thumb breakpoint instruction is available.
	(arm_breakpoint_from_pc): If a 32-bit Thumb breakpoint instruction
	is available, use it when needed.
	(arm_remote_breakpoint_from_pc): New function.
	(arm_gdbarch_init): Register arm_remote_breakpoint_from_pc.
	* arm-tdep.h (struct gdbarch_tdep): Correct thumb_breakpoint
	comment.  Add thumb2_breakpoint and thumb2_breakpoint_size.

	gdbserver/
	* linux-arm-low.c (thumb_breakpoint_len): Delete.
	(thumb2_breakpoint): New.
	(arm_breakpoint_at): Check for Thumb-2 breakpoints.

	testsuite/
	* gdb.arch/thumb2-it.S, gdb.arch/thumb2-it.exp: New files.
2010-02-01 16:13:17 +00:00
Daniel Jacobowitz 2b00904856 * infrun.c (prepare_to_proceed): Handle other signals which might
match a breakpoint.
	(handle_inferior_event): Move the check for unusual breakpoint
	signals earlier.

	gdbserver/
	* linux-low.c (get_stop_pc): Check for SIGTRAP.
	(linux_wait_for_event_1): Handle SIGILL and SIGSEGV as possible
	breakpoints.
2010-01-29 15:40:22 +00:00
Pedro Alves 3be029c76b * linux-ppc-low.c (ppc_arch_setup): Adjust to regcache
changes.
2010-01-21 22:10:18 +00:00
Jan Kratochvil 18f5de3bf8 gdb/gdbserver/
* linux-s390-low.c (s390_collect_ptrace_register)
	(s390_supply_ptrace_register): Adjust it for the new regcache parameter.
2010-01-21 19:26:49 +00:00
Doug Evans 14ce306570 * linux-low.c (PTRACE_ARG3_TYPE): Change from long to void*.
(PTRACE_ARG4_TYPE): New macro.
	(handle_extended_wait): Cast ptrace arg4 to PTRACE_ARG4_TYPE.
	(linux_wait_for_event_1, linux_resume_one_lwp): Ditto.
	(fetch_register): Cast to uintptr_t before casting to PTRACE_ARG3_TYPE.
	(usr_store_inferior_registers): Ditto.
	(linux_read_memory, linux_write_memory): Ditto.
	(linux_test_for_tracefork): Ditto.
2010-01-21 18:35:42 +00:00
Doug Evans 3743bb4fbf * linux-arm-low.c: Remove redundant include of gdb_proc_service.h.
Only include elf.h if gdb_proc_service.h didn't include linux/elf.h.
2010-01-21 18:27:32 +00:00
Pedro Alves 8b315be588 * proc-service.c (ps_lgetregs): Don't refetch registers from the
target.
2010-01-21 15:33:19 +00:00
Pedro Alves 85492558cd * spu-low.c (spu_fetch_registers, spu_store_registers): Change
prototype to take a regcache.  Adjust.
2010-01-21 14:11:21 +00:00
Pedro Alves 442ea88105 * regcache.h (struct thread_info): Forward declare.
(struct regcache): New.
	(new_register_cache): Adjust prototype.
	(get_thread_regcache): Declare.
	(free_register_cache): Adjust prototype.
	(registers_to_string, registers_from_string): Ditto.
	(supply_register, supply_register_by_name, collect_register)
	(collect_register_as_string, collect_register_by_name): Ditto.
	* regcache.c (struct inferior_regcache_data): Delete.
	(get_regcache): Rename to ...
	(get_thread_regcache): ... this.  Adjust.  Switch inferior before
	fetching registers.
	(regcache_invalidate_one): Adjust.
	(regcache_invalidate): Fix prototype.
	(new_register_cache): Return the new register cache.
	(free_register_cache): Change prototype.
	(realloc_register_cache): Adjust.
	(registers_to_string): Change prototype to take a regcache.  Adjust.
	(registers_from_string): Ditto.
	(register_data): Ditto.
	(supply_register): Ditto.
	(supply_register_by_name): Ditto.
	(collect_register): Ditto.
	(collect_register_as_string): Ditto.
	(collect_register_by_name): Ditto.
	* server.c (process_serial_event): Adjust.
	* linux-low.h (regset_fill_func, regset_store_func): Change
	prototype.
	(get_pc, set_pc, collect_ptrace_register, supply_ptrace_register):
	Change prototype.
	* linux-low.c (get_stop_pc): Adjust.
	(check_removed_breakpoint): Adjust.
	(linux_wait_for_event): Adjust.
	(linux_resume_one_lwp): Adjust.
	(fetch_register): Add regcache parameter.  Adjust.
	(usr_store_inferior_registers): Ditto.
	(regsets_fetch_inferior_registers): Ditto.
	(regsets_store_inferior_registers): Ditto.
	(linux_fetch_registers, linux_store_registers): Ditto.
	* i387-fp.c (i387_cache_to_fsave): Change prototype to take a
	regcache.  Adjust.
	(i387_fsave_to_cache, i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
	* i387-fp.h (i387_cache_to_fsave, i387_fsave_to_cache): Change
	prototype to take a regcache.
	(i387_cache_to_fxsave, i387_fxsave_to_cache): Ditto.
	* remote-utils.c (convert_ascii_to_int, outreg)
	(prepare_resume_reply): Change prototype to take a regcache.
	Adjust.
	* target.h (struct target_ops) <fetch_registers, store_registers>:
	Change prototype to take a regcache.
	(fetch_inferior_registers, store_inferior_registers): Change
	prototype to take a regcache.  Adjust.
	* proc-service.c (ps_lgetregs): Adjust.
	* linux-x86-low.c (x86_fill_gregset, x86_store_gregset)
	(x86_fill_fpregset, x86_store_fpregset, x86_fill_fpxregset)
	(x86_store_fpxregset, x86_get_pc, x86_set_pc): Change prototype to
	take a regcache.  Adjust.
	* linux-arm-low.c (arm_fill_gregset, arm_store_gregset)
	(arm_fill_wmmxregset, arm_store_wmmxregset, arm_fill_vfpregset)
	(arm_store_vfpregset, arm_get_pc, arm_set_pc):
	(arm_breakpoint_at): Change prototype to take a regcache.  Adjust.
	* linux-cris-low.c (cris_get_pc, cris_set_pc)
	(cris_cannot_fetch_register):
	(cris_breakpoint_at): Change prototype to take a regcache.
	Adjust.
	* linux-crisv32-low.c (cris_get_pc, cris_set_pc,
	cris_reinsert_addr, cris_write_data_breakpoint): Change prototype
	to take a regcache.  Adjust.
	(cris_breakpoint_at, cris_insert_point, cris_remove_point):
	Adjust.
	* linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Change prototype to
	take a regcache.  Adjust.
	* linux-m68k-low.c (m68k_fill_gregset, m68k_store_gregset)
	(m68k_fill_fpregset, m68k_store_fpregset, m68k_get_pc,
	(m68k_set_pc): Change prototype to take a regcache.  Adjust.
	* linux-mips-low.c (mips_get_pc):
	(mips_set_pc): Change prototype to take a regcache.  Adjust.
	(mips_reinsert_addr): Adjust.
	(mips_collect_register): Change prototype to take a regcache.
	Adjust.
	(mips_supply_register):
	(mips_collect_register_32bit, mips_supply_register_32bit)
	(mips_fill_gregset, mips_store_gregset, mips_fill_fpregset)
	(mips_store_fpregset): Ditto.
	* linux-ppc-low.c (ppc_supply_ptrace_register, ppc_supply_ptrace_register):
	Ditto.
	(parse_spufs_run): Adjust.
	(ppc_get_pc, ppc_set_pc, ppc_fill_gregset, ppc_fill_vsxregset)
	(ppc_store_vsxregset, ppc_fill_vrregset, ppc_store_vrregset)
	(ppc_fill_evrregset, ppc_store_evrregset): Change prototype to
	take a regcache.  Adjust.
	* linux-s390-low.c (s390_collect_ptrace_register)
	(s390_supply_ptrace_register, s390_fill_gregset, s390_get_pc)
	(s390_set_pc): Change prototype to take a regcache.  Adjust.
	(s390_arch_setup): Adjust.
	* linux-sh-low.c (sh_get_pc, sh_breakpoint_at)
	(sh_fill_gregset): Change prototype to take a regcache.  Adjust.
	* linux-sparc-low.c (sparc_fill_gregset_to_stack)
	(sparc_fill_gregset, sparc_store_gregset_from_stack)
	(sparc_store_gregset, sparc_get_pc): Change prototype to take a
	regcache.  Adjust.
	(sparc_breakpoint_at): Adjust.
	* linux-xtensa-low.c (xtensa_fill_gregset):
	(xtensa_store_gregset):
	(xtensa_fill_xtregset, xtensa_store_xtregset, xtensa_get_pc)
	(xtensa_set_pc): Change prototype to take a regcache.  Adjust.
	* nto-low.c (nto_fetch_registers, nto_store_registers): Change
	prototype to take a regcache.  Adjust.
	* win32-arm-low.c (arm_fetch_inferior_register)
	(arm_store_inferior_register): Change prototype to take a
	regcache.  Adjust.
	* win32-i386-low.c (i386_fetch_inferior_register)
	(i386_store_inferior_register): Change prototype to take a
	regcache.  Adjust.
	* win32-low.c (child_fetch_inferior_registers)
	(child_store_inferior_registers): Change prototype to take a
	regcache.  Adjust.
	(win32_wait): Adjust.
	(win32_fetch_inferior_registers): Change prototype to take a
	regcache.  Adjust.
	(win32_store_inferior_registers): Adjust.
	* win32-low.h (struct win32_target_ops) <fetch_inferior_register,
	store_inferior_register>: Change prototype to take a regcache.
2010-01-20 22:55:38 +00:00
Doug Evans ec8ebe726b * linux-low.c (W_STOPCODE): Provide definition if missing. 2010-01-20 18:29:39 +00:00
Doug Evans 60c3d7b00b * linux-low.c (linux_create_inferior): Wrap use of __SIGRTMIN in
#ifdef.
	(linux_wait_for_event1, linux_init_signals): Ditto.
2010-01-20 18:22:48 +00:00
Vladimir Prus dc146f7c09 Implement core awareness.
* bcache.c (compare_ints): Remove
	(print_percentage): Use compare_positive_ints.
	* defs.h (compare_positive_ints): Declare.
	* linux-nat.h (struct lin_lwp): New field core.
	(linux_nat_core_of_thread_1): Declare.
	* linux-nat.c (add_lwp): Init the 'core' field.
	(linux_nat_wait_1): Record the core.
	(linux_nat_core_of_thread_1, linux_nat_core_of_thread): New.
	(linux_nat_add_target): Register the above.
	* linux-thread-db.c (update_thread_core): New.
	(thread_db_find_new_threads): Update core information for
	every thread.
	* remote.c (struct private_thread_info): New.
	(free_private_thread_info, demand_private_info): New.
	(PACKET_qXfer_threads, use_osdata_threads): New.
	(struct thread_item, threads_parsing_context
	(start_thread, end_thread, thread_attributes)
	(thread_children, threads_children, threads_elements): New.
	(remote_threads_info): Try qXfer:threads before anything
	else.
	(remote_protocol_packets): Register qXfer:threads.
	(remote_open_1): Init use_osdata_threads.
	(struct stop_reply): New field 'core'.
	(remote_parse_stop_reply): Parse core number.
	(process_stop_reply): Record core number.
	(remote_xfer_partial): Handle qXfer:threads.
	(remote_core_of_thread): New.
	(init_remote_ops): Register remote_core_of_thread.
	(_initialize_remote): Register qXfer:read.
	* target.c (target_core_of_thread): New
	* target.h (enum target_object): New value TARGET_OBJECT_THREADS.
	(struct target_ops): New field to_core_of_threads.
	(target_core_of_thread): Declare.
	* gdbthread.h (struct thread_info): New field private_dtor.
	* thread.c (print_thread_info): Report the core.
	* ui-out.c (MAX_UI_OUT_LEVELS): Increase.
	* utils.c (compare_positive_ints): New.
	* features/threads.dtd: New.
	* mi/mi-interp.c (mi_on_normal_stop): Report the core.
	* mi/mi-main.c (struct collect_cores_data, collect_cores)
	(do_nothing, free_vector_of_osdata_items)
	(splay_tree_int_comparator, free_splay_tree): New.
	(print_one_inferior_data): Implemented printing of selected
	inferiors.  Collect and print cores.
	(output_cores): New.
	(mi_cmd_list_thread_groups): Support --recurse.  Permit specifying
	thread groups together with --available.
2010-01-12 21:40:25 +00:00
Ulrich Weigand 7803799a0f * features/Makefile (WHICH): Add s390-linux32, s390-linux64,
and s390x-linux64.
	(s390-linux32-expedite): Define.
	(s390-linux64-expedite): Define.
	(s390x-linux64-expedite): Define.
	* features/s390-acr.xml: New file.
	* features/s390-fpr.xml: New file.
	* features/s390-core32.xml: New file.
	* features/s390-core64.xml: New file.
	* features/s390x-core64.xml: New file.
	* features/s390-linux32.xml: New file.
	* features/s390-linux64.xml: New file.
	* features/s390x-linux64.xml: New file.
	* features/s390-linux32.c: New generated file.
	* features/s390-linux64.c: New generated file.
	* features/s390x-linux64.c: New generated file.

	* regformats/s390-linux32.dat: New generated file.
	* regformats/s390-linux64.dat: New generated file.
	* regformats/s390x-linux64.dat: New generated file.
	* regformats/reg-s390.dat: Remove.
	* regformats/reg-s390x.dat: Remove.

	* s390-nat.c: Include "auxv.h" and <elf.h>.
	(HWCAP_S390_HIGH_GPRS): Define if undefined.
	(s390_target_wordsize): New function.
	(s390_auxv_parse): Likewise.
	(s390_get_hwcap): Likewise.
	(s390_read_description): Likewise.
	(_initialize_s390_nat): Install s390_auxv_parse and
	s390_read_description.

	* s390-tdep.c: Include "features/s390-linux32.c",
	"features/s390-linux64.c", and "features/s390x-linux64.c".
	(struct gdbarch_tdep): Add gpr_full_regnum, pc_regnum, and cc_regnum.
	(s390_register_call_saved): New function.
	(s390_register_name): Remove.
	(s390_register_type): Remove.
	(s390_dwarf_regmap): Add lower half GPR pseudo DWARF CFI regnums.
	(s390_dwarf_reg_to_regnum): Remap GPR regnums to full GPRs.
	(s390_adjust_frame_regnum): Remap GPR regnums to lower halves for CFI.
	(s390_pseudo_register_name): New function.
	(s390_pseudo_register_type): New function.
	(s390_pseudo_register_read): Handle both 32-bit and 64-bit cases.
	Handle full GPR pesudos and varying pseudo register numbers.
	(s390_pseudo_register_write): Likewise
	(s390x_pseudo_register_read): Remove.
	(s390x_pseudo_register_write): Likewise.
	(s390_register_group): Remove.
	(s390_pseudo_register_group): New function.
	(s390_regmap_gregset): Add GPR upper halves.
	(s390x_regmap_gregset): Likewise.
	(s390_regmap_fpregset): Likewise.
	(s390_regmap_upper): New global variable.
	(s390_upper_regset): New global variable.
	(s390_upper_regset_sections): New global variable.
	(s390_regset_from_core_section): Handle GPR upper halves.
	(s390_core_read_description): New function.
	(s390_prologue_frame_unwind_cache): Set up ABI call-saved/clobbered
	register information.  Handle varying pseudo register numbers.
	(s390_backchain_frame_unwind_cache): Likewise.
	(s390_frame_prev_register): Unwind full GPRs to show lower halves.
	(s390_stub_frame_unwind_cache): Handle varying pseudo register numbers.
	(s390_sigtramp_frame_unwind_cache): Unwind PSWM and PSWA as well as
	PC and CC pseudos.  Unwind upper halves and full GPRs as appropriate.
	Handle varying pseudo register numbers.
	(s390_unwind_pc): Handle varying pseudo register numbers.
	(s390_dwarf2_prev_register): New function.
	(s390_dwarf2_frame_init_reg): Set up ABI call-saved/clobbered
	register information.  Handle varying pseudo register numbers.
	Install s390_dwarf2_prev_register to unwind full GPRs.
	(s390_gdbarch_init): Handle target descriptions.  Assign varying
	pseudo register numbers.  Install s390_adjust_frame_regnum.
	(_initialize_s390_tdep): Initialize target descriptions.

	* s390-tdep.h (S390_R0_UPPER_REGNUM .. S390_R15_UPPER_REGNUM): Define.
	(S390_NUM_REGS): Redefine to include upper half registers.
	(S390_PC_REGNUM, S390_CC_REGNUM): Remove.
	(S390_NUM_PSEUDO_REGS, S390_NUM_TOTAL_REGS): Likewise.
	(tdesc_s390_linux32): Add declaration.
	(tdesc_s390_linux64): Likewise.
	(tdesc_s390x_linux64): Likewise.

gdb/testsuite/
	* gdb.xml/tdesc-regs.exp: Support s390*-*-* targets.

gdbserver/
	* Makefile.in (clean): Remove new generated files.
	(reg-s390.o, reg-s390.c): Remove rules.
	(reg-s390x.o, reg-s390x.c): Likewise.
	(s390-linux32.o, s390-linux32.c): Add rules.
	(s390-linux64.o, s390-linux64.c): Likewise.
	(s390x-linux64.o, s390x-linux64.c): Likewise.
	* configure.srv (s390*-*-linux*): Update srv_regobj and srv_xmlfiles.
	* linux-s390-low.c: Include <elf.h>.
	(HWCAP_S390_HIGH_GPRS): Define if undefined.
	(init_registers_s390): Remove prototype.
	(init_registers_s390x): Likewise.
	(init_registers_s390_linux32): Add prototype.
	(init_registers_s390_linux64): Likewise.
	(init_registers_s390x_linux64): Likewise.
	(s390_num_regs_3264): New define.
	(s390_regmap_3264): New global variable.
	(s390_cannot_fetch_register): Remove obsolete check.
	(s390_cannot_store_register): Likewise.
	(s390_collect_ptrace_register): Handle upper/lower register halves.
	(s390_supply_ptrace_register): Likewise.
	(s390_fill_gregset): Update to register number changes.
	(s390_get_hwcap): New routine.
	(s390_arch_setup): Detect 32-bit process running on 64-bit system.
	Install appropriate regmap and register set.
2010-01-04 15:03:01 +00:00
Joel Brobecker abd775ced8 Update the copyright header of most if not all files that have not been
updated yet.
2010-01-01 09:44:07 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Joel Brobecker 6e7ffa3987 * server.c (gdbserver_version): Update copyright year to 2010.
* gdbreplay.c (gdbreplay_version): Likewise.
2010-01-01 06:59:28 +00:00
Doug Evans 957f3f49de * linux-low.c: Delete inclusion of ansidecl.h, elf/common.h,
elf/external.h.  Include <elf.h> instead but only if necessary.
2009-12-28 19:45:56 +00:00
Pedro Alves ca5c370d27 * linux-low.c (linux_remove_process): Remove `detaching'
parameter.  Don't release/detach from thread_db here.
	(linux_kill): Release/detach from thread_db here, ...
	(linux_detach): ... and here, before actually detaching.
	(linux_wait_1): ... and here, when a process exits.
	* thread-db.c (any_thread_of): New.
	(thread_db_free): Switch the current inferior to a thread of the
	passed in process.
2009-12-28 16:09:27 +00:00
Doug Evans d90e6a886c * linux-x86-low.c: Delete outdated comment about Elf32_Phdr. 2009-12-22 00:18:13 +00:00
Doug Evans c5f62d5ff9 gdb/
* linux-nat.c (kill_lwp): Minor cleanup, move definition of
	tkill_failed into ifdef HAVE_TKILL_SYSCALL.  Move setting of errno
	there too.  Delete unnecessary resetting of errno after syscall.
	Minor comment changes to match gdbserver/linux-low.c:kill_lwp.

	gdbserver/
	* linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill.
	Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc
	warning ifndef __NR_tkill.  Move setting of errno there too.
	Delete unnecessary resetting of errno after syscall.
	Minor comment changes to match gdb/linux-nat.c:kill_lwp.
2009-12-21 21:23:43 +00:00
Doug Evans 10e86dd778 * configure.ac: Check for dladdr.
* config.in: Regenerate.
	* configure: Regenerate.
	* thread-db.c (dladdr_to_soname): Only define ifdef HAVE_DLADDR.
	(try_thread_db_load): Update.
2009-12-21 20:52:53 +00:00
Doug Evans 4ee62156d9 * linux-low.c (my_waitpid): Delete unnecessary prototype. 2009-12-21 17:54:03 +00:00
Doug Evans e946488510 * event-loop.c: Include unistd.h if it exists. 2009-12-19 01:24:51 +00:00
Doug Evans 07d4f67e9d * linux-low.c (my_waitpid): Move definition away from being in
between linux_tracefork_child/linux_test_for_tracefork.
2009-12-19 01:16:23 +00:00
Doug Evans 00f515dab6 gdb/
* gdb_proc_service.h (psaddr_t): Fix type.
	* linux-thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
	signature to match glibc.
	(thread_db_get_thread_local_address): Use psaddr_t for type of
	address to match parameter of td_thr_tls_get_addr_p.
	Cast through psaddr_t instead of (void*) to match parameter of
	td_thr_tls_get_addr_p.

	gdbserver/
	* gdb_proc_service.h (psaddr_t): Fix type.
	* thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
	signature to match glibc.
2009-12-19 00:29:11 +00:00
Doug Evans 1de1badb7a * linux-low.c (linux_read_memory): Fix argument to read. 2009-12-16 21:23:34 +00:00
Pedro Alves aeeb81d1c7 * win32-low.c (get_child_debug_event): On EXIT_THREAD_DEBUG_EVENT
events, don't leave current_inferior pointing at null.
2009-11-26 22:18:40 +00:00