* win32/win32.c (poll_child_status): [experimental] set the cause of

a child's death to status if its exitcode seems to be an error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2013-05-02 02:34:11 +00:00
Родитель fe2177fddc
Коммит 25acda257c
2 изменённых файлов: 38 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu May 2 11:32:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (poll_child_status): [experimental] set the cause of
a child's death to status if its exitcode seems to be an error.
Thu May 2 11:24:00 2013 Zachary Scott <zachary@zacharyscott.net>
* lib/yaml.rb: nodoc EngineManager, add History doc #8344

Просмотреть файл

@ -3908,7 +3908,39 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
}
pid = child->pid;
CloseChildHandle(child);
if (stat_loc) *stat_loc = exitcode << 8;
if (stat_loc) {
*stat_loc = exitcode << 8;
if (exitcode & 0xC0000000) {
static struct {
DWORD status;
int sig;
} table[] = {
{STATUS_ACCESS_VIOLATION, SIGSEGV},
{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_FLOAT_MULTIPLE_FAULTS, SIGFPE},
{STATUS_FLOAT_MULTIPLE_TRAPS, SIGFPE},
{0, 0}
};
int i;
for (i = 0; table[i].status; i++) {
if (table[i].status == exitcode) {
*stat_loc |= table[i].sig;
break;
}
}
// if unknown status, assume SEGV
if (!table[i].status)
*stat_loc |= SIGSEGV;
}
}
return pid;
}
return 0;