This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 08/11] [SQUASH] btrace: Adjust struct btrace_function::{flow,segment}.


> -----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 08/11] [SQUASH] btrace: Adjust struct
> btrace_function::{flow,segment}.

Hello Tim,


> -  /* The previous and next segment belonging to the same function.
> -     If a function calls another function, the former will have at least
> -     two segments: one before the call and another after the return.  */
> -  struct btrace_func_link segment;
> -
> -  /* The previous and next function in control flow order.  */
> -  struct btrace_func_link flow;
> +  /* The function segment numbers of the previous and next segment belonging
> to
> +     the same function.  If a function calls another function, the former will
> +     have at least two segments: one before the call and another after the
> +     return.  Will be zero if there is no such function segment.  */
> +  unsigned int prev_segment;
> +  unsigned int next_segment;

Since we don't need FLOW.PREV/NEXT anymore, I'd omit _SEGMENT in the name
and just call it PREV and NEXT.  The comment will describe what they mean.

If we manage to not needing to squash the patches, I'd keep the two parts separate.

 
> -  for (; bfun != NULL; bfun = bfun->flow.next)
> -    bfun->level += adjustment;
> +  while (bfun != NULL)
> +    {
> +      bfun->level += adjustment;
> +      bfun = ftrace_find_call_by_number (btinfo, bfun->number + 1);
> +    }

Could we do a VEC_iterate instead?


>    level = INT_MAX;
> -  for (; bfun != end; bfun = bfun->flow.next)
> -    level = std::min (level, bfun->level);
> +  while (bfun != end)
> +    {
> +      level = std::min (level, bfun->level);
> +      bfun = ftrace_find_call_by_number (btinfo, bfun->number + 1);
> +    }

Same here.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]