GDB (xrefs)

Classes | Macros | Functions | Variables
cleanups.c File Reference
`#include "common-defs.h"`
`#include "cleanups.h"`

Go to the source code of this file.

## Classes
struct | cleanup

## Macros
#define | SENTINEL_CLEANUP ((struct cleanup *) &sentinel_cleanup)

## Functions
static struct cleanup * | make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function, void *arg, void(*free_arg)(void *))
static struct cleanup * | make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function, void *arg)
struct cleanup * | make_cleanup (make_cleanup_ftype *function, void *arg)
struct cleanup * | make_cleanup_dtor (make_cleanup_ftype *function, void *arg, make_cleanup_dtor_ftype *dtor)
struct cleanup * | make_final_cleanup (make_cleanup_ftype *function, void *arg)
static void | do_my_cleanups (struct cleanup **pmy_chain, struct cleanup *old_chain)
struct cleanup * | all_cleanups (void)
void | do_cleanups (struct cleanup *old_chain)
void | do_final_cleanups (struct cleanup *old_chain)
static void | discard_my_cleanups (struct cleanup **pmy_chain, struct cleanup *old_chain)
void | discard_cleanups (struct cleanup *old_chain)
void | discard_final_cleanups (struct cleanup *old_chain)
static struct cleanup * | save_my_cleanups (struct cleanup **pmy_chain)
struct cleanup * | save_cleanups (void)
struct cleanup * | save_final_cleanups (void)
static void | restore_my_cleanups (struct cleanup **pmy_chain, struct cleanup *chain)
void | restore_cleanups (struct cleanup *chain)
void | restore_final_cleanups (struct cleanup *chain)
void | null_cleanup (void *arg)

## Variables
static const struct cleanup | sentinel_cleanup = { 0, 0, 0, 0 }
static struct cleanup * | cleanup_chain = SENTINEL_CLEANUP
static struct cleanup * | final_cleanup_chain = SENTINEL_CLEANUP

## Macro Definition Documentation

## ◆ SENTINEL_CLEANUP

#define SENTINEL_CLEANUP ((struct cleanup *) &sentinel_cleanup)

Definition at line 59 of file cleanups.c.

Referenced by all_cleanups(), restore_my_cleanups(), and save_my_cleanups().

## Function Documentation

## ◆ all_cleanups()

struct cleanup* all_cleanups | ( | void |  | ) |

Definition at line 165 of file cleanups.c.

References SENTINEL_CLEANUP.

Referenced by captured_command_loop(), exception_rethrow(), find_overload_match(), operator new(), quit_force(), throw_exception_cxx(), and throw_exception_sjlj().

## ◆ discard_cleanups()

void discard_cleanups | ( | struct cleanup * | old_chain | ) |

Definition at line 212 of file cleanups.c.

References cleanup_chain, and discard_my_cleanups().

Referenced by ada_exception_message_1(), bpstat_do_actions(), call_function_by_hand_dummy(), catch_ada_exception_command_split(), core_open(), create_breakpoint(), darwin_current_sos(), displaced_step_prepare_throw(), execute_command(), fetch_inferior_event(), find_oload_champ_namespace_loop(), forward_search_command(), gather_arguments(), gdbscm_value_to_string(), generate_c_for_variable_locations(), get_prev_frame_if_no_cycle(), inf_ptrace_attach(), inf_ptrace_create_inferior(), init_cutu_and_read_dies(), init_tu_and_read_dwo_dies(), linespec_parse_basic(), macro_expand(), macro_expand_next(), make_symbol_overload_list(), open_and_init_dwo_file(), parse_xml_btrace(), parse_xml_raw(), pipe_windows_open(), prepare_for_detach(), proceed(), read_string(), record_btrace_open(), record_full_message(), record_full_restore(), record_full_wait_1(), remote_file_get(), remote_file_put(), remote_notif_ack(), remote_notif_parse(), reread_symbols(), reverse_search_command(), run_command_1(), save_infcall_suspend_state(), svr4_current_sos_direct(), svr4_handle_solib_event(), svr4_parse_libraries(), syms_from_objfile_1(), tdesc_parse_xml(), until_break_command(), until_next_command(), VEC(), and wait_for_inferior().

## ◆ discard_final_cleanups()

void discard_final_cleanups | ( | struct cleanup * | old_chain | ) |

Definition at line 221 of file cleanups.c.

References discard_my_cleanups(), and final_cleanup_chain.

## ◆ discard_my_cleanups()

static void discard_my_cleanups | ( | struct cleanup ** | pmy_chain,
|  | struct cleanup * | old_chain
| ) |  |
| static

