This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make debug output for versioned functions available


Hi,
when versioning, we never output abstract copy of function resulting in
debug info pointing to undefined abstract origin dies, so nothing in
versioned function is accessible from gdb.

Bootstrapped/regtested x86_64-linux, I intend to commit this as obvoius
shortly.

	* gcc.dg/debug/dwarf2/ipa-cp1.c: New test.
	* tree-inline.c (tree_function_versioning): Output abstract
	function.

Index: testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c
===================================================================
*** testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c	(revision 0)
--- testsuite/gcc.dg/debug/dwarf2/ipa-cp1.c	(revision 0)
***************
*** 0 ****
--- 1,30 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -gdwarf-2 -dA" } */
+ void q(int p);
+ static void
+ t(int constant_propagated_par)
+ {
+   int local_var = constant_propagated_par + 1;
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+   q(local_var);
+ }
+ main()
+ {
+   t(5);
+   t(5);
+   t(5);
+   t(5);
+   t(5);
+   t(5);
+   t(5);
+ }
+ /* { dg-final { scan-assembler "local_var" } } */
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 144497)
--- tree-inline.c	(working copy)
*************** tree_function_versioning (tree old_decl,
*** 4225,4230 ****
--- 4226,4237 ----
    old_version_node = cgraph_node (old_decl);
    new_version_node = cgraph_node (new_decl);
  
+   /* Output the inlining info for this abstract function, since it has been
+      inlined.  If we don't do this now, we can lose the information about the
+      variables in the function when the blocks get blown away as soon as we
+      remove the cgraph node.  */
+   (*debug_hooks->outlining_inline_function) (old_decl);
+ 
    DECL_ARTIFICIAL (new_decl) = 1;
    DECL_ABSTRACT_ORIGIN (new_decl) = DECL_ORIGIN (old_decl);
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]