public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb 11.1: struct inf lacks two members
@ 2021-11-02 23:11 Andrea Monaco
  2021-11-03  0:35 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Monaco @ 2021-11-02 23:11 UTC (permalink / raw)
  To: gdb


Hello,


after a successful configure, gdb 11.1 fails to make in my GNU/Hurd
system with the following errors:


  CXX    gnu-nat.o
gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
 2117 |   if (!inf->target_is_pushed (this))
      |             ^~~~~~~~~~~~~~~~
gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
 2118 |     inf->push_target (this);
      |          ^~~~~~~~~~~


and some others follow.  I found out that struct inf (from gnu-nat.c) is
only defined in the GNU/Hurd target, but it lacks the target_is_pushed
and push_target members which are part of class inferior (from
inferior.h).  Is this a syntax error?



Let me know,

Andrea Monaco

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

* Re: gdb 11.1: struct inf lacks two members
  2021-11-02 23:11 gdb 11.1: struct inf lacks two members Andrea Monaco
@ 2021-11-03  0:35 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2021-11-03  0:35 UTC (permalink / raw)
  To: Andrea Monaco, gdb

On 2021-11-02 19:11, Andrea Monaco via Gdb wrote:
> 
> Hello,
> 
> 
> after a successful configure, gdb 11.1 fails to make in my GNU/Hurd
> system with the following errors:
> 
> 
>   CXX    gnu-nat.o
> gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
> gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
>  2117 |   if (!inf->target_is_pushed (this))
>       |             ^~~~~~~~~~~~~~~~
> gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
>  2118 |     inf->push_target (this);
>       |          ^~~~~~~~~~~
> 
> 
> and some others follow.  I found out that struct inf (from gnu-nat.c) is
> only defined in the GNU/Hurd target, but it lacks the target_is_pushed
> and push_target members which are part of class inferior (from
> inferior.h).  Is this a syntax error?
> 
> 
> 
> Let me know,
> 
> Andrea Monaco
> 

Oh, my bad I think.  This should use the "inferior" variable, not inf.
As you mentioned, there's a "struct inf" type only defined in gnu-nat,
and I got confused with the two similar variables.  The change below
should fix it, can you confirm?


diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 54838347f947..13afb3ed8b01 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2108,8 +2108,8 @@ gnu_nat_target::create_inferior (const char *exec_file,
 
   inf_debug (inf, "creating inferior");
 
-  if (!inf->target_is_pushed (this))
-    inf->push_target (this);
+  if (!inferior->target_is_pushed (this))
+    inferior->push_target (this);
 
   pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
 		       NULL, NULL, NULL, NULL);

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

end of thread, other threads:[~2021-11-03  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 23:11 gdb 11.1: struct inf lacks two members Andrea Monaco
2021-11-03  0:35 ` Simon Marchi

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).