Definition at line 194 of file cleanups.c.

References cleanup::arg, cleanup::free_arg, cleanup::next, and xfree().

Referenced by discard_cleanups(), and discard_final_cleanups().

## ◆ do_cleanups()

void do_cleanups | ( | struct cleanup * | old_chain | ) |

Definition at line 174 of file cleanups.c.

References cleanup_chain, and do_my_cleanups().

Referenced by ada_collect_symbol_completion_matches(), ada_iterate_over_symbols(), ada_lookup_symbol(), add_path(), add_symbol_file_command(), addr_info_make_relative(), arm_exidx_new_objfile(), auto_load_objfile_script_1(), auto_load_section_scripts(), bfd_lookup_symbol_from_dyn_symtab(), block_lookup(), btrace_add_pc(), btrace_fetch(), btrace_insn_history(), btrace_print_lines(), build_id_to_debug_bfd(), build_type_psymtabs_1(), c_parse(), c_type_print_base_struct_union(), call_function_by_hand_dummy(), captured_command_loop(), check_fast_tracepoint_sals(), coff_symfile_read(), compile_object_load(), compile_to_object(), complete_expression(), copy_sections(), create_excep_cond_exprs(), dbx_read_symtab(), decode_line_1(), decode_line_2(), decode_line_full(), decode_objc(), displaced_step_fixup(), displaced_step_prepare_throw(), dsbt_relocate_main_executable(), dw2_do_instantiate_symtab(), dw2_instantiate_symtab(), dwarf2_build_psymtabs_hard(), elfstab_build_psymtabs(), evaluate_subexp(), event_location_to_sals(), exception_rethrow(), exec_file_locate_attach(), execute_script_contents(), expand(), fetch_inferior_event(), filter_results(), find_function_symbols(), find_linespec_symbols(), find_method(), find_oload_champ_namespace_loop(), find_overload_match(), find_separate_debug_file(), find_source_lines(), find_superclass_methods(), follow_exec(), frv_relocate_main_executable(), gdb_bfd_lookup_symbol_from_symtab(), gdb_readline_wrapper(), gdbscm_apply_val_pretty_printer(), gdbscm_frame_read_register(), gdbscm_frame_read_var(), gdbscm_lookup_global_symbol(), gdbscm_lookup_symbol(), gdbscm_make_lazy_value(), gdbscm_make_value(), gdbscm_parse_and_eval(), gdbscm_type_field(), gdbscm_type_has_field_p(), gdbscm_value_address(), gdbscm_value_call(), gdbscm_value_dereference(), gdbscm_value_dynamic_type(), gdbscm_value_field(), gdbscm_value_referenced_value(), gdbscm_value_subscript(), gdbscm_value_to_lazy_string(), gdbscm_value_to_string(), generic_load(), generic_printstr(), get_filename_and_charpos(), get_var_value(), inferior_call_waitpid(), info_auto_load_libthread_db(), info_macro_command(), info_macros_command(), info_static_tracepoint_markers_command(), init_cutu_and_read_dies(), init_cutu_and_read_dies_no_follow(), init_tu_and_read_dwo_dies(), iterate_over_mappings(), jit_bfd_try_read_symtab(), linespec_complete(), linespec_complete_label(), linespec_lex_to_end(), linespec_parse_basic(), linux_child_follow_fork(), linux_info_proc(), linux_mntns_access_fs(), lm_info_read(), load_command(), macho_symfile_read(), macro_define_command(), macro_expand_command(), macro_expand_next(), macro_expand_once_command(), maybe_expand(), normal_stop(), objfile_relocate(), old_renaming_is_invisible(), open_symbol_file_object(), openp(), operator new(), parse_linespec(), parse_partial_symbols(), pascm_set_func(), pascm_show_func(), pipe_windows_open(), ppscm_make_pp_type_error_exception(), ppscm_print_children(), ppscm_print_exception_unless_memory_error(), ppscm_print_string_repr(), print_address_symbolic(), print_it_exception(), print_mention_exception(), proc_update_threads(), process_full_comp_unit(), process_full_type_unit(), process_structure_scope(), procfs_info_proc(), procfs_open_1(), procfs_pidlist(), prompt_for_continue(), psymtab_to_symtab_1(), read_alphacoff_dynamic_symtab(), read_dbx_symtab(), read_pe_exported_syms(), read_struct_type(), record_btrace_wait(), record_full_exec_insn(), record_full_goto_bookmark(), remote_check_symbols(), remote_file_get(), remote_file_put(), remote_query_supported(), resolve_subexp(), rs6000_aix_core_xfer_shared_libraries_aix(), rs6000_xfer_shared_libraries(), save_infcall_suspend_state(), search_minsyms_for_name(), solib_aix_solib_create_inferior_hook(), solib_find_1(), gdb_xml_parser::start_element(), stop_all_threads(), svr4_handle_solib_event(), svr4_keep_data_in_core(), svr4_parse_libraries(), symbol_file_add_from_memory(), symbol_file_add_separate(), symfile_bfd_open(), target_fileio_read_alloc_1(), target_write_memory_blocks(), tdesc_parse_xml(), thread_db_load_search(), throw_exception_cxx(), throw_exception_sjlj(), trace_dump_actions(), trace_save_ctf(), trace_save_tfile(), try_open_exec_file(), try_thread_db_load_from_dir(), try_thread_db_load_from_pdir_1(), tsave_command(), val_print_string(), VEC(), vlscm_binop(), vlscm_convert_typed_value_from_scheme(), vlscm_do_cast(), vlscm_rich_compare(), vlscm_unop(), wait_for_inferior(), whatis_exp(), write_name_assoc(), and write_var_or_type().

