- fixing problem of destroying windows -> segfault
[pygdb.git] / pygdb.py
1 #!/usr/bin/python
2 #shuber, 2008-06-08
3
4 __author__ = "shuber"
5
6 import gtk
7 import os
8 import string
9 import sys
10
11 import GdbTerminal
12 import MainControlWindow
13 import StatusWindow
14
15
16 def launchDebugger(clientCmd, quitonclose=True):
17
18
19
20 def hideWindows():
21 #Kill the debugger
22 dbgterm.stopDbg()
23
24 mainCtrlWnd.destroy()
25 statusWnd.destroy()
26 gtk.main_quit()
27
28
29
30 #Determine the closing callback func
31 if quitonclose:
32 destroycb = gtk.main_quit
33 else:
34 destroycb = hideWindows
35
36 #Create Terminal
37 dbgterm = GdbTerminal.GdbTerminal(clientCmd, destroycb)
38
39 #Create windows
40 mainCtrlWnd = MainControlWindow.MainControlWindow(dbgterm, destroycb)
41 statusWnd = StatusWindow.StatusWindow(mainCtrlWnd, dbgterm, destroycb)
42 dbgterm.initialize()
43
44 return dbgterm, mainCtrlWnd, statusWnd
45
46
47
48 if __name__ == "__main__":
49
50 #Check if enough arguments are given
51 if len(sys.argv) <= 1:
52 print "Please give executeable to debug."
53 sys.exit(-1)
54
55 #Create the terminals
56 clientCmd = string.join(sys.argv[1:])
57 launchDebugger(clientCmd)
58 gtk.main()
59
60