* python/py-type.c (typy_fields_items): Call check_typedef.
testsuite/ * gdb.python/py-type.c (TS): New typedef. (ts): New global. * gdb.python/py-type.exp: Test field list of typedef.
This commit is contained in:
parent
bd119cf152
commit
f6b47be484
5 changed files with 43 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2011-11-10 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* python/py-type.c (typy_fields_items): Call check_typedef.
|
||||||
|
|
||||||
2011-11-10 Joel Brobecker <brobecker@adacore.com>
|
2011-11-10 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* findvar.c (read_frame_register_value): Read the correct bytes
|
* findvar.c (read_frame_register_value): Read the correct bytes
|
||||||
|
|
|
@ -294,14 +294,33 @@ make_fielditem (struct type *type, int i, enum gdbpy_iter_kind kind)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
|
typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
|
||||||
{
|
{
|
||||||
|
PyObject *py_type = self;
|
||||||
PyObject *result = NULL, *iter = NULL;
|
PyObject *result = NULL, *iter = NULL;
|
||||||
|
volatile struct gdb_exception except;
|
||||||
|
struct type *type = ((type_object *) py_type)->type;
|
||||||
|
struct type *checked_type = type;
|
||||||
|
|
||||||
iter = typy_make_iter (self, kind);
|
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||||
if (iter == NULL)
|
{
|
||||||
return NULL;
|
CHECK_TYPEDEF (checked_type);
|
||||||
|
}
|
||||||
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
|
|
||||||
|
if (checked_type != type)
|
||||||
|
py_type = type_to_type_object (checked_type);
|
||||||
|
iter = typy_make_iter (py_type, kind);
|
||||||
|
if (checked_type != type)
|
||||||
|
{
|
||||||
|
/* Need to wrap this in braces because Py_DECREF isn't wrapped
|
||||||
|
in a do{}while(0). */
|
||||||
|
Py_DECREF (py_type);
|
||||||
|
}
|
||||||
|
if (iter != NULL)
|
||||||
|
{
|
||||||
result = PySequence_List (iter);
|
result = PySequence_List (iter);
|
||||||
Py_DECREF (iter);
|
Py_DECREF (iter);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2011-11-10 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* gdb.python/py-type.c (TS): New typedef.
|
||||||
|
(ts): New global.
|
||||||
|
* gdb.python/py-type.exp: Test field list of typedef.
|
||||||
|
|
||||||
2011-11-10 Joel Brobecker <brobecker@adacore.com>
|
2011-11-10 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* gdb.ada/small_reg_param: New testcase.
|
* gdb.ada/small_reg_param: New testcase.
|
||||||
|
|
|
@ -21,6 +21,9 @@ struct s
|
||||||
int b;
|
int b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct s TS;
|
||||||
|
TS ts;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
struct C
|
struct C
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,10 @@ proc runto_bp {bp} {
|
||||||
proc test_fields {lang} {
|
proc test_fields {lang} {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
|
# .fields() of a typedef should still return the underlying field list
|
||||||
|
gdb_test "python print len(gdb.parse_and_eval('ts').type.fields())" "2" \
|
||||||
|
"$lang typedef field list"
|
||||||
|
|
||||||
if {$lang == "c++"} {
|
if {$lang == "c++"} {
|
||||||
# Test usage with a class
|
# Test usage with a class
|
||||||
gdb_py_test_silent_cmd "print c" "print value" 1
|
gdb_py_test_silent_cmd "print c" "print value" 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue