You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
683 B

  1. #!/usr/bin/python
  2. import sys
  3. import datetime
  4. import os
  5. home = os.path.expanduser("~")
  6. if len(sys.argv) < 2:
  7. print("""
  8. Run as:
  9. cin-debug-run <exec-name> <exec args>
  10. """)
  11. quit()
  12. pname = sys.argv[1]
  13. logfile = "%s/%s-%s.log" % (home, pname, datetime.datetime.now().strftime("%Y-%m-%d-%l:%M:%S"))
  14. runargs = ""
  15. if len(sys.argv) > 2:
  16. for i in range(2, len(sys.argv)):
  17. runargs += " %s" % sys.argv[i]
  18. gdb_script = \
  19. """
  20. set logging file %s
  21. set logging on
  22. set pagination off
  23. define hook-stop
  24. thread apply all bt
  25. quit
  26. end
  27. run %s
  28. """ % (logfile, runargs)
  29. print(gdb_script)
  30. os.system("echo '%s' | gdb %s" % (gdb_script, pname))
  31. quit()