This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I was fixing a few things here and there in gdb/wince.c and gdb/wince-stub.c, until I noticed that most of it is duplicated from gdb/win32-nat.c. I then merged the WinCE support into win32-nat.c. The result is that Windows CE support code got almost cut in half, and we lose no features. In fact, we gain some. The ChangeLog is big, but it is mostly about renaming, moving and deleting stuff.
I've declared a vector (win32_target_iface_t) holding pointers into implementations of the needed functions to communicate with the stub. I've done it this way, because I thought of adding support for remote debugging of desktop Windows apps using the same stub as Windows CE. In the end I never got to it, but should be easy to do. IMHO, this is better than duplicating all of the debugging support in a target remote stub, as done in gdbproxy from Wine. I then define macros for all the win32 calls in this vector, so for example, a call for CloseHandle turns into a DEBUG_CloseHandle.
I have introduced a few defines, that I don't know the right place for them. They currently live on the win32.h file. They are the HAVE_CREATE_NEW_PROCESS_GROUP, HAVE_SELECTORS, HAVE_DEBUG_PRIVILEGE_SUPPORT. They depend on target architecture and target OS, so maybe they should be in the respective config/$arch/*.h files.
Also, I only tested this on arm-wince-pe. I don't have access to any MIPS or SH Windows CE machine. I don't think they are supported by MS anymore, but I am not sure. I am not against deprecating those.
Cheers, Pedro Alves
--- ChangeLog
* wince.c: Remove code duplicate fro win32-nat.c (CHECK, DEBUG_EXEC, DEBUG_EVENTS, DEBUG_MEM, DEBUG_EXCEPT): Remove. (wcslen, CeSetFileTime): Declare. (werror): New function. (DEFAULT_UPLOAD_DIR): New define. (DEBUG_COM, DEBUG_WINCE): New macros. (win32_child_thread_alive, child_kill_inferior, last_sig, thread_info_struct, thread_head, thread_rec, current_event, current_process_handle, current_thread, this_thread, main_thread_id, exception_count, event_count, debug_exec, debug_events, debug_memory, debug_exceptions, mappings, regptr, getword, putlen, getlen): Remove. (s): Initialize to invalid socket state. (vstub_error, stub_error): Tag with ATTR_NORETURN. (sockread): Handle EINTR. Return 1 on success. (sockwrite): Return 1 on success. (putdword, putword, getdword, getresult): Update sockread and sockwrite calls to new semantics. (putmemory, getresult): len is now long. (REMOTE_CreateProcessA): New function. (REMOTE_OpenProcess): New function. (REMOTE_TerminateProcess): Rename from terminate_process. Return FALSE when there is no connection. (REMOTE_WaitForDebugEvent): Rename from wait_for_debug_event. Return FALSE when there is no connection. (REMOTE_GetThreadContext): Rename from get_thread_context. Return FALSE when there is no connection. Make sure we have the right context. (REMOTE_SetThreadContext): Rename from set_thread_context. Return FALSE when there is no connection. (REMOTE_ReadProcessMemory): Rename from read_process_memory. Return FALSE when there is no connection. (REMOTE_WriteProcessMemory): Rename from write_process_memory. Return FALSE when there is no connection. (REMOTE_FlushInstructionCache): New function. (remote_write_bytes, thread_alive): Remove. (REMOTE_WaitForSingleObject): New function. (REMOTE_SuspendThread): Rename from suspend_thread. (REMOTE_ResumeThread): Rename from resume_thread. (REMOTE_ContinueDebugEvent): Rename from continue_debug_event. Return FALSE when there is no connection. (REMOTE_CloseHandle): Rename from close_handle. Return FALSE when there is no connection. Short-circuit NULL case. (check_for_step, undoSStep, wince_software_single_step, sh_get_next_pc): Remove. (child_add_thread, child_init_thread_list, child_delete_thread, check, do_child_fetch_inferior_registers, child_fetch_inferior_registers, do_child_store_inferior_registers, child_store_inferior_registers, handle_load_dll, handle_output_debug_string, handle_exception, child_continue, get_child_debug_event, child_wait, child_files_info, child_open): Remove.
(REMOTE_FileChecksum): New function. (_init_win32_wce_iface): New function. (FACTOR, NSPERSEC, time_t_to_filetime, to_time_t): Update from a recent cygwin. (upload_to_device): Don't rely only on timestamps to decide if file needs uploading, but do a simple checksum compare too. Enables the debugging of older executables than already on device. Don't open for writing when reading the timestamps. Enables more than one stub running. Issue progress report. Synchronize timestamps between host and target. (wince_stub_connect): Rename from wince_initialize. Don't bother connecting when upload_when is UPLOAD_NEVER. Disable Nagle algorithm. (child_create_inferior, child_kill_inferior, child_resume, child_prepare_to_store, child_can_run, child_close, child_load, init_child_ops): Remove. (replace_upload): Guard against dangling else. (set_upload_type): Update to new declaration. (_initialize_wince): Remove commands already handled by win32-nat.c. Add "debugcommunication", "debugwince" commands. (win32_child_thread_alive, cygwin_pid_to_str): Remove.
* wince-stub.h (win_func): Sort alphanumerically. Define GDB_FIRST as the first element. Remove GDB_SINGLESTEP. (gdb_wince_len): Define as unsigned long. (gdb_wince_result): Define as unsigned long. (putlen): Define. (getlen): Define.
* wince-stub.c (wcschr): Protoize. (in_addr_t): Define. (REALLOC): Remove. (STUB_LOG): New macro. (vstub_log): New function. (stub_log): New function. (sockread, sockwrite): Return 1 on success. (getdword, getword, getmemory, putdword, putword): Adapt to new sockread and sockwrite semantics. (getlen, putlen): Remove. (puthandle): New macro. (putmemory): gdb_wince_len is now 32 bits. Adapt. (curproc): Remove comment, no longer true. (create_process): Try to detect suspicious cases. (terminate_process): Fully simulate TerminateProcess call. (debug_active_process): New function. (stepped): Remove. (flat_single_step): Remove. (wait_for_debug_event): Only handle events for the process we are debugging, not it's children. (open_process): New function. (get_thread_context): Workaround the fact that w32api headers don't define the whole CONTEXT structure yet. (write_process_memory): Remove unneeded casts. (flush_instruction_cache): New function. (thread_alive): Remove. (wait_for_single_object): New function. (file_checksum): New function. (stop_requested): Record here a stub stop request. (stop_stub): New function. (msg_handler_map): Map stub command to handler function. (HANDLER_COUNT): New macro. (error_there_are_handlers_missing, error_there_are_too_many_handlers): New compile time asserts. (dispatch): Use msg_handler_map instead of switch over every possible message. Close stub when stop_requested is detected. (WinMain): Add some logging. Workaround the fact that gethostbyname function cannot resolve IP address strings passed to it. Disable Nagle algorithm.
* config/arm/tm-wince.h (SOFTWARE_SINGLE_STEP_P): Remove. (SOFTWARE_SINGLE_STEP): Remove. (wince_software_single_step): Remove. (ARM_BE_BREAKPOINT, ARM_LE_BREAKPOINT): Define the correct values for Windows CE.
* config/arm/wince.mt (TDEPFILES): Also compile win32-nat.c and corelow.c. (MT_CFLAGS): Define __arm__. Break long line into multiple lines.
* solib.c: Set errno to ENOENT, so we can use perror_with_name correctly. (solib_map_sections): When the so is not found, flag it. On subsequent searches, avoid researching, and repeating the same error message. (solib_read_symbols): Only call symbol_add_stub, when solib_open reports the so is found. Otherwise, flag it. (read_symbols_stub_arg): New struct. (read_symbols_stub): New function. sharedlibrary_command: Always pass in a valid string to solib_add. (solib_add): Only consider a non-empty string a valid pattern. Try reading in symbols from all sos when there is an empty pattern (called from sharedlibrary_command). If there isn't a pattern, only try reading sos we know exist (gdb->not_found is not set). Call solib_read symbols wrapped in catch_errors, so we don't stop on first error.
Attachment:
gdb-wince.diff.gz
Description: application/gzip
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |