예제 #1
0
    def __init__(self, hex_file, board):

        debugger.Debugger(sys)

        if board.bldr == "noboot":

            # TODO : interface here something like PICpgm (http://www.members.aon.at/electronics/pic/picpgm/)
            #self.logwindow("You choose a board without bootloader.\nYou should either change your board type\nor use a programmer to upload your application on your board", 1)
            raise Exception(
                "You choose a board without bootloader.\nYou should either change your board type\nor use a programmer to upload your application on your board"
            )

        elif board.bldr == "boot2":
            from uploaderVSC import uploaderVSC as Uploader

        #elif board.bldr == 'boot3':
        #    self.uploader = self.uploaderDLN(*parameters)

        elif board.bldr == "boot4":
            from uploader8 import uploader8 as Uploader

        elif board.bldr == "microchip":
            from uploader32 import uploader32 as Uploader

        self.uploader = Uploader(hex_file, board)
예제 #2
0
def _GetCurrentDebugger():
    global currentDebugger
    if currentDebugger is None:
        _CheckNeedGUI()
        import debugger
        currentDebugger = debugger.Debugger()
    return currentDebugger
예제 #3
0
def main():
    p = process_model.Process(None)
    dbg = debugger.Debugger(debuglog=io.open(sys.argv[1],
                                             encoding='utf8').readlines(),
                            proc=p)
    dbg.parse()
    thread_analyzer.cleanup(p, httpd.httpd_cleanups)
    thread_analyzer.annotate(p, httpd.httpd_annotations)
    p.group()
    io.open(sys.argv[2], 'w',
            encoding='utf8').write(text_type(json.dumps(p.description())))
예제 #4
0
def lala():
    db = debugger.Debugger()
    print db
    hilo = threading.Thread(target=lolo, args=(db, ))
    hilo.start()
    print "lanzo"
    while hilo.isAlive():
        #time.sleep(5)
        c = raw_input("Comando: \n")
        db.command_if(c)
        hilo.join(.3)
예제 #5
0
    def __init__(self, mouse, keyboard):
        self.mouse = mouse
        self.keyboard = keyboard

        self.debugger = debugger.Debugger()

        self.columns = 2
        self.rows = 5

        self.difficulty = 0
        self._generate_level(self.difficulty)
        self._generate_ui()
예제 #6
0
    def __init__(self, parser=None):
        self.parser = parser
        self.debug = False
        self.debugger = debugger.Debugger()
        self.repl_count = 0
        self.root_scope = self.scope = Scope()
        self.modules = {"boot": self.root_scope}
        self.sources = {"boot": ""}
        self.scope["__module__"] = "boot"
        self.scope["__func__"] = None
        self.scope["__func_name__"] = "__main__"
        self.scope["__parent__"] = None
        self.scope["None"] = None
        self.scope["_slice"] = slice
        self.scope["_iter"] = iter
        self.scope["inf"] = float('inf')
        self.scope["int"] = int
        self.scope["cpy_str"] = str
        self.scope["list_append"] = list.append

        for varname in [
                "Exception", "True", "False", "IndexError", "StopIteration",
                "AssertionError", "bool", "xrange", "type", "zip", "reversed"
        ]:
            self.scope[varname] = getattr(__builtin__, varname)

        for varname in [
                "Instance", "Name", "Node", "Thunk", "Scope", "self.lookup",
                "_print", "bpoint", "no_op", "self.evaluate",
                "self.eval_error", "get_name", "__binary__", "__unary__",
                "self.modules", "self.sources", "self.ast", "tag_file",
                "self.assignment", "c_array"
        ]:
            if "." in varname:
                name = varname.split(".")[-1]
                self.scope[name] = getattr(self, name)
            else:
                self.scope[varname] = globals()[varname]

        self.functions = {
            "NUMBER": constant,
            "STRING": constant,
            "thaw": constant,
            "EMPTY_LINE": no_op,
            "comment": no_op,
            "pass_stmt": no_op,
            "__getattr__": self.getattrib,
        }
예제 #7
0
def before_each(steps, breakpoints=[11]):
    global d, debugq, outputq, breakpointQ
    d = debugger.Debugger(breakpoints)
    debugq = multiprocessing.Queue()
    outputq = multiprocessing.Queue()
    breakpointQ = multiprocessing.Queue()
    for step in steps: 
        debugq.put(step)

    debugprocess = multiprocessing.Process(target=d.debug, args=(breakpointQ, outputq, debugq, sample))
    debugprocess.start()
    print("Running test")
    while (not debugq.empty()) and outputq.qsize() != (len(steps) + 1):
        pass
    time.sleep(0.5)
    debugprocess.terminate()
    print('')
