Segmentation fault when .prof file not writeable
To reproduce:
$ echo 'main = return ()' > Test.hs
$ touch Test.prof
$ chmod -w Test.prof
$ ghc -prof Test.hs
[1 of 1] Compiling Main ( Test.hs, Test.o )
Linking Test ...
$ ./Test +RTS -hr{} -hc
Can't open profiling report file Test.prof
Segmentation fault (core dumped)
The warning is ok (maybe it should be an error?), but it shouldn't segfault.
Running ./Test +RTS -hr
works fine.
http://downloads.haskell.org/~ghc/master/users-guide/profiling.html#rts-options-for-heap-profiling:
-
-hc
: Breaks down the graph by the cost-centre stack which produced the data. -
-hr⟨cc⟩
: Restrict the profile to closures with retainer sets containing cost-centre stacks with one of the specified cost centres at the top.
Bug exists since dbef766c (2002):
- you can now restrict a heap profile to certain retainer sets,
but still display by cost centre (or type, or closure or
whatever).
Because it didn't update this code+comment introduced in db61851c (2001):
// The following line was added by Sung; retainer/LDV profiling may need
// two output files, i.e., <program>.prof/hp.
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER)
RtsFlags.ProfFlags.doHeapProfile = 0;
Another relevant commit a4e17de6:
Author: simonmar <unknown>
Date: Wed Nov 28 15:42:26 2001 +0000
[project @ 2001-11-28 15:42:26 by simonmar]
Don't need the .prof file when LDV-profiling.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | low |
Resolution | Unresolved |
Component | Profiling |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |