[4/7] gdbserver: btrace enums
Commit Message
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(-)
Comments
> -----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
@@ -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;
@@ -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;
@@ -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