Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,260
    • Issues 5,260
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 572
    • Merge requests 572
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #11489
Closed
Open
Issue created Jan 25, 2016 by Thomas Miedema@thomie

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking