rpms/openoffice.org/FC-6 openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch, NONE, 1.1 openoffice.org.spec, 1.940, 1.941

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Apr 16 10:07:50 UTC 2007


Author: caolanm

Update of /cvs/dist/rpms/openoffice.org/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv8756

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch 
Log Message:
openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch

openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch:
 osl/unx/signal.c     |    0 
 sal/osl/unx/signal.c |  113 ++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 102 insertions(+), 11 deletions(-)

--- NEW FILE openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch ---
Index: osl/unx/signal.c
===================================================================
RCS file: /cvs/porting/sal/osl/unx/signal.c,v
retrieving revision 1.32.14.1
diff -u -r1.32.14.1 signal.c
--- openoffice.org.orig/sal/osl/unx/signal.c	19 Jan 2007 11:43:41 -0000	1.32.14.1
+++ openoffice.org/sal/osl/unx/signal.c	15 Apr 2007 15:55:35 -0000
@@ -41,6 +41,7 @@
 
 #ifdef LINUX
 #include <execinfo.h>
+#include <link.h>
 #define INCLUDE_BACKTRACE
 #define STACKTYPE "Linux"
 #endif
@@ -385,6 +394,87 @@
 
 #define REPORTENV_PARAM		"-crashreportenv:"
 
