2016-08-18 155 views
0

我知道有一個類似​​在那裏。但我認爲這個問題是不同的。GDB的腐敗堆棧問題,不顯示功能和行號

我使用gdb-cross-aarch64來分析arm arch64設備上生成的轉儲核心文件。

我的命令行是這樣的:

gdb-cross-aarch64 /path_to/gst-launch-1.0 /path_to/core.2135 

gst-launch-1.0是取決於LIB libOmxCore.so共享。

這裏是gdb的輸出:

GNU gdb (GDB) 7.9.1 
Copyright (C) 2015 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "--host=x86_64-linux --target=aarch64-poky-linux". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from ./work/aarch64-poky-linux/gstreamer1.0/1.4.5-r0/image/usr/bin/gst-launch-1.0...done. 
[New LWP 2135] 
[New LWP 2137] 
[New LWP 2141] 
[New LWP 2139] 
[New LWP 2138] 
[New LWP 2136] 
[New LWP 2143] 
[New LWP 2142] 
[New LWP 2140] 

warning: Could not load shared library symbols for 46 libraries, e.g. linux-vdso.so.1. 
Use the "info sharedlibrary" command to see the complete listing. 
Do you need "set solib-search-path" or "set sysroot"? 
Core was generated by `gst-launch-1.0 filesrc location=samplevideo.mp4 ! decodebin ! fakesink'. 
Program terminated with signal SIGABRT, Aborted. 
#0 0x0000007fa1d42cb0 in ??() 
(gdb) set sysroot /Disk_1/Alan_s_Work/path_to/image/ 
Reading symbols from /Disk_1/Alan_s_Work/path_to/libOmxCore.so...done. 
(gdb) bt 
#0 0x0000007fa1d42cb0 in ??() 
#1 0x0000007fa1d46120 in ??() 
Backtrace stopped: previous frame identical to this frame (corrupt stack?) 
(gdb) 

如上所示,我已經設置在gdb的sysroot,和在libOmxCore.sogst-launch-1.0符號由gdb讀取。

但我仍然無法通過gdb看到有效的堆棧回溯。

我很確定signal SIGABRTlibOmxCore.so引起的。

我在這裏做錯了什麼?或者我還應該做什麼?

謝謝你

回答

0

這些都是棘手的錯誤找到。調試器通過向上走過您提供的核心轉儲的堆棧幀來獲取它通常顯示的回溯信息。

在堆棧損壞的情況下,顯然沒有任何有用的信息可以用於創建回溯或反向論證:如果看不到適當的回溯,代碼會破壞堆棧。調試器可以爲您提供的驗屍並不多。

損壞的堆棧,特別是使用外部庫時,可能會出現大量原因。有些是:

  1. 移交記憶庫希望看到在堆棧上
  2. 移交指向一個堆棧變量不再有效(如指針返回到局部變量)
  3. 告訴圖書館有關您給它的變量或緩衝區大小的錯誤故事。
  4. 移交標量而不是指針
  5. 假設庫將分配緩衝區並返回指針,但庫存在其他情況。
  6. ...和一個巨大的其他可能的原因量...

手動完成對你的代碼,對準你需要的庫的需求來分配存儲區。找出庫的工作內存(是你的代碼還是分配它的庫),並仔細檢查它是否足夠滿足需求。

SIGABRT被送到一個巨大的原因量,有些你可能想在一個位顯得更加強烈:

  1. 線程運行野生(即不是join編爲
  2. 任何事情堆管理像mallocfree不當指針
  3. 和任何在您的圖書館發現自己在一個情況下與程序事情是不可能的。
+0

謝謝@tofro。 「我非常確定信號SIGABRT是由libOmxCore.so引起的」 因爲我故意在libOmxCore.so函數中設置了「assert(0)」。因爲我想指導自己如何使用'gdb'。 – Alan