~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/tools/find_typedef

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.11 2008/03/18 23:23:08 momjian Exp $
 
3
# $PostgreSQL: pgsql/src/tools/find_typedef,v 1.16 2009/06/12 03:09:07 momjian Exp $
4
4
 
5
5
# This script attempts to find all typedef's in the postgres binaries
6
6
# by using 'nm' to report all typedef debugging symbols.
45
45
                # the typedef references, not the definitions, so I think it might
46
46
                # be fine
47
47
                objdump -W "$DIR"/* |
48
 
                egrep -A3 '(DW_TAG_typedef|DW_TAG_structure_type|DW_TAG_union_type)' |
 
48
                egrep -A3 '\(DW_TAG_typedef\)' |
49
49
                awk ' $2 == "DW_AT_name" {print $NF}'
 
50
        elif [ `readelf -w 2>&1 | wc -l` -gt 1 ]
 
51
        then    # FreeBSD, similar output to Linux
 
52
                readelf -w "$DIR"/* |
 
53
                egrep -A3 '\(DW_TAG_typedef\)' |
 
54
                awk ' $1 == "DW_AT_name" {print $NF}'
50
55
        else    # BSD/OS
 
56
                # BSD/OS reports all typedefs, even those defined in system
 
57
                # include files but never referenced in the PG code.
51
58
                objdump --stabs "$DIR"/* |
52
 
                awk ' $2 == "LSYM" && $7 ~ /:[tT]/ {sub(":.*", "", $7); print $7}'
 
59
                awk ' $2 == "LSYM" && $7 ~ /:t/ {sub(":.*", "", $7); print $7}'
53
60
        fi
54
61
done |
55
62
grep -v ' ' | # some typedefs have spaces, remove them