## ◆ do_final_cleanups()

void do_final_cleanups | ( | struct cleanup * | old_chain | ) |

Definition at line 183 of file cleanups.c.

References do_my_cleanups(), and final_cleanup_chain.

Referenced by quit_force().

## ◆ do_my_cleanups()

static void do_my_cleanups | ( | struct cleanup ** | pmy_chain,
|  | struct cleanup * | old_chain
| ) |  |
| static

Definition at line 146 of file cleanups.c.

References cleanup::arg, cleanup::free_arg, cleanup::function, cleanup::next, and xfree().

Referenced by do_cleanups(), and do_final_cleanups().

## ◆ make_cleanup()

struct cleanup* make_cleanup | ( | make_cleanup_ftype * | function,
|  | void * | arg
| ) |  |

Definition at line 116 of file cleanups.c.

References cleanup::arg, cleanup_chain, and make_my_cleanup().

Referenced by ada_collect_symbol_completion_matches(), ada_exception_message_1(), ada_iterate_over_symbols(), ada_lookup_symbol(), add_path(), add_symbol_file_command(), addr_info_make_relative(), all_tracepoint_actions_and_cleanup(), arm_exidx_new_objfile(), auto_load_objfile_script_1(), auto_load_section_scripts(), bfd_lookup_symbol_from_dyn_symtab(), block_lookup(), build_id_to_debug_bfd(), build_type_psymtabs_1(), c_compute_program(), c_parse(), c_type_print_base_struct_union(), call_function_by_hand_dummy(), catch_ada_exception_command_split(), check_fast_tracepoint_sals(), cmdscm_function(), coff_locate_sections(), coff_symfile_read(), compile_object_load(), compile_to_object(), complete_expression(), copy_sections(), core_open(), create_breakpoint(), create_excep_cond_exprs(), create_global_typedef_table(), darwin_current_sos(), dbx_read_symtab(), decode_line_1(), decode_line_2(), decode_line_full(), decode_objc(), displaced_step_fixup(), displaced_step_prepare_throw(), dsbt_relocate_main_executable(), dw2_do_instantiate_symtab(), dw2_instantiate_symtab(), dwarf2_add_field(), dwarf2_add_member_fn(), dwarf2_add_type_defn(), dwarf2_build_psymtabs_hard(), elfstab_build_psymtabs(), enable_thread_stack_temporaries(), event_location_to_sals(), exec_file_locate_attach(), execute_script_contents(), expand(), fetch_inferior_event(), filter_results(), find_function_symbols(), find_linespec_symbols(), find_method(), find_oload_champ_namespace_loop(), find_overload_match(), find_source_lines(), find_superclass_methods(), follow_exec(), frv_relocate_main_executable(), gather_arguments(), gdb_bfd_errmsg(), gdb_bfd_lookup_symbol_from_symtab(), gdb_readline_wrapper(), gdbscm_apply_val_pretty_printer(), gdbscm_frame_read_register(), gdbscm_frame_read_var(), gdbscm_lookup_global_symbol(), gdbscm_lookup_symbol(), gdbscm_parse_and_eval(), gdbscm_type_field(), gdbscm_type_has_field_p(), gdbscm_value_field(), gdbscm_value_to_lazy_string(), gdbscm_value_to_string(), generate_c_for_variable_locations(), generic_load(), generic_printstr(), get_prev_frame_if_no_cycle(), get_var_value(), inf_ptrace_attach(), inf_ptrace_create_inferior(), inferior_call_waitpid(), info_auto_load_libthread_db(), info_macro_command(), info_macros_command(), info_static_tracepoint_markers_command(), init_cutu_and_read_dies(), init_cutu_and_read_dies_no_follow(), init_tu_and_read_dwo_dies(), iterate_over_mappings(), linespec_complete(), linespec_complete_label(), linespec_lex_to_end(), linespec_parse_basic(), linux_child_follow_fork(), linux_info_proc(), linux_mntns_access_fs(), linux_nat_attach(), lm_info_read(), load_command(), macho_symfile_read(), macro_define_command(), macro_expand(), macro_expand_command(), macro_expand_next(), macro_expand_once_command(), make_bpstat_clear_actions_cleanup(), make_cleanup_btrace_data(), make_cleanup_free_bincl_list(), make_cleanup_free_char_ptr_vec(), make_cleanup_free_section_addr_info(), make_cleanup_free_target_description(), make_cleanup_free_typedef_hash(), make_cleanup_restore_infcall_control_state(), make_cleanup_restore_infcall_suspend_state(), make_cleanup_ui_out_end(), make_cleanup_unpush_target(), make_cleanup_value_free_to_mark(), make_symbol_overload_list(), maybe_expand(), normal_stop(), objfile_relocate(), old_renaming_is_invisible(), open_and_init_dwo_file(), open_symbol_file_object(), operator_stoken(), parse_linespec(), parse_partial_symbols(), parse_xml_raw(), pascm_set_func(), pascm_show_func(), pascm_signal_setshow_error(), pipe_windows_open(), ppscm_make_pp_type_error_exception(), ppscm_print_children(), ppscm_print_exception_unless_memory_error(), ppscm_print_string_repr(), prepare_for_detach(), print_address_symbolic(), print_it_exception(), print_mention_exception(), proc_update_threads(), proceed(), process_full_comp_unit(), process_full_type_unit(), process_structure_scope(), procfs_info_proc(), procfs_pidlist(), prompt_for_continue(), psymtab_include_file_name(), psymtab_to_symtab_1(), read_alphacoff_dynamic_symtab(), read_baseclasses(), read_cutu_die_from_dwo(), read_member_functions(), read_pe_exported_syms(), read_string(), read_struct_fields(), read_struct_type(), record_btrace_open(), record_btrace_wait(), record_full_exec_insn(), record_full_goto_bookmark(), record_full_message(), record_full_restore(), record_full_wait_1(), remote_check_symbols(), remote_file_get(), remote_file_put(), remote_notif_ack(), remote_notif_parse(), remote_query_supported(), reread_symbols(), resolve_subexp(), rs6000_aix_core_xfer_shared_libraries_aix(), rs6000_xfer_shared_libraries(), run_command_1(), save_infcall_suspend_state(), search_minsyms_for_name(), solib_aix_solib_create_inferior_hook(), solib_bfd_fopen(), solib_find_1(), gdb_xml_parser::start_element(), stop_all_threads(), svr4_current_sos_direct(), svr4_handle_solib_event(), svr4_keep_data_in_core(), svr4_parse_libraries(), symbol_file_add_from_memory(), symfile_bfd_open(), syms_from_objfile_1(), target_fileio_read_alloc_1(), target_write_memory_blocks(), thread_db_load_search(), trace_dump_actions(), trace_save_ctf(), trace_save_tfile(), try_open_exec_file(), try_thread_db_load_from_dir(), try_thread_db_load_from_pdir_1(), tsave_command(), unexpected_linespec_error(), until_break_command(), until_next_command(), val_print_string(), VEC(), vlscm_convert_typed_value_from_scheme(), wait_for_inferior(), whatis_exp(), write_name_assoc(), write_var_or_type(), and yyparse().

