public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix procfs.c compilation
@ 2023-11-30  9:47 Rainer Orth
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer Orth @ 2023-11-30  9:47 UTC (permalink / raw)
  To: gdb-cvs

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

commit 53302c2d33c26909cc8446819f6677076ba48ca9
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Thu Nov 30 10:46:25 2023 +0100

    Fix procfs.c compilation
    
    procfs.c doesn't currently compile on Solaris:
    
    /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In member function ‘virtual int procfs_target::can_use_hw_breakpoint(bptype, int, int)’:
    /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3017:9: error: ‘ptr_type’ was not declared in this scope; did you mean ‘var_types’?
     3017 |   type *ptr_type
          |         ^~~~~~~~
          |         var_types
    
    This was caused by this patch:
    
    commit 99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee
    Author: Simon Marchi <simon.marchi@efficios.com>
    Date:   Fri Sep 29 14:24:38 2023 -0400
    
        gdb: remove target_gdbarch
    
    Partially undoing it restores the build.
    
    Tested on amd64-pc-solaris2.11.

Diff:
---
 gdb/procfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1a543a60202..1410bbc0d7d 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3014,7 +3014,7 @@ procfs_target::can_use_hw_breakpoint (enum bptype type, int cnt, int othertype)
      procfs_address_to_host_pointer will reveal that an internal error
      will be generated when the host and target pointer sizes are
      different.  */
-  type *ptr_type
+  struct type *ptr_type
     = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
   if (sizeof (void *) != ptr_type->length ())

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [binutils-gdb] Fix procfs.c compilation
@ 2022-03-31  8:37 Rainer Orth
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer Orth @ 2022-03-31  8:37 UTC (permalink / raw)
  To: gdb-cvs

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

commit 5530c021ce01abf368a9cde26b22c4b34f320ee8
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Thu Mar 31 10:34:52 2022 +0200

    Fix procfs.c compilation
    
    procfs.c doesn't compile on Solaris:
    
    /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c: In member function ‘virtual bool procfs_target::info_proc(const char*, info_proc_what)’:
    /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c:3302:3: error: ‘gdb_argv’ was not declared in this scope
     3302 |   gdb_argv built_argv (args);
          |   ^~~~~~~~
    /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c:3303:20: error: ‘built_argv’ was not declared in this scope; did you mean ‘buildargv’?
     3303 |   for (char *arg : built_argv)
          |                    ^~~~~~~~~~
          |                    buildargv
    
    Fixed by including  "gdbsupport/buildargv.h".
    
    Tested on amd64-pc-solaris2.11, sparcv9-sun-solaris2.11.

Diff:
---
 gdb/procfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 584833a284e..f6ca1345a21 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -45,6 +45,7 @@
 #include "observable.h"
 #include "gdbsupport/scoped_fd.h"
 #include "gdbsupport/pathstuff.h"
+#include "gdbsupport/buildargv.h"
 
 /* This module provides the interface between GDB and the
    /proc file system, which is used on many versions of Unix


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [binutils-gdb] Fix procfs.c compilation
@ 2018-06-13  9:07 Rainer Orth
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer Orth @ 2018-06-13  9:07 UTC (permalink / raw)
  To: gdb-cvs

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

commit 62c808aef64d77d5585f54c792ebe3f388a960a9
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Wed Jun 13 11:05:51 2018 +0200

    Fix procfs.c compilation
    
    procfs.c currently doesn't compile on Solaris:
    
    /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function `void _initialize_procfs()':
    /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3734:15: error: invalid initialization of reference of type `const target_info&' from expression of type `procfs_target*'
       add_target (&the_procfs_target);
                   ^~~~~~~~~~~~~~~~~~
    In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
                     from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
    /vol/src/gnu/gdb/gdb/local/gdb/target.h:2305:13: note: in passing argument 1 of `void add_target(const target_info&, void (*)(const char*, int), void (*)(cmd_list_element*, completion_tracker&, const char*, const char*))'
     extern void add_target (const target_info &info,
                 ^~~~~~~~~~
    /vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In member function `virtual char* procfs_target::make_corefile_notes(bfd*, int*)':
    /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: too many arguments to function `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > target_read_alloc(target_ops*, target_object, const char*)'
         NULL, &auxv);
                    ^
    In file included from /vol/src/gnu/gdb/gdb/local/gdb/inferior.h:40,
                     from /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:24:
    /vol/src/gnu/gdb/gdb/local/gdb/target.h:341:40: note: declared here
     extern gdb::optional<gdb::byte_vector> target_read_alloc
                                            ^~~~~~~~~~~~~~~~~
    /vol/src/gnu/gdb/gdb/local/gdb/procfs.c:3898:16: error: cannot convert `gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >' to `int' in assignment
         NULL, &auxv);
                    ^
    
    Fixed as follows.  Built and ran make check on 64-bit Solaris 11.5/x86
    (amd64-pc-solaris2.11) only.
    
    	* procfs.c (_initialize_procfs): Use add_inf_child_target.
    	(procfs_target::make_corefile_notes): Adjust to new
    	target_read_alloc return type.

Diff:
---
 gdb/ChangeLog |  6 ++++++
 gdb/procfs.c  | 18 +++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index edb60f7..42995df 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* procfs.c (_initialize_procfs): Use add_inf_child_target.
+	(procfs_target::make_corefile_notes): Adjust to new
+	target_read_alloc return type.
+
 2018-06-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 	    Stephen Roberts  <stephen.roberts@arm.com>
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 082f5d4..8b09eca 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3731,7 +3731,7 @@ _initialize_procfs (void)
   add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd,
 	   _("Cancel a trace of exits from the syscall."));
 
-  add_target (&the_procfs_target);
+  add_inf_child_target (&the_procfs_target);
 }
 
 /* =================== END, GDB  "MODULE" =================== */
@@ -3851,8 +3851,6 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
   char *note_data = NULL;
   char *inf_args;
   struct procfs_corefile_thread_data thread_args;
-  gdb_byte *auxv;
-  int auxv_len;
   enum gdb_signal stop_signal;
 
   if (get_exec_file (0))
@@ -3894,14 +3892,12 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
 			     &thread_args);
   note_data = thread_args.note_data;
 
-  auxv_len = target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV,
-				NULL, &auxv);
-  if (auxv_len > 0)
-    {
-      note_data = elfcore_write_note (obfd, note_data, note_size,
-				      "CORE", NT_AUXV, auxv, auxv_len);
-      xfree (auxv);
-    }
+  gdb::optional<gdb::byte_vector> auxv =
+    target_read_alloc (current_top_target (), TARGET_OBJECT_AUXV, NULL);
+  if (auxv && !auxv->empty ())
+    note_data = elfcore_write_note (obfd, note_data, note_size,
+				    "CORE", NT_AUXV, auxv->data (),
+				    auxv->size ());
 
   return note_data;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-30  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30  9:47 [binutils-gdb] Fix procfs.c compilation Rainer Orth
  -- strict thread matches above, loose matches on Subject: below --
2022-03-31  8:37 Rainer Orth
2018-06-13  9:07 Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).