예제 #8
0
파일: main.py 프로젝트: agent001/HCL
def main():
    arguments = sys.argv
    if len(arguments) != 2:
        info.print_usage()
    else:
        filename = sys.argv[-1]
        if not os.path.isfile(filename):
            info.print_file_not_found(filename)
        else:
            vm = hardware.HCLVirtualMachine()
            syntax_tree = process_file(filename)
            vm.process_syntax_tree(syntax_tree)

            if DEBUGGING:

                db = debugger.Debugger(vm, MEMORY_SIZE)
                db.run()
예제 #9
0
    def __init__(self,  plugin_callback,  data_range=[-1000,  0]):
        self.data_range=data_range
        parser =  argparse.ArgumentParser("[plugin_options]")

        parser.add_argument("--p_debug_elf", dest="p_debug_elf",  help="ELF file for debug information", default="")
        (opts, args) = parser.parse_known_args()
        
        self.active_plugins=[]#[distance_kalman_filter()]
        self.active_plugins=[google_earth_server.Google_Earth_Server(data_range = self.data_range),  \
                                        gps_tool.gps_tool(),  \
                                        gps_tool.Named_Value_Scaler(),  \
                                        raw_stream_exporter.Raw_Stream_Exporter(),\
                                        #robotvis.robotvis()\
                                        ]
        if opts.p_debug_elf!="":
            self.active_plugins.append(debugger.Debugger(elf_filename= opts.p_debug_elf))
        
        self.plugin_callback=plugin_callback
예제 #10
0
    def __init__(self, left, top, width, height, textures, idx, grid):
        pygame.Rect.__init__(self, left, top, width, height)
        self.hidden_tex = textures[0]
        self.revealed_tex = textures[1]
        self.mine_tex = textures[2]
        self.mine_red_tex = textures[3]
        self.mine_green_tex = textures[4]
        self.flag_tex = textures[5]
        self.number_tex = None
        self.idx = idx
        self.grid = grid
        self.is_revealed = False
        self.is_mine = False
        self.flagged = False
        self.number = -1
        self.held = False
        self.highlight = 0

        self.exploded_mine = (-1, -1)

        self.debug = debugger.Debugger("debug.log")
예제 #11
0
def setup():
    global debugprocess
    request_json = flask.request.get_json()
    if request_json == None:
        return (
            "Please set the content-type to application/json and send data in json format",
            400)

    arrayOfBreakpoints = request_json.get('breakpoints')

    if type(arrayOfBreakpoints) != type([]):
        return ("", 400)
    for i in arrayOfBreakpoints:
        if type(i) != int:
            return ("", 400)

    debuggerObj = debugger.Debugger(arrayOfBreakpoints)
    debugprocess = multiprocessing.Process(target=debuggerObj.debug,
                                           args=(breakpointQ, outputq, debugq,
                                                 template.coderunners_exec))
    debugprocess.start()
    output = outputq.get()
    return (flask.jsonify(output), 200)
예제 #12
0
            results = self.core.processor.completer(str, state)
            return results[state]
        else:
            return [None]
    pass

# Demo it
if __name__=='__main__':
    def foo():
        y = 2
        for i in range(2):
            print("%d %d" % (i, y) )
            pass
        return 3
    import debugger
    d = debugger.Debugger()
    d.settings['trace'] = True
    d.settings['printset'] = tracer.ALL_EVENTS
    d.core.step_ignore = -1
    print('Issuing: run_eval("1+2")')
    print(d.run_eval('1+2'))
    print('Issuing: run_exec("x=1; y=2")')
    d.run_exec('x=1; y=2')

    print('Issuing: run("3*4")')
    print(d.run('3*4'))
    print('Issuing: run("x=3; y=4")')
    d.run('x=3; y=4')

    print('Issuing: run_call(foo)')
    d.run_call(foo)
