cpthreadsthreadx

thread stack pointer


In Linux 2.6.32-32, is there a way to find the following information about a thread programmatically in a pthreads program? I need: run count, stack pointer, stack start/end, stack size, stack usage. Something like ThreadX, I guess, but within a program. Thanks.


Solution

  • For obtaining your own stack pointer you can always do something along the lines of:

    mword sp;
    asm volatile ("mov %esp, $0" : "=r"(sp));