GDB (xrefs)
Loading...
Searching...
No Matches
py-framefilter.c
Go to the documentation of this file.
1/* Python frame filters
2
3 Copyright (C) 2013-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 "objfiles.h"
22#include "symtab.h"
23#include "language.h"
24#include "arch-utils.h"
25#include "python.h"
26#include "ui-out.h"
27#include "valprint.h"
28#include "stack.h"
29#include "source.h"
30#include "annotate.h"
31#include "hashtab.h"
32#include "demangle.h"
33#include "mi/mi-cmds.h"
34#include "python-internal.h"
35#include "gdbsupport/gdb_optional.h"
36#include "cli/cli-style.h"
37
43
44/* Helper function to extract a symbol, a name and a language
45 definition from a Python object that conforms to the "Symbol Value"
46 interface. OBJ is the Python object to extract the values from.
47 NAME is a pass-through argument where the name of the symbol will
48 be written. NAME is allocated in this function, but the caller is
49 responsible for clean up. SYM is a pass-through argument where the
50 symbol will be written and SYM_BLOCK is a pass-through argument to
51 write the block where the symbol lies in. In the case of the API
52 returning a string, this will be set to NULL. LANGUAGE is also a
53 pass-through argument denoting the language attributed to the
54 Symbol. In the case of SYM being NULL, this will be set to the
55 current language. Returns EXT_LANG_BT_ERROR on error with the
56 appropriate Python exception set, and EXT_LANG_BT_OK on success. */
57
58static enum ext_lang_bt_status
59extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr<char> *name,
60 struct symbol **sym, const struct block **sym_block,
61 const struct language_defn **language)
62{
63 gdbpy_ref<> result (PyObject_CallMethod (obj, "symbol", NULL));
64
65 if (result == NULL)
66 return EXT_LANG_BT_ERROR;
67
68 /* For 'symbol' callback, the function can return a symbol or a
69 string. */
70 if (gdbpy_is_string (result.get ()))
71 {
72 *name = python_string_to_host_string (result.get ());
73
74 if (*name == NULL)
75 return EXT_LANG_BT_ERROR;
76 /* If the API returns a string (and not a symbol), then there is
77 no symbol derived language available and the frame filter has
78 either overridden the symbol with a string, or supplied a
79 entirely synthetic symbol/value pairing. In that case, use
80 the current language. */
82 *sym = NULL;
83 *sym_block = NULL;
84 }
85 else
86 {
87 /* This type checks 'result' during the conversion so we
88 just call it unconditionally and check the return. */
89 *sym = symbol_object_to_symbol (result.get ());
90 /* TODO: currently, we have no way to recover the block in which SYMBOL
91 was found, so we have no block to return. Trying to evaluate SYMBOL
92 will yield an incorrect value when it's located in a FRAME and
93 evaluated from another frame (as permitted in nested functions). */
94 *sym_block = NULL;
95
96 if (*sym == NULL)
97 {
98 PyErr_SetString (PyExc_RuntimeError,
99 _("Unexpected value. Expecting a "
100 "gdb.Symbol or a Python string."));
101 return EXT_LANG_BT_ERROR;
102 }
103
104 /* Duplicate the symbol name, so the caller has consistency
105 in garbage collection. */
106 name->reset (xstrdup ((*sym)->print_name ()));
107
108 /* If a symbol is specified attempt to determine the language
109 from the symbol. If mode is not "auto", then the language
110 has been explicitly set, use that. */
112 *language = language_def ((*sym)->language ());
113 else
115 }
116
117 return EXT_LANG_BT_OK;
118}
119
120/* Helper function to extract a value from an object that conforms to
121 the "Symbol Value" interface. OBJ is the Python object to extract
122 the value from. VALUE is a pass-through argument where the value
123 will be written. If the object does not have the value attribute,
124 or provides the Python None for a value, VALUE will be set to NULL
125 and this function will return as successful. Returns EXT_LANG_BT_ERROR
126 on error with the appropriate Python exception set, and EXT_LANG_BT_OK on
127 success. */
128
129static enum ext_lang_bt_status
131{
132 if (PyObject_HasAttrString (obj, "value"))
133 {
134 gdbpy_ref<> vresult (PyObject_CallMethod (obj, "value", NULL));
135
136 if (vresult == NULL)
137 return EXT_LANG_BT_ERROR;
138
139 /* The Python code has returned 'None' for a value, so we set
140 value to NULL. This flags that GDB should read the
141 value. */
142 if (vresult == Py_None)
143 {
144 *value = NULL;
145 return EXT_LANG_BT_OK;
146 }
147 else
148 {
149 *value = convert_value_from_python (vresult.get ());
150
151 if (*value == NULL)
152 return EXT_LANG_BT_ERROR;
153
154 return EXT_LANG_BT_OK;
155 }
156 }
157 else
158 *value = NULL;
159
160 return EXT_LANG_BT_OK;
161}
162
163/* MI prints only certain values according to the type of symbol and
164 also what the user has specified. SYM is the symbol to check, and
165 MI_PRINT_TYPES is an enum specifying what the user wants emitted
166 for the MI command in question. */
167static int
169{
170 int print_me = 0;
171
172 switch (sym->aclass ())
173 {
174 default:
175 case LOC_UNDEF: /* catches errors */
176 case LOC_CONST: /* constant */
177 case LOC_TYPEDEF: /* local typedef */
178 case LOC_LABEL: /* local label */
179 case LOC_BLOCK: /* local function */
180 case LOC_CONST_BYTES: /* loc. byte seq. */
181 case LOC_UNRESOLVED: /* unresolved static */
182 case LOC_OPTIMIZED_OUT: /* optimized out */
183 print_me = 0;
184 break;
185
186 case LOC_ARG: /* argument */
187 case LOC_REF_ARG: /* reference arg */
188 case LOC_REGPARM_ADDR: /* indirect register arg */
189 case LOC_LOCAL: /* stack local */
190 case LOC_STATIC: /* static */
191 case LOC_REGISTER: /* register */
192 case LOC_COMPUTED: /* computed location */
193 if (type == MI_PRINT_LOCALS)
194 print_me = ! sym->is_argument ();
195 else
196 print_me = sym->is_argument ();
197 }
198 return print_me;
199}
200
201/* Helper function which outputs a type name extracted from VAL to a
202 "type" field in the output stream OUT. OUT is the ui-out structure
203 the type name will be output too, and VAL is the value that the
204 type will be extracted from. */
205
206static void
207py_print_type (struct ui_out *out, struct value *val)
208{
209 check_typedef (val->type ());
210
211 string_file stb;
212 type_print (val->type (), "", &stb, -1);
213 out->field_stream ("type", stb);
214}
215
216/* Helper function which outputs a value to an output field in a
217 stream. OUT is the ui-out structure the value will be output to,
218 VAL is the value that will be printed, OPTS contains the value
219 printing options, ARGS_TYPE is an enumerator describing the
220 argument format, and LANGUAGE is the language_defn that the value
221 will be printed with. */
222
223static void
224py_print_value (struct ui_out *out, struct value *val,
225 const struct value_print_options *opts,
226 int indent,
227 enum ext_lang_frame_args args_type,
228 const struct language_defn *language)
229{
230 int should_print = 0;
231
232 /* MI does not print certain values, differentiated by type,
233 depending on what ARGS_TYPE indicates. Test type against option.
234 For CLI print all values. */
235 if (args_type == MI_PRINT_SIMPLE_VALUES
236 || args_type == MI_PRINT_ALL_VALUES)
237 {
238 if (args_type == MI_PRINT_ALL_VALUES)
239 should_print = 1;
240 else if (args_type == MI_PRINT_SIMPLE_VALUES
241 && mi_simple_type_p (val->type ()))
242 should_print = 1;
243 }
244 else if (args_type != NO_VALUES)
245 should_print = 1;
246
247 if (should_print)
248 {
249 string_file stb;
250
251 common_val_print (val, &stb, indent, opts, language);
252 out->field_stream ("value", stb);
253 }
254}
255
256/* Helper function to call a Python method and extract an iterator
257 from the result. If the function returns anything but an iterator
258 the exception is preserved and NULL is returned. FILTER is the
259 Python object to call, and FUNC is the name of the method. Returns
260 a PyObject, or NULL on error with the appropriate exception set.
261 This function can return an iterator, or NULL. */
262
263static PyObject *
264get_py_iter_from_func (PyObject *filter, const char *func)
265{
266 if (PyObject_HasAttrString (filter, func))
267 {
268 gdbpy_ref<> result (PyObject_CallMethod (filter, func, NULL));
269
270 if (result != NULL)
271 {
272 if (result == Py_None)
273 {
274 return result.release ();
275 }
276 else
277 {
278 return PyObject_GetIter (result.get ());
279 }
280 }
281 }
282 else
283 Py_RETURN_NONE;
284
285 return NULL;
286}
287
288/* Helper function to output a single frame argument and value to an
289 output stream. This function will account for entry values if the
290 FV parameter is populated, the frame argument has entry values
291 associated with them, and the appropriate "set entry-value"
292 options are set. Will output in CLI or MI like format depending
293 on the type of output stream detected. OUT is the output stream,
294 SYM_NAME is the name of the symbol. If SYM_NAME is populated then
295 it must have an accompanying value in the parameter FV. FA is a
296 frame argument structure. If FA is populated, both SYM_NAME and
297 FV are ignored. OPTS contains the value printing options,
298 ARGS_TYPE is an enumerator describing the argument format,
299 PRINT_ARGS_FIELD is a flag which indicates if we output "ARGS=1"
300 in MI output in commands where both arguments and locals are
301 printed. */
302
303static void
305 const char *sym_name,
306 struct frame_arg *fa,
307 struct value *fv,
308 const struct value_print_options *opts,
309 enum ext_lang_frame_args args_type,
310 int print_args_field,
311 const struct language_defn *language)
312{
313 struct value *val;
314
315 if (fa != NULL)
316 {
317 if (fa->val == NULL && fa->error == NULL)
318 return;
319 language = language_def (fa->sym->language ());
320 val = fa->val;
321 }
322 else
323 val = fv;
324
325 gdb::optional<ui_out_emit_tuple> maybe_tuple;
326
327 /* MI has varying rules for tuples, but generally if there is only
328 one element in each item in the list, do not start a tuple. The
329 exception is -stack-list-variables which emits an ARGS="1" field
330 if the value is a frame argument. This is denoted in this
331 function with PRINT_ARGS_FIELD which is flag from the caller to
332 emit the ARGS field. */
333 if (out->is_mi_like_p ())
334 {
335 if (print_args_field || args_type != NO_VALUES)
336 maybe_tuple.emplace (out, nullptr);
337 }
338
340
341 /* If frame argument is populated, check for entry-values and the
342 entry value options. */
343 if (fa != NULL)
344 {
345 string_file stb;
346
347 gdb_puts (fa->sym->print_name (), &stb);
349 {
350 stb.puts ("=");
351
352 gdb_puts (fa->sym->print_name (), &stb);
353 }
356 stb.puts ("@entry");
357 out->field_stream ("name", stb);
358 }
359 else
360 /* Otherwise, just output the name. */
361 out->field_string ("name", sym_name);
362
364
365 out->text ("=");
366
367 if (print_args_field)
368 out->field_signed ("arg", 1);
369
370 /* For MI print the type, but only for simple values. This seems
371 weird, but this is how MI choose to format the various output
372 types. */
373 if (args_type == MI_PRINT_SIMPLE_VALUES && val != NULL)
374 py_print_type (out, val);
375
376 if (val != NULL)
377 annotate_arg_value (val->type ());
378
379 /* If the output is to the CLI, and the user option "set print
380 frame-arguments" is set to none, just output "...". */
381 if (! out->is_mi_like_p () && args_type == NO_VALUES)
382 out->field_string ("value", "...");
383 else
384 {
385 /* Otherwise, print the value for both MI and the CLI, except
386 for the case of MI_PRINT_NO_VALUES. */
387 if (args_type != NO_VALUES)
388 {
389 if (val == NULL)
390 {
391 gdb_assert (fa != NULL && fa->error != NULL);
392 out->field_fmt ("value", metadata_style.style (),
393 _("<error reading variable: %s>"),
394 fa->error.get ());
395 }
396 else
397 py_print_value (out, val, opts, 0, args_type, language);
398 }
399 }
400}
401
402/* Helper function to loop over frame arguments provided by the
403 "frame_arguments" Python API. Elements in the iterator must
404 conform to the "Symbol Value" interface. ITER is the Python
405 iterable object, OUT is the output stream, ARGS_TYPE is an
406 enumerator describing the argument format, PRINT_ARGS_FIELD is a
407 flag which indicates if we output "ARGS=1" in MI output in commands
408 where both arguments and locals are printed, and FRAME is the
409 backing frame. Returns EXT_LANG_BT_ERROR on error, with any GDB
410 exceptions converted to a Python exception, or EXT_LANG_BT_OK on
411 success. */
412
413static enum ext_lang_bt_status
415 struct ui_out *out,
416 enum ext_lang_frame_args args_type,
417 int print_args_field,
418 frame_info_ptr frame)
419{
420 struct value_print_options opts;
421
423
424 if (args_type == CLI_SCALAR_VALUES)
425 {
426 /* True in "summary" mode, false otherwise. */
427 opts.summary = true;
428 }
429
430 opts.deref_ref = true;
431
433
434 /* Collect the first argument outside of the loop, so output of
435 commas in the argument output is correct. At the end of the
436 loop block collect another item from the iterator, and, if it is
437 not null emit a comma. */
438 gdbpy_ref<> item (PyIter_Next (iter));
439 if (item == NULL && PyErr_Occurred ())
440 return EXT_LANG_BT_ERROR;
441
442 while (item != NULL)
443 {
444 const struct language_defn *language;
445 gdb::unique_xmalloc_ptr<char> sym_name;
446 struct symbol *sym;
447 const struct block *sym_block;
448 struct value *val;
450
451 success = extract_sym (item.get (), &sym_name, &sym, &sym_block,
452 &language);
453 if (success == EXT_LANG_BT_ERROR)
454 return EXT_LANG_BT_ERROR;
455
456 success = extract_value (item.get (), &val);
457 if (success == EXT_LANG_BT_ERROR)
458 return EXT_LANG_BT_ERROR;
459
460 if (sym && out->is_mi_like_p ()
461 && ! mi_should_print (sym, MI_PRINT_ARGS))
462 continue;
463
464 /* If the object did not provide a value, read it using
465 read_frame_args and account for entry values, if any. */
466 if (val == NULL)
467 {
468 struct frame_arg arg, entryarg;
469
470 /* If there is no value, and also no symbol, set error and
471 exit. */
472 if (sym == NULL)
473 {
474 PyErr_SetString (PyExc_RuntimeError,
475 _("No symbol or value provided."));
476 return EXT_LANG_BT_ERROR;
477 }
478
480 sym, frame, &arg, &entryarg);
481
482 /* The object has not provided a value, so this is a frame
483 argument to be read by GDB. In this case we have to
484 account for entry-values. */
485
487 {
488 py_print_single_arg (out, NULL, &arg,
489 NULL, &opts,
490 args_type,
491 print_args_field,
492 NULL);
493 }
494
495 if (entryarg.entry_kind != print_entry_values_no)
496 {
498 {
499 out->text (", ");
500 out->wrap_hint (4);
501 }
502
503 py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
504 args_type, print_args_field, NULL);
505 }
506 }
507 else
508 {
509 /* If the object has provided a value, we just print that. */
510 if (val != NULL)
511 py_print_single_arg (out, sym_name.get (), NULL, val, &opts,
512 args_type, print_args_field,
513 language);
514 }
515
516 /* Collect the next item from the iterator. If
517 this is the last item, do not print the
518 comma. */
519 item.reset (PyIter_Next (iter));
520 if (item != NULL)
521 out->text (", ");
522 else if (PyErr_Occurred ())
523 return EXT_LANG_BT_ERROR;
524
526 }
527
528 return EXT_LANG_BT_OK;
529}
530
531
532/* Helper function to loop over variables provided by the
533 "frame_locals" Python API. Elements in the iterable must conform
534 to the "Symbol Value" interface. ITER is the Python iterable
535 object, OUT is the output stream, INDENT is whether we should
536 indent the output (for CLI), ARGS_TYPE is an enumerator describing
537 the argument format, PRINT_ARGS_FIELD is flag which indicates
538 whether to output the ARGS field in the case of
539 -stack-list-variables and FRAME is the backing frame. Returns
540 EXT_LANG_BT_ERROR on error, with any GDB exceptions converted to a Python
541 exception, or EXT_LANG_BT_OK on success. */
542
543static enum ext_lang_bt_status
545 struct ui_out *out,
546 int indent,
547 enum ext_lang_frame_args args_type,
548 int print_args_field,
549 frame_info_ptr frame)
550{
551 struct value_print_options opts;
552
554 opts.deref_ref = true;
555
556 while (true)
557 {
558 const struct language_defn *language;
559 gdb::unique_xmalloc_ptr<char> sym_name;
560 struct value *val;
562 struct symbol *sym;
563 const struct block *sym_block;
564 int local_indent = 8 + (8 * indent);
565 gdb::optional<ui_out_emit_tuple> tuple;
566
567 gdbpy_ref<> item (PyIter_Next (iter));
568 if (item == NULL)
569 break;
570
571 success = extract_sym (item.get (), &sym_name, &sym, &sym_block,
572 &language);
573 if (success == EXT_LANG_BT_ERROR)
574 return EXT_LANG_BT_ERROR;
575
576 success = extract_value (item.get (), &val);
577 if (success == EXT_LANG_BT_ERROR)
578 return EXT_LANG_BT_ERROR;
579
580 if (sym != NULL && out->is_mi_like_p ()
582 continue;
583
584 /* If the object did not provide a value, read it. */
585 if (val == NULL)
586 val = read_var_value (sym, sym_block, frame);
587
588 /* With PRINT_NO_VALUES, MI does not emit a tuple normally as
589 each output contains only one field. The exception is
590 -stack-list-variables, which always provides a tuple. */
591 if (out->is_mi_like_p ())
592 {
593 if (print_args_field || args_type != NO_VALUES)
594 tuple.emplace (out, nullptr);
595 }
596
597 /* If the output is not MI we indent locals. */
598 out->spaces (local_indent);
599 out->field_string ("name", sym_name.get ());
600 out->text (" = ");
601
602 if (args_type == MI_PRINT_SIMPLE_VALUES)
603 py_print_type (out, val);
604
605 /* CLI always prints values for locals. MI uses the
606 simple/no/all system. */
607 if (! out->is_mi_like_p ())
608 {
609 int val_indent = (indent + 1) * 4;
610
611 py_print_value (out, val, &opts, val_indent, args_type,
612 language);
613 }
614 else
615 {
616 if (args_type != NO_VALUES)
617 py_print_value (out, val, &opts, 0, args_type,
618 language);
619 }
620
621 out->text ("\n");
622 }
623
624 if (!PyErr_Occurred ())
625 return EXT_LANG_BT_OK;
626
627 return EXT_LANG_BT_ERROR;
628}
629
630/* Helper function for -stack-list-variables. Returns EXT_LANG_BT_ERROR on
631 error, or EXT_LANG_BT_OK on success. */
632
633static enum ext_lang_bt_status
635 struct value_print_options *opts,
636 enum ext_lang_frame_args args_type,
637 frame_info_ptr frame)
638{
639 gdbpy_ref<> args_iter (get_py_iter_from_func (filter, "frame_args"));
640 if (args_iter == NULL)
641 return EXT_LANG_BT_ERROR;
642
643 gdbpy_ref<> locals_iter (get_py_iter_from_func (filter, "frame_locals"));
644 if (locals_iter == NULL)
645 return EXT_LANG_BT_ERROR;
646
647 ui_out_emit_list list_emitter (out, "variables");
648
649 if (args_iter != Py_None
650 && (enumerate_args (args_iter.get (), out, args_type, 1, frame)
652 return EXT_LANG_BT_ERROR;
653
654 if (locals_iter != Py_None
655 && (enumerate_locals (locals_iter.get (), out, 1, args_type, 1, frame)
657 return EXT_LANG_BT_ERROR;
658
659 return EXT_LANG_BT_OK;
660}
661
662/* Helper function for printing locals. This function largely just
663 creates the wrapping tuple, and calls enumerate_locals. Returns
664 EXT_LANG_BT_ERROR on error, or EXT_LANG_BT_OK on success. */
665
666static enum ext_lang_bt_status
668 struct ui_out *out,
669 enum ext_lang_frame_args args_type,
670 int indent,
671 frame_info_ptr frame)
672{
673 gdbpy_ref<> locals_iter (get_py_iter_from_func (filter, "frame_locals"));
674 if (locals_iter == NULL)
675 return EXT_LANG_BT_ERROR;
676
677 ui_out_emit_list list_emitter (out, "locals");
678
679 if (locals_iter != Py_None
680 && (enumerate_locals (locals_iter.get (), out, indent, args_type,
681 0, frame) == EXT_LANG_BT_ERROR))
682 return EXT_LANG_BT_ERROR;
683
684 return EXT_LANG_BT_OK;
685}
686
687/* Helper function for printing frame arguments. This function
688 largely just creates the wrapping tuple, and calls enumerate_args.
689 Returns EXT_LANG_BT_ERROR on error, with any GDB exceptions converted to
690 a Python exception, or EXT_LANG_BT_OK on success. */
691
692static enum ext_lang_bt_status
694 struct ui_out *out,
695 enum ext_lang_frame_args args_type,
696 frame_info_ptr frame)
697{
698 gdbpy_ref<> args_iter (get_py_iter_from_func (filter, "frame_args"));
699 if (args_iter == NULL)
700 return EXT_LANG_BT_ERROR;
701
702 ui_out_emit_list list_emitter (out, "args");
703
704 out->wrap_hint (3);
706 out->text (" (");
707
708 if (args_type == CLI_PRESENCE)
709 {
710 if (args_iter != Py_None)
711 {
712 gdbpy_ref<> item (PyIter_Next (args_iter.get ()));
713
714 if (item != NULL)
715 out->text ("...");
716 else if (PyErr_Occurred ())
717 return EXT_LANG_BT_ERROR;
718 }
719 }
720 else if (args_iter != Py_None
721 && (enumerate_args (args_iter.get (), out, args_type, 0, frame)
723 return EXT_LANG_BT_ERROR;
724
725 out->text (")");
726
727 return EXT_LANG_BT_OK;
728}
729
730/* Print a single frame to the designated output stream, detecting
731 whether the output is MI or console, and formatting the output
732 according to the conventions of that protocol. FILTER is the
733 frame-filter associated with this frame. FLAGS is an integer
734 describing the various print options. The FLAGS variables is
735 described in "apply_frame_filter" function. ARGS_TYPE is an
736 enumerator describing the argument format. OUT is the output
737 stream to print, INDENT is the level of indention for this frame
738 (in the case of elided frames), and LEVELS_PRINTED is a hash-table
739 containing all the frames level that have already been printed.
740 If a frame level has been printed, do not print it again (in the
741 case of elided frames). Returns EXT_LANG_BT_ERROR on error, with any
742 GDB exceptions converted to a Python exception, or EXT_LANG_BT_OK
743 on success. It can also throw an exception RETURN_QUIT. */
744
745static enum ext_lang_bt_status
746py_print_frame (PyObject *filter, frame_filter_flags flags,
747 enum ext_lang_frame_args args_type,
748 struct ui_out *out, int indent, htab_t levels_printed)
749{
750 int has_addr = 0;
751 CORE_ADDR address = 0;
752 struct gdbarch *gdbarch = NULL;
753 frame_info_ptr frame = NULL;
754 struct value_print_options opts;
755
756 int print_level, print_frame_info, print_args, print_locals;
757 /* Note that the below default in non-mi mode is the same as the
758 default value for the backtrace command (see the call to print_frame_info
759 in backtrace_command_1).
760 Having the same default ensures that 'bt' and 'bt no-filters'
761 have the same behaviour when some filters exist but do not apply
762 to a frame. */
765 gdb::unique_xmalloc_ptr<char> function_to_free;
766
767 /* Extract print settings from FLAGS. */
768 print_level = (flags & PRINT_LEVEL) ? 1 : 0;
770 print_args = (flags & PRINT_ARGS) ? 1 : 0;
771 print_locals = (flags & PRINT_LOCALS) ? 1 : 0;
772
775 {
776 gdb::optional<enum print_what> user_frame_info_print_what;
777
778 get_user_print_what_frame_info (&user_frame_info_print_what);
779 if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
780 {
781 /* Use the specific frame information desired by the user. */
782 print_what = *user_frame_info_print_what;
783 }
784 }
785
786 /* Get the underlying frame. This is needed to determine GDB
787 architecture, and also, in the cases of frame variables/arguments to
788 read them if they returned filter object requires us to do so. */
789 gdbpy_ref<> py_inf_frame (PyObject_CallMethod (filter, "inferior_frame",
790 NULL));
791 if (py_inf_frame == NULL)
792 return EXT_LANG_BT_ERROR;
793
794 frame = frame_object_to_frame_info (py_inf_frame.get ());
795 if (frame == NULL)
796 return EXT_LANG_BT_ERROR;
797
798 symtab_and_line sal = find_frame_sal (frame);
799
800 gdbarch = get_frame_arch (frame);
801
802 /* stack-list-variables. */
803 if (print_locals && print_args && ! print_frame_info)
804 {
805 if (py_mi_print_variables (filter, out, &opts,
806 args_type, frame) == EXT_LANG_BT_ERROR)
807 return EXT_LANG_BT_ERROR;
808 return EXT_LANG_BT_OK;
809 }
810
811 gdb::optional<ui_out_emit_tuple> tuple;
812
813 /* -stack-list-locals does not require a
814 wrapping frame attribute. */
815 if (print_frame_info || (print_args && ! print_locals))
816 tuple.emplace (out, "frame");
817
819 {
820 /* Elided frames are also printed with this function (recursively)
821 and are printed with indention. */
822 if (indent > 0)
823 out->spaces (indent * 4);
824
825 /* The address is required for frame annotations, and also for
826 address printing. */
827 if (PyObject_HasAttrString (filter, "address"))
828 {
829 gdbpy_ref<> paddr (PyObject_CallMethod (filter, "address", NULL));
830
831 if (paddr == NULL)
832 return EXT_LANG_BT_ERROR;
833
834 if (paddr != Py_None)
835 {
836 if (get_addr_from_python (paddr.get (), &address) < 0)
837 return EXT_LANG_BT_ERROR;
838
839 has_addr = 1;
840 }
841 }
842 }
843
844 /* For MI, each piece is controlled individually. */
845 bool location_print = (print_frame_info
846 && !out->is_mi_like_p ()
847 && (print_what == LOCATION
851
852 /* Print frame level. MI does not require the level if
853 locals/variables only are being printed. */
854 if (print_level
855 && (location_print
856 || (out->is_mi_like_p () && (print_frame_info || print_args))))
857 {
858 struct frame_info **slot;
859 int level;
860
861 slot = (frame_info **) htab_find_slot (levels_printed,
862 frame.get(), INSERT);
863
864 level = frame_relative_level (frame);
865
866 /* Check if this frame has already been printed (there are cases
867 where elided synthetic dummy-frames have to 'borrow' the frame
868 architecture from the eliding frame. If that is the case, do
869 not print 'level', but print spaces. */
870 if (*slot == frame)
871 out->field_skip ("level");
872 else
873 {
874 *slot = frame.get ();
875 annotate_frame_begin (print_level ? level : 0,
876 gdbarch, address);
877 out->text ("#");
878 out->field_fmt_signed (2, ui_left, "level", level);
879 }
880 }
881
882 if (location_print || (out->is_mi_like_p () && print_frame_info))
883 {
884 /* Print address to the address field. If an address is not provided,
885 print nothing. */
886 if (opts.addressprint && has_addr)
887 {
888 if (!sal.symtab
889 || frame_show_address (frame, sal)
891 {
893 out->field_core_addr ("addr", gdbarch, address);
894 if (get_frame_pc_masked (frame))
895 out->field_string ("pac", " [PAC]");
897 out->text (" in ");
898 }
899 }
900
901 /* Print frame function name. */
902 if (PyObject_HasAttrString (filter, "function"))
903 {
904 gdbpy_ref<> py_func (PyObject_CallMethod (filter, "function", NULL));
905 const char *function = NULL;
906
907 if (py_func == NULL)
908 return EXT_LANG_BT_ERROR;
909
910 if (gdbpy_is_string (py_func.get ()))
911 {
912 function_to_free = python_string_to_host_string (py_func.get ());
913
914 if (function_to_free == NULL)
915 return EXT_LANG_BT_ERROR;
916
917 function = function_to_free.get ();
918 }
919 else if (PyLong_Check (py_func.get ()))
920 {
921 CORE_ADDR addr;
922 struct bound_minimal_symbol msymbol;
923
924 if (get_addr_from_python (py_func.get (), &addr) < 0)
925 return EXT_LANG_BT_ERROR;
926
927 msymbol = lookup_minimal_symbol_by_pc (addr);
928 if (msymbol.minsym != NULL)
929 function = msymbol.minsym->print_name ();
930 }
931 else if (py_func != Py_None)
932 {
933 PyErr_SetString (PyExc_RuntimeError,
934 _("FrameDecorator.function: expecting a " \
935 "String, integer or None."));
936 return EXT_LANG_BT_ERROR;
937 }
938
940 if (function == NULL)
941 out->field_skip ("func");
942 else
943 out->field_string ("func", function, function_name_style.style ());
944 }
945 }
946
947
948 /* Frame arguments. Check the result, and error if something went
949 wrong. */
950 if (print_args && (location_print || out->is_mi_like_p ()))
951 {
952 if (py_print_args (filter, out, args_type, frame) == EXT_LANG_BT_ERROR)
953 return EXT_LANG_BT_ERROR;
954 }
955
956 /* File name/source/line number information. */
957 bool print_location_source
958 = ((location_print && print_what != SHORT_LOCATION)
959 || (out->is_mi_like_p () && print_frame_info));
960 if (print_location_source)
961 {
963
964 if (PyObject_HasAttrString (filter, "filename"))
965 {
966 gdbpy_ref<> py_fn (PyObject_CallMethod (filter, "filename", NULL));
967
968 if (py_fn == NULL)
969 return EXT_LANG_BT_ERROR;
970
971 if (py_fn != Py_None)
972 {
973 gdb::unique_xmalloc_ptr<char>
974 filename (python_string_to_host_string (py_fn.get ()));
975
976 if (filename == NULL)
977 return EXT_LANG_BT_ERROR;
978
979 out->wrap_hint (3);
980 out->text (" at ");
982 out->field_string ("file", filename.get (),
985 }
986 }
987
988 if (PyObject_HasAttrString (filter, "line"))
989 {
990 gdbpy_ref<> py_line (PyObject_CallMethod (filter, "line", NULL));
991 int line;
992
993 if (py_line == NULL)
994 return EXT_LANG_BT_ERROR;
995
996 if (py_line != Py_None)
997 {
998 line = PyLong_AsLong (py_line.get ());
999 if (PyErr_Occurred ())
1000 return EXT_LANG_BT_ERROR;
1001
1002 out->text (":");
1004 out->field_signed ("line", line);
1005 }
1006 }
1007 if (out->is_mi_like_p ())
1008 out->field_string ("arch",
1009 (gdbarch_bfd_arch_info (gdbarch))->printable_name);
1010 }
1011
1012 bool source_print
1013 = (! out->is_mi_like_p ()
1015 if (source_print)
1016 {
1017 if (print_location_source)
1018 out->text ("\n"); /* Newline after the location source. */
1019 print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
1020 }
1021
1022 /* For MI we need to deal with the "children" list population of
1023 elided frames, so if MI output detected do not send newline. */
1024 if (! out->is_mi_like_p ())
1025 {
1027 /* print_source_lines has already printed a newline. */
1028 if (!source_print)
1029 out->text ("\n");
1030 }
1031
1032 if (print_locals)
1033 {
1034 if (py_print_locals (filter, out, args_type, indent,
1035 frame) == EXT_LANG_BT_ERROR)
1036 return EXT_LANG_BT_ERROR;
1037 }
1038
1039 if ((flags & PRINT_HIDE) == 0)
1040 {
1041 /* Finally recursively print elided frames, if any. */
1042 gdbpy_ref<> elided (get_py_iter_from_func (filter, "elided"));
1043 if (elided == NULL)
1044 return EXT_LANG_BT_ERROR;
1045
1046 if (elided != Py_None)
1047 {
1048 PyObject *item;
1049
1050 ui_out_emit_list inner_list_emiter (out, "children");
1051
1052 indent++;
1053
1054 while ((item = PyIter_Next (elided.get ())))
1055 {
1056 gdbpy_ref<> item_ref (item);
1057
1058 enum ext_lang_bt_status success
1059 = py_print_frame (item, flags, args_type, out, indent,
1060 levels_printed);
1061
1062 if (success == EXT_LANG_BT_ERROR)
1063 return EXT_LANG_BT_ERROR;
1064 }
1065 if (item == NULL && PyErr_Occurred ())
1066 return EXT_LANG_BT_ERROR;
1067 }
1068 }
1069
1070 return EXT_LANG_BT_OK;
1071}
1072
1073/* Helper function to initiate frame filter invocation at starting
1074 frame FRAME. */
1075
1076static PyObject *
1078 int frame_low, int frame_high)
1079{
1080 gdbpy_ref<> frame_obj (frame_info_to_frame_object (frame));
1081 if (frame_obj == NULL)
1082 return NULL;
1083
1084 gdbpy_ref<> module (PyImport_ImportModule ("gdb.frames"));
1085 if (module == NULL)
1086 return NULL;
1087
1088 gdbpy_ref<> sort_func (PyObject_GetAttrString (module.get (),
1089 "execute_frame_filters"));
1090 if (sort_func == NULL)
1091 return NULL;
1092
1093 gdbpy_ref<> py_frame_low = gdb_py_object_from_longest (frame_low);
1094 if (py_frame_low == NULL)
1095 return NULL;
1096
1097 gdbpy_ref<> py_frame_high = gdb_py_object_from_longest (frame_high);
1098 if (py_frame_high == NULL)
1099 return NULL;
1100
1101 gdbpy_ref<> iterable (PyObject_CallFunctionObjArgs (sort_func.get (),
1102 frame_obj.get (),
1103 py_frame_low.get (),
1104 py_frame_high.get (),
1105 NULL));
1106 if (iterable == NULL)
1107 return NULL;
1108
1109 if (iterable != Py_None)
1110 return PyObject_GetIter (iterable.get ());
1111 else
1112 return iterable.release ();
1113}
1114
1115/* This is the only publicly exported function in this file. FRAME
1116 is the source frame to start frame-filter invocation. FLAGS is an
1117 integer holding the flags for printing. The following elements of
1118 the FRAME_FILTER_FLAGS enum denotes the make-up of FLAGS:
1119 PRINT_LEVEL is a flag indicating whether to print the frame's
1120 relative level in the output. PRINT_FRAME_INFO is a flag that
1121 indicates whether this function should print the frame
1122 information, PRINT_ARGS is a flag that indicates whether to print
1123 frame arguments, and PRINT_LOCALS, likewise, with frame local
1124 variables. ARGS_TYPE is an enumerator describing the argument
1125 format, OUT is the output stream to print. FRAME_LOW is the
1126 beginning of the slice of frames to print, and FRAME_HIGH is the
1127 upper limit of the frames to count. Returns EXT_LANG_BT_ERROR on error,
1128 or EXT_LANG_BT_OK on success. */
1129
1132 frame_info_ptr frame, frame_filter_flags flags,
1133 enum ext_lang_frame_args args_type,
1134 struct ui_out *out, int frame_low, int frame_high)
1135{
1136 struct gdbarch *gdbarch = NULL;
1138
1141
1142 try
1143 {
1144 gdbarch = get_frame_arch (frame);
1145 }
1146 catch (const gdb_exception_error &except)
1147 {
1148 /* Let gdb try to print the stack trace. */
1150 }
1151
1152 gdbpy_enter enter_py (gdbarch);
1153
1154 /* When we're limiting the number of frames, be careful to request
1155 one extra frame, so that we can print a message if there are more
1156 frames. */
1157 int frame_countdown = -1;
1158 if ((flags & PRINT_MORE_FRAMES) != 0 && frame_low >= 0 && frame_high >= 0)
1159 {
1160 ++frame_high;
1161 /* This has an extra +1 because it is checked before a frame is
1162 printed. */
1163 frame_countdown = frame_high - frame_low + 1;
1164 }
1165
1166 gdbpy_ref<> iterable (bootstrap_python_frame_filters (frame, frame_low,
1167 frame_high));
1168
1169 if (iterable == NULL)
1170 {
1171 /* Normally if there is an error GDB prints the exception,
1172 abandons the backtrace and exits. The user can then call "bt
1173 no-filters", and get a default backtrace (it would be
1174 confusing to automatically start a standard backtrace halfway
1175 through a Python filtered backtrace). However in the case
1176 where GDB cannot initialize the frame filters (most likely
1177 due to incorrect auto-load paths), GDB has printed nothing.
1178 In this case it is OK to print the default backtrace after
1179 printing the error message. GDB returns EXT_LANG_BT_NO_FILTERS
1180 here to signify there are no filters after printing the
1181 initialization error. This return code will trigger a
1182 default backtrace. */
1183
1186 }
1187
1188 /* If iterable is None, then there are no frame filters registered.
1189 If this is the case, defer to default GDB printing routines in MI
1190 and CLI. */
1191 if (iterable == Py_None)
1193
1194 htab_up levels_printed (htab_create (20,
1195 htab_hash_pointer,
1196 htab_eq_pointer,
1197 NULL));
1198
1199 while (true)
1200 {
1201 gdbpy_ref<> item (PyIter_Next (iterable.get ()));
1202
1203 if (item == NULL)
1204 {
1205 if (PyErr_Occurred ())
1206 {
1208 return EXT_LANG_BT_ERROR;
1209 }
1210 break;
1211 }
1212
1213 if (frame_countdown != -1)
1214 {
1215 gdb_assert ((flags & PRINT_MORE_FRAMES) != 0);
1216 --frame_countdown;
1217 if (frame_countdown == 0)
1218 {
1219 /* We've printed all the frames we were asked to
1220 print, but more frames existed. */
1221 gdb_printf (_("(More stack frames follow...)\n"));
1222 break;
1223 }
1224 }
1225
1226 try
1227 {
1228 success = py_print_frame (item.get (), flags, args_type, out, 0,
1229 levels_printed.get ());
1230 }
1231 catch (const gdb_exception_error &except)
1232 {
1233 gdbpy_convert_exception (except);
1234 success = EXT_LANG_BT_ERROR;
1235 }
1236
1237 /* Do not exit on error printing a single frame. Print the
1238 error and continue with other frames. */
1239 if (success == EXT_LANG_BT_ERROR)
1241 }
1242
1243 return success;
1244}
const char *const name
void annotate_frame_source_file_end(void)
Definition annotate.c:534
void annotate_frame_function_name(void)
Definition annotate.c:506
void annotate_frame_end(void)
Definition annotate.c:562
void annotate_arg_end(void)
Definition annotate.c:418
void annotate_frame_address_end(void)
Definition annotate.c:499
void annotate_arg_begin(void)
Definition annotate.c:393
void annotate_frame_address(void)
Definition annotate.c:492
void annotate_frame_source_file(void)
Definition annotate.c:527
void annotate_arg_name_end(void)
Definition annotate.c:400
void annotate_frame_source_line(void)
Definition annotate.c:541
void annotate_frame_source_begin(void)
Definition annotate.c:520
void annotate_arg_value(struct type *type)
Definition annotate.c:407
void annotate_frame_args(void)
Definition annotate.c:513
void annotate_frame_begin(int level, struct gdbarch *gdbarch, CORE_ADDR pc)
Definition annotate.c:470
ui_file_style style() const
Definition cli-style.c:169
frame_info * get() const
Definition frame.h:294
virtual void puts(const char *str)
Definition ui-file.h:76
void field_fmt_signed(int width, ui_align align, const char *fldname, LONGEST value)
Definition ui-out.c:449
void void void spaces(int numspaces)
Definition ui-out.c:560
void field_core_addr(const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
Definition ui-out.c:478
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
Definition ui-out.c:511
void field_fmt(const char *fldname, const char *format,...) ATTRIBUTE_PRINTF(3
Definition ui-out.c:525
void field_signed(const char *fldname, LONGEST value)
Definition ui-out.c:437
void field_skip(const char *fldname)
Definition ui-out.c:499
void text(const char *string)
Definition ui-out.c:566
void field_stream(const char *fldname, string_file &stream, const ui_file_style &style=ui_file_style())
Definition ui-out.c:486
bool is_mi_like_p() const
Definition ui-out.c:810
void void void wrap_hint(int indent)
Definition ui-out.c:785
cli_style_option function_name_style
cli_style_option file_name_style
cli_style_option metadata_style
language
Definition defs.h:211
@ PRINT_ARGS
Definition extension.h:96
@ PRINT_LOCALS
Definition extension.h:99
@ PRINT_MORE_FRAMES
Definition extension.h:102
@ PRINT_FRAME_INFO
Definition extension.h:93
@ PRINT_HIDE
Definition extension.h:105
@ PRINT_LEVEL
Definition extension.h:90
ext_lang_bt_status
Definition extension.h:71
@ EXT_LANG_BT_ERROR
Definition extension.h:74
@ EXT_LANG_BT_OK
Definition extension.h:78
@ EXT_LANG_BT_NO_FILTERS
Definition extension.h:82
ext_lang_frame_args
Definition extension.h:114
@ MI_PRINT_ALL_VALUES
Definition extension.h:118
@ MI_PRINT_SIMPLE_VALUES
Definition extension.h:122
@ CLI_PRESENCE
Definition extension.h:131
@ NO_VALUES
Definition extension.h:116
@ CLI_SCALAR_VALUES
Definition extension.h:125
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition findvar.c:739
int frame_relative_level(frame_info_ptr fi)
Definition frame.c:2946
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
Definition frame.c:3027
bool get_frame_pc_masked(frame_info_ptr frame)
Definition frame.c:208
symtab_and_line find_frame_sal(frame_info_ptr frame)
Definition frame.c:2821
void print_frame_info(const frame_print_options &fp_opts, frame_info_ptr, int print_level, enum print_what print_what, int args, int set_current_sal)
Definition stack.c:1021
print_what
Definition frame.h:803
@ SHORT_LOCATION
Definition frame.h:817
@ LOCATION
Definition frame.h:809
@ SRC_AND_LOC
Definition frame.h:811
@ SRC_LINE
Definition frame.h:805
@ LOC_AND_ADDRESS
Definition frame.h:814
const char print_entry_values_compact[]
Definition stack.c:112
void read_frame_arg(const frame_print_options &fp_opts, symbol *sym, frame_info_ptr frame, struct frame_arg *argp, struct frame_arg *entryargp)
Definition stack.c:524
const char print_entry_values_only[]
Definition stack.c:108
const char print_entry_values_no[]
Definition stack.c:107
frame_print_options user_frame_print_options
Definition stack.c:127
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
Definition gdbarch.c:1387
static void print_args(struct field *args, int nargs, int spaces)
Definition gdbtypes.c:4911
struct type * check_typedef(struct type *type)
Definition gdbtypes.c:2966
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
const struct language_defn * language_def(enum language lang)
Definition language.c:439
const struct language_defn * current_language
Definition language.c:82
language_mode
Definition language.h:717
@ language_mode_auto
Definition language.h:718
bool mi_simple_type_p(struct type *type)
Definition mi-cmd-var.c:346
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
Definition minsyms.c:996
PyObject * frame_info_to_frame_object(frame_info_ptr frame)
Definition py-frame.c:346
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
Definition py-frame.c:62
static void py_print_value(struct ui_out *out, struct value *val, const struct value_print_options *opts, int indent, enum ext_lang_frame_args args_type, const struct language_defn *language)
static enum ext_lang_bt_status extract_sym(PyObject *obj, gdb::unique_xmalloc_ptr< char > *name, struct symbol **sym, const struct block **sym_block, const struct language_defn **language)
enum ext_lang_bt_status gdbpy_apply_frame_filter(const struct extension_language_defn *extlang, frame_info_ptr frame, frame_filter_flags flags, enum ext_lang_frame_args args_type, struct ui_out *out, int frame_low, int frame_high)
static enum ext_lang_bt_status enumerate_args(PyObject *iter, struct ui_out *out, enum ext_lang_frame_args args_type, int print_args_field, frame_info_ptr frame)
static enum ext_lang_bt_status extract_value(PyObject *obj, struct value **value)
static void py_print_type(struct ui_out *out, struct value *val)
static PyObject * get_py_iter_from_func(PyObject *filter, const char *func)
static int mi_should_print(struct symbol *sym, enum mi_print_types type)
static enum ext_lang_bt_status py_print_frame(PyObject *filter, frame_filter_flags flags, enum ext_lang_frame_args args_type, struct ui_out *out, int indent, htab_t levels_printed)
static enum ext_lang_bt_status py_mi_print_variables(PyObject *filter, struct ui_out *out, struct value_print_options *opts, enum ext_lang_frame_args args_type, frame_info_ptr frame)
mi_print_types
@ MI_PRINT_LOCALS
@ MI_PRINT_ARGS
static enum ext_lang_bt_status py_print_args(PyObject *filter, struct ui_out *out, enum ext_lang_frame_args args_type, frame_info_ptr frame)
static enum ext_lang_bt_status enumerate_locals(PyObject *iter, struct ui_out *out, int indent, enum ext_lang_frame_args args_type, int print_args_field, frame_info_ptr frame)
static PyObject * bootstrap_python_frame_filters(frame_info_ptr frame, int frame_low, int frame_high)
static void py_print_single_arg(struct ui_out *out, const char *sym_name, struct frame_arg *fa, struct value *fv, const struct value_print_options *opts, enum ext_lang_frame_args args_type, int print_args_field, const struct language_defn *language)
static enum ext_lang_bt_status py_print_locals(PyObject *filter, struct ui_out *out, enum ext_lang_frame_args args_type, int indent, frame_info_ptr frame)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
Definition py-ref.h:42
struct symbol * symbol_object_to_symbol(PyObject *obj)
Definition py-symbol.c:357
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
Definition py-utils.c:282
int get_addr_from_python(PyObject *obj, CORE_ADDR *addr)
Definition py-utils.c:239
void gdbpy_convert_exception(const struct gdb_exception &exception)
Definition py-utils.c:217
gdb::unique_xmalloc_ptr< char > python_string_to_host_string(PyObject *obj)
Definition py-utils.c:142
int gdbpy_is_string(PyObject *obj)
Definition py-utils.c:164
struct value * convert_value_from_python(PyObject *obj)
Definition py-value.c:1892
#define PyObject_CallMethod
int gdb_python_initialized
void gdbpy_print_stack_or_quit()
void(* func)(remote_target *remote, char *)
void print_source_lines(struct symtab *s, int line, int stopline, print_source_lines_flags flags)
Definition source.c:1465
bool frame_show_address(frame_info_ptr frame, struct symtab_and_line sal)
Definition stack.c:314
void get_user_print_what_frame_info(gdb::optional< enum print_what > *what)
Definition stack.c:1004
Definition block.h:109
struct minimal_symbol * minsym
Definition minsyms.h:49
const char * entry_kind
Definition frame.h:959
struct value * val
Definition frame.h:944
gdb::unique_xmalloc_ptr< char > error
Definition frame.h:948
struct symbol * sym
Definition frame.h:940
CORE_ADDR addr
Definition frame.c:165
int level
Definition frame.c:131
const char * print_name() const
Definition symtab.h:475
enum language language() const
Definition symtab.h:502
address_class aclass() const
Definition symtab.h:1274
bool is_argument() const
Definition symtab.h:1306
struct symtab * symtab
Definition symtab.h:2328
Definition value.h:130
struct type * type() const
Definition value.h:180
@ LOC_STATIC
Definition symtab.h:979
@ LOC_BLOCK
Definition symtab.h:1028
@ LOC_LABEL
Definition symtab.h:1022
@ LOC_REGISTER
Definition symtab.h:993
@ LOC_REF_ARG
Definition symtab.h:1001
@ LOC_UNRESOLVED
Definition symtab.h:1057
@ LOC_LOCAL
Definition symtab.h:1013
@ LOC_CONST
Definition symtab.h:975
@ LOC_CONST_BYTES
Definition symtab.h:1033
@ LOC_UNDEF
Definition symtab.h:971
@ LOC_OPTIMIZED_OUT
Definition symtab.h:1062
@ LOC_TYPEDEF
Definition symtab.h:1018
@ LOC_REGPARM_ADDR
Definition symtab.h:1009
@ LOC_COMPUTED
Definition symtab.h:1066
@ LOC_ARG
Definition symtab.h:997
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
Definition typeprint.c:388
@ ui_left
Definition ui-out.h:45
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1886
void gdb_puts(const char *linebuffer, struct ui_file *stream)
Definition utils.c:1809
void get_user_print_options(struct value_print_options *opts)
Definition valprint.c:135
void common_val_print(struct value *value, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
Definition valprint.c:1033
int PyObject
Definition varobj.c:41