diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-04-09 15:16:19 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-04-09 15:16:19 -0400 |
commit | c252925ccc8c3c2ce2a65d12a50acfee53914ce3 (patch) | |
tree | 6fa48792604458aec63c02752d1412d5adf655d9 /gdb/tracepoint.h | |
parent | c9638d2669ced9348eac869dadc7be24df85a9a8 (diff) | |
download | gdb-c252925ccc8c3c2ce2a65d12a50acfee53914ce3.zip gdb-c252925ccc8c3c2ce2a65d12a50acfee53914ce3.tar.gz gdb-c252925ccc8c3c2ce2a65d12a50acfee53914ce3.tar.bz2 |
Remove VEC(tsv_s), use std::vector instead
This patch removes VEC(tsv_s), using an std::vector instead. I C++ified
trace_state_variable a bit in the process, using std::string for the
name. I also thought it would be nicer to pass a const reference to
target_download_trace_state_variable, since we know it will never be
NULL. This highlighted that the make-target-delegates script didn't
handle references well, so I adjusted this as well. It will surely be
useful in the future.
gdb/ChangeLog:
* tracepoint.h (struct trace_state_variable): Add constructor.
<name>: Change type to std::string.
* tracepoint.c (tsv_s): Remove.
(DEF_VEC_O(tsv_s)): Remove.
(tvariables): Change to std::vector.
(create_trace_state_variable): Adjust to std::vector.
(find_trace_state_variable): Likewise.
(find_trace_state_variable_by_number): Likewise.
(delete_trace_state_variable): Likewise.
(trace_variable_command): Adjust to std::string.
(delete_trace_variable_command): Likewise.
(tvariables_info_1): Adjust to std::vector.
(save_trace_state_variables): Likewise.
(start_tracing): Likewise.
(merge_uploaded_trace_state_variables): Adjust to std::vector
and std::string.
* target.h (struct target_ops)
<to_download_trace_state_variable>: Pass reference to
trace_state_variable.
* target-debug.h (target_debug_print_const_trace_state_variable_r): New.
* target-delegates.c: Re-generate.
* mi/mi-interp.c (mi_tsv_created): Adjust to std::string.
(mi_tsv_deleted): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* remote.c (remote_download_trace_state_variable): Change
pointer to reference and adjust.
* make-target-delegates (parse_argtypes): Handle references.
(write_function_header): Likewise.
(munge_type): Likewise.
Diffstat (limited to 'gdb/tracepoint.h')
-rw-r--r-- | gdb/tracepoint.h | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 02f4bf7..42e4130 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -47,29 +47,33 @@ typedef std::unique_ptr<traceframe_info> traceframe_info_up; tracepoints. */ struct trace_state_variable - { - /* The variable's name. The user has to prefix with a dollar sign, - but we don't store that internally. */ - const char *name; +{ + trace_state_variable (std::string &&name_, int number_) + : name (name_), number (number_) + {} - /* An id number assigned by GDB, and transmitted to targets. */ - int number; + /* The variable's name. The user has to prefix with a dollar sign, + but we don't store that internally. */ + std::string name; + + /* An id number assigned by GDB, and transmitted to targets. */ + int number = 0; - /* The initial value of a variable is a 64-bit signed integer. */ - LONGEST initial_value; + /* The initial value of a variable is a 64-bit signed integer. */ + LONGEST initial_value = 0; - /* 1 if the value is known, else 0. The value is known during a - trace run, or in tfind mode if the variable was collected into - the current trace frame. */ - int value_known; + /* 1 if the value is known, else 0. The value is known during a + trace run, or in tfind mode if the variable was collected into + the current trace frame. */ + int value_known = 0; - /* The value of a variable is a 64-bit signed integer. */ - LONGEST value; + /* The value of a variable is a 64-bit signed integer. */ + LONGEST value = 0; - /* This is true for variables that are predefined and built into - the target. */ - int builtin; - }; + /* This is true for variables that are predefined and built into + the target. */ + int builtin = 0; + }; /* The trace status encompasses various info about the general state of the tracing run. */ |