|
From: <sv...@va...> - 2009-05-19 05:29:02
|
Author: njn
Date: 2009-05-19 06:28:43 +0100 (Tue, 19 May 2009)
New Revision: 9951
Log:
Tweak VG_(exit).
Modified:
trunk/coregrind/m_libcassert.c
Modified: trunk/coregrind/m_libcassert.c
===================================================================
--- trunk/coregrind/m_libcassert.c 2009-05-19 05:23:29 UTC (rev 9950)
+++ trunk/coregrind/m_libcassert.c 2009-05-19 05:28:43 UTC (rev 9951)
@@ -99,14 +99,15 @@
/* Pull down the entire world */
void VG_(exit)( Int status )
{
-# if defined(VGO_linux)
+#if defined(VGO_linux)
(void)VG_(do_syscall1)(__NR_exit_group, status );
-# endif
+#elif defined(VGO_aix5)
(void)VG_(do_syscall1)(__NR_exit, status );
- /* Why are we still alive here? */
+#else
+# error Unknown OS
+#endif
/*NOTREACHED*/
- *(volatile Int *)0 = 'x';
- vg_assert(2+2 == 5);
+ VG_(core_panic)("VG_(exit) didn't work?");
}
// Print the scheduler status.
|
|
From: Julian S. <js...@ac...> - 2009-05-19 07:15:48
|
> Modified: trunk/coregrind/m_libcassert.c
> ===================================================================
> --- trunk/coregrind/m_libcassert.c 2009-05-19 05:23:29 UTC (rev 9950)
> +++ trunk/coregrind/m_libcassert.c 2009-05-19 05:28:43 UTC (rev 9951)
> @@ -99,14 +99,15 @@
> /* Pull down the entire world */
> void VG_(exit)( Int status )
> {
> -# if defined(VGO_linux)
> +#if defined(VGO_linux)
> (void)VG_(do_syscall1)(__NR_exit_group, status );
> -# endif
> +#elif defined(VGO_aix5)
> (void)VG_(do_syscall1)(__NR_exit, status );
> - /* Why are we still alive here? */
> +#else
> +# error Unknown OS
> +#endif
> /*NOTREACHED*/
> - *(volatile Int *)0 = 'x';
> - vg_assert(2+2 == 5);
> + VG_(core_panic)("VG_(exit) didn't work?");
> }
The point of the write to zero here was to take the process out
with SIGSEGV if the syscall failed to do so. Doesn't VG_(core_panic)
eventually lead back to VG_(exit) ?
J
|
|
From: Nicholas N. <n.n...@gm...> - 2009-05-19 07:29:45
|
On Tue, May 19, 2009 at 5:18 PM, Julian Seward <js...@ac...> wrote:
>
>> Modified: trunk/coregrind/m_libcassert.c
>> ===================================================================
>> --- trunk/coregrind/m_libcassert.c 2009-05-19 05:23:29 UTC (rev 9950)
>> +++ trunk/coregrind/m_libcassert.c 2009-05-19 05:28:43 UTC (rev 9951)
>> @@ -99,14 +99,15 @@
>> /* Pull down the entire world */
>> void VG_(exit)( Int status )
>> {
>> -# if defined(VGO_linux)
>> +#if defined(VGO_linux)
>> (void)VG_(do_syscall1)(__NR_exit_group, status );
>> -# endif
>> +#elif defined(VGO_aix5)
>> (void)VG_(do_syscall1)(__NR_exit, status );
>> - /* Why are we still alive here? */
>> +#else
>> +# error Unknown OS
>> +#endif
>> /*NOTREACHED*/
>> - *(volatile Int *)0 = 'x';
>> - vg_assert(2+2 == 5);
>> + VG_(core_panic)("VG_(exit) didn't work?");
>> }
>
> The point of the write to zero here was to take the process out
> with SIGSEGV if the syscall failed to do so. Doesn't VG_(core_panic)
> eventually lead back to VG_(exit) ?
You're right, but dereferencing zero seems like a bad way to do it.
GCC has __builtin_trap() -- that might be better.
N
|