mirror of
https://github.com/vivisect/vivisect
synced 2026-06-08 18:04:23 +00:00
fix bug in PostHookBreakpoint, add test
This commit is contained in:
@@ -389,6 +389,10 @@ class PostHookBreakpoint(NiceBreakpoint):
|
||||
print('Post hook callback "%s" exception: %s' % (hook_cb, str(e)))
|
||||
|
||||
def notify(self, event, trace):
|
||||
ret_addr, args = self.parent.callinfo[trace.getCurrentThread()]
|
||||
tup = self.parent.callinfo.get(trace.getCurrentThread(), None)
|
||||
if tup == None:
|
||||
return
|
||||
|
||||
ret_addr, args = tup
|
||||
|
||||
self.runPostHookCallbacks(event, trace, ret_addr, args)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
|
||||
import vtrace.breakpoints
|
||||
|
||||
# TODO: move testmods.hookbptest tests in here as well.
|
||||
|
||||
class MockTrace(object):
|
||||
def getCurrentThread(self):
|
||||
return 0
|
||||
|
||||
class HookBpPostTests(unittest.TestCase):
|
||||
def test_PostHitNoCallinfo(self):
|
||||
'''
|
||||
tests condition where:
|
||||
1. thread 1 hits hookbp and sets up postbp
|
||||
2. thread 2 hits postbp (there's nothing in callinfo for thread 2)
|
||||
'''
|
||||
hbp = vtrace.breakpoints.HookBreakpoint('0xdeadbeef')
|
||||
phbp = vtrace.breakpoints.PostHookBreakpoint('0xcafebabe', hbp)
|
||||
|
||||
phbp.notify(None, MockTrace())
|
||||
Reference in New Issue
Block a user