Link to home
Start Free TrialLog in
Avatar of Dooglave
Dooglave

asked on

gdb script not working with -k and -wcore and -x options in new version of gdb, Is there an alternate meathod to count the number of file descriptors in use?

This works in IPSO 4.2:
#!/bin/sh

FILE=/tmp/patch.$$
cat << _EOF > $FILE
x/1d (&nfiles)
quit
_EOF
NUMFD=`gdb -k -wcore -batch -x $FILE /image/current/kernel /dev/mem \ | grep nfiles | awk ' { print $3 } '`

echo "There are $NUMFD file descriptors in use"
rm $FILE

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
In IPSO 6.2 I get:
# ./numdescriptors.sh
gdb: unrecognized option `-k'
Use `gdb --help' for a complete list of options.
There are  file descriptors in use


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Options for IPSO 6.2:
# gdb --help
This is the GNU debugger.  Usage:

    gdb [options] [executable-file [core-file or process-id]]
    gdb [options] --args executable-file [inferior-arguments ...]


  --args             Arguments after executable-file are passed to inferior
  --[no]async        Enable (disable) asynchronous version of CLI
  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  --batch            Exit after processing options.
  --cd=DIR           Change current directory to DIR.
  --command=FILE     Execute GDB commands from FILE.
  --core=COREFILE    Analyze the core dump COREFILE.
  --pid=PID          Attach to running process PID.
  --dbx              DBX compatibility mode.
  --directory=DIR    Search for source files in DIR.
  --epoch            Output information used by epoch emacs-GDB interface.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --fullname         Output information used by emacs-GDB interface.
  --help             Print this message.
  --interpreter=INTERP
                     Select a specific interpreter / user interface
  --mapped           Use mapped symbol files if supported on this system.
  --nw               Do not use a window interface.
  --nx               Do not read .gdbinit file.
  --quiet            Do not print version number on startup.
  --readnow          Fully read symbol files on first access.
  --se=FILE          Use FILE as symbol file and executable file.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  --tui              Use a terminal user interface.
  --version          Print version information and then exit.
  -w                 Use a window interface.
  --write            Set writing into executable and core files.
  --xdb              XDB compatibility mode.

For more information, type "help" from within GDB, or consult the
GDB manual (available as on-line info or a printed manual).
Report bugs to "bug-gdb@gnu.org".

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Options for IPSO 4.1:
# gdb --help
GDB 4.16 (i386-unknown-freebsd), Copyright 1996 Free Software Foundation, Inc.
This is the GNU debugger.  Usage:
    gdb [options] [executable-file [core-file or process-id]]
Options:
  --help             Print this message.
  --quiet            Do not print version number on startup.
  --fullname         Output information used by emacs-GDB interface.
  --epoch            Output information used by epoch emacs-GDB interface.
  --batch            Exit after processing options.
  --nx               Do not read .gdbinit file.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  --cd=DIR           Change current directory to DIR.
  --directory=DIR    Search for source files in DIR.
  --command=FILE     Execute GDB commands from FILE.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --se=FILE          Use FILE as symbol file and executable file.
  --core=COREFILE    Analyze the core dump COREFILE.
  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  --mapped           Use mapped symbol files if supported on this system.
  --readnow          Fully read symbol files on first access.
  --nw               Do not use a window interface.
  --kernel           Enable kernel debugging.
  --wcore            Make core file writable (only works for /dev/mem).
                     This option only works while debugging a kernel !!

For more information, type "help" from within GDB, or consult the
GDB manual (available as on-line info or a printed manual).
ASKER CERTIFIED SOLUTION
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial