This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Fix a cygwin SEGV when reading ntdll.dll
- From: Christopher Faylor <cgf at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 6 Jul 2003 15:49:16 -0400
- Subject: [PATCH] Fix a cygwin SEGV when reading ntdll.dll
The Cygwin version of gdb had a typo which caused a SEGV when
reading certain DLLs. The below patch fixes that.
cgf
2003-07-06 Christopher Faylor <cgf@redhat.com>
* win32-nat.c (solib_symbols_add): Use one variable for all section
address stuff. Pass variable rather than address of variable to
safe_symbol_file_add.
Index: win32-nat.c
===================================================================
RCS file: /cvs/uberbaum/gdb/win32-nat.c,v
retrieving revision 1.76
diff -u -p -w -r1.76 win32-nat.c
--- win32-nat.c 11 Jun 2003 22:36:04 -0000 1.76
+++ win32-nat.c 6 Jul 2003 19:45:17 -0000
@@ -802,7 +802,7 @@ get_relocated_section_addrs (bfd *abfd,
static struct objfile *
solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr)
{
- struct section_addr_info *section_addrs_ptr = NULL;
+ struct section_addr_info *addrs = NULL;
static struct objfile *result = NULL;
bfd *abfd = NULL;
@@ -825,33 +825,28 @@ solib_symbols_add (char *name, int from_
{
if (bfd_check_format (abfd, bfd_object))
{
- section_addrs_ptr = get_relocated_section_addrs (abfd, load_addr);
+ addrs = get_relocated_section_addrs (abfd, load_addr);
}
bfd_close (abfd);
}
- if (section_addrs_ptr)
+ if (addrs)
{
- result = safe_symbol_file_add (name, from_tty, section_addrs_ptr,
- 0, OBJF_SHARED);
-
- free_section_addr_info (section_addrs_ptr);
+ result = safe_symbol_file_add (name, from_tty, addrs, 0, OBJF_SHARED);
+ free_section_addr_info (addrs);
}
-
else
{
/* Fallback on handling just the .text section. */
- struct section_addr_info *section_addrs;
struct cleanup *my_cleanups;
- section_addrs = alloc_section_addr_info (1);
- my_cleanups = make_cleanup (xfree, section_addrs);
- section_addrs->other[0].name = ".text";
- section_addrs->other[0].addr = load_addr;
+ 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, from_tty, §ion_addrs,
- 0, OBJF_SHARED);
+ result = safe_symbol_file_add (name, from_tty, addrs, 0, OBJF_SHARED);
do_cleanups (my_cleanups);
}