#! /bin/sh
PROG=/usr/sbin/smbd
GDBSCRIPT=/tmp/.$(basename $0).$$
cat > $GDBSCRIPT <<GDB
handle SIGUSR1 nostop
handle SIGTERM nostop
break malloc_printf
break malloc_error_break
break main
break count_all_current_connections
break open_sockets_smbd
define errno
print *(int*)__error()
end
document errno
Print the value of the global variable "errno".
end
define getegid
print (gid_t)getegid()
end
define geteuid
print (uid_t)geteuid()
end
document geteuid
Print the result of geteuid()
end
document getegid
Print the result of getegid()
end
GDB
trap "rm -f $GDBSCRIPT" 0 1 2 3 15
gdb -x $GDBSCRIPT --waitfor `basename $PROG` $PROG