zz.sh 947 B

12345678910111213141516171819202122232425
  1. #!/bin/sh -x
  2. rm ./O1
  3. rm ./O2
  4. rm ./O3
  5. valgrind -v --tool=memcheck --leak-check=full --suppressions=valgrind-suppressions --suppressions=gtk.supp --suppressions=gtk64.supp --suppressions=glib.supp ./gml4gtk 1>O1 2>O2
  6. # the -A options shows the next 3 lines
  7. # in the backtrace where the calloc came from
  8. grep dp_calloc -A 3 O2 >O3
  9. grep dp_free -A 3 O2 >>O3
  10. # use after free
  11. grep use -A 3 O2 >>O3
  12. grep Invalid -A 3 O2 >>O3
  13. # run valgrind to check for memory leaks
  14. # -v -v options add more verbose output
  15. # --show-reachable=yes show reachable memory, but also shows it in the linked thread lib code
  16. # --tool=memcheck use the memcheck tool, there are other tools too
  17. # --leak-check=full show all info
  18. # --show-reachable=yes show reachable memory
  19. # --track-fds=yes show open file descriptors
  20. # --trace-children=yes trace forked children
  21. # --log-file=00valgrindlog.txt write to log file
  22. # gml4gtk uses monly calloc() and free() to check in the log file