* [PATCH] [gdb/build] Fix build on postmarketos
@ 2024-03-14 9:54 Tom de Vries
2024-03-14 12:43 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2024-03-14 9:54 UTC (permalink / raw)
To: gdb-patches
I tried building gdbserver on postmarketos (which is based on alpine linux,
which uses musl libc), and ran into:
...
gdbserver/linux-low.cc: In lambda function:
gdbserver/linux-low.cc:1907:41: error: \
'W_EXITCODE' was not declared in this scope
1907 | mark_lwp_dead (leader_lp, W_EXITCODE (0, 0), true);
| ^~~~~~~~~~
...
The macro W_EXITCODE is not defined in gdbsupport/gdb_wait.h, but WSETEXIT is:
...
/* These are not defined in POSIX, but are used by our programs. */
#ifndef WSETEXIT
# ifdef W_EXITCODE
#define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
# else
#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
# endif
#endif
...
Fix this by using WSETEXIT.
Tested on x86_64-linux.
PR build/31483
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31483
---
gdbserver/linux-low.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 9d5a6242803..aaa7bbc2a4c 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -1904,7 +1904,9 @@ linux_process_target::check_zombie_leaders ()
thread_info *leader_thread = get_lwp_thread (leader_lp);
if (report_exit_events_for (leader_thread))
{
- mark_lwp_dead (leader_lp, W_EXITCODE (0, 0), true);
+ int wstat;
+ WSETEXIT (wstat, 0);
+ mark_lwp_dead (leader_lp, wstat, true);
new_pending_event = true;
}
else
base-commit: 3a4c6f1aa958739705ee69526fdeed7c69d7243c
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [gdb/build] Fix build on postmarketos
2024-03-14 9:54 [PATCH] [gdb/build] Fix build on postmarketos Tom de Vries
@ 2024-03-14 12:43 ` Tom Tromey
2024-03-14 16:32 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-03-14 12:43 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> I tried building gdbserver on postmarketos (which is based on alpine linux,
Tom> which uses musl libc), and ran into:
Tom> ...
Tom> gdbserver/linux-low.cc: In lambda function:
Tom> gdbserver/linux-low.cc:1907:41: error: \
Tom> 'W_EXITCODE' was not declared in this scope
Tom> 1907 | mark_lwp_dead (leader_lp, W_EXITCODE (0, 0), true);
Tom> | ^~~~~~~~~~
Tom> ...
Tom> The macro W_EXITCODE is not defined in gdbsupport/gdb_wait.h, but WSETEXIT is:
Tom> ...
Tom> /* These are not defined in POSIX, but are used by our programs. */
Tom> #ifndef WSETEXIT
Tom> # ifdef W_EXITCODE
Tom> #define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
Tom> # else
Tom> #define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
Tom> # endif
Tom> #endif
Tom> ...
I think it'd be better to change this to define W_EXITCODE.
WSETEXIT isn't used in the tree at all AFAICT.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [gdb/build] Fix build on postmarketos
2024-03-14 12:43 ` Tom Tromey
@ 2024-03-14 16:32 ` Tom de Vries
0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2024-03-14 16:32 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 3/14/24 13:43, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> I tried building gdbserver on postmarketos (which is based on alpine linux,
> Tom> which uses musl libc), and ran into:
> Tom> ...
> Tom> gdbserver/linux-low.cc: In lambda function:
> Tom> gdbserver/linux-low.cc:1907:41: error: \
> Tom> 'W_EXITCODE' was not declared in this scope
> Tom> 1907 | mark_lwp_dead (leader_lp, W_EXITCODE (0, 0), true);
> Tom> | ^~~~~~~~~~
> Tom> ...
>
> Tom> The macro W_EXITCODE is not defined in gdbsupport/gdb_wait.h, but WSETEXIT is:
> Tom> ...
> Tom> /* These are not defined in POSIX, but are used by our programs. */
>
> Tom> #ifndef WSETEXIT
> Tom> # ifdef W_EXITCODE
> Tom> #define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
> Tom> # else
> Tom> #define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
> Tom> # endif
> Tom> #endif
> Tom> ...
>
> I think it'd be better to change this to define W_EXITCODE.
> WSETEXIT isn't used in the tree at all AFAICT.
Thanks for the review.
Fine by me, I've submitted a v2 here (
https://sourceware.org/pipermail/gdb-patches/2024-March/207288.html ).
Thanks,
- Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-14 16:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 9:54 [PATCH] [gdb/build] Fix build on postmarketos Tom de Vries
2024-03-14 12:43 ` Tom Tromey
2024-03-14 16:32 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox