(self)
| 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") |
nothing calls this directly
no test coverage detected