How to use the drgn.typename.ArrayTypeName function in drgn

To help you get started, we’ve selected a few drgn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osandov / drgn / tests / test_typename.py View on Github external
def test_array(self):
        self.assertEqual(parse_type_name('int []'),
                         ArrayTypeName(BasicTypeName('int'), None))
        self.assertEqual(parse_type_name('int [2]'),
                         ArrayTypeName(BasicTypeName('int'), 2))
        self.assertEqual(parse_type_name('int [0x10]'),
                         ArrayTypeName(BasicTypeName('int'), 16))
        self.assertEqual(parse_type_name('int [010]'),
                         ArrayTypeName(BasicTypeName('int'), 8))
        self.assertEqual(parse_type_name('int [2][3]'),
                         ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
        self.assertEqual(parse_type_name('int [2][3][4]'),
                         ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
github osandov / drgn / tests / test_typename.py View on Github external
def test_array(self):
        self.assertEqual(parse_type_name('int []'),
                         ArrayTypeName(BasicTypeName('int'), None))
        self.assertEqual(parse_type_name('int [2]'),
                         ArrayTypeName(BasicTypeName('int'), 2))
        self.assertEqual(parse_type_name('int [0x10]'),
                         ArrayTypeName(BasicTypeName('int'), 16))
        self.assertEqual(parse_type_name('int [010]'),
                         ArrayTypeName(BasicTypeName('int'), 8))
        self.assertEqual(parse_type_name('int [2][3]'),
                         ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
        self.assertEqual(parse_type_name('int [2][3][4]'),
                         ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
github osandov / drgn / tests / test_typename.py View on Github external
def test_array_of_pointers(self):
        self.assertEqual(str(ArrayTypeName(ArrayTypeName(PointerTypeName(BasicTypeName('int')), 3), 2)),
                         'int *[2][3]')
github osandov / drgn / tests / test_typename.py View on Github external
def test_pointer_to_pointer_to_array(self):
        self.assertEqual(parse_type_name('int (**)[2]'),
                         PointerTypeName(PointerTypeName(ArrayTypeName(BasicTypeName('int'), 2))))
github osandov / drgn / tests / test_typename.py View on Github external
def test_array(self):
        self.assertEqual(parse_type_name('int []'),
                         ArrayTypeName(BasicTypeName('int'), None))
        self.assertEqual(parse_type_name('int [2]'),
                         ArrayTypeName(BasicTypeName('int'), 2))
        self.assertEqual(parse_type_name('int [0x10]'),
                         ArrayTypeName(BasicTypeName('int'), 16))
        self.assertEqual(parse_type_name('int [010]'),
                         ArrayTypeName(BasicTypeName('int'), 8))
        self.assertEqual(parse_type_name('int [2][3]'),
                         ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
        self.assertEqual(parse_type_name('int [2][3][4]'),
                         ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
github osandov / drgn / tests / test_typename.py View on Github external
def test_array(self):
        self.assertEqual(str(ArrayTypeName(BasicTypeName('int'), None)),
                         'int []')
        self.assertEqual(str(ArrayTypeName(BasicTypeName('int'), 2)),
                         'int [2]')
        self.assertEqual(str(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2)),
                         'int [2][3]')
        self.assertEqual(str(ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2)),
                         'int [2][3][4]')
github osandov / drgn / tests / test_typename.py View on Github external
def test_array(self):
        self.assertEqual(parse_type_name('int []'),
                         ArrayTypeName(BasicTypeName('int'), None))
        self.assertEqual(parse_type_name('int [2]'),
                         ArrayTypeName(BasicTypeName('int'), 2))
        self.assertEqual(parse_type_name('int [0x10]'),
                         ArrayTypeName(BasicTypeName('int'), 16))
        self.assertEqual(parse_type_name('int [010]'),
                         ArrayTypeName(BasicTypeName('int'), 8))
        self.assertEqual(parse_type_name('int [2][3]'),
                         ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 3), 2))
        self.assertEqual(parse_type_name('int [2][3][4]'),
                         ArrayTypeName(ArrayTypeName(ArrayTypeName(BasicTypeName('int'), 4), 3), 2))
github osandov / drgn / drgn / type.py View on Github external
def type_name(self) -> ArrayTypeName:
        return ArrayTypeName(self.type.type_name(), self.size)