MCPcopy Create free account
hub / github.com/Vector35/debugger / test_assembly_code

Method test_assembly_code

test/debugger_test.py:262–288  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

260 dbg.quit_and_wait()
261
262 def test_assembly_code(self):
263 if self.arch == 'x86_64':
264 fpath = name_to_fpath('asmtest', 'x86_64')
265 bv = load(fpath)
266 dbg = DebuggerController(bv)
267 self.assertNotIn(dbg.launch_and_wait(), [DebugStopReason.ProcessExited, DebugStopReason.InternalError])
268 entry = dbg.data.entry_point
269 self.assertEqual(dbg.ip, entry)
270
271 # TODO: we can use BN to disassemble the binary and find out how long is the instruction
272 # step into nop
273 dbg.step_into_and_wait()
274 self.assertEqual(dbg.ip, entry+1)
275 # step into call, return
276 dbg.step_into_and_wait()
277 dbg.step_into_and_wait()
278 # back
279 self.assertEqual(dbg.ip, entry+6)
280 dbg.step_into_and_wait()
281 # step into call, return
282 dbg.step_into_and_wait()
283 dbg.step_into_and_wait()
284 # back
285 self.assertEqual(dbg.ip, entry+12)
286
287 reason = dbg.go_and_wait()
288 self.assertEqual(reason, DebugStopReason.ProcessExited)
289
290 @unittest.skipIf(platform.system() == 'Linux', 'Cannot attach to pid unless running as root')
291 def test_attach(self):

Callers

nothing calls this directly

Calls 5

launch_and_waitMethod · 0.95
step_into_and_waitMethod · 0.95
go_and_waitMethod · 0.95
DebuggerControllerClass · 0.90
name_to_fpathFunction · 0.85

Tested by

no test coverage detected