]> granicus.if.org Git - postgresql/blob - src/tools/find_typedef
2a56dcd4882bc6f624f7fc54f23094c40879ba70
[postgresql] / src / tools / find_typedef
1 #!/bin/sh
2
3 # $PostgreSQL: pgsql/src/tools/find_typedef,v 1.6 2006/03/11 04:38:41 momjian Exp $
4
5 # This script attempts to find all typedef's in the postgres binaries
6 # by using 'nm' to report all typedef debugging symbols.
7
8 # For this program to work, you must have compiled all binaries with 
9 # debugging symbols.
10 #
11 # This is run on BSD/OS 4.0, so you may need to make changes.
12
13 # Ignore the nm errors about a file not being a binary file.
14 #
15 # Remember, debugging symbols are your friends.
16 #
17
18 if [ "$#" -eq 0 -o ! -d "$1" ]
19 then    echo "Usage:  $0 postgres_binary_directory [...]" 1>&2
20         exit 1
21 fi
22
23 for DIR
24 do
25         objdump --stabs "$DIR"/* |
26         grep "LSYM" |
27         awk '{print $7}' |
28         grep ':t' |
29         sed 's/^\([^:]*\).*$/\1/' |
30         grep -v ' ' # some typedefs have spaces, remove them
31 done |
32 sort |
33 uniq |
34 # these are used both for typedefs and variable names
35 # so do not include them
36 egrep -v '^(date|interval|timestamp|ANY)$' |
37 sed 's/\(.*\)/-T\1 \\/'