[Git][ghc/ghc][wip/local-symbols-2] Enable -fexpose-all-symbols when debug level >=2

Ben Gamari gitlab at gitlab.haskell.org
Sat Oct 31 19:20:29 UTC 2020



Ben Gamari pushed to branch wip/local-symbols-2 at Glasgow Haskell Compiler / GHC


Commits:
e3071f56 by Ben Gamari at 2020-10-31T15:20:18-04:00
Enable -fexpose-all-symbols when debug level >=2

- - - - -


3 changed files:

- compiler/GHC/Driver/Session.hs
- docs/users_guide/debug-info.rst
- docs/users_guide/phases.rst


Changes:

=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -4392,7 +4392,13 @@ setVerbosity :: Maybe Int -> DynP ()
 setVerbosity mb_n = upd (\dfs -> dfs{ verbosity = mb_n `orElse` 3 })
 
 setDebugLevel :: Maybe Int -> DynP ()
-setDebugLevel mb_n = upd (\dfs -> dfs{ debugLevel = mb_n `orElse` 2 })
+setDebugLevel mb_n =
+  upd (\dfs -> exposeSyms $ dfs{ debugLevel = n })
+  where
+    n = mb_n `orElse` 2
+    exposeSyms
+      | n > 2     = setGeneralFlag' Opt_ExposeInternalSymbols
+      | otherwise = id
 
 data PkgDbRef
   = GlobalPkgDb


=====================================
docs/users_guide/debug-info.rst
=====================================
@@ -14,6 +14,7 @@ useable by most UNIX debugging tools.
     :category: debugging
 
     :since: 7.10, numeric levels since 8.0
+    :implies: :ghc-flag:`-fexpose-internal-symbols` when ⟨n⟩ >= 2.
 
     Emit debug information in object code. Currently only DWARF debug
     information is supported on x86-64 and i386. Currently debug levels 0


=====================================
docs/users_guide/phases.rst
=====================================
@@ -728,10 +728,11 @@ Options affecting code generation
     Request that GHC emits verbose symbol tables which include local symbols
     for module-internal functions. These can be useful for tools like
     :ref:`perf <https://perf.wiki.kernel.org/>` but increase object file sizes.
+    This is implied by :ghc-flag:`-g2 <-g>` and above.
 
-    :ghc-flag:`-fno-expose-internal-symbols` suppresses all non-global symbol
-    table entries, resulting in smaller object file sizes at the expense of
-    debuggability.
+    :ghc-flag:`-fno-expose-internal-symbols <-fexpose-internal-symbols>`
+    suppresses all non-global symbol table entries, resulting in smaller object
+    file sizes at the expense of debuggability.
 
 .. _options-linker:
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3071f569b9383d58e966929f784278fe38f6eed

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3071f569b9383d58e966929f784278fe38f6eed
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201031/5cb441ef/attachment-0001.html>


More information about the ghc-commits mailing list