[5/7] gdb: use frame_id_p instead of comparing to null_frame_id in frame_info_ptr::reinflate

Message ID 20221107155310.2590069-5-simon.marchi@polymtl.ca
State Committed
Commit 45eca9d9f36985672cb2303b4ea0b3c855961c1d
Headers
Series [1/7] gdb: clear other.m_cached_id in frame_info_ptr's move ctor |

Commit Message

Simon Marchi Nov. 7, 2022, 3:53 p.m. UTC
  From: Simon Marchi <simon.marchi@efficios.com>

The assertion

    gdb_assert (m_cached_id != null_frame_id);

is always true, as comparing equal to null_frame_id is always false
(it's the first case in frame_id::operator==, not sure why it's not this
way, but that's what it is).

Replace the comparison with a call to frame_id_p.

Change-Id: I93986e6a85ac56353690792552e5b3b4cedec7fb
---
 gdb/frame-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey Nov. 8, 2022, 5:43 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> From: Simon Marchi <simon.marchi@efficios.com>
Simon> The assertion

Simon>     gdb_assert (m_cached_id != null_frame_id);

Simon> is always true, as comparing equal to null_frame_id is always false
Simon> (it's the first case in frame_id::operator==, not sure why it's not this
Simon> way, but that's what it is).

Simon> Replace the comparison with a call to frame_id_p.

Looks good.

Tom
  

Patch

diff --git a/gdb/frame-info.c b/gdb/frame-info.c
index 84791205d906..584222dc490f 100644
--- a/gdb/frame-info.c
+++ b/gdb/frame-info.c
@@ -39,7 +39,7 @@  frame_info_ptr::prepare_reinflate ()
 void
 frame_info_ptr::reinflate ()
 {
-  gdb_assert (m_cached_id != null_frame_id);
+  gdb_assert (frame_id_p (m_cached_id));
 
   if (m_ptr == nullptr)
     m_ptr = frame_find_by_id (m_cached_id).get ();