[patch] gprof -C seg fault

Nick Clifton nickc@redhat.com
Tue Mar 15 16:20:00 GMT 2005


Hi Guys,

  Whilst looking at PR 747 I discovered that gprof's -C switch was
  causing a seg fault.  It appears to be a simple case of a missing
  line of code - a sorted table was being created but the code to walk
  through the table was not initialising the pointer.

  The attached patch fixes this problem and I am going to check it
  into both the mainline and the 2.16 branch.

Cheers
  Nick

gprof/ChangeLog
2005-03-15  Nick Clifton  <nickc@redhat.com>

	* basic_blocks.c (print_exec_counts): Step through sorted array of
	basic blocks.

Index: gprof/basic_blocks.c
===================================================================
RCS file: /cvs/src/src/gprof/basic_blocks.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 basic_blocks.c
*** gprof/basic_blocks.c	3 Mar 2005 12:05:12 -0000	1.13
--- gprof/basic_blocks.c	15 Mar 2005 16:16:18 -0000
*************** print_exec_counts ()
*** 281,286 ****
--- 281,288 ----
  
    for (i = 0; i < len; ++i)
      {
+       sym = sorted_bbs [i];
+       
        if (sym->ncalls > 0 || ! ignore_zeros)
  	{
  	  /* FIXME: This only works if bfd_vma is unsigned long.  */
  



More information about the Binutils mailing list