This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
PATCH: Workaround IRIX 5 compilation problem
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 26 Apr 2004 22:43:25 +0200 (MEST)
- Subject: PATCH: Workaround IRIX 5 compilation problem
GDB 6.1 fails to compile on mips-sgi-irix5.3 with the following error:
gcc -c -O2 -I. -I/vol/gnu/src/gdb/gdb-dist/gdb -I/vol/gnu/src/gdb/gdb-dist/gdb/config -DLOCALEDIR="\"/vol/gnu/share/locale\"" -DHAVE_CONFIG_H -I/vol/gnu/src/gdb/gdb-dist/gdb/../include/opcode -I/vol/gnu/src/gdb/gdb-dist/gdb/../readline/.. -I../bfd -I/vol/gnu/src/gdb/gdb-dist/gdb/../bfd -I/vol/gnu/src/gdb/gdb-dist/gdb/../include -I../intl -I/vol/gnu/src/gdb/gdb-dist/gdb/../intl -DMI_OUT=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral -Wunused-label /vol/gnu/src/gdb/gdb-dist/gdb/proc-api.c
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `create_procinfo':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:689: warning: implicit declaration of function `memset'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `dead_procinfo':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:828: warning: format not a string literal and no format arguments
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `proc_get_pending_signals':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:2037: warning: implicit declaration of function `memcpy'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `procfs_create_inferior':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:4940: warning: implicit declaration of function `strchr'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:4975: warning: implicit declaration of function `strlen'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:4983: warning: implicit declaration of function `strncpy'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:4985: warning: implicit declaration of function `strcat'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `mappingflags':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:5494: warning: implicit declaration of function `strcpy'
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `info_mappings_callback':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:5539: warning: format not a string literal, argument types not checked
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `info_proc_mappings':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:5569: warning: format not a string literal, argument types not checked
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `info_proc_cmd':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:5613: warning: implicit declaration of function `strncmp'
In file included from /usr/include/sys/proc.h:138,
from /vol/gnu/src/gdb/gdb-dist/gdb/proc-api.c:42:
/usr/include/sys/region.h:75: error: parse error before "anon_hdl"
/usr/include/sys/region.h:77: error: parse error before '}' token
/usr/include/sys/region.h:342: error: parse error before "sysreg"
/usr/include/sys/region.h:348: error: parse error before '*' token
/usr/include/sys/region.h:351: error: parse error before '*' token
/usr/include/sys/region.h:354: error: parse error before '*' token
/usr/include/sys/region.h:373: error: parse error before '*' token
/usr/include/sys/region.h:437: error: parse error before "reg_t"
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c: In function `create_procinfo':
/vol/gnu/src/gdb/gdb-dist/gdb/procfs.c:677: warning: 'parent' might be used uninitialized in this function
make[1]: *** [proc-api.o] Error 1
This happens because the definition of of anon_hdl in <sys/types.h> is
protected with _KERNEL || _STANDALONE || _KMEMUSER.
Compiling with -D_KMEMUSER works, but unfortunately adding that definition
to gdb/config/mips/nm-irix5.h does not: <sys/types.h> is included before
defs.h, so the definition needs to go either into config.h or directly into
proc-api.c. I think the former approach is cleaner, so this patch
implements it.
Ok for 6.1 branch and mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Fri Apr 23 22:48:23 2004 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure.in (mips-sgi-irix5*): Define _KMEMUSER for
<sys/proc.h>.
* configure: Regenerate.
* config.in: Likewise.
===================================================================
RCS file: gdb/RCS/configure.in,v
retrieving revision 1.1
diff -up -r1.1 gdb/configure.in
--- gdb/configure.in 2004/02/26 00:41:46 1.1
+++ gdb/configure.in 2004/04/23 20:48:02
@@ -606,6 +606,7 @@ AC_MSG_RESULT($gdb_cv_hpux_sswide)
# If we are configured native on GNU/Linux, work around problems with
# sys/procfs.h
# Also detect which type of /proc is in use, such as for Unixware or Solaris.
+# Work around a <sys/proc.h> problem on IRIX 5.
if test "${target}" = "${host}"; then
case "${host}" in
@@ -622,6 +623,10 @@ if test "${target}" = "${host}"; then
*-*-solaris2.[[6789]])
AC_DEFINE(NEW_PROC_API)
;;
+ mips-sgi-irix5*)
+ AC_DEFINE(_KMEMUSER, 1,
+ [[Define to 1 so <sys/proc.h> gets a definition of anon_hdl. ]])
+ ;;
esac
fi