Пример #1
0
	def test_run_exit(self):
		s = mozz.Session(abs_path(__file__, "run_exit_test.bin"), 2)

		state = [0]

		@s.on_run()
		def run(host):
			mozz.debug("cb run")
			self.assertEqual(s.iteration(), 0)
			self.assertEqual(state[0], 0)
			state[0] += 1

		def offset():
			return (s.iteration()-1)*4

		@s.on_inferior_pre()
		def inf_pre(host):
			mozz.debug("cb inf pre")
			self.assertEqual(state[0], offset() + 1)
			state[0] += 1

		@s.at_entry()
		def entry(host):
			pc = host.inferior().reg_pc()
			mozz.debug("entry point is 0x%x" % (pc))
			self.assertEqual(pc, 0x400410)
			self.assertEqual(state[0], offset() + 2)
			state[0] += 1

		@s.on_exit()
		def on_exit(host):
			mozz.debug("cb exit")
			self.assertEqual(state[0], offset() + 3)
			state[0] += 1

		@s.on_inferior_post()
		def on_inf_post(host):
			mozz.debug("cb inf post")
			self.assertEqual(state[0], offset() + 4)
			state[0] += 1

		@s.on_finish()
		def finish(host):
			mozz.debug("cb finish")
			self.assertEqual(s.iteration(), 2)
			self.assertEqual(state[0], offset() + 5)
			state[0] += 1

		mozz.run_session(s)
		mozz.debug("session over")
		self.assertEqual(s.iteration(), 2)
		self.assertEqual(state[0], offset() + 6)
Пример #2
0
    def test_run_exit(self):
        s = mozz.Session(abs_path(__file__, "run_exit_test.bin"), 2)

        state = [0]

        @s.on_run()
        def run(host):
            mozz.debug("cb run")
            self.assertEqual(s.iteration(), 0)
            self.assertEqual(state[0], 0)
            state[0] += 1

        def offset():
            return (s.iteration() - 1) * 4

        @s.on_inferior_pre()
        def inf_pre(host):
            mozz.debug("cb inf pre")
            self.assertEqual(state[0], offset() + 1)
            state[0] += 1

        @s.at_entry()
        def entry(host):
            pc = host.inferior().reg_pc()
            mozz.debug("entry point is 0x%x" % (pc))
            self.assertEqual(pc, 0x400410)
            self.assertEqual(state[0], offset() + 2)
            state[0] += 1

        @s.on_exit()
        def on_exit(host):
            mozz.debug("cb exit")
            self.assertEqual(state[0], offset() + 3)
            state[0] += 1

        @s.on_inferior_post()
        def on_inf_post(host):
            mozz.debug("cb inf post")
            self.assertEqual(state[0], offset() + 4)
            state[0] += 1

        @s.on_finish()
        def finish(host):
            mozz.debug("cb finish")
            self.assertEqual(s.iteration(), 2)
            self.assertEqual(state[0], offset() + 5)
            state[0] += 1

        mozz.run_session(s)
        mozz.debug("session over")
        self.assertEqual(s.iteration(), 2)
        self.assertEqual(state[0], offset() + 6)
Пример #3
0
		def inf_pre(host):
			state[0] += 1
			mozz.debug("i=%d" % state[0])
			self.assertEqual(s.iteration(), state[0])
Пример #4
0
 def finish(host):
     mozz.debug("cb finish")
     self.assertEqual(s.iteration(), 2)
     self.assertEqual(state[0], offset() + 5)
     state[0] += 1
Пример #5
0
 def on_inf_post(host):
     mozz.debug("cb inf post")
     self.assertEqual(state[0], offset() + 4)
     state[0] += 1
Пример #6
0
 def on_exit(host):
     mozz.debug("cb exit")
     self.assertEqual(state[0], offset() + 3)
     state[0] += 1
Пример #7
0
 def entry(host):
     pc = host.inferior().reg_pc()
     mozz.debug("entry point is 0x%x" % (pc))
     self.assertEqual(pc, 0x400410)
     self.assertEqual(state[0], offset() + 2)
     state[0] += 1
Пример #8
0
 def inf_pre(host):
     mozz.debug("cb inf pre")
     self.assertEqual(state[0], offset() + 1)
     state[0] += 1
Пример #9
0
 def run(host):
     mozz.debug("cb run")
     self.assertEqual(s.iteration(), 0)
     self.assertEqual(state[0], 0)
     state[0] += 1
Пример #10
0
 def inf_pre(host):
     state[0] += 1
     mozz.debug("i=%d" % state[0])
     self.assertEqual(s.iteration(), state[0])
Пример #11
0
		def finish(host):
			mozz.debug("cb finish")
			self.assertEqual(s.iteration(), 2)
			self.assertEqual(state[0], offset() + 5)
			state[0] += 1
Пример #12
0
		def on_inf_post(host):
			mozz.debug("cb inf post")
			self.assertEqual(state[0], offset() + 4)
			state[0] += 1
Пример #13
0
		def on_exit(host):
			mozz.debug("cb exit")
			self.assertEqual(state[0], offset() + 3)
			state[0] += 1
Пример #14
0
		def entry(host):
			pc = host.inferior().reg_pc()
			mozz.debug("entry point is 0x%x" % (pc))
			self.assertEqual(pc, 0x400410)
			self.assertEqual(state[0], offset() + 2)
			state[0] += 1
Пример #15
0
		def inf_pre(host):
			mozz.debug("cb inf pre")
			self.assertEqual(state[0], offset() + 1)
			state[0] += 1
Пример #16
0
		def run(host):
			mozz.debug("cb run")
			self.assertEqual(s.iteration(), 0)
			self.assertEqual(state[0], 0)
			state[0] += 1