This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


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

PATCH to buildsym.c



As discussed over the past few days, GDB misorders
line-table entries when it sees something like:

  <line 9>
  <line 5>
  <code>

The appropriate line-number to show when stopped at code is 5, not 9.

Here's the patch discussed.  May I check this in?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-12-01  Mark Mitchell  <mark@codesourcery.com>

	* buildsym.c (compare_line_numbers): Make sorting the line-number
	table stable.

Index: buildsym.c
===================================================================
RCS file: /cvs/gdb/gdb/gdb/buildsym.c,v
retrieving revision 1.1.1.3
diff -c -p -r1.1.1.3 buildsym.c
*** buildsym.c	1999/08/02 23:45:13	1.1.1.3
--- buildsym.c	1999/12/01 17:48:04
*************** compare_line_numbers (const void *ln1p, 
*** 733,741 ****
    if (ln1->pc > ln2->pc)
      return 1;
  
!   /* If pc equal, sort by line.  I'm not sure whether this is optimum
!      behavior (see comment at struct linetable in symtab.h).  */
!   return ln1->line - ln2->line;
  }
  
  /* Start a new symtab for a new source file.  Called, for example,
--- 733,740 ----
    if (ln1->pc > ln2->pc)
      return 1;
  
!   /* Make the sort stable.  */
!   return ln1 - ln2;
  }
  
  /* Start a new symtab for a new source file.  Called, for example,


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