sublimegdb.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:SublimeRemoteGDB 作者: summerwinter 项目源码 文件源码
def update_cursor():
    global gdb_cursor
    global gdb_cursor_position
    global gdb_stack_index
    global gdb_stack_frame

    if not get_setting("update_while_running", True) and gdb_run_status == "running":
        return

    res = run_cmd("-stack-info-frame", True)
    if get_result(res) == "error":
        if gdb_run_status != "running":
            print("run_status is %s, but got error: %s" % (gdb_run_status, res))
            return
    currFrame = parse_result_line(res)["frame"]
    gdb_stack_index = int(currFrame["level"])

    if "fullname" in currFrame:
        gdb_cursor = gdb_source_path.translate_remote_path(currFrame["fullname"])
        gdb_cursor_position = int(currFrame["line"])
        sublime.active_window().focus_group(get_setting("file_group", 0))
        sublime.active_window().open_file("%s:%d" % (gdb_cursor, gdb_cursor_position), sublime.ENCODED_POSITION)
        global gdb_global_command_input_focused
        if gdb_global_command_input_focused == True:
            sublime.active_window().focus_view(gdb_input_view)
            gdb_global_command_input_focused = False
    else:
        gdb_cursor_position = 0

    sameFrame = gdb_stack_frame is not None and \
                gdb_stack_frame["func"] == currFrame["func"]
    if sameFrame and "shlibname" in currFrame and "shlibname" in gdb_stack_frame:
        sameFrame = currFrame["shlibname"] == gdb_stack_frame["shlibname"]
    if sameFrame and "fullname" in currFrame and "fullname" in gdb_stack_frame:
        sameFrame = currFrame["fullname"] == gdb_stack_frame["fullname"]

    gdb_stack_frame = currFrame
    # Always need to update the callstack since it's possible to
    # end up in the current function from many different call stacks
    gdb_callstack_view.update_callstack()
    gdb_threads_view.update_threads()

    update_view_markers()
    gdb_variables_view.update_variables(sameFrame)
    gdb_register_view.update_values()
    gdb_disassembly_view.update_disassembly()

    global gdb_first_callstack
    if gdb_first_callstack == False and gdb_settings.get("debug_mode") in ["attach", "coredump"]:
        gdb_first_callstack = True
        gdb_breakpoint_view.sync_breakpoints()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号