force valgrind output on crash

This commit is contained in:
Timerix22 2023-05-19 23:42:12 +06:00
parent 9711d8fbb1
commit 5e23ef8156
2 changed files with 8 additions and 6 deletions

View File

@ -50,8 +50,7 @@ case "$TASK" in
# -fprofile-use enables compiler to use profiling info files to optimize executable # -fprofile-use enables compiler to use profiling info files to optimize executable
# -fprofile-prefix-path sets path where profiling info about objects are be saved # -fprofile-prefix-path sets path where profiling info about objects are be saved
# -fdata-sections -ffunction-sections -Wl,--gc-sections removes unused code # -fdata-sections -ffunction-sections -Wl,--gc-sections removes unused code
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects \ C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects -fdata-sections -ffunction-sections -Wl,--gc-sections"
-fdata-sections -ffunction-sections -Wl,--gc-sections"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="$CPP_ARGS" LINKER_ARGS="$CPP_ARGS"
PRE_TASK_SCRIPT= PRE_TASK_SCRIPT=
@ -107,7 +106,7 @@ case "$TASK" in
;; ;;
# executes $EXEC_FILE with valgrind memory checker # executes $EXEC_FILE with valgrind memory checker
valgrind) valgrind)
VALGRIND_ARGS="-s --log-file=valgrind.log --read-var-info=yes --track-origins=yes --fullpath-after=$PROJECT/ --leak-check=full --show-leak-kinds=all" VALGRIND_ARGS="-s --read-var-info=yes --track-origins=yes --fullpath-after=$PROJECT/ --leak-check=full --show-leak-kinds=all"
TASK_SCRIPT=cbuild/default_tasks/valgrind.sh TASK_SCRIPT=cbuild/default_tasks/valgrind.sh
;; ;;
# generates profiling info # generates profiling info

View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
cd "$OUTDIR" cd "$OUTDIR"
valgrind $VALGRIND_ARGS ./$EXEC_FILE rm -f "valgrind.log"
cat "valgrind.log" set +e
myprint "${GREEN}valgrind log saved to ${CYAN}$OUTDIR/exec.log" valgrind --log-file=valgrind.log $VALGRIND_ARGS ./$EXEC_FILE
set -e
[ -f "valgrind.log" ] && cat "valgrind.log" || error "valgrind exited with errors"
myprint "${GREEN}valgrind log saved to ${CYAN}$OUTDIR/valgrind.log"
cd .. cd ..