我正在開發一個應用程序,它在某些時候必須使用不同的堆棧,並由我開發的庫管理。所以,我調用這個庫的初始化函數,並將堆棧指針($ sp)設置爲我想要的內存地址。當手動更改堆棧指針時,GDB會丟失
當運行通過GDB這個代碼,我的其他堆棧初始化後完成,執行返回到調用函數,GDB給了我這樣的警告:
warning: GDB can't find the start of the function at 0x12.
GDB is unable to find the start of the function at 0x12
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x12 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
此外,打印$ SP的情況下,顯示舊值。
由於這部分代碼而不GDB正確執行,並有在0×12沒有功能,這是因爲GDB使用堆棧指針來解決跟蹤函數的幀的。
有什麼辦法可以避免這種行爲,並且能夠調試這個應用程序?