Example #1
0
def do_debug():
    """Run inside winpdb if the environment variable BLOGOFILE_DEBUG is set to
    anything other than 0"""
    try:
        if os.environ['BLOGOFILE_DEBUG'] != "0":
            print("Running in debug mode. Enter a password for Winpdb to use.")
            import rpdb2; rpdb2.start_embedded_debugger_interactive_password()
    except KeyError:
        pass #Not running in debug mode
Example #2
0
  Thread ID and thread name are visible in WinPdb thread list.
  Got feedback from WinPdb owner saying the hacks are safe for the time being

Issues:
  Does not work for standalone GreenScript, only for embedded.
"""


import rpdb2
import gs


print "Creating an Endpoint for a WinPdb Remote Debugger"
print "You will now be prompted for a password, then the simulation"
print "will stall 5 mins or until a debugger command is received"
rpdb2.start_embedded_debugger_interactive_password(fAllowRemote=True)

## "go" from here to reach user code, after setting breakpoints ##
sc_elab_threads = set()


class sc_callback_wind:
    """
    Wrapper to set a breakpoint with the Winpdb debugger, for end-of-elab, etc
    called from the elaboration thread of SystemC
    """

    def __init__(self, runnable, prompt):
        self.runnable = runnable
        if hasattr(runnable, "func_name"):
            self.func_name = runnable.func_name
Example #3
0
	def main():
		r = 1
		try:
			import time, gc
			t = time.time()
			gc_enabled = gc.isenabled()
			if gc_enabled:
				try: gc.disable()
				except NotImplementedError: pass # jython uses gc of the jvm
			try:
				options = parse_args(sys.argv[1:])
				option_collector = OptionCollector()
	
				import logger
				logger.use_options(options)
				option_collector.option_decls.add(logger)

				import subprocess_wrapper
				subprocess_wrapper.use_options(options)
				option_collector.option_decls.add(subprocess_wrapper)

				option_collector.known_options.add('debug')
				if 'help' in options: option_collector.help['debug'] = ('[passwd]', 'use the python rpdb2/winpdb debugger', 'prompt for password if none given')
				debug = options.get('debug', None)
				if debug is not None:
					import rpdb2
					if len(debug) != 0: rpdb2.start_embedded_debugger(debug)
					else:
						print 'wonderbuild: please chose a password for the python rpdb2 debugger:'
						rpdb2.start_embedded_debugger_interactive_password()

				option_collector.known_options.add('profile')
				if False: # do not show this option
					if 'help' in options: option_collector.help['profile'] = ('<file>', 'profile execution and put results in <file> (implies --jobs=1)')
				profile = options.get('profile', None)
				if profile is None: r = run(options, option_collector)
				else:
					import cProfile
					cProfile.run(
'''
from wonderbuild.main import run
from wonderbuild.options import parse_args, OptionCollector
options = parse_args(sys.argv[1:])
option_collector = OptionCollector()
option_collector.known_options.add('profile')
# cProfile is only able to profile one thread
options['jobs'] = 1 # overrides possible previous jobs options
run(options, option_collector)
''',
						profile
					)
					import pstats
					s = pstats.Stats(profile)
					#s.sort_stats('time').print_stats(45)
					s.sort_stats('cumulative').reverse_order().print_stats()
					r = 0
			finally:
				t = time.time() - t
				print >> sys.stderr, colored('2', 'wonderbuild: build time: ' + str(t) + 's')
				if gc_enabled: gc.enable()
		except UserReadableException, e:
			print >> sys.stderr, colored('31;1', 'wonderbuild: failed: ') + colored('31', str(e))
			r = 1
Example #4
0
#!/usr/bin/env python

import pdbparse
import sys

debug = False
if debug:
	import rpdb2; rpdb2.start_embedded_debugger_interactive_password()

pdb = pdbparse.PDB7(open(sys.argv[1], 'rb'))
print len(pdb.streams[2].data)
Example #5
0
Status:
  Working.  "import winpdb_gs" will change gs debugger to be WinPdb not Pdb
  Thread ID and thread name are visible in WinPdb thread list.
  Got feedback from WinPdb owner saying the hacks are safe for the time being

Issues:
  Does not work for standalone GreenScript, only for embedded.
"""

import rpdb2
import gs

print "Creating an Endpoint for a WinPdb Remote Debugger"
print "You will now be prompted for a password, then the simulation"
print "will stall 5 mins or until a debugger command is received"
rpdb2.start_embedded_debugger_interactive_password(fAllowRemote=True)

## "go" from here to reach user code, after setting breakpoints ##
sc_elab_threads = set()


class sc_callback_wind:
    """
    Wrapper to set a breakpoint with the Winpdb debugger, for end-of-elab, etc
    called from the elaboration thread of SystemC
    """
    def __init__(self, runnable, prompt):
        self.runnable = runnable
        if hasattr(runnable, "func_name"):
            self.func_name = runnable.func_name
        global sc_elab_threads