[binutils-gdb] [gdb] Simplify get_frame_function

Tom de Vries 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=e1557abbb01c35adbcdcc65f2a8b188908a006eb

commit e1557abbb01c35adbcdcc65f2a8b188908a006eb
Author: Tom de Vries <[email protected]>
Date:   Fri Apr 24 14:17:29 2026 +0200

    [gdb] Simplify get_frame_function
    
    Use block::containing_function to simplify get_frame_function.
    
    While we're at it, modernize using nullptr.

Diff:
---
 gdb/blockframe.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index ce28d99c7e4..8aafa6ffe57 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -116,14 +116,10 @@ struct symbol *
 get_frame_function (const frame_info_ptr &frame)
 {
   const struct block *bl = get_frame_block (frame, 0);
+  if (bl == nullptr)
+    return nullptr;
 
-  if (bl == NULL)
-    return NULL;
-
-  while (bl->function () == NULL && bl->superblock () != NULL)
-    bl = bl->superblock ();
-
-  return bl->function ();
+  return bl->containing_function ();
 }
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.