debugging - Is there a way to stop Valgrind on the first error it finds? -


if errors found in valgrind's output, want generate output using debug version of program. however, valgrinding thousands of runs in debug way time-intensive.

so run in release mode, , if error found abort run , complete testing in debug.

short of monitoring output , killing process manually, there better solution?

you can use --db-attach=yes , --db-command= execute specific command want stop valgrind execution. normal debug process, --db-command invokes gdb child process. cannot stop execution killing process using --db-command=kill -9 %p, because kills child process, not valgrind itself.

if using linux , has /proc file system support, can parent process number in 4th column in /proc/pid/stat. such have chance kill parent process stop valgrind.

for example,

valgrind --db-attach=yes --db-command="cat /proc/%p/stat | cut -d' ' -f4 | xargs kill -9" ./a.out

when first error appears, asked

---- attach debugger ? --- [return/n/n/y/y/c/c] ----

and when press y, try invoke debug command. in case, parent process id, valgrind, , send kill signal process. therefore, valgrind shall stopped.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -