[binutils-gdb] gdb/dwarf: change dwarf2_fetch_cfa_info 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=8428e2c86801d9a186fcb2b43c6d5f5221a36308

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

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

Diff:
---
 gdb/dwarf2/frame.c |  7 ++++---
 gdb/dwarf2/frame.h | 32 ++++++++++++++++----------------
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index c8db0c3b19a..83dd7c2bc8c 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -768,7 +768,7 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs,
 
 /* See dwarf2/frame.h.  */
 
-int
+bool
 dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
 		       dwarf2_per_cu *data, int *regnum_out,
 		       LONGEST *offset_out, CORE_ADDR *text_offset_out,
@@ -815,14 +815,15 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
 	  *offset_out = -fs.regs.cfa_offset;
 	else
 	  *offset_out = fs.regs.cfa_offset;
-	return 1;
+
+	return true;
       }
 
     case CFA_EXP:
       *text_offset_out = per_objfile->objfile->text_section_offset ();
       *cfa_start_out = fs.regs.cfa_exp;
       *cfa_end_out = fs.regs.cfa_exp + fs.regs.cfa_exp_len;
-      return 0;
+      return false;
 
     default:
       internal_error (_("Unknown CFA rule."));
diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index 89fa234c43c..47f9ed88f7c 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -246,7 +246,7 @@ CORE_ADDR dwarf2_frame_cfa (const frame_info_ptr &this_frame);
 
 /* Find the CFA information for PC.
 
-   Return 1 if a register is used for the CFA, or 0 if another
+   Return true if a register is used for the CFA, or false if another
    expression is used.  Throw an exception on error.
 
    GDBARCH is the architecture to use.
@@ -254,17 +254,17 @@ CORE_ADDR dwarf2_frame_cfa (const frame_info_ptr &this_frame);
 
    REGNUM_OUT is an out parameter that is set to the register number.
    OFFSET_OUT is the offset to use from this register.
-   These are only filled in when 1 is returned.
+   These are only filled in when true is returned.
 
    TEXT_OFFSET_OUT, CFA_START_OUT, and CFA_END_OUT describe the CFA
-   in other cases.  These are only used when 0 is returned.  */
+   in other cases.  These are only used when false is returned.  */
 
-extern int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
-				  dwarf2_per_cu *data, int *regnum_out,
-				  LONGEST *offset_out,
-				  CORE_ADDR *text_offset_out,
-				  const gdb_byte **cfa_start_out,
-				  const gdb_byte **cfa_end_out);
+extern bool dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
+				   dwarf2_per_cu *data, int *regnum_out,
+				   LONGEST *offset_out,
+				   CORE_ADDR *text_offset_out,
+				   const gdb_byte **cfa_start_out,
+				   const gdb_byte **cfa_end_out);
 
 /* Allocate a new instance of the function unique data.
 
@@ -330,14 +330,14 @@ static inline void *dwarf2_frame_allocate_fn_data
   return nullptr;
 }
 
-static inline int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
-					 struct dwarf2_per_cu_data *data,
-					 int *regnum_out, LONGEST *offset_out,
-					 CORE_ADDR *text_offset_out,
-					 const gdb_byte **cfa_start_out,
-					 const gdb_byte **cfa_end_out)
+static inline bool
+dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
+		       struct dwarf2_per_cu_data *data, int *regnum_out,
+		       LONGEST *offset_out, CORE_ADDR *text_offset_out,
+		       const gdb_byte **cfa_start_out,
+		       const gdb_byte **cfa_end_out)
 {
-  return 0;
+  return false;
 }
 
 static inline void
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.