def signalClient(self, norev=False): start_eip = idaversion.get_reg_value(self.PC) #print('signalClient eip was at 0x%x, then after rev 1 0x%x call setAndDisable string is %s' % (start_eip, eip, simicsString)) if norev: idaapi.step_into() idaversion.wait_for_next_event(idc.WFNE_SUSP, -1) simicsString = gdbProt.Evalx('SendGDBMonitor("@cgc.printRegJson()");') try: regs = json.loads(simicsString) except: print('failed to get regs from %s' % simicsString) return for reg in regs: r = str(reg.upper()) if r == 'EFLAGS': r = 'EFL' elif r == 'CPSR': r = 'PSR' #print('set %s to 0x%x' % (r, regs[reg])) idaversion.set_reg_value(regs[reg], r) idaversion.refresh_debugger_memory() new_eip = idaversion.get_reg_value(self.PC) #print('signalClient back from cont new_eip is 0x%x' % new_eip) if new_eip >= self.kernel_base: print('in kernel, run to user') self.updateStackTrace()
def doStepInto(self): #print('in doInto') idaapi.step_into() idaversion.wait_for_next_event(idc.WFNE_SUSP, -1) cur_addr = idaversion.get_reg_value(self.PC) if cur_addr > self.kernel_base: self.runToUserSpace()
def doStepOver(self): #print('in doStepOver') idaapi.step_over() #print('back from step over') idaversion.wait_for_next_event(idc.WFNE_SUSP, -1) #print('back getDebuggerEvent') cur_addr = idaversion.get_reg_value(self.PC) #print('cur_addr is 0x%x' % cur_addr) if cur_addr > self.kernel_base: print('run to user space') self.runToUserSpace()
def XXXXXXXXXXXXXXXsignalClient(self, norev=False): start_eip = idaversion.get_reg_value(self.PC) if not norev: simicsString = gdbProt.Evalx('SendGDBMonitor("@cgc.rev1()");') eip = gdbProt.getEIPWhenStopped() if eip is None or not (type(eip) is int or type(eip) is long): print('signalClient got wrong stuff? %s from getEIP' % str(eip)) return #print('signalClient eip was at 0x%x, then after rev 1 0x%x call setAndDisable string is %s' % (start_eip, eip, simicsString)) idaapi.step_into() idaversion.wait_for_next_event(idc.WFNE_SUSP, -1) new_eip = idaversion.get_reg_value(self.PC) #print('signalClient back from cont new_eip is 0x%x' % new_eip) if new_eip >= self.kernel_base: print('in kernel, run to user') self.updateStackTrace()
def stepWait(): idc.StepInto() event = idaversion.wait_for_next_event(idc.WFNE_ANY, -1)