當前位置: 首頁>>代碼示例>>Python>>正文


Python gdb.selected_frame方法代碼示例

本文整理匯總了Python中gdb.selected_frame方法的典型用法代碼示例。如果您正苦於以下問題:Python gdb.selected_frame方法的具體用法?Python gdb.selected_frame怎麽用?Python gdb.selected_frame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gdb的用法示例。


在下文中一共展示了gdb.selected_frame方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_contents

# 需要導入模塊: import gdb [as 別名]
# 或者: from gdb import selected_frame [as 別名]
def get_contents(self):
        str = ''

        str += Strongdb.border_header('Backtrace')

        frame = gdb.selected_frame()
        while frame != None:
            str += '\t%s -> %s()\n' % (Strongdb.colorize(hex(frame.pc())[:-1], Colors.address_color),
                                       frame.name() if frame.name() != None else '??')

            older_frm = frame.older()
            if older_frm == None:
                str += Strongdb.colorize('\t' + gdb.frame_stop_reason_string(frame.unwind_stop_reason()),
                                         Colors.address_color)

            frame = older_frm

        str += Strongdb.border_footer()
        return str 
開發者ID:cx9527,項目名稱:strongdb,代碼行數:21,代碼來源:strongdb.py

示例2: stop

# 需要導入模塊: import gdb [as 別名]
# 或者: from gdb import selected_frame [as 別名]
def stop(self):
    rdi = gdb.selected_frame().read_register('rdi') #XXX
    return False
    if rdi == 0 or rdi == ZERO_SIZE_PTR or rdi == 0x40000000: #XXX
      return False

    cache = rdi.cast(gdb.lookup_type('struct kmem_cache').pointer()).dereference()
    cache = cache['name'].string()

    name, pid = get_task_info()

    if apply_filter(name, cache):
      trace_info = 'kfree is freeing an object from cache ' + cache  + ' on behalf of process "' + name + '", pid ' + str(pid)
      salt_print(trace_info)
      history.append(('kfree', cache, name, pid))
    return False 
開發者ID:PaoloMonti42,項目名稱:salt,代碼行數:18,代碼來源:salt.py

示例3: get_selected_frame

# 需要導入模塊: import gdb [as 別名]
# 或者: from gdb import selected_frame [as 別名]
def get_selected_frame(cls):
        _gdbframe = gdb.selected_frame()
        if _gdbframe:
            return Frame(_gdbframe)
        return None 
開發者ID:google,項目名稱:pyringe,代碼行數:7,代碼來源:libpython.py

示例4: invoke

# 需要導入模塊: import gdb [as 別名]
# 或者: from gdb import selected_frame [as 別名]
def invoke(self, arg, from_tty):
        print ("\n********************************************************************************")
        print ("Displaying blocking threads using 'blocked' command")
        threads = {}
        for process in gdb.inferiors():
            for thread in process.threads():
                trd = Thread()
                trd.threadId = thread.ptid[1] #[1] - threadId; [0] - process pid
                #print ("Thread: {0}".format(threads[-1].threadId))
                thread.switch()
                frame = gdb.selected_frame()
                while frame:
                    frame.select()
                    #print("   {0}".format(frame.name()))
                    if "pthread_mutex_lock" in frame.name():
                        trd.waitOnThread = int(gdb.execute("print mutex.__data.__owner", to_string=True).split()[2])
                        #print(threads[-1].waitOnThread)
                    trd.frames.append(frame.name())
                    frame = frame.older()
                threads[trd.threadId] = trd

        for (tid,thread) in threads.items():
            if thread.waitOnThread:
                deadlockedText = "" if not threads[thread.waitOnThread].waitOnThread == thread.threadId else "AND DEADLOCKED"
                print ("Thread: {0} waits for thread: {1} {2}".format(thread.threadId, thread.waitOnThread, deadlockedText))
        print ("********************************************************************************") 
開發者ID:DamZiobro,項目名稱:gdb-automatic-deadlock-detector,代碼行數:28,代碼來源:gdbDisplayLockedThreads.py


注:本文中的gdb.selected_frame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。