[binutils-gdb/gdb-18-branch] Fix procfs.c compilation on Solaris

Rainer Orth 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=72572ab0996392cf4206c63db33601c4f172924c

commit 72572ab0996392cf4206c63db33601c4f172924c
Author: Rainer Orth <[email protected]>
Date:   Fri Aug 14 11:33:07 2026 +0200

    Fix procfs.c compilation on Solaris
    
    procfs.c doesn't compile on trunk and the gdb-18 branch:
    
    procfs.c: In function ‘int procfs_notice_thread(procinfo*, procinfo*, void*)’:
    procfs.c:2857:33: error: invalid use of non-static member function ‘thread_state thread_info::state() const’
     2857 |   if (thr == NULL || thr->state == THREAD_EXITED)
          |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~
    
    Fixed by calling the member function.
    
    procfs.c: In function ‘bool find_memory_regions_callback(prmap*, find_memory_region_ftype)’:
    procfs.c:3152:15: error: no match for call to ‘(find_memory_region_ftype {aka gdb::function_view<bool(long unsigned int, long unsigned int, bool, bool, bool, bool, bool, bool)>}) (CORE_ADDR, std::size_t&, bool, bool, bool, bool, bool)’
     3152 |   return func ((CORE_ADDR) map->pr_vaddr,
          |          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
     3153 |                map->pr_size,
          |                ~~~~~~~~~~~~~
     3154 |                (map->pr_mflags & MA_READ) != 0,
          |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3155 |                (map->pr_mflags & MA_WRITE) != 0,
          |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3156 |                (map->pr_mflags & MA_EXEC) != 0,
          |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3157 |                true, /* MODIFIED is unknown, pass it as true.  */
          |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3158 |                false);
          |                ~~~~~~
    
    Fixed by passing the new HOLE arg.
    
    procfs.c: In function ‘void info_proc_mappings(procinfo*, int)’:
    procfs.c:3257:25: error: too many arguments to function ‘bool iterate_over_mappings(procinfo*, find_memory_region_ftype, bool (*)(prmap*, find_memory_region_ftype))’
     3257 |   iterate_over_mappings (pi, NULL, NULL, info_mappings_callback);
          |   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixed by removing the unused arg.
    
    Tested on sparcv9-sun-solaris2.11 and amd64-pc-solaris2.11 with results
    similar to the gdb-17 ones.
    
    (cherry picked from commit 82e8ea345aec5198ea18a67e32e95f6be08963d8)

Diff:
---
 gdb/procfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 8d96bf588da..bbee28bbc5e 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2854,7 +2854,7 @@ procfs_notice_thread (procinfo *pi, procinfo *thread, void *ptr)
   ptid_t gdb_threadid = ptid_t (pi->pid, thread->tid, 0);
 
   thread_info *thr = the_procfs_target.find_thread (gdb_threadid);
-  if (thr == NULL || thr->state == THREAD_EXITED)
+  if (thr == NULL || thr->state () == THREAD_EXITED)
     add_thread (&the_procfs_target, gdb_threadid);
 
   return 0;
@@ -3155,7 +3155,7 @@ find_memory_regions_callback (struct prmap *map, find_memory_region_ftype func)
 	       (map->pr_mflags & MA_WRITE) != 0,
 	       (map->pr_mflags & MA_EXEC) != 0,
 	       true, /* MODIFIED is unknown, pass it as true.  */
-	       false);
+	       false, false);
 }
 
 /* External interface.  Calls a callback function once for each
@@ -3205,8 +3205,7 @@ mappingflags (long flags)
    mappings'.  */
 
 static bool
-info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
-			void *unused)
+info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore)
 {
   unsigned int pr_off;
 
@@ -3254,7 +3253,7 @@ info_proc_mappings (procinfo *pi, int summary)
 		"    Offset",
 		"Flags");
 
-  iterate_over_mappings (pi, NULL, NULL, info_mappings_callback);
+  iterate_over_mappings (pi, NULL, info_mappings_callback);
   gdb_printf ("\n");
 }
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.