Handle missing shared libraries during the examination of a core

dump gracefully.
	* solib.c (find_solib):  Use catch_errors around call to
	solib_map_sections. Use warning instead of error if reading of
	the shared library name fails.
	(solib_map_sections):  Change return and argument types to make
	it callable from catch_errors.
	(symbol_add_stub):  Avoid GDB core dump if solib->abfd is NULL.
	* irix5-nat.c, osfsolib.c (xfer_link_map_member, solib_map_sections,
	symbol_add_stub):  Ditto.
This commit is contained in:
Peter Schauer 1998-04-22 20:17:44 +00:00
parent f3b96ecc60
commit b420cea7eb
4 changed files with 59 additions and 28 deletions

View File

@ -1,3 +1,16 @@
Wed Apr 22 12:58:23 1998 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
Handle missing shared libraries during the examination of a core
dump gracefully.
* solib.c (find_solib): Use catch_errors around call to
solib_map_sections. Use warning instead of error if reading of
the shared library name fails.
(solib_map_sections): Change return and argument types to make
it callable from catch_errors.
(symbol_add_stub): Avoid GDB core dump if solib->abfd is NULL.
* irix5-nat.c, osfsolib.c (xfer_link_map_member, solib_map_sections,
symbol_add_stub): Ditto.
Wed Apr 22 14:34:49 1998 Michael Meissner <meissner@cygnus.com> Wed Apr 22 14:34:49 1998 Michael Meissner <meissner@cygnus.com>
* Makefile.in (INTL*): Add support to link in the intl library, * Makefile.in (INTL*): Add support to link in the intl library,

View File

