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

Method test_attach

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

Source from the content-addressed store, hash-verified

289
290 @unittest.skipIf(platform.system() == 'Linux', 'Cannot attach to pid unless running as root')
291 def test_attach(self):
292 pid = None
293 if platform.system() == 'Windows':
294 fpath = name_to_fpath('helloworld_loop', self.arch)
295 DETACHED_PROCESS = 0x00000008
296 CREATE_NEW_CONSOLE = 0x00000010
297 cmds = [fpath]
298 pid = subprocess.Popen(cmds, creationflags=CREATE_NEW_CONSOLE).pid
299 elif platform.system() in ['Darwin', 'Linux']:
300 fpath = name_to_fpath('helloworld_loop', self.arch)
301 cmds = [fpath]
302 pid = subprocess.Popen(cmds).pid
303 else:
304 print('attaching test not yet implemented on %s' % platform.system())
305
306 self.assertIsNotNone(pid)
307 bv = load(fpath)
308 dbg = DebuggerController(bv)
309 dbg.pid_attach = pid
310 self.assertTrue(dbg.attach_and_wait())
311 self.assertGreater(len(dbg.regs), 0)
312
313 dbg.quit_and_wait()
314
315
316@unittest.skipIf(platform.system() != 'Darwin' or platform.machine() != 'arm64', "Only run arm64 tests on arm Mac")

Callers

nothing calls this directly

Calls 5

attach_and_waitMethod · 0.95
quit_and_waitMethod · 0.95
DebuggerControllerClass · 0.90
name_to_fpathFunction · 0.85
printFunction · 0.85

Tested by

no test coverage detected