예제 #13
0
    def __init__(self, splash_write, argvs):
        super(PinguinoIDE, self).__init__()

        debugger.Debugger(sys)

        root = logging.getLogger()
        root.setLevel(logging.DEBUG)

        ch = logging.StreamHandler(debugger.sys_redirect("stdout", False))
        ch.setLevel(logging.DEBUG)
        formatter = logging.Formatter("%(message)s")
        ch.setFormatter(formatter)
        root.addHandler(ch)

        # print(self.get_systeminfo())

        QtCore.QTextCodec.setCodecForCStrings(QtCore.QTextCodec.codecForName("UTF-8"))
        QtCore.QTextCodec.setCodecForLocale(QtCore.QTextCodec.codecForName("UTF-8"))
        QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec.codecForName("UTF-8"))

        self.main = Ui_PinguinoIDE()
        self.main.setupUi(self)

        self.argvs = argvs

        if not self.argvs.devmode:
            self.main.menubar.removeAction(self.main.menuDevelopment.menuAction())

        #set_environ_vars()
        #self.check_user_files()
        splash_write(QtGui.QApplication.translate("Splash", "Setting enviroment values"))
        PinguinoConfig.set_environ_vars()
        splash_write(QtGui.QApplication.translate("Splash", "Checking user files"))
        PinguinoConfig.check_user_files()

        splash_write(QtGui.QApplication.translate("Splash", "Loading Pinguino API"))
        self.pinguinoAPI = Pinguino()
        self.pinguinoAPI._boards_ = AllBoards

        splash_write(QtGui.QApplication.translate("Splash", "Loading configuration"))
        self.configIDE = Config()

        splash_write(QtGui.QApplication.translate("Splash", "Loading graphical mode"))
        self.PinguinoKIT = GraphicalIDE(self)
        self.main.tabWidget_graphical.setVisible(False)
        self.main.dockWidget_blocks.setVisible(False)

        splash_write(QtGui.QApplication.translate("Splash", "Loading icons"))
        self.ICONS = CompleteIcons()

        splash_write(QtGui.QApplication.translate("Splash", "Setting theme"))
        self.build_menutoolbar()
        self.set_icon_theme()
        self.reload_toolbar_icons()

        #self.update_pinguino_paths()
        #self.update_user_libs()
        splash_write(QtGui.QApplication.translate("Splash", "Linking paths for libraries and compilers"))
        PinguinoConfig.update_pinguino_paths(self.configIDE, self.pinguinoAPI)
        PinguinoConfig.update_pinguino_extra_options(self.configIDE, self.pinguinoAPI)
        splash_write(QtGui.QApplication.translate("Splash", "Searching user libraries"))
        PinguinoConfig.update_user_libs(self.pinguinoAPI)

        # RB 2015-01-27 : Still useful ? See also methods.py/set_board
        self.pinguinoAPI.set_os_variables()

        self.setWindowTitle(os.getenv("PINGUINO_NAME")+" "+os.getenv("PINGUINO_VERSION"))

        splash_write(QtGui.QApplication.translate("Splash", "Opening last files"))
        self.open_last_files()

        splash_write(QtGui.QApplication.translate("Splash", "Starting widgets features"))
        self.init_widgets()
        splash_write(QtGui.QApplication.translate("Splash", "Building status bar"))
        self.build_statusbar()
        splash_write(QtGui.QApplication.translate("Splash", "Building Python Shell"))
        self.build_output()

        splash_write(QtGui.QApplication.translate("Splash", "Overwriting stylesheets"))
        self.set_styleSheet()

        #timer events
        splash_write(QtGui.QApplication.translate("Splash", "Starting timers"))
        self.update_functions()
        self.update_directives()
        self.update_variables()
        self.update_autocompleter()
        self.check_external_changes()
        self.save_backup_file()

        splash_write(QtGui.QApplication.translate("Splash", "Loading examples"))
        self.__update_path_files__(os.path.join(os.getenv("PINGUINO_USER_PATH"), "examples"))
        self.__update_graphical_path_files__(os.path.join(os.getenv("PINGUINO_USER_PATH"), "graphical_examples"))

        splash_write(QtGui.QApplication.translate("Splash", "Loading boards configuration"))
        #self.set_board() #called in self.get_status_board()
        self.statusbar_ide(self.get_status_board())

        splash_write(QtGui.QApplication.translate("Splash", "Connecting events"))
        self.connect_events()
        splash_write(QtGui.QApplication.translate("Splash", "Loading configuration"))
        self.load_main_config()

        os_name = os.getenv("PINGUINO_OS_NAME")
        if os_name == "windows":
            os.environ["PATH"] = os.environ["PATH"] + ";" + self.configIDE.get_path("sdcc_bin")

        elif os_name == "linux":
            os.environ["LD_LIBRARY_PATH"]="/usr/lib32:/usr/lib:/usr/lib64"

        splash_write(QtGui.QApplication.translate("Splash", "Welcome to %s %s")%(os.getenv("PINGUINO_NAME"), os.getenv("PINGUINO_VERSION")))
        print("Pinguino IDE started!")
예제 #14
0
        self.lock.acquire()
        del self.in_execution[node["name"]]
        self.lock.release()


if __name__ == "__main__":
    # Execute all graph paths passed as parameters.
    if len(sys.argv) < 2:
        print(
            "Usage: python graphex.py <file.graph.json> [debug] [cluster] [args]"
        )
    else:
        state = GraphExState()
        offset = 2
        if len(sys.argv) > offset and sys.argv[offset] == "debug":
            state.shared_dict["debugger"] = debugger.Debugger()
            offset += 1
        if len(sys.argv) > offset and sys.argv[offset] == "cluster":
            state.restricted_mode = True
            offset += 1
        if len(sys.argv) > offset:
            dbg = None
            if "debugger" in state.shared_dict:
                dbg = state.shared_dict["debugger"]
            state.shared_dict = json.loads(" ".join(sys.argv[offset:]))
            if dbg is not None:
                state.shared_dict["debugger"] = dbg
        state.shared_dict["kill"] = False
        gex = GraphEx(sys.argv[1], state)
        gex.executeThreaded()
        for hook in state.shutdown_hooks:
예제 #15
0
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-------------------------------------------------------------------------"""

################################################################################

import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os

import debugger
debugger.Debugger(sys, clear=True)

os.environ["NAME"] = NAME
os.environ["VERSION"] = VERSION
os.environ["SUBVERSION"] = SUBVERSION
os.environ["PINGUINO_HOME"] = os.path.abspath(sys.path[0])

# For PyInstaller compatibility
if os.path.exists(os.path.abspath("pinguino_data")):
    os.environ["PINGUINO_DATA"] = os.path.abspath("pinguino_data")
else:
    os.environ["PINGUINO_DATA"] = os.getenv("PINGUINO_HOME")

import argparse
from tkgui.pinguino_api.boards import boardlist
예제 #16
0
dir_K = os.path.join(dataroot, phase + 'K')  #keypoints
dir_3d = os.path.join(dataroot, phase + '_3d_full')

P1_name = 'fashionMENTees_Tanksid0000404701_1front.jpg'

P1_path = os.path.join(dir_P, P1_name)  # person 1
BP1_path = os.path.join(dir_K, P1_name + '.npy')  # bone of person 1

# person 1 & 2 3d pose(x,y,z)
P13d_path = os.path.join(dir_3d, P1_name.replace('.jpg', '.npy'))  # person 1

BP1_3d_dict = np.load(P13d_path, allow_pickle=True).item()
BP1_3d, bias1 = BP1_3d_dict['pred_3d'], BP1_3d_dict['bias']
BP1_3d = rescale3d(BP1_3d, bias1)

BP1_img = np.load(BP1_path)  # h, w, c
P1_img = Image.open(P1_path).convert('RGB')

debugger1 = debugger.Debugger()
debugger1.add_img(Image.open(P1_path))
# debugger1.add_img(Image.open(BP1_img))
# debugger1.add_point_2d(pred, (255, 0, 0))
debugger1.add_point_3d(BP1_3d, 'b')
debugger1.show_3d()

# BP1_3d = rescale3d(BP1_3d, bias1)

# BP1 = torch.from_numpy(BP1_img).float() #h, w, c
# BP1 = BP1.transpose(2, 0) #c,w,h
# BP1 = BP1.transpose(2, 1) #c,h,w
예제 #17
0
파일: hardware.py 프로젝트: agent001/HCL
def debugging():

    vm = HCLVirtualMachine()

    db = debugger.Debugger(vm, MEMORY_SIZE)
    db.run()
예제 #18
0
파일: main.py 프로젝트: xedbg/pyAVRdbg
import socket
import debugger
from pyedbglib.protocols import avr8protocol
import signal
import sys
import time
import select

HOST = '127.0.0.1'  # Standard loopback interface address (localhost)
PORT = 12555  # Port to listen on (non-privileged ports are > 1023)

lastPacket = ""

dbg = debugger.Debugger("atmega4809")
dbg.stop()
dbg.breakpointSWClearAll()
dbg.breakpointHWClear()
pollet_event = dbg.pollEvent()
while pollet_event != None:
    pollet_event = dbg.pollEvent()
#    dbg.run()

SIGTRAP = "S05"
last_SIGVAL = "S00"


def signal_handler(sig, frame):
    print('You pressed Ctrl+C!')
    dbg.cleanup()
    sys.exit(0)
예제 #19
0
    def __init__(self):
        pygame.init()

        self.my_path = "%s/.." % os.path.dirname(os.path.realpath(__file__))

        logo = pygame.image.load("%s/img/minesweeper_logo.png" % self.my_path)
        pygame.display.set_icon(logo)

        pygame.display.set_caption("Minesweeper")

        self.screen = pygame.display.set_mode((const.WIDTH, const.HEIGHT))

        self.background_tex = pygame.image.load("%s/img/background.png" %
                                                self.my_path)
        self.cell_textures = [
            pygame.image.load("%s/img/cell/cell_hidden.png" % self.my_path),
            pygame.image.load("%s/img/cell/cell_revealed.png" % self.my_path),
            pygame.image.load("%s/img/cell/mine.png" % self.my_path),
            pygame.image.load("%s/img/cell/mine_red.png" % self.my_path),
            pygame.image.load("%s/img/cell/mine_green.png" % self.my_path),
            pygame.image.load("%s/img/cell/flag.png" % self.my_path)
        ]
        self.number_tex_list = [
            pygame.image.load("%s/img/numbers/num_1.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_2.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_3.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_4.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_5.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_6.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_7.png" % self.my_path),
            pygame.image.load("%s/img/numbers/num_8.png" % self.my_path)
        ]
        self.restart_button_list = [
            pygame.image.load(
                "%s/img/restart_button/restart_button_green.png" %
                self.my_path),
            pygame.image.load(
                "%s/img/restart_button/restart_button_yellow.png" %
                self.my_path),
            pygame.image.load("%s/img/restart_button/restart_button_red.png" %
                              self.my_path),
            pygame.image.load(
                "%s/img/restart_button/restart_button_green_clicked.png" %
                self.my_path),
            pygame.image.load(
                "%s/img/restart_button/restart_button_yellow_clicked.png" %
                self.my_path),
            pygame.image.load(
                "%s/img/restart_button/restart_button_red_clicked.png" %
                self.my_path)
        ]
        self.restart_button_rect = pygame.Rect(const.RESTART_BUTTON_COORD,
                                               const.RESTART_BUTTON_SIZE)

        # Highscore button
        self.highscore_button_tex = pygame.image.load("%s/img/highscore.png" %
                                                      self.my_path)
        self.highscore_button_clicked_tex = pygame.image.load(
            "%s/img/highscore_clicked.png" % self.my_path)
        self.highscore_cur_tex = self.highscore_button_tex
        self.highscore_button_rect = pygame.Rect(const.HIGHSCORE_BUTTON_COORD,
                                                 const.HIGHSCORE_BUTTON_SIZE)
        # Highscore panel
        self.highscore_panel_tex = pygame.image.load(
            "%s/img/highscore_menu.png" % self.my_path)
        self.highscore_panel_rect = pygame.Rect(const.HIGHSCORE_PANEL_COORD,
                                                const.HIGHSCORE_PANEL_SIZE)
        self.showing_highscores = False
        self.highscore_list = []
        # Change name button
        self.change_name_button_tex = pygame.image.load(
            "%s/img/change_name_button.png" % self.my_path)
        self.change_name_button_clicked_tex = pygame.image.load(
            "%s/img/change_name_button_clicked.png" % self.my_path)
        self.change_name_button_changing_tex = pygame.image.load(
            "%s/img/change_name_button_changing.png" % self.my_path)
        self.change_name_cur_tex = self.change_name_button_tex
        self.change_name_button_rect = pygame.Rect(const.CHANGE_NAME_COORD,
                                                   const.CHANGE_NAME_SIZE)
        self.changing_name = False

        self.ui_font = pygame.font.SysFont("monospace", 50, True)
        self.highscore_font = pygame.font.SysFont("monospace", 30, True)
        self.name_font = pygame.font.SysFont("monospace", 25, True)

        self.player_name = const.PLAYER_NAME

        ##################
        # This part should match restart_game()
        self.grid = grid_o.Grid(self.cell_textures, self.number_tex_list)
        self.is_alive = True
        self.mines_placed = False
        self.mines_flagged = 0
        self.empty_flagged = 0
        self.restart_button_state = 0
        self.time_elapsed = 0
        self.last_frame_time = pygame.time.get_ticks()
        ##################

        # For input
        self.left_mouse_held = False
        self.last_left_click = 0
        self.right_mouse_held = False
        self.last_cell_held = None
        self.last_clicked_celll = [
            self.grid.get_clicked_cell((100, 100)) for i in range(9)
        ]
        self.lr_mouse_held = False
        self.i = 1
        self.debug = debugger.Debugger("debug.log")
예제 #20
0
def doit():
    db = debugger.Debugger()
    db.debug("1.py")
    db.command("s")