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]

Re: begin_function debug hook.


Richard Henderson wrote:-

> I think the hook you're currently calling begin_function isn't.
> 
> There should be three hooks: 
> 
> 	begin_function		Called before the function is declared,
> 				e.g. dbxout_begin_function and
> 				sdbout_mark_begin_function.
> 
> 	begin_prologue		Called after the function directives have
> 				been emitted, but before any code has been
> 				generated.  This is the one you converted
> 				today, for those that have
> 				begin_function_before_prologue set.
> 
> 	end_prologue		Called after prologue instructions are
> 				emitted.  This is those for which you have
> 				begin_function_before_prologue clear.

Great, this is the separation I was looking for, and not understanding
the code enough I couldn't provide myself.  Thanks.  I'll post a
re-work.

Should I put the current source_line() output into the do_nothing
function (see below)?

> >    dwarf2out_end_epilogue,
> > +  debug_nothing_int, 0,		/* begin_function */
> 
> To avoid confusion I think you should treat this the same way as
> you did dwarf2out_end_epilogue -- call the debug hook first and
> then if we're doing dwarf2 eh, but not dwarf2 debug, then call
> dwarf2out_begin_prologue explicitly.

OK; I was just wary of ordering.  I take it that we can assume dwarf2
eh stuff is ordering agnostic w.r.t. nearby non-dwarf2 debug output?

The existing code does

   dwarf2_or_dwarf2eh_begin_prologue();

   if (sdb or xcoff)
      sdb_or_xcoff_begin_prologue();
   else
     source_line();

If I change this to:

   // Non-trivial for sdb, xcoff, dwarf2
   (*debug_hooks->begin_prologue)();

   if (!dwarf2 && dwarf2_eh)
	dwarf2out_begin_prologue();

then do I put the source_line () calls for non-sdb non-xcoff
non-dwarf2 debug info in the do_nothing begin_prologue() hook?  This
seems most logical, but doing that means the semantics for standard
dwarf2 have changed between the 2 versions - source_line() is no
longer called.

This is what I meant in the original mail wondering whether the
existing call to source_line() for dwarf2 is intended.

Neil.


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