X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fwindows-nat.c;h=dc6dbddf3b58a471779a47e45e79cfb3ed7af9ee;hb=5fed81ff351121887a93b5b57caebb86667cbbd2;hp=1ef38fb32b4bd8cb9d9907ba1c7d728658a9f446;hpb=d092c5a2465ece3435131ae6fef1ccb6e70986cb;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 1ef38fb32b..dc6dbddf3b 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -42,6 +42,7 @@ #include #include #endif +#include #include "buildsym.h" #include "filenames.h" @@ -465,7 +466,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, windows_thread_info *th, int r) { char *context_offset = ((char *) &th->context) + mappings[r]; - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); long l; @@ -552,7 +553,7 @@ do_windows_store_inferior_registers (const struct regcache *regcache, ((char *) &th->context) + mappings[r]); else { - for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++) + for (r = 0; r < gdbarch_num_regs (regcache->arch ()); r++) do_windows_store_inferior_registers (regcache, th, r); } } @@ -755,8 +756,8 @@ get_image_name (HANDLE h, void *address, int unicode) do_initial_windows_stuff and windows_add_all_dlls for more info on how we handle DLL loading during that phase). */ -static int -handle_load_dll (void *dummy) +static void +handle_load_dll () { LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll; char *dll_name; @@ -769,7 +770,7 @@ handle_load_dll (void *dummy) dll_name = get_image_name (current_process_handle, event->lpImageName, event->fUnicode); if (!dll_name) - return 1; + return; solib_end->next = windows_make_so (dll_name, event->lpBaseOfDll); solib_end = solib_end->next; @@ -778,8 +779,6 @@ handle_load_dll (void *dummy) DEBUG_EVENTS (("gdb: Loading dll \"%s\" at %s.\n", solib_end->so_name, host_address_to_string (li->load_addr))); - - return 1; } static void @@ -799,8 +798,8 @@ windows_free_so (struct so_list *so) do_initial_windows_stuff and windows_add_all_dlls for more info on how we handle DLL loading during that phase). */ -static int -handle_unload_dll (void *dummy) +static void +handle_unload_dll () { LPVOID lpBaseOfDll = current_event.u.UnloadDll.lpBaseOfDll; struct so_list *so; @@ -819,7 +818,7 @@ handle_unload_dll (void *dummy) DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", sodel->so_name)); windows_free_so (sodel); - return 1; + return; } } @@ -832,8 +831,23 @@ handle_unload_dll (void *dummy) 32bit and 64bit worlds). */ complaint (&symfile_complaints, _("dll starting at %s not found."), host_address_to_string (lpBaseOfDll)); +} - return 0; +/* Call FUNC wrapped in a TRY/CATCH that swallows all GDB + exceptions. */ + +static void +catch_errors (void (*func) ()) +{ + TRY + { + func (); + } + CATCH (ex, RETURN_MASK_ALL) + { + exception_print (gdb_stderr, ex); + } + END_CATCH } /* Clear list of loaded DLLs. */ @@ -845,7 +859,7 @@ windows_clear_solib (void) } static void -signal_event_command (char *args, int from_tty) +signal_event_command (const char *args, int from_tty) { uintptr_t event_id = 0; char *endargs = NULL; @@ -1006,7 +1020,7 @@ display_selector (HANDLE thread, DWORD sel) } static void -display_selectors (char * args, int from_tty) +display_selectors (const char * args, int from_tty) { if (!current_thread) { @@ -1362,7 +1376,7 @@ windows_resume (struct target_ops *ops, { /* Single step by setting t bit. */ struct regcache *regcache = get_current_regcache (); - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); windows_fetch_inferior_registers (ops, regcache, gdbarch_ps_regnum (gdbarch)); th->context.EFlags |= FLAG_TRACE_BIT; @@ -1541,7 +1555,7 @@ get_windows_debug_event (struct target_ops *ops, CloseHandle (current_event.u.LoadDll.hFile); if (saw_create != 1 || ! windows_initialization_done) break; - catch_errors (handle_load_dll, NULL, (char *) "", RETURN_MASK_ALL); + catch_errors (handle_load_dll); ourstatus->kind = TARGET_WAITKIND_LOADED; ourstatus->value.integer = 0; thread_id = main_thread_id; @@ -1554,7 +1568,7 @@ get_windows_debug_event (struct target_ops *ops, "UNLOAD_DLL_DEBUG_EVENT")); if (saw_create != 1 || ! windows_initialization_done) break; - catch_errors (handle_unload_dll, NULL, (char *) "", RETURN_MASK_ALL); + catch_errors (handle_unload_dll); ourstatus->kind = TARGET_WAITKIND_LOADED; ourstatus->value.integer = 0; thread_id = main_thread_id;