* [PATCH 1/2] Cast the pointer assigned to ss_sp to char *.
2016-04-19 21:41 [PATCH 0/2] Fix C++ build on FreeBSD/x86 John Baldwin
2016-04-19 21:41 ` [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build John Baldwin
@ 2016-04-19 21:41 ` John Baldwin
2016-04-19 22:38 ` Pedro Alves
1 sibling, 1 reply; 5+ messages in thread
From: John Baldwin @ 2016-04-19 21:41 UTC (permalink / raw)
To: gdb-patches
FreeBSD versions older than 11.0 use char * as the type of ss_sp in
stack_t instead of the standards-defined void *. C++ allows a char *
pointer to be converted to a void *, so it is safe to cast the return
value of xmalloc to char * if ss_sp is either a char * or void *.
Just always use the cast to char * since that is less ugly than having
to add a special case.
gdb/ChangeLog:
* main.c (setup_alternate_signal_stack): Cast to char *.
---
gdb/ChangeLog | 4 ++++
gdb/main.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9e65878..6f681b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2016-04-19 John Baldwin <jhb@FreeBSD.org>
+
+ * main.c (setup_alternate_signal_stack): Cast to char *.
+
2016-04-19 Doug Evans <xdje42@gmail.com>
* source.c (is_regular_file): New arg errno_ptr.
diff --git a/gdb/main.c b/gdb/main.c
index c149b70..2ce1713 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -297,7 +297,9 @@ setup_alternate_signal_stack (void)
#ifdef HAVE_SIGALTSTACK
stack_t ss;
- ss.ss_sp = xmalloc (SIGSTKSZ);
+ /* FreeBSD versions older than 11.0 use char * for ss_sp instead of
+ void *. This cast works with both types. */
+ ss.ss_sp = (char *) xmalloc (SIGSTKSZ);
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
--
2.7.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
2016-04-19 21:41 [PATCH 0/2] Fix C++ build on FreeBSD/x86 John Baldwin
@ 2016-04-19 21:41 ` John Baldwin
2016-04-19 22:40 ` Pedro Alves
2016-04-19 21:41 ` [PATCH 1/2] Cast the pointer assigned to ss_sp to char * John Baldwin
1 sibling, 1 reply; 5+ messages in thread
From: John Baldwin @ 2016-04-19 21:41 UTC (permalink / raw)
To: gdb-patches
gdb/ChangeLog:
* amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Change xstateregs
to void *.
(amd64bsd_store_inferior_registers): Likewise.
* fbsd-nat.c (resume_one_thread_cb): Explicitly cast data to ptid_t *.
(resume_all_threads_cb): Likewise.
* i386bsd-nat.c (i386bsd_supply_gregset): Cast gregs to char *.
(i386bsd_collect_gregset): Likewise.
(i386bsd_fetch_inferior_registers): Change xstateregs to void *.
(i386bsd_store_inferior_registers): Likewise.
---
gdb/ChangeLog | 12 ++++++++++++
gdb/amd64bsd-nat.c | 4 ++--
gdb/fbsd-nat.c | 4 ++--
gdb/i386bsd-nat.c | 8 ++++----
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6f681b9..a3d0500 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,17 @@
2016-04-19 John Baldwin <jhb@FreeBSD.org>
+ * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Change xstateregs
+ to void *.
+ (amd64bsd_store_inferior_registers): Likewise.
+ * fbsd-nat.c (resume_one_thread_cb): Explicitly cast data to ptid_t *.
+ (resume_all_threads_cb): Likewise.
+ * i386bsd-nat.c (i386bsd_supply_gregset): Cast gregs to char *.
+ (i386bsd_collect_gregset): Likewise.
+ (i386bsd_fetch_inferior_registers): Change xstateregs to void *.
+ (i386bsd_store_inferior_registers): Likewise.
+
+2016-04-19 John Baldwin <jhb@FreeBSD.org>
+
* main.c (setup_alternate_signal_stack): Cast to char *.
2016-04-19 Doug Evans <xdje42@gmail.com>
diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c
index fb7e4fa..e278a91 100644
--- a/gdb/amd64bsd-nat.c
+++ b/gdb/amd64bsd-nat.c
@@ -65,7 +65,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops,
{
struct fpreg fpregs;
#ifdef PT_GETXSTATE_INFO
- char *xstateregs;
+ void *xstateregs;
if (amd64bsd_xsave_len != 0)
{
@@ -118,7 +118,7 @@ amd64bsd_store_inferior_registers (struct target_ops *ops,
{
struct fpreg fpregs;
#ifdef PT_GETXSTATE_INFO
- char *xstateregs;
+ void *xstateregs;
if (amd64bsd_xsave_len != 0)
{
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index bdf078e..b582abe 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -428,7 +428,7 @@ static void (*super_resume) (struct target_ops *,
static int
resume_one_thread_cb (struct thread_info *tp, void *data)
{
- ptid_t *ptid = data;
+ ptid_t *ptid = (ptid_t *) data;
int request;
if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid))
@@ -447,7 +447,7 @@ resume_one_thread_cb (struct thread_info *tp, void *data)
static int
resume_all_threads_cb (struct thread_info *tp, void *data)
{
- ptid_t *filter = data;
+ ptid_t *filter = (ptid_t *) data;
if (!ptid_match (tp->ptid, *filter))
return 0;
diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c
index 5d45c33..f5f4a0f 100644
--- a/gdb/i386bsd-nat.c
+++ b/gdb/i386bsd-nat.c
@@ -92,7 +92,7 @@ size_t i386bsd_xsave_len;
static void
i386bsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
- const char *regs = gregs;
+ const char *regs = (const char *) gregs;
int regnum;
for (regnum = 0; regnum < ARRAY_SIZE (i386bsd_r_reg_offset); regnum++)
@@ -112,7 +112,7 @@ static void
i386bsd_collect_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- char *regs = gregs;
+ char *regs = (char *) gregs;
int i;
for (i = 0; i < ARRAY_SIZE (i386bsd_r_reg_offset); i++)
@@ -157,7 +157,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
#ifdef PT_GETXSTATE_INFO
if (i386bsd_xsave_len != 0)
{
- char *xstateregs;
+ void *xstateregs;
xstateregs = alloca (i386bsd_xsave_len);
if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
@@ -227,7 +227,7 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
#ifdef PT_GETXSTATE_INFO
if (i386bsd_xsave_len != 0)
{
- char *xstateregs;
+ void *xstateregs;
xstateregs = alloca (i386bsd_xsave_len);
if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
--
2.7.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/2] Fix C++ build on FreeBSD/x86
@ 2016-04-19 21:41 John Baldwin
2016-04-19 21:41 ` [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build John Baldwin
2016-04-19 21:41 ` [PATCH 1/2] Cast the pointer assigned to ss_sp to char * John Baldwin
0 siblings, 2 replies; 5+ messages in thread
From: John Baldwin @ 2016-04-19 21:41 UTC (permalink / raw)
To: gdb-patches
These changes allow FreeBSD/amd64 and FreeBSD/i386 to build in C++ mode.
Tested with GCC (4.8) and clang (3.4 and 3.8).
John Baldwin (2):
Cast the pointer assigned to ss_sp to char *.
Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
gdb/ChangeLog | 16 ++++++++++++++++
gdb/amd64bsd-nat.c | 4 ++--
gdb/fbsd-nat.c | 4 ++--
gdb/i386bsd-nat.c | 8 ++++----
gdb/main.c | 4 +++-
5 files changed, 27 insertions(+), 9 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Cast the pointer assigned to ss_sp to char *.
2016-04-19 21:41 ` [PATCH 1/2] Cast the pointer assigned to ss_sp to char * John Baldwin
@ 2016-04-19 22:38 ` Pedro Alves
0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2016-04-19 22:38 UTC (permalink / raw)
To: John Baldwin, gdb-patches
Perfect, thanks.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
2016-04-19 21:41 ` [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build John Baldwin
@ 2016-04-19 22:40 ` Pedro Alves
0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2016-04-19 22:40 UTC (permalink / raw)
To: John Baldwin, gdb-patches
OK.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-19 22:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 21:41 [PATCH 0/2] Fix C++ build on FreeBSD/x86 John Baldwin
2016-04-19 21:41 ` [PATCH 2/2] Handle void * conversions in FreeBSD/x86 native code to fix C++ build John Baldwin
2016-04-19 22:40 ` Pedro Alves
2016-04-19 21:41 ` [PATCH 1/2] Cast the pointer assigned to ss_sp to char * John Baldwin
2016-04-19 22:38 ` Pedro Alves
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).