File: cin-debug-run

package info (click to toggle)
cinnamon 6.4.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,300 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (44 lines) | stat: -rwxr-xr-x 683 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python

import sys
import datetime
import os

home = os.path.expanduser("~")

if len(sys.argv) < 2:
    print("""
    Run as:

        cin-debug-run <exec-name> <exec args>

    """)
    quit()

pname = sys.argv[1]
logfile = "%s/%s-%s.log" % (home, pname, datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S"))

runargs = ""

if len(sys.argv) > 2:
    for i in range(2, len(sys.argv)):
        runargs += " %s" % sys.argv[i]

gdb_script = \
    """
set logging file %s
set logging on
set pagination off

define hook-stop
    thread apply all bt
    quit
end

run %s
""" % (logfile, runargs)
print(gdb_script)
os.system("echo '%s' | gdb %s" % (gdb_script, pname))

quit()