diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-12 13:55:32 +0200 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-12 13:55:32 +0200 |
commit | 1eac6bea98f41ee12ba9e750a9578bd8585011c9 (patch) | |
tree | e67896dc27ed9d5e758e5cbd4abc207cd45c0def /gdb/probe.h | |
parent | aaa63a31909946c4f68da64a93662147d67630bd (diff) | |
download | gdb-1eac6bea98f41ee12ba9e750a9578bd8585011c9.zip gdb-1eac6bea98f41ee12ba9e750a9578bd8585011c9.tar.gz gdb-1eac6bea98f41ee12ba9e750a9578bd8585011c9.tar.bz2 |
Make collect_probes return an std::vector
Change collect_probes so it returns an std::vector<bound_probe> instead
of a VEC(bound_probe_s). This allows removing some cleanups. It also
seems like enable_probes_command and disable_probes_command were not
freeing that vector.
The comparison function compare_probes needs to be updated to return a
bool indicating whether the first parameter is "less than" the second
parameter.
I defined two constructors to bound_probe. The default constructor is
needed, for example, so the instance in struct bp_location can be
constructed without parameters. The constructor with parameters is
useful so we can use emplace_back and pass the values directly.
The s390 builder on the buildbot shows a weird failure that I can't
explain:
../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*):
../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror]
for (struct probe *probe : *probes)
^~~~~~
I guess it's a bug with that specific version< of the compiler, since no
other gcc gives me that error. It is using:
g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
Any idea about this problem?
gdb/ChangeLog:
* probe.h (struct bound_probe): Define constructors.
* probe.c (bound_probe_s): Remove typedef.
(DEF_VEC_O (bound_probe_s)): Remove VEC.
(collect_probes): Change return type to std::vector, remove
cleanup.
(compare_probes): Return bool, change parameter type. Change
semantic to "less than".
(gen_ui_out_table_header_info): Change parameter to std::vector
and update.
(exists_probe_with_pops): Likewise.
(info_probes_for_ops): Update to std::vector change.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
Diffstat (limited to 'gdb/probe.h')
-rw-r--r-- | gdb/probe.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gdb/probe.h b/gdb/probe.h index 61e3031..3248dc8 100644 --- a/gdb/probe.h +++ b/gdb/probe.h @@ -214,15 +214,26 @@ struct probe their point of use. */ struct bound_probe - { - /* The probe. */ +{ + /* Create an empty bound_probe object. */ - struct probe *probe; + bound_probe () + {} - /* The objfile in which the probe originated. */ + /* Create and initialize a bound_probe object using PROBE and OBJFILE. */ - struct objfile *objfile; - }; + bound_probe (struct probe *probe_, struct objfile *objfile_) + : probe (probe_), objfile (objfile_) + {} + + /* The probe. */ + + struct probe *probe = NULL; + + /* The objfile in which the probe originated. */ + + struct objfile *objfile = NULL; +}; /* A helper for linespec that decodes a probe specification. It returns a std::vector<symtab_and_line> object and updates LOC or |