[Ltrace-devel] [PATCH] Fix SIGSEGV on MIPS big endian

Petr Machata pmachata at redhat.com
Mon Jan 28 17:49:06 UTC 2013


Oliver Spornitz <ospornit at rz-online.de> writes:

> This patch sets up the correct breakpoint opcode and endianness.
> After applying the patch, it is necessary to run autoreconf.

Thanks for hunting this down.  Is there a compiler-provided #define that
we could use instead of introducing our own?  (It's of course OK to
introduce one like you did if there is nothing that we can portably rely
on.)

It also seems like we could drop the "sysdeps/linux-gnu/mipsel" symlink
and just always use ".../mips".  The two cases would be differentiated
in arch.h like they are now.  If you are interested in preparing such a
patch, I'll be happy to accept it.

There are a couple style nits with your patch that I comment inline.

> --- a/configure.ac
> +++ b/configure.ac
> @@ -41,8 +41,12 @@ AC_SUBST(HOST_OS)
>  case "${host_cpu}" in
>      arm*|sa110)		HOST_CPU="arm" ;;
>      cris*)		HOST_CPU="cris" ;;
> -    mips*el)		HOST_CPU="mipsel" ;;
> -    mips*)		HOST_CPU="mips" ;;
> +    mips*el)		HOST_CPU="mipsel" 

Trailing whitespace.

> +			AC_DEFINE([HAVE_ENDIAN_LITTLE], [1], [we have a little endian machine])                        

And here.

> +			;;
> +    mips*)		HOST_CPU="mips"
> +			AC_DEFINE([HAVE_ENDIAN_BIG], [1], [we have a big endian machine])                                                 

And here as well.

> +			;;
>      powerpc|powerpc64)	HOST_CPU="ppc" ;;
>      sun4u|sparc64)	HOST_CPU="sparc" ;;
>      s390x)		HOST_CPU="s390" ;;

> -#define BREAKPOINT_VALUE { 0x0d, 0x00, 0x00, 0x00 }
> +#ifdef HAVE_ENDIAN_LITTLE
> +	#define BREAKPOINT_VALUE { 0x0d, 0x00, 0x00, 0x00 }
> +	#define ARCH_ENDIAN_LITTLE

These should be:
+# define XXX...

> +#elif defined (HAVE_ENDIAN_BIG)

No space after "defined".

Thanks,
PM



More information about the Ltrace-devel mailing list