From: Ivo Raisr Date: Mon, 28 Nov 2016 21:41:28 +0000 (+0000) Subject: Use NULL_STK_ID consistently throughout whole Valgrind. X-Git-Tag: svn/VALGRIND_3_13_0~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02a02e7bf9bc2db3f07bd2a1d6c247afae82bdb4;p=thirdparty%2Fvalgrind.git Use NULL_STK_ID consistently throughout whole Valgrind. Follow up to SVN r16159, BZ#373046. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16160 --- diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c index 296d6584a4..5962cc4aae 100644 --- a/coregrind/m_clientstate.c +++ b/coregrind/m_clientstate.c @@ -31,6 +31,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_threadstate.h" #include "pub_core_vki.h" #include "pub_core_xarray.h" #include "pub_core_clientstate.h" @@ -50,7 +51,7 @@ Addr VG_(clstk_start_base) = 0; /* Initial highest address of the stack segment of the main thread. */ Addr VG_(clstk_end) = 0; -UWord VG_(clstk_id) = 0; +UWord VG_(clstk_id) = NULL_STK_ID; /* Maximum size of the main thread's client stack. */ SizeT VG_(clstk_max_size) = 0; diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index 674674f77a..9c850350fd 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -195,7 +195,7 @@ static void run_a_thread_NORETURN(Word tidW) VG_TRACK(die_mem_munmap, a, sizeof(struct vki_sc_shared)); /* Deregister thread's stack. */ - if (tst->os_state.stk_id != (UWord)-1) + if (tst->os_state.stk_id != NULL_STK_ID) VG_(deregister_stack)(tst->os_state.stk_id); /* Tell the tool this thread is exiting. */ @@ -708,14 +708,13 @@ static void set_stack(ThreadId tid, vki_stack_t *st) new_start = new_end + 1 - new_size; } - if (tst->os_state.stk_id == (UWord)-1) { + if (tst->os_state.stk_id == NULL_STK_ID) { /* This thread doesn't have a stack set yet. */ VG_(debugLog)(2, "syswrap-solaris", "Stack set to %#lx-%#lx (new) for thread %u.\n", new_start, new_end, tid); tst->os_state.stk_id = VG_(register_stack)(new_start, new_end); - } - else { + } else { /* Change a thread stack. */ VG_(debugLog)(2, "syswrap-solaris", "Stack set to %#lx-%#lx (change) for thread %u.\n", @@ -7037,7 +7036,7 @@ PRE(sys_lwp_create) later by libc by a setustack() call (the getsetcontext syscall). */ ctst->client_stack_highest_byte = 0; ctst->client_stack_szB = 0; - vg_assert(ctst->os_state.stk_id == (UWord)(-1)); + vg_assert(ctst->os_state.stk_id == NULL_STK_ID); /* Inform a tool that a new thread is created. This has to be done before any other core->tool event is sent. */