GDB (xrefs)
Loading...
Searching...
No Matches
py-frame.c
Go to the documentation of this file.
1/* Python interface to stack frames
2
3 Copyright (C) 2008-2023 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 "language.h"
22#include "charset.h"
23#include "block.h"
24#include "frame.h"
25#include "symtab.h"
26#include "stack.h"
27#include "value.h"
28#include "python-internal.h"
29#include "symfile.h"
30#include "objfiles.h"
31
33 PyObject_HEAD
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. */
46};
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
63{
64 frame_object *frame_obj = (frame_object *) obj;
65 frame_info_ptr 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
80static PyObject *
82{
83 const frame_id &fid = ((frame_object *) self)->frame_id;
84 return PyUnicode_FromString (fid.to_string ().c_str ());
85}
86
87/* Implementation of gdb.Frame.is_valid (self) -> Boolean.
88 Returns True if the frame corresponding to the frame_id of this
89 object still exists in the inferior. */
90
91static PyObject *
93{
94 frame_info_ptr frame = NULL;
95
96 try
97 {
98 frame = frame_object_to_frame_info (self);
99 }
100 catch (const gdb_exception &except)
101 {
103 }
104
105 if (frame == NULL)
106 Py_RETURN_FALSE;
107
108 Py_RETURN_TRUE;
109}
110
111/* Implementation of gdb.Frame.name (self) -> String.
112 Returns the name of the function corresponding to this frame. */
113
114static PyObject *
116{
117 frame_info_ptr frame;
118 gdb::unique_xmalloc_ptr<char> name;
119 enum language lang;
120 PyObject *result;
121
122 try
123 {
124 FRAPY_REQUIRE_VALID (self, frame);
125
126 name = find_frame_funname (frame, &lang, NULL);
127 }
128 catch (const gdb_exception &except)
129 {
131 }
132
133 if (name)
134 {
135 result = PyUnicode_Decode (name.get (), strlen (name.get ()),
136 host_charset (), NULL);
137 }
138 else
139 {
140 result = Py_None;
141 Py_INCREF (Py_None);
142 }
143
144 return result;
145}
146
147/* Implementation of gdb.Frame.type (self) -> Integer.
148 Returns the frame type, namely one of the gdb.*_FRAME constants. */
149
150static PyObject *
152{
153 frame_info_ptr frame;
154 enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */
155
156 try
157 {
158 FRAPY_REQUIRE_VALID (self, frame);
159
160 type = get_frame_type (frame);
161 }
162 catch (const gdb_exception &except)
163 {
165 }
166
167 return gdb_py_object_from_longest (type).release ();
168}
169
170/* Implementation of gdb.Frame.architecture (self) -> gdb.Architecture.
171 Returns the frame's architecture as a gdb.Architecture object. */
172
173static PyObject *
175{
176 frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
177 frame_object *obj = (frame_object *) self;
178
179 try
180 {
181 FRAPY_REQUIRE_VALID (self, frame);
182 }
183 catch (const gdb_exception &except)
184 {
186 }
187
188 return gdbarch_to_arch_object (obj->gdbarch);
189}
190
191/* Implementation of gdb.Frame.unwind_stop_reason (self) -> Integer.
192 Returns one of the gdb.FRAME_UNWIND_* constants. */
193
194static PyObject *
196{
197 frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
198 enum unwind_stop_reason stop_reason;
199
200 try
201 {
202 FRAPY_REQUIRE_VALID (self, frame);
203 }
204 catch (const gdb_exception &except)
205 {
207 }
208
209 stop_reason = get_frame_unwind_stop_reason (frame);
210
211 return gdb_py_object_from_longest (stop_reason).release ();
212}
213
214/* Implementation of gdb.Frame.pc (self) -> Long.
215 Returns the frame's resume address. */
216
217static PyObject *
219{
220 CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
221 frame_info_ptr frame;
222
223 try
224 {
225 FRAPY_REQUIRE_VALID (self, frame);
226
227 pc = get_frame_pc (frame);
228 }
229 catch (const gdb_exception &except)
230 {
232 }
233
234 return gdb_py_object_from_ulongest (pc).release ();
235}
236
237/* Implementation of gdb.Frame.read_register (self, register) -> gdb.Value.
238 Returns the value of a register in this frame. */
239
240static PyObject *
242{
243 PyObject *pyo_reg_id;
244 PyObject *result = nullptr;
245
246 static const char *keywords[] = { "register", nullptr };
247 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &pyo_reg_id))
248 return nullptr;
249
250 try
251 {
252 scoped_value_mark free_values;
253 frame_info_ptr frame;
254 int regnum;
255
256 FRAPY_REQUIRE_VALID (self, frame);
257
258 if (!gdbpy_parse_register_id (get_frame_arch (frame), pyo_reg_id,
259 &regnum))
260 return nullptr;
261
262 gdb_assert (regnum >= 0);
263 struct value *val = value_of_register (regnum, frame);
264
265 if (val == NULL)
266 PyErr_SetString (PyExc_ValueError, _("Can't read register."));
267 else
268 result = value_to_value_object (val);
269 }
270 catch (const gdb_exception &except)
271 {
273 }
274
275 return result;
276}
277
278/* Implementation of gdb.Frame.block (self) -> gdb.Block.
279 Returns the frame's code block. */
280
281static PyObject *
283{
284 frame_info_ptr frame;
285 const struct block *block = NULL, *fn_block;
286
287 try
288 {
289 FRAPY_REQUIRE_VALID (self, frame);
290 block = get_frame_block (frame, NULL);
291 }
292 catch (const gdb_exception &except)
293 {
295 }
296
297 for (fn_block = block;
298 fn_block != NULL && fn_block->function () == NULL;
299 fn_block = fn_block->superblock ())
300 ;
301
302 if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
303 {
304 PyErr_SetString (PyExc_RuntimeError,
305 _("Cannot locate block for frame."));
306 return NULL;
307 }
308
309 return block_to_block_object (block, fn_block->function ()->objfile ());
310}
311
312
313/* Implementation of gdb.Frame.function (self) -> gdb.Symbol.
314 Returns the symbol for the function corresponding to this frame. */
315
316static PyObject *
318{
319 struct symbol *sym = NULL;
320 frame_info_ptr frame;
321
322 try
323 {
324 enum language funlang;
325
326 FRAPY_REQUIRE_VALID (self, frame);
327
328 gdb::unique_xmalloc_ptr<char> funname
329 = find_frame_funname (frame, &funlang, &sym);
330 }
331 catch (const gdb_exception &except)
332 {
334 }
335
336 if (sym)
337 return symbol_to_symbol_object (sym);
338
339 Py_RETURN_NONE;
340}
341
342/* Convert a frame_info struct to a Python Frame object.
343 Sets a Python exception and returns NULL on error. */
344
345PyObject *
347{
348 gdbpy_ref<frame_object> frame_obj (PyObject_New (frame_object,
350 if (frame_obj == NULL)
351 return NULL;
352
353 try
354 {
355
356 /* Try to get the previous frame, to determine if this is the last frame
357 in a corrupt stack. If so, we need to store the frame_id of the next
358 frame and not of this one (which is possibly invalid). */
359 if (get_prev_frame (frame) == NULL
360 && get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
361 && get_next_frame (frame) != NULL)
362 {
363 frame_obj->frame_id = get_frame_id (get_next_frame (frame));
364 frame_obj->frame_id_is_next = 1;
365 }
366 else
367 {
368 frame_obj->frame_id = get_frame_id (frame);
369 frame_obj->frame_id_is_next = 0;
370 }
371 frame_obj->gdbarch = get_frame_arch (frame);
372 }
373 catch (const gdb_exception &except)
374 {
376 return NULL;
377 }
378
379 return (PyObject *) frame_obj.release ();
380}
381
382/* Implementation of gdb.Frame.older (self) -> gdb.Frame.
383 Returns the frame immediately older (outer) to this frame, or None if
384 there isn't one. */
385
386static PyObject *
388{
389 frame_info_ptr frame, prev = NULL;
390 PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
391
392 try
393 {
394 FRAPY_REQUIRE_VALID (self, frame);
395
396 prev = get_prev_frame (frame);
397 }
398 catch (const gdb_exception &except)
399 {
401 }
402
403 if (prev)
404 prev_obj = frame_info_to_frame_object (prev);
405 else
406 {
407 Py_INCREF (Py_None);
408 prev_obj = Py_None;
409 }
410
411 return prev_obj;
412}
413
414/* Implementation of gdb.Frame.newer (self) -> gdb.Frame.
415 Returns the frame immediately newer (inner) to this frame, or None if
416 there isn't one. */
417
418static PyObject *
420{
421 frame_info_ptr frame, next = NULL;
422 PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
423
424 try
425 {
426 FRAPY_REQUIRE_VALID (self, frame);
427
428 next = get_next_frame (frame);
429 }
430 catch (const gdb_exception &except)
431 {
433 }
434
435 if (next)
436 next_obj = frame_info_to_frame_object (next);
437 else
438 {
439 Py_INCREF (Py_None);
440 next_obj = Py_None;
441 }
442
443 return next_obj;
444}
445
446/* Implementation of gdb.Frame.find_sal (self) -> gdb.Symtab_and_line.
447 Returns the frame's symtab and line. */
448
449static PyObject *
451{
452 frame_info_ptr frame;
453 PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
454
455 try
456 {
457 FRAPY_REQUIRE_VALID (self, frame);
458
459 symtab_and_line sal = find_frame_sal (frame);
460 sal_obj = symtab_and_line_to_sal_object (sal);
461 }
462 catch (const gdb_exception &except)
463 {
465 }
466
467 return sal_obj;
468}
469
470/* Implementation of gdb.Frame.read_var_value (self, variable,
471 [block]) -> gdb.Value. If the optional block argument is provided
472 start the search from that block, otherwise search from the frame's
473 current block (determined by examining the resume address of the
474 frame). The variable argument must be a string or an instance of a
475 gdb.Symbol. The block argument must be an instance of gdb.Block. Returns
476 NULL on error, with a python exception set. */
477static PyObject *
479{
480 frame_info_ptr frame;
481 PyObject *sym_obj, *block_obj = NULL;
482 struct symbol *var = NULL; /* gcc-4.3.2 false warning. */
483 const struct block *block = NULL;
484
485 static const char *keywords[] = { "variable", "block", nullptr };
486 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|O!", keywords,
487 &sym_obj, &block_object_type,
488 &block_obj))
489 return nullptr;
490
491 if (PyObject_TypeCheck (sym_obj, &symbol_object_type))
492 var = symbol_object_to_symbol (sym_obj);
493 else if (gdbpy_is_string (sym_obj))
494 {
495 gdb::unique_xmalloc_ptr<char>
496 var_name (python_string_to_target_string (sym_obj));
497
498 if (!var_name)
499 return NULL;
500
501 if (block_obj != nullptr)
502 {
503 /* This call should only fail if the type of BLOCK_OBJ is wrong,
504 and we ensure the type is correct when we parse the arguments,
505 so we can just assert the return value is not nullptr. */
506 block = block_object_to_block (block_obj);
507 gdb_assert (block != nullptr);
508 }
509
510 try
511 {
512 struct block_symbol lookup_sym;
513 FRAPY_REQUIRE_VALID (self, frame);
514
515 if (!block)
516 block = get_frame_block (frame, NULL);
517 lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL);
518 var = lookup_sym.symbol;
519 block = lookup_sym.block;
520 }
521 catch (const gdb_exception &except)
522 {
524 return NULL;
525 }
526
527 if (!var)
528 {
529 PyErr_Format (PyExc_ValueError,
530 _("Variable '%s' not found."), var_name.get ());
531
532 return NULL;
533 }
534 }
535 else
536 {
537 PyErr_Format (PyExc_TypeError,
538 _("argument 1 must be gdb.Symbol or str, not %s"),
539 Py_TYPE (sym_obj)->tp_name);
540 return NULL;
541 }
542
543 PyObject *result = nullptr;
544 try
545 {
546 FRAPY_REQUIRE_VALID (self, frame);
547
548 scoped_value_mark free_values;
549 struct value *val = read_var_value (var, block, frame);
550 result = value_to_value_object (val);
551 }
552 catch (const gdb_exception &except)
553 {
555 }
556
557 return result;
558}
559
560/* Select this frame. */
561
562static PyObject *
564{
566
567 try
568 {
569 FRAPY_REQUIRE_VALID (self, fi);
570
571 select_frame (fi);
572 }
573 catch (const gdb_exception &except)
574 {
576 }
577
578 Py_RETURN_NONE;
579}
580
581/* The stack frame level for this frame. */
582
583static PyObject *
585{
587
588 try
589 {
590 FRAPY_REQUIRE_VALID (self, fi);
591
592 return gdb_py_object_from_longest (frame_relative_level (fi)).release ();
593 }
594 catch (const gdb_exception &except)
595 {
597 }
598
599 Py_RETURN_NONE;
600}
601
602/* The language for this frame. */
603
604static PyObject *
606{
607 try
608 {
610 FRAPY_REQUIRE_VALID (self, fi);
611
612 enum language lang = get_frame_language (fi);
613 const language_defn *lang_def = language_def (lang);
614
615 return host_string_to_python_string (lang_def->name ()).release ();
616 }
617 catch (const gdb_exception &except)
618 {
620 }
621
622 Py_RETURN_NONE;
623}
624
625/* The static link for this frame. */
626
627static PyObject *
629{
630 frame_info_ptr link;
631
632 try
633 {
634 FRAPY_REQUIRE_VALID (self, link);
635
636 link = frame_follow_static_link (link);
637 }
638 catch (const gdb_exception &except)
639 {
641 }
642
643 if (link == nullptr)
644 Py_RETURN_NONE;
645
646 return frame_info_to_frame_object (link);
647}
648
649/* Implementation of gdb.newest_frame () -> gdb.Frame.
650 Returns the newest frame object. */
651
652PyObject *
654{
655 frame_info_ptr frame = NULL;
656
657 try
658 {
659 frame = get_current_frame ();
660 }
661 catch (const gdb_exception &except)
662 {
664 }
665
666 return frame_info_to_frame_object (frame);
667}
668
669/* Implementation of gdb.selected_frame () -> gdb.Frame.
670 Returns the selected frame object. */
671
672PyObject *
674{
675 frame_info_ptr frame = NULL;
676
677 try
678 {
679 frame = get_selected_frame ("No frame is currently selected.");
680 }
681 catch (const gdb_exception &except)
682 {
684 }
685
686 return frame_info_to_frame_object (frame);
687}
688
689/* Implementation of gdb.stop_reason_string (Integer) -> String.
690 Return a string explaining the unwind stop reason. */
691
692PyObject *
694{
695 int reason;
696 const char *str;
697
698 if (!PyArg_ParseTuple (args, "i", &reason))
699 return NULL;
700
701 if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
702 {
703 PyErr_SetString (PyExc_ValueError,
704 _("Invalid frame stop reason."));
705 return NULL;
706 }
707
709 return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
710}
711
712/* Implements the equality comparison for Frame objects.
713 All other comparison operators will throw a TypeError Python exception,
714 as they aren't valid for frames. */
715
716static PyObject *
717frapy_richcompare (PyObject *self, PyObject *other, int op)
718{
719 int result;
720
721 if (!PyObject_TypeCheck (other, &frame_object_type)
722 || (op != Py_EQ && op != Py_NE))
723 {
724 Py_INCREF (Py_NotImplemented);
725 return Py_NotImplemented;
726 }
727
728 frame_object *self_frame = (frame_object *) self;
729 frame_object *other_frame = (frame_object *) other;
730
731 if (self_frame->frame_id_is_next == other_frame->frame_id_is_next
732 && self_frame->frame_id == other_frame->frame_id)
733 result = Py_EQ;
734 else
735 result = Py_NE;
736
737 if (op == result)
738 Py_RETURN_TRUE;
739 Py_RETURN_FALSE;
740}
741
742/* Sets up the Frame API in the gdb module. */
743
746{
747 frame_object_type.tp_new = PyType_GenericNew;
748 if (PyType_Ready (&frame_object_type) < 0)
749 return -1;
750
751 /* Note: These would probably be best exposed as class attributes of
752 Frame, but I don't know how to do it except by messing with the
753 type's dictionary. That seems too messy. */
754 if (PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME) < 0
755 || PyModule_AddIntConstant (gdb_module, "DUMMY_FRAME", DUMMY_FRAME) < 0
756 || PyModule_AddIntConstant (gdb_module, "INLINE_FRAME", INLINE_FRAME) < 0
757 || PyModule_AddIntConstant (gdb_module, "TAILCALL_FRAME",
758 TAILCALL_FRAME) < 0
759 || PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME",
760 SIGTRAMP_FRAME) < 0
761 || PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME) < 0
762 || PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME",
763 SENTINEL_FRAME) < 0)
764 return -1;
765
766#define SET(name, description) \
767 if (PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name) < 0) \
768 return -1;
769#include "unwind_stop_reasons.def"
770#undef SET
771
772 return gdb_pymodule_addobject (gdb_module, "Frame",
774}
775
777
778
779
780static PyMethodDef frame_object_methods[] = {
781 { "is_valid", frapy_is_valid, METH_NOARGS,
782 "is_valid () -> Boolean.\n\
783Return true if this frame is valid, false if not." },
784 { "name", frapy_name, METH_NOARGS,
785 "name () -> String.\n\
786Return the function name of the frame, or None if it can't be determined." },
787 { "type", frapy_type, METH_NOARGS,
788 "type () -> Integer.\n\
789Return the type of the frame." },
790 { "architecture", frapy_arch, METH_NOARGS,
791 "architecture () -> gdb.Architecture.\n\
792Return the architecture of the frame." },
793 { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
794 "unwind_stop_reason () -> Integer.\n\
795Return the reason why it's not possible to find frames older than this." },
796 { "pc", frapy_pc, METH_NOARGS,
797 "pc () -> Long.\n\
798Return the frame's resume address." },
799 { "read_register", (PyCFunction) frapy_read_register,
800 METH_VARARGS | METH_KEYWORDS,
801 "read_register (register_name) -> gdb.Value\n\
802Return the value of the register in the frame." },
803 { "block", frapy_block, METH_NOARGS,
804 "block () -> gdb.Block.\n\
805Return the frame's code block." },
806 { "function", frapy_function, METH_NOARGS,
807 "function () -> gdb.Symbol.\n\
808Returns the symbol for the function corresponding to this frame." },
809 { "older", frapy_older, METH_NOARGS,
810 "older () -> gdb.Frame.\n\
811Return the frame that called this frame." },
812 { "newer", frapy_newer, METH_NOARGS,
813 "newer () -> gdb.Frame.\n\
814Return the frame called by this frame." },
815 { "find_sal", frapy_find_sal, METH_NOARGS,
816 "find_sal () -> gdb.Symtab_and_line.\n\
817Return the frame's symtab and line." },
818 { "read_var", (PyCFunction) frapy_read_var, METH_VARARGS | METH_KEYWORDS,
819 "read_var (variable) -> gdb.Value.\n\
820Return the value of the variable in this frame." },
821 { "select", frapy_select, METH_NOARGS,
822 "Select this frame as the user's current frame." },
823 { "level", frapy_level, METH_NOARGS,
824 "The stack level of this frame." },
825 { "language", frapy_language, METH_NOARGS,
826 "The language of this frame." },
827 { "static_link", frapy_static_link, METH_NOARGS,
828 "The static link of this frame, or None." },
829 {NULL} /* Sentinel */
830};
831
832PyTypeObject frame_object_type = {
833 PyVarObject_HEAD_INIT (NULL, 0)
834 "gdb.Frame", /* tp_name */
835 sizeof (frame_object), /* tp_basicsize */
836 0, /* tp_itemsize */
837 0, /* tp_dealloc */
838 0, /* tp_print */
839 0, /* tp_getattr */
840 0, /* tp_setattr */
841 0, /* tp_compare */
842 0, /* tp_repr */
843 0, /* tp_as_number */
844 0, /* tp_as_sequence */
845 0, /* tp_as_mapping */
846 0, /* tp_hash */
847 0, /* tp_call */
848 frapy_str, /* tp_str */
849 0, /* tp_getattro */
850 0, /* tp_setattro */
851 0, /* tp_as_buffer */
852 Py_TPFLAGS_DEFAULT, /* tp_flags */
853 "GDB frame object", /* tp_doc */
854 0, /* tp_traverse */
855 0, /* tp_clear */
856 frapy_richcompare, /* tp_richcompare */
857 0, /* tp_weaklistoffset */
858 0, /* tp_iter */
859 0, /* tp_iternext */
860 frame_object_methods, /* tp_methods */
861 0, /* tp_members */
862 0, /* tp_getset */
863 0, /* tp_base */
864 0, /* tp_dict */
865 0, /* tp_descr_get */
866 0, /* tp_descr_set */
867 0, /* tp_dictoffset */
868 0, /* tp_init */
869 0, /* tp_alloc */
870};
int regnum
const char *const name
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
Definition blockframe.c:55
const char * host_charset(void)
Definition charset.c:416
language
Definition defs.h:211
struct value * value_of_register(int regnum, frame_info_ptr frame)
Definition findvar.c:253
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition findvar.c:739
frame_info_ptr get_next_frame(frame_info_ptr this_frame)
Definition frame.c:2068
enum unwind_stop_reason get_frame_unwind_stop_reason(frame_info_ptr frame)
Definition frame.c:3166
int frame_relative_level(frame_info_ptr fi)
Definition frame.c:2946
frame_info_ptr frame_follow_static_link(frame_info_ptr frame)
Definition frame.c:3127
void select_frame(frame_info_ptr fi)
Definition frame.c:1927
CORE_ADDR get_frame_pc(frame_info_ptr frame)
Definition frame.c:2712
const char * unwind_stop_reason_to_string(enum unwind_stop_reason reason)
Definition frame.c:3178
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
Definition frame.c:3027
enum frame_type get_frame_type(frame_info_ptr frame)
Definition frame.c:2955
frame_info_ptr get_selected_frame(const char *message)
Definition frame.c:1888
frame_info_ptr frame_find_by_id(struct frame_id id)
Definition frame.c:916
enum language get_frame_language(frame_info_ptr frame)
Definition frame.c:3074
frame_info_ptr get_current_frame(void)
Definition frame.c:1670
struct frame_id get_frame_id(frame_info_ptr fi)
Definition frame.c:631
frame_info_ptr get_prev_frame(frame_info_ptr this_frame)
Definition frame.c:2614
symtab_and_line find_frame_sal(frame_info_ptr frame)
Definition frame.c:2821
frame_type
Definition frame.h:184
@ ARCH_FRAME
Definition frame.h:200
@ DUMMY_FRAME
Definition frame.h:190
@ TAILCALL_FRAME
Definition frame.h:195
@ SIGTRAMP_FRAME
Definition frame.h:198
@ NORMAL_FRAME
Definition frame.h:187
@ SENTINEL_FRAME
Definition frame.h:203
@ INLINE_FRAME
Definition frame.h:193
unwind_stop_reason
Definition frame.h:653
const struct language_defn * language_def(enum language lang)
Definition language.c:439
PyObject * gdbarch_to_arch_object(struct gdbarch *gdbarch)
Definition py-arch.c:90
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
Definition py-block.c:323
PyTypeObject block_object_type
Definition py-block.c:510
const struct block * block_object_to_block(PyObject *obj)
Definition py-block.c:336
static PyObject * frapy_str(PyObject *self)
Definition py-frame.c:81
static PyObject * frapy_read_register(PyObject *self, PyObject *args, PyObject *kw)
Definition py-frame.c:241
PyObject * gdbpy_frame_stop_reason_string(PyObject *self, PyObject *args)
Definition py-frame.c:693
static PyObject * frapy_older(PyObject *self, PyObject *args)
Definition py-frame.c:387
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_frames(void)
Definition py-frame.c:745
static PyObject * frapy_is_valid(PyObject *self, PyObject *args)
Definition py-frame.c:92
static PyObject * frapy_static_link(PyObject *self, PyObject *args)
Definition py-frame.c:628
static PyObject * frapy_arch(PyObject *self, PyObject *args)
Definition py-frame.c:174
static PyObject * frapy_language(PyObject *self, PyObject *args)
Definition py-frame.c:605
#define FRAPY_REQUIRE_VALID(frame_obj, frame)
Definition py-frame.c:50
PyObject * frame_info_to_frame_object(frame_info_ptr frame)
Definition py-frame.c:346
static PyObject * frapy_richcompare(PyObject *self, PyObject *other, int op)
Definition py-frame.c:717
static PyObject * frapy_pc(PyObject *self, PyObject *args)
Definition py-frame.c:218
static PyObject * frapy_block(PyObject *self, PyObject *args)
Definition py-frame.c:282
static PyObject * frapy_find_sal(PyObject *self, PyObject *args)
Definition py-frame.c:450
PyObject * gdbpy_selected_frame(PyObject *self, PyObject *args)
Definition py-frame.c:673
static PyObject * frapy_name(PyObject *self, PyObject *args)
Definition py-frame.c:115
static PyObject * frapy_level(PyObject *self, PyObject *args)
Definition py-frame.c:584
PyObject * gdbpy_newest_frame(PyObject *self, PyObject *args)
Definition py-frame.c:653
PyTypeObject frame_object_type
Definition py-frame.c:832
static PyObject * frapy_unwind_stop_reason(PyObject *self, PyObject *args)
Definition py-frame.c:195
static PyObject * frapy_type(PyObject *self, PyObject *args)
Definition py-frame.c:151
static PyObject * frapy_read_var(PyObject *self, PyObject *args, PyObject *kw)
Definition py-frame.c:478
static PyObject * frapy_function(PyObject *self, PyObject *args)
Definition py-frame.c:317
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
Definition py-frame.c:62
static PyObject * frapy_newer(PyObject *self, PyObject *args)
Definition py-frame.c:419
static PyMethodDef frame_object_methods[]
Definition py-frame.c:780
static PyObject * frapy_select(PyObject *self, PyObject *args)
Definition py-frame.c:563
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
Definition py-ref.h:42
bool gdbpy_parse_register_id(struct gdbarch *gdbarch, PyObject *pyo_reg_id, int *reg_num)
struct symbol * symbol_object_to_symbol(PyObject *obj)
Definition py-symbol.c:357
PyObject * symbol_to_symbol_object(struct symbol *sym)
Definition py-symbol.c:344
PyTypeObject symbol_object_type
Definition py-symbol.c:750
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
Definition py-symtab.c:481
gdbpy_ref host_string_to_python_string(const char *str)
Definition py-utils.c:154
gdb::unique_xmalloc_ptr< char > python_string_to_target_string(PyObject *obj)
Definition py-utils.c:114
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
Definition py-utils.c:282
void gdbpy_convert_exception(const struct gdb_exception &exception)
Definition py-utils.c:217
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
Definition py-utils.c:334
int gdbpy_is_string(PyObject *obj)
Definition py-utils.c:164
gdbpy_ref gdb_py_object_from_ulongest(ULONGEST l)
Definition py-utils.c:293
PyObject * value_to_value_object(struct value *val)
Definition py-value.c:1854
PyObject * gdb_module
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
gdb::unique_xmalloc_ptr< char > find_frame_funname(frame_info_ptr frame, enum language *funlang, struct symbol **funcp)
Definition stack.c:1256
const struct block * block
Definition symtab.h:1537
struct symbol * symbol
Definition symtab.h:1533
Definition block.h:109
symbol * function() const
Definition block.h:127
std::string to_string() const
Definition frame.c:407
PyObject_HEAD struct frame_id frame_id
Definition py-frame.c:34
int frame_id_is_next
Definition py-frame.c:45
struct gdbarch * gdbarch
Definition py-frame.c:35
virtual const char * name() const =0
struct objfile * objfile() const
Definition symtab.c:6482
Definition value.h:130
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
Definition symtab.c:1964
@ VAR_DOMAIN
Definition symtab.h:910
int PyObject
Definition varobj.c:41