• thomie's avatar
    Fix segmentation fault when .prof file not writeable · 6d2bdfd8
    thomie authored
    There are two ways to do retainer profiling. Quoting from the user's guide:
      1. `+RTS -hr` "Breaks down the graph by retainer set"
      2. `+RTS -hr<cc> -h<x>`, where `-h<x>` is one of normal heap profiling
         break-down options (e.g. `-hc`), and `-hr<cc> means "Restrict the
         profile to closures with retainer sets containing cost-centre
         stacks with one of the specified cost centres at the top."
    Retainer profiling writes to a .hp file, like the other heap profiling
    options, but also to a .prof file. Therefore, when the .prof file is not
    writeable for whatever reason, retainer profiling should be turned off
    This worked ok when running the program with `+RTS -hr` (option 1), but a
    segfault would occur when using `+RTS -hr<cc> -h<x>`, with `x!=r` (option 2).
    This commit fixes that.
    Reviewed by: bgamari
    Differential Revision: https://phabricator.haskell.org/D1849
    GHC Trac Issues: #11489
all.T 4.28 KB