From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: "Wiederhake, Tim" <tim.wiederhake@intel.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 05/11] btrace: Use function segment index in insn iterator.
Date: Fri, 24 Feb 2017 09:32:00 -0000 [thread overview]
Message-ID: <A78C989F6D9628469189715575E55B234004E8B5@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <1487337989-6367-6-git-send-email-tim.wiederhake@intel.com>
> -----Original Message-----
> From: Wiederhake, Tim
> Sent: Friday, February 17, 2017 2:26 PM
> To: gdb-patches@sourceware.org
> Cc: Metzger, Markus T <markus.t.metzger@intel.com>
> Subject: [PATCH 05/11] btrace: Use function segment index in insn iterator.
Hello Tim,
> 2017-02-17 Tim Wiederhake <tim.wiederhake@intel.com>
>
> gdb/ChangeLog
> * btrace.c: (btrace_insn_get, btrace_insn_get_error,
> btrace_insn_number,
> btrace_insn_begin, btrace_insn_end, btrace_insn_next,
> btrace_insn_prev,
> btrace_find_insn_by_number): Replaced function segment pointer with
> index.
I think this is "Replace function segment ...". More below.
> diff --git a/gdb/btrace.c b/gdb/btrace.c
> index 31590ce..1e110cc 100644
> --- a/gdb/btrace.c
> +++ b/gdb/btrace.c
> @@ -2236,8 +2236,8 @@ btrace_insn_get (const struct btrace_insn_iterator *it)
> const struct btrace_function *bfun;
> unsigned int index, end;
>
> - index = it->index;
> - bfun = it->function;
> + index = it->insn_index;
> + bfun = VEC_index (btrace_fun_p, it->btinfo->functions, it->call_index);
Should we assert that IT->CALL_INDEX lies inside the vector's bounds? More below.
> diff --git a/gdb/btrace.h b/gdb/btrace.h
> index c49b114..53df6e9 100644
> --- a/gdb/btrace.h
> +++ b/gdb/btrace.h
> @@ -196,12 +196,12 @@ struct btrace_insn_iterator
> /* The branch trace information for this thread. Will never be NULL. */
> const struct btrace_thread_info *btinfo;
>
> - /* The branch trace function segment containing the instruction.
> - Will never be NULL. */
> - const struct btrace_function *function;
> + /* The index of the function call segment in struct btrace_thread_info's
> + FUNCTIONS vector. Note that index + 1 == number. */
> + unsigned int call_index;
The comment is really referring to the iterator's BTINFO field, isn't it? Why
not say "The index in BTINFO->FUNCTIONS". I don't think we need the note
on how the index relates to the function number, here.
With this change, the btrace_insn_iterator really contains all the fields of
btrace_call_iterator. Should we make it actually contain a btrace_call_iterator?
It might simplify the above code in that it allows us to use btrace_call_get instead
of accessing the BTINFO->FUNCTIONS vector directly.
> @@ -1692,7 +1692,8 @@ record_btrace_frame_sniffer (const struct
> frame_unwind *self,
>
> replay = tp->btrace.replay;
> if (replay != NULL)
> - bfun = replay->function;
> + bfun = VEC_index (btrace_fun_p, tp->btrace.functions,
> + replay->call_index);
We should use REPLAY->BTINFO or, even better, btrace_call_get.
> @@ -2705,7 +2706,7 @@ record_btrace_set_replay (struct thread_info *tp,
>
> btinfo = &tp->btrace;
>
> - if (it == NULL || it->function == NULL)
> + if (it == NULL)
> record_btrace_stop_replaying (tp);
IT->FUNCTION == NULL checks for the end iterator. I don't think that we can
simply omit it.
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, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2017-02-24 9:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 13:27 [PATCH 00/11] btrace: Turn linked list of function call segments into vector Tim Wiederhake
2017-02-17 13:27 ` [PATCH 02/11] btrace: Change parameters to use btrace_thread_info Tim Wiederhake
2017-02-24 9:32 ` Metzger, Markus T
2017-02-17 13:27 ` [PATCH 09/11] [SQUASH] btrace: Remove struct btrace_thread_info::{begin,end} Tim Wiederhake
2017-02-17 13:27 ` [PATCH 06/11] [SQUASH] btrace: Save function calls in a vector Tim Wiederhake
2017-02-24 9:33 ` Metzger, Markus T
2017-02-17 13:27 ` [PATCH 08/11] [SQUASH] btrace: Adjust struct btrace_function::{flow,segment} Tim Wiederhake
2017-02-24 9:33 ` Metzger, Markus T
2017-02-17 13:27 ` [PATCH 01/11] btrace: Use struct btrace_thread_info fields directly Tim Wiederhake
2017-02-17 13:27 ` [PATCH 05/11] btrace: Use function segment index in insn iterator Tim Wiederhake
2017-02-24 9:32 ` Metzger, Markus T [this message]
2017-02-17 13:27 ` [PATCH 11/11] [SQUASH] btrace: Cleanup Tim Wiederhake
2017-02-17 13:27 ` [PATCH 03/11] btrace: Add btinfo to instruction interator Tim Wiederhake
2017-02-24 9:32 ` Metzger, Markus T
2017-02-17 13:27 ` [PATCH 04/11] btrace: Use function segment index in call iterator Tim Wiederhake
2017-02-24 9:32 ` Metzger, Markus T
2017-02-17 13:27 ` [PATCH 10/11] [SQUASH] btrace: Remove bfun_s vector Tim Wiederhake
2017-02-17 13:27 ` [PATCH 07/11] [SQUASH] btrace: Adjust struct btrace_function::up Tim Wiederhake
2017-02-24 9:33 ` Metzger, Markus T
2017-02-24 9:32 ` [PATCH 00/11] btrace: Turn linked list of function call segments into vector Metzger, Markus T
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A78C989F6D9628469189715575E55B234004E8B5@IRSMSX104.ger.corp.intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=tim.wiederhake@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).