簡體   English   中英

`gdb` 如何計算棧幀的邊界?

[英]How does `gdb` compute the bounds of a stack frame?

我正在調試一個新的線程庫,我在其中手動設置堆棧寄存器rsp (以切換到用戶管理的堆棧),然后調用一個永遠不會返回的 function。

當我嘗試在 gdb 中獲取回溯時,我得到以下 output。

(gdb) bt
#0  load (_m=std::memory_order_seq_cst, this=<error reading variable: Asked for position 0 of stack, stack only has 0 elements on it.>)
    at /usr/include/c++/4.9/atomic:209
#1  Arachne::schedulerMainLoop () at Arachne.cc:236
#2  0x000000000040268d in Arachne::threadMainFunction (id=<optimized out>) at Arachne.cc:135
#3  0x0000000000000000 in ?? ()

gdb怎么判斷棧里面有0個元素呢?

更一般地說, gdb是如何確定堆棧有多少個元素的?

Asked for position 0 of stack, stack only has 0 elements on it. 來自gdb/dwarf2/expr.c並且不涉及您的 CPU 堆棧。 相反,它抱怨DWARF表達式工作的堆棧。

這可能意味着您的 DWARF 調試信息無效。 或者你對esp所做的混淆了 GDB 的 DWARF 表達式計算器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM