From stdcxx-commits-return-1535-apmail-incubator-stdcxx-commits-archive=incubator.apache.org@incubator.apache.org Thu Jul 12 15:19:43 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 918 invoked from network); 12 Jul 2007 15:19:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jul 2007 15:19:43 -0000 Received: (qmail 78654 invoked by uid 500); 12 Jul 2007 15:19:46 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 78640 invoked by uid 500); 12 Jul 2007 15:19:45 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 78628 invoked by uid 99); 12 Jul 2007 15:19:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 08:19:45 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,UPPERCASE_25_50 X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 08:19:42 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 135CE1A981A; Thu, 12 Jul 2007 08:19:22 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r555657 - in /incubator/stdcxx/trunk/util: exec.cpp runall.cpp Date: Thu, 12 Jul 2007 15:19:21 -0000 To: stdcxx-commits@incubator.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070712151922.135CE1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Thu Jul 12 08:19:20 2007 New Revision: 555657 URL: http://svn.apache.org/viewvc?view=rev&rev=555657 Log: 2007-07-12 Farid Zaripov * exec.cpp [WIN32]: Added map between NT_STATUS values and UNIX signals. (exec_file) [WIN32]: Translate exit code to signal value using map. * runall.cpp [WIN32]: Removed #include'ing of signal.h and windows.h. Modified: incubator/stdcxx/trunk/util/exec.cpp incubator/stdcxx/trunk/util/runall.cpp Modified: incubator/stdcxx/trunk/util/exec.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?view=diff&rev=555657&r1=555656&r2=555657 ============================================================================== --- incubator/stdcxx/trunk/util/exec.cpp (original) +++ incubator/stdcxx/trunk/util/exec.cpp Thu Jul 12 08:19:20 2007 @@ -48,7 +48,10 @@ # include /* for PROCESS_INFORMATION, ... */ # include /* for CreateProcess, ... */ # ifndef SIGTRAP -# define SIGTRAP 5 // STATUS_BREAKPOINT translated into SIGTRAP +# define SIGTRAP 5 // STATUS_BREAKPOINT translated into SIGTRAP +# endif +# ifndef SIGBUS +# define SIGBUS 10 // STATUS_IN_PAGE_ERROR translated into SIGBUS # endif #endif #include /* for S_* */ @@ -925,6 +928,29 @@ } } #else /* _WIN{32,64} */ + +// map between NT_STATUS value and corresponding UNIX signal +static const struct { + DWORD nt_status; + int signal; +} nt_status_map [] = { + { STATUS_BREAKPOINT, SIGTRAP }, + { STATUS_ACCESS_VIOLATION, SIGSEGV }, + { STATUS_IN_PAGE_ERROR, SIGBUS }, + { STATUS_ILLEGAL_INSTRUCTION, SIGILL }, + { STATUS_PRIVILEGED_INSTRUCTION, SIGILL }, + { STATUS_FLOAT_DENORMAL_OPERAND, SIGFPE }, + { STATUS_FLOAT_DIVIDE_BY_ZERO, SIGFPE }, + { STATUS_FLOAT_INEXACT_RESULT, SIGFPE }, + { STATUS_FLOAT_INVALID_OPERATION, SIGFPE }, + { STATUS_FLOAT_OVERFLOW, SIGFPE }, + { STATUS_FLOAT_STACK_CHECK, SIGFPE }, + { STATUS_FLOAT_UNDERFLOW, SIGFPE }, + { STATUS_INTEGER_DIVIDE_BY_ZERO, SIGFPE }, + { STATUS_INTEGER_OVERFLOW, SIGFPE } +}; + + /** Opens an input file, based on exec_name, using the child_sa security setting. @@ -1243,13 +1269,12 @@ if (0 == CloseHandle (child.hProcess)) warn_last_error ("Closing child process handle"); - if (STATUS_ACCESS_VIOLATION == result->exit) { - result->exit = SIGSEGV; - result->signaled = 1; - } - else if (STATUS_BREAKPOINT == result->exit) { - result->exit = SIGTRAP; - result->signaled = 1; + for (int i = 0; i < sizeof (nt_status_map) / sizeof (*nt_status_map); ++i) { + if (nt_status_map [i].nt_status == DWORD (result->exit)) { + result->exit = nt_status_map [i].signal; + result->signaled = 1; + break; + } } } Modified: incubator/stdcxx/trunk/util/runall.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/runall.cpp?view=diff&rev=555657&r1=555656&r2=555657 ============================================================================== --- incubator/stdcxx/trunk/util/runall.cpp (original) +++ incubator/stdcxx/trunk/util/runall.cpp Thu Jul 12 08:19:20 2007 @@ -35,9 +35,6 @@ #include #if !defined (_WIN32) && !defined (_WIN64) # include /* for WIFEXITED(), ... */ -#else -# include /* for SIGSEGV */ -# include /* for STATUS_ACCESS_VIOLATION */ #endif #include "cmdopt.h"