|
From: Nicholas N. <nj...@ca...> - 2005-01-03 07:09:54
|
On Wed, 29 Dec 2004, Owen O'Malley wrote:
> I'm writing a tool that needs to get the simulated stack pointer from a helper
> function. Does this look reasonable or did I miss something?
>
> static void* get_stack_ptr(int tid) {
> void *ptr;
> if (VG_(get_current_tid)() == tid) {
> ptr = VG_(baseBlock)[VGOFF_(m_esp)];
> } else {
> ptr = ARCH_STACK_PTR(VG_(threads)[tid].arch);
> }
> return ptr;
> }
Looks ok to me, except the 4th line would be better written as:
ptr = VG_(baseBlock)[VGOFF_STACK_PTR];
to be arch-independent.
N
|