1 /* Python interface to btrace instruction history.
3 Copyright 2016-2017 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "gdbthread.h"
25 #include "py-record.h"
26 #include "py-record-btrace.h"
31 #define BTPY_PYSLICE(x) (x)
35 #define BTPY_PYSLICE(x) ((PySliceObject *) x)
39 #define BTPY_REQUIRE_VALID_CALL(obj, iter) \
41 struct thread_info *tinfo = find_thread_ptid (obj->ptid); \
42 if (tinfo == NULL || btrace_is_empty (tinfo)) \
43 return PyErr_Format (gdbpy_gdb_error, _("Empty branch trace.")); \
44 if (0 == btrace_find_call_by_number (&iter, &tinfo->btrace, \
46 return PyErr_Format (gdbpy_gdb_error, _("No such call segment."));\
49 /* Python object for btrace record lists. */
54 /* The thread this list belongs to. */
57 /* The first index being part of this list. */
60 /* The last index begin part of this list. */
66 /* Either &BTPY_CALL_TYPE or &RECPY_INSN_TYPE. */
67 PyTypeObject
* element_type
;
70 /* Python type for btrace function-calls. */
72 static PyTypeObject btpy_call_type
= {
73 PyVarObject_HEAD_INIT (NULL
, 0)
76 /* Python type for btrace lists. */
78 static PyTypeObject btpy_list_type
= {
79 PyVarObject_HEAD_INIT (NULL
, 0)
82 /* Returns either a btrace_insn for the given Python gdb.RecordInstruction
83 object or sets an appropriate Python exception and returns NULL. */
85 static const btrace_insn
*
86 btrace_insn_from_recpy_insn (const PyObject
* const pyobject
)
88 const btrace_insn
*insn
;
89 const recpy_element_object
*obj
;
91 btrace_insn_iterator iter
;
93 if (Py_TYPE (pyobject
) != &recpy_insn_type
)
95 PyErr_Format (gdbpy_gdb_error
, _("Must be gdb.RecordInstruction"));
99 obj
= (const recpy_element_object
*) pyobject
;
100 tinfo
= find_thread_ptid (obj
->ptid
);
102 if (tinfo
== NULL
|| btrace_is_empty (tinfo
))
104 PyErr_Format (gdbpy_gdb_error
, _("No such instruction."));
108 if (btrace_find_insn_by_number (&iter
, &tinfo
->btrace
, obj
->number
) == 0)
110 PyErr_Format (gdbpy_gdb_error
, _("No such instruction."));
114 insn
= btrace_insn_get (&iter
);
117 PyErr_Format (gdbpy_gdb_error
, _("Not a valid instruction."));
124 /* Looks at the recorded item with the number NUMBER and create a
125 gdb.RecordInstruction or gdb.RecordGap object for it accordingly. */
128 btpy_insn_or_gap_new (const thread_info
*tinfo
, Py_ssize_t number
)
130 btrace_insn_iterator iter
;
133 btrace_find_insn_by_number (&iter
, &tinfo
->btrace
, number
);
134 err_code
= btrace_insn_get_error (&iter
);
138 const btrace_config
*config
;
139 const char *err_string
;
141 config
= btrace_conf (&tinfo
->btrace
);
142 err_string
= btrace_decode_error (config
->format
, err_code
);
144 return recpy_gap_new (err_code
, err_string
, number
);
147 return recpy_insn_new (tinfo
->ptid
, RECORD_METHOD_BTRACE
, number
);
150 /* Create a new gdb.BtraceFunctionCall object. */
153 btpy_call_new (ptid_t ptid
, Py_ssize_t number
)
155 recpy_element_object
* const obj
= PyObject_New (recpy_element_object
,
162 obj
->method
= RECORD_METHOD_BTRACE
;
163 obj
->number
= number
;
165 return (PyObject
*) obj
;
168 /* Create a new gdb.BtraceList object. */
171 btpy_list_new (ptid_t ptid
, Py_ssize_t first
, Py_ssize_t last
, Py_ssize_t step
,
172 PyTypeObject
*element_type
)
174 btpy_list_object
* const obj
= PyObject_New (btpy_list_object
,
184 obj
->element_type
= element_type
;
186 return (PyObject
*) obj
;
189 /* Implementation of BtraceInstruction.number [int] and
190 BtraceFunctionCall.number [int]. */
193 btpy_number (PyObject
*self
, void *closure
)
195 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
197 return PyInt_FromSsize_t (obj
->number
);
200 /* Implementation of BtraceInstruction.__hash__ () -> int and
201 BtraceFunctionCall.__hash__ () -> int. */
204 btpy_hash (PyObject
*self
)
206 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
211 /* Implementation of RecordInstruction.sal [gdb.Symtab_and_line] for btrace.
212 Returns the SAL associated with this instruction. */
215 recpy_bt_insn_sal (PyObject
*self
, void *closure
)
217 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
218 PyObject
*result
= NULL
;
225 result
= symtab_and_line_to_sal_object (find_pc_line (insn
->pc
, 0));
227 CATCH (except
, RETURN_MASK_ALL
)
229 GDB_PY_HANDLE_EXCEPTION (except
);
236 /* Implementation of RecordInstruction.pc [int] for btrace.
237 Returns the instruction address. */
240 recpy_bt_insn_pc (PyObject
*self
, void *closure
)
242 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
247 return gdb_py_long_from_ulongest (insn
->pc
);
250 /* Implementation of RecordInstruction.size [int] for btrace.
251 Returns the instruction size. */
254 recpy_bt_insn_size (PyObject
*self
, void *closure
)
256 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
261 return PyInt_FromLong (insn
->size
);
264 /* Implementation of RecordInstruction.is_speculative [bool] for btrace.
265 Returns if this instruction was executed speculatively. */
268 recpy_bt_insn_is_speculative (PyObject
*self
, void *closure
)
270 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
275 if (insn
->flags
& BTRACE_INSN_FLAG_SPECULATIVE
)
281 /* Implementation of RecordInstruction.data [buffer] for btrace.
282 Returns raw instruction data. */
285 recpy_bt_insn_data (PyObject
*self
, void *closure
)
287 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
288 gdb_byte
*buffer
= NULL
;
296 buffer
= (gdb_byte
*) xmalloc (insn
->size
);
297 read_memory (insn
->pc
, buffer
, insn
->size
);
299 CATCH (except
, RETURN_MASK_ALL
)
302 GDB_PY_HANDLE_EXCEPTION (except
);
306 object
= PyBytes_FromStringAndSize ((const char*) buffer
, insn
->size
);
313 return PyMemoryView_FromObject (object
);
315 return PyBuffer_FromObject (object
, 0, Py_END_OF_BUFFER
);
320 /* Implementation of RecordInstruction.decoded [str] for btrace.
321 Returns the instruction as human readable string. */
324 recpy_bt_insn_decoded (PyObject
*self
, void *closure
)
326 const btrace_insn
* const insn
= btrace_insn_from_recpy_insn (self
);
334 gdb_print_insn (target_gdbarch (), insn
->pc
, &strfile
, NULL
);
336 CATCH (except
, RETURN_MASK_ALL
)
338 gdbpy_convert_exception (except
);
344 return PyBytes_FromString (strfile
.string ().c_str ());
347 /* Implementation of BtraceFunctionCall.level [int]. Returns the
351 btpy_call_level (PyObject
*self
, void *closure
)
353 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
354 const struct btrace_function
*func
;
355 struct btrace_call_iterator iter
;
357 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
359 func
= btrace_call_get (&iter
);
363 return PyInt_FromLong (iter
.btinfo
->level
+ func
->level
);
366 /* Implementation of BtraceFunctionCall.symbol [gdb.Symbol]. Returns
367 the symbol associated with this function call. */
370 btpy_call_symbol (PyObject
*self
, void *closure
)
372 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
373 const struct btrace_function
*func
;
374 struct btrace_call_iterator iter
;
376 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
378 func
= btrace_call_get (&iter
);
382 if (func
->sym
== NULL
)
385 return symbol_to_symbol_object (func
->sym
);
388 /* Implementation of BtraceFunctionCall.instructions [list].
389 Return the list of instructions that belong to this function call. */
392 btpy_call_instructions (PyObject
*self
, void *closure
)
394 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
395 const struct btrace_function
*func
;
396 struct btrace_call_iterator iter
;
399 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
401 func
= btrace_call_get (&iter
);
405 len
= VEC_length (btrace_insn_s
, func
->insn
);
407 /* Gaps count as one instruction. */
411 return btpy_list_new (obj
->ptid
, func
->insn_offset
, func
->insn_offset
+ len
,
412 1, &recpy_insn_type
);
415 /* Implementation of BtraceFunctionCall.up [gdb.BtraceRecordCall].
416 Return the caller / returnee of this function. */
419 btpy_call_up (PyObject
*self
, void *closure
)
421 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
422 const struct btrace_function
*func
;
423 struct btrace_call_iterator iter
;
425 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
427 func
= btrace_call_get (&iter
);
431 if (func
->up
== NULL
)
434 return btpy_call_new (obj
->ptid
, func
->up
->number
);
437 /* Implementation of BtraceFunctionCall.prev_sibling [BtraceFunctionCall].
438 Return a previous segment of this function. */
441 btpy_call_prev_sibling (PyObject
*self
, void *closure
)
443 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
444 const struct btrace_function
*func
;
445 struct btrace_call_iterator iter
;
447 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
449 func
= btrace_call_get (&iter
);
453 if (func
->segment
.prev
== NULL
)
456 return btpy_call_new (obj
->ptid
, func
->segment
.prev
->number
);
459 /* Implementation of BtraceFunctionCall.next_sibling [BtraceFunctionCall].
460 Return a following segment of this function. */
463 btpy_call_next_sibling (PyObject
*self
, void *closure
)
465 const recpy_element_object
* const obj
= (const recpy_element_object
*) self
;
466 const struct btrace_function
*func
;
467 struct btrace_call_iterator iter
;
469 BTPY_REQUIRE_VALID_CALL (obj
, iter
);
471 func
= btrace_call_get (&iter
);
475 if (func
->segment
.next
== NULL
)
478 return btpy_call_new (obj
->ptid
, func
->segment
.next
->number
);
481 /* Python rich compare function to allow for equality and inequality checks
485 btpy_richcompare (PyObject
*self
, PyObject
*other
, int op
)
487 const recpy_element_object
* const obj1
= (recpy_element_object
*) self
;
488 const recpy_element_object
* const obj2
= (recpy_element_object
*) other
;
490 if (Py_TYPE (self
) != Py_TYPE (other
))
492 Py_INCREF (Py_NotImplemented
);
493 return Py_NotImplemented
;
499 if (ptid_equal (obj1
->ptid
, obj2
->ptid
) && obj1
->number
== obj2
->number
)
505 if (!ptid_equal (obj1
->ptid
, obj2
->ptid
) || obj1
->number
!= obj2
->number
)
514 Py_INCREF (Py_NotImplemented
);
515 return Py_NotImplemented
;
518 /* Implementation of BtraceList.__len__ (self) -> int. */
521 btpy_list_length (PyObject
*self
)
523 const btpy_list_object
* const obj
= (btpy_list_object
*) self
;
524 const Py_ssize_t distance
= obj
->last
- obj
->first
;
525 const Py_ssize_t result
= distance
/ obj
->step
;
527 if ((distance
% obj
->step
) == 0)
534 BtraceList.__getitem__ (self, key) -> BtraceInstruction and
535 BtraceList.__getitem__ (self, key) -> BtraceFunctionCall. */
538 btpy_list_item (PyObject
*self
, Py_ssize_t index
)
540 const btpy_list_object
* const obj
= (btpy_list_object
*) self
;
541 struct thread_info
* const tinfo
= find_thread_ptid (obj
->ptid
);
544 if (index
< 0 || index
>= btpy_list_length (self
))
545 return PyErr_Format (PyExc_IndexError
, _("Index out of range: %zd."),
548 number
= obj
->first
+ (obj
->step
* index
);
550 if (obj
->element_type
== &recpy_insn_type
)
551 return recpy_insn_new (obj
->ptid
, RECORD_METHOD_BTRACE
, number
);
553 return btpy_call_new (obj
->ptid
, number
);
556 /* Implementation of BtraceList.__getitem__ (self, slice) -> BtraceList. */
559 btpy_list_slice (PyObject
*self
, PyObject
*value
)
561 const btpy_list_object
* const obj
= (btpy_list_object
*) self
;
562 const Py_ssize_t length
= btpy_list_length (self
);
563 Py_ssize_t start
, stop
, step
, slicelength
;
565 if (PyInt_Check (value
))
567 Py_ssize_t index
= PyInt_AsSsize_t (value
);
569 /* Emulate Python behavior for negative indices. */
573 return btpy_list_item (self
, index
);
576 if (!PySlice_Check (value
))
577 return PyErr_Format (PyExc_TypeError
, _("Index must be int or slice."));
579 if (0 != PySlice_GetIndicesEx (BTPY_PYSLICE (value
), length
, &start
, &stop
,
580 &step
, &slicelength
))
583 return btpy_list_new (obj
->ptid
, obj
->first
+ obj
->step
* start
,
584 obj
->first
+ obj
->step
* stop
, obj
->step
* step
,
588 /* Helper function that returns the position of an element in a BtraceList
589 or -1 if the element is not in the list. */
592 btpy_list_position (PyObject
*self
, PyObject
*value
)
594 const btpy_list_object
* const list_obj
= (btpy_list_object
*) self
;
595 const recpy_element_object
* const obj
= (const recpy_element_object
*) value
;
596 Py_ssize_t index
= obj
->number
;
598 if (list_obj
->element_type
!= Py_TYPE (value
))
601 if (!ptid_equal (list_obj
->ptid
, obj
->ptid
))
604 if (index
< list_obj
->first
|| index
> list_obj
->last
)
607 index
-= list_obj
->first
;
609 if (index
% list_obj
->step
!= 0)
612 return index
/ list_obj
->step
;
615 /* Implementation of "in" operator for BtraceLists. */
618 btpy_list_contains (PyObject
*self
, PyObject
*value
)
620 if (btpy_list_position (self
, value
) < 0)
626 /* Implementation of BtraceLists.index (self, value) -> int. */
629 btpy_list_index (PyObject
*self
, PyObject
*value
)
631 const LONGEST index
= btpy_list_position (self
, value
);
634 return PyErr_Format (PyExc_ValueError
, _("Not in list."));
636 return gdb_py_long_from_longest (index
);
639 /* Implementation of BtraceList.count (self, value) -> int. */
642 btpy_list_count (PyObject
*self
, PyObject
*value
)
644 /* We know that if an element is in the list, it is so exactly one time,
645 enabling us to reuse the "is element of" check. */
646 return PyInt_FromLong (btpy_list_contains (self
, value
));
649 /* Python rich compare function to allow for equality and inequality checks
653 btpy_list_richcompare (PyObject
*self
, PyObject
*other
, int op
)
655 const btpy_list_object
* const obj1
= (btpy_list_object
*) self
;
656 const btpy_list_object
* const obj2
= (btpy_list_object
*) other
;
658 if (Py_TYPE (self
) != Py_TYPE (other
))
660 Py_INCREF (Py_NotImplemented
);
661 return Py_NotImplemented
;
667 if (ptid_equal (obj1
->ptid
, obj2
->ptid
)
668 && obj1
->element_type
== obj2
->element_type
669 && obj1
->first
== obj2
->first
670 && obj1
->last
== obj2
->last
671 && obj1
->step
== obj2
->step
)
677 if (!ptid_equal (obj1
->ptid
, obj2
->ptid
)
678 || obj1
->element_type
!= obj2
->element_type
679 || obj1
->first
!= obj2
->first
680 || obj1
->last
!= obj2
->last
681 || obj1
->step
!= obj2
->step
)
690 Py_INCREF (Py_NotImplemented
);
691 return Py_NotImplemented
;
695 BtraceRecord.method [str]. */
698 recpy_bt_method (PyObject
*self
, void *closure
)
700 return PyString_FromString ("btrace");
704 BtraceRecord.format [str]. */
707 recpy_bt_format (PyObject
*self
, void *closure
)
709 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
710 const struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
711 const struct btrace_config
* config
;
716 config
= btrace_conf (&tinfo
->btrace
);
721 return PyString_FromString (btrace_format_short_string (config
->format
));
725 BtraceRecord.replay_position [BtraceInstruction]. */
728 recpy_bt_replay_position (PyObject
*self
, void *closure
)
730 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
731 const struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
736 if (tinfo
->btrace
.replay
== NULL
)
739 return btpy_insn_or_gap_new (tinfo
,
740 btrace_insn_number (tinfo
->btrace
.replay
));
744 BtraceRecord.begin [BtraceInstruction]. */
747 recpy_bt_begin (PyObject
*self
, void *closure
)
749 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
750 struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
751 struct btrace_insn_iterator iterator
;
756 btrace_fetch (tinfo
);
758 if (btrace_is_empty (tinfo
))
761 btrace_insn_begin (&iterator
, &tinfo
->btrace
);
762 return btpy_insn_or_gap_new (tinfo
, btrace_insn_number (&iterator
));
766 BtraceRecord.end [BtraceInstruction]. */
769 recpy_bt_end (PyObject
*self
, void *closure
)
771 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
772 struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
773 struct btrace_insn_iterator iterator
;
778 btrace_fetch (tinfo
);
780 if (btrace_is_empty (tinfo
))
783 btrace_insn_end (&iterator
, &tinfo
->btrace
);
784 return btpy_insn_or_gap_new (tinfo
, btrace_insn_number (&iterator
));
788 BtraceRecord.instruction_history [list]. */
791 recpy_bt_instruction_history (PyObject
*self
, void *closure
)
793 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
794 struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
795 struct btrace_insn_iterator iterator
;
796 unsigned long first
= 0;
797 unsigned long last
= 0;
802 btrace_fetch (tinfo
);
804 if (btrace_is_empty (tinfo
))
807 btrace_insn_begin (&iterator
, &tinfo
->btrace
);
808 first
= btrace_insn_number (&iterator
);
810 btrace_insn_end (&iterator
, &tinfo
->btrace
);
811 last
= btrace_insn_number (&iterator
);
813 return btpy_list_new (record
->ptid
, first
, last
, 1, &recpy_insn_type
);
817 BtraceRecord.function_call_history [list]. */
820 recpy_bt_function_call_history (PyObject
*self
, void *closure
)
822 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
823 struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
824 struct btrace_call_iterator iterator
;
825 unsigned long first
= 0;
826 unsigned long last
= 0;
831 btrace_fetch (tinfo
);
833 if (btrace_is_empty (tinfo
))
836 btrace_call_begin (&iterator
, &tinfo
->btrace
);
837 first
= btrace_call_number (&iterator
);
839 btrace_call_end (&iterator
, &tinfo
->btrace
);
840 last
= btrace_call_number (&iterator
);
842 return btpy_list_new (record
->ptid
, first
, last
, 1, &btpy_call_type
);
845 /* Implementation of BtraceRecord.goto (self, BtraceInstruction) -> None. */
848 recpy_bt_goto (PyObject
*self
, PyObject
*args
)
850 const recpy_record_object
* const record
= (recpy_record_object
*) self
;
851 struct thread_info
* const tinfo
= find_thread_ptid (record
->ptid
);
852 const recpy_element_object
*obj
;
854 if (tinfo
== NULL
|| btrace_is_empty (tinfo
))
855 return PyErr_Format (gdbpy_gdb_error
, _("Empty branch trace."));
857 if (!PyArg_ParseTuple (args
, "O", &obj
))
860 if (Py_TYPE (obj
) != &recpy_insn_type
)
861 return PyErr_Format (PyExc_TypeError
, _("Argument must be instruction."));
865 struct btrace_insn_iterator iter
;
867 btrace_insn_end (&iter
, &tinfo
->btrace
);
869 if (btrace_insn_number (&iter
) == obj
->number
)
870 target_goto_record_end ();
872 target_goto_record (obj
->number
);
874 CATCH (except
, RETURN_MASK_ALL
)
876 GDB_PY_HANDLE_EXCEPTION (except
);
883 /* BtraceFunctionCall members. */
885 static gdb_PyGetSetDef btpy_call_getset
[] =
887 { "number", btpy_number
, NULL
, "function call number", NULL
},
888 { "level", btpy_call_level
, NULL
, "call stack level", NULL
},
889 { "symbol", btpy_call_symbol
, NULL
, "associated line and symbol", NULL
},
890 { "instructions", btpy_call_instructions
, NULL
, "list of instructions in \
891 this function segment", NULL
},
892 { "up", btpy_call_up
, NULL
, "caller or returned-to function segment", NULL
},
893 { "prev_sibling", btpy_call_prev_sibling
, NULL
, "previous segment of this \
895 { "next_sibling", btpy_call_next_sibling
, NULL
, "next segment of this \
900 /* BtraceList methods. */
902 struct PyMethodDef btpy_list_methods
[] =
904 { "count", btpy_list_count
, METH_O
, "count number of occurences"},
905 { "index", btpy_list_index
, METH_O
, "index of entry"},
909 /* BtraceList sequence methods. */
911 static PySequenceMethods btpy_list_sequence_methods
=
916 /* BtraceList mapping methods. Necessary for slicing. */
918 static PyMappingMethods btpy_list_mapping_methods
=
923 /* Sets up the btrace record API. */
926 gdbpy_initialize_btrace (void)
928 btpy_call_type
.tp_new
= PyType_GenericNew
;
929 btpy_call_type
.tp_flags
= Py_TPFLAGS_DEFAULT
;
930 btpy_call_type
.tp_basicsize
= sizeof (recpy_element_object
);
931 btpy_call_type
.tp_name
= "gdb.BtraceFunctionCall";
932 btpy_call_type
.tp_doc
= "GDB btrace call object";
933 btpy_call_type
.tp_getset
= btpy_call_getset
;
934 btpy_call_type
.tp_richcompare
= btpy_richcompare
;
935 btpy_call_type
.tp_hash
= btpy_hash
;
937 btpy_list_type
.tp_new
= PyType_GenericNew
;
938 btpy_list_type
.tp_flags
= Py_TPFLAGS_DEFAULT
;
939 btpy_list_type
.tp_basicsize
= sizeof (btpy_list_object
);
940 btpy_list_type
.tp_name
= "gdb.BtraceObjectList";
941 btpy_list_type
.tp_doc
= "GDB btrace list object";
942 btpy_list_type
.tp_methods
= btpy_list_methods
;
943 btpy_list_type
.tp_as_sequence
= &btpy_list_sequence_methods
;
944 btpy_list_type
.tp_as_mapping
= &btpy_list_mapping_methods
;
945 btpy_list_type
.tp_richcompare
= btpy_list_richcompare
;
947 btpy_list_sequence_methods
.sq_item
= btpy_list_item
;
948 btpy_list_sequence_methods
.sq_length
= btpy_list_length
;
949 btpy_list_sequence_methods
.sq_contains
= btpy_list_contains
;
951 btpy_list_mapping_methods
.mp_subscript
= btpy_list_slice
;
953 if (PyType_Ready (&btpy_call_type
) < 0
954 || PyType_Ready (&btpy_list_type
) < 0)