aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-stack.c
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2024-02-07 19:51:26 +0100
committerHannes Domani <ssbssa@yahoo.de>2024-02-07 19:52:06 +0100
commitad7b7cb1f4a4a21b18740e5972b772a82fb05faf (patch)
treeee9c647fad5f041a1a50fcac2e178ecf4ff1fcc4 /gdb/mi/mi-cmd-stack.c
parent6fb99666f4bbc79708acb8efb2d80e57de67b80b (diff)
downloadgdb-ad7b7cb1f4a4a21b18740e5972b772a82fb05faf.zip
gdb-ad7b7cb1f4a4a21b18740e5972b772a82fb05faf.tar.gz
gdb-ad7b7cb1f4a4a21b18740e5972b772a82fb05faf.tar.bz2
Fix raw-frame-arguments in combination with frame-filters
Currently, if frame-filters are active, raw-values is used instead of raw-frame-arguments to decide if a pretty-printer should be invoked for frame arguments in a backtrace. In this example, "super struct" is the output of the pretty-printer: (gdb) disable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 If no frame-filter is active, then the raw-values print option does not affect the backtrace output: (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off Instead, the raw-frame-arguments option disables the pretty-printer in the backtrace: (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 But if a frame-filter is active, the same rules don't apply. The option raw-frame-arguments is ignored, but raw-values decides if the pretty-printer is used: (gdb) enable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 So this adds the PRINT_RAW_FRAME_ARGUMENTS flag to frame_filter_flag, which is then used in the frame-filter to override the raw flag in enumerate_args. Then the output is the same if a frame-filter is active, the pretty-printer for backtraces is only disabled with the raw-frame-arguments option: (gdb) enable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 Co-Authored-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/mi/mi-cmd-stack.c')
-rw-r--r--gdb/mi/mi-cmd-stack.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index d80739b..d4202b9 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -372,6 +372,8 @@ mi_cmd_stack_list_args (const char *command, const char *const *argv, int argc)
if (! raw_arg && frame_filters)
{
frame_filter_flags flags = PRINT_LEVEL | PRINT_ARGS;
+ if (user_frame_print_options.print_raw_frame_arguments)
+ flags |= PRINT_RAW_FRAME_ARGUMENTS;
int py_frame_low = frame_low;
/* We cannot pass -1 to frame_low, as that would signify a
@@ -466,6 +468,8 @@ mi_cmd_stack_list_variables (const char *command, const char *const *argv,
if (! raw_arg && frame_filters)
{
frame_filter_flags flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS;
+ if (user_frame_print_options.print_raw_frame_arguments)
+ flags |= PRINT_RAW_FRAME_ARGUMENTS;
result = mi_apply_ext_lang_frame_filter (frame, flags,
print_value,
@@ -491,7 +495,8 @@ mi_cmd_stack_list_variables (const char *command, const char *const *argv,
static void
list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
- enum print_values values, int skip_unavailable)
+ enum print_values values, int skip_unavailable,
+ const frame_print_options &fp_opts)
{
struct ui_out *uiout = current_uiout;
@@ -548,6 +553,8 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
get_no_prettyformat_print_options (&opts);
opts.deref_ref = true;
+ if (arg->sym->is_argument ())
+ opts.raw = fp_opts.print_raw_frame_arguments;
common_val_print (arg->val, &stb, 0, &opts,
language_def (arg->sym->language ()));
}
@@ -664,9 +671,11 @@ list_args_or_locals (const frame_print_options &fp_opts,
}
if (arg.entry_kind != print_entry_values_only)
- list_arg_or_local (&arg, what, values, skip_unavailable);
+ list_arg_or_local (&arg, what, values, skip_unavailable,
+ fp_opts);
if (entryarg.entry_kind != print_entry_values_no)
- list_arg_or_local (&entryarg, what, values, skip_unavailable);
+ list_arg_or_local (&entryarg, what, values, skip_unavailable,
+ fp_opts);
}
}