Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/10] [gdb] Use block::containing_function
Date: Fri,  1 May 2026 14:44:55 +0200	[thread overview]
Message-ID: <20260501124504.2233495-2-tdevries@suse.de> (raw)
In-Reply-To: <20260501124504.2233495-1-tdevries@suse.de>

Add uses of block::containing_function.
---
 gdb/go-lang.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 3b388c961fa..657679f3fe8 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -430,28 +430,21 @@ go_symbol_package_name (const struct symbol *sym)
 gdb::unique_xmalloc_ptr<char>
 go_block_package_name (const struct block *block)
 {
-  while (block != NULL)
-    {
-      struct symbol *function = block->function ();
-
-      if (function != NULL)
-	{
-	  gdb::unique_xmalloc_ptr<char> package_name
-	    = go_symbol_package_name (function);
-
-	  if (package_name != NULL)
-	    return package_name;
+  struct symbol *function
+    = block != nullptr ? block->containing_function () : nullptr;
+  if (function == nullptr)
+    return nullptr;
 
-	  /* Stop looking if we find a function without a package name.
-	     We're most likely outside of Go and thus the concept of the
-	     "current" package is gone.  */
-	  return NULL;
-	}
+  gdb::unique_xmalloc_ptr<char> package_name
+    = go_symbol_package_name (function);
 
-      block = block->superblock ();
-    }
+  if (package_name != nullptr)
+    return package_name;
 
-  return NULL;
+  /* Stop looking if we find a function without a package name.
+     We're most likely outside of Go and thus the concept of the
+     "current" package is gone.  */
+  return nullptr;
 }
 
 /* See language.h.  */
-- 
2.51.0


  reply	other threads:[~2026-05-01 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 12:44 [PATCH 00/10] [gdb] Add superblocks range loops Tom de Vries
2026-05-01 12:44 ` Tom de Vries [this message]
2026-05-01 12:44 ` [PATCH 02/10] [gdb] Factor out block::containing_function_block Tom de Vries
2026-05-01 12:44 ` [PATCH 03/10] [gdb] Use block::containing_function_block Tom de Vries
2026-05-01 12:44 ` [PATCH 04/10] [gdb] Add unit test for next_iterator Tom de Vries
2026-05-01 12:44 ` [PATCH 05/10] [gdbsupport] Use using instead of typedef in next_iterator Tom de Vries
2026-05-01 12:45 ` [PATCH 06/10] [gdbsupport] Factor out base_next_iterator Tom de Vries
2026-05-08 19:17   ` Tom Tromey
2026-05-01 12:45 ` [PATCH 07/10] [gdb] Add block::block_and_superblocks Tom de Vries
2026-05-01 12:45 ` [PATCH 08/10] [gdb] Use block::block_and_superblocks Tom de Vries
2026-05-08 19:41   ` Tom Tromey
2026-05-01 12:45 ` [PATCH 09/10] [gdb] Add block::block_and_superblocks_in_fn Tom de Vries
2026-05-01 12:45 ` [PATCH 10/10] [gdb] Use block::block_and_superblocks_in_fn Tom de Vries
2026-06-09 12:40 ` [PATCH 00/10] [gdb] Add superblocks range loops Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260501124504.2233495-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox