我看到了gdb在核心转储后为所有线程转储回溯的一个漂亮的行。所以我尝试了一个快速:
int main() {int* x = new int[5]; for(int i = 0; true; ++i) x[i] = i; }
得到一个核心转储,然后运行这个:
gdb --batch --quiet -ex "thread apply all bt full" -ex "quit" a.out core.box-name.a.out.27459.8515.11
我得到了输出:
[New LWP 27459]
warning: Can't read pathname for load map: Input/output error.
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff9e503000
Core was generated by `./a.out'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000000004005ca in main () at <stdin>:6
6 <stdin>: No such file or directory.
Thread 1 (LWP 27459):
#0 0x00000000004005ca in main () at <stdin>:6
i = 33788
x = 0x1a460010
我看到了一个回溯,这很好,但我想知道我看到的两个警告是关于什么的?
从这个链接来看,这是gdb中的一个错误,在最近的版本中已经修复。
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=248898