]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: change dwarf_block_to_fb_offset to return bool
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 11 Mar 2026 18:05:48 +0000 (14:05 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 12 Mar 2026 14:20:51 +0000 (10:20 -0400)
Change-Id: If62adeb3bf302de07e0dab46a1b9fad6050df800
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/expr.c
gdb/dwarf2/expr.h

index 217f494ebd3ca22e676aeb40e17272fe69846621..222f563e2a959345cca770925c42dd364b53b096 100644 (file)
@@ -1467,30 +1467,29 @@ dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf, const gdb_byte *buf_end,
   return dwarf_reg;
 }
 
-/* If <BUF..BUF_END] contains DW_FORM_block* with single DW_OP_fbreg(X) fill
-   in FB_OFFSET_RETURN with the X offset and return 1.  Otherwise return 0.  */
+/* See expr.h.  */
 
-int
+bool
 dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end,
                          CORE_ADDR *fb_offset_return)
 {
   int64_t fb_offset;
 
   if (buf_end <= buf)
-    return 0;
+    return false;
 
   if (*buf != DW_OP_fbreg)
-    return 0;
+    return false;
+
   buf++;
 
   buf = gdb_read_sleb128 (buf, buf_end, &fb_offset);
   if (buf == NULL)
-    return 0;
+    return false;
+
   *fb_offset_return = fb_offset;
-  if (buf != buf_end || fb_offset != (LONGEST) *fb_offset_return)
-    return 0;
 
-  return 1;
+  return buf == buf_end && fb_offset == (LONGEST) *fb_offset_return;
 }
 
 /* See expr.h.  */
index ad841658f632a0d5bdb52c6d2c9913fca102895a..eaa166935342f9c6be0cd193aee7a28551b629c8 100644 (file)
@@ -275,8 +275,12 @@ int dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf,
                                    const gdb_byte *buf_end,
                                    CORE_ADDR *deref_size_return);
 
-int dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end,
-                             CORE_ADDR *fb_offset_return);
+/* If <BUF..BUF_END] contains DW_FORM_block* with single DW_OP_fbreg(X) fill
+   in FB_OFFSET_RETURN with the X offset and return true.  Otherwise return
+   false.  */
+
+bool dwarf_block_to_fb_offset (const gdb_byte *buf, const gdb_byte *buf_end,
+                              CORE_ADDR *fb_offset_return);
 
 /* If <BUF..BUF_END] contains DW_FORM_block* with single DW_OP_bregSP(X) fill
    in SP_OFFSET_RETURN with the X offset and return true.  Otherwise return