1997-09-08 06:14:01 +02:00
|
|
|
#!/bin/sh
|
2006-03-11 05:38:42 +01:00
|
|
|
|
|
|
|
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.6 2006/03/11 04:38:41 momjian Exp $
|
|
|
|
|
1997-09-08 06:14:01 +02:00
|
|
|
# This script attempts to find all typedef's in the postgres binaries
|
|
|
|
# by using 'nm' to report all typedef debugging symbols.
|
|
|
|
#
|
|
|
|
# For this program to work, you must have compiled all binaries with
|
|
|
|
# debugging symbols.
|
|
|
|
#
|
1999-02-10 18:14:32 +01:00
|
|
|
# This is run on BSD/OS 4.0, so you may need to make changes.
|
1997-09-08 06:14:01 +02:00
|
|
|
#
|
|
|
|
# Ignore the nm errors about a file not being a binary file.
|
|
|
|
#
|
|
|
|
# Remember, debugging symbols are your friends.
|
|
|
|
#
|
|
|
|
|
2005-11-15 01:43:01 +01:00
|
|
|
if [ "$#" -eq 0 -o ! -d "$1" ]
|
|
|
|
then echo "Usage: $0 postgres_binary_directory [...]" 1>&2
|
1997-09-08 06:14:01 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-11-15 01:43:01 +01:00
|
|
|
for DIR
|
|
|
|
do
|
|
|
|
objdump --stabs "$DIR"/* |
|
|
|
|
grep "LSYM" |
|
|
|
|
awk '{print $7}' |
|
|
|
|
grep ':t' |
|
|
|
|
sed 's/^\([^:]*\).*$/\1/' |
|
|
|
|
grep -v ' ' # some typedefs have spaces, remove them
|
|
|
|
done |
|
1999-02-10 18:14:32 +01:00
|
|
|
sort |
|
2005-11-15 01:43:01 +01:00
|
|
|
uniq |
|
2005-11-15 15:45:10 +01:00
|
|
|
# these are used both for typedefs and variable names
|
|
|
|
# so do not include them
|
|
|
|
egrep -v '^(date|interval|timestamp|ANY)$' |
|
2005-11-15 01:43:01 +01:00
|
|
|
sed 's/\(.*\)/-T\1 \\/'
|