Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gaa-cifasis committed Mar 22, 2016
1 parent d1ca288 commit 766924d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions vdiscover/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from Alarm import alarm_handler, TimeoutEx

class Process(Application):
def __init__(self, program, envs, timeout, included_mods = [], ignored_mods = [], no_stdout = True, max_events = 10000):
def __init__(self, program, envs, timeout, included_mods = [], ignored_mods = [], no_stdout = True, max_events = 320, min_events = -10*320):

Application.__init__(self) # no effect

Expand All @@ -64,6 +64,7 @@ def __init__(self, program, envs, timeout, included_mods = [], ignored_mods = []
self.mm = None
self.timeouts = 0
self.max_events = max_events
self.min_events = min_events

# Parse ELF
self.elf = ELF(self.program, plt = False)
Expand Down Expand Up @@ -157,13 +158,22 @@ def createEvents(self, signal):
self.process.singleStep()
self.debugger.waitProcessEvent()

n = self.nevents.get(name, 0)
self.nevents[name] = n + 1
n = self.nevents.get((ip,name), 0)
self.nevents[(ip, name)] = n + 2

for ((ip_,name_),n) in self.nevents.items():

if n > self.min_events + 1:
self.nevents[(ip_, name_)] = n - 1
elif n == self.min_events + 1:
self.nevents[(ip_, name_)] = self.min_events
#print "restoring!", (ip, name)
self.breakpoint(call_ip)

if n < self.max_events:
self.breakpoint(call_ip)
#else:
#print "disabled!"
#print "disabled!", (ip, name)

#print "call detected!"
return [call]
Expand Down

0 comments on commit 766924d

Please sign in to comment.