Python gdb.selected_frame() Examples
The following are 11
code examples of gdb.selected_frame().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gdb
, or try the search function
.
Example #1
Source File: salt.py From salt with GNU General Public License v3.0 | 7 votes |
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
Example #2
Source File: strongdb.py From strongdb with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: libpython.py From pyringe with Apache License 2.0 | 5 votes |
def get_selected_frame(cls): _gdbframe = gdb.selected_frame() if _gdbframe: return Frame(_gdbframe) return None
Example #4
Source File: python-gdb.py From copr-sundry with Apache License 2.0 | 5 votes |
def get_selected_frame(cls): _gdbframe = gdb.selected_frame() if _gdbframe: return Frame(_gdbframe) return None
Example #5
Source File: python-gdb.py From copr-sundry with Apache License 2.0 | 5 votes |
def get_selected_frame(cls): _gdbframe = gdb.selected_frame() if _gdbframe: return Frame(_gdbframe) return None
Example #6
Source File: gdbDisplayLockedThreads.py From gdb-automatic-deadlock-detector with MIT License | 5 votes |
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 ("********************************************************************************")
Example #7
Source File: salt.py From salt with GNU General Public License v3.0 | 5 votes |
def stop(self): kfreeFinishBP(internal=True) #x = gdb.selected_frame().read_var('x') #trace_info = 'freeing object at address ' + str(x) return False
Example #8
Source File: salt.py From salt with GNU General Public License v3.0 | 5 votes |
def stop(self): s = gdb.selected_frame().read_var('s') name, pid = get_task_info() cache = s['name'].string() if apply_filter(name, cache): trace_info = 'kmem_cache_alloc is accessing cache ' + cache + ' on behalf of process "' + name + '", pid ' + str(pid) #trace_info += '\nreturning object at address ' + str(tohex(ret, 64)) salt_print(trace_info) history.append(('kmem_cache_alloc', cache, name, pid)) return False
Example #9
Source File: salt.py From salt with GNU General Public License v3.0 | 5 votes |
def stop(self): s = gdb.selected_frame().read_var('s') x = gdb.selected_frame().read_var('x') name, pid = get_task_info() cache = s['name'].string() if apply_filter(name, cache): trace_info = 'kmem_cache_free is freeing from cache ' + cache + ' on behalf of process "' + name + '", pid ' + str(pid) #trace_info += '\nfreeing object at address ' + str(x) salt_print(trace_info) history.append(('kmem_cache_free', cache, name, pid)) return False
Example #10
Source File: salt.py From salt with GNU General Public License v3.0 | 5 votes |
def stop(self): s = gdb.selected_frame().read_var('s') name, pid = get_task_info() cache = s['name'].string() if apply_filter(name, cache): trace_info = 'a new slab is being created for ' + cache + ' on behalf of process "' + name + '", pid ' + str(pid) salt_print('\033[91m'+trace_info+'\033[0m') history.append(('new_slab', cache, name, pid)) return False
Example #11
Source File: strongdb.py From strongdb with GNU General Public License v3.0 | 4 votes |
def get_contents(self): str = "" str += Strongdb.border_header('Assembly') if Strongdb.is_arm_mode(): length_per_ins = 4 else: length_per_ins = 2 frame = gdb.selected_frame() instructions = frame.architecture().disassemble(frame.pc() - 4 * length_per_ins, count=10) self.load_jni_native_table() for ins in instructions: if frame.pc() == ins['addr']: str += Strongdb.colorize('-->\t' + hex(ins['addr'])[:-1] + ':\t', Colors.address_color) str += Strongdb.colorize(self.get_machine_code(ins['asm']), Colors.code_highlight_color) jni_func = "" # get JNIEnv pointer jni_env_addr = self.get_jni_env_addr() # check blx rx if jni_env_addr != 0 and ins['asm'].lower().startswith('blx\tr'): reg = ins['asm'][4:] called_addr = Strongdb.run_cmd('i r $' + reg).split(None)[1] # if the address is in JniNativeInterface address table if self.jni_env.func_address[called_addr] != None: jni_func = "; " + self.jni_env.func_address[called_addr] str += Strongdb.colorize(ins['asm'] + '\t' + Strongdb.colorize(jni_func, 'yellow'), Colors.code_highlight_color) + '\n' else: str += Strongdb.colorize('\t' + hex(ins['addr'])[:-1] + ':\t', Colors.address_color) str += Strongdb.colorize(self.get_machine_code(ins['asm']), Colors.code_color) str += Strongdb.colorize(ins['asm'], Colors.code_color) + '\n' str += Strongdb.border_footer() return str