From 39c49f83b643618704b1a89e0b14680090a17f97 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:46:13 -0700 Subject: Add target_ops argument to to_read_btrace 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (struct target_ops) : Add argument. * remote.c (struct target_ops) : Add 'self' argument. * amd64-linux-nat.c (amd64_linux_read_btrace): New function. (_initialize_amd64_linux_nat): Use it. * i386-linux-nat.c (i386_linux_read_btrace): New function. (_initialize_i386_linux_nat): Use it. --- gdb/ChangeLog | 11 +++++++++++ gdb/amd64-linux-nat.c | 11 ++++++++++- gdb/i386-linux-nat.c | 11 ++++++++++- gdb/remote.c | 3 ++- gdb/target.c | 2 +- gdb/target.h | 3 ++- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5c9b175..3480224 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2014-02-19 Tom Tromey + * target.h (struct target_ops) : Add argument. + * target.c (struct target_ops) : Add argument. + * remote.c (struct target_ops) : Add 'self' + argument. + * amd64-linux-nat.c (amd64_linux_read_btrace): New function. + (_initialize_amd64_linux_nat): Use it. + * i386-linux-nat.c (i386_linux_read_btrace): New function. + (_initialize_i386_linux_nat): Use it. + +2014-02-19 Tom Tromey + * target.h (struct target_ops) : Add argument. * target.c (target_teardown_btrace): Add argument. * remote.c (remote_teardown_btrace): Add 'self' argument. diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index d7256c3..b7b889b 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -1191,6 +1191,15 @@ amd64_linux_teardown_btrace (struct target_ops *self, linux_disable_btrace (tinfo); } +static enum btrace_error +amd64_linux_read_btrace (struct target_ops *self, + VEC (btrace_block_s) **data, + struct btrace_target_info *btinfo, + enum btrace_read_type type) +{ + return linux_read_btrace (data, btinfo, type); +} + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_amd64_linux_nat (void); @@ -1234,7 +1243,7 @@ _initialize_amd64_linux_nat (void) t->to_enable_btrace = amd64_linux_enable_btrace; t->to_disable_btrace = amd64_linux_disable_btrace; t->to_teardown_btrace = amd64_linux_teardown_btrace; - t->to_read_btrace = linux_read_btrace; + t->to_read_btrace = amd64_linux_read_btrace; /* Register the target. */ linux_nat_add_target (t); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 0f8bc82..84f20ab 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -1102,6 +1102,15 @@ i386_linux_teardown_btrace (struct target_ops *self, linux_disable_btrace (tinfo); } +static enum btrace_error +i386_linux_read_btrace (struct target_ops *self, + VEC (btrace_block_s) **data, + struct btrace_target_info *btinfo, + enum btrace_read_type type) +{ + return linux_read_btrace (data, btinfo, type); +} + /* -Wmissing-prototypes */ extern initialize_file_ftype _initialize_i386_linux_nat; @@ -1140,7 +1149,7 @@ _initialize_i386_linux_nat (void) t->to_enable_btrace = i386_linux_enable_btrace; t->to_disable_btrace = i386_linux_disable_btrace; t->to_teardown_btrace = i386_linux_teardown_btrace; - t->to_read_btrace = linux_read_btrace; + t->to_read_btrace = i386_linux_read_btrace; /* Register the target. */ linux_nat_add_target (t); diff --git a/gdb/remote.c b/gdb/remote.c index b77ea81..eb8eb0f 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11322,7 +11322,8 @@ remote_teardown_btrace (struct target_ops *self, /* Read the branch trace. */ static enum btrace_error -remote_read_btrace (VEC (btrace_block_s) **btrace, +remote_read_btrace (struct target_ops *self, + VEC (btrace_block_s) **btrace, struct btrace_target_info *tinfo, enum btrace_read_type type) { diff --git a/gdb/target.c b/gdb/target.c index e1ffaf0..7d3d587 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -4250,7 +4250,7 @@ target_read_btrace (VEC (btrace_block_s) **btrace, for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_read_btrace != NULL) - return t->to_read_btrace (btrace, btinfo, type); + return t->to_read_btrace (t, btrace, btinfo, type); tcomplain (); return BTRACE_ERR_NOT_SUPPORTED; diff --git a/gdb/target.h b/gdb/target.h index 982bc18..b9ff035 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -921,7 +921,8 @@ struct target_ops DATA is cleared before new trace is added. The branch trace will start with the most recent block and continue towards older blocks. */ - enum btrace_error (*to_read_btrace) (VEC (btrace_block_s) **data, + enum btrace_error (*to_read_btrace) (struct target_ops *self, + VEC (btrace_block_s) **data, struct btrace_target_info *btinfo, enum btrace_read_type type); -- cgit v1.1