btrace: Use std::vector in struct btrace_thread_information.
This commit is contained in:
parent
70c16c04ac
commit
2b51eddc55
3 changed files with 18 additions and 13 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2017-05-30 Tim Wiederhake <tim.wiederhake@intel.com>
|
||||||
|
|
||||||
|
* btrace.c (btrace_fetch, btrace_clear, btrace_find_insn_by_number):
|
||||||
|
Replace VEC_* with std::vector functions.
|
||||||
|
* btrace.h: Add include: vector. Remove typedef for DEF_VEC_P.
|
||||||
|
(struct btrace_thread_info)<functions>: Change type to std::vector.
|
||||||
|
|
||||||
2017-05-30 Simon Marchi <simon.marchi@ericsson.com>
|
2017-05-30 Simon Marchi <simon.marchi@ericsson.com>
|
||||||
|
|
||||||
* NEWS (Changes in GDB 8.0): Remove extra empty line. Move
|
* NEWS (Changes in GDB 8.0): Remove extra empty line. Move
|
||||||
|
|
17
gdb/btrace.c
17
gdb/btrace.c
|
@ -1857,12 +1857,12 @@ btrace_fetch (struct thread_info *tp)
|
||||||
btrace_data_append (&btinfo->data, &btrace);
|
btrace_data_append (&btinfo->data, &btrace);
|
||||||
btrace_maint_clear (btinfo);
|
btrace_maint_clear (btinfo);
|
||||||
|
|
||||||
VEC_truncate (btrace_fun_p, btinfo->functions, 0);
|
btinfo->functions.clear ();
|
||||||
btrace_clear_history (btinfo);
|
btrace_clear_history (btinfo);
|
||||||
btrace_compute_ftrace (tp, &btrace);
|
btrace_compute_ftrace (tp, &btrace);
|
||||||
|
|
||||||
for (bfun = btinfo->begin; bfun != NULL; bfun = bfun->flow.next)
|
for (bfun = btinfo->begin; bfun != NULL; bfun = bfun->flow.next)
|
||||||
VEC_safe_push (btrace_fun_p, btinfo->functions, bfun);
|
btinfo->functions.push_back (bfun);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
|
@ -1884,8 +1884,7 @@ btrace_clear (struct thread_info *tp)
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
|
|
||||||
btinfo = &tp->btrace;
|
btinfo = &tp->btrace;
|
||||||
|
btinfo->functions.clear ();
|
||||||
VEC_free (btrace_fun_p, btinfo->functions);
|
|
||||||
|
|
||||||
it = btinfo->begin;
|
it = btinfo->begin;
|
||||||
while (it != NULL)
|
while (it != NULL)
|
||||||
|
@ -2480,16 +2479,16 @@ btrace_find_insn_by_number (struct btrace_insn_iterator *it,
|
||||||
const struct btrace_function *bfun;
|
const struct btrace_function *bfun;
|
||||||
unsigned int upper, lower;
|
unsigned int upper, lower;
|
||||||
|
|
||||||
if (VEC_empty (btrace_fun_p, btinfo->functions))
|
if (btinfo->functions.empty ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lower = 0;
|
lower = 0;
|
||||||
bfun = VEC_index (btrace_fun_p, btinfo->functions, lower);
|
bfun = btinfo->functions[lower];
|
||||||
if (number < bfun->insn_offset)
|
if (number < bfun->insn_offset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
upper = VEC_length (btrace_fun_p, btinfo->functions) - 1;
|
upper = btinfo->functions.size () - 1;
|
||||||
bfun = VEC_index (btrace_fun_p, btinfo->functions, upper);
|
bfun = btinfo->functions[upper];
|
||||||
if (number >= bfun->insn_offset + ftrace_call_num_insn (bfun))
|
if (number >= bfun->insn_offset + ftrace_call_num_insn (bfun))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -2498,7 +2497,7 @@ btrace_find_insn_by_number (struct btrace_insn_iterator *it,
|
||||||
{
|
{
|
||||||
const unsigned int average = lower + (upper - lower) / 2;
|
const unsigned int average = lower + (upper - lower) / 2;
|
||||||
|
|
||||||
bfun = VEC_index (btrace_fun_p, btinfo->functions, average);
|
bfun = btinfo->functions[average];
|
||||||
|
|
||||||
if (number < bfun->insn_offset)
|
if (number < bfun->insn_offset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
# include <intel-pt.h>
|
# include <intel-pt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct thread_info;
|
struct thread_info;
|
||||||
struct btrace_function;
|
struct btrace_function;
|
||||||
|
|
||||||
|
@ -187,9 +189,6 @@ struct btrace_function
|
||||||
btrace_function_flags flags;
|
btrace_function_flags flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct btrace_function *btrace_fun_p;
|
|
||||||
DEF_VEC_P (btrace_fun_p);
|
|
||||||
|
|
||||||
/* A branch trace instruction iterator. */
|
/* A branch trace instruction iterator. */
|
||||||
struct btrace_insn_iterator
|
struct btrace_insn_iterator
|
||||||
{
|
{
|
||||||
|
@ -342,7 +341,7 @@ struct btrace_thread_info
|
||||||
|
|
||||||
/* Vector of pointer to decoded function segments. These are in execution
|
/* Vector of pointer to decoded function segments. These are in execution
|
||||||
order with the first element == BEGIN and the last element == END. */
|
order with the first element == BEGIN and the last element == END. */
|
||||||
VEC (btrace_fun_p) *functions;
|
std::vector<btrace_function *> functions;
|
||||||
|
|
||||||
/* The function level offset. When added to each function's LEVEL,
|
/* The function level offset. When added to each function's LEVEL,
|
||||||
this normalizes the function levels such that the smallest level
|
this normalizes the function levels such that the smallest level
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue