* [commit] more cygwin shared library cleanup
@ 2005-11-01 5:08 Christopher Faylor
2005-11-01 5:28 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Faylor @ 2005-11-01 5:08 UTC (permalink / raw)
To: gdb-patches
I have more to do to consolidate cygwin's handling of shared libraries
with gdb but this is a step along the way.
I ended up putting back some of the functions I'd previously deleted
because they were really needed for core file handling.
cgf
2005-10-31 Christopher Faylor <cgf@timesys.com>
* win32-nat.c (get_relocated_section_addrs): Reinstate.
(solib_symbols_add): New function.
(lm_info): Remove end_addr field.
(register_loaded_dll): Don't try to find end_addr since gdb will do
this automatically now. Make so_original_name == so_name for now.
Eliminate strcpy by using so_name directly. Read in symbols if new
paramater "readsyms" is true.
(handle_load_dll): Pass auto_solib_add to register_loaded_dll to
control when symbols should be read.
(win32_free_so): Don't free objfile here.
(win32_create_inferior_hook): New function.
(handle_unload_dll): Remove left-over cruft.
(win32_special_symbol_handling): New (dummy) function.
(map_single_dll_code_section): Reinstate.
(dll_code_sections_add): Reinstate.
(core_section_load_dll_symbols): Reinstate. Don't issue an error on
duplicate attempts to read same dll. Make sure that UNIX-like name is
used to register DLL.
(win32_current_sos): Handle core files. Reset private list before
passing start of list pointer to gdb.
(init_win32_ops): Fill out (currently unused)
solib_create_inferior_hook. Fill out special_symbol_handling.
* config/i386/tm-cygwin.h: Remove most special solib stuff.
Index: win32-nat.c
===================================================================
RCS file: /cvs/uberbaum/gdb/win32-nat.c,v
retrieving revision 1.114
diff -u -p -r1.114 win32-nat.c
--- win32-nat.c 1 Nov 2005 00:40:09 -0000 1.114
+++ win32-nat.c 1 Nov 2005 05:05:24 -0000
@@ -54,6 +54,7 @@
#include <unistd.h>
#include "exec.h"
#include "solist.h"
+#include "solib.h"
#include "i386-tdep.h"
#include "i387-tdep.h"
@@ -517,7 +518,6 @@ struct safe_symbol_file_add_args
struct lm_info
{
DWORD load_addr;
- DWORD end_addr;
};
static struct so_list solib_start, *solib_end;
@@ -577,14 +577,121 @@ safe_symbol_file_add (char *name, int fr
return p.ret;
}
+/* Get the loaded address of all sections, given that .text was loaded
+ at text_load. Assumes that all sections are subject to the same
+ relocation offset. Returns NULL if problems occur or if the
+ sections were not relocated. */
+
+static struct section_addr_info *
+get_relocated_section_addrs (bfd *abfd, CORE_ADDR text_load)
+{
+ struct section_addr_info *result = NULL;
+ int section_count = bfd_count_sections (abfd);
+ asection *text_section = bfd_get_section_by_name (abfd, ".text");
+ CORE_ADDR text_vma;
+
+ if (!text_section)
+ {
+ /* Couldn't get the .text section. Weird. */
+ }
+
+ else if (text_load == (text_vma = bfd_get_section_vma (abfd, text_section)))
+ {
+ /* DLL wasn't relocated. */
+ }
+
+ else
+ {
+ /* Figure out all sections' loaded addresses. The offset here is
+ such that taking a bfd_get_section_vma() result and adding
+ offset will give the real load address of the section. */
+
+ CORE_ADDR offset = text_load - text_vma;
+
+ struct section_table *table_start = NULL;
+ struct section_table *table_end = NULL;
+ struct section_table *iter = NULL;
+
+ build_section_table (abfd, &table_start, &table_end);
+
+ for (iter = table_start; iter < table_end; ++iter)
+ {
+ /* Relocated addresses. */
+ iter->addr += offset;
+ iter->endaddr += offset;
+ }
+
+ result = build_section_addr_info_from_section_table (table_start,
+ table_end);
+
+ xfree (table_start);
+ }
+
+ return result;
+}
+
+/* Add DLL symbol information. */
+static void
+solib_symbols_add (struct so_list *so, CORE_ADDR load_addr)
+{
+ struct section_addr_info *addrs = NULL;
+ static struct objfile *result = NULL;
+ char *name = so->so_name;
+ bfd *abfd = NULL;
+
+ /* The symbols in a dll are offset by 0x1000, which is the
+ the offset from 0 of the first byte in an image - because
+ of the file header and the section alignment. */
+
+ if (!name || !name[0])
+ return;
+
+ abfd = bfd_openr (name, "pei-i386");
+
+ if (!abfd)
+ {
+ /* pei failed - try pe */
+ abfd = bfd_openr (name, "pe-i386");
+ }
+
+ if (abfd)
+ {
+ if (bfd_check_format (abfd, bfd_object))
+ addrs = get_relocated_section_addrs (abfd, load_addr);
+
+ bfd_close (abfd);
+ }
+
+ if (addrs)
+ {
+ result = safe_symbol_file_add (name, 0, addrs, 0, OBJF_SHARED);
+ free_section_addr_info (addrs);
+ }
+ else
+ {
+ /* Fallback on handling just the .text section. */
+ struct cleanup *my_cleanups;
+
+ addrs = alloc_section_addr_info (1);
+ my_cleanups = make_cleanup (xfree, addrs);
+ addrs->other[0].name = ".text";
+ addrs->other[0].addr = load_addr;
+
+ result = safe_symbol_file_add (name, 0, addrs, 0, OBJF_SHARED);
+ do_cleanups (my_cleanups);
+ }
+
+ so->symbols_loaded = !!result;
+ return;
+}
+
/* Remember the maximum DLL length for printing in info dll command. */
static int max_dll_name_len;
-static void
-register_loaded_dll (const char *name, DWORD load_addr)
+static char *
+register_loaded_dll (const char *name, DWORD load_addr, int readsyms)
{
struct so_list *so;
- char ppath[MAX_PATH + 1];
char buf[MAX_PATH + 1];
char cwd[MAX_PATH + 1];
char *p;
@@ -615,25 +722,21 @@ register_loaded_dll (const char *name, D
GetSystemDirectory (buf, sizeof (buf));
strcat (buf, "\\ntdll.dll");
}
- cygwin_conv_to_posix_path (buf, ppath);
- so = (struct so_list *) xmalloc (sizeof (struct so_list) + strlen (ppath) + 8 + 1);
+ so = (struct so_list *) xmalloc (sizeof (struct so_list));
memset (so, 0, sizeof (*so));
so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
so->lm_info->load_addr = load_addr;
- if (VirtualQueryEx (current_process_handle, (void *) load_addr, &m,
- sizeof (m)))
- so->lm_info->end_addr = (DWORD) m.AllocationBase + m.RegionSize;
- else
- so->lm_info->end_addr = load_addr + 0x2000; /* completely arbitrary */
-
- so->next = NULL;
- strcpy (so->so_name, ppath);
+ cygwin_conv_to_posix_path (buf, so->so_name);
+ strcpy (so->so_original_name, so->so_name);
solib_end->next = so;
solib_end = so;
- len = strlen (ppath);
+ len = strlen (so->so_name);
if (len > max_dll_name_len)
max_dll_name_len = len;
+ if (readsyms)
+ solib_symbols_add (so, (CORE_ADDR) load_addr);
+ return so->so_name;
}
static char *
@@ -699,7 +802,7 @@ handle_load_dll (void *dummy)
if (!dll_name)
return 1;
- register_loaded_dll (dll_name, (DWORD) event->lpBaseOfDll + 0x1000);
+ register_loaded_dll (dll_name, (DWORD) event->lpBaseOfDll + 0x1000, auto_solib_add);
return 1;
}
@@ -707,18 +810,10 @@ handle_load_dll (void *dummy)
static void
win32_free_so (struct so_list *so)
{
- if (so->objfile)
- free_objfile (so->objfile);
if (so->lm_info)
xfree (so->lm_info);
}
-static struct so_list *
-win32_current_sos (void)
-{
- return solib_start.next;
-}
-
static void
win32_relocate_section_addresses (struct so_list *so,
struct section_table *sec)
@@ -727,6 +822,13 @@ win32_relocate_section_addresses (struct
return;
}
+static void
+win32_solib_create_inferior_hook (void)
+{
+ solib_add (NULL, 0, NULL, auto_solib_add);
+ return;
+}
+
static int
handle_unload_dll (void *dummy)
{
@@ -752,13 +854,17 @@ handle_unload_dll (void *dummy)
static void
win32_clear_solib (void)
{
- struct so_list *so, *so1 = solib_start.next;
-
solib_start.next = NULL;
solib_end = &solib_start;
max_dll_name_len = sizeof ("DLL Name") - 1;
}
+static void
+win32_special_symbol_handling (void)
+{
+ return;
+}
+
/* Load DLL symbol info. */
void
dll_symbol_command (char *args, int from_tty)
@@ -1575,18 +1681,18 @@ win32_pid_to_exec_file (int pid)
cygwin_internal (CW_LOCK_PINFO, 1000);
for (cpid = 0;
(pinfo = (struct external_pinfo *)
- cygwin_internal (CW_GETPINFO, cpid | CW_NEXTPID));
+ cygwin_internal (CW_GETPINFO, cpid | CW_NEXTPID));
cpid = pinfo->pid)
{
if (pinfo->dwProcessId == current_event.dwProcessId) /* Got it */
{
- cygwin_conv_to_full_posix_path (pinfo->progname, path);
- path_ptr = path;
- break;
+ cygwin_conv_to_full_posix_path (pinfo->progname, path);
+ path_ptr = path;
+ break;
}
}
cygwin_internal (CW_UNLOCK_PINFO);
- return path_ptr;
+ return path_ptr;
}
/* Print status information about what we're accessing. */
@@ -1987,6 +2093,178 @@ cygwin_pid_to_str (ptid_t ptid)
return buf;
}
+typedef struct
+{
+ struct target_ops *target;
+ bfd_vma addr;
+} map_code_section_args;
+
+static void
+map_single_dll_code_section (bfd *abfd, asection *sect, void *obj)
+{
+ int old;
+ int update_coreops;
+ struct section_table *new_target_sect_ptr;
+
+ map_code_section_args *args = (map_code_section_args *) obj;
+ struct target_ops *target = args->target;
+ if (sect->flags & SEC_CODE)
+ {
+ update_coreops = core_ops.to_sections == target->to_sections;
+
+ if (target->to_sections)
+ {
+ old = target->to_sections_end - target->to_sections;
+ target->to_sections = (struct section_table *)
+ xrealloc ((char *) target->to_sections,
+ (sizeof (struct section_table)) * (1 + old));
+ }
+ else
+ {
+ old = 0;
+ target->to_sections = (struct section_table *)
+ xmalloc ((sizeof (struct section_table)));
+ }
+ target->to_sections_end = target->to_sections + (1 + old);
+
+ /* Update the to_sections field in the core_ops structure
+ if needed. */
+ if (update_coreops)
+ {
+ core_ops.to_sections = target->to_sections;
+ core_ops.to_sections_end = target->to_sections_end;
+ }
+ new_target_sect_ptr = target->to_sections + old;
+ new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
+ new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
+ bfd_section_size (abfd, sect);;
+ new_target_sect_ptr->the_bfd_section = sect;
+ new_target_sect_ptr->bfd = abfd;
+ }
+}
+
+static int
+dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
+{
+ bfd *dll_bfd;
+ map_code_section_args map_args;
+ asection *lowest_sect;
+ char *name;
+ if (dll_name == NULL || target == NULL)
+ return 0;
+ name = xstrdup (dll_name);
+ dll_bfd = bfd_openr (name, "pei-i386");
+ if (dll_bfd == NULL)
+ return 0;
+
+ if (bfd_check_format (dll_bfd, bfd_object))
+ {
+ lowest_sect = bfd_get_section_by_name (dll_bfd, ".text");
+ if (lowest_sect == NULL)
+ return 0;
+ map_args.target = target;
+ map_args.addr = base_addr - bfd_section_vma (dll_bfd, lowest_sect);
+
+ bfd_map_over_sections (dll_bfd, &map_single_dll_code_section, (void *) (&map_args));
+ }
+
+ return 1;
+}
+
+static void
+core_section_load_dll_symbols (bfd *abfd, asection *sect, void *obj)
+{
+ struct target_ops *target = (struct target_ops *) obj;
+
+ DWORD base_addr;
+
+ int dll_name_size;
+ struct win32_pstatus *pstatus;
+ struct so_list *so;
+ char *dll_name;
+ char *buf = NULL;
+ char *p;
+ struct objfile *objfile;
+ const char *dll_basename;
+
+ if (strncmp (sect->name, ".module", 7) != 0)
+ return;
+
+ buf = (char *) xmalloc (bfd_get_section_size (sect) + 1);
+ if (!buf)
+ {
+ printf_unfiltered ("memory allocation failed for %s\n", sect->name);
+ goto out;
+ }
+ if (!bfd_get_section_contents (abfd, sect, buf, 0, bfd_get_section_size (sect)))
+ goto out;
+
+ pstatus = (struct win32_pstatus *) buf;
+
+ memmove (&base_addr, &(pstatus->data.module_info.base_address), sizeof (base_addr));
+ dll_name_size = pstatus->data.module_info.module_name_size;
+ if (offsetof (struct win32_pstatus, data.module_info.module_name) + dll_name_size > bfd_get_section_size (sect))
+ goto out;
+
+ dll_name = pstatus->data.module_info.module_name;
+
+ if (!(dll_basename = strrchr (dll_name, '/')))
+ dll_basename = dll_name;
+ else
+ dll_basename++;
+
+ ALL_OBJFILES (objfile)
+ {
+ char *objfile_basename = strrchr (objfile->name, '/');
+
+ if (objfile_basename &&
+ strcasecmp (dll_basename, objfile_basename + 1) == 0)
+ goto out;
+ }
+
+ base_addr += 0x1000;
+ dll_name = register_loaded_dll (dll_name, base_addr, 1);
+
+ if (!dll_code_sections_add (dll_name, (DWORD) base_addr, target))
+ printf_unfiltered ("%s: Failed to map dll code sections.\n", dll_name);
+
+out:
+ if (buf)
+ xfree (buf);
+ return;
+}
+
+static struct so_list *
+win32_current_sos (void)
+{
+ struct so_list *head = solib_start.next;
+ win32_clear_solib ();
+ if (!head && core_bfd)
+ {
+ bfd_map_over_sections (core_bfd, &core_section_load_dll_symbols,
+ &win32_ops);
+ head = solib_start.next;
+ win32_clear_solib ();
+ }
+ return head;
+}
+
+static void
+fetch_elf_core_registers (char *core_reg_sect,
+ unsigned core_reg_size,
+ int which,
+ CORE_ADDR reg_addr)
+{
+ int r;
+ if (core_reg_size < sizeof (CONTEXT))
+ {
+ error (_("Core file register section too small (%u bytes)."), core_reg_size);
+ return;
+ }
+ for (r = 0; r < NUM_REGS; r++)
+ regcache_raw_supply (current_regcache, r, core_reg_sect + mappings[r]);
+}
+
static void
init_win32_ops (void)
{
@@ -2031,8 +2309,8 @@ init_win32_ops (void)
win32_so_ops.relocate_section_addresses = win32_relocate_section_addresses;
win32_so_ops.free_so = win32_free_so;
win32_so_ops.clear_solib = win32_clear_solib;
- win32_so_ops.solib_create_inferior_hook = NULL;
- win32_so_ops.special_symbol_handling = NULL;
+ win32_so_ops.solib_create_inferior_hook = win32_solib_create_inferior_hook;
+ win32_so_ops.special_symbol_handling = win32_special_symbol_handling;
win32_so_ops.current_sos = win32_current_sos;
win32_so_ops.open_symbol_file_object = NULL;
win32_so_ops.in_dynsym_resolve_code = NULL;
@@ -2165,22 +2443,6 @@ win32_win32_thread_alive (ptid_t ptid)
FALSE : TRUE;
}
-static void
-fetch_elf_core_registers (char *core_reg_sect,
- unsigned core_reg_size,
- int which,
- CORE_ADDR reg_addr)
-{
- int r;
- if (core_reg_size < sizeof (CONTEXT))
- {
- error (_("Core file register section too small (%u bytes)."), core_reg_size);
- return;
- }
- for (r = 0; r < NUM_REGS; r++)
- regcache_raw_supply (current_regcache, r, core_reg_sect + mappings[r]);
-}
-
static struct core_fns win32_elf_core_fns =
{
bfd_target_elf_flavour,
Index: config/i386/tm-cygwin.h
===================================================================
RCS file: /cvs/uberbaum/gdb/config/i386/tm-cygwin.h,v
retrieving revision 1.18
diff -u -p -r1.18 tm-cygwin.h
--- config/i386/tm-cygwin.h 6 Apr 2004 01:53:51 -0000 1.18
+++ config/i386/tm-cygwin.h 1 Nov 2005 05:05:24 -0000
@@ -21,16 +21,5 @@
Boston, MA 02111-1307, USA. */
#define ATTACH_NO_WAIT
-#define SOLIB_ADD(filename, from_tty, targ, readsyms) child_solib_add(filename, from_tty, targ, readsyms)
-#define PC_SOLIB(addr) solib_address (addr)
-#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) child_solib_loaded_library_pathname(pid)
-#define CLEAR_SOLIB child_clear_solibs
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
-
-struct target_ops;
-char *cygwin_pid_to_str (ptid_t ptid);
-void child_solib_add (char *, int, struct target_ops *, int);
-char *solib_address (CORE_ADDR);
-char *child_solib_loaded_library_pathname(int);
-void child_clear_solibs (void);
void dll_symbol_command (char *, int);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [commit] more cygwin shared library cleanup
2005-11-01 5:08 [commit] more cygwin shared library cleanup Christopher Faylor
@ 2005-11-01 5:28 ` Daniel Jacobowitz
2005-11-01 14:11 ` [commit] cygwin shared library cleanup, round 3 Christopher Faylor
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-11-01 5:28 UTC (permalink / raw)
To: gdb-patches
On Tue, Nov 01, 2005 at 12:08:45AM -0500, Christopher Faylor wrote:
> I have more to do to consolidate cygwin's handling of shared libraries
> with gdb but this is a step along the way.
>
> I ended up putting back some of the functions I'd previously deleted
> because they were really needed for core file handling.
As usual, thanks! It's great to see the Cygwin port getting attention.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 3+ messages in thread
* [commit] cygwin shared library cleanup, round 3
2005-11-01 5:28 ` Daniel Jacobowitz
@ 2005-11-01 14:11 ` Christopher Faylor
0 siblings, 0 replies; 3+ messages in thread
From: Christopher Faylor @ 2005-11-01 14:11 UTC (permalink / raw)
To: gdb-patches
Random fixes, the most thrilling of which is the addition of solib_add
in a couple of places to properly catch dll load and unload. Hopefully
this will be fixed "the right way" by the implementation of solib
breakpoints sometime soon, unless I run out of steam.
I also added the beginnings of cygwin signal handling (not to be confused
with the anemic Windows signal handling).
cgf
2005-11-01 Christopher Faylor <cgf@timesys.com>
* 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.
Index: win32-nat.c
===================================================================
RCS file: /cvs/uberbaum/gdb/win32-nat.c,v
retrieving revision 1.115
diff -u -p -r1.115 win32-nat.c
--- win32-nat.c 1 Nov 2005 05:08:28 -0000 1.115
+++ win32-nat.c 1 Nov 2005 14:06:28 -0000
@@ -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, D
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
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 targe
|| !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 targe
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 exception
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 exception
_("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. */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-01 14:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-01 5:08 [commit] more cygwin shared library cleanup Christopher Faylor
2005-11-01 5:28 ` Daniel Jacobowitz
2005-11-01 14:11 ` [commit] cygwin shared library cleanup, round 3 Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox