Commit Graph

29 Commits

Author SHA1 Message Date
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
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 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 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
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 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +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
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 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 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
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
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
Pedro Alves 45e2715e39 * win32-low.c (handle_output_debug_string): Ignore event if not
waiting.
2007-07-08 19:37:46 +00:00
Pedro Alves 7390519ea0 * server.h (check_remote_input_interrupt_request): New function.
* remote_utils.c (INVALID_DESCRIPTOR): New define.
	(remote_desc): Initialize with INVALID_DESCRIPTOR.
	(input_interrupt): Expose on USE_WIN32API too.  Fix whitespace.
	(check_remote_input_interrupt_request): New function.
	* server.h (check_remote_input_interrupt_request): Declare.

	* win32-low.(winapi_DebugBreakProcess,
	winapi_GenerateConsoleCtrlEvent): New typedefs.
	(get_child_debug_event): Lower Win32 debug event polling from 1 sec
	to 250 ms.
	(win32_wait): Check for remote interrupt request
	with check_remote_input_interrupt_request.
	(win32_request_interrupt): New function.
	(win32_target_op): Set request_interrupt to win32_request_interrupt.
2007-05-10 22:04:50 +00:00
Pedro Alves 34b3492108 * win32-low.c (debug_registers_changed,
debug_registers_used, CONTEXT_EXTENDED_REGISTERS,
	CONTEXT_FLOATING_POINT, CONTEXT_DEBUG_REGISTERS,
	CONTEXT_DEBUGGER, CONTEXT_DEBUGGER_DR): Delete.
	(thread_rec): Get context using the low target.
	(child_add_thread): Call thread_added on the low target,
	which does the same thing.
	(regptr): Delete.
	(do_initial_child_stuff): Remove debug registers references.
	Set context using the low target.  Resume threads after
	setting the contexts.
	(child_continue): Remove dead variable.  Remove debug
	registers references.
	(child_fetch_inferior_registers): Go through the low target.
	(do_child_store_inferior_registers): Remove.
	(child_store_inferior_registers): Go through the low target.
	(win32_resume): Remove debug registers references.
	Set context using the low target.
	(handle_exception): Change return type to void.  Don't record
	context here.  Set status to TARGET_WAITKIND_SPURIOUS on a
	first chance exception.
	(get_child_debug_event): Change return type to void.  Remove
	goto loop.  Always return after waiting for debug event.
	(win32_wait): Convert to switch statement.  Handle spurious
	events.

	* win32-i386-low.c (debug_registers_changed,
	debug_registers_used): New.
	(initial_stuff): Rename to ...
	(i386_initial_stuff): ... this.  Clear debug registers
	state variables.
	(store_debug_registers): Delete.
	(i386_get_thread_context): New.
	(load_debug_registers): Delete.
	(i386_set_thread_context): New.
	(i386_thread_added): New.
	(single_step): Rename to ...
	(i386_single_step): ... this.
	(do_fetch_inferior_registers): Rename to ...
	(i386_fetch_inferior_register): ... this.
	(i386_store_inferior_register): New.
	(the_low_target): Adapt to new interface.

	* win32-arm-low.c (CONTEXT_FLOATING_POINT): Define.
	(arm_get_thread_context): New.
	(arm_set_thread_context): New.
	(regptr): New.
	(do_fetch_inferior_registers): Rename to ...
	(arm_fetch_inferior_register): ... this.
	(arm_store_inferior_register): New.
	(arm_wince_breakpoint): Reimplement as unsigned long.
	(arm_wince_breakpoint_len): Define.
	(the_low_target): Adapt to new interface.

	* win32-low.h (target_ops): Remove regmap, store_debug_registers and
	load_debug_registers.  Add get_thread_context, set_thread_context,
	thread_added and store_inferior_register.  Rename
	fetch_inferior_registers to fetch_inferior_register.
	(regptr): Remove declaration.
2007-05-10 21:48:56 +00:00
Pedro Alves 444d61395b * target.h (target_ops): Change return type of detach to int.
Add join.
	(join_inferior): New.
	* server.c (main): Don't skip detach support on mingw32.
	If the inferior doesn't support detaching return error.
	Call join_inferior instead of using waitpid.
	* linux-low.c (linux_join): New.
	(linux_target_op): Add linux_join.
	* spu-low.c (spu_join): New.
	(spu_target_ops): Add spu_join.
	* win32-low.c (win32_detach): Adapt to new interface.
	Reopen current_process_handle before detaching.  Issue a child
	resume before detaching.
	(win32_join): New.
	(win32_target_op): Add win32_join.
2007-05-10 21:05:15 +00:00
Pedro Alves 1d5315fee9 * win32-low.c (win32-attach): Fix return value.
* target.h (target_ops): Describe ATTACH return values.
2007-05-10 20:48:41 +00:00
Pedro Alves bf91483160 * win32-low.c (GETPROCADDRESS): Define.
(winapi_DebugActiveProcessStop): Add WINAPI.  typedef as pointer.
	(winapi_DebugSetProcessKillOnExit): Likewise.
	(win32_create_inferior): Force usage of ansi CreateProcessA.
	(win32_attach): Use GETPROCADDRESS.
	(win32_detach): Likewise.
2007-05-10 20:39:18 +00:00
Pedro Alves f72f3e600b * win32-low.c (win32_wait): Don't use WSTOPSIG. 2007-05-10 20:25:01 +00:00
Pedro Alves ed50f18f18 * win32-low.c: Commit leftover changes from 2007-03-29. 2007-03-30 20:28:24 +00:00
Pedro Alves 41093d8184 * win32-low.c: Rename typedef thread_info to
win32_thread_info throughout.
2007-03-28 22:12:31 +00:00
Pedro Alves 544afa546f * win32-i386-low.c: Rename to ...
* win32-low.c: ... this.
	* configure.srv: Replace win32-i386-low.o with win32-low.o.
	* Makefile.in: Likewise.
2007-03-28 22:00:15 +00:00