Update find_typedefs to handle simple 'typedef X' cases, per request
authorBruce Momjian <bruce@momjian.us>
Fri, 21 Dec 2007 21:02:41 +0000 (21:02 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 21 Dec 2007 21:02:41 +0000 (21:02 +0000)
from Tom.

src/tools/find_typedef

index f8f10a6f81962a22d87fed4005d3c4b272b94b67..63a8dd39df53accecc0ebe50ee06817281fe7b88 100755 (executable)
 # 
 # Ignore the nm errors about a file not being a binary file.
 #
-# Remember, debugging symbols are your friends.
+# It gets typedefs by reading "STABS":
 #
+#    http://www.informatik.uni-frankfurt.de/doc/texi/stabs_toc.html
+#
+#    objdump:
+#       -G, --stabs  Display (in raw form) any STABS info in the file
+#
+#       --stabs
+#         Display the contents of the .stab, .stab.index, and
+#         .stab.excl sections from an ELF file.  This is only
+#         useful on systems (such as Solaris  2.0)  in  which
+#         .stab debugging symbol-table entries are carried in
+#         an ELF section.  In most other file formats, debug-
+#         ging  symbol-table  entries  are  interleaved  with
+#         linkage symbols, and are visible in the --syms out-
+#         put.
+
 
 if [ "$#" -eq 0 -o ! -d "$1" ]
 then   echo "Usage:  $0 postgres_binary_directory [...]" 1>&2
@@ -23,10 +38,7 @@ fi
 for DIR
 do
        objdump --stabs "$DIR"/* |
-       grep "LSYM" |
-       awk '{print $7}' |
-       grep ':t' |
-       sed 's/^\([^:]*\).*$/\1/' |
+       awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}' |
        grep -v ' ' # some typedefs have spaces, remove them
 done |
 sort |