]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: introduce FRAME_SCOPED_DEBUG_ENTER_EXIT
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 25 Mar 2021 02:54:39 +0000 (22:54 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 25 Mar 2021 03:00:56 +0000 (23:00 -0400)
Change-Id: I45b69b4ed962e70572bc55b8adfb211483c1eeed

gdb/frame-unwind.c
gdb/frame.c
gdb/frame.h
gdbsupport/common-debug.h

index b19e95d350908545dd3ca7b6129ef07903d2352f..ca03f0ca8e722cd7d0549643c80626b123de737b 100644 (file)
@@ -171,6 +171,9 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
 void
 frame_unwind_find_by_frame (struct frame_info *this_frame, void **this_cache)
 {
+  FRAME_SCOPED_DEBUG_ENTER_EXIT;
+
+
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct frame_unwind_table *table
     = (struct frame_unwind_table *) gdbarch_data (gdbarch, frame_unwind_data);
index 4258c5e0edb7f417a20feb9b5640023ec43a2497..cb5b5afbf3284b374285dbb55535b387ec0bd9b3 100644 (file)
@@ -330,7 +330,8 @@ scoped_restore_selected_frame::~scoped_restore_selected_frame ()
 
 /* Flag to control debugging.  */
 
-unsigned int frame_debug;
+bool frame_debug;
+
 static void
 show_frame_debug (struct ui_file *file, int from_tty,
                  struct cmd_list_element *c, const char *value)
@@ -565,6 +566,8 @@ skip_tailcall_frames (struct frame_info *frame)
 static void
 compute_frame_id (struct frame_info *fi)
 {
+  FRAME_SCOPED_DEBUG_ENTER_EXIT;
+
   gdb_assert (fi->this_id.p == frame_id_status::NOT_COMPUTED);
 
   unsigned int entry_generation = get_frame_cache_generation ();
@@ -2170,10 +2173,9 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
 static struct frame_info *
 get_prev_frame_always_1 (struct frame_info *this_frame)
 {
-  struct gdbarch *gdbarch;
+  FRAME_SCOPED_DEBUG_ENTER_EXIT;
 
   gdb_assert (this_frame != NULL);
-  gdbarch = get_frame_arch (this_frame);
 
   if (frame_debug)
     {
@@ -2189,6 +2191,8 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
       frame_debug_printf ("%s", debug_file.c_str ());
     }
 
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+
   /* Only try to do the unwind once.  */
   if (this_frame->prev_p)
     {
@@ -2544,6 +2548,8 @@ inside_entry_func (frame_info *this_frame)
 struct frame_info *
 get_prev_frame (struct frame_info *this_frame)
 {
+  FRAME_SCOPED_DEBUG_ENTER_EXIT;
+
   CORE_ADDR frame_pc;
   int frame_pc_p;
 
@@ -3242,11 +3248,11 @@ Literal \"unlimited\" or zero means no limit."),
      set_backtrace_option_defs, &set_backtrace_cmdlist, &show_backtrace_cmdlist);
 
   /* Debug this files internals.  */
-  add_setshow_zuinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
+  add_setshow_boolean_cmd ("frame", class_maintenance, &frame_debug,  _("\
 Set frame debugging."), _("\
 Show frame debugging."), _("\
 When non-zero, frame specific internal debugging is enabled."),
-                            NULL,
-                            show_frame_debug,
-                            &setdebuglist, &showdebuglist);
+                          NULL,
+                          show_frame_debug,
+                          &setdebuglist, &showdebuglist);
 }
index 7a23126c9d419529b4f60256ca3a138e144c7afa..bcd2d476f3c3ad18650672a5db12f195d7a57adc 100644 (file)
@@ -71,6 +71,7 @@
 
 #include "language.h"
 #include "cli/cli-option.h"
+#include "gdbsupport/common-debug.h"
 
 struct symtab_and_line;
 struct frame_unwind;
@@ -211,13 +212,16 @@ extern const struct frame_id outer_frame_id;
 
 /* Flag to control debugging.  */
 
-extern unsigned int frame_debug;
+extern bool frame_debug;
 
 /* Print a "frame" debug statement.  */
 
 #define frame_debug_printf(fmt, ...) \
   debug_prefixed_printf_cond (frame_debug, "frame", fmt, ##__VA_ARGS__)
 
+#define FRAME_SCOPED_DEBUG_ENTER_EXIT \
+  scoped_debug_enter_exit (frame_debug, "frame")
+
 /* Construct a frame ID.  The first parameter is the frame's constant
    stack address (typically the outer-bound), and the second the
    frame's constant code address (typically the entry point).
index 05367401a7d2ac05a1284a4f15ca0d766f53c989..7288b694d5955854d44aec10ed30b27b6f8f2a55 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef COMMON_COMMON_DEBUG_H
 #define COMMON_COMMON_DEBUG_H
 
+#include "gdbsupport/preprocessor.h"
+
 /* Set to true to enable debugging of hardware breakpoint/
    watchpoint support code.  */