This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

RFA: gprof-related patches


Hi -

The following patches relate to gprof, and intend to correct a
pair of minor problems.  First, gprof's histogram output table
sometimes messes up its choice of SI scaling factor/prefix, due
to convoluted logic.  This resulted in numeric fields overflowing
their intended formatting columns.  Second, bfd's routines for
assigning default nm-type chars to symbols include an ad-hoc set
of sections.  The patch extends it to include '.init' and '.fini',
and treat them like .text-like sections.  This patch allows gprof
to treat ELF init/fini processing routines as profilable program
fragments.

May I commit?


Index: bfd/ChangeLog
2002-02-18  Frank Ch. Eigler  <fche@redhat.com>

	* syms.c (stt[]): Add .init/.fini -> "t" mapping.

Index: bfd/syms.c
===================================================================
*** syms.c	2002/01/24 00:13:04	1.92.2.2
--- syms.c	2002/02/18 17:50:49
*************** static const struct section_to_type stt[
*** 538,543 ****
--- 538,545 ----
    {".sdata", 'g'},		/* Small initialized data.  */
    {".text", 't'},
    {"code", 't'},		/* MRI .text */
+   {".init", 't'},		/* ELF init/fini sections */
+   {".fini", 't'},
    {".drectve", 'i'},            /* MSVC's .drective section */
    {".idata", 'i'},              /* MSVC's .idata (import) section */
    {".edata", 'e'},              /* MSVC's .edata (export) section */


Index: gprof/ChangeLog
2002-02-18  Frank Ch. Eigler  <fche@redhat.com>

	* hist.c (hist_print): Rewrite log_scale calculation loop.

Index: gprof/hist.c
===================================================================
*** hist.c	2001/03/15 04:23:36	1.14
--- hist.c	2002/02/18 17:50:50
*************** DEFUN_VOID (hist_print)
*** 513,525 ****
  
        if (top_dog && top_dog->ncalls != 0 && top_time > 0.0)
  	{
  	  top_time /= hz;
  
! 	  while (SItab[log_scale].scale * top_time < 1000.0
! 		 && ((size_t) log_scale
! 		     < sizeof (SItab) / sizeof (SItab[0]) - 1))
  	    {
! 	      ++log_scale;
  	    }
  	}
      }
--- 513,530 ----
  
        if (top_dog && top_dog->ncalls != 0 && top_time > 0.0)
  	{
+ 	  int min_log_scale = 0;
+ 	  int max_log_scale = sizeof (SItab) / sizeof (SItab[0]) - 1;
+ 
  	  top_time /= hz;
  
! 	  for (log_scale = min_log_scale; 
! 	       log_scale < max_log_scale;
! 	       log_scale ++)
  	    {
! 	      float scaled_value = SItab[log_scale].scale * top_time;
! 	      if (scaled_value >= 1.0 && scaled_value < 1000.0) 
! 		break;
  	    }
  	}
      }



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