問題:
I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed.我正在通過 gdb 運行一個應用程序,我想在任何時候訪問/更改特定變量時設置一個斷點。 Is there a good method for doing this?有沒有好的方法可以做到這一點? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.我也對在 C/C++ 中監視變量以查看它是否/何時更改的其他方法感興趣。
解決方案:
參考一: https://en.stackoom.com/question/FJD參考二: https://stackoom.com/question/FJD