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]

[debuglocus] Reserve uppermost source location bit


Fer petes sake...

I somehow missed checking this in earlier. This reserves the uppermost bit in a source locus for the debuglocus flag. It also modifies the code a little to start abandoning column support earlier if we begin running out of source locus's. that change may not be neccessary, but I'll add in in for now.

bootstrapped and no new regressions on x86_64-unknown-linux-gnu. And now the branch will compile. Doh.

Andrew



2009-03-23  Andrew MacLeod  <amacleod@redhat.com>

	* include/line-map.h (DEBUGLOCUS_BIT): Declare.
	* line-map.c (linemap_line_start, linemap_position_for_column): Cut off
	column support earlier.


Index: include/line-map.h
===================================================================
*** include/line-map.h	(revision 145011)
--- include/line-map.h	(working copy)
*************** typedef unsigned int linenum_type;
*** 42,47 ****
--- 42,51 ----
     and effectively typedef source_location location_t.  */
  typedef unsigned int source_location;
  
+ /* The top bit is hijacked to indicate that its a debug location rather than
+    a source location.  */
+ #define DEBUGLOCUS_BIT	0x80000000
+ 
  /* Memory allocation function typedef.  Works like xrealloc.  */
  typedef void *(*line_map_realloc) (void *, size_t);
  
Index: line-map.c
===================================================================
*** line-map.c	(revision 145011)
--- line-map.c	(working copy)
*************** Foundation, 51 Franklin Street, Fifth Fl
*** 24,29 ****
--- 24,30 ----
  #include "system.h"
  #include "line-map.h"
  
+ #define COLUMN_CUTOFF	0xB0000000
  static void trace_include (const struct line_maps *, const struct line_map *);
  
  /* Initialize a line map set.  */
*************** linemap_line_start (struct line_maps *se
*** 203,214 ****
    if (add_map)
      {
        int column_bits;
!       if (max_column_hint > 100000 || highest > 0xC0000000)
  	{
  	  /* If the column number is ridiculous or we've allocated a huge
  	     number of source_locations, give up on column numbers. */
  	  max_column_hint = 0;
! 	  if (highest >0xF0000000)
  	    return 0;
  	  column_bits = 0;
  	}
--- 204,216 ----
    if (add_map)
      {
        int column_bits;
!       if (max_column_hint > 100000 || highest > COLUMN_CUTOFF)
  	{
  	  /* If the column number is ridiculous or we've allocated a huge
  	     number of source_locations, give up on column numbers. */
  	  max_column_hint = 0;
! 	  /* Arbitrary value to try to prevent overflows.  */
! 	  if (highest >= DEBUGLOCUS_BIT - 0xFFFF)
  	    return 0;
  	  column_bits = 0;
  	}
*************** linemap_position_for_column (struct line
*** 245,251 ****
    source_location r = set->highest_line;
    if (to_column >= set->max_column_hint)
      {
!       if (r >= 0xC000000 || to_column > 100000)
  	{
  	  /* Running low on source_locations - disable column numbers.  */
  	  return r;
--- 247,253 ----
    source_location r = set->highest_line;
    if (to_column >= set->max_column_hint)
      {
!       if (r >= COLUMN_CUTOFF || to_column > 100000)
  	{
  	  /* Running low on source_locations - disable column numbers.  */
  	  return r;


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