What is the THREAD datatype in QNX neutrino? How can I access to content of a thread's stack using its THREAD* value just like when you debug stack frames using gdb command tool?
Asked
Active
Viewed 156 times
0
-
If it's even possible, you have to remember that while you're examining the other threads stack it might actually change while you're reading it. Unless you pause the other thread of course. – Some programmer dude Sep 13 '13 at 14:38
-
Yes! The threads I am going to read their stack are not running during reading. – moorara Sep 13 '13 at 14:51
1 Answers
0
You can retrieve the register values of a particular thread in your own or (if you are root) in another process via the /proc filesystem.
First you use the DCMD_PROC_CURTHREAD devctl() to select the thread you want to retrieve the registers of:
After that you use DCMD_PROC_GETREG to retrieve the value of registers, including the stack pointer.
If you are doing this from another thread of the same process then you can use the value of SP as it is because you are in the same address space.
If you are doing this from another process then you need to read() the address space via /proc/PID/as as described at: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_prog%2Fprocess.html&cp=13_7_3_4_1&anchor=Address_space

maverick
- 436
- 2
- 10