mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
d60c6a1d68
In order to retrieve registers from stack traces, we need to know what registers are defined for a platform. This adds a small DSL for defining registers for an architecture. The DSL is parsed by an awk script that generates the necessary tables, lookup functions, and enum definitions.
17 lines
505 B
Python
17 lines
505 B
Python
import unittest
|
|
|
|
from drgn import Architecture, Platform, PlatformFlags
|
|
|
|
|
|
class TestPlatform(unittest.TestCase):
|
|
def test_default_flags(self):
|
|
Platform(Architecture.X86_64)
|
|
self.assertRaises(ValueError, Platform, Architecture.UNKNOWN)
|
|
|
|
def test_registers(self):
|
|
self.assertIn(
|
|
'rax',
|
|
(reg.name for reg in Platform(Architecture.X86_64).registers))
|
|
self.assertEqual(
|
|
Platform(Architecture.UNKNOWN, PlatformFlags(0)).registers, ())
|