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: 3 debug hooks for begin_function


On Mon, Jul 16, 2001 at 09:12:10PM +0100, Neil Booth wrote:
> Right, but my point is that the write_symbols==NO_DEBUG variety
> currently outputs a line number, too.

Which is stupid, except for...

> Also, output_source_line() is local to final.c, and takes an rtx that
> is not passed to the hook, so calling it from the hook functions is not
> particularly nice.

Ah.  I hadn't looked at this function before.  Gross.

The good news is that this is mostly related to the -a option,
which I want very much to remove.  Humourously, the confusion
here also results in -a being broken for SDB and XCOFF, since
we weren't calling output_source_line, which does more than
just output a source line.

So, what I think you ought to do is:

 (1) Rename output_source_line to notice_source_line, and delete
     the call to debug_hooks->source_line.

 (2) Change the only other caller of output_source_line to invoke
     both notice_source_line and debug_hooks->source_line.

 (3) Change debug_hooks->source_line to take the line number directly
     instead of via a note.  Notice _all_ versions just immediately
     grab the line number from the note and otherwise ignore it.

 (4) Change the begin_prologue hook to take the filename as well
     as line number.  Have begin_prologue call debug_hooks->source_line
     (or the direct equivalent) itself if desired.

     Note that this gives begin_prologue the same interface as
     source_line, so you don't need a do_nothing function.  Put,
     for example, dbxout_source_line in the begin_prologue slot.

 (5) This leaves the beginning of final_start_function looking like

  /* Initial line number is supposed to be output before the function's
     prologue and label so that the function's address will not appear
     to be in the last statement of the preceding function.  The actual
     line number debug output is done in debug_hooks->begin_prologue.  */
  if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
    notice_source_line (first);
  high_block_linenum = high_function_linenum = last_linenum;

  (*debug_hooks->begin_prologue) (last_filename, last_linenum);

#if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO)
  if (write_symbols != DWARF2_DEBUG && dwarf2out_do_frame ())
    dwarf2out_begin_prologue (NULL, 0);
#endif



r~


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