-
Notifications
You must be signed in to change notification settings - Fork 294
Closed
Description
Description
I use ret-sync with gdb. And my gdb and ida are on ther same Destop. So, when I just send ni in gdb, the ida window jump out !!! Then I have to switch back to gdb. What a annoyance !!!
My Solution
First, I just comment the idaapi.jumpto(ea) in SyncPlugin.py, and the annoyance gone.
But there's still sometimes I need to check ida. So I and some code.
SyncPlugin.py
''' this code is in class RequestHandler '''
def req_loc2(self, hash):
offset, base = hash['offset'], hash.get('base')
ea = self.rebase(base, offset)
if not ea:
return
idaapi.jumpto(ea)
''' here I register my function '''
self.req_handlers = {
'broker': self.req_broker,
'loc': self.req_loc,
'loc2': self.req_loc2,
'cmd': self.req_cmd,
'cmt': self.req_cmt,
'rcmt': self.req_rcmt,
'fcmt': self.req_fcmt,
'raddr': self.req_raddr,
'cursor': self.req_cursor,
'patch': self.req_patch,
'rln': self.req_rln,
'rrln': self.req_rrln,
'lbl': self.req_lbl,
'bc': self.req_bc,
'bps_get': self.req_bps_get,
'bps_set': self.req_bps_set,
'modcheck': self.req_modcheck,
'dialect': self.req_set_dbg_dialect
}sync.py
class Loc(gdb.Command):
def __init__(self, sync):
gdb.Command.__init__(self, "loc", gdb.COMMAND_OBSCURE, gdb.COMPLETE_NONE)
self.sync = sync
def invoke(self, arg, from_tty):
offset = get_pc()
if not offset:
print("<not running>")
return
if not self.sync.base:
print("[sync] process not synced, command is dropped")
return
if not self.sync.pid:
self.sync.pid = get_pid(ctx=self.sync.ctx)
if self.sync.pid is None:
print("[sync] failed to get pid")
return
else:
print("[sync] pid: %s" % self.sync.pid)
self.sync.offset = offset
mod = self.sync.mod_info(self.sync.offset)
if mod:
if VERBOSE >= 2:
print("[sync] mod found")
print(mod)
base, sym = mod
if self.sync.base != base:
self.sync.tunnel.send("[notice]{\"type\":\"module\",\"path\":\"%s\"}\n" % sym)
self.sync.base = base
self.sync.tunnel.send("[sync]{\"type\":\"loc2\",\"base\":%d,\"offset\":%d}\n" % (self.sync.base, self.sync.offset))
else:
print("[sync] unknown module at current PC: 0x%x" % self.offset)
print("[sync] NOTE: will resume sync when at a known module address")
self.base = None
self.offset = None
''' also need to be registered '''
Loc(sync)Insert these code properly, and just type loc in gdb, ida cursor will be updated, instead of updating everytime.
Suggestion
Forget about my ugly code. Hope my problem will be solved in future edition.
Reactions are currently unavailable