This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: C++ conversion status update
- From: Pedro Alves <palves at redhat dot com>
- To: John Baldwin <jhb at freebsd dot org>, gdb at sourceware dot org
- Date: Tue, 19 Apr 2016 21:36:33 +0100
- Subject: Re: C++ conversion status update
- Authentication-results: sourceware.org; auth=none
- References: <565460FB dot 6070103 at redhat dot com> <5711857D dot 8030708 at redhat dot com> <57151080 dot 3000900 at redhat dot com> <4587615 dot ZrrbCebxpz at ralph dot baldwin dot cx>
On 04/19/2016 07:22 PM, John Baldwin wrote:
> Thanks, I was able to test it and it works great on FreeBSD/amd64.
Great, thanks for confirming.
> The only remaining issue is that FreeBSD's stack_t defines ss_sp as char *
> instead of void *. Apparently 4.4BSD had this and the other BSD's fixed this
> long ago. When I first ran into this in January I fixed FreeBSD's trunk, so
> 11.0 will ship with a proper ss_sp of void *, but older releases will not.
>
> The affected code is in setup_alternate_signal_stack() in gdb/main.c where
> ss_sp is assigned to the void * returned from xmalloc().
>
> I was torn between just supporting C++ builds on FreeBSD 11 and later, or
> adding autoconf glue for just this part. However, given that it seems like
> the recent discussion is to deprecate C mode in the near future, it seems
> like I should do the latter. Do you have any better suggestions?
>
C++ allows conversion to 'void *' without a cast. So I think
we just need to do:
- ss.ss_sp = xmalloc (SIGSTKSZ);
+ ss.ss_sp = (char *) xmalloc (SIGSTKSZ);
and it'll work on both char * and void * hosts. I tried it
here on GNU/Linux, where ss_sp is void *, and it works.
Would you like to send that as a patch (with a comment)?
We can leave adding an autoconf check if some other host uses
a type different than void * and char *.
Thanks,
Pedro Alves