Forum Discussion
hErd
New Contributor
1 year agoHow to analyse lock acquire and release using intel pin instrumentation
I am analyzing C++ codes to find data races in them using intel pin
Now I found some inbuilt functions in Intel Pin like INS_IsMemoryRead and INS_IsMemoryWrite to determine if a instruction is memory read or write respectively Now I want to achive the same for lock acquire and lock release (only for C++ pthread_mutex) but I didn't find any such function
So I disassembled the lock acquire statement and found a lock prefix and a cmpxchg statement
So I decided to use lockPrefix function of Intel Pin to determine if the instruction has lock prefix and INS_Opcode function to check if xed value is cmpxchg and then check if the adress being written to has value 1 then we can say lock acquire is successful
But I believe there is something simpler and also have doubts regarding correctness of my approach
Now I found some inbuilt functions in Intel Pin like INS_IsMemoryRead and INS_IsMemoryWrite to determine if a instruction is memory read or write respectively Now I want to achive the same for lock acquire and lock release (only for C++ pthread_mutex) but I didn't find any such function
So I disassembled the lock acquire statement and found a lock prefix and a cmpxchg statement
So I decided to use lockPrefix function of Intel Pin to determine if the instruction has lock prefix and INS_Opcode function to check if xed value is cmpxchg and then check if the adress being written to has value 1 then we can say lock acquire is successful
But I believe there is something simpler and also have doubts regarding correctness of my approach
Is this related to FPGA question?
7 Replies
- KennyT_altera
Super Contributor
Is this related to FPGA question?
- hErd
New Contributor
I am really sorry but I don't understand what you mean by "FPGA question"
- KennyT_altera
Super Contributor
You may refer to here https://www.intel.com/content/www/us/en/products/overview.html
Is this related to FPGA product?
- KennyT_altera
Super Contributor
Is there any update?
- KennyT_altera
Super Contributor
upon checking, this is not a FPGA question.. Can you post your question to the right category in the below? https://community.intel.com/t5/Product-Support-Forums/ct-p/product-support-forums
Thanks
- KennyT_altera
Super Contributor
closing the non fpga related question