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

Method test_register_read_write

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

Source from the content-addressed store, hash-verified

183 dbg.quit_and_wait()
184
185 def test_register_read_write(self):
186 fpath = name_to_fpath('helloworld', self.arch)
187 bv = load(fpath)
188 dbg = DebuggerController(bv)
189 self.assertNotIn(dbg.launch_and_wait(), [DebugStopReason.ProcessExited, DebugStopReason.InternalError])
190
191 arch_name = bv.arch.name
192 if arch_name == 'x86':
193 (xax, xbx) = ('eax', 'ebx')
194 (testval_a, testval_b) = (0xDEADBEEF, 0xCAFEBABE)
195 elif arch_name == 'x86_64':
196 (xax, xbx) = ('rax', 'rbx')
197 (testval_a, testval_b) = (0xAAAAAAAADEADBEEF, 0xBBBBBBBBCAFEBABE)
198 else:
199 (xax, xbx) = ('x0', 'x1')
200 (testval_a, testval_b) = (0xAAAAAAAADEADBEEF, 0xBBBBBBBBCAFEBABE)
201
202 rax = dbg.get_reg_value(xax)
203 rbx = dbg.get_reg_value(xbx)
204
205 dbg.set_reg_value(xax, testval_a)
206 self.assertEqual(dbg.get_reg_value(xax), testval_a)
207 dbg.set_reg_value(xbx, testval_b)
208 self.assertEqual(dbg.get_reg_value(xbx), testval_b)
209
210 dbg.set_reg_value(xax, rax)
211 self.assertEqual(dbg.get_reg_value(xax), rax)
212 dbg.set_reg_value(xbx, rbx)
213 self.assertEqual(dbg.get_reg_value(xbx), rbx)
214
215 dbg.quit_and_wait()
216
217 def test_memory_read_write(self):
218 fpath = name_to_fpath('helloworld', self.arch)

Callers

nothing calls this directly

Calls 6

launch_and_waitMethod · 0.95
get_reg_valueMethod · 0.95
set_reg_valueMethod · 0.95
quit_and_waitMethod · 0.95
DebuggerControllerClass · 0.90
name_to_fpathFunction · 0.85

Tested by

no test coverage detected