This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 02/10] Change backtrace_command_1 calling to use flags
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Tue, 25 Apr 2017 13:41:05 -0600
- Subject: [RFA 02/10] Change backtrace_command_1 calling to use flags
- Authentication-results: sourceware.org; auth=none
- References: <20170425194113.17862-1-tom@tromey.com>
The next patch will add more flags to backtrace_command_1; and rather
than add another boolean argument, this patch changes it to accept a
flags value.
ChangeLog
2017-04-25 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Remove "show_locals" parameter,
add "flags".
(backtrace_command): Remove "fulltrace", add "flags".
---
gdb/ChangeLog | 6 ++++++
gdb/stack.c | 15 ++++++---------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 48f2063..ab9b432 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2017-04-25 Tom Tromey <tom@tromey.com>
+ * stack.c (backtrace_command_1): Remove "show_locals" parameter,
+ add "flags".
+ (backtrace_command): Remove "fulltrace", add "flags".
+
+2017-04-25 Tom Tromey <tom@tromey.com>
+
* stack.c (backtrace_command): Rewrite command line parsing.
2017-04-25 Yao Qi <yao.qi@linaro.org>
diff --git a/gdb/stack.c b/gdb/stack.c
index c2fc3f1..b320c93 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1714,7 +1714,7 @@ frame_info (char *addr_exp, int from_tty)
frames. */
static void
-backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
+backtrace_command_1 (char *count_exp, int flags, int no_filters,
int from_tty)
{
struct frame_info *fi;
@@ -1795,11 +1795,9 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
if (! no_filters)
{
- int flags = PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
enum ext_lang_frame_args arg_type;
- if (show_locals)
- flags |= PRINT_LOCALS;
+ flags |= PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
if (!strcmp (print_frame_arguments, "scalars"))
arg_type = CLI_SCALAR_VALUES;
@@ -1827,7 +1825,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
the frame->prev field gets set to NULL in that case). */
print_frame_info (fi, 1, LOCATION, 1, 0);
- if (show_locals)
+ if ((flags & PRINT_LOCALS) != 0)
{
struct frame_id frame_id = get_frame_id (fi);
@@ -1868,7 +1866,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
static void
backtrace_command (char *arg, int from_tty)
{
- bool fulltrace = false;
+ int flags = 0;
bool filters = true;
if (arg)
@@ -1891,7 +1889,7 @@ backtrace_command (char *arg, int from_tty)
if (subset_compare (this_arg, "no-filters"))
filters = false;
else if (subset_compare (this_arg, "full"))
- fulltrace = true;
+ flags |= PRINT_LOCALS;
else
{
/* Not a recognized argument, so stop. */
@@ -1906,8 +1904,7 @@ backtrace_command (char *arg, int from_tty)
arg = NULL;
}
- backtrace_command_1 (arg, fulltrace /* show_locals */,
- !filters /* no frame-filters */, from_tty);
+ backtrace_command_1 (arg, flags, !filters /* no frame-filters */, from_tty);
}
/* Iterate over the local variables of a block B, calling CB with
--
2.9.3