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

Ben Gamari gitlab at gitlab.haskell.org
Thu Oct 29 16:37:56 UTC 2020



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


Commits:
f91ff21c by Ben Gamari at 2020-10-29T12:37:07-04:00
Enable -fexpose-all-symbols when debug level is set

- - - - -


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 > 0     = 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-all-symbols`
 
     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-internals-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/f91ff21ca0f329956e69cb266dbab96049ecd924

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f91ff21ca0f329956e69cb266dbab96049ecd924
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/20201029/652d1f06/attachment-0001.html>


More information about the ghc-commits mailing list