Showing posts with label gdb. Show all posts
Showing posts with label gdb. Show all posts

Monday, July 18, 2011

PM sig_segv

 $ gdb
 (gdb) file /vob/signalware/Master/pm/pm  |
 Reading symbols from /vob/signalware/Master/pm/pm...done.
 (gdb) attach 26427
 Attaching to program `/vob/signalware/Master/pm/pm', process 26427
 Reading symbols from /usr/lib/sparcv9/omni/libdgms.so...done.
 Loaded symbols for /usr/lib/sparcv9/omni/libdgms.so
 ...  
 sol-thread active.
 Retry #1:
 Retry #2:
 Retry #3:
 Retry #4:
 [New LWP    1        ]
 [New Thread 1 (LWP 1)]
 Symbols already loaded for /usr/lib/sparcv9/omni/libdgms.so
 ...
 [Switching to Thread 1 (LWP 1)]
 0xffffffff7d7a677c in _poll () from /usr/lib/64/libc.so.1
 (gdb) handle SIGSEGV stop print
 Signal        Stop      Print   Pass to program Description
 SIGSEGV       Yes       Yes     Yes             Segmentation fault
 (gdb) cont
 Continuing.
 Program received signal SIGSEGV, Segmentation fault.
 0xffffffff7d73d28c in strlen () from /usr/lib/64/libc.so.1
 (gdb) bt
 #0  0xffffffff7d73d28c in strlen () from /usr/lib/64/libc.so.1
 #1  0xffffffff7d790308 in _doprnt () from /usr/lib/64/libc.so.1
 #2  0xffffffff7d792538 in vsprintf () from /usr/lib/64/libc.so.1
 #3  0xffffffff7e71b624 in FtFormatInternationalMsg (catd=0x10075fa50, set_number=45, message_number=109, 
     defaultString=0xffffffff7c321a0f "M  DENY\n  %s\n  %s\n", 
     destMsgBuf=0x100186380 "M  DENY\n  +------+\n| INFO |  Acquiring lock on addDelNode.lock.6981\n+------+\n/export/home/omni/bin/DFcat addDelNode.lock.6981 2>&1\n/export/home/omni/bin/DFconvert /tmp/addDelNode.lock.6981\n\n+------+\n|"..., sizeDestMsgBuf=4096)
     at ../lib_util.c:1740
 #4  0x0000000100010a14 in DoCreateNode (pcmd=0x100624a10) at pm.c:5333
 #5  0x0000000100034980 in yyparse () at parse.y:1026
 #6  0x000000010003acf4 in parseMML () at nlex.l:1024
 #7  0x0000000100037620 in process_mml_cmd () at parse.y:2399
 #8  0x000000010000a760 in main (argc=7672264, argv=0x100624e18) at pm.c:1555
 (gdb) quit

Ignore SIGUSR2 signals

This command will prevent your program from stopping whenever it receives a SIGUSR2 but will print it anyway.

(gdb) handle SIGUSR2 nostop noprint

This is useful in JGUI Server to prevent gdb from being stopped by SIG_CPT.

Ignore SIGALRM in single-stepping


To ignore SIGALRM signals while single-stepping, but treat them normally during normal execution, you could define:

define hook-stop
handle SIGALRM nopass
end
define hook-run
handle SIGALRM pass
end
define hook-continue
handle SIGLARM pass
end

NB: recorded in ~gallinar/.gdbinit, which is read automatically by gdb if gallinar or which can be sourced (within gdb) if root.

Installing gdb

On-line doc

Excerpt:

 CC="gcc -m64" ./configure --prefix=/u/engineering/locals/solaris10/softs/proglang/gdb-6.6
 make
 make install

Compilation errors:

rm -f gdb
gcc -g -O2       \
        -o gdb gdb.o libgdb.a \
           ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a ./../intl/libintl.a ../libiberty/libiberty.a      -ldl -lncurses -lsocket -lnsl -lm      ../libiberty/libiberty.a  
Undefined                       first referenced
 symbol                             in file
initscr32                           libgdb.a(tui.o)
w32addch                            libgdb.a(tui-io.o)
w32attron                           libgdb.a(tui-wingeneral.o)
w32attroff                          libgdb.a(tui-wingeneral.o)
acs32map                            libgdb.a(tui-win.o)
ld: fatal: Symbol referencing errors. No output written to gdb

To solve it:

cd /usr/ccs/lib
ln -s /usr/ccs/lib/libcurses.so libncurses.so