diff options
author | Christopher Faylor <me+cygwin@cgf.cx> | 2005-11-01 14:07:00 +0000 |
---|---|---|
committer | Christopher Faylor <me+cygwin@cgf.cx> | 2005-11-01 14:07:00 +0000 |
commit | 3929abe911f69151c090ce5f3912324b852d273c (patch) | |
tree | 40197481dbb4eef28050fd0a759130d720f79cad /gdb/win32-nat.c | |
parent | 1a088d065a1177313c8304095f49b74662eddd04 (diff) | |
download | gdb-3929abe911f69151c090ce5f3912324b852d273c.zip gdb-3929abe911f69151c090ce5f3912324b852d273c.tar.gz gdb-3929abe911f69151c090ce5f3912324b852d273c.tar.bz2 |
* win32-nat.c (CYGWIN_SIGNAL_STRING): Delete.
(_CYGWIN_SIGNAL_STRING): Define if not already defined in cygwin.h.
(win32_add_thread): Use XZALLOC rather than xmalloc/memset.
(register_loaded_dll): Ditto.
(handle_load_dll): Call solib_add here.
(handle_unload_dll): Ditto.
(info_dll_command): Delete.
(handle_output_debug_string): Use official _CYGWIN_SIGNAL_STRING.
(win32_current_sos): Duplicate table to pass off to caller rather than deleting
our version.
(set_win32_aliases): New function.
(_initialize_win32_nat): Remove local handling of "info shared". Set
deprecated_init_ui_hook to allow late setting of "info dll" alias.
Diffstat (limited to 'gdb/win32-nat.c')
-rw-r--r-- | gdb/win32-nat.c | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index b0dbfe9..81c115f 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -84,7 +84,9 @@ static int debug_registers_used; /* The string sent by cygwin when it processes a signal. FIXME: This should be in a cygwin include file. */ -#define CYGWIN_SIGNAL_STRING "cygwin: signal" +#ifndef _CYGWIN_SIGNAL_STRING +#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f" +#endif #define CHECK(x) check (x, __FILE__,__LINE__) #define DEBUG_EXEC(x) if (debug_exec) printf_unfiltered x @@ -263,8 +265,7 @@ win32_add_thread (DWORD id, HANDLE h) if ((th = thread_rec (id, FALSE))) return th; - th = (thread_info *) xmalloc (sizeof (*th)); - memset (th, 0, sizeof (*th)); + th = XZALLOC (thread_info); th->id = id; th->h = h; th->next = thread_head.next; @@ -722,8 +723,7 @@ register_loaded_dll (const char *name, DWORD load_addr, int readsyms) GetSystemDirectory (buf, sizeof (buf)); strcat (buf, "\\ntdll.dll"); } - so = (struct so_list *) xmalloc (sizeof (struct so_list)); - memset (so, 0, sizeof (*so)); + so = XZALLOC (struct so_list); so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info)); so->lm_info->load_addr = load_addr; cygwin_conv_to_posix_path (buf, so->so_name); @@ -803,6 +803,7 @@ handle_load_dll (void *dummy) return 1; register_loaded_dll (dll_name, (DWORD) event->lpBaseOfDll + 0x1000, auto_solib_add); + solib_add (NULL, 0, NULL, auto_solib_add); return 1; } @@ -843,8 +844,10 @@ handle_unload_dll (void *dummy) if (!so->next) solib_end = so; free_so (sodel); + solib_add (NULL, 0, NULL, auto_solib_add); return 1; } + error (_("Error: dll starting at 0x%lx not found."), (DWORD) lpBaseOfDll); return 0; @@ -887,22 +890,6 @@ dll_symbol_command (char *args, int from_tty) safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED); } -/* List currently loaded DLLs. */ -static void -info_dll_command (char *ignore, int from_tty) -{ - struct so_list *so = &solib_start; - - if (!so->next) - return; - - printf_filtered ("%*s Load Address\n", -max_dll_name_len, "DLL Name"); - while ((so = so->next) != NULL) - printf_filtered ("%*s %08lx\n", -max_dll_name_len, so->so_name, so->lm_info->load_addr); - - return; -} - /* Handle DEBUG_STRING output from child process. Cygwin prepends its messages with a "cygwin:". Interpret this as a Cygwin signal. Otherwise just print the string as a warning. */ @@ -917,7 +904,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus) || !s || !*s) return gotasig; - if (strncmp (s, CYGWIN_SIGNAL_STRING, sizeof (CYGWIN_SIGNAL_STRING) - 1) != 0) + if (strncmp (s, _CYGWIN_SIGNAL_STRING, sizeof (_CYGWIN_SIGNAL_STRING) - 1) != 0) { if (strncmp (s, "cYg", 3) != 0) warning (("%s"), s); @@ -925,7 +912,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus) else { char *p; - int sig = strtol (s + sizeof (CYGWIN_SIGNAL_STRING) - 1, &p, 0); + int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0); gotasig = target_signal_from_host (sig); ourstatus->value.sig = gotasig; if (gotasig) @@ -2237,16 +2224,32 @@ out: static struct so_list * win32_current_sos (void) { - struct so_list *head = solib_start.next; - win32_clear_solib (); - if (!head && core_bfd) + struct so_list *sop; + struct so_list *start = NULL; + struct so_list *last; + + if (!solib_start.next && core_bfd) { + win32_clear_solib (); bfd_map_over_sections (core_bfd, &core_section_load_dll_symbols, &win32_ops); - head = solib_start.next; - win32_clear_solib (); } - return head; + + for (sop = solib_start.next; sop; sop = sop->next) + { + struct so_list *new = XZALLOC (struct so_list); + strcpy (new->so_name, sop->so_name); + strcpy (new->so_original_name, sop->so_original_name); + if (!start) + last = start = new; + else + { + last->next = new; + last = new; + } + } + + return start; } static void @@ -2319,6 +2322,12 @@ init_win32_ops (void) current_target_so_ops = &win32_so_ops; } +static void +set_win32_aliases (char *argv0) +{ + add_info_alias ("dll", "sharedlibrary", 1); +} + void _initialize_win32_nat (void) { @@ -2382,9 +2391,6 @@ Show whether to display kernel exceptions in child process."), NULL, NULL, /* FIXME: i18n: */ &setlist, &showlist); - add_info ("dll", info_dll_command, _("Status of loaded DLLs.")); - add_info_alias ("sharedlibrary", "dll", 1); - add_prefix_cmd ("w32", class_info, info_w32_command, _("Print information specific to Win32 debugging."), &info_w32_cmdlist, "info w32 ", 0, &infolist); @@ -2393,6 +2399,7 @@ Show whether to display kernel exceptions in child process."), NULL, _("Display selectors infos."), &info_w32_cmdlist); add_target (&win32_ops); + deprecated_init_ui_hook = set_win32_aliases; } /* Hardware watchpoint support, adapted from go32-nat.c code. */ |