From 77831620cf45a82c54a85091dcdc9e0affea47a9 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Thu, 8 Oct 2009 21:00:04 +0000 Subject: Add support for debugging with ICF (Identical Code Folding). gcc/ChangeLog: Add support for debugging with ICF (Identical Code Folding). * calls.c (debug.h): New #include. (emit_call_1): Call virtual_call_token debug hook. * common.opt (-fenable-icf-debug): New option. * dwarf2out.c (dwarf2_debug_hooks): Add entries for new hooks (two locations in the source). (poc_label_num): New variable. (dcall_entry, vcall_entry): New typedefs. (dcall_table, vcall_table): New variables. (struct vcall_insn): New type. (vcall_insn_table): New variable. (DEBUG_DCALL_SECTION, DEBUG_VCALL_SECTION): New macros. (size_of_dcall_table): New function. (output_dcall_table): New function. (size_of_vcall_table): New function. (output_vcall_table): New function. (dwarf2out_direct_call): New function. (vcall_insn_table_hash): New function. (vcall_insn_table_eq): New function. (dwarf2out_virtual_call_token): New function. (dwarf2out_virtual_call): New function. (dwarf2out_init): Allocate new tables and sections. (prune_unused_types): Mark DIEs referenced from direct call table. (dwarf2out_finish): Output direct and virtual call tables. * final.c (final_scan_insn): Call direct_call and virtual_call debug hooks. * debug.h (struct gcc_debug_hooks): Add direct_call, virtual_call_token, virtual_call hooks. (debug_nothing_uid): New function. * debug.c (do_nothing_debug_hooks): Add dummy entries for new hooks. (debug_nothing_uid): New function. * dbxout.c (dbx_debug_hooks): Add dummy entries for new hooks. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * doc/invoke.texi (-fenable-icf-debug): New option. gcc/testsuite/ChangeLog: Add support for debugging with ICF (Identical Code Folding). * g++.dg/debug/dwarf2/icf.C: New test. From-SVN: r152577 --- gcc/debug.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gcc/debug.h') diff --git a/gcc/debug.h b/gcc/debug.h index de525fe..4009cd6 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -126,6 +126,25 @@ struct gcc_debug_hooks text sections. */ void (* switch_text_section) (void); + /* Records a direct call to the function DECL, noting the point of call + and the debug info for the function. Called from final_scan_insn + when ICF debugging is enabled. */ + void (* direct_call) (tree decl); + + /* Records the OBJ_TYPE_REF_TOKEN for a virtual call through ADDR, which + for C++ is the vtable slot index, noting the INSN_UID for the call + instruction. Called from calls.c:emit_call_1 when ICF debugging is + enabled. It's necessary to do this during lowering because the + call instruction and the OBJ_TYPE_REF become separated after that + point. */ + void (* virtual_call_token) (tree addr, int insn_uid); + + /* Records a virtual call given INSN_UID, which is the UID of the call + instruction. The UID is then mapped to the vtable slot index noted + during the lowering phase. Called from final_scan_insn when ICF + debugging is enabled. */ + void (* virtual_call) (int insn_uid); + /* Called from grokdeclarator. Replaces the anonymous name with the type name. */ void (* set_name) (tree, tree); @@ -151,6 +170,7 @@ extern void debug_nothing_tree_int (tree, int); extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool); extern bool debug_true_const_tree (const_tree); extern void debug_nothing_rtx (rtx); +extern void debug_nothing_uid (int); /* Hooks for various debug formats. */ extern const struct gcc_debug_hooks do_nothing_debug_hooks; -- cgit v1.1