Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Default value for SOLIB_LOADED_LIBRARY_PATHNAME
@ 2003-07-03 18:15 Fred Fish
  2003-07-07 14:17 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Fred Fish @ 2003-07-03 18:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: fnf

The default for SOLIB_LOADED_LIBRARY_PATHNAME should be something
other than zero.

From breakpoint.c:

  #if defined(SOLIB_HAVE_LOAD_EVENT)
	&& (!SOLIB_HAVE_LOAD_EVENT (PIDGET (inferior_ptid))
	    || ((b->dll_pathname != NULL)
		&& (strcmp (b->dll_pathname, 
			    SOLIB_LOADED_LIBRARY_PATHNAME (
			      PIDGET (inferior_ptid)))
		    != 0)))
  #endif

Note that the result of evaluating SOLIB_LOADED_LIBRARY_PATHNAME is
given as an argument to strcmp.  For compilers where strcmp is a
builtin, the compiler may notice that it is being passed a zero (NULL)
arg and complain.

It is better to use a default of an empty string, like is done earlier
in breakpoint.c:

  #ifndef SOLIB_LOADED_LIBRARY_PATHNAME
  #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) ""
  #endif


Index: coff-solib.h
===================================================================
RCS file: /cvs/src/src/gdb/coff-solib.h,v
retrieving revision 1.4
diff -c -p -r1.4 coff-solib.h
*** coff-solib.h	1 Nov 2001 16:17:08 -0000	1.4
--- coff-solib.h	3 Jul 2003 18:08:14 -0000
*************** extern void coff_solib_create_inferior_h
*** 109,115 ****
   */
  
  #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
! (0)
  
  /* This function returns TRUE if the dynamic linker has just reported
     an unload of a library.
--- 109,115 ----
   */
  
  #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
! ""
  
  /* This function returns TRUE if the dynamic linker has just reported
     an unload of a library.
Index: solib.h
===================================================================
RCS file: /cvs/src/src/gdb/solib.h,v
retrieving revision 1.9
diff -c -p -r1.9 solib.h
*** solib.h	7 May 2002 08:35:54 -0000	1.9
--- solib.h	3 Jul 2003 18:08:15 -0000
*************** extern void solib_create_inferior_hook (
*** 112,118 ****
   */
  
  #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
! (0)
  
  /* This function returns TRUE if the dynamic linker has just reported
     an unload of a library.
--- 112,118 ----
   */
  
  #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \
! ""
  
  /* This function returns TRUE if the dynamic linker has just reported
     an unload of a library.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-08 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03 18:15 Default value for SOLIB_LOADED_LIBRARY_PATHNAME Fred Fish
2003-07-07 14:17 ` Daniel Jacobowitz
2003-07-08 20:30   ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox