aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorJan Vrany <jan.vrany@labware.com>2025-02-04 13:56:49 +0000
committerJan Vrany <jan.vrany@labware.com>2025-02-04 13:56:49 +0000
commit13dad2fefb26f1972145084d58d013f12d98c5d0 (patch)
tree6e027bb48ce2e4544ad9d14857b3f8c669865284 /gdb/python
parent30243af82d55050d4168090626dbc91a1c935159 (diff)
downloadbinutils-13dad2fefb26f1972145084d58d013f12d98c5d0.zip
binutils-13dad2fefb26f1972145084d58d013f12d98c5d0.tar.gz
binutils-13dad2fefb26f1972145084d58d013f12d98c5d0.tar.bz2
gdb/python: add void_type () method to gdb.Architecture object
This commit adds a new method to Python architecture objects that returns a void type for that architecture. This will be useful later to create types for function symbols created using Python extension code. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-arch.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index f7e35a4..2bf6251 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -1,6 +1,6 @@
/* Python interface to architecture
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -318,6 +318,16 @@ archpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
return type_to_type_object (type);
}
+/* Implementation of gdb.void_type. */
+static PyObject *
+archpy_void_type (PyObject *self, PyObject *args)
+{
+ struct gdbarch *gdbarch;
+ ARCHPY_REQUIRE_VALID (self, gdbarch);
+
+ return type_to_type_object (builtin_type (gdbarch)->builtin_void);
+}
+
/* __repr__ implementation for gdb.Architecture. */
static PyObject *
@@ -383,6 +393,10 @@ END_PC." },
"integer_type (size [, signed]) -> type\n\
Return an integer Type corresponding to the given bitsize and signed-ness.\n\
If not specified, the type defaults to signed." },
+ { "void_type", (PyCFunction) archpy_void_type,
+ METH_NOARGS,
+ "void_type () -> type\n\
+Return a void Type." },
{ "registers", (PyCFunction) archpy_registers,
METH_VARARGS | METH_KEYWORDS,
"registers ([ group-name ]) -> Iterator.\n\