私は、ある時点で、私が開発したライブラリによって管理される別のスタックを使用する必要があるアプリケーションを開発しています。そこで、このライブラリの初期化関数を呼び出すと、スタックポインタ($ sp)が必要なメモリアドレスに設定されます。
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がなくても正しく実行され、0x12には関数がないため、これはGDBがスタックポインターを使用して関数のフレームを追跡するためにアドレス指定するために発生します。
この動作を回避し、このアプリケーションをデバッグできるようにする方法はありますか?