On 02/18/2017 11:38 PM, ISHIKAWA,chiaki wrote: > BTW, DOES ANYONE HAVE A GOOD IDEA ABOUT HOW TO CAPTURE the mapped file, etc > WHEN SIGSEGV happens? It is very dynamic and by the time I am ready to type > in shell commands, the child binary that experienced it may be gone. Yes, I > have not been able to figure out exactly which process under the test > suite setup started by thunderbird (under valgrind) is experiencing a > difficulty. > I guess some clever hacking via gdb gets me started there? > BTW, valgrind's --gdb-* options are meant to debug the target under valgrind, > NOT the segfault of valgrind itself, correct? > [And the whole thing including valgrind works under kernel 3.19.5 and not > under later kernel drives me crasy.]
This gdb command will stop execution and print a message when SIGSEGV happens: (gdb) handle SIGSEGV stop print When the SIGSEGV happens then you will have to focus keyboard input to that process. (The above 'handle' command is the default anyway, so if the automation for your test harness snatches control, then you still might not get a chance for manual input.) There is no way to ask of gdb, "Please run these commands upon SIGSEGV." You can write a script for the entire input to gdb: gdb -batch -x script -e executable (beware: it is very brittle) but gdb cannot switch its input stream (such as back and forth between the script and the terminal) while it is running. "gdb -batch -x script -e executable" might be your best option, but it will take some patience. There is no way for the script to check that gdb is waiting for input after SIGSEGV, so you just have to assume that the SIGSEGV is going to happen after your 'run' command in the input. Yes, valgrind's --gdb-* options are for debugging the target under valgrind, and are NOT for debugging valgrind itself. If you run "strace -f -o strace.out -e trace=execve valgrind --trace-children=yes ..." then the output in strace.out will tell you which process receives the SIGSEGV. The "-e trace=execve" is a filter which restricts tracing to execve only; otherwise the output will be very long because it contains every system call for every process. -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users