From: <sv...@ww...> - 2007-11-04 09:22:42
|
Author: nsmoooose Date: 2007-11-04 01:22:30 -0700 (Sun, 04 Nov 2007) New Revision: 2190 Modified: trunk/csp/tools/layout/layout Log: Made it possible to start the theater layout tool with the --pause option. This makes it possible to attach the debugger during the startup procedure of the tool. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2190 Modified: trunk/csp/tools/layout/layout =================================================================== --- trunk/csp/tools/layout/layout 2007-10-27 22:52:21 UTC (rev 2189) +++ trunk/csp/tools/layout/layout 2007-11-04 08:22:30 UTC (rev 2190) @@ -38,6 +38,12 @@ def main(args): print "Combat Simulator Project Theater Layout Tool" print "============================================" + + options = app.options + + if options.pause: + pauseForDebugger() + view = cLayout.View() argv = [app.programName()] + list(args) if view.init(argv): @@ -48,6 +54,27 @@ ui.MainLoop() view.quit() +def pauseForDebugger(): + """ + Print a help message for attaching gdb to this process and wait for keyboard + input. Should be called after the cspsim module has been loaded if requested. + """ + print + print "All extension modules have been loaded and the simulation is now paused" + print "to give you an opportunity to attach a debugging session. Under GNU/Linux" + print "run the following command from a separate shell to attach a debug session:" + print + print " gdb python %d" % os.getpid() + print + print "This will run gdb and attach to the simulation process. Once gdb finishes" + print "loading symbols for all the modules, you can set breakpoints as needed" + print "and then enter 'c' to continue." + print + print "Finally, return to this window and press <enter> to resume." + print + sys.stdin.readline() + + # find the root of the CSP workspace base = csp.dir #os.path.dirname(os.path.dirname(app.__file__)) # default Data directory for CSPSim in the current workspace @@ -59,5 +86,6 @@ app.addOption('--xml', default=xml_path, type='string', help='path to theater data') app.addOption('--model', default=model_path, type='string', help='path to 3d models') +app.addOption('--pause', action='store_true', default=False, help='pause on startup for attaching a debugger') app.start() print 'end' |