[gnu.gdb.bug] gdb-3.0/munch

grunwald@M.CS.UIUC.EDU (Dirk Grunwald) (12/23/88)

And, actually, you have to change munch to make it work under UMAX.
I've appended a new copy at the end of this mail.

Here's a diff that's needed for core.c to compile under UMAX.

*** /tmp/,RCSt1004108	Thu Dec 22 13:56:28 1988
--- core.c	Thu Dec 22 13:55:54 1988
***************
*** 34,40 ****
--- 34,44 ----
  #include <sys/file.h>
  #include <sys/stat.h>
  
+ #ifdef UMAX_CORE
+ #include <sys/ptrace.h>
+ #else /* not UMAX_CORE */
  #include <sys/user.h>
+ #endif
  
  /* Recognize COFF format systems because a.out.h defines AOUTHDR.  */
  #ifdef AOUTHDR


...and here's the new munch

#! /bin/sh

# create an initialization procedure from a list of .o files

cookie=">>>use usg format"
nookie=">>>use umax format"

# see if param.h defines "USG"
cat param.h > /tmp/munch$$.c
cat >> /tmp/munch$$.c <<!
#ifdef USG
$cookie
#endif
#ifdef UMAX_CORE
$nookie
#endif
!
if (cc -E -I. /tmp/munch$$.c | grep "^$cookie" > /dev/null)
then
	TYPE=USG
else
    if (cc -E -I. /tmp/munch$$.c | grep "^$nookie" > /dev/null)
    then
	TYPE=UMAX
    else
	TYPE=BSD
    fi
fi
rm -f /tmp/munch$$.c


echo '/* Do not modify this file.  It is created automatically by "munch". */'
echo 'void initialize_all_files () {'

case $TYPE in
	BSD)
		nm $* | \
		grep 'T __initialize_' | \
		sed -e 's/^.*T _\(.*\)/    \1 ();/'
		;;
	USG)
		# for usg use nm -p, grep for _initialize, 
		# don't delete leading '_'
		nm -p $* | \
		grep 'T _initialize_' | \
		sed -e 's/^.*T \(.*\)/    \1 ();/'
		;;
#
#	Some people just have to be different.
#
	UMAX)
		# for usg use nm -p, grep for _initialize, 
		# don't delete leading '_'
		nm -p $* | \
		grep 'T __initialize_' | \
		sed -e 's/^.*T _\(.*\)/    \1 ();/'
		;;
	*)
		echo unknown object file type $TYPE
		;;
esac

echo '}'