[Forensics-changes] [libguytools] 02/04: Imported Upstream version 2.0.4

Michael Prokop mika at moszumanska.debian.org
Tue Aug 18 11:08:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

mika pushed a commit to branch debian
in repository libguytools.

commit 430eaf910e51b0c83228797609692b9fdbf124ac
Author: Michael Prokop <mika at debian.org>
Date:   Tue Aug 18 12:55:47 2015 +0200

    Imported Upstream version 2.0.4
---
 changelog      | 10 +++++-----
 toolsignal.cpp | 60 ++++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/changelog b/changelog
index b8926ae..4efec74 100644
--- a/changelog
+++ b/changelog
@@ -1,7 +1,11 @@
+libguytools2 (2.0.4-1) unstable; urgency=low
+  * Removed arch specific code in toolsignal.cpp
+ -- Guy Voncken <develop at faert.net>  Thu, 13 Jul 2015 16:00:00 +0200
+
 libguytools2 (2.0.3-1) unstable; urgency=low
   * Corrected problem with trailing backslashes
   * Switched to my new developer email address
- -- Guy Voncken <develop at faert.net>  Mon, 02 Mar 2015 12:00:00 +0100
+ -- Guy Voncken <develop at faert.net>  Thu, 30 Oct 2014 16:00:00 +0100
 
 libguytools2 (2.0.2-1) unstable; urgency=low
   * Correctly handling decimal point for different locale settings in toolcfg
@@ -26,22 +30,18 @@ libguytools1 (1.1.0beta1-0) unstable; urgency=low
   * Debianisation changes by Mika
  -- Guy Voncken <develop at faert.net>  Tue, 18 Aug 2009 11:00:00 +0200
 
-
 libguytools1 (1.0.3) unstable; urgency=low
   * Debian packaging checked and corrected
  -- Guy Voncken <develop at faert.net>  Wed, 08 Apr 2008 17:00:00 +0200
 
-
 libguytools1 (1.0.2) unstable; urgency=low
   * Support for amd64 architecture
  -- Guy Voncken <develop at faert.net>  Wed, 16 Nov 2007 09:00:00 +0200
 
-
 libguytools1 (1.0.1) unstable; urgency=low
   * Const type cleaned up.
  -- Guy Voncken <develop at faert.net>  Wed, 06 Jun 2007 16:25:08 +0200
 
-
 libguytools1 (1.0.0) unstable; urgency=low
   * Initial release.
  -- Guy Voncken <develop at faert.net>  Wed, 06 Jun 2007 16:25:08 +0200
diff --git a/toolsignal.cpp b/toolsignal.cpp
index 038eec7..3fcf585 100644
--- a/toolsignal.cpp
+++ b/toolsignal.cpp
@@ -143,27 +143,39 @@ static void ToolSignalBacktraceHandler (int Signal, siginfo_t *pSignalInfo, void
    int           TraceSize;
    int           i;
    static int    RecursiveCallDetection = 0;
-   void *pIP = NULL;
 
-   #if defined(__sparc__)
-      struct sigcontext* pSigContext = (struct sigcontext*) pSecret;
-      #if __WORDSIZE == 64
-         pIP = (void*) pSigContext->sigc_regs.tpc ;
+   /* Code below is no longer needed. According to tests on amd64 and i386 on Ubuntu 14.04, the address of the 
+      place the where exception occured nowadays is correctly included in the array data returned by backtrace(). 
+      It thus seems to be no longer necessary to separately fetch and add the instruction pointer corresponding 
+      to the segmentation fault.
+      This wasn't the case on older systems, see for example http://www.linuxjournal.com/article/6391?page=0,1 .
+
+      void *pIP = NULL;
+
+      #if defined(__sparc__)
+         struct sigcontext* pSigContext = (struct sigcontext*) pSecret;
+         #if __WORDSIZE == 64
+            pIP = (void*) pSigContext->sigc_regs.tpc ;
+         #else
+            pIP = (void*) pSigContext->si_regs.pc ;
+         #endif
       #else
-         pIP = (void*) pSigContext->si_regs.pc ;
+         ucontext_t* pUContext = (ucontext_t*) pSecret;
+         #if   defined(__i386__)
+            pIP = (void*) pUContext->uc_mcontext.gregs[REG_EIP];
+         #elif defined(__x86_64__)
+            pIP = (void*) pUContext->uc_mcontext.gregs[REG_RIP];
+         #elif defined(__hppa__)
+            pIP = (void*) pUContext->uc_mcontext.sc_iaoq[0] & ~0x3UL;
+         #elif (defined (__ppc__)) || (defined (__powerpc__))
+            pIP = (void*) pUContext->uc_mcontext.regs->nip;
+         #elif defined(__arm__)
+            pIP = (void*) pUContext->uc_mcontext.arm_pc;
+         #elif defined(__aarch64__)
+            pIP = (void*) pUContext->uc_mcontext.pc;
+         #endif
       #endif
-   #else
-      ucontext_t* pUContext = (ucontext_t*) pSecret;
-      #if   defined(__i386__)
-         pIP = (void*) pUContext->uc_mcontext.gregs[REG_EIP];
-      #elif defined(__x86_64__)
-         pIP = (void*) pUContext->uc_mcontext.gregs[REG_RIP];
-      #elif defined(__hppa__)
-         pIP = (void*) pUContext->uc_mcontext.sc_iaoq[0] & ~0x3UL;
-      #elif (defined (__ppc__)) || (defined (__powerpc__))
-         pIP = (void*) pUContext->uc_mcontext.regs->nip;
-      #endif
-    #endif
+   */
 
    RecursiveCallDetection++;
    switch (RecursiveCallDetection)
@@ -174,9 +186,9 @@ static void ToolSignalBacktraceHandler (int Signal, siginfo_t *pSignalInfo, void
          ToolSignalLogEntry (true, __FFL__, "----------------------------------------------------------------------");
          if (Signal == SIGSEGV)
          {
-            ToolSignalLogEntry (true, __FFL__, "Thread (%d-%d): Got signal '%s' (%d), faulty address is %p, from %p",
+            ToolSignalLogEntry (true, __FFL__, "Thread (%d-%d): Got signal '%s' (%d), faulty address is %p" /*, "from %p" */, // See remarks above
                                getpid(), pthread_self(), strsignal(Signal), Signal,
-                               pSignalInfo->si_addr, pIP);
+                               pSignalInfo->si_addr /*, pIP*/);
          }
          else
          {
@@ -184,11 +196,13 @@ static void ToolSignalBacktraceHandler (int Signal, siginfo_t *pSignalInfo, void
                                getpid(), pthread_self(), strsignal(Signal), Signal);
          }
          TraceSize = backtrace (TraceArr, TraceArrLen);
-         TraceArr[1] = pIP;
+         /* TraceArr[1] = pIP;   */  // See remarks above
          ppMessages  = backtrace_symbols (TraceArr, TraceSize);
 
-         ToolSignalLogEntry (true, __FFL__, "Backtrace execution path:");
-         for (i=1; i<TraceSize; ++i)
+         ToolSignalLogEntry (true, __FFL__, "Backtrace execution path");
+         ToolSignalLogEntry (true, __FFL__, "The first two entries are normally related to the signal handler.");
+         ToolSignalLogEntry (true, __FFL__, "The faulty code generally is referenced by the 3rd line in the listing below.");
+         for (i=0; i<TraceSize; ++i)
             ToolSignalLogEntry (true, __FFL__, "[Backtrace] %s", ppMessages[i]);
 
          if (ToolSignalLocal.pSignalHandlerFn)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/libguytools.git



More information about the forensics-changes mailing list