带有崩溃Haskell程序的空.prof文件(在Windows上)
我试图通过分析来诊断程序中的无限循环。因为我必须用Ctrl-C中途中止程序,.prof文件保持为空。根据我所读到的,如果程序崩溃,.prof文件仍然可以工作 为了测试它是否是我的特定程序的配置,我编写了以下代码:带有崩溃Haskell程序的空.prof文件(在Windows上),haskell,profiling,ghc,Haskell,Profiling,Ghc,我试图通过分析来诊断程序中的无限循环。因为我必须用Ctrl-C中途中止程序,.prof文件保持为空。根据我所读到的,如果程序崩溃,.prof文件仍然可以工作 为了测试它是否是我的特定程序的配置,我编写了以下代码: module Main ( main ) where testInf = map (+1) [1..] main = do print (show testInf) 我正在使用Leksah,配置生成以下.cabal文件: name: tests version:
module Main (
main
) where
testInf = map (+1) [1..]
main = do
print (show testInf)
我正在使用Leksah,配置生成以下.cabal文件:
name: tests
version: 0.0.1
cabal-version: >=1.2
build-type: Simple
license: AllRightsReserved
license-file: ""
description:
data-dir: ""
executable tests
build-depends: base -any
main-is: Main.hs
buildable: True
hs-source-dirs: src
ghc-options: -prof -auto-all
然后通过运行tests+RTS-p
执行程序。当我用Crl-C终止程序时,.prof文件是0kb。如果我更改程序,使其不会无限运行,那么一旦完成,它将生成一个完整的.prof文件
其他详细信息
- 阴谋集团:
使用阴谋集团库1.16.0版
- GHC:
Glasgow Haskell编译器,7.6.3版,第2阶段,由GHC 7.4.1版启动
systemctl
运行我的程序时,我遇到了同样的问题
我发送了一个SIGTERM
信号,得到了一个空的*.prof
文件
但是,发送SIGINT
信号会给我.prof
文件
在GHC的信号处理方面做一些挖掘:
这告诉我们如何处理SIGINT
:
* SIGINT handler.
*
* We like to shutdown nicely after receiving a SIGINT, write out the
* stats, write profiling info, close open files and flush buffers etc.
而且:
So the first ^C tries to exit the program
// cleanly, and the second one just kills it.
因此,如果按一次
^C(SIGINT)
,程序尚未退出,它可能仍在写入*。prof
文件+执行其他清理。第二个^C(SIGINT)
只是终止,留下一个空的*.prof文件。注意:程序崩溃/=
使用Ctrl+C
发送中断信号。虽然程序最终因内存不足错误而崩溃,但结果仍然相同。如果有人有答案。。。知道是否有解决方案是很方便的。也许你想用-xc编译以在它死后获得堆栈跟踪?