[PATCH] crasher in solib-legacy.c

Michael Snyder msnyder@cygnus.com
Mon Jan 7 11:44:00 GMT 2002


If you attach to a PID without specifying a symbol/exec file, 
this code will be executed with exec_bfd == NULL.

2002-01-07  Michael Snyder  <msnyder@redhat.com>

	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): 
	Don't use exec_bfd if it's NULL.

Index: solib-legacy.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-legacy.c,v
retrieving revision 1.3
diff -p -r1.3 solib-legacy.c
*** solib-legacy.c	2001/03/20 02:57:42	1.3
--- solib-legacy.c	2002/01/07 19:41:42
*************** legacy_svr4_fetch_link_map_offsets (void
*** 130,136 ****
  #endif /* defined (HAVE_STRUCT_LINK_MAP32) */
  
  #if defined (HAVE_STRUCT_LINK_MAP32)
!   if (bfd_get_arch_size (exec_bfd) == 32)
      return lmp32;
    else
  #endif
--- 130,141 ----
  #endif /* defined (HAVE_STRUCT_LINK_MAP32) */
  
  #if defined (HAVE_STRUCT_LINK_MAP32)
!   if (exec_bfd != NULL)
!     {
!       if (bfd_get_arch_size (exec_bfd) == 32)
! 	return lmp32;
!     }
!   else if (TARGET_PTR_BIT == 32)
      return lmp32;
    else
  #endif



More information about the Gdb-patches mailing list