More gdb/skip.c C++ification
authorPedro Alves <palves@redhat.com>
Fri, 11 Aug 2017 11:11:28 +0000 (12:11 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 11 Aug 2017 11:11:28 +0000 (12:11 +0100)
commitde7985c3cca1358b21b49a9872455e2032f48ee3
tree5480a35da9833bf2e31b5edbb8a3106d0be9fa07
parentbe7d3cd5f13196dd070978aa48c2832c351c25b6
More gdb/skip.c C++ification

- Make skiplist_entry a class with private data members.
- Move all construction logic to the ctor.
- Make skip_file_p etc be methods of skiplist_entry.
- Use std::list for the skip entries chain.  Make the list own its
  elements.
- Get rid of the ALL_SKIPLIST_ENTRIES/ALL_SKIPLIST_ENTRIES_SAFE
  macros, use range-for / iterators instead.
- function_name_is_marked_for_skip 'function_sal' argument must be
  non-NULL, so make it a reference instead.

All skiplist_entry invariants are now controlled by skiplist_entry
methods/internals.  Some gdb_asserts disappear for being redundant.

gdb/ChangeLog:
2017-08-11  Pedro Alves  <palves@redhat.com>

* infrun.c (process_event_stop_test): Adjust
function_name_is_marked_for_skip call.
* skip.c: Include <list>.
(skiplist_entry): Make it a class with private fields, and
getters/setters.
(skiplist_entry_chain): Delete.
(skiplist_entries): New.
(skiplist_entry_count): Delete.
(highest_skiplist_entry_num): New.
(ALL_SKIPLIST_ENTRIES, ALL_SKIPLIST_ENTRIES_SAFE): Delete.
(add_skiplist_entry): Delete.
(skiplist_entry::skiplist_entry): New.
(skiplist_entry::add_entry): New.
(skip_file_command, skip_function): Adjust.
(compile_skip_regexp): Delete.
(skip_command): Don't compile regexp here.  Adjust to use
skiplist_entry::add_entry.
(skip_info): Adjust to use range-for and getters.
(skip_enable_command, skip_disable_command): Adjust to use
range-for and setters.
(skip_delete_command): Adjust to use std::list.
(add_skiplist_entry): Delete.
(skip_file_p): Delete, refactored as ...
(skiplist_entry::do_skip_file_p): ... this new method.
(skip_gfile_p): Delete, refactored as ...
(skiplist_entry::do_gskip_file_p): ... this new method.
(skip_function_p, skip_rfunction_p): Delete, refactored as ...
(skiplist_entry::skip_function_p): ... this new method.
(function_name_is_marked_for_skip): Now returns bool, and takes
the function sal by const reference.  Adjust to use range-for and
skiplist_entry methods.
(_initialize_step_skip): Remove references to
skiplist_entry_chain, skiplist_entry_count.
* skip.h (function_name_is_marked_for_skip): Now returns bool, and
takes the function sal by const reference.
gdb/ChangeLog
gdb/infrun.c
gdb/skip.c
gdb/skip.h