Skip to content

Commit

Permalink
modify get_dbg_info, get code line and files without inserting breakp…
Browse files Browse the repository at this point in the history
…oint
  • Loading branch information
TomAPU authored Sep 4, 2023
1 parent 0d43162 commit d41dca2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions syzscope/interface/vm/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,15 @@ def get_func_name(self, addr):
return ret

def get_dbg_info(self, addr):
cmd = 'b *{}'.format(addr)
cmd = 'info line *{}'.format(addr)
raw = self.sendline(cmd)
dbg_info_regx = r'Breakpoint \d+ at 0x[a-f0-9]+: file (([A-Za-z0-9_\-.]+\/)+[A-Za-z0-9_.\-]+), line (\d+)'
#example input: 'Line 2852 of "net/core/skbuff.c" starts at address 0xffffffff83f0ad69 <skb_queue_purge+25> and ends at 0xffffffff83f0ad79 <skb_queue_purge+41>.\npwndbg>'
dbg_info_regx = r'Line (\d+) of "(.+)" starts at address'
ret = []
for line in raw.split('\n'):
line = line.strip('\n')
dbg_file = utilities.regx_get(dbg_info_regx, line, 0)
dbg_line = utilities.regx_get(dbg_info_regx, line, 2)
dbg_file = utilities.regx_get(dbg_info_regx, line, 1)
dbg_line = utilities.regx_get(dbg_info_regx, line, 0)
if dbg_file != None and dbg_line != None:
ret.append(dbg_file)
ret.append(dbg_line)
Expand Down

0 comments on commit d41dca2

Please sign in to comment.