SF.net SVN: gar:[22417] csw/mgar/pkg/avidemux/trunk
pfelecan at users.sourceforge.net
pfelecan at users.sourceforge.net
Wed Nov 6 12:38:12 CET 2013
Revision: 22417
http://gar.svn.sourceforge.net/gar/?rev=22417&view=rev
Author: pfelecan
Date: 2013-11-06 11:38:12 +0000 (Wed, 06 Nov 2013)
Log Message:
-----------
avidemux/trunk: instead of NOPing the crash dump feature, implement
one for Solaris
Modified Paths:
--------------
csw/mgar/pkg/avidemux/trunk/Makefile
Added Paths:
-----------
csw/mgar/pkg/avidemux/trunk/files/0005-implement-solaris-crashdump.patch
Removed Paths:
-------------
csw/mgar/pkg/avidemux/trunk/files/0005-make-crashdump-NOP.patch
Modified: csw/mgar/pkg/avidemux/trunk/Makefile
===================================================================
--- csw/mgar/pkg/avidemux/trunk/Makefile 2013-11-06 11:14:40 UTC (rev 22416)
+++ csw/mgar/pkg/avidemux/trunk/Makefile 2013-11-06 11:38:12 UTC (rev 22417)
@@ -21,7 +21,7 @@
PATCHFILES += 0002-cmake-verbosity-management.patch
PATCHFILES += 0003-use-not-as-needed-linker-option.patch
PATCHFILES += 0004-fix-processors-cardinality-gathering.patch
-PATCHFILES += 0005-make-crashdump-NOP.patch
+PATCHFILES += 0005-implement-solaris-crashdump.patch
PATCHFILES += 0006-abs-desabiguation.patch
PATCHFILES += 0007-abs-desabiguation-2.patch
PATCHFILES += 0008-fix-text-relocation-remains-referenced.patch
Added: csw/mgar/pkg/avidemux/trunk/files/0005-implement-solaris-crashdump.patch
===================================================================
--- csw/mgar/pkg/avidemux/trunk/files/0005-implement-solaris-crashdump.patch (rev 0)
+++ csw/mgar/pkg/avidemux/trunk/files/0005-implement-solaris-crashdump.patch 2013-11-06 11:38:12 UTC (rev 22417)
@@ -0,0 +1,192 @@
+From 3020afed1938e54ea5d142760e7946cd93bb4ad0 Mon Sep 17 00:00:00 2001
+From: Peter Felecan <pfelecan at opencsw.org>
+Date: Wed, 6 Nov 2013 11:55:37 +0100
+Subject: [PATCH] implement solaris crashdump
+
+---
+ avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp | 118 ++++++++++++++++++++--
+ 1 file changed, 111 insertions(+), 7 deletions(-)
+
+diff --git a/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp b/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
+index 891325f..2ae15d9 100644
+--- a/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
++++ b/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
+@@ -21,7 +21,18 @@
+ #include <unistd.h>
+ #include <cxxabi.h>
+ #include <signal.h>
++#if defined(__sun__)
++#include <dlfcn.h>
++#include <strings.h>
++#include <ucontext.h>
++#include <sys/stack.h>
++#ifdef _LP64
++#define _ELF64
++#endif
++#include <sys/machelf.h>
++#else
+ #include <execinfo.h>
++#endif
+
+ #include "ADM_default.h"
+
+@@ -54,15 +65,102 @@ void installSigHandler()
+ void sig_segfault_handler(int signo)
+ {
+ static int running=0;
+- if(running)
++ if(running)
+ {
+ signo=0;
+ exit(1);
+ }
+- running=0;
++ running=0;
+ ADM_backTrack("Segfault",0,"??");
+ }
+
++#if defined(__sun__)
++static const int maxSize = 2048;
++
++static void addr2sym(void* pc, char* buffer, int size)
++{
++ Dl_info info;
++ Sym* sym = (Sym*)0;
++ static size_t dsize = maxSize - 1;
++ static char demangled[maxSize];
++ int dstatus = 0;
++
++ if (dladdr1(pc, &info, (void**)&sym, RTLD_DL_SYMENT) == 0)
++ {
++ snprintf(buffer, size, "[0x%p]", pc);
++ }
++
++ if ((info.dli_fname != NULL && info.dli_sname != NULL) &&
++ (((uintptr_t)pc - (uintptr_t)info.dli_saddr) < sym->st_size))
++ {
++ __cxxabiv1::__cxa_demangle(info.dli_sname,demangled,&dsize,&dstatus);
++ snprintf(buffer, size, "%s'%s+0x%x [0x%p]",
++ info.dli_fname,
++ demangled,
++ (unsigned long)pc - (unsigned long)info.dli_saddr,
++ pc);
++ }
++ else
++ {
++ snprintf(buffer, size, "%s'0x%p [0x%p]",
++ info.dli_fname,
++ (unsigned long)pc - (unsigned long)info.dli_fbase,
++ pc);
++ }
++
++ return;
++}
++
++static void printFrame(int fd, const char* format, ...)
++{
++ va_list ap;
++ static char buffer[maxSize];
++
++ va_start(ap, format);
++ (void)vsnprintf(buffer, sizeof (buffer), format, ap);
++ va_end(ap);
++
++ (void)write(fd, buffer, strlen(buffer));
++}
++
++static int printStack(uintptr_t pc, int signo, void *arg)
++{
++
++ static char buffer[maxSize];
++ char sigbuf[SIG2STR_MAX];
++
++
++ int filenum = (intptr_t)arg;
++
++ addr2sym((void *)pc, buffer, sizeof (buffer));
++
++ if (signo) {
++ sigbuf[0] = '?';
++ sigbuf[1] = 0;
++
++ (void) sig2str(signo, sigbuf);
++
++ printFrame(filenum, "%s [Signal %d (%s)]\n",
++ buffer, (ulong_t)signo, sigbuf);
++ } else
++ printFrame(filenum, "%s\n", buffer);
++
++ return (0);
++}
++
++static int backtrace(int fd)
++{
++ int rc = -1;
++ ucontext_t u;
++
++ if (getcontext(&u) >= 0)
++ {
++ rc = walkcontext(&u, printStack, (void*)(intptr_t)fd);
++ }
++ return(rc);
++}
++#endif /* : defined(__sun__) */
++
+ void ADM_backTrack(const char *info,int lineno,const char *file)
+ {
+ if(mysaveFunction)
+@@ -70,23 +168,27 @@ void ADM_backTrack(const char *info,int lineno,const char *file)
+
+ #if !defined(__HAIKU__)
+ char wholeStuff[2048];
++#if !defined(__sun__)
+ char buffer[4096];
+ char in[2048];
+ void *stack[20];
+ char **functions;
+ int count, i;
+-
++#endif
+ wholeStuff[0]=0;
+
+ printf("\n*********** BACKTRACK **************\n");
+
++#if !defined(__sun__)
+ count = backtrace(stack, 20);
+ functions = backtrace_symbols(stack, count);
++#endif
+ sprintf(wholeStuff,"%s\n at line %d, file %s",info,lineno,file);
++#if !defined(__sun__)
+ int status;
+ size_t size=2047;
+ // it looks like that xxxx (functionName+0x***) XXXX
+- for (i=0; i < count; i++)
++ for (i=0; i < count; i++)
+ {
+ char *s=strstr(functions[i],"(");
+ buffer[0]=0;
+@@ -94,16 +196,18 @@ void ADM_backTrack(const char *info,int lineno,const char *file)
+ {
+ strcpy(in,s+1);
+ char *e=strstr(in,"+");
+- *e=0;
++ *e=0;
+ __cxxabiv1::__cxa_demangle(in,buffer,&size,&status);
+ if(status) strcpy(buffer,in);
+- }else
++ }else
+ strcpy(buffer,functions[i]);
+ printf("%s:%d:<%s>:%d\n",functions[i],i,buffer,status);
+ strcat(wholeStuff,buffer);
+ strcat(wholeStuff,"\n");
+ }
+-
++#else
++ backtrace(fileno(stdout));
++#endif
+ printf("*********** BACKTRACK **************\n");
+
+ if(myFatalFunction)
+--
+1.8.4.1
+
Deleted: csw/mgar/pkg/avidemux/trunk/files/0005-make-crashdump-NOP.patch
===================================================================
--- csw/mgar/pkg/avidemux/trunk/files/0005-make-crashdump-NOP.patch 2013-11-06 11:14:40 UTC (rev 22416)
+++ csw/mgar/pkg/avidemux/trunk/files/0005-make-crashdump-NOP.patch 2013-11-06 11:38:12 UTC (rev 22417)
@@ -1,44 +0,0 @@
-From d7022be6a4b0de461934a3ae6bc1bd1fc6d10aba Mon Sep 17 00:00:00 2001
-From: Peter Felecan <pfelecan at opencsw.org>
-Date: Sun, 27 Oct 2013 16:26:50 +0100
-Subject: [PATCH] make crashdump NOP
-
----
- avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp b/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
-index 891325f..e81de25 100644
---- a/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
-+++ b/avidemux_core/ADM_core/src/ADM_crashdump_unix.cpp
-@@ -21,7 +21,9 @@
- #include <unistd.h>
- #include <cxxabi.h>
- #include <signal.h>
-+#if !defined(__sun__)
- #include <execinfo.h>
-+#endif /* : !defined(__sun__) */
-
- #include "ADM_default.h"
-
-@@ -65,6 +67,7 @@ void sig_segfault_handler(int signo)
-
- void ADM_backTrack(const char *info,int lineno,const char *file)
- {
-+#if !defined(__sun__)
- if(mysaveFunction)
- mysaveFunction();
-
-@@ -111,5 +114,9 @@ void ADM_backTrack(const char *info,int lineno,const char *file)
-
- exit(-1); // _exit(1) ???
- #endif
-+#else /* : !defined(__sun__) */
-+ printf("crashed in %s at line %d\n", file, lineno);
-+ printf("crash backtrace not implemented for SUN Solaris!\n");
-+#endif /* : !defined(__sun__) */
- }
- //EOF
---
-1.8.3.4
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list