rpms/oprofile/F-13 oprofile-sect.patch, NONE, 1.1 oprofile.spec, 1.86, 1.87

William Eden Cohen wcohen at fedoraproject.org
Wed Apr 21 19:12:31 UTC 2010


Author: wcohen

Update of /cvs/pkgs/rpms/oprofile/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv19006

Modified Files:
	oprofile.spec 
Added Files:
	oprofile-sect.patch 
Log Message:
Handle the separate debuginfo rhbz554639


oprofile-sect.patch:
 bfd_support.cpp |   54 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 8 deletions(-)

--- NEW FILE oprofile-sect.patch ---
diff -paur oprofile/ChangeLog op-debuginfo-fix/ChangeLog
--- oprofile/libutil++/bfd_support.cpp	2009-10-26 08:01:08.000000000 -0500
+++ op-debuginfo-fix/libutil++/bfd_support.cpp	2010-04-13 16:15:58.000000000 -0500
@@ -20,7 +20,7 @@
 
 #include <cstdlib>
 #include <cstring>
-
+#include <cassert>
 #include <iostream>
 #include <fstream>
 #include <sstream>
@@ -432,13 +432,28 @@ void bfd_info::close()
 		bfd_close(abfd);
 }
 
+/**
+ * This function is only called when processing symbols retrieved from a
+ * debuginfo file that is separate from the actual runtime binary image.
+ * Separate debuginfo files may be needed in two different cases:
+ *   1) the real image is completely stripped, where there is no symbol
+	information at all
+ *   2) the real image has debuginfo stripped, and the user is requesting "-g"
+ *   (src file/line num info)
+ * After all symbols are gathered up, there will be some filtering/removal of
+ * unnecessary symbols.  In particular, the bfd_info::interesting_symbol()
+ * function filters out symbols whose section's flag value does not include
+ * SEC_LOAD.  This filtering is required, so it must be retained.  However,
+ * we run into a problem with symbols from debuginfo files, since the
+ * section flag does NOT include SEC_LOAD.  To solve this problem, the
+ * translate_debuginfo_syms function maps the debuginfo symbol's sections to
+ * that of their corresponding real image.
+*/
 void bfd_info::translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms)
 {
-	bfd_section ** image_sect;
 	unsigned int img_sect_cnt = 0;
 	bfd * image_bfd = image_bfd_info->abfd;
-
-	image_sect = (bfd_section **) malloc(image_bfd->section_count * (sizeof(bfd_section *)));
+	multimap<string, bfd_section *> image_sections;
 
 	for (bfd_section * sect = image_bfd->sections;
 	     sect && img_sect_cnt < image_bfd->section_count;
@@ -446,20 +461,43 @@ void bfd_info::translate_debuginfo_syms(
 		// A comment section marks the end of the needed sections
 		if (strstr(sect->name, ".comment") == sect->name)
 			break;
-		image_sect[sect->index] = sect;
+		image_sections.insert(pair<string, bfd_section *>(sect->name, sect));
 		img_sect_cnt++;
 	}
 
 	asymbol * sym = dbg_syms[0];
+	string prev_sect_name = "";
+	bfd_section * matched_section = NULL;
 	for (int i = 0; i < nr_dbg_syms; sym = dbg_syms[++i]) {
+		bool section_switch;
+
+		if (strcmp(prev_sect_name.c_str(), sym->section->name)) {
+			section_switch = true;
+			prev_sect_name = sym->section->name;
+		} else {
+			section_switch = false;
+		}
 		if (sym->section->owner && sym->section->owner == abfd) {
-			if ((unsigned int)sym->section->index < img_sect_cnt) {
-				sym->section = image_sect[sym->section->index];
+			if (section_switch ) {
+				matched_section = NULL;
+				multimap<string, bfd_section *>::iterator it;
+				pair<multimap<string, bfd_section *>::iterator,
+				     multimap<string, bfd_section *>::iterator> range;
+
+				range = image_sections.equal_range(sym->section->name);
+				for (it = range.first; it != range.second; it++) {
+					if ((*it).second->vma == sym->section->vma) {
+						matched_section = (*it).second;
+						break;
+					}
+				}
+			}
+			if (matched_section) {
+				sym->section = matched_section;
 				sym->the_bfd = image_bfd;
 			}
 		}
 	}
-	free(image_sect);
 }
 
 #if SYNTHESIZE_SYMBOLS


Index: oprofile.spec
===================================================================
RCS file: /cvs/pkgs/rpms/oprofile/F-13/oprofile.spec,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -p -r1.86 -r1.87
--- oprofile.spec	11 Dec 2009 16:40:58 -0000	1.86
+++ oprofile.spec	21 Apr 2010 19:12:30 -0000	1.87
@@ -1,7 +1,7 @@
 Summary: System wide profiler
 Name: oprofile
 Version: 0.9.6
-Release: 2%{?dist}
+Release: 5%{?dist}
 License: GPLv2
 Group: Development/System
 #
@@ -14,6 +14,7 @@ Patch63: oprofile-0.7-libs.patch
 Patch83: oprofile-0.9.3-xen.patch
 #Patch104: oprofile-jvmpi-lgpl.patch
 #Patch105: oprofile-0.9.5-timer.patch
+Patch106: oprofile-sect.patch
 
 URL: http://oprofile.sf.net
 
@@ -80,6 +81,7 @@ agent library.
 %setup -q -n %{name}-%{version}
 %patch10 -p1 -b .guess2
 %patch63 -p1 -b .libs
+%patch106 -p1 -b .sect
 
 ./autogen.sh
 
@@ -227,6 +229,9 @@ exit 0
 /etc/ld.so.conf.d/*
 
 %changelog
+* Wed Apr 14 2010 Will Cohen <wcohen at redhat.com> - 0.9.6-5
+- Handle debuginfo section differences. rhbz554639
+
 * Fri Dec 11 2009 Will Cohen <wcohen at redhat.com> - 0.9.6-2
 - Clean up oprofile.spec file.
 



More information about the scm-commits mailing list