This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what.
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 30 Aug 2013 16:50:19 +0100
- Subject: [PATCH 2/3] print_stack_frame&friends: merge print_level, print_args and print_what.
- Authentication-results: sourceware.org; auth=none
- References: <20130830155005 dot 16741 dot 57766 dot stgit at brno dot lan>
Looking at print_frame_info, I noticed things like:
location_print = (print_what == LOCATION
|| print_what == LOC_AND_ADDRESS
|| print_what == SRC_AND_LOC);
...
source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
...
which hint that print_what could actually be a set of bit flags. Then
we have print_level and print_args as separate parameters, but those
also specify print formatting, so, if we make print_what a set of bit
flags, those could be merged in as well. That's what this patch does.
In print_frame_info, there's a SRC_LINE check that looks like:
if (source_print && sal.symtab)
{
int done = 0;
int mid_statement = ((print_what == SRC_LINE)
&& frame_show_address (frame, sal));
Now, with "print source" a single bit (SRC_LINE == PF_SRC_LINE;
SRC_AND_LOC == PF_SRC_LINE | PF_LOCATION; etc.), what to replace that
check with? Check for the non-existence of other flags? I think
that'd be brittle. What we need is yet another flag that callers pass
in when they want that mid_statement bit to trigger -- that's what the
new PF_SRC_ADDRESS is for.
(After writing this, I found out that Cagney had already hinted at
this merge when adding print_level/print_args:
<https://sourceware.org/ml/gdb-patches/2004-04/msg00585.html>)
gdb/
2013-08-30 Pedro Alves <palves@redhat.com>
* frame.h (enum print_what) <SRC_LINE, LOCATION, SRC_AND_LOC,
LOC_AND_ADDRESS>: Delete.
<PF_LOCATION, PF_LOC_LEVEL, PF_LOC_ADDRESS, PF_LOC_ARGS,
PF_SRC_LINE, PF_SRC_ADDRESS>: New values.
* stack.c (print_stack_frame): Remove print_level parameter.
Adjust.
(print_frame_info, print_frame): Remove print_level and print_args
parameters. Adjust.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust.
* ada-tasks.c (task_command_1): Adjust.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
Adjust.
* corelow.c (core_open): Adjust.
* infcmd.c (finish_command, kill_command): Adjust.
* inferior.c (inferior_command): Adjust.
* infrun.c (normal_stop): Adjust.
* linux-fork.c (linux_fork_context): Adjust.
* record-full.c (record_full_goto_entry, record_full_restore):
Adjust.
* remote-mips.c (common_open): Adjust.
* thread.c (print_thread_info, restore_selected_frame): Adjust.
(restore_selected_frame, do_captured_thread_select): Adjust.
* tracepoint.c (tfind_1): Adjust.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Adjust.
* mi/mi-interp.c (mi_on_normal_stop): Adjust.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Adjust.
---
gdb/mi/mi-cmd-stack.c | 8 +++++---
gdb/mi/mi-interp.c | 3 ++-
gdb/mi/mi-main.c | 6 ++++--
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index dfb6719..b2507d0 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1275,6 +1275,7 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
const int taskno = value_as_long (parse_and_eval (taskno_str));
struct ada_task_info *task_info;
struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
+ enum print_what print_what;
if (taskno <= 0 || taskno > VEC_length (ada_task_info_s, data->task_list))
error (_("Task ID %d not known. Use the \"info tasks\" command to\n"
@@ -1307,11 +1308,12 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
taskno);
switch_to_thread (task_info->ptid);
- ada_find_printable_frame (get_selected_frame (NULL));
printf_filtered (_("[Switching to task %d]\n"), taskno);
- print_stack_frame (get_selected_frame (NULL),
- frame_relative_level (get_selected_frame (NULL)),
- SRC_AND_LOC, 1);
+ print_what = PF_SRC_LINE | PF_LOCATION;
+ ada_find_printable_frame (get_selected_frame (NULL));
+ if (frame_relative_level (get_selected_frame (NULL)))
+ print_what |= PF_LOC_LEVEL;
+ print_stack_frame (get_selected_frame (NULL), print_what, 1);
}
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index d1e7ca8..a646e53 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -100,7 +100,8 @@ bsd_kvm_open (char *filename, int from_tty)
target_fetch_registers (get_current_regcache (), -1);
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL), 0,
+ PF_LOCATION | PF_SRC_LINE, 1);
}
static void
@@ -286,7 +287,8 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
target_fetch_registers (get_current_regcache (), -1);
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL), 0,
+ PF_LOCATION | PF_SRC_LINE, 1);
}
#endif
@@ -306,7 +308,8 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
target_fetch_registers (get_current_regcache (), -1);
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL), 0,
+ PF_LOCATION | PF_SRC_LINE, 1);
}
static int
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 7a5aaab..d7bc5ed 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -453,7 +453,8 @@ core_open (char *filename, int from_tty)
/* Now, set up the frame cache, and print the top of stack. */
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
static void
diff --git a/gdb/frame.h b/gdb/frame.h
index a5e1629..95f0285 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -595,18 +595,37 @@ extern struct gdbarch *frame_unwind_arch (struct frame_info *frame);
extern struct gdbarch *frame_unwind_caller_arch (struct frame_info *frame);
-/* Values for the source flag to be used in print_frame_info_base(). */
+/* Bit flags to be used with print_stack_frame, print_frame_info and
+ friends. */
+
enum print_what
{
- /* Print only the source line, like in stepi. */
- SRC_LINE = -1,
- /* Print only the location, i.e. level, address (sometimes)
- function, args, file, line, line num. */
- LOCATION,
- /* Print both of the above. */
- SRC_AND_LOC,
- /* Print location only, but always include the address. */
- LOC_AND_ADDRESS
+ /* Print the location, i.e. level (if requested), address
+ (sometimes), function, args (if requested), file, line, line
+ num. */
+ PF_LOCATION = 1 << 0,
+
+ /* Print frame level before the location (e.g., #0). */
+ PF_LOC_LEVEL = 1 << 1,
+
+ /* Always print address in addition to the location. If not
+ specified, the address is printed if there's no symtab for the
+ location or if the location points in the middle of a
+ statement. */
+ PF_LOC_ADDRESS = 1 << 2,
+
+ /* Print function arguments. */
+ PF_LOC_ARGS = 1 << 3,
+
+ /* Print the source line, if possible. If not possible (e.g.,
+ after a stepi in code that has no debug info), print the
+ location instead. */
+ PF_SRC_LINE = 1 << 4,
+
+ /* Print address before the source line if PC points to the middle
+ of a statement. Only valid if PF_SRC_LINE is also
+ specified. */
+ PF_SRC_ADDRESS = 1 << 5,
};
/* Allocate zero initialized memory from the frame cache obstack.
@@ -659,12 +678,12 @@ extern CORE_ADDR get_pc_function_start (CORE_ADDR);
extern struct frame_info *find_relative_frame (struct frame_info *, int *);
-extern void print_stack_frame (struct frame_info *, int print_level,
+extern void print_stack_frame (struct frame_info *,
enum print_what print_what,
int set_current_sal);
-extern void print_frame_info (struct frame_info *, int print_level,
- enum print_what print_what, int args,
+extern void print_frame_info (struct frame_info *,
+ enum print_what print_what,
int set_current_sal);
extern struct frame_info *block_innermost_frame (const struct block *);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 242aac1..327ba1d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1765,7 +1765,8 @@ finish_command (char *arg, int from_tty)
if (from_tty)
{
printf_filtered (_("Run till exit from "));
- print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL, 0);
}
proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT, 1);
@@ -1790,7 +1791,8 @@ finish_command (char *arg, int from_tty)
else
printf_filtered (_("Run till exit from "));
- print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL, 0);
}
if (execution_direction == EXEC_REVERSE)
@@ -2334,7 +2336,8 @@ kill_command (char *arg, int from_tty)
if (target_has_stack)
{
printf_filtered (_("In %s,\n"), target_longname);
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
}
bfd_cache_close_all ();
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 28a5200..39fe745 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -739,7 +739,8 @@ inferior_command (char *args, int from_tty)
else if (inf->pid != 0)
{
ui_out_text (current_uiout, "\n");
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d09c977..c24183a 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6056,7 +6056,7 @@ normal_stop (void)
if (stop_print_frame && !batch_silent)
{
int bpstat_ret;
- int source_flag;
+ enum print_what print_what;
int do_frame_printing = 1;
struct thread_info *tp = inferior_thread ();
@@ -6071,34 +6071,32 @@ normal_stop (void)
&& frame_id_eq (tp->control.step_frame_id,
get_frame_id (get_current_frame ()))
&& step_start_function == find_pc_function (stop_pc))
- source_flag = SRC_LINE; /* Finished step, just
- print source line. */
+ print_what = PF_SRC_LINE; /* Finished step. */
else
- source_flag = SRC_AND_LOC; /* Print location and
- source line. */
+ print_what = PF_LOCATION | PF_SRC_LINE;
break;
case PRINT_SRC_AND_LOC:
- source_flag = SRC_AND_LOC; /* Print location and
- source line. */
+ print_what = PF_LOCATION | PF_SRC_LINE;
break;
case PRINT_SRC_ONLY:
- source_flag = SRC_LINE;
+ print_what = PF_SRC_LINE;
break;
case PRINT_NOTHING:
- source_flag = SRC_LINE; /* something bogus */
+ print_what = PF_SRC_LINE; /* something bogus */
do_frame_printing = 0;
break;
default:
internal_error (__FILE__, __LINE__, _("Unknown value."));
}
- /* The behavior of this routine with respect to the source
- flag is:
- SRC_LINE: Print only source line
- LOCATION: Print only location
- SRC_AND_LOC: Print location and source line. */
+ /* If only printing source, then make sure to print the
+ address if the program landed in the middle of a
+ statement. */
+ if (print_what == PF_SRC_LINE)
+ print_what |= PF_SRC_ADDRESS;
+
if (do_frame_printing)
- print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
+ print_stack_frame (get_selected_frame (NULL), print_what, 1);
/* Display the auto-display expressions. */
do_displays ();
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 3774a7f..f1821c8 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -731,7 +731,8 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
printf_filtered (_("Switching to %s\n"),
target_pid_to_str (inferior_ptid));
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* Switch inferior process (checkpoint) context, by checkpoint id. */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 6101341..edc2c1f 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -158,8 +158,9 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
{
QUIT;
/* Print the location and the address always, even for level 0.
- If args is 0, don't print the arguments. */
- print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
+ Don't print the arguments. */
+ print_frame_info (fi, PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS,
+ 0);
}
}
@@ -691,5 +692,6 @@ mi_cmd_stack_info_frame (char *command, char **argv, int argc)
if (argc > 0)
error (_("-stack-info-frame: No arguments allowed"));
- print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
+ print_frame_info (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
}
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 80cc005..be7d360 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -448,7 +448,8 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
get_last_target_status (&last_ptid, &last);
bpstat_print (bs, last.kind);
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_SRC_LINE, 1);
current_uiout = saved_uiout;
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e8c4744..a176c59 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -194,7 +194,8 @@ mi_cmd_exec_return (char *command, char **argv, int argc)
/* Because we have called return_command with from_tty = 0, we need
to print the frame here. */
- print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
}
void
@@ -2484,7 +2485,8 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
error (_("Invalid mode '%s'"), mode);
if (has_stack_frames () || get_traceframe_number () >= 0)
- print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ADDRESS, 1);
}
void
diff --git a/gdb/record-full.c b/gdb/record-full.c
index f9af408..e90b5e9 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2004,7 +2004,8 @@ record_full_goto_entry (struct record_full_entry *p)
registers_changed ();
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* The "to_goto_record_begin" target method. */
@@ -2590,7 +2591,8 @@ record_full_restore (void)
printf_filtered (_("Restored records from core file %s.\n"),
bfd_get_filename (core_bfd));
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* bfdcore_write -- write bytes into a core file section. */
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index bf6cce5..7817bc7 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1661,7 +1661,8 @@ seen from the board via TFTP, specify that name as the third parameter.\n"));
reinit_frame_cache ();
registers_changed ();
stop_pc = regcache_read_pc (get_current_regcache ());
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL), 0,
+ PF_LOCATION | PF_SRC_LINE, 1);
xfree (serial_port_name);
do_cleanups (cleanup);
diff --git a/gdb/stack.c b/gdb/stack.c
index cd4ac7a..f8ad24a 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -95,8 +95,8 @@ const char *print_entry_values = print_entry_values_default;
static void print_frame_local_vars (struct frame_info *, int,
struct ui_file *);
-static void print_frame (struct frame_info *frame, int print_level,
- enum print_what print_what, int print_args,
+static void print_frame (struct frame_info *frame,
+ enum print_what print_what,
struct symtab_and_line sal);
static void set_last_displayed_sal (int valid,
@@ -146,29 +146,30 @@ frame_show_address (struct frame_info *frame,
return get_frame_pc (frame) != sal.pc;
}
-/* Show or print a stack frame FRAME briefly. The output is format
- according to PRINT_LEVEL and PRINT_WHAT printing the frame's
- relative level, function name, argument list, and file name and
- line number. If the frame's PC is not at the beginning of the
- source line, the actual PC is printed at the beginning. */
+/* Show or print a stack frame FRAME briefly. The output is formatted
+ according to PRINT_WHAT, printing the frame's relative level,
+ function name, argument list, file name and line number. If the
+ frame's PC is not at the beginning of the source line, the actual
+ PC is printed at the beginning. */
void
-print_stack_frame (struct frame_info *frame, int print_level,
- enum print_what print_what,
+print_stack_frame (struct frame_info *frame, enum print_what print_what,
int set_current_sal)
{
volatile struct gdb_exception e;
- /* For mi, alway print location and address. */
+ /* For mi, alway print location and address, and no source line. */
if (ui_out_is_mi_like_p (current_uiout))
- print_what = LOC_AND_ADDRESS;
+ {
+ print_what |= PF_LOCATION | PF_LOC_ADDRESS;
+ print_what &= ~PF_SRC_LINE;
+ }
TRY_CATCH (e, RETURN_MASK_ERROR)
{
- int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
+ int center = (print_what & PF_SRC_LINE) != 0;
- print_frame_info (frame, print_level, print_what, 1 /* print_args */,
- set_current_sal);
+ print_frame_info (frame, print_what | PF_LOC_ARGS, set_current_sal);
if (set_current_sal)
set_current_sal_from_frame (frame, center);
}
@@ -770,20 +771,11 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
}
}
-/* Print information about frame FRAME. The output is format according
- to PRINT_LEVEL and PRINT_WHAT and PRINT_ARGS. The meaning of
- PRINT_WHAT is:
-
- SRC_LINE: Print only source line.
- LOCATION: Print only location.
- LOC_AND_SRC: Print location and source line.
-
- Used in "where" output, and to emit breakpoint or step
- messages. */
+/* Print information about frame FRAME. The output is formatted
+ according to PRINT_WHAT. */
void
-print_frame_info (struct frame_info *frame, int print_level,
- enum print_what print_what, int print_args,
+print_frame_info (struct frame_info *frame, enum print_what print_what,
int set_current_sal)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -798,6 +790,7 @@ print_frame_info (struct frame_info *frame, int print_level,
{
struct cleanup *uiout_cleanup
= make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
+ int print_level = (print_what & PF_LOC_LEVEL) != 0;
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
gdbarch, get_frame_pc (frame));
@@ -847,14 +840,12 @@ print_frame_info (struct frame_info *frame, int print_level,
to get the line containing FRAME->pc. */
find_frame_sal (frame, &sal);
- location_print = (print_what == LOCATION
- || print_what == LOC_AND_ADDRESS
- || print_what == SRC_AND_LOC);
+ location_print = (print_what & PF_LOCATION) != 0;
if (location_print || !sal.symtab)
- print_frame (frame, print_level, print_what, print_args, sal);
+ print_frame (frame, print_what, sal);
- source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
+ source_print = (print_what & PF_SRC_LINE) != 0;
/* If disassemble-next-line is set to auto or on and doesn't have
the line debug messages for $pc, output the next instruction. */
@@ -867,7 +858,7 @@ print_frame_info (struct frame_info *frame, int print_level,
if (source_print && sal.symtab)
{
int done = 0;
- int mid_statement = ((print_what == SRC_LINE)
+ int mid_statement = ((print_what & PF_SRC_ADDRESS) != 0
&& frame_show_address (frame, sal));
if (annotation_level)
@@ -1126,8 +1117,7 @@ find_frame_funname (struct frame_info *frame, char **funname,
}
static void
-print_frame (struct frame_info *frame, int print_level,
- enum print_what print_what, int print_args,
+print_frame (struct frame_info *frame, enum print_what print_what,
struct symtab_and_line sal)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1140,6 +1130,8 @@ print_frame (struct frame_info *frame, int print_level,
struct symbol *func;
CORE_ADDR pc = 0;
int pc_p;
+ int print_level = ((print_what & PF_LOC_LEVEL) != 0);
+ int print_args = ((print_what & PF_LOC_ARGS) != 0);
pc_p = get_frame_pc_if_available (frame, &pc);
@@ -1164,7 +1156,8 @@ print_frame (struct frame_info *frame, int print_level,
if (opts.addressprint)
if (!sal.symtab
|| frame_show_address (frame, sal)
- || print_what == LOC_AND_ADDRESS)
+ || ((print_what & PF_LOCATION) != 0
+ && (print_what & PF_LOC_ADDRESS) != 0))
{
annotate_frame_address ();
if (pc_p)
@@ -1791,7 +1784,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
hand, perhaps the code does or could be fixed to make sure
the frame->prev field gets set to NULL in that case). */
- print_frame_info (fi, 1, LOCATION, 1, 0);
+ print_frame_info (fi, PF_LOCATION | PF_LOC_LEVEL | PF_LOC_ARGS, 0);
if (show_locals)
{
struct frame_id frame_id = get_frame_id (fi);
@@ -2188,7 +2181,7 @@ select_and_print_frame (struct frame_info *frame)
{
select_frame (frame);
if (frame)
- print_stack_frame (frame, 1, SRC_AND_LOC, 1);
+ print_stack_frame (frame, PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* Return the symbol-block in which the selected frame is executing.
@@ -2266,7 +2259,8 @@ static void
frame_command (char *level_exp, int from_tty)
{
select_frame_command (level_exp, from_tty);
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* The XDB Compatibility command to print the current frame. */
@@ -2274,7 +2268,8 @@ frame_command (char *level_exp, int from_tty)
static void
current_frame_command (char *level_exp, int from_tty)
{
- print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (_("No stack.")),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* Select the frame up one or COUNT_EXP stack levels from the
@@ -2305,7 +2300,8 @@ static void
up_command (char *count_exp, int from_tty)
{
up_silently_base (count_exp);
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* Select the frame down one or COUNT_EXP stack levels from the previously
@@ -2344,7 +2340,8 @@ static void
down_command (char *count_exp, int from_tty)
{
down_silently_base (count_exp);
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
diff --git a/gdb/thread.c b/gdb/thread.c
index 498e547..4038d8a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -923,13 +923,17 @@ print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
ui_out_text (uiout, "(running)\n");
else
{
+ enum print_what print_what;
+
/* The switch below puts us at the top of the stack (leaf
frame). */
switch_to_thread (tp->ptid);
- print_stack_frame (get_selected_frame (NULL),
- /* For MI output, print frame level. */
- ui_out_is_mi_like_p (uiout),
- LOCATION, 0);
+
+ print_what = PF_LOCATION;
+ /* For MI output, print frame level. */
+ if (ui_out_is_mi_like_p (uiout))
+ print_what |= PF_LOC_LEVEL;
+ print_stack_frame (get_selected_frame (NULL), print_what, 0);
}
if (ui_out_is_mi_like_p (uiout))
@@ -1082,7 +1086,8 @@ restore_selected_frame (struct frame_id a_frame_id, int frame_level)
/* For MI, we should probably have a notification about
current frame change. But this error is not very
likely, so don't bother for now. */
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
}
@@ -1467,7 +1472,8 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
else
{
ui_out_text (uiout, "\n");
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+ print_stack_frame (get_selected_frame (NULL),
+ PF_LOCATION | PF_LOC_LEVEL | PF_SRC_LINE, 1);
}
/* Since the current thread may have changed, see if there is any
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c086587..deabf28 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2440,11 +2440,13 @@ tfind_1 (enum trace_find_type type, int num,
if (frame_id_eq (old_frame_id,
get_frame_id (get_current_frame ())))
- print_what = SRC_LINE;
+ print_what = PF_SRC_LINE | PF_SRC_ADDRESS;
else
- print_what = SRC_AND_LOC;
+ print_what = PF_LOCATION | PF_SRC_LINE;
- print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
+ print_what |= PF_LOC_LEVEL;
+
+ print_stack_frame (get_selected_frame (NULL), print_what, 1);
do_displays ();
}
}