Tectrendz
Tectrendz

Reputation: 1464

How to detect the thread which is writing to a stack address?

I am seeing value of the variable passed to a function is becoming null after returning from the function. The variable is pushed to the stack and while returning the same is pop. Do we have a way to find the culprit thread ? Can i protect the that stack location ? i did check the assembly and dont see any offset to rbp which may change stack ?

push   %rbp
mov    %rsp,%rbp
push   %rbx

.....................



add    $0x8,%rsp
pop    %rbx
leaveq

Upvotes: 0

Views: 152

Answers (2)

David Schwartz
David Schwartz

Reputation: 182885

Just debug the program normally. You're trying to make things much harder than they need to be.

Upvotes: 1

anio
anio

Reputation: 9171

I think the operating system should be protecting your process from any other process messing with it's memory. Are you certain you don't have memory corruption within your program? Do you have multiple threads? Those are more likely culprits than another rogue process.

Upvotes: 1

Related Questions