From: Bart Van Assche Date: Thu, 2 Sep 2010 14:38:38 +0000 (+0000) Subject: Added functions for querying the properties of the alternate stack. X-Git-Tag: svn/VALGRIND_3_6_0~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bf86ce7b99b7754baff212f2d9a88ab07a7e6e7;p=thirdparty%2Fvalgrind.git Added functions for querying the properties of the alternate stack. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11324 --- diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 250a21c7ed..7a7e1e1c17 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -310,6 +310,20 @@ SizeT VG_(thread_get_stack_size)(ThreadId tid) return VG_(threads)[tid].client_stack_szB; } +Addr VG_(thread_get_altstack_min)(ThreadId tid) +{ + vg_assert(0 <= tid && tid < VG_N_THREADS && tid != VG_INVALID_THREADID); + vg_assert(VG_(threads)[tid].status != VgTs_Empty); + return (Addr)VG_(threads)[tid].altstack.ss_sp; +} + +SizeT VG_(thread_get_altstack_size)(ThreadId tid) +{ + vg_assert(0 <= tid && tid < VG_N_THREADS && tid != VG_INVALID_THREADID); + vg_assert(VG_(threads)[tid].status != VgTs_Empty); + return VG_(threads)[tid].altstack.ss_size; +} + //------------------------------------------------------------- /* Details about the capabilities of the underlying (host) CPU. These details are acquired by (1) enquiring with the CPU at startup, or diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h index c9d77dd726..5d89c708d1 100644 --- a/include/pub_tool_machine.h +++ b/include/pub_tool_machine.h @@ -148,6 +148,14 @@ extern Addr VG_(thread_get_stack_max) ( ThreadId tid ); // Returns how many bytes have been allocated for the stack of the given thread extern Addr VG_(thread_get_stack_size) ( ThreadId tid ); +// Returns the bottommost address of the alternate signal stack. +// See also the man page of sigaltstack(). +extern Addr VG_(thread_get_altstack_min) ( ThreadId tid ); + +// Returns how many bytes have been allocated for the alternate signal stack. +// See also the man page of sigaltstack(). +extern SizeT VG_(thread_get_altstack_size) ( ThreadId tid ); + // Given a pointer to a function as obtained by "& functionname" in C, // produce a pointer to the actual entry point for the function. For // most platforms it's the identity function. Unfortunately, on