@ -1,5 +1,5 @@
/* Native support for the SGI Iris running IRIX version 5, for GDB. /* Native support for the SGI Iris running IRIX version 5, for GDB.
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@ -352,8 +352,8 @@ xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
static CORE_ADDR static CORE_ADDR
locate_base PARAMS ((void)); locate_base PARAMS ((void));
static void static int
solib_map_sections PARAMS ((struct so_list *)); solib_map_sections PARAMS ((char *));
/* /*
@ -363,7 +363,7 @@ LOCAL FUNCTION
SYNOPSIS SYNOPSIS
static void solib_map_sections (struct so_list *so) static int solib_map_sections (struct so_list *so)
DESCRIPTION DESCRIPTION
@ -382,10 +382,11 @@ FIXMES
expansion stuff?). expansion stuff?).
*/ */
static void static int
solib_map_sections (so) solib_map_sections (arg)
struct so_list *so; char *arg;
{ {
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename; char *filename;
char *scratch_pathname; char *scratch_pathname;
int scratch_chan; int scratch_chan;
@ -447,6 +448,8 @@ solib_map_sections (so)
/* Free the file names, close the file now. */ /* Free the file names, close the file now. */
do_cleanups (old_chain); do_cleanups (old_chain);
return (1);
} }
/* /*
@ -731,7 +734,9 @@ xfer_link_map_member (so_list_ptr, lm)
#endif #endif
} }
solib_map_sections (so_list_ptr); catch_errors (solib_map_sections, (char *) so_list_ptr,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
} }
@ -810,7 +815,7 @@ symbol_add_stub (arg)
if (so -> textsection) if (so -> textsection)
text_addr = so -> textsection -> addr; text_addr = so -> textsection -> addr;
else else if (so -> abfd != NULL)
{ {
asection *lowest_sect; asection *lowest_sect;

View File

@ -1,5 +1,5 @@
/* Handle OSF/1 shared libraries for GDB, the GNU Debugger. /* Handle OSF/1 shared libraries for GDB, the GNU Debugger.
Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Copyright 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -193,8 +193,8 @@ next_link_map_member PARAMS ((struct so_list *));
static void static void
xfer_link_map_member PARAMS ((struct so_list *, struct link_map *)); xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
static void static int
solib_map_sections PARAMS ((struct so_list *)); solib_map_sections PARAMS ((char *));
/* /*
@ -204,7 +204,7 @@ LOCAL FUNCTION
SYNOPSIS SYNOPSIS
static void solib_map_sections (struct so_list *so) static int solib_map_sections (struct so_list *so)
DESCRIPTION DESCRIPTION
@ -223,10 +223,11 @@ FIXMES
expansion stuff?). expansion stuff?).
*/ */
static void static int
solib_map_sections (so) solib_map_sections (arg)
struct so_list *so; char *arg;
{ {
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename; char *filename;
char *scratch_pathname; char *scratch_pathname;
int scratch_chan; int scratch_chan;
@ -288,6 +289,8 @@ solib_map_sections (so)
/* Free the file names, close the file now. */ /* Free the file names, close the file now. */
do_cleanups (old_chain); do_cleanups (old_chain);
return (1);
} }
/* /*
@ -485,7 +488,9 @@ xfer_link_map_member (so_list_ptr, lm)
} }
#endif #endif
solib_map_sections (so_list_ptr); catch_errors (solib_map_sections, (char *) so_list_ptr,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
} }
} }
@ -570,7 +575,7 @@ symbol_add_stub (arg)
if (so -> textsection) if (so -> textsection)
text_addr = so -> textsection -> addr; text_addr = so -> textsection -> addr;
else else if (so -> abfd != NULL)
{ {
asection *lowest_sect; asection *lowest_sect;

View File

@ -186,8 +186,8 @@ first_link_map_member PARAMS ((void));
static CORE_ADDR static CORE_ADDR
locate_base PARAMS ((void)); locate_base PARAMS ((void));
static void static int
solib_map_sections PARAMS ((struct so_list *)); solib_map_sections PARAMS ((char *));
#ifdef SVR4_SHARED_LIBS #ifdef SVR4_SHARED_LIBS
@ -224,7 +224,7 @@ LOCAL FUNCTION
SYNOPSIS SYNOPSIS
static void solib_map_sections (struct so_list *so) static int solib_map_sections (struct so_list *so)
DESCRIPTION DESCRIPTION
@ -243,10 +243,11 @@ FIXMES
expansion stuff?). expansion stuff?).
*/ */
static void static int
solib_map_sections (so) solib_map_sections (arg)
struct so_list *so; char *arg;
{ {
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename; char *filename;
char *scratch_pathname; char *scratch_pathname;
int scratch_chan; int scratch_chan;
@ -343,6 +344,8 @@ solib_map_sections (so)
/* Free the file names, close the file now. */ /* Free the file names, close the file now. */
do_cleanups (old_chain); do_cleanups (old_chain);
return (1);
} }
#ifndef SVR4_SHARED_LIBS #ifndef SVR4_SHARED_LIBS
@ -986,12 +989,17 @@ find_solib (so_list_ptr)
target_read_string ((CORE_ADDR) LM_NAME (new), &buffer, target_read_string ((CORE_ADDR) LM_NAME (new), &buffer,
MAX_PATH_SIZE - 1, &errcode); MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0) if (errcode != 0)
error ("find_solib: Can't read pathname for load map: %s\n", {
safe_strerror (errcode)); warning ("find_solib: Can't read pathname for load map: %s\n",
safe_strerror (errcode));
return (so_list_next);
}
strncpy (new -> so_name, buffer, MAX_PATH_SIZE - 1); strncpy (new -> so_name, buffer, MAX_PATH_SIZE - 1);
new -> so_name[MAX_PATH_SIZE - 1] = '\0'; new -> so_name[MAX_PATH_SIZE - 1] = '\0';
free (buffer); free (buffer);
solib_map_sections (new); catch_errors (solib_map_sections, (char *) new,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
} }
} }
return (so_list_next); return (so_list_next);
@ -1008,7 +1016,7 @@ symbol_add_stub (arg)
if (so -> textsection) if (so -> textsection)
text_addr = so -> textsection -> addr; text_addr = so -> textsection -> addr;
else else if (so -> abfd != NULL)
{ {
asection *lowest_sect; asection *lowest_sect;