## ◆ make_cleanup_dtor()

struct cleanup* make_cleanup_dtor | ( | make_cleanup_ftype * | function,
|  | void * | arg,
|  | make_cleanup_dtor_ftype * | dtor
| ) |  |

Definition at line 125 of file cleanups.c.

References cleanup::arg, cleanup_chain, and make_my_cleanup2().

Referenced by make_cleanup_close(), and make_cleanup_restore_current_traceframe().

## ◆ make_final_cleanup()

struct cleanup* make_final_cleanup | ( | make_cleanup_ftype * | function,
|  | void * | arg
| ) |  |

Definition at line 135 of file cleanups.c.

References cleanup::arg, final_cleanup_chain, and make_my_cleanup().

Referenced by do_start_initialization(), gdb_init(), and get_compile_file_tempdir().

## ◆ make_my_cleanup()

static struct cleanup* make_my_cleanup | ( | struct cleanup ** | pmy_chain,
|  | make_cleanup_ftype * | function,
|  | void * | arg
| ) |  |
| static

Definition at line 104 of file cleanups.c.

References cleanup::arg, and make_my_cleanup2().

Referenced by make_cleanup(), and make_final_cleanup().

## ◆ make_my_cleanup2()

static struct cleanup* make_my_cleanup2 | ( | struct cleanup ** | pmy_chain,
|  | make_cleanup_ftype * | function,
|  | void * | arg,
|  | void(*)(void *) | free_arg
| ) |  |
| static

