[binutils-gdb] gdb/dwarf: change dwarf_block_to_fb_offset 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=c0580ba2a17de9c494eb30786cb370a6df3f3dac commit c0580ba2a17de9c494eb30786cb370a6df3f3dac Author: Simon Marchi <[email protected]> Date: Wed Mar 11 14:05:48 2026 -0400 gdb/dwarf: change dwarf_block_to_fb_offset to return bool Change-Id: If62adeb3bf302de07e0dab46a1b9fad6050df800 Approved-By: Tom Tromey <[email protected]> Diff: --- gdb/dwarf2/expr.c | 17 ++++++++--------- gdb/dwarf2/expr.h | 8 ++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 217f494ebd3..222f563e2a9 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -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. */ diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index ad841658f63..eaa16693534 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -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