Skip to content

Commit 365561c

Browse files
committed
added hold debugger function
basically helps with holding the debugger to attach with gdb; can pass the process name to get the last process id
1 parent 46fda8c commit 365561c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

isis/isis.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ def hd(s,n,le=True):
272272
fmt_str = '{:#08x}:' + (' {{:#0{pad}x}}'.format(pad=(n*2+2)))*len(line)
273273
print fmt_str.format(addr,*line)
274274
addr += 0x10
275+
276+
def hold_debugger(program_name=None):
277+
'''Holds the debugger until c is pressed; optional arg to print the pid of that process'''
278+
if(program_name):
279+
print program_name+" pid:"+str(map(int,check_output(["pidof",program_name]).split())[-1])
280+
281+
print "Attach Debugger..."
282+
while(raw_input() != 'c'):
283+
pass
275284

276285
if __name__ == '__main__':
277286
import code

0 commit comments

Comments
 (0)