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

* Re: Default value for SOLIB_LOADED_LIBRARY_PATHNAME
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-07-07 14:17 UTC (permalink / raw)
  To: fnf; +Cc: gdb-patches

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


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

* Re: Default value for SOLIB_LOADED_LIBRARY_PATHNAME
  2003-07-07 14:17 ` Daniel Jacobowitz
@ 2003-07-08 20:30   ` Kevin Buettner
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Buettner @ 2003-07-08 20:30 UTC (permalink / raw)
  To: Daniel Jacobowitz, fnf; +Cc: gdb-patches

On Jul 7, 10:17am, Daniel Jacobowitz wrote:

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

I agree.

Fred, please commit this change.

Thanks,

Kevin


^ 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