Definition at line 79 of file cleanups.c.

References cleanup::arg, cleanup::free_arg, cleanup::function, gdb_assert, cleanup::next, and XNEW.

Referenced by make_cleanup_dtor(), and make_my_cleanup().

## ◆ null_cleanup()

void null_cleanup | ( | void * | arg | ) |

Definition at line 294 of file cleanups.c.

Referenced by ada_collect_symbol_completion_matches(), add_symbol_file_command(), arm_exidx_new_objfile(), c_type_print_base_struct_union(), call_function_by_hand_dummy(), catch_ada_exception_command_split(), create_breakpoint(), dbx_read_symtab(), elfstab_build_psymtabs(), execute_script_contents(), expand(), fetch_inferior_event(), find_method(), find_overload_match(), find_superclass_methods(), gdbscm_apply_val_pretty_printer(), inf_ptrace_attach(), inf_ptrace_create_inferior(), init_cutu_and_read_dies(), init_tu_and_read_dwo_dies(), iterate_over_mappings(), linux_mntns_access_fs(), load_command(), normal_stop(), ppscm_print_children(), process_structure_scope(), procfs_info_proc(), prompt_for_continue(), read_pe_exported_syms(), read_struct_type(), record_btrace_open(), record_btrace_wait(), record_full_goto_bookmark(), resolve_subexp(), solib_find_1(), symfile_bfd_open(), syms_from_objfile_1(), target_write_memory_blocks(), thread_db_load_search(), until_break_command(), whatis_exp(), and write_var_or_type().

## ◆ restore_cleanups()

void restore_cleanups | ( | struct cleanup * | chain | ) |

Definition at line 273 of file cleanups.c.

References cleanup_chain, and restore_my_cleanups().

Referenced by catcher_pop(), and exception_try_scope_exit().

## ◆ restore_final_cleanups()

void restore_final_cleanups | ( | struct cleanup * | chain | ) |

Definition at line 281 of file cleanups.c.

References final_cleanup_chain, and restore_my_cleanups().

## ◆ restore_my_cleanups()

static void restore_my_cleanups | ( | struct cleanup ** | pmy_chain,
|  | struct cleanup * | chain
| ) |  |
| static

Definition at line 261 of file cleanups.c.

References _, internal_warning(), and SENTINEL_CLEANUP.

Referenced by restore_cleanups(), and restore_final_cleanups().

## ◆ save_cleanups()

struct cleanup* save_cleanups | ( | void |  | ) |

Definition at line 242 of file cleanups.c.

References cleanup_chain, and save_my_cleanups().

Referenced by exception_try_scope_entry(), and exceptions_state_mc_init().

## ◆ save_final_cleanups()

struct cleanup* save_final_cleanups | ( | void |  | ) |

Definition at line 251 of file cleanups.c.

References final_cleanup_chain, and save_my_cleanups().

## ◆ save_my_cleanups()

static struct cleanup* save_my_cleanups | ( | struct cleanup ** | pmy_chain | ) |
| static

Definition at line 231 of file cleanups.c.

References SENTINEL_CLEANUP.

Referenced by save_cleanups(), and save_final_cleanups().

## Variable Documentation

## ◆ cleanup_chain

struct cleanup* cleanup_chain = SENTINEL_CLEANUP
| static

Definition at line 63 of file cleanups.c.

Referenced by discard_cleanups(), do_cleanups(), info_macro_command(), info_macros_command(), macro_define_command(), macro_expand_command(), macro_expand_once_command(), make_cleanup(), make_cleanup_dtor(), print_address_symbolic(), restore_cleanups(), and save_cleanups().

## ◆ final_cleanup_chain

struct cleanup* final_cleanup_chain = SENTINEL_CLEANUP
| static

Definition at line 67 of file cleanups.c.

Referenced by discard_final_cleanups(), do_final_cleanups(), make_final_cleanup(), restore_final_cleanups(), and save_final_cleanups().

## ◆ sentinel_cleanup

const struct cleanup sentinel_cleanup = { 0, 0, 0, 0 }
| static

Definition at line 56 of file cleanups.c.