* [PATCH 0/7] C++ patches
@ 2015-10-28 16:48 Pedro Alves
2015-10-28 16:55 ` [PATCH 1/7] compile: Rename struct type_map_instance::gcc_type field Pedro Alves
` (7 more replies)
0 siblings, 8 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 16:48 UTC (permalink / raw)
To: gdb-patches
A few more GDB-in-C++ patches.
Pedro Alves (7):
compile: Rename struct type_map_instance::gcc_type field
Add cast to exception_none
gdbserver/Linux: Introduce NULL_REGSET
gdbserver: btrace enums
gdbserver: enum gdb_signal casts
gdbserver/tracepoint: Add casts out of tpoint->handle
gdbserver/mem-break.c: Add cast
gdb/common/common-exceptions.c | 2 +-
gdb/compile/compile-c-types.c | 8 ++++----
gdb/gdbserver/linux-aarch64-low.c | 2 +-
gdb/gdbserver/linux-arm-low.c | 2 +-
gdb/gdbserver/linux-crisv32-low.c | 2 +-
gdb/gdbserver/linux-low.c | 2 +-
gdb/gdbserver/linux-low.h | 5 +++++
gdb/gdbserver/linux-m68k-low.c | 2 +-
gdb/gdbserver/linux-mips-low.c | 2 +-
gdb/gdbserver/linux-nios2-low.c | 2 +-
gdb/gdbserver/linux-ppc-low.c | 2 +-
gdb/gdbserver/linux-s390-low.c | 2 +-
gdb/gdbserver/linux-sh-low.c | 2 +-
gdb/gdbserver/linux-sparc-low.c | 2 +-
gdb/gdbserver/linux-tic6x-low.c | 2 +-
gdb/gdbserver/linux-tile-low.c | 2 +-
gdb/gdbserver/linux-x86-low.c | 2 +-
gdb/gdbserver/linux-xtensa-low.c | 2 +-
gdb/gdbserver/mem-break.c | 2 +-
gdb/gdbserver/server.c | 15 ++++++++-------
gdb/gdbserver/target.h | 6 +++---
gdb/gdbserver/tracepoint.c | 14 ++++++++++++--
22 files changed, 49 insertions(+), 33 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/7] compile: Rename struct type_map_instance::gcc_type field
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
@ 2015-10-28 16:55 ` Pedro Alves
2015-10-28 17:05 ` [PATCH 6/7] gdbserver/tracepoint: Add casts out of tpoint->handle Pedro Alves
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 16:55 UTC (permalink / raw)
To: gdb-patches
Fixes:
src/gdb/compile/compile-c-types.c:36:12: error: declaration of âgcc_type type_map_instance::gcc_typeâ [-fpermissive]
gcc_type gcc_type;
^
In file included from src/gdb/../include/gcc-c-interface.h:23:0,
from src/gdb/compile/compile-internal.h:21,
from src/gdb/compile/compile-c-types.c:23:
src/gdb/../include/gcc-interface.h:32:28: error: changes meaning of âgcc_typeâ from âtypedef long long unsigned int gcc_typeâ [-fpermissive]
typedef unsigned long long gcc_type;
^
src/gdb/compile/compile-c-types.c: In function âgcc_type convert_qualified(compile_c_instance*, type*)â:
src/gdb/compile/compile-c-types.c:310:19: error: invalid conversion from âintâ to âgcc_qualifiersâ [-fpermissive]
quals);
^
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* compile/compile-c-types.c (struct type_map_instance)
<gcc_type>: Rename to gcc_type_handle.
(insert_type, convert_type): Adjust.
---
gdb/compile/compile-c-types.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 60f9bd4..ccc9167 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -31,7 +31,7 @@ struct type_map_instance
/* The corresponding gcc type handle. */
- gcc_type gcc_type;
+ gcc_type gcc_type_handle;
};
/* Hash a type_map_instance. */
@@ -72,13 +72,13 @@ insert_type (struct compile_c_instance *context, struct type *type,
void **slot;
inst.type = type;
- inst.gcc_type = gcc_type;
+ inst.gcc_type_handle = gcc_type;
slot = htab_find_slot (context->type_map, &inst, INSERT);
add = (struct type_map_instance *) *slot;
/* The type might have already been inserted in order to handle
recursive types. */
- if (add != NULL && add->gcc_type != gcc_type)
+ if (add != NULL && add->gcc_type_handle != gcc_type)
error (_("Unexpected type id from GCC, check you use recent enough GCC."));
if (add == NULL)
@@ -388,7 +388,7 @@ convert_type (struct compile_c_instance *context, struct type *type)
inst.type = type;
found = (struct type_map_instance *) htab_find (context->type_map, &inst);
if (found != NULL)
- return found->gcc_type;
+ return found->gcc_type_handle;
result = convert_type_basic (context, type);
insert_type (context, type, result);
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 6/7] gdbserver/tracepoint: Add casts out of tpoint->handle
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
2015-10-28 16:55 ` [PATCH 1/7] compile: Rename struct type_map_instance::gcc_type field Pedro Alves
@ 2015-10-28 17:05 ` Pedro Alves
2015-10-28 17:10 ` [PATCH 3/7] gdbserver/Linux: Introduce NULL_REGSET Pedro Alves
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 17:05 UTC (permalink / raw)
To: gdb-patches
... as needed for C++.
tpoint->handle is a generic 'void *' handle.
gdb/gdbserver/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* tracepoint.c (clear_installed_tracepoints): Add casts.
---
gdb/gdbserver/tracepoint.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index b6c70c9..9006a2e 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -2448,10 +2448,20 @@ clear_installed_tracepoints (void)
switch (tpoint->type)
{
case trap_tracepoint:
- delete_breakpoint (tpoint->handle);
+ {
+ struct breakpoint *bp
+ = (struct breakpoint *) tpoint->handle;
+
+ delete_breakpoint (bp);
+ }
break;
case fast_tracepoint:
- delete_fast_tracepoint_jump (tpoint->handle);
+ {
+ struct fast_tracepoint_jump *jump
+ = (struct fast_tracepoint_jump *) tpoint->handle;
+
+ delete_fast_tracepoint_jump (jump);
+ }
break;
case static_tracepoint:
if (prev_stpoint != NULL
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/7] gdbserver/Linux: Introduce NULL_REGSET
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
2015-10-28 16:55 ` [PATCH 1/7] compile: Rename struct type_map_instance::gcc_type field Pedro Alves
2015-10-28 17:05 ` [PATCH 6/7] gdbserver/tracepoint: Add casts out of tpoint->handle Pedro Alves
@ 2015-10-28 17:10 ` Pedro Alves
2015-10-28 17:20 ` [PATCH 4/7] gdbserver: btrace enums Pedro Alves
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 17:10 UTC (permalink / raw)
To: gdb-patches
Fixes errors like:
src/gdb/gdbserver/linux-x86-low.c:477:1: error: invalid conversion from 'int' to 'regset_type' [-fpermissive]
gdb/gdbserver/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* linux-low.h (NULL_REGSET): Define.
* linux-aarch64-low.c (aarch64_regsets): Use NULL_REGSET.
* linux-arm-low.c (arm_regsets): Likewise.
* linux-crisv32-low.c (cris_regsets): Likewise.
* linux-m68k-low.c (m68k_regsets): Likewise.
* linux-mips-low.c (mips_regsets): Likewise.
* linux-nios2-low.c (nios2_regsets): Likewise.
* linux-ppc-low.c (ppc_regsets): Likewise.
* linux-s390-low.c (s390_regsets): Likewise.
* linux-sh-low.c (sh_regsets): Likewise.
* linux-sparc-low.c (sparc_regsets): Likewise.
* linux-tic6x-low.c (tic6x_regsets): Likewise.
* linux-tile-low.c (tile_regsets): Likewise.
* linux-x86-low.c (x86_regsets): Likewise.
* linux-xtensa-low.c (xtensa_regsets): Likewise.
---
gdb/gdbserver/linux-aarch64-low.c | 2 +-
gdb/gdbserver/linux-arm-low.c | 2 +-
gdb/gdbserver/linux-crisv32-low.c | 2 +-
gdb/gdbserver/linux-low.h | 5 +++++
gdb/gdbserver/linux-m68k-low.c | 2 +-
gdb/gdbserver/linux-mips-low.c | 2 +-
gdb/gdbserver/linux-nios2-low.c | 2 +-
gdb/gdbserver/linux-ppc-low.c | 2 +-
gdb/gdbserver/linux-s390-low.c | 2 +-
gdb/gdbserver/linux-sh-low.c | 2 +-
gdb/gdbserver/linux-sparc-low.c | 2 +-
gdb/gdbserver/linux-tic6x-low.c | 2 +-
gdb/gdbserver/linux-tile-low.c | 2 +-
gdb/gdbserver/linux-x86-low.c | 2 +-
gdb/gdbserver/linux-xtensa-low.c | 2 +-
15 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index cb49a04..4f23392 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -539,7 +539,7 @@ static struct regset_info aarch64_regsets[] =
sizeof (struct user_fpsimd_state), FP_REGS,
aarch64_fill_fpregset, aarch64_store_fpregset
},
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info aarch64_regsets_info =
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index d3ae9f4..bab2aaf 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -898,7 +898,7 @@ static struct regset_info arm_regsets[] = {
{ PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 0, 32 * 8 + 4,
EXTENDED_REGS,
arm_fill_vfpregset, arm_store_vfpregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info arm_regsets_info =
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index f97122e..8d9ef04 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -391,7 +391,7 @@ cris_arch_setup (void)
static struct regset_info cris_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 28dd4db..ccf4c94 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -38,6 +38,11 @@ enum regset_type {
EXTENDED_REGS,
};
+/* The arch's regsets array initializer must be terminated with a NULL
+ regset. */
+#define NULL_REGSET \
+ { 0, 0, 0, -1, (enum regset_type) -1, NULL, NULL }
+
struct regset_info
{
int get_request, set_request;
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
index ba8e5e9..10129a6 100644
--- a/gdb/gdbserver/linux-m68k-low.c
+++ b/gdb/gdbserver/linux-m68k-low.c
@@ -119,7 +119,7 @@ static struct regset_info m68k_regsets[] = {
FP_REGS,
m68k_fill_fpregset, m68k_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static const gdb_byte m68k_breakpoint[] = { 0x4E, 0x4F };
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 344d7a5..86f7962 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -837,7 +837,7 @@ static struct regset_info mips_regsets[] = {
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS,
mips_fill_fpregset, mips_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info mips_regsets_info =
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
index 95a2d9e..369e89c 100644
--- a/gdb/gdbserver/linux-nios2-low.c
+++ b/gdb/gdbserver/linux-nios2-low.c
@@ -239,7 +239,7 @@ static struct regset_info nios2_regsets[] =
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
nios2_num_regs * 4, GENERAL_REGS,
nios2_fill_gregset, nios2_store_gregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info nios2_regsets_info =
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 6e6a936..9e223ea 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -657,7 +657,7 @@ static struct regset_info ppc_regsets[] = {
{ PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS,
ppc_fill_evrregset, ppc_store_evrregset },
{ 0, 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct usrregs_info ppc_usrregs_info =
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 2ba1221..efede2d 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -390,7 +390,7 @@ static struct regset_info s390_regsets[] = {
EXTENDED_REGS, s390_fill_vxrs_low, s390_store_vxrs_low },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0,
EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
index f7f3239..207e87e 100644
--- a/gdb/gdbserver/linux-sh-low.c
+++ b/gdb/gdbserver/linux-sh-low.c
@@ -114,7 +114,7 @@ static void sh_fill_gregset (struct regcache *regcache, void *buf)
static struct regset_info sh_regsets[] = {
{ 0, 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info sh_regsets_info =
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdb/gdbserver/linux-sparc-low.c
index 0691867..e6a4f84 100644
--- a/gdb/gdbserver/linux-sparc-low.c
+++ b/gdb/gdbserver/linux-sparc-low.c
@@ -291,7 +291,7 @@ static struct regset_info sparc_regsets[] = {
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t),
FP_REGS,
sparc_fill_fpregset, sparc_store_fpregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info sparc_regsets_info =
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
index d9476fd..cf8b5fb 100644
--- a/gdb/gdbserver/linux-tic6x-low.c
+++ b/gdb/gdbserver/linux-tic6x-low.c
@@ -332,7 +332,7 @@ tic6x_store_gregset (struct regcache *regcache, const void *buf)
static struct regset_info tic6x_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, TIC6X_NUM_REGS * 4, GENERAL_REGS,
tic6x_fill_gregset, tic6x_store_gregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static void
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index e31a620..47ca245 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -135,7 +135,7 @@ static struct regset_info tile_regsets[] =
{
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, tile_num_regs * 8,
GENERAL_REGS, tile_fill_gregset, tile_store_gregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static struct regsets_info tile_regsets_info =
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 406d552..89ec4e5 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -463,7 +463,7 @@ static struct regset_info x86_regsets[] =
FP_REGS,
x86_fill_fpregset, x86_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
static CORE_ADDR
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index fa6f418..7c71631 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -142,7 +142,7 @@ static struct regset_info xtensa_regsets[] = {
{ PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE,
EXTENDED_REGS,
xtensa_fill_xtregset, xtensa_store_xtregset },
- { 0, 0, 0, -1, -1, NULL, NULL }
+ NULL_REGSET
};
#if XCHAL_HAVE_BE
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/7] gdbserver: btrace enums
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
` (2 preceding siblings ...)
2015-10-28 17:10 ` [PATCH 3/7] gdbserver/Linux: Introduce NULL_REGSET Pedro Alves
@ 2015-10-28 17:20 ` Pedro Alves
2015-10-28 18:46 ` Metzger, Markus T
2015-10-28 17:44 ` [PATCH 5/7] gdbserver: enum gdb_signal casts Pedro Alves
` (3 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 17:20 UTC (permalink / raw)
To: gdb-patches
Fixes:
../../../src/gdb/gdbserver/linux-low.c: In function âint linux_low_read_btrace(btrace_target_info*, buffer*, int)â:
../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from âintâ to âbtrace_read_typeâ [-fpermissive]
err = linux_read_btrace (&btrace, tinfo, type);
^
In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0:
../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error: initializing argument 3 of âbtrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)â [-fpermissive]
extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
^
I didn't spot the cyclic dependency the comment talks about.
gdb/ChangeLog:
2015-10-28 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_low_read_btrace): Change type of 'type'
parameter.
* server.c (handle_qxfer_btrace): Change type of 'type'
local.
* target.h (struct target_ops) <read_btrace>: Change type of
'type' parameter. Update comment.
---
gdb/gdbserver/linux-low.c | 2 +-
gdb/gdbserver/server.c | 3 ++-
gdb/gdbserver/target.h | 6 +++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e778c4c..41ab510 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6815,7 +6815,7 @@ linux_low_encode_raw (struct buffer *buffer, const gdb_byte *data,
static int
linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer,
- int type)
+ enum btrace_read_type type)
{
struct btrace_data btrace;
struct btrace_block *block;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index ad6626e..024399d 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1608,7 +1608,8 @@ handle_qxfer_btrace (const char *annex,
{
static struct buffer cache;
struct thread_info *thread;
- int type, result;
+ enum btrace_read_type type;
+ int result;
if (the_target->read_btrace == NULL || writebuf != NULL)
return -2;
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index a14c6ff..769c876 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -399,11 +399,11 @@ struct target_ops
Returns zero on success, non-zero otherwise. */
int (*disable_btrace) (struct btrace_target_info *tinfo);
- /* Read branch trace data into buffer. We use an int to specify the type
- to break a cyclic dependency.
+ /* Read branch trace data into buffer.
Return 0 on success; print an error message into BUFFER and return -1,
otherwise. */
- int (*read_btrace) (struct btrace_target_info *, struct buffer *, int type);
+ int (*read_btrace) (struct btrace_target_info *, struct buffer *,
+ enum btrace_read_type type);
/* Read the branch trace configuration into BUFFER.
Return 0 on success; print an error message into BUFFER and return -1
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/7] gdbserver: enum gdb_signal casts
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
` (3 preceding siblings ...)
2015-10-28 17:20 ` [PATCH 4/7] gdbserver: btrace enums Pedro Alves
@ 2015-10-28 17:44 ` Pedro Alves
2015-10-28 17:57 ` [PATCH 2/7] Add cast to exception_none Pedro Alves
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 17:44 UTC (permalink / raw)
To: gdb-patches
This is code parsing RSP signal numbers, checking whether the numbers
are indeed valid/known GDB signals, and then converting to host signal
numbers. I considered adding temporary enum gdb_signal variables
instead, but didn't really like the result.
gdb/gdbserver/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* server.c (handle_v_cont, process_serial_event): Add enum
gdb_signal casts to signal parsing code.
---
gdb/gdbserver/server.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 024399d..3232da1 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2555,9 +2555,9 @@ handle_v_cont (char *own_buf)
goto err;
p = q;
- if (!gdb_signal_to_host_p (sig))
+ if (!gdb_signal_to_host_p ((enum gdb_signal) sig))
goto err;
- resume_info[i].sig = gdb_signal_to_host (sig);
+ resume_info[i].sig = gdb_signal_to_host ((enum gdb_signal) sig);
}
else if (p[0] == 'r')
{
@@ -4039,8 +4039,8 @@ process_serial_event (void)
case 'C':
require_running (own_buf);
hex2bin (own_buf + 1, &sig, 1);
- if (gdb_signal_to_host_p (sig))
- signal = gdb_signal_to_host (sig);
+ if (gdb_signal_to_host_p ((enum gdb_signal) sig))
+ signal = gdb_signal_to_host ((enum gdb_signal) sig);
else
signal = 0;
myresume (own_buf, 0, signal);
@@ -4048,8 +4048,8 @@ process_serial_event (void)
case 'S':
require_running (own_buf);
hex2bin (own_buf + 1, &sig, 1);
- if (gdb_signal_to_host_p (sig))
- signal = gdb_signal_to_host (sig);
+ if (gdb_signal_to_host_p ((enum gdb_signal) sig))
+ signal = gdb_signal_to_host ((enum gdb_signal) sig);
else
signal = 0;
myresume (own_buf, 1, signal);
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/7] Add cast to exception_none
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
` (4 preceding siblings ...)
2015-10-28 17:44 ` [PATCH 5/7] gdbserver: enum gdb_signal casts Pedro Alves
@ 2015-10-28 17:57 ` Pedro Alves
2015-10-28 18:24 ` [PATCH 7/7] gdbserver/mem-break.c: Add cast Pedro Alves
2015-10-29 15:32 ` [PATCH 0/7] C++ patches Pedro Alves
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 17:57 UTC (permalink / raw)
To: gdb-patches
Fixes, in C++ mode:
../../src/gdb/common/common-exceptions.c:23:69: error: invalid conversion from âintâ to âreturn_reasonâ [-fpermissive]
const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
^
(I considered adding an enum value for '0', but the code and comments
around return_reason and its uses explain how 0 is special/internal,
so I'm leaving it be.)
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* common/common-exceptions.c (exception_none): Add cast.
---
gdb/common/common-exceptions.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c
index 8ee96ab..ce476a2 100644
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -20,7 +20,7 @@
#include "common-defs.h"
#include "common-exceptions.h"
-const struct gdb_exception exception_none = { 0, GDB_NO_ERROR, NULL };
+const struct gdb_exception exception_none = { (enum return_reason) 0, GDB_NO_ERROR, NULL };
#ifndef __cplusplus
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 7/7] gdbserver/mem-break.c: Add cast
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
` (5 preceding siblings ...)
2015-10-28 17:57 ` [PATCH 2/7] Add cast to exception_none Pedro Alves
@ 2015-10-28 18:24 ` Pedro Alves
2015-10-29 15:32 ` [PATCH 0/7] C++ patches Pedro Alves
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-28 18:24 UTC (permalink / raw)
To: gdb-patches
... for C++.
Fixes:
gdb/gdbserver/mem-break.c:204:28: error: invalid conversion from 'int' to 'bkpt_type' [-fpermissive]
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* mem-break.c (Z_packet_to_bkpt_type): Add cast.
---
gdb/gdbserver/mem-break.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 656402a..c808a84 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -241,7 +241,7 @@ Z_packet_to_bkpt_type (char z_type)
{
gdb_assert ('0' <= z_type && z_type <= '4');
- return gdb_breakpoint_Z0 + (z_type - '0');
+ return (enum bkpt_type) (gdb_breakpoint_Z0 + (z_type - '0'));
}
/* See mem-break.h. */
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 4/7] gdbserver: btrace enums
2015-10-28 17:20 ` [PATCH 4/7] gdbserver: btrace enums Pedro Alves
@ 2015-10-28 18:46 ` Metzger, Markus T
2015-10-29 14:42 ` Pedro Alves
0 siblings, 1 reply; 11+ messages in thread
From: Metzger, Markus T @ 2015-10-28 18:46 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Wednesday, October 28, 2015 3:59 PM
> To: gdb-patches@sourceware.org
> Subject: [PATCH 4/7] gdbserver: btrace enums
Hello Pedro,
> ../../../src/gdb/gdbserver/linux-low.c: In function ‘int
> linux_low_read_btrace(btrace_target_info*, buffer*, int)’:
> ../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from
> ‘int’ to ‘btrace_read_type’ [-fpermissive]
> err = linux_read_btrace (&btrace, tinfo, type);
> ^
> In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0:
> ../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error: initializing
> argument 3 of ‘btrace_error linux_read_btrace(btrace_data*,
> btrace_target_info*, btrace_read_type)’ [-fpermissive]
> extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
> ^
>
> I didn't spot the cyclic dependency the comment talks about.
At that time, you had to include server.h/defs.h before vec.h. So I couldn't
include btrace-common.h (which includes vec.h and also server.h) into target.h,
which was in turn included in server.h.
The patch looks good to me.
Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/7] gdbserver: btrace enums
2015-10-28 18:46 ` Metzger, Markus T
@ 2015-10-29 14:42 ` Pedro Alves
0 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-29 14:42 UTC (permalink / raw)
To: Metzger, Markus T, gdb-patches
On 10/28/2015 03:29 PM, Metzger, Markus T wrote:
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] On Behalf Of Pedro Alves
>> Sent: Wednesday, October 28, 2015 3:59 PM
>> To: gdb-patches@sourceware.org
>> Subject: [PATCH 4/7] gdbserver: btrace enums
>
> Hello Pedro,
Hi Markus,
>
>> ../../../src/gdb/gdbserver/linux-low.c: In function âint
>> linux_low_read_btrace(btrace_target_info*, buffer*, int)â:
>> ../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from
>> âintâ to âbtrace_read_typeâ [-fpermissive]
>> err = linux_read_btrace (&btrace, tinfo, type);
>> ^
>> In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0:
>> ../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error: initializing
>> argument 3 of âbtrace_error linux_read_btrace(btrace_data*,
>> btrace_target_info*, btrace_read_type)â [-fpermissive]
>> extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
>> ^
>>
>> I didn't spot the cyclic dependency the comment talks about.
>
> At that time, you had to include server.h/defs.h before vec.h. So I couldn't
> include btrace-common.h (which includes vec.h and also server.h) into target.h,
> which was in turn included in server.h.
>
>
> The patch looks good to me.
Thanks. I updated the git log to point to your explanation here, and
pushed this in.
Thanks.
---
Subject: [PATCH] gdbserver: btrace enums
Fixes:
../../../src/gdb/gdbserver/linux-low.c: In function âint linux_low_read_btrace(btrace_target_info*, buffer*, int)â:
../../../src/gdb/gdbserver/linux-low.c:6827:48: error: invalid conversion from âintâ to âbtrace_read_typeâ [-fpermissive]
err = linux_read_btrace (&btrace, tinfo, type);
^
In file included from ../../../src/gdb/gdbserver/linux-low.c:98:0:
../../../src/gdb/gdbserver/../nat/linux-btrace.h:116:26: error: initializing argument 3 of âbtrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)â [-fpermissive]
extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
^
The cyclic dependency the comment talks about is no longer relevant:
https://sourceware.org/ml/gdb-patches/2015-10/msg00643.html
gdb/gdbserver/ChangeLog:
2015-10-29 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_low_read_btrace): Change type of 'type'
parameter.
* server.c (handle_qxfer_btrace): Change type of 'type'
local.
* target.h (struct target_ops) <read_btrace>: Change type of
'type' parameter. Update comment.
---
gdb/gdbserver/ChangeLog | 18 ++++++++++++++++++
gdb/gdbserver/linux-low.c | 2 +-
gdb/gdbserver/server.c | 3 ++-
gdb/gdbserver/target.h | 6 +++---
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0dfecf1..9b8a7d7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -16,6 +16,24 @@
* linux-x86-low.c (x86_regsets): Likewise.
* linux-xtensa-low.c (xtensa_regsets): Likewise.
+2015-10-29 Pedro Alves <palves@redhat.com>
+
+ * linux-low.h (NULL_REGSET): Define.
+ * linux-aarch64-low.c (aarch64_regsets): Use NULL_REGSET.
+ * linux-arm-low.c (arm_regsets): Likewise.
+ * linux-crisv32-low.c (cris_regsets): Likewise.
+ * linux-m68k-low.c (m68k_regsets): Likewise.
+ * linux-mips-low.c (mips_regsets): Likewise.
+ * linux-nios2-low.c (nios2_regsets): Likewise.
+ * linux-ppc-low.c (ppc_regsets): Likewise.
+ * linux-s390-low.c (s390_regsets): Likewise.
+ * linux-sh-low.c (sh_regsets): Likewise.
+ * linux-sparc-low.c (sparc_regsets): Likewise.
+ * linux-tic6x-low.c (tic6x_regsets): Likewise.
+ * linux-tile-low.c (tile_regsets): Likewise.
+ * linux-x86-low.c (x86_regsets): Likewise.
+ * linux-xtensa-low.c (xtensa_regsets): Likewise.
+
2015-10-26 Doug Evans <dje@google.com>
* linux-low.c (__SIGRTMIN): Move to nat/linux-nat.h.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e778c4c..41ab510 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6815,7 +6815,7 @@ linux_low_encode_raw (struct buffer *buffer, const gdb_byte *data,
static int
linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer,
- int type)
+ enum btrace_read_type type)
{
struct btrace_data btrace;
struct btrace_block *block;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index ad6626e..024399d 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1608,7 +1608,8 @@ handle_qxfer_btrace (const char *annex,
{
static struct buffer cache;
struct thread_info *thread;
- int type, result;
+ enum btrace_read_type type;
+ int result;
if (the_target->read_btrace == NULL || writebuf != NULL)
return -2;
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index a14c6ff..769c876 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -399,11 +399,11 @@ struct target_ops
Returns zero on success, non-zero otherwise. */
int (*disable_btrace) (struct btrace_target_info *tinfo);
- /* Read branch trace data into buffer. We use an int to specify the type
- to break a cyclic dependency.
+ /* Read branch trace data into buffer.
Return 0 on success; print an error message into BUFFER and return -1,
otherwise. */
- int (*read_btrace) (struct btrace_target_info *, struct buffer *, int type);
+ int (*read_btrace) (struct btrace_target_info *, struct buffer *,
+ enum btrace_read_type type);
/* Read the branch trace configuration into BUFFER.
Return 0 on success; print an error message into BUFFER and return -1
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/7] C++ patches
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
` (6 preceding siblings ...)
2015-10-28 18:24 ` [PATCH 7/7] gdbserver/mem-break.c: Add cast Pedro Alves
@ 2015-10-29 15:32 ` Pedro Alves
7 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2015-10-29 15:32 UTC (permalink / raw)
To: gdb-patches
On 10/28/2015 02:59 PM, Pedro Alves wrote:
> A few more GDB-in-C++ patches.
>
> Pedro Alves (7):
> compile: Rename struct type_map_instance::gcc_type field
> Add cast to exception_none
> gdbserver/Linux: Introduce NULL_REGSET
> gdbserver: btrace enums
> gdbserver: enum gdb_signal casts
> gdbserver/tracepoint: Add casts out of tpoint->handle
> gdbserver/mem-break.c: Add cast
Simon mentioned this looked good to him on irc, so I pushed it all in.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-10-29 13:03 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 16:48 [PATCH 0/7] C++ patches Pedro Alves
2015-10-28 16:55 ` [PATCH 1/7] compile: Rename struct type_map_instance::gcc_type field Pedro Alves
2015-10-28 17:05 ` [PATCH 6/7] gdbserver/tracepoint: Add casts out of tpoint->handle Pedro Alves
2015-10-28 17:10 ` [PATCH 3/7] gdbserver/Linux: Introduce NULL_REGSET Pedro Alves
2015-10-28 17:20 ` [PATCH 4/7] gdbserver: btrace enums Pedro Alves
2015-10-28 18:46 ` Metzger, Markus T
2015-10-29 14:42 ` Pedro Alves
2015-10-28 17:44 ` [PATCH 5/7] gdbserver: enum gdb_signal casts Pedro Alves
2015-10-28 17:57 ` [PATCH 2/7] Add cast to exception_none Pedro Alves
2015-10-28 18:24 ` [PATCH 7/7] gdbserver/mem-break.c: Add cast Pedro Alves
2015-10-29 15:32 ` [PATCH 0/7] C++ patches Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox