static gdb_PyGetSetDef corefile_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, nullptr,
- "The __dict__ for the gdb.Corefile.", nullptr },
+ gdbpy_dict_wrapper_cfg_dict_getter ("corefile"),
{ "filename", cfpy_get_filename, nullptr,
"The filename of a valid Corefile object.", nullptr },
{ nullptr }
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
- gdb_py_generic_getattro, /*tp_getattro*/
- gdb_py_generic_setattro, /*tp_setattro*/
+ gdbpy_dict_wrapper_getsetattro,
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB corefile object", /* tp_doc */
static gdb_PyGetSetDef event_object_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, NULL,
- "The __dict__ for this event.", NULL },
+ gdbpy_dict_wrapper_cfg_dict_getter ("event"),
{ NULL }
};
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- gdb_py_generic_getattro, /* tp_getattro */
- gdb_py_generic_setattro, /* tp_setattro */
+ gdbpy_dict_wrapper_getsetattro,
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
"GDB event object", /* tp_doc */
static gdb_PyGetSetDef inferior_object_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, nullptr,
- "The __dict__ for this inferior.", nullptr },
+ gdbpy_dict_wrapper_cfg_dict_getter ("inferior"),
{ "arguments", infpy_get_args, infpy_set_args,
"Arguments to this program.", nullptr },
{ "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- gdb_py_generic_getattro, /* tp_getattro */
- gdb_py_generic_setattro, /* tp_setattro */
+ gdbpy_dict_wrapper_getsetattro,
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"GDB inferior object", /* tp_doc */
static gdb_PyGetSetDef thread_object_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, nullptr,
- "The __dict__ for this thread.", nullptr },
+ gdbpy_dict_wrapper_cfg_dict_getter ("thread"),
{ "name", thpy_get_name, thpy_set_name,
"The name of the thread, as set by the user or the OS.", NULL },
{ "details", thpy_get_details, NULL,
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
- gdb_py_generic_getattro, /*tp_getattro*/
- gdb_py_generic_setattro, /*tp_setattro*/
+ gdbpy_dict_wrapper_getsetattro,
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB thread object", /* tp_doc */
static gdb_PyGetSetDef objfile_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, NULL,
- "The __dict__ for this objfile.", NULL },
+ gdbpy_dict_wrapper_cfg_dict_getter ("objfile"),
{ "filename", objfpy_get_filename, NULL,
"The objfile's filename, or None.", NULL },
{ "username", objfpy_get_username, NULL,
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
- gdb_py_generic_getattro, /*tp_getattro*/
- gdb_py_generic_setattro, /*tp_setattro*/
+ gdbpy_dict_wrapper_getsetattro,
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB objfile object", /* tp_doc */
static gdb_PyGetSetDef pspace_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, NULL,
- "The __dict__ for this progspace.", NULL },
+ gdbpy_dict_wrapper_cfg_dict_getter ("progspace"),
{ "filename", pspy_get_filename, NULL,
"The filename of the progspace's main symbol file, or None.", nullptr },
{ "symbol_file", pspy_get_symbol_file, nullptr,
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
- gdb_py_generic_getattro, /*tp_getattro*/
- gdb_py_generic_setattro, /*tp_setattro*/
+ gdbpy_dict_wrapper_getsetattro,
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB progspace object", /* tp_doc */
Access to the dict requires a custom getter defined via PyGetSetDef.
gdb_PyGetSetDef my_object_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, nullptr,
- "The __dict__ for this object.", nullptr },
+ gdbpy_dict_wrapper_cfg_dict_getter ("object"),
...
{ nullptr }
};
return &wrapper->dict;
}
+#define gdbpy_dict_wrapper_cfg_dict_getter(object_name) \
+ { \
+ "__dict__", /* name */ \
+ (getter) gdb_py_generic_dict_getter, \
+ (setter) nullptr, \
+ "The __dict__ for this " object_name ".", /* doc */ \
+ nullptr, /* closure */ \
+ }
+
+#define gdbpy_dict_wrapper_getsetattro \
+ /*tp_getattro*/ \
+ gdb_py_generic_getattro, \
+ /*tp_setattro*/ \
+ gdb_py_generic_setattro
+
/* Allocate the dictionary pointed by 'dict'.
Note: this method should be called once the object was allocated,
when setting its attributes. */
static gdb_PyGetSetDef field_object_getset[] =
{
- { "__dict__", gdb_py_generic_dict_getter, NULL,
- "The __dict__ for this field.", NULL },
- { NULL }
+ gdbpy_dict_wrapper_cfg_dict_getter ("field"),
+ { nullptr }
};
PyTypeObject field_object_type =
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
- gdb_py_generic_getattro, /*tp_getattro*/
- gdb_py_generic_setattro, /*tp_setattro*/
+ gdbpy_dict_wrapper_getsetattro,
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB field object", /* tp_doc */