GDB 6.5 RTEMS patch

Joel Sherrill joel.sherrill@oarcorp.com
Mon Aug 14 15:43:00 GMT 2006


Daniel Jacobowitz wrote:
> On Thu, Jul 13, 2006 at 03:41:19PM -0500, Joel Sherrill wrote:
>   
>> diff -uNr /home/joel/tools-original/gdb-6.5/bfd/sysdep.h gdb-6.5/bfd/sysdep.h
>> --- /home/joel/tools-original/gdb-6.5/bfd/sysdep.h	2005-05-05 13:51:14.000000000 -0500
>> +++ gdb-6.5/bfd/sysdep.h	2006-07-13 10:00:00.000000000 -0500
>> @@ -135,7 +135,7 @@
>>  #endif
>>  
>>  #if !HAVE_DECL_STRSTR
>> -extern char *strstr ();
>> +/* extern char *strstr (); */
>>  #endif
>>  
>>  #ifdef HAVE_FTELLO
>>     
>
> What's this for?  Shouldn't be necessary, of course.
>   

I just ran into a configuration tripping the need for this again. I am 
in a chroot'ed
RH73 environment building RPMs. gcc is from the RPM gcc-2.96-113. Apparently
strstr is a macro on this configuration. When compiling the interp.c 
file from some
of the simulators, you get this error.

../../../gdb-6.5/bfd/sysdep.h:138:22: macro "strstr" requires 2 
arguments, but only 1 given

I think this is the macro is in /usr/include/bits/string2.h causing this:

/* Find the first occurrence of NEEDLE in HAYSTACK. Newer gcc versions
do this itself. */
#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97)
# define strstr(haystack, needle) \
(__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p 
(needle) \
? (((__const char *) (needle))[0] == '\0' \
? (char *) (size_t) (haystack) \
: (((__const char *) (needle))[1] == '\0' \
? strchr (haystack, \
((__const char *) (needle))[0]) \
: strstr (haystack, needle))) \
: strstr (haystack, needle)))
#endif

Any thoughts now that I have finally reproduced the odd case that made 
me want to comment
that originally. :)

Thanks.

--joel



More information about the Gdb-patches mailing list