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