]> Git Repo - binutils.git/blob - gdb/python/py-frame.c
Make array object extern
[binutils.git] / gdb / python / py-frame.c
1 /* Python interface to stack frames
2
3    Copyright (C) 2008-2015 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
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.
11
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.
16
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/>.  */
19
20 #include "defs.h"
21 #include "charset.h"
22 #include "block.h"
23 #include "frame.h"
24 #include "symtab.h"
25 #include "stack.h"
26 #include "value.h"
27 #include "python-internal.h"
28 #include "symfile.h"
29 #include "objfiles.h"
30 #include "user-regs.h"
31
32 typedef struct {
33   PyObject_HEAD
34   struct frame_id frame_id;
35   struct gdbarch *gdbarch;
36
37   /* Marks that the FRAME_ID member actually holds the ID of the frame next
38      to this, and not this frames' ID itself.  This is a hack to permit Python
39      frame objects which represent invalid frames (i.e., the last frame_info
40      in a corrupt stack).  The problem arises from the fact that this code
41      relies on FRAME_ID to uniquely identify a frame, which is not always true
42      for the last "frame" in a corrupt stack (it can have a null ID, or the same
43      ID as the  previous frame).  Whenever get_prev_frame returns NULL, we
44      record the frame_id of the next frame and set FRAME_ID_IS_NEXT to 1.  */
45   int frame_id_is_next;
46 } frame_object;
47
48 /* Require a valid frame.  This must be called inside a TRY_CATCH, or
49    another context in which a gdb exception is allowed.  */
50 #define FRAPY_REQUIRE_VALID(frame_obj, frame)           \
51     do {                                                \
52       frame = frame_object_to_frame_info (frame_obj);   \
53       if (frame == NULL)                                \
54         error (_("Frame is invalid."));                 \
55     } while (0)
56
57 /* Returns the frame_info object corresponding to the given Python Frame
58    object.  If the frame doesn't exist anymore (the frame id doesn't
59    correspond to any frame in the inferior), returns NULL.  */
60
61 struct frame_info *
62 frame_object_to_frame_info (PyObject *obj)
63 {
64   frame_object *frame_obj = (frame_object *) obj;
65   struct frame_info *frame;
66
67   frame = frame_find_by_id (frame_obj->frame_id);
68   if (frame == NULL)
69     return NULL;
70
71   if (frame_obj->frame_id_is_next)
72     frame = get_prev_frame (frame);
73
74   return frame;
75 }
76
77 /* Called by the Python interpreter to obtain string representation
78    of the object.  */
79
80 static PyObject *
81 frapy_str (PyObject *self)
82 {
83   char *s;
84   PyObject *result;
85   struct ui_file *strfile;
86
87   strfile = mem_fileopen ();
88   fprint_frame_id (strfile, ((frame_object *) self)->frame_id);
89   s = ui_file_xstrdup (strfile, NULL);
90   result = PyString_FromString (s);
91   xfree (s);
92
93   return result;
94 }
95
96 /* Implementation of gdb.Frame.is_valid (self) -> Boolean.
97    Returns True if the frame corresponding to the frame_id of this
98    object still exists in the inferior.  */
99
100 static PyObject *
101 frapy_is_valid (PyObject *self, PyObject *args)
102 {
103   struct frame_info *frame = NULL;
104   volatile struct gdb_exception except;
105
106   TRY_CATCH (except, RETURN_MASK_ALL)
107     {
108       frame = frame_object_to_frame_info (self);
109     }
110   GDB_PY_HANDLE_EXCEPTION (except);
111
112   if (frame == NULL)
113     Py_RETURN_FALSE;
114
115   Py_RETURN_TRUE;
116 }
117
118 /* Implementation of gdb.Frame.name (self) -> String.
119    Returns the name of the function corresponding to this frame.  */
120
121 static PyObject *
122 frapy_name (PyObject *self, PyObject *args)
123 {
124   struct frame_info *frame;
125   char *name = NULL;
126   enum language lang;
127   PyObject *result;
128   volatile struct gdb_exception except;
129
130   TRY_CATCH (except, RETURN_MASK_ALL)
131     {
132       FRAPY_REQUIRE_VALID (self, frame);
133
134       find_frame_funname (frame, &name, &lang, NULL);
135     }
136
137   if (except.reason < 0)
138     xfree (name);
139
140   GDB_PY_HANDLE_EXCEPTION (except);
141
142   if (name)
143     {
144       result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
145       xfree (name);
146     }
147   else
148     {
149       result = Py_None;
150       Py_INCREF (Py_None);
151     }
152
153   return result;
154 }
155
156 /* Implementation of gdb.Frame.type (self) -> Integer.
157    Returns the frame type, namely one of the gdb.*_FRAME constants.  */
158
159 static PyObject *
160 frapy_type (PyObject *self, PyObject *args)
161 {
162   struct frame_info *frame;
163   enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning.  */
164   volatile struct gdb_exception except;
165
166   TRY_CATCH (except, RETURN_MASK_ALL)
167     {
168       FRAPY_REQUIRE_VALID (self, frame);
169
170       type = get_frame_type (frame);
171     }
172   GDB_PY_HANDLE_EXCEPTION (except);
173
174   return PyInt_FromLong (type);
175 }
176
177 /* Implementation of gdb.Frame.architecture (self) -> gdb.Architecture.
178    Returns the frame's architecture as a gdb.Architecture object.  */
179
180 static PyObject *
181 frapy_arch (PyObject *self, PyObject *args)
182 {
183   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
184   frame_object *obj = (frame_object *) self;
185   volatile struct gdb_exception except;
186
187   TRY_CATCH (except, RETURN_MASK_ALL)
188     {
189       FRAPY_REQUIRE_VALID (self, frame);
190     }
191   GDB_PY_HANDLE_EXCEPTION (except);
192
193   return gdbarch_to_arch_object (obj->gdbarch);
194 }
195
196 /* Implementation of gdb.Frame.unwind_stop_reason (self) -> Integer.
197    Returns one of the gdb.FRAME_UNWIND_* constants.  */
198
199 static PyObject *
200 frapy_unwind_stop_reason (PyObject *self, PyObject *args)
201 {
202   struct frame_info *frame = NULL;    /* Initialize to appease gcc warning.  */
203   volatile struct gdb_exception except;
204   enum unwind_stop_reason stop_reason;
205
206   TRY_CATCH (except, RETURN_MASK_ALL)
207     {
208       FRAPY_REQUIRE_VALID (self, frame);
209     }
210   GDB_PY_HANDLE_EXCEPTION (except);
211
212   stop_reason = get_frame_unwind_stop_reason (frame);
213
214   return PyInt_FromLong (stop_reason);
215 }
216
217 /* Implementation of gdb.Frame.pc (self) -> Long.
218    Returns the frame's resume address.  */
219
220 static PyObject *
221 frapy_pc (PyObject *self, PyObject *args)
222 {
223   CORE_ADDR pc = 0;           /* Initialize to appease gcc warning.  */
224   struct frame_info *frame;
225   volatile struct gdb_exception except;
226
227   TRY_CATCH (except, RETURN_MASK_ALL)
228     {
229       FRAPY_REQUIRE_VALID (self, frame);
230
231       pc = get_frame_pc (frame);
232     }
233   GDB_PY_HANDLE_EXCEPTION (except);
234
235   return gdb_py_long_from_ulongest (pc);
236 }
237
238 /* Implementation of gdb.Frame.read_register (self, register) -> gdb.Value.
239    Returns the value of a register in this frame.  */
240
241 static PyObject *
242 frapy_read_register (PyObject *self, PyObject *args)
243 {
244   volatile struct gdb_exception except;
245   const char *regnum_str;
246   struct value *val = NULL;
247
248   if (!PyArg_ParseTuple (args, "s", &regnum_str))
249     return NULL;
250
251   TRY_CATCH (except, RETURN_MASK_ALL)
252     {
253       struct frame_info *frame;
254       int regnum;
255
256       FRAPY_REQUIRE_VALID (self, frame);
257
258       regnum = user_reg_map_name_to_regnum (get_frame_arch (frame),
259                                             regnum_str,
260                                             strlen (regnum_str));
261       if (regnum >= 0)
262         val = value_of_register (regnum, frame);
263
264       if (val == NULL)
265         PyErr_SetString (PyExc_ValueError, _("Unknown register."));
266     }
267   GDB_PY_HANDLE_EXCEPTION (except);
268
269   return val == NULL ? NULL : value_to_value_object (val);
270 }
271
272 /* Implementation of gdb.Frame.block (self) -> gdb.Block.
273    Returns the frame's code block.  */
274
275 static PyObject *
276 frapy_block (PyObject *self, PyObject *args)
277 {
278   struct frame_info *frame;
279   const struct block *block = NULL, *fn_block;
280   volatile struct gdb_exception except;
281
282   TRY_CATCH (except, RETURN_MASK_ALL)
283     {
284       FRAPY_REQUIRE_VALID (self, frame);
285       block = get_frame_block (frame, NULL);
286     }
287   GDB_PY_HANDLE_EXCEPTION (except);
288
289   for (fn_block = block;
290        fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL;
291        fn_block = BLOCK_SUPERBLOCK (fn_block))
292     ;
293
294   if (block == NULL || fn_block == NULL || BLOCK_FUNCTION (fn_block) == NULL)
295     {
296       PyErr_SetString (PyExc_RuntimeError,
297                        _("Cannot locate block for frame."));
298       return NULL;
299     }
300
301   if (block)
302     {
303       return block_to_block_object
304         (block, symbol_objfile (BLOCK_FUNCTION (fn_block)));
305     }
306
307   Py_RETURN_NONE;
308 }
309
310
311 /* Implementation of gdb.Frame.function (self) -> gdb.Symbol.
312    Returns the symbol for the function corresponding to this frame.  */
313
314 static PyObject *
315 frapy_function (PyObject *self, PyObject *args)
316 {
317   struct symbol *sym = NULL;
318   struct frame_info *frame;
319   volatile struct gdb_exception except;
320
321   TRY_CATCH (except, RETURN_MASK_ALL)
322     {
323       FRAPY_REQUIRE_VALID (self, frame);
324
325       sym = find_pc_function (get_frame_address_in_block (frame));
326     }
327   GDB_PY_HANDLE_EXCEPTION (except);
328
329   if (sym)
330     return symbol_to_symbol_object (sym);
331
332   Py_RETURN_NONE;
333 }
334
335 /* Convert a frame_info struct to a Python Frame object.
336    Sets a Python exception and returns NULL on error.  */
337
338 PyObject *
339 frame_info_to_frame_object (struct frame_info *frame)
340 {
341   frame_object *frame_obj;
342   volatile struct gdb_exception except;
343
344   frame_obj = PyObject_New (frame_object, &frame_object_type);
345   if (frame_obj == NULL)
346     return NULL;
347
348   TRY_CATCH (except, RETURN_MASK_ALL)
349     {
350
351       /* Try to get the previous frame, to determine if this is the last frame
352          in a corrupt stack.  If so, we need to store the frame_id of the next
353          frame and not of this one (which is possibly invalid).  */
354       if (get_prev_frame (frame) == NULL
355           && get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
356           && get_next_frame (frame) != NULL)
357         {
358           frame_obj->frame_id = get_frame_id (get_next_frame (frame));
359           frame_obj->frame_id_is_next = 1;
360         }
361       else
362         {
363           frame_obj->frame_id = get_frame_id (frame);
364           frame_obj->frame_id_is_next = 0;
365         }
366       frame_obj->gdbarch = get_frame_arch (frame);
367     }
368   if (except.reason < 0)
369     {
370       Py_DECREF (frame_obj);
371       gdbpy_convert_exception (except);
372       return NULL;
373     }
374   return (PyObject *) frame_obj;
375 }
376
377 /* Implementation of gdb.Frame.older (self) -> gdb.Frame.
378    Returns the frame immediately older (outer) to this frame, or None if
379    there isn't one.  */
380
381 static PyObject *
382 frapy_older (PyObject *self, PyObject *args)
383 {
384   struct frame_info *frame, *prev = NULL;
385   volatile struct gdb_exception except;
386   PyObject *prev_obj = NULL;   /* Initialize to appease gcc warning.  */
387
388   TRY_CATCH (except, RETURN_MASK_ALL)
389     {
390       FRAPY_REQUIRE_VALID (self, frame);
391
392       prev = get_prev_frame (frame);
393     }
394   GDB_PY_HANDLE_EXCEPTION (except);
395
396   if (prev)
397     prev_obj = (PyObject *) frame_info_to_frame_object (prev);
398   else
399     {
400       Py_INCREF (Py_None);
401       prev_obj = Py_None;
402     }
403
404   return prev_obj;
405 }
406
407 /* Implementation of gdb.Frame.newer (self) -> gdb.Frame.
408    Returns the frame immediately newer (inner) to this frame, or None if
409    there isn't one.  */
410
411 static PyObject *
412 frapy_newer (PyObject *self, PyObject *args)
413 {
414   struct frame_info *frame, *next = NULL;
415   volatile struct gdb_exception except;
416   PyObject *next_obj = NULL;   /* Initialize to appease gcc warning.  */
417
418   TRY_CATCH (except, RETURN_MASK_ALL)
419     {
420       FRAPY_REQUIRE_VALID (self, frame);
421
422       next = get_next_frame (frame);
423     }
424   GDB_PY_HANDLE_EXCEPTION (except);
425
426   if (next)
427     next_obj = (PyObject *) frame_info_to_frame_object (next);
428   else
429     {
430       Py_INCREF (Py_None);
431       next_obj = Py_None;
432     }
433
434   return next_obj;
435 }
436
437 /* Implementation of gdb.Frame.find_sal (self) -> gdb.Symtab_and_line.
438    Returns the frame's symtab and line.  */
439
440 static PyObject *
441 frapy_find_sal (PyObject *self, PyObject *args)
442 {
443   struct frame_info *frame;
444   struct symtab_and_line sal;
445   volatile struct gdb_exception except;
446   PyObject *sal_obj = NULL;   /* Initialize to appease gcc warning.  */
447
448   TRY_CATCH (except, RETURN_MASK_ALL)
449     {
450       FRAPY_REQUIRE_VALID (self, frame);
451
452       find_frame_sal (frame, &sal);
453       sal_obj = symtab_and_line_to_sal_object (sal);
454     }
455   GDB_PY_HANDLE_EXCEPTION (except);
456
457   return sal_obj;
458 }
459
460 /* Implementation of gdb.Frame.read_var_value (self, variable,
461    [block]) -> gdb.Value.  If the optional block argument is provided
462    start the search from that block, otherwise search from the frame's
463    current block (determined by examining the resume address of the
464    frame).  The variable argument must be a string or an instance of a
465    gdb.Symbol.  The block argument must be an instance of gdb.Block.  Returns
466    NULL on error, with a python exception set.  */
467 static PyObject *
468 frapy_read_var (PyObject *self, PyObject *args)
469 {
470   struct frame_info *frame;
471   PyObject *sym_obj, *block_obj = NULL;
472   struct symbol *var = NULL;    /* gcc-4.3.2 false warning.  */
473   struct value *val = NULL;
474   volatile struct gdb_exception except;
475
476   if (!PyArg_ParseTuple (args, "O|O", &sym_obj, &block_obj))
477     return NULL;
478
479   if (PyObject_TypeCheck (sym_obj, &symbol_object_type))
480     var = symbol_object_to_symbol (sym_obj);
481   else if (gdbpy_is_string (sym_obj))
482     {
483       char *var_name;
484       const struct block *block = NULL;
485       struct cleanup *cleanup;
486       volatile struct gdb_exception except;
487
488       var_name = python_string_to_target_string (sym_obj);
489       if (!var_name)
490         return NULL;
491       cleanup = make_cleanup (xfree, var_name);
492
493       if (block_obj)
494         {
495           block = block_object_to_block (block_obj);
496           if (!block)
497             {
498               PyErr_SetString (PyExc_RuntimeError,
499                                _("Second argument must be block."));
500               do_cleanups (cleanup);
501               return NULL;
502             }
503         }
504
505       TRY_CATCH (except, RETURN_MASK_ALL)
506         {
507           FRAPY_REQUIRE_VALID (self, frame);
508
509           if (!block)
510             block = get_frame_block (frame, NULL);
511           var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
512         }
513       if (except.reason < 0)
514         {
515           do_cleanups (cleanup);
516           gdbpy_convert_exception (except);
517           return NULL;
518         }
519
520       if (!var)
521         {
522           PyErr_Format (PyExc_ValueError,
523                         _("Variable '%s' not found."), var_name);
524           do_cleanups (cleanup);
525
526           return NULL;
527         }
528
529       do_cleanups (cleanup);
530     }
531   else
532     {
533       PyErr_SetString (PyExc_TypeError,
534                        _("Argument must be a symbol or string."));
535       return NULL;
536     }
537
538   TRY_CATCH (except, RETURN_MASK_ALL)
539     {
540       FRAPY_REQUIRE_VALID (self, frame);
541
542       val = read_var_value (var, frame);
543     }
544   GDB_PY_HANDLE_EXCEPTION (except);
545
546   return value_to_value_object (val);
547 }
548
549 /* Select this frame.  */
550
551 static PyObject *
552 frapy_select (PyObject *self, PyObject *args)
553 {
554   struct frame_info *fi;
555   volatile struct gdb_exception except;
556
557   TRY_CATCH (except, RETURN_MASK_ALL)
558     {
559       FRAPY_REQUIRE_VALID (self, fi);
560
561       select_frame (fi);
562     }
563   GDB_PY_HANDLE_EXCEPTION (except);
564
565   Py_RETURN_NONE;
566 }
567
568 /* Implementation of gdb.newest_frame () -> gdb.Frame.
569    Returns the newest frame object.  */
570
571 PyObject *
572 gdbpy_newest_frame (PyObject *self, PyObject *args)
573 {
574   struct frame_info *frame = NULL;
575   volatile struct gdb_exception except;
576
577   TRY_CATCH (except, RETURN_MASK_ALL)
578     {
579       frame = get_current_frame ();
580     }
581   GDB_PY_HANDLE_EXCEPTION (except);
582
583   return frame_info_to_frame_object (frame);
584 }
585
586 /* Implementation of gdb.selected_frame () -> gdb.Frame.
587    Returns the selected frame object.  */
588
589 PyObject *
590 gdbpy_selected_frame (PyObject *self, PyObject *args)
591 {
592   struct frame_info *frame = NULL;
593   volatile struct gdb_exception except;
594
595   TRY_CATCH (except, RETURN_MASK_ALL)
596     {
597       frame = get_selected_frame ("No frame is currently selected.");
598     }
599   GDB_PY_HANDLE_EXCEPTION (except);
600
601   return frame_info_to_frame_object (frame);
602 }
603
604 /* Implementation of gdb.stop_reason_string (Integer) -> String.
605    Return a string explaining the unwind stop reason.  */
606
607 PyObject *
608 gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
609 {
610   int reason;
611   const char *str;
612
613   if (!PyArg_ParseTuple (args, "i", &reason))
614     return NULL;
615
616   if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
617     {
618       PyErr_SetString (PyExc_ValueError,
619                        _("Invalid frame stop reason."));
620       return NULL;
621     }
622
623   str = unwind_stop_reason_to_string (reason);
624   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
625 }
626
627 /* Implements the equality comparison for Frame objects.
628    All other comparison operators will throw a TypeError Python exception,
629    as they aren't valid for frames.  */
630
631 static PyObject *
632 frapy_richcompare (PyObject *self, PyObject *other, int op)
633 {
634   int result;
635
636   if (!PyObject_TypeCheck (other, &frame_object_type)
637       || (op != Py_EQ && op != Py_NE))
638     {
639       Py_INCREF (Py_NotImplemented);
640       return Py_NotImplemented;
641     }
642
643   if (frame_id_eq (((frame_object *) self)->frame_id,
644                    ((frame_object *) other)->frame_id))
645     result = Py_EQ;
646   else
647     result = Py_NE;
648
649   if (op == result)
650     Py_RETURN_TRUE;
651   Py_RETURN_FALSE;
652 }
653
654 /* Sets up the Frame API in the gdb module.  */
655
656 int
657 gdbpy_initialize_frames (void)
658 {
659   frame_object_type.tp_new = PyType_GenericNew;
660   if (PyType_Ready (&frame_object_type) < 0)
661     return -1;
662
663   /* Note: These would probably be best exposed as class attributes of
664      Frame, but I don't know how to do it except by messing with the
665      type's dictionary.  That seems too messy.  */
666   if (PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME) < 0
667       || PyModule_AddIntConstant (gdb_module, "DUMMY_FRAME", DUMMY_FRAME) < 0
668       || PyModule_AddIntConstant (gdb_module, "INLINE_FRAME", INLINE_FRAME) < 0
669       || PyModule_AddIntConstant (gdb_module, "TAILCALL_FRAME",
670                                   TAILCALL_FRAME) < 0
671       || PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME",
672                                   SIGTRAMP_FRAME) < 0
673       || PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME) < 0
674       || PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME",
675                                   SENTINEL_FRAME) < 0)
676     return -1;
677
678 #define SET(name, description) \
679   if (PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name) < 0) \
680     return -1;
681 #include "unwind_stop_reasons.def"
682 #undef SET
683
684   return gdb_pymodule_addobject (gdb_module, "Frame",
685                                  (PyObject *) &frame_object_type);
686 }
687
688 \f
689
690 static PyMethodDef frame_object_methods[] = {
691   { "is_valid", frapy_is_valid, METH_NOARGS,
692     "is_valid () -> Boolean.\n\
693 Return true if this frame is valid, false if not." },
694   { "name", frapy_name, METH_NOARGS,
695     "name () -> String.\n\
696 Return the function name of the frame, or None if it can't be determined." },
697   { "type", frapy_type, METH_NOARGS,
698     "type () -> Integer.\n\
699 Return the type of the frame." },
700   { "architecture", frapy_arch, METH_NOARGS,
701     "architecture () -> gdb.Architecture.\n\
702 Return the architecture of the frame." },
703   { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
704     "unwind_stop_reason () -> Integer.\n\
705 Return the reason why it's not possible to find frames older than this." },
706   { "pc", frapy_pc, METH_NOARGS,
707     "pc () -> Long.\n\
708 Return the frame's resume address." },
709   { "read_register", frapy_read_register, METH_VARARGS,
710     "read_register (register_name) -> gdb.Value\n\
711 Return the value of the register in the frame." },
712   { "block", frapy_block, METH_NOARGS,
713     "block () -> gdb.Block.\n\
714 Return the frame's code block." },
715   { "function", frapy_function, METH_NOARGS,
716     "function () -> gdb.Symbol.\n\
717 Returns the symbol for the function corresponding to this frame." },
718   { "older", frapy_older, METH_NOARGS,
719     "older () -> gdb.Frame.\n\
720 Return the frame that called this frame." },
721   { "newer", frapy_newer, METH_NOARGS,
722     "newer () -> gdb.Frame.\n\
723 Return the frame called by this frame." },
724   { "find_sal", frapy_find_sal, METH_NOARGS,
725     "find_sal () -> gdb.Symtab_and_line.\n\
726 Return the frame's symtab and line." },
727   { "read_var", frapy_read_var, METH_VARARGS,
728     "read_var (variable) -> gdb.Value.\n\
729 Return the value of the variable in this frame." },
730   { "select", frapy_select, METH_NOARGS,
731     "Select this frame as the user's current frame." },
732   {NULL}  /* Sentinel */
733 };
734
735 PyTypeObject frame_object_type = {
736   PyVarObject_HEAD_INIT (NULL, 0)
737   "gdb.Frame",                    /* tp_name */
738   sizeof (frame_object),          /* tp_basicsize */
739   0,                              /* tp_itemsize */
740   0,                              /* tp_dealloc */
741   0,                              /* tp_print */
742   0,                              /* tp_getattr */
743   0,                              /* tp_setattr */
744   0,                              /* tp_compare */
745   0,                              /* tp_repr */
746   0,                              /* tp_as_number */
747   0,                              /* tp_as_sequence */
748   0,                              /* tp_as_mapping */
749   0,                              /* tp_hash  */
750   0,                              /* tp_call */
751   frapy_str,                      /* tp_str */
752   0,                              /* tp_getattro */
753   0,                              /* tp_setattro */
754   0,                              /* tp_as_buffer */
755   Py_TPFLAGS_DEFAULT,             /* tp_flags */
756   "GDB frame object",             /* tp_doc */
757   0,                              /* tp_traverse */
758   0,                              /* tp_clear */
759   frapy_richcompare,              /* tp_richcompare */
760   0,                              /* tp_weaklistoffset */
761   0,                              /* tp_iter */
762   0,                              /* tp_iternext */
763   frame_object_methods,           /* tp_methods */
764   0,                              /* tp_members */
765   0,                              /* tp_getset */
766   0,                              /* tp_base */
767   0,                              /* tp_dict */
768   0,                              /* tp_descr_get */
769   0,                              /* tp_descr_set */
770   0,                              /* tp_dictoffset */
771   0,                              /* tp_init */
772   0,                              /* tp_alloc */
773 };
This page took 0.068671 seconds and 4 git commands to generate.