Gdb 确定非法指令错误的来源

Gdb 确定非法指令错误的来源,gdb,Gdb,在i386上使用LLVM 3.4或更新版本构建Thunderbird/Firefox会在安装阶段导致崩溃;amd64不会出现此问题。这个问题在VMware下运行的VM和裸机上都出现了,但我也能够在其他裸机i386系统上运行而没有问题。我猜这可能是LLVM的代码生成问题,从我在别处听到的内容来看,这是从LLVM 3.3和3.4之间的某个地方开始的,但我不知道这是真的LLVM问题还是Thunderbird/Firefox安装程序中的相关代码问题 gmake[1]: Entering director

在i386上使用LLVM 3.4或更新版本构建Thunderbird/Firefox会在安装阶段导致崩溃;amd64不会出现此问题。这个问题在VMware下运行的VM和裸机上都出现了,但我也能够在其他裸机i386系统上运行而没有问题。我猜这可能是LLVM的代码生成问题,从我在别处听到的内容来看,这是从LLVM 3.3和3.4之间的某个地方开始的,但我不知道这是真的LLVM问题还是Thunderbird/Firefox安装程序中的相关代码问题

gmake[1]: Entering directory '/usr/ports/pobj/thunderbird-24.2.0/build-i386/mail/installer'
OMNIJAR_NAME=omni.ja \
/usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/_virtualenv/bin/python /usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/packager.py -DMOZ_GLUE_IN_PROGRAM -DMOZ_THUNDERBIRD=1 -DOSTYPE=\"OpenBSD5\" -DOSARCH=OpenBSD -DNO_NSPR_10_SUPPORT -DAB_CD=en-US -DMOZ_APP_NAME=thunderbird -DPREF_DIR=defaults/pref -DMOZ_ENABLE_GNOME_COMPONENT=1 -DMOZ_GTK2=1 -DJAREXT= -DMOZ_NATIVE_NSPR=1 -DMOZ_NATIVE_NSS=1 -DMOZ_CHILD_PROCESS_NAME=plugin-container -DDLL_PREFIX=lib -DDLL_SUFFIX=.so.28.0 -DBIN_SUFFIX= -DBINPATH=bin \
        --format omni \
        --removals /usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mail/installer/removed-files.in \
     \
     \
     \
    --optimizejars \
     \
    package-manifest ../../mozilla/dist ../../mozilla/dist/thunderbird \
    --non-resource defaults/messenger/mailViews.dat
Executing /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/xpcshell -g /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -a /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -f /usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/precompile_cache.js -e precompile_startupcache("resource://gre/");
Traceback (most recent call last):
  File "/usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/packager.py", line 375, in <module>
main()
  File "/usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/packager.py", line 367, in main
args.source, gre_path, base)
  File "/usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/packager.py", line 148, in precompile_cache
    errors.fatal('Error while running startup cache precompilation')
  File "/usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/python/mozbuild/mozpack/errors.py", line 101, in fatal
self._handle(self.FATAL, msg)
  File "/usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/python/mozbuild/mozpack/errors.py", line 96, in _handle
raise ErrorMessage(msg)
mozpack.errors.ErrorMessage: Error: Error while running startup cache precompilation
我使用了核心文件,而不是像您指定的那样运行gdb

# egdb build-i386/mozilla/dist/bin/xpcshell build-i386/mail/installer/xpcshell.core
Python Exception <type 'exceptions.ImportError'> No module named gdb: 

warning: 
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "i386-unknown-openbsd5.5".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/xpcshell...(no debugging symbols found)...done.
[New process 13685]
Core was generated by `xpcshell'.
Program terminated with signal 4, Illegal instruction.
#0  0x002ead4d in mozilla::BinaryPath::GetFile(char const*, nsIFile**) () from /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/libxul.so.28.0
(gdb) x/i $pc
=> 0x2ead4d <_ZN7mozilla10BinaryPath7GetFileEPKcPP7nsIFile+157>:        ud2    
(gdb) quit
# echo _ZN7mozilla10BinaryPath7GetFileEPKcPP7nsIFile+157 | c++filt
mozilla::BinaryPath::GetFile(char const*, nsIFile**)+157
#egdb build-i386/mozilla/dist/bin/xpcshell build-i386/mail/installer/xpcshell.core
Python异常没有名为gdb的模块:
警告:
无法从“/usr/local/share/gdb/Python”加载Python gdb模块。
_gdb模块提供了有限的Python支持。
建议传递--data directory=/path/to/gdb/data directory。
GNU gdb(gdb)7.6.1
版权所有(C)2013免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“i386-unknown-openbsd5.5”。
有关错误报告说明,请参阅:
...
正在从/usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/xpcshell读取符号…(未找到调试符号)…完成。
[新工艺13685]
核心由“xpcshell”生成。
程序以信号4终止,指令非法。
#mozilla::BinaryPath::GetFile(char const*,nsfile**)中的0 0x002ead4d,来自/usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/libxul.so.28.0
(gdb)x/i$pc
=>0x2ead4d:ud2
(gdb)退出
#echo | zn7Mozilla10BinaryPath7GetFileEPKCPP7nsFile+157 | c++过滤器
mozilla::BinaryPath::GetFile(char const*,nsFile**)+157
正在寻找相关工具的帮助,以尝试确定此非法指令错误的来源

您的第一项任务是了解您试图执行的非法指令

在GDB下运行
xpcshell
,如下所示:

gdb --args /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/xpcshell \
  -g /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -a \
  /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -f \
  /usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/precompile_cache.js -e \
  precompile_startupcache("resource://gre/");

(gdb) run
... GDB will stop on SIGILL
(gdb) x/i $pc
一旦你知道非法指令是什么,你就需要弄清楚为什么Clang会产生它


一种可能的情况是
ud2
指令,当它在程序中检测到时发出叮当声。

感谢您的响应。这将帮助我朝着正确的方向前进。
gdb --args /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/xpcshell \
  -g /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -a \
  /usr/ports/pobj/thunderbird-24.2.0/build-i386/mozilla/dist/bin/ -f \
  /usr/ports/pobj/thunderbird-24.2.0/comm-esr24/mozilla/toolkit/mozapps/installer/precompile_cache.js -e \
  precompile_startupcache("resource://gre/");

(gdb) run
... GDB will stop on SIGILL
(gdb) x/i $pc