+#ifdef LINUX
+
+typedef struct
+{
+    const char *name;
+    Elf32_Off offset;
+} dynamic_entry;
+
+static int
+callback(struct dl_phdr_info *info, size_t size, void *data)
+{
+    const Elf32_Phdr* pDynamic = NULL;
+
+    if (size == sizeof(struct dl_phdr_info))
+    {
+        int i;
+        for (i = 0; i < info->dlpi_phnum; ++i)
+        {
+            if (info->dlpi_phdr[i].p_type == PT_DYNAMIC)
+            {
+                pDynamic = &(info->dlpi_phdr[i]);
+                break;
+            }
+        }
+    }
+
+    if (pDynamic)
+    {
+        char buffer[100];
+        int len;
+        char exe[PATH_MAX];
+        const char *dsoname = info->dlpi_name;
+
+        dynamic_entry* entry = (dynamic_entry*)data;
+
+        if (strcmp(dsoname, "") == 0)
+        { 
+            snprintf(buffer, sizeof(buffer), "/proc/%d/exe", getpid());
+            if ((len = readlink(buffer, exe, PATH_MAX)) != -1)
+            {
+                exe[len] = '\0';
+                dsoname = exe;
+            }
+        }
+
+        if (strcmp(dsoname, entry->name) == 0)
+        {
+            entry->offset = pDynamic->p_offset;
+            return 1;
+        }
+    }
+    return 0;
+}
+
+/* Get the location of the .dynamic section offset for the given elf file.
+ * i.e. same as the "Offset" value shown for DYNAMIC from readelf -l foo 
+ *
+ * We want to know this value so that if the binaries have been modifed
+ * by prelink then we can still process the call stack on server side 
+ * by comparing this value to that of an "un-prelinked but known to be
+ * otherwise equivalent" version of those binaries and adjust the call 
+ * stack addresses by the differences between .dynamic addresses so as 
+ * to be able to map the prelinked addresses back to the unprelinked 
+ * addresses
+ *
+ * cmc at openoffice.org
+ */
+static Elf32_Off
+dynamic_section_offset(const char *name)
+{
+    dynamic_entry entry;
+
+    entry.name = name;
+    entry.offset = 0;
+
+    dl_iterate_phdr(callback, &entry);
+
+    return entry.offset;
+}
+#endif
+
 static int ReportCrash( int Signal )
 {
 #ifdef SAL_ENABLE_CRASH_REPORT
@@ -507,12 +597,12 @@
 					{
 						Dl_info dl_info;
 
-						fprintf( stackout, "0x%x:",
-							(unsigned int)stackframes[iFrame] );
+						fprintf( stackout, "0x%.*lx:", sizeof(char*)*2,
+							(unsigned long)stackframes[iFrame] );
 
-						fprintf( xmlout, "<errormail:StackInfo pos=\"%d\" ip=\"0x%x\"",
+						fprintf( xmlout, "<errormail:StackInfo pos=\"%d\" ip=\"0x%lx\"",
 							iFrame,
-							(unsigned int)stackframes[iFrame]
+							(unsigned long)stackframes[iFrame]
 							);
 
 						memset( &dl_info, 0, sizeof(dl_info) );
@@ -565,17 +655,26 @@
 
 							if ( dl_info.dli_fbase && dl_info.dli_fname )
 							{
-								fprintf( stackout, " %s + 0x%x",
+#ifdef LINUX
+								unsigned long dynamic_offset = dynamic_section_offset(dl_info.dli_fname);
+								fprintf( stackout, " 0x%.*lx:",
+									sizeof(char*) * 2,
+									dynamic_offset);
+#endif
+								fprintf( stackout, " %s + 0x%lx",
 									dl_info.dli_fname,
-									(char*)stackframes[iFrame] - (char*)dl_info.dli_fbase
+									(unsigned long)(stackframes[iFrame] - dl_info.dli_fbase)
 									);
 
-								fprintf( xmlout, " rel=\"0x%x\"", (char *)stackframes[iFrame] - (char *)dl_info.dli_fbase );
+								fprintf( xmlout, " rel=\"0x%lx\"", (unsigned long)(stackframes[iFrame] - dl_info.dli_fbase) );
 								if ( dli_fname )
 									fprintf( xmlout, " name=\"%s\"", dli_fname );
 
 								if ( dli_fdir )
 									fprintf( xmlout, " path=\"%s\"", dli_fdir );
+#ifdef LINUX
+								fprintf( xmlout, " dynamicoffset=\"0x%lx\"", dynamic_offset );
+#endif
 							}
 							else
 								fprintf( stackout, " ????????" );
@@ -584,13 +683,13 @@
 							{
 								fputs( " (", stackout );
 								fputs_xml( dl_info.dli_sname, stackout );
-								fprintf( stackout, " + 0x%x)", 
-									(char*)stackframes[iFrame] - (char*)dl_info.dli_saddr );
+								fprintf( stackout, " + 0x%lx)", 
+									(unsigned long)(stackframes[iFrame] - dl_info.dli_saddr) );
 
 								fputs( " ordinal=\"", xmlout );
 								fputs_xml( dl_info.dli_sname, xmlout );
-								fprintf( xmlout, "+0x%x\"", 
-									(char *)stackframes[iFrame] - (char *)dl_info.dli_saddr );
+								fprintf( xmlout, "+0x%lx\"", 
+									(unsigned long)(stackframes[iFrame] - dl_info.dli_saddr) );
 							}
 
 						}


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/dist/rpms/openoffice.org/FC-6/openoffice.org.spec,v
retrieving revision 1.940
retrieving revision 1.941
diff -u -r1.940 -r1.941
--- openoffice.org.spec	13 Apr 2007 12:04:40 -0000	1.940
+++ openoffice.org.spec	16 Apr 2007 10:07:48 -0000	1.941
@@ -1,6 +1,6 @@
 %define oootag OOD680
 %define ooomilestone 5
-%define rh_rpm_release 5.20
+%define rh_rpm_release 5.21
 
 # gcc#19664#
 %define stlvisibilityfcked 1
@@ -163,6 +163,7 @@
 Patch95: workspace.sixtyfour11.patch
 Patch96: openoffice.org-2.2.0.ooo75167.framework.workspacerestore.patch
 Patch97: openoffice.org-cairoupdate.patch
+Patch98: openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch
 
 %define instdir %{_libdir}/openoffice.org2.0
 
@@ -1060,6 +1061,7 @@
 %patch95 -p1 -b .workspace.sixtyfour11.patch
 %patch96 -p1 -b .ooo75167.framework.workspacerestore.patch
 %patch97 -p1 -b .openoffice.org-cairoupdate.patch
+%patch98 -p1 -b .ooo76393.sal.dynamicsection.patch
 
 tar xzf %{SOURCE1}
 
@@ -2589,6 +2591,10 @@
 %{instdir}/share/registry/modules/org/openoffice/Office/Scripting/Scripting-python.xcu
 
 %changelog
+* Mon Apr 16 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.0.4-5.5.21
+- add openoffice.org-2.2.0.ooo76393.sal.dynamicsection.patch for better
+  offline debugging support
+
 * Fri Apr 13 2007 Caolan McNamara <caolanm at redhat.com> - 1:2.0.4-5.5.20
 - Resolves: rhbz#235834 update subpixel logic
 




More information about the fedora-cvs-commits mailing list