|
From: Bart V. A. <bar...@gm...> - 2008-12-31 12:36:51
|
On Wed, Dec 31, 2008 at 12:11 PM, Felix Schmidt <fel...@we...> wrote:
> this is the code fragment:
>
> 73 VG_(thread_stack_next)(&thread, &s_min, &s_max);
> 74 if(addr >= s_min && addr <= s_max)
> 75 {
> 76 // stack
> 79 } else {
> 80 // heap or bss
> 81 }
>
> I try to get stack boundaries. Then I want to decide if the given
> address a stack address or a heap rather bss address.
> I think the +1 falsify the result. Wrong stack boundaries are supposed.
> (may be the stack boundaries of current thread +1)
VG_(thread_stack_next)() is typically used to iterate over all
threads. Without the "+1" inside VG_(thread_stack_next)() this
function would not iterate over threads but would always return
information for the same thread. If you only need the stack
information for a single thread, there are two options:
* Decrement 'thread' before calling VG_(thread_stack_next)().
* Use VG_(thread_get_stack_max)(...) and
VG_(thread_get_stack_size)(...) instead of VG_(thread_stack_next)().
Bart.
|