]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Simplify get_frame_function
authorTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 12:17:29 +0000 (14:17 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 12:17:29 +0000 (14:17 +0200)
Use block::containing_function to simplify get_frame_function.

While we're at it, modernize using nullptr.

gdb/blockframe.c

index ce28d99c7e4b4036a16d053b6f2b0a714a60142c..8aafa6ffe572bbb5b0f98246023640d86149490e 100644 (file)
@@ -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 ();
 }
 \f