确定非法指令错误的来源

时间:2014-02-28 04:42:31

标签: gdb

在i386上使用LLVM 3.4或更高版本构建Thunderbird / Firefox会导致安装阶段崩溃; amd64不会发生这个问题。这个问题已经出现在VMware和裸机上运行的虚拟机,但我也能够在没有问题的情况下在其他裸机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

我正在寻找相关工具的一些帮助,以尝试确定此非法指令错误的来源。

Core was generated by `xpcshell'.
Program terminated with signal 4, Illegal instruction.

我使用核心文件而不是按照你指定的方式运行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

1 个答案:

答案 0 :(得分:0)

  

寻求相关工具的一些帮助,以尝试确定此非法指令错误的来源

您的首要任务是了解您正在尝试执行的非法指令。

在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指令,当Clang在程序中检测到undefined behavior时会发出该指令。