* [PATCH 1/4] Cast void * to struct user_pt_regs *
2015-11-19 13:01 [PATCH 0/4] [C++, AArch64] Fix warnings and errors Yao Qi
@ 2015-11-19 13:01 ` Yao Qi
2015-11-19 13:01 ` [PATCH 4/4] Change argument opcode type from enum aarch64_opcodes to uint32_t Yao Qi
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2015-11-19 13:01 UTC (permalink / raw)
To: gdb-patches
This patch fixes the following GDBserver build errors in C++.
gdb/gdbserver/linux-aarch64-low.c:108:33: error: invalid conversion from 'void*' to 'user_pt_regs*' [-fpermissive]
struct user_pt_regs *regset = buf;
^
gdb/gdbserver/linux-aarch64-low.c: In function 'void aarch64_store_gregset(regcache*, const void*)':
gdb/gdbserver/linux-aarch64-low.c:121:39: error: invalid conversion from 'const void*' to 'const user_pt_regs*' [-fpermissive]
const struct user_pt_regs *regset = buf;
gdb/gdbserver:
2015-11-19 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_fill_gregset): Cast buf to
struct user_pt_regs *.
(aarch64_store_gregset): Likewise.
---
gdb/gdbserver/linux-aarch64-low.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 4f23392..8d22218 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -105,7 +105,7 @@ aarch64_cannot_fetch_register (int regno)
static void
aarch64_fill_gregset (struct regcache *regcache, void *buf)
{
- struct user_pt_regs *regset = buf;
+ struct user_pt_regs *regset = (struct user_pt_regs *) buf;
int i;
for (i = 0; i < AARCH64_X_REGS_NUM; i++)
@@ -118,7 +118,7 @@ aarch64_fill_gregset (struct regcache *regcache, void *buf)
static void
aarch64_store_gregset (struct regcache *regcache, const void *buf)
{
- const struct user_pt_regs *regset = buf;
+ const struct user_pt_regs *regset = (const struct user_pt_regs *) buf;
int i;
for (i = 0; i < AARCH64_X_REGS_NUM; i++)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 4/4] Change argument opcode type from enum aarch64_opcodes to uint32_t
2015-11-19 13:01 [PATCH 0/4] [C++, AArch64] Fix warnings and errors Yao Qi
2015-11-19 13:01 ` [PATCH 1/4] Cast void * to struct user_pt_regs * Yao Qi
@ 2015-11-19 13:01 ` Yao Qi
2015-11-19 13:01 ` [PATCH 3/4] Define enum out of the scope of struct Yao Qi
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2015-11-19 13:01 UTC (permalink / raw)
To: gdb-patches
The patch fixes the following errors in C++ build,
gdb/gdbserver/linux-aarch64-low.c: In function 'int emit_data_processing(uint32_t*, aarch64_opcodes, aarch64_register, aarch64_register, aarch64_operand)':
gdb/gdbserver/linux-aarch64-low.c:1071:52: error: invalid conversion from 'unsigned int' to 'aarch64_opcodes' [-fpermissive]
return emit_data_processing_reg (buf, opcode | operand_opcode, rd,
^
gdb/gdbserver:
2015-11-19 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (emit_data_processing_reg): Change opcode
type to uint32_t.
---
gdb/gdbserver/linux-aarch64-low.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 7cd9b77..cb78666 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -1029,7 +1029,7 @@ emit_stlr (uint32_t *buf, struct aarch64_register rt,
/* Helper function for data processing instructions with register sources. */
static int
-emit_data_processing_reg (uint32_t *buf, enum aarch64_opcodes opcode,
+emit_data_processing_reg (uint32_t *buf, uint32_t opcode,
struct aarch64_register rd,
struct aarch64_register rn,
struct aarch64_register rm)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 3/4] Define enum out of the scope of struct
2015-11-19 13:01 [PATCH 0/4] [C++, AArch64] Fix warnings and errors Yao Qi
2015-11-19 13:01 ` [PATCH 1/4] Cast void * to struct user_pt_regs * Yao Qi
2015-11-19 13:01 ` [PATCH 4/4] Change argument opcode type from enum aarch64_opcodes to uint32_t Yao Qi
@ 2015-11-19 13:01 ` Yao Qi
2015-11-19 13:01 ` [PATCH 2/4] Cast void * to user_fpsimd_state * Yao Qi
2015-11-19 13:43 ` [PATCH 0/4] [C++, AArch64] Fix warnings and errors Simon Marchi
4 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2015-11-19 13:01 UTC (permalink / raw)
To: gdb-patches
This patch moves the enum definition out of the scope of struct, and
fixes the following error.
gdb/gdbserver/linux-aarch64-low.c:681:18: error: 'OPERAND_REGISTER' was not declared in this scope
operand.type = OPERAND_REGISTER;
^
gdb/gdbserver:
2015-11-19 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (enum aarch64_operand_type): New.
(struct aarch64_operand): Move enum out.
---
gdb/gdbserver/linux-aarch64-low.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index a145f80..7cd9b77 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -614,17 +614,20 @@ enum aarch64_condition_codes
LE = 0xd,
};
+enum aarch64_operand_type
+{
+ OPERAND_IMMEDIATE,
+ OPERAND_REGISTER,
+};
+
/* Representation of an operand. At this time, it only supports register
and immediate types. */
struct aarch64_operand
{
/* Type of the operand. */
- enum
- {
- OPERAND_IMMEDIATE,
- OPERAND_REGISTER,
- } type;
+ enum aarch64_operand_type type;
+
/* Value of the operand according to the type. */
union
{
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/4] Cast void * to user_fpsimd_state *.
2015-11-19 13:01 [PATCH 0/4] [C++, AArch64] Fix warnings and errors Yao Qi
` (2 preceding siblings ...)
2015-11-19 13:01 ` [PATCH 3/4] Define enum out of the scope of struct Yao Qi
@ 2015-11-19 13:01 ` Yao Qi
2015-11-19 13:43 ` [PATCH 0/4] [C++, AArch64] Fix warnings and errors Simon Marchi
4 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2015-11-19 13:01 UTC (permalink / raw)
To: gdb-patches
This patch fixes the following build error in GDBserver,
gdb/gdbserver/linux-aarch64-low.c: In function 'void aarch64_fill_fpregset(regcache*, void*)':
gdb/gdbserver/linux-aarch64-low.c:134:38: error: invalid conversion from 'void*' to 'user_fpsimd_state*' [-fpermissive]
struct user_fpsimd_state *regset = buf;
^
gdb/gdbserver/linux-aarch64-low.c: In function 'void aarch64_store_fpregset(regcache*, const void*)':
gdb/gdbserver/linux-aarch64-low.c:146:44: error: invalid conversion from 'const void*' to 'const user_fpsimd_state*' [-fpermissive]
const struct user_fpsimd_state *regset = buf;
^
gdb/gdbserver:
2015-11-19 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_fill_fpregset): Cast buf to
struct user_fpsimd_state *.
(aarch64_store_fpregset): Likewise.
---
gdb/gdbserver/linux-aarch64-low.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 8d22218..a145f80 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -131,7 +131,7 @@ aarch64_store_gregset (struct regcache *regcache, const void *buf)
static void
aarch64_fill_fpregset (struct regcache *regcache, void *buf)
{
- struct user_fpsimd_state *regset = buf;
+ struct user_fpsimd_state *regset = (struct user_fpsimd_state *) buf;
int i;
for (i = 0; i < AARCH64_V_REGS_NUM; i++)
@@ -143,7 +143,8 @@ aarch64_fill_fpregset (struct regcache *regcache, void *buf)
static void
aarch64_store_fpregset (struct regcache *regcache, const void *buf)
{
- const struct user_fpsimd_state *regset = buf;
+ const struct user_fpsimd_state *regset
+ = (const struct user_fpsimd_state *) buf;
int i;
for (i = 0; i < AARCH64_V_REGS_NUM; i++)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] [C++, AArch64] Fix warnings and errors
2015-11-19 13:01 [PATCH 0/4] [C++, AArch64] Fix warnings and errors Yao Qi
` (3 preceding siblings ...)
2015-11-19 13:01 ` [PATCH 2/4] Cast void * to user_fpsimd_state * Yao Qi
@ 2015-11-19 13:43 ` Simon Marchi
2015-11-19 14:03 ` Yao Qi
4 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2015-11-19 13:43 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 15-11-19 08:00 AM, Yao Qi wrote:
> This patch set fixes warnings and errors when I build GDB and GDBserver
> in C++ mode for native aarch64-linux. There is still one error fixed
> by Simon's patch,
>
> [PATCH] Fix length calculation in aarch64_linux_set_debug_regs
> https://sourceware.org/ml/gdb-patches/2015-11/msg00010.html
>
> I think Simon's patch should go in too. Each of them is obvious to
> me. I'll push them in soon.
>
> *** BLURB HERE ***
>
> Yao Qi (4):
> Cast void * to struct user_pt_regs *
> Cast void * to user_fpsimd_state *.
> Define enum out of the scope of struct
> Change argument opcode type from enum aarch64_opcodes to uint32_t
>
> gdb/gdbserver/linux-aarch64-low.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
The series looks good to me.
Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread