[binutils-gdb] gdb/dwarf: change dwarf2_frame_ops to return bool

Simon Marchi via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a4d7df7666b1020401f9cc562e3e8e217243d80e

commit a4d7df7666b1020401f9cc562e3e8e217243d80e
Author: Simon Marchi <[email protected]>
Date:   Wed Mar 11 14:05:45 2026 -0400

    gdb/dwarf: change dwarf2_frame_ops to return bool
    
    Change-Id: I0531b413823b1edc419be8f4977e9baa9efe3833
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/dwarf2/frame.h     |  2 +-
 gdb/i386-darwin-tdep.c |  2 +-
 gdb/i386-darwin-tdep.h |  2 +-
 gdb/i386-linux-tdep.c  | 12 +++++-------
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index c3bbfcc03f5..6ecd5d0d656 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -200,7 +200,7 @@ struct dwarf2_frame_state
 
 using init_reg_ftype = void (gdbarch *, int, dwarf2_frame_state_reg *,
 			     const frame_info_ptr &);
-using signal_frame_p_ftype = int (gdbarch *, const frame_info_ptr &);
+using signal_frame_p_ftype = bool (gdbarch *, const frame_info_ptr &);
 using adjust_regnum_ftype = int (gdbarch *, int, int);
 
 /* If DWARF supoprt was requested, create the real prototype for the
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index 76617a97a64..b9ea7cb3f36 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -97,7 +97,7 @@ i386_darwin_sigcontext_addr (const frame_info_ptr &this_frame)
    Without this function, the frame is recognized as a normal frame which is
    not expected.  */
 
-int
+bool
 darwin_dwarf_signal_frame_p (struct gdbarch *gdbarch,
 			     const frame_info_ptr &this_frame)
 {
diff --git a/gdb/i386-darwin-tdep.h b/gdb/i386-darwin-tdep.h
index a0f88b39c28..1496e2829c1 100644
--- a/gdb/i386-darwin-tdep.h
+++ b/gdb/i386-darwin-tdep.h
@@ -27,6 +27,6 @@
 extern int i386_darwin_thread_state_reg_offset[];
 extern const int i386_darwin_thread_state_num_regs;
 
-int darwin_dwarf_signal_frame_p (struct gdbarch *, const frame_info_ptr &);
+bool darwin_dwarf_signal_frame_p (struct gdbarch *, const frame_info_ptr &);
 
 #endif /* GDB_I386_DARWIN_TDEP_H */
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 4a4daabbeaa..dae4a7b7eeb 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -250,10 +250,10 @@ i386_linux_sigtramp_p (const frame_info_ptr &this_frame)
 	  || strcmp ("__restore_rt", name) == 0);
 }
 
-/* Return one if the PC of THIS_FRAME is in a signal trampoline which
+/* Return true if the PC of THIS_FRAME is in a signal trampoline which
    may have DWARF-2 CFI.  */
 
-static int
+static bool
 i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
 				 const frame_info_ptr &this_frame)
 {
@@ -264,11 +264,9 @@ i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
 
   /* If a vsyscall DSO is in use, the signal trampolines may have these
      names.  */
-  if (name && (strcmp (name, "__kernel_sigreturn") == 0
-	       || strcmp (name, "__kernel_rt_sigreturn") == 0))
-    return 1;
-
-  return 0;
+  return (name != nullptr
+	  && (streq (name, "__kernel_sigreturn")
+	      || streq (name, "__kernel_rt_sigreturn")));
 }
 
 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>.  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.