1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/buildtools/scripts/abi_gen.sh
Alexander Bokovoy c63dcc97b6 gen_abi.sh: filter out symbols not needed for ABI
gdb does not allow to print definitions of certain section names
and special symbols used for dynamic loading machinery:

__bss_start
_edata
_init
_fini
_end

Please note the space before the pattern, it is needed to avoid
hungry matches of valid symbols with these as substrings (foo_init,
for example).

Without this patch gdb on Fedora 18 breaks when attempting to print
function and struct signature.
2012-09-07 12:31:42 +02:00

22 lines
491 B
Bash
Executable File

#!/bin/sh
# generate a set of ABI signatures from a shared library
SHAREDLIB="$1"
GDBSCRIPT="gdb_syms.$$"
(
cat <<EOF
set height 0
set width 0
EOF
nm "$SHAREDLIB" | cut -d' ' -f2- | egrep '^[BDGTRVWS]' | grep -v @ | egrep -v ' (__bss_start|_edata|_init|_fini|_end)' | cut -c3- | sort | while read s; do
echo "echo $s: "
echo p $s
done
) > $GDBSCRIPT
# forcing the terminal avoids a problem on Fedora12
TERM=none gdb -batch -x $GDBSCRIPT "$SHAREDLIB" < /dev/null
rm -f $GDBSCRIPT