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