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]

powerpc64 gprof


Removing dot-symbols rendered gprof ineffective.  This regenerates
code section dot-syms, allowing gprof to return sensible function info.

	* corefile.c (core_init): Call bfd_get_synthetic_symtab.

Applying mainline and 2.16.

Index: gprof/corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.20
diff -u -p -r1.20 corefile.c
--- gprof/corefile.c	3 Mar 2005 12:05:12 -0000	1.20
+++ gprof/corefile.c	14 Apr 2005 09:23:09 -0000
@@ -142,6 +142,9 @@ void
 core_init (const char *aout_name)
 {
   int core_sym_bytes;
+  asymbol *synthsyms;
+  long synth_count;
+
   core_bfd = bfd_openr (aout_name, 0);
 
   if (!core_bfd)
@@ -190,6 +193,23 @@ core_init (const char *aout_name)
       done (1);
     }
 
+  synth_count = bfd_get_synthetic_symtab (core_bfd, core_num_syms, core_syms,
+					  0, NULL, &synthsyms);
+  if (synth_count > 0)
+    {
+      asymbol **symp;
+      long new_size;
+      long i;
+
+      new_size = (core_num_syms + synth_count + 1) * sizeof (*core_syms);
+      core_syms = xrealloc (core_syms, new_size);
+      symp = core_syms + core_num_syms;
+      core_num_syms += synth_count;
+      for (i = 0; i < synth_count; i++)
+	*symp++ = synthsyms + i;
+      *symp = 0;
+    }
+
   min_insn_size = 1;
   offset_to_code = 0;
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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