From: "Kévin Le Gouguec" <legouguec@adacore.com>
To: Tom de Vries <tdevries@suse.de>
Cc: Simon Marchi <simark@simark.ca>, Tom Tromey <tom@tromey.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] [gdbsupport] Add gdb::{waitpid,read,write,close}
Date: Mon, 02 Dec 2024 10:38:49 +0100 [thread overview]
Message-ID: <87ser6v2za.fsf@adacore.com> (raw)
In-Reply-To: <2a0ca637-82c7-4194-9b5e-6ce6802e3415@suse.de> (Tom de Vries's message of "Fri, 29 Nov 2024 17:23:15 +0100")
Tom de Vries <tdevries@suse.de> writes:
>> When building for mingw-w64, I see this, which seems related:
>> CXX cli/cli-cmds.o
>> In file included from /home/simark/src/binutils-gdb/gdb/cli/cli-cmds.c:58:
>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h: In function ‘pid_t gdb::waitpid(pid_t, int*, int)’:
>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:77:35: error: ‘::waitpid’ has not been declared; did you mean ‘gdb::waitpid’?
>> 77 | return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options);
>> | ^~~~~~~
>> | gdb::waitpid
>> /home/simark/src/binutils-gdb/gdb/../gdbsupport/eintr.h:75:1: note: ‘gdb::waitpid’ declared here
>> 75 | waitpid (pid_t pid, int *wstatus, int options)
>> | ^~~~~~~
>> Note that to get to it, you have to step past this other build error in
>> gdbserver (by doing `make all-gdb` for instance):
>> https://inbox.sourceware.org/gdb-patches/75926446-4c8a-40ee-8ed8-ab55f38e1520@simark.ca/T/#m194744b18419e37dfb4ec82c8e0ce73fb017ba17
>
> Hi Simon,
>
> thanks for reporting this.
>
> I don't have a windows setup unfortunately, so I have no way of reproducing this, and at this point I have no idea why waitpid is not declared.
FWIW (not much: not very Windows-savvy), I fixed my test build with the
following patch. I was also getting a "'::wait' has not been declared"
error, hence the extra #ifdef (found no HAVE_ macro for 'wait', so went
with HAVE_SYS_WAIT_H after glancing the 3posix manpage).
(Figured I'd share since that let me build & test native Windows, though
emphatically not suggesting this as a "proper fix": not sure "wait ⇔
HAVE_SYS_WAIT_H" is a correct implication, haven't checked if gnulib
might help, …)
diff --git a/gdbsupport/eintr.h b/gdbsupport/eintr.h
index 3980e3f5ac1..2bd17108f6e 100644
--- a/gdbsupport/eintr.h
+++ b/gdbsupport/eintr.h
@@ -22,7 +22,9 @@
#include <cerrno>
#include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -71,11 +73,13 @@ handle_eintr (ErrorValType errval, const Fun &f, const Args &... args)
return ret;
}
+#ifdef HAVE_WAITPID
inline pid_t
waitpid (pid_t pid, int *wstatus, int options)
{
return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options);
}
+#endif
inline int
open (const char *pathname, int flags)
@@ -83,11 +87,13 @@ open (const char *pathname, int flags)
return gdb::handle_eintr (-1, ::open, pathname, flags);
}
+#ifdef HAVE_SYS_WAIT_H
inline pid_t
wait (int *wstatus)
{
return gdb::handle_eintr (-1, ::wait, wstatus);
}
+#endif
inline int
close (int fd)
next prev parent reply other threads:[~2024-12-02 9:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 17:49 Tom de Vries
2024-10-28 17:49 ` [PATCH 2/3] [gdb] Use gdb::waitpid more often Tom de Vries
2024-10-28 17:49 ` [PATCH 3/3] [gdbsupport] Add gdb::wait Tom de Vries
2024-11-01 17:35 ` [PATCH 1/3] [gdbsupport] Add gdb::{waitpid,read,write,close} Tom Tromey
2024-11-05 12:07 ` Tom de Vries
2024-11-22 16:46 ` Tom de Vries
2024-11-29 16:15 ` Simon Marchi
2024-11-29 16:23 ` Tom de Vries
2024-11-29 16:27 ` Simon Marchi
2024-11-29 16:32 ` Tom de Vries
2024-11-29 17:23 ` Simon Marchi
2024-11-29 17:28 ` Tom de Vries
2024-12-02 9:38 ` Kévin Le Gouguec [this message]
2024-12-02 11:07 ` 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=87ser6v2za.fsf@adacore.com \
--to=legouguec@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=tdevries@suse.de \
--cc=tom@tromey.com \
/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