This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Default value for SOLIB_LOADED_LIBRARY_PATHNAME


On Thu, Jul 03, 2003 at 11:15:12AM -0700, Fred Fish wrote:
> 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

[With a changelog entry] this is OK.  All this code desperately needs
to die, but that's not your problem.

> 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.
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]