1. 02 Nov, 2011 11 commits
    • Simon Marlow's avatar
      Overhaul of infrastructure for profiling, coverage (HPC) and breakpoints · 7bb0447d
      Simon Marlow authored
      User visible changes
      ====================
      
      Profilng
      --------
      
      Flags renamed (the old ones are still accepted for now):
      
        OLD            NEW
        ---------      ------------
        -auto-all      -fprof-auto
        -auto          -fprof-exported
        -caf-all       -fprof-cafs
      
      New flags:
      
        -fprof-auto              Annotates all bindings (not just top-level
                                 ones) with SCCs
      
        -fprof-top               Annotates just top-level bindings with SCCs
      
        -fprof-exported          Annotates just exported bindings with SCCs
      
        -fprof-no-count-entries  Do not maintain entry counts when profiling
                                 (can make profiled code go faster; useful with
                                 heap profiling where entry counts are not used)
      
      Cost-centre stacks have a new semantics, which should in most cases
      result in more useful and intuitive profiles.  If you find this not to
      be the case, please let me know.  This is the area where I have been
      experimenting most, and the current solution is probably not the
      final version, however it does address all the outstanding bugs and
      seems to be better than GHC 7.2.
      
      Stack traces
      ------------
      
      +RTS -xc now gives more information.  If the exception originates from
      a CAF (as is common, because GHC tends to lift exceptions out to the
      top-level), then the RTS walks up the stack and reports the stack in
      the enclosing update frame(s).
      
      Result: +RTS -xc is much more useful now - but you still have to
      compile for profiling to get it.  I've played around a little with
      adding 'head []' to GHC itself, and +RTS -xc does pinpoint the problem
      quite accurately.
      
      I plan to add more facilities for stack tracing (e.g. in GHCi) in the
      future.
      
      Coverage (HPC)
      --------------
      
       * derived instances are now coloured yellow if they weren't used
       * likewise record field names
       * entry counts are more accurate (hpc --fun-entry-count)
       * tab width is now correct (markup was previously off in source with
         tabs)
      
      Internal changes
      ================
      
      In Core, the Note constructor has been replaced by
      
              Tick (Tickish b) (Expr b)
      
      which is used to represent all the kinds of source annotation we
      support: profiling SCCs, HPC ticks, and GHCi breakpoints.
      
      Depending on the properties of the Tickish, different transformations
      apply to Tick.  See CoreUtils.mkTick for details.
      
      Tickets
      =======
      
      This commit closes the following tickets, test cases to follow:
      
        - Close #2552: not a bug, but the behaviour is now more intuitive
          (test is T2552)
      
        - Close #680 (test is T680)
      
        - Close #1531 (test is result001)
      
        - Close #949 (test is T949)
      
        - Close #2466: test case has bitrotted (doesn't compile against current
          version of vector-space package)
      7bb0447d
    • Simon Marlow's avatar
      fix time calculation for retainer profiling · bd72eeb1
      Simon Marlow authored
      bd72eeb1
    • Simon Marlow's avatar
      0047d2c3
    • Simon Marlow's avatar
      fix doc bugs · e3143e85
      Simon Marlow authored
      The description of GHC's divergence from the FFI spec was in the wrong
      place, and the xref was broken.
      e3143e85
    • Simon Marlow's avatar
    • Simon Marlow's avatar
      minor bugfix for 'make re2' etc. · 49c01f4b
      Simon Marlow authored
      49c01f4b
    • Simon Marlow's avatar
    • Simon Marlow's avatar
      For the location on a record selector binding, use the location of the · d4c20a1b
      Simon Marlow authored
      record selector identifier in the data declaration.  Previously the
      location was pointing to the TyCon in the source, which was clearly
      wrong, and the new way gives more useful information from HPC: if a
      record selector is never used, the markup will shade the identifier
      yellow.
      d4c20a1b
    • Simon Peyton Jones's avatar
      Add a base size when computing max-ticks, · 4921136b
      Simon Peyton Jones authored
      to deal with very small programs (like zero)
      4921136b
    • Simon Peyton Jones's avatar
    • Simon Peyton Jones's avatar
      Fix Trac #5592: unused-import warnings with dot-dot notation · 0f6ab776
      Simon Peyton Jones authored
      A subtle interaction between two complicate features!
      0f6ab776
  2. 01 Nov, 2011 13 commits
  3. 31 Oct, 2011 10 commits
  4. 30 Oct, 2011 1 commit
  5. 27 Oct, 2011 5 commits
    • Duncan Coutts's avatar
      Allow the -t -T -s -S flags (without <file> arg!) in -rtsopts=some mode · 6dfd9016
      Duncan Coutts authored
      Without any <file> arg, these flags just dump info to stderr so
      are at most a mild information disclosure danger. We disallow
      a <file> arg in the default -rtsopts=some mode since that will
      overwrite the given file.
      6dfd9016
    • Duncan Coutts's avatar
      Change what +RTS options are available by default · 8c7ad0bd
      Duncan Coutts authored
      Ticket #3910 originally pointed out that the RTS options are a potential
      security problem. For example the -t -s or -S flags can be used to
      overwrite files. This would be bad in the context of CGI scripts or
      setuid binaries. So we introduced a system where +RTS processing is more
      or less disabled unless you pass the -rtsopts flag at link time.
      
      This scheme is safe enough but it also really annoies users. They have
      to use -rtsopts in many circumstances: with -threaded to use -N, with
      -eventlog to use -l, with -prof to use any of the profiling flags. Many
      users just set -rtsopts globally or in project .cabal files. Apart from
      annoying users it reduces security because it means that deployed
      binaries will have all RTS options enabled rather than just profiling
      ones.
      
      This patch relaxes the set of RTS options that are available in the
      default -rtsopts=some case. For "deployment" ways like vanilla and
      -threaded we remain quite conservative. Only --info -? --help are
      allowed for vanilla. For -threaded, -N and -N<x> are allowed with a
      check that x <= num cpus.
      
      For "developer" ways like -debug, -eventlog, -prof, we allow all the
      options that are special to that way. Some of these allow writing files,
      but the file written is not directly under the control of the attacker.
      For the setuid case (where the attacker would have control over binary
      name, current dir, local symlinks etc) we check if the process is
      running setuid/setgid and refuse all RTS option processing. Users would
      need to use -rtsopts=all in this case.
      
      We are making the assumption that developers will not deploy binaries
      built in the -debug, -eventlog, -prof ways. And even if they do, the
      damage should be limited to DOS, information disclosure and writing
      files like <progname>.eventlog, not arbitrary files.
      8c7ad0bd
    • Duncan Coutts's avatar
      Use signed comparison for +RTS -N x <= 0 test · 43a92710
      Duncan Coutts authored
      Otherwise we can use +RTS -N-1 and get 2^32 or 2^64 capabilities
      which doesn't work out so well...
      43a92710
    • Duncan Coutts's avatar
    • Duncan Coutts's avatar
      Add an RTS eventlog tracing class for user messages · aaaaf67b
      Duncan Coutts authored
      Enables people to turn them on/off. Defaults to on.
      aaaaf67b