From 1f45808ead357e8a81dec16b9802a6c369e08426 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:43 +0000 Subject: Clean up tracepoint.h/c:collection_list Noticed we could do this while working on the expression_up change. The main goal here was getting rid of the encode_actions_and_make_cleanup / do_clear_collection_list cleanups. While at it, uncrustify the code: - Make collection_list a C++ class, with data members private (and thus renamed m_...). - Make related functions be member methods. - Use std::vector instead of an open coding a vector implementation. - Use std::sort instead of qsort. - Rename the "list" member of collection_list, which is an incredibly obfuscating name. - Rename a couple other things here and there for clarify. - Use "bool" more. gdb/ChangeLog: 2016-11-08 Pedro Alves * mi/mi-main.c (print_variable_or_computed): Constify 'expression' parameter. (mi_cmd_trace_frame_collected): Call encode_actions instead of encode_actions_and_make_cleanup. Adjust to use std::vector. * tracepoint.c (memrange_cmp): Delete. (memrange_comp): New. (memrange_sortmerge): Take a memrange vector as parameter instead of a collection_list. Use std::sort instead of qsort. (add_register): Now a method of collection_list. Adjust to m_ prefix of data fields. (add_memrange): Now a method of collection_list. Adjust to m_ prefix of data fields. Adjust to use std::vector. (collect_symbol): Now a method of collection_list. Adjust to m_ prefix of data fields. (do_collect_symbol): Adjust. Call add_wholly_collected instead of accessing the vector directly. (collection_list::add_wholly_collected): New. (add_local_symbols): Now a method of collection_list. (add_static_trace_data): Now a method of collection_list. Adjust to use bool. (clear_collection_list, do_clear_collection_list): Delete. (init_collection_list): Delete. (collection_list::collection_list): New. (collection_list::~collection_list): New. (stringify_collection_list): Rename to ... (collection_list::stringify): ... this and adjust to being a method of collection_list. Adjust to use of std::vector. (append_exp): Now a method of collection_list. Use ui_file_as_string. Adjust to std::vector. (collection_list::finish): New. (encode_actions_1): Adjust. (encode_actions_and_make_cleanup): Rename to ... (encode_actions)... this. No longer returns a cleanup. No longer call init_collection_list nor install do_clear_collection_list cleanups. Call collection_list::finish instead of memrange_sortmerge directly. (encode_actions_rsp): Adjust to call encode_actions instead of encode_actions_and_make_cleanup. Adjust to method renames. (add_aexpr): Now a method of collection_list. * tracepoint.h: Include and . (struct memrange): Add constructors. (struct collection_list): Now a class. (class collection_list) : New methods. : Rename to ... : ... this. : Delete fields. : New field. : Delete fields. : New field. : Rename to ... : ... this. Now a bool. : Rename to ... : ... this. Now a std::vector. : Rename to ... : ... this. Now a std::vector. (encode_actions_and_make_cleanup): Delete declaration. (encode_actions): New declaration. --- gdb/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'gdb/ChangeLog') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6078081..274c681 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,69 @@ 2016-11-08 Pedro Alves + * mi/mi-main.c (print_variable_or_computed): Constify 'expression' + parameter. + (mi_cmd_trace_frame_collected): Call encode_actions instead of + encode_actions_and_make_cleanup. Adjust to use std::vector. + * tracepoint.c (memrange_cmp): Delete. + (memrange_comp): New. + (memrange_sortmerge): Take a memrange vector as parameter instead + of a collection_list. Use std::sort instead of qsort. + (add_register): Now a method of collection_list. Adjust to m_ + prefix of data fields. + (add_memrange): Now a method of collection_list. Adjust to m_ + prefix of data fields. Adjust to use std::vector. + (collect_symbol): Now a method of collection_list. Adjust to m_ + prefix of data fields. + (do_collect_symbol): Adjust. Call add_wholly_collected instead of + accessing the vector directly. + (collection_list::add_wholly_collected): New. + (add_local_symbols): Now a method of collection_list. + (add_static_trace_data): Now a method of collection_list. Adjust + to use bool. + (clear_collection_list, do_clear_collection_list): Delete. + (init_collection_list): Delete. + (collection_list::collection_list): New. + (collection_list::~collection_list): New. + (stringify_collection_list): Rename to ... + (collection_list::stringify): ... this and adjust to being a + method of collection_list. Adjust to use of std::vector. + (append_exp): Now a method of collection_list. Use + ui_file_as_string. Adjust to std::vector. + (collection_list::finish): New. + (encode_actions_1): Adjust. + (encode_actions_and_make_cleanup): Rename to ... + (encode_actions)... this. No longer returns a cleanup. No longer + call init_collection_list nor install do_clear_collection_list + cleanups. Call collection_list::finish instead of + memrange_sortmerge directly. + (encode_actions_rsp): Adjust to call encode_actions instead of + encode_actions_and_make_cleanup. Adjust to method renames. + (add_aexpr): Now a method of collection_list. + * tracepoint.h: Include and . + (struct memrange): Add constructors. + (struct collection_list): Now a class. + (class collection_list) : New methods. + : Rename to ... + : ... this. + : Delete fields. + : New field. + : Delete fields. + : New field. + : Rename to ... + : ... this. Now a bool. + : Rename to ... + : ... this. Now a std::vector. + : Rename to ... + : ... this. Now a std::vector. + (encode_actions_and_make_cleanup): Delete declaration. + (encode_actions): New declaration. + +2016-11-08 Pedro Alves + * ui-file.c (do_ui_file_as_string, ui_file_as_string): New functions. * ui-file.h: Include . -- cgit v1.1