[binutils-gdb] gdb: introduce blockvector_up

Simon Marchi simark@sourceware.org
Mon Nov 3 21:41:52 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f4cb3ab5ae8b390a7eecf54b13cf193b82d6ccc

commit 6f4cb3ab5ae8b390a7eecf54b13cf193b82d6ccc
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Mon Nov 3 12:45:10 2025 -0500

    gdb: introduce blockvector_up
    
    Change-Id: Id43c5982969f85b5931ba8a32d208a7326ed3492
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/block.h    | 2 ++
 gdb/buildsym.c | 3 +--
 gdb/buildsym.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/block.h b/gdb/block.h
index 78fa375a473..87ef7fab197 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -512,6 +512,8 @@ private:
   std::vector<struct block *> m_blocks;
 };
 
+using blockvector_up = std::unique_ptr<blockvector>;
+
 extern const struct blockvector *blockvector_for_pc (CORE_ADDR,
 					       const struct block **);
 
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index b757c78eb36..750f049d720 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -830,7 +830,6 @@ buildsym_compunit::end_compunit_symtab_from_static_block
   (struct block *static_block, bool expandable)
 {
   struct compunit_symtab *cu = m_compunit_symtab;
-  std::unique_ptr<blockvector> blockvector;
   struct subfile *subfile;
   CORE_ADDR end_addr;
 
@@ -856,7 +855,7 @@ buildsym_compunit::end_compunit_symtab_from_static_block
   finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
 			 m_last_source_start_addr, end_addr,
 			 true, expandable);
-  blockvector = make_blockvector ();
+  blockvector_up blockvector = make_blockvector ();
 
   /* Read the line table if it has to be read separately.
      This is only used by xcoffread.c.  */
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 2a64ad5640b..f7fb2c2c452 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -19,6 +19,7 @@
 #ifndef GDB_BUILDSYM_H
 #define GDB_BUILDSYM_H
 
+#include "block.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "symtab.h"
 #include "addrmap.h"
@@ -344,7 +345,7 @@ private:
 				       CORE_ADDR start, CORE_ADDR end,
 				       bool is_global, bool expandable);
 
-  std::unique_ptr<blockvector> make_blockvector ();
+  blockvector_up make_blockvector ();
 
   void watch_main_source_file_lossage ();


More information about the Gdb-cvs mailing list