コード例 #1
0
ファイル: m_nexti.py プロジェクト: he426100/maple_engine
    def mni_func(self, args, from_tty):
        s = args.split()
        if len(s) > 1: # msi into next Maple instruction
            self.usage()
            return
        if len(s) == 0:
            mni_common()
        elif len(s) == 1 and s[0].isdigit():
            for i in range(int(s[0])):
                if m_inf.is_inferior_running(): mni_common()
                else:
                    break
        else:
            self.usage()
            return

        if m_inf.is_inferior_running():
            mni_display_last_opcodes()
            m_util.gdb_exec('display')

        return
コード例 #2
0
ファイル: m_nexti.py プロジェクト: he426100/maple_engine
def mni_common():
    #start_level_num = get_current_stack_level()
    prev_frame = m_frame.get_newest_frame()
    m_util.gdb_exec('msi -internal')
    new_frame = m_frame.get_newest_frame()
    #end_level_num   = get_current_stack_level()

    if not new_frame:
        return

    if new_frame != prev_frame and prev_frame.is_valid():
        #assert start_level_num < end_level_num
        m_stepi.silent_finish()
        m_util.gdb_exec('msi -internal')
    #else:
    #    assert start_level_num >= end_level_num

    # a trigger point to update m_datastore caches
    if m_inf.is_inferior_running():
        m_datastore.mgdb_rdata.update_gdb_runtime_data()
        m_datastore.mgdb_rdata.update_frame_change_counter()
コード例 #3
0
ファイル: m_event.py プロジェクト: he426100/maple_engine
def event_breakpoint_created_handler(bp):
    """event handler to handle breakpoint creation
       if a native breakpoint is created in Maple shared library program space,
       delete this breakpoint or disable it
    """
    if isinstance(bp, m_stepi.MapleFinishBreakpoint):
        return

    if bp.location == "maple::maple_invoke_method" or bp.location == "__inc_opcode_cnt" \
       or bp.location == "maple::InvokeInterpretMethod" or bp.location == "__inc_opcode_cnt_dyn":
        return

    if not m_inf.is_inferior_running():
        return

    try:
        result_value = gdb.parse_and_eval(bp.location)
    except:
        # breakpoint symbol not found in program space, so it is not a valid breakpoint
        return

    so_name = gdb.solib_name(int(result_value.address))
    if not so_name:  # this happens to be at very beginning before all the shared libraries are loaded
        return

    so_name = os.path.realpath(so_name)
    asm_name_1 = so_name[:-3] + '.s'
    asm_name_2 = so_name[:-3] + '.VtableImpl.s'

    asm_list = m_info.get_loaded_lib_asm_path()
    if asm_name_1 in asm_list or asm_name_2 in asm_list:
        bploc = '%s%s%s' % (MColors.BP_ADDR, bp.location, MColors.ENDC)
        # this means this breakpoint's address is in Maple Engine loaded shared library
        gdb_print("Warning: It is not allowed to set a gdb breakpoint at %s in Maple shared library %s%s%s" % \
            (bploc, MColors.BT_SRC, so_name.split('/')[-1], MColors.ENDC))
        bp.delete()
        gdb_print(
            "This gdb breakpoint at %s was deleted. Please set a Maple breakpoint with a 'mbreak' command"
            % bploc)