From 4e86efb4e51b66ef57b3fe6f28576de23a1bf1c6 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 11 Jun 2009 03:14:08 +0000
Subject: [PATCH] Add FreeBSD support for find_typedef, per request from
 Andrew.

---
 src/tools/find_typedef | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/tools/find_typedef b/src/tools/find_typedef
index 5ce2d1f23b1..0474245ba69 100755
--- a/src/tools/find_typedef
+++ b/src/tools/find_typedef
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.13 2009/06/10 15:13:45 momjian Exp $
+# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.14 2009/06/11 03:14:08 momjian Exp $
 
 # This script attempts to find all typedef's in the postgres binaries
 # by using 'nm' to report all typedef debugging symbols.
@@ -47,6 +47,11 @@ do	# if objdump -W is recognized, only one line of error should appear
 		objdump -W "$DIR"/* |
 		egrep -A3 'DW_TAG_typedef' |
 		awk ' $2 == "DW_AT_name" {print $NF}'
+	elif [ `readelf -w 2>&1 | wc -l` -gt 1 ]
+	then	# FreeBSD, similar output to Linux
+		readelf -w "$DIR"/* |
+		egrep -A3 '\(DW_TAG_typedef\)' |
+		awk ' $1 == "DW_AT_name" {print $NF}'
 	else	# BSD/OS
 		objdump --stabs "$DIR"/* |
 		awk ' $2 == "LSYM" && $7 ~ /:t/ {sub(":.*", "", $7); print $7}'
-- 
GitLab