aboutsummaryrefslogtreecommitdiff
path: root/src/tools/find_typedef
blob: 2a56dcd4882bc6f624f7fc54f23094c40879ba70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.6 2006/03/11 04:38:41 momjian Exp $

# 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.
#
# This is run on BSD/OS 4.0, so you may need to make changes.
# 
# Ignore the nm errors about a file not being a binary file.
#
# Remember, debugging symbols are your friends.
#

if [ "$#" -eq 0 -o ! -d "$1" ]
then	echo "Usage:  $0 postgres_binary_directory [...]" 1>&2
	exit 1
fi

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 |
sort |
uniq |
# these are used both for typedefs and variable names
# so do not include them
egrep -v '^(date|interval|timestamp|ANY)$' |
sed 's/\(.*\)/-T\1 \\/'