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]

Re: Line number handling in RTL reorganization


> 	This patch breaks debugging on AIX -- no line number debugging
> information is generated.  A lot of other debugging information is
> missing, but other macros use the line number to determine if GCC
> currently is within a function, so the broken line numbers may be causing
> the other problems.
> 
> 	One major problem is:
> 
>         (final_start_function): Set initial source file and line.

Hi, the attached patch should fix it, but I don't have time to test it
right now.  It would be cool if you can tell me whether it works well for AIX :)

Sun Jul 13 17:31:40 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* cfglayout.c (locator_file): Break out from ....
	(insn_file): ... here.
	(locator_line): Break out from ....
	(insn_line): ... here.
	* rtl.h (locator_file, locator_line): Declare.
	(final_start_function): Set proper line/file info.
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.44
diff -c -3 -p -r1.44 cfglayout.c
*** cfglayout.c	7 Jul 2003 00:05:10 -0000	1.44
--- cfglayout.c	13 Jul 2003 13:32:06 -0000
*************** insn_scope (rtx insn)
*** 435,447 ****
     return VARRAY_TREE (block_locators_blocks, min);
  }
  
! /* Return line number of the statement that produced this insn.  */
  int
! insn_line (rtx insn)
  {
    int max = VARRAY_ACTIVE_SIZE (line_locators_locs);
    int min = 0;
-   int loc = INSN_LOCATOR (insn);
  
    if (!max || !loc)
      return 0;
--- 435,446 ----
     return VARRAY_TREE (block_locators_blocks, min);
  }
  
! /* Return line number of the statement specified by the locator.  */
  int
! locator_line (int loc)
  {
    int max = VARRAY_ACTIVE_SIZE (line_locators_locs);
    int min = 0;
  
    if (!max || !loc)
      return 0;
*************** insn_line (rtx insn)
*** 463,475 ****
     return VARRAY_INT (line_locators_lines, min);
  }
  
! /* Return source file of the statement that produced this insn.  */
  const char *
! insn_file (rtx insn)
  {
    int max = VARRAY_ACTIVE_SIZE (file_locators_locs);
    int min = 0;
-   int loc = INSN_LOCATOR (insn);
  
    if (!max || !loc)
      return NULL;
--- 462,480 ----
     return VARRAY_INT (line_locators_lines, min);
  }
  
! /* Return line number of the statement that produced this insn.  */
! int
! insn_line (rtx insn)
! {
!   return locator_line (INSN_LOCATOR (insn));
! }
! 
! /* Return source file of the statement specified by LOC.  */
  const char *
! locator_file (int loc)
  {
    int max = VARRAY_ACTIVE_SIZE (file_locators_locs);
    int min = 0;
  
    if (!max || !loc)
      return NULL;
*************** insn_file (rtx insn)
*** 489,494 ****
--- 494,506 ----
  	}
      }
     return VARRAY_CHAR_PTR (file_locators_files, min);
+ }
+ 
+ /* Return source file of the statement that produced this insn.  */
+ const char *
+ insn_file (rtx insn)
+ {
+   return locator_file (INSN_LOCATOR (insn));
  }
  
  /* Rebuild all the NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes based
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.285
diff -c -3 -p -r1.285 final.c
*** final.c	1 Jul 2003 05:00:15 -0000	1.285
--- final.c	13 Jul 2003 13:32:11 -0000
*************** final_start_function (rtx first ATTRIBUT
*** 1349,1356 ****
      }
  #endif
  
!   last_linenum = 0;
!   last_filename = 0;
    high_block_linenum = high_function_linenum = last_linenum;
  
    (*debug_hooks->begin_prologue) (last_linenum, last_filename);
--- 1349,1357 ----
      }
  #endif
  
!   last_filename = locator_file (prologue_locator);
!   last_linenum = locator_line (prologue_locator);
! 
    high_block_linenum = high_function_linenum = last_linenum;
  
    (*debug_hooks->begin_prologue) (last_linenum, last_filename);
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.429
diff -c -3 -p -r1.429 rtl.h
*** rtl.h	11 Jul 2003 14:09:29 -0000	1.429
--- rtl.h	13 Jul 2003 13:32:15 -0000
*************** extern rtx prev_cc0_setter (rtx);
*** 1544,1549 ****
--- 1544,1551 ----
  extern tree choose_inner_scope (tree, tree);
  extern int insn_line (rtx);
  extern const char * insn_file (rtx);
+ extern int locator_line (int);
+ extern const char * locator_file (int);
  extern int prologue_locator, epilogue_locator;
  
  /* In jump.c */


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