mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Add Linux support to find_typedefs, with help from Alvaro.
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.8 2007/12/21 21:02:41 momjian Exp $
 | 
					# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.9 2008/03/18 22:45:11 momjian Exp $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This script attempts to find all typedef's in the postgres binaries
 | 
					# This script attempts to find all typedef's in the postgres binaries
 | 
				
			||||||
# by using 'nm' to report all typedef debugging symbols.
 | 
					# by using 'nm' to report all typedef debugging symbols.
 | 
				
			||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
# For this program to work, you must have compiled all binaries with 
 | 
					# For this program to work, you must have compiled all binaries with 
 | 
				
			||||||
# debugging symbols.
 | 
					# debugging symbols.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# This is run on BSD/OS 4.0, so you may need to make changes.
 | 
					# This is run on BSD/OS 4.0 or Linux, so you may need to make changes.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Ignore the nm errors about a file not being a binary file.
 | 
					# Ignore the nm errors about a file not being a binary file.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -37,10 +37,18 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
for DIR
 | 
					for DIR
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
 | 
						if [ `objdump -W 2>&1 | wc -l` -eq 1 ]
 | 
				
			||||||
 | 
						then	# Linux
 | 
				
			||||||
 | 
							# unfortunately the Linux version doesn't show unreferenced typedefs
 | 
				
			||||||
 | 
							objdump -W "$DIR"/* |
 | 
				
			||||||
 | 
							egrep -A3 '(DW_TAG_typedef|DW_TAG_structure_type|DW_TAG_union_type)' |
 | 
				
			||||||
 | 
							awk ' $2 == "DW_AT_name" {print $NF}'
 | 
				
			||||||
 | 
						else	# BSD/OS
 | 
				
			||||||
		objdump --stabs "$DIR"/* |
 | 
							objdump --stabs "$DIR"/* |
 | 
				
			||||||
	awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}' |
 | 
							awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}'
 | 
				
			||||||
	grep -v ' ' # some typedefs have spaces, remove them
 | 
						fi
 | 
				
			||||||
done |
 | 
					done |
 | 
				
			||||||
 | 
					grep -v ' ' | # some typedefs have spaces, remove them
 | 
				
			||||||
sort |
 | 
					sort |
 | 
				
			||||||
uniq |
 | 
					uniq |
 | 
				
			||||||
# these are used both for typedefs and variable names
 | 
					# these are used both for typedefs and variable names
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user