Ticket #3693: Compiler-StackTraces.dpatch

File Compiler-StackTraces.dpatch, 83.1 KB (added by batterseapower, 4 years ago)
Line 
16 patches for repository /Users/mbolingbroke/Programming/Checkouts/ghc.head:
2
3Thu Apr 22 18:27:07 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
4  * Determine referrers for internal names while tidying, so System Names get better tidied OccNames
5
6Mon Apr 26 23:01:43 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
7  * Support for reifying STG stack traces in Haskell
8 
9  This consists of four main pieces:
10   1. A new primop (raiseWithStack#) and a change to the signature of catch#
11      so that the exception handler receives a reified stack as one argument.
12   2. Changes to the RTS to supply a reified stack to the handler from catch#
13      upon a synchronous or asynchronous exception. This includes some RTS options
14      allowing the stack reification process to be controlled a little.
15   3. Emission of a char* field in the StgRetInfoTable structures generated from
16      Haskell and STG which describes approximately where the return point came
17      from in terms of Haskell source files. This is what is supplied to the Haskell
18      side as a reified stack.
19   4. A change to the base libraries so there are nice Haskell-ish wrappers around
20      the new primops. This change is reflected in a small tweak I had to make to
21      ghc/InteractiveUI.hs (so you need the base library patch for this one to work).
22 
23  If IA64 support is not already thoroughly broken, this patch will have broken it.
24  This is because I repurposed some code from the IA64 Adjustor to create a general
25  utility function for allocating ByteArray#.
26 
27
28Wed Apr 28 23:20:02 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
29  * Add the -strip-stack-info flag, which uses objcopy and RTS hooks to remove the .ghc_debug section from the binary
30
31Thu Apr 29 08:48:54 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
32  * Add missing RTS file for stack trace support
33
34Thu Apr 29 12:50:48 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
35  * Documentation for flags related to stack traces
36
37Thu Apr 29 20:55:53 BST 2010  Max Bolingbroke <batterseapower@hotmail.com>
38  * Fix Linker.c so it deals with .ghc_debug sections in PE images
39
40New patches:
41
42[Determine referrers for internal names while tidying, so System Names get better tidied OccNames
43Max Bolingbroke <batterseapower@hotmail.com>**20100422172707
44 Ignore-this: c9a2fc3398ebfa023e1deda1452ba21c
45] {
46hunk ./compiler/main/TidyPgm.lhs 48
47 import Util
48 import FastString
49 
50+import Data.Either      ( partitionEithers )
51 import Data.List       ( sortBy )
52 import Data.IORef      ( IORef, readIORef, writeIORef )
53 \end{code}
54hunk ./compiler/main/TidyPgm.lhs 600
55 chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_rules
56   = do { (unfold_env1,occ_env1) <- search init_work_list emptyVarEnv init_occ_env
57        ; let internal_ids = filter (not . (`elemVarEnv` unfold_env1)) binders
58-       ; tidy_internal internal_ids unfold_env1 occ_env1 }
59+             internal_referrers = find_int_referrers (mkVarEnv (all_external_binders `zip` all_external_binders))
60+                                                     [] (flattenBinds $ binds ++ implicit_binds)
61+       ; tidy_internal (map (\x -> (x, lookupVarEnv internal_referrers x)) internal_ids) unfold_env1 occ_env1 }
62  where
63   nc_var = hsc_NC hsc_env
64 
65hunk ./compiler/main/TidyPgm.lhs 628
66   implicit_binders = bindersOfBinds implicit_binds
67   binder_set       = mkVarSet binders
68 
69-  avoids   = [getOccName name | bndr <- binders ++ implicit_binders,
70-                                let name = idName bndr,
71-                                isExternalName name ]
72+  all_external_binders = filter (isExternalName . idName) binders ++ implicit_binders
73+  avoids               = map (getOccName . idName) all_external_binders
74                -- In computing our "avoids" list, we must include
75                --      all implicit Ids
76                --      all things with global names (assigned once and for
77hunk ./compiler/main/TidyPgm.lhs 665
78   search ((idocc,referrer) : rest) unfold_env occ_env
79     | idocc `elemVarEnv` unfold_env = search rest unfold_env occ_env
80     | otherwise = do
81-      (occ_env', name') <- tidyTopName mod nc_var (Just referrer) occ_env idocc
82+      (occ_env', name') <- tidyTopName mod nc_var True (Just referrer) occ_env idocc
83       let
84           (new_ids, show_unfold)
85                 | omit_prags = ([], False)
86hunk ./compiler/main/TidyPgm.lhs 683
87       --
88       search (zip new_ids (repeat referrer') ++ rest) unfold_env' occ_env'
89 
90-  tidy_internal :: [Id] -> UnfoldEnv -> TidyOccEnv
91+  -- We want to find good referrer information even for internal binders that never got externalised.
92+  -- The only reason for this is that they might show up in STG stack traces, in which case we want their
93+  -- OccNames to be at least somewhat close to where they might have originated from in the user's input program.
94+  find_int_referrers internal_referrers [] internalish
95+    | null externalish' = internal_referrers
96+    | otherwise         = find_int_referrers internal_referrers externalish' internalish'
97+    where split_one (x, e) = case lookupVarEnv internal_referrers x of Just referrer -> Left (referrer, e); Nothing -> Right (x, e)
98+          (externalish', internalish') = partitionEithers $ map split_one internalish
99+  find_int_referrers internal_referrers ((referrer, e):externalish) internalish
100+    = find_int_referrers internal_referrers' externalish internalish
101+    where internal_referrers' = foldr (\x m -> extendVarEnv m x referrer) internal_referrers $
102+                                    filter (\v -> not $ elemVarEnv v internal_referrers) $ snd (exprFvsInOrder e)
103+
104+  tidy_internal :: [(Id, Maybe Id)] -> UnfoldEnv -> TidyOccEnv
105                 -> IO (UnfoldEnv, TidyOccEnv)
106   tidy_internal []       unfold_env occ_env = return (unfold_env,occ_env)
107hunk ./compiler/main/TidyPgm.lhs 699
108-  tidy_internal (id:ids) unfold_env occ_env = do
109-      (occ_env', name') <- tidyTopName mod nc_var Nothing occ_env id
110+  tidy_internal ((id, mb_referrer):ids) unfold_env occ_env = do
111+      (occ_env', name') <- tidyTopName mod nc_var False mb_referrer occ_env id
112       let unfold_env' = extendVarEnv unfold_env id (name',False)
113       tidy_internal ids unfold_env' occ_env'
114 
115hunk ./compiler/main/TidyPgm.lhs 804
116 -- we intend to externalise it.
117 
118 \begin{code}
119-tidyTopName :: Module -> IORef NameCache -> Maybe Id -> TidyOccEnv
120+tidyTopName :: Module -> IORef NameCache -> Bool -> Maybe Id -> TidyOccEnv
121            -> Id -> IO (TidyOccEnv, Name)
122hunk ./compiler/main/TidyPgm.lhs 806
123-tidyTopName mod nc_var maybe_ref occ_env id
124+tidyTopName mod nc_var external maybe_ref occ_env id
125   | global && internal = return (occ_env, localiseName name)
126 
127   | global && external = return (occ_env, name)
128hunk ./compiler/main/TidyPgm.lhs 835
129   | otherwise = panic "tidyTopName"
130   where
131     name       = idName id
132-    external    = isJust maybe_ref
133     global     = isExternalName name
134     local      = not global
135     internal   = not external
136hunk ./compiler/main/TidyPgm.lhs 838
137-    loc                = nameSrcSpan name
138+    loc         = nameSrcSpan (if isSystemName name then maybe name idName maybe_ref else name)
139+     -- Using the SrcLoc from the referrer for system names gives us better
140+     -- information for use in stack traces
141 
142     old_occ     = nameOccName name
143     new_occ
144}
145[Support for reifying STG stack traces in Haskell
146Max Bolingbroke <batterseapower@hotmail.com>**20100426220143
147 Ignore-this: abfac1504883f5eb20758bef8e41f301
148 
149 This consists of four main pieces:
150  1. A new primop (raiseWithStack#) and a change to the signature of catch#
151     so that the exception handler receives a reified stack as one argument.
152  2. Changes to the RTS to supply a reified stack to the handler from catch#
153     upon a synchronous or asynchronous exception. This includes some RTS options
154     allowing the stack reification process to be controlled a little.
155  3. Emission of a char* field in the StgRetInfoTable structures generated from
156     Haskell and STG which describes approximately where the return point came
157     from in terms of Haskell source files. This is what is supplied to the Haskell
158     side as a reified stack.
159  4. A change to the base libraries so there are nice Haskell-ish wrappers around
160     the new primops. This change is reflected in a small tweak I had to make to
161     ghc/InteractiveUI.hs (so you need the base library patch for this one to work).
162 
163 If IA64 support is not already thoroughly broken, this patch will have broken it.
164 This is because I repurposed some code from the IA64 Adjustor to create a general
165 utility function for allocating ByteArray#.
166 
167] {
168hunk ./compiler/cmm/Cmm.hs 181
169                         --               Nothing: a 1-word gap
170                        -- Start of list is the *young* end
171       C_SRT
172+      (Maybe RetDescription)
173 
174 data CmmReturnInfo = CmmMayReturn
175                    | CmmNeverReturns
176hunk ./compiler/cmm/Cmm.hs 192
177 type ClosureLayout = (StgHalfWord, StgHalfWord) -- ptrs, nptrs
178 type ConstrTag = StgHalfWord
179 type ConstrDescription = CmmLit
180+type RetDescription = CmmLit -- Description of return point, for use in user-visible stack traces
181 type FunArity = StgHalfWord
182 type SlowEntry = CmmLit
183   -- We would like this to be a CLabel but
184hunk ./compiler/cmm/Cmm.hs 404
185   | Data
186   | ReadOnlyData
187   | RelocatableReadOnlyData
188+  | RelocatableDebugData -- .ghc_debug section: similar to RelocatableReadOnlyData, but used to store stack trace data
189   | UninitialisedData
190   | ReadOnlyData16     -- .rodata.cst16 on x86_64, 16-byte aligned
191   | OtherSection String
192hunk ./compiler/cmm/CmmBuildInfoTables.hs 425
193             (FunInfo    c s a d e)  -> FunInfo c (toSrt s) a d e
194             (ThunkInfo  c s)        -> ThunkInfo c (toSrt s)
195             (ThunkSelectorInfo x s) -> ThunkSelectorInfo x (toSrt s)
196-            (ContInfo v s)          -> ContInfo (toVars v) (toSrt s)
197+            (ContInfo v s d)        -> ContInfo (toVars v) (toSrt s) d
198 updInfoTbl _ _ t@(CmmInfo _ _ CmmNonInfoTable) = t
199   
200 -- Lower the CmmTopForInfoTables type down to good old CmmTopZ
201hunk ./compiler/cmm/CmmCPS.hs 277
202     where
203       -- User written continuations
204       selectContinuationFormat' (Continuation
205-                          (Right (CmmInfo _ _ (CmmInfoTable _ _ _ (ContInfo format _))))
206+                          (Right (CmmInfo _ _ (CmmInfoTable _ _ _ (ContInfo format _ _))))
207                           label formals _ _) =
208           (formals, Just label, format)
209       -- Either user written non-continuation code
210hunk ./compiler/cmm/CmmCPS.hs 385
211 -- User written continuations
212 applyContinuationFormat formats
213    (Continuation (Right (CmmInfo gc update_frame
214-                             (CmmInfoTable clos prof tag (ContInfo _ srt))))
215+                             (CmmInfoTable clos prof tag (ContInfo _ srt descr))))
216                  label formals is_gc blocks) =
217hunk ./compiler/cmm/CmmCPS.hs 387
218-    Continuation (CmmInfo gc update_frame (CmmInfoTable clos prof tag (ContInfo format srt)))
219+    Continuation (CmmInfo gc update_frame (CmmInfoTable clos prof tag (ContInfo format srt descr)))
220                  label formals is_gc blocks
221     where
222       format = continuation_stack $ maybe unknown_block id $ lookup label formats
223hunk ./compiler/cmm/CmmCPS.hs 401
224 -- CPS generated continuations
225 applyContinuationFormat formats (Continuation
226                           (Left srt) label formals is_gc blocks) =
227-    Continuation (CmmInfo gc Nothing (CmmInfoTable undefined prof tag (ContInfo (continuation_stack $ format) srt)))
228+    Continuation (CmmInfo gc Nothing (CmmInfoTable undefined prof tag (ContInfo (continuation_stack $ format) srt Nothing)))
229                  label formals is_gc blocks
230     where
231       gc = Nothing -- Generated continuations never need a stack check
232hunk ./compiler/cmm/CmmInfo.hs 35
233 emptyContInfoTable :: CmmInfo
234 emptyContInfoTable =
235   CmmInfo Nothing Nothing (CmmInfoTable False (ProfilingInfo zero zero) rET_SMALL
236-                                              (ContInfo [] NoC_SRT))
237+                                              (ContInfo [] NoC_SRT Nothing))
238     where zero = CmmInt 0 wordWidth
239 
240 cmmToRawCmm :: [Cmm] -> IO [RawCmm]
241hunk ./compiler/cmm/CmmInfo.hs 135
242                 std_info = mkStdInfoTable ty_prof' cl_prof' type_tag 0 (mkWordCLit offset)
243 
244           -- A continuation/return-point.
245-          ContInfo stack_layout srt ->
246+          ContInfo stack_layout srt mb_descr ->
247               liveness_data ++
248hunk ./compiler/cmm/CmmInfo.hs 137
249-              mkInfoTableAndCode info_label std_info srt_label entry_label
250+              mkInfoTableAndCode info_label std_info (descr_lit : srt_label) entry_label
251                                  arguments blocks
252               where
253                 std_info = mkStdInfoTable ty_prof' cl_prof' maybe_big_type_tag srt_bitmap
254hunk ./compiler/cmm/CmmInfo.hs 148
255                                      then liveness_tag
256                                      else type_tag
257                 (srt_label, srt_bitmap) = mkSRTLit info_label srt
258+                dummy_relative_ref = CmmLabelDiffOff info_label info_label 0 -- Value of the right width, with sentinel value 0
259+                descr_lit = maybe dummy_relative_ref (makeRelativeRefTo info_label) mb_descr
260 
261 -- Generate a bare info table, not attached to any procedure.
262 mkBareInfoTable :: CLabel -> Unique -> CmmInfoTable -> [CmmTopZ]
263hunk ./compiler/cmm/CmmParse.y 322
264                -- closure type (no live regs)
265                {% withThisPackage $ \pkg ->
266                   do let infoLabel = mkCmmInfoLabel pkg $3
267+                     stk_lit <- code $ emitStackLabel $3
268                      return (mkCmmRetLabel pkg $3,
269                        CmmInfoTable False (ProfilingInfo zeroCLit zeroCLit) (fromIntegral $5)
270hunk ./compiler/cmm/CmmParse.y 325
271-                                    (ContInfo [] NoC_SRT),
272+                                    (ContInfo [] NoC_SRT (Just stk_lit)),
273                        []) }
274 
275        | 'INFO_TABLE_RET' '(' NAME ',' INT ',' formals_without_hints0 ')'
276hunk ./compiler/cmm/CmmParse.y 332
277                -- closure type, live regs
278                {% withThisPackage $ \pkg ->
279                   do live <- sequence (map (liftM Just) $7)
280+                     stk_lit <- code $ emitStackLabel $3
281                      return (mkCmmRetLabel pkg $3,
282                        CmmInfoTable False (ProfilingInfo zeroCLit zeroCLit) (fromIntegral $5)
283hunk ./compiler/cmm/CmmParse.y 335
284-                                    (ContInfo live NoC_SRT),
285+                                    (ContInfo live NoC_SRT (Just stk_lit)),
286                        live) }
287 
288 body   :: { ExtCode }
289hunk ./compiler/cmm/CmmParse.y 609
290 section "data"          = Data
291 section "rodata" = ReadOnlyData
292 section "relrodata" = RelocatableReadOnlyData
293+section "relghcdebug" = RelocatableDebugData
294 section "bss"   = UninitialisedData
295 section s       = OtherSection s
296 
297hunk ./compiler/cmm/PprCmm.hs 196
298 pprTypeInfo (ThunkSelectorInfo offset srt) =
299     vcat [ptext (sLit "ptrs: ") <> integer (toInteger offset),
300           ptext (sLit "srt: ") <> ppr srt]
301-pprTypeInfo (ContInfo stack srt) =
302+pprTypeInfo (ContInfo stack srt mb_descr) =
303     vcat [ptext (sLit "stack: ") <> ppr stack,
304hunk ./compiler/cmm/PprCmm.hs 198
305-          ptext (sLit "srt: ") <> ppr srt]
306+          ptext (sLit "srt: ") <> ppr srt,
307+          ptext (sLit "descr: ") <> maybe (ptext (sLit "<none>")) pprLit mb_descr]
308 
309 -- Temp Jan08
310 argDescrType :: ArgDescr -> StgHalfWord
311hunk ./compiler/cmm/PprCmm.hs 620
312     ReadOnlyData16    -> section <+> doubleQuotes (ptext (sLit "readonly16"))
313     RelocatableReadOnlyData
314                       -> section <+> doubleQuotes (ptext (sLit "relreadonly"))
315+    RelocatableDebugData
316+                      -> section <+> doubleQuotes (ptext (sLit "relghcdebug"))
317     UninitialisedData -> section <+> doubleQuotes (ptext (sLit "uninitialised"))
318     OtherSection s'   -> section <+> doubleQuotes (text s')
319  where
320hunk ./compiler/codeGen/CgInfoTbls.hs 141
321 emitReturnTarget name stmts
322   = do { srt_info   <- getSRTInfo
323        ; blks <- cgStmtsToBlocks stmts
324+        ; stk_lit <- emitStackLabel =<< getStackLabel -- TODO: decorate with ReturnTarget-specifiec info
325         ; frame <- mkStackLayout
326hunk ./compiler/codeGen/CgInfoTbls.hs 143
327-        ; let info = CmmInfo
328+        ; let ret_descr = makeRelativeRefTo info_lbl stk_lit
329+              info = CmmInfo
330                        gc_target
331                        Nothing
332                        (CmmInfoTable False
333hunk ./compiler/codeGen/CgInfoTbls.hs 150
334                         (ProfilingInfo zeroCLit zeroCLit)
335                         rET_SMALL -- cmmToRawCmm may convert it to rET_BIG
336-                        (ContInfo frame srt_info))
337+                        (ContInfo frame srt_info (Just ret_descr)))
338         ; emitInfoTableAndCode (infoLblToEntryLbl info_lbl) info args blks
339        ; return info_lbl }
340   where
341hunk ./compiler/codeGen/CgMonad.lhs 25
342        noCgStmts, oneCgStmt, consCgStmt,
343 
344        getCmm,
345-       emitData, emitProc, emitSimpleProc,
346+       emitData, emitProc, emitSimpleProc, emitStackLabel,
347 
348        forkLabelledCode,
349        forkClosureBody, forkStatics, forkAlts, forkEval,
350hunk ./compiler/codeGen/CgMonad.lhs 35
351        EndOfBlockInfo(..),
352        setEndOfBlockInfo, getEndOfBlockInfo,
353 
354+       setStackLabel, getStackLabel,
355        setSRT, getSRT,
356        setSRTLabel, getSRTLabel,
357        setTickyCtrLabel, getTickyCtrLabel,
358hunk ./compiler/codeGen/CgMonad.lhs 79
359 import Unique
360 import Util()
361 import UniqSupply
362-import FastString()
363+import FastString
364 import Outputable
365 
366 import Control.Monad
367hunk ./compiler/codeGen/CgMonad.lhs 102
368 \begin{code}
369 data CgInfoDownwards   -- information only passed *downwards* by the monad
370   = MkCgInfoDown {
371-       cgd_dflags  :: DynFlags,
372-       cgd_mod     :: Module,          -- Module being compiled
373-       cgd_statics :: CgBindings,      -- [Id -> info] : static environment
374-       cgd_srt_lbl :: CLabel,          -- label of the current SRT
375-        cgd_srt     :: SRT,            -- the current SRT
376-       cgd_ticky   :: CLabel,          -- current destination for ticky counts
377-       cgd_eob     :: EndOfBlockInfo   -- Info for stuff to do at end of basic block:
378+       cgd_dflags    :: DynFlags,
379+       cgd_mod       :: Module,                -- Module being compiled
380+       cgd_stack_lbl :: FastString,            -- Human-readable label derived from enclosing binder, for insertion into backtraces
381+       cgd_statics   :: CgBindings,    -- [Id -> info] : static environment
382+       cgd_srt_lbl   :: CLabel,                -- label of the current SRT
383+        cgd_srt       :: SRT,          -- the current SRT
384+       cgd_ticky     :: CLabel,                -- current destination for ticky counts
385+       cgd_eob       :: EndOfBlockInfo -- Info for stuff to do at end of basic block:
386   }
387 
388 initCgInfoDown :: DynFlags -> Module -> CgInfoDownwards
389hunk ./compiler/codeGen/CgMonad.lhs 114
390 initCgInfoDown dflags mod
391-  = MkCgInfoDown {     cgd_dflags  = dflags,
392-                       cgd_mod     = mod,
393-                       cgd_statics = emptyVarEnv,
394-                       cgd_srt_lbl = error "initC: srt_lbl",
395-                       cgd_srt     = error "initC: srt",
396-                       cgd_ticky   = mkTopTickyCtrLabel,
397-                       cgd_eob     = initEobInfo }
398+  = MkCgInfoDown {     cgd_dflags    = dflags,
399+                       cgd_mod       = mod,
400+                       cgd_stack_lbl = error "initC: cgd_stack_lbl",
401+                       cgd_statics   = emptyVarEnv,
402+                       cgd_srt_lbl   = error "initC: srt_lbl",
403+                       cgd_srt       = error "initC: srt",
404+                       cgd_ticky     = mkTopTickyCtrLabel,
405+                       cgd_eob       = initEobInfo }
406 
407 data CgState
408   = MkCgState {
409hunk ./compiler/codeGen/CgMonad.lhs 762
410        ; blks <- cgStmtsToBlocks stmts
411        ; emitProc (CmmInfo Nothing Nothing CmmNonInfoTable) lbl [] blks }
412 
413+emitStackLabel :: FastString -> FCode CmmLit
414+emitStackLabel fs = do
415+   clabel <- liftM mkStringLitLabel newUnique
416+   emitData RelocatableDebugData [CmmDataLabel clabel, CmmString (bytesFS fs)]
417+   return $ CmmLabel clabel
418+
419+
420 getCmm :: Code -> FCode Cmm
421 -- Get all the CmmTops (there should be no stmts)
422 -- Return a single Cmm which may be split from other Cmms by
423hunk ./compiler/codeGen/CgMonad.lhs 848
424        info <- getInfoDown
425        return (cgd_eob info)
426 
427+-- ----------------------------------------------------------------------------
428+-- Get/set the binder used for stack traces
429+
430+getStackLabel :: FCode FastString
431+getStackLabel = liftM cgd_stack_lbl getInfoDown
432+
433+setStackLabel :: FastString -> FCode a -> FCode a
434+setStackLabel stack_lbl code
435+  = do info <- getInfoDown
436+       withInfoDown code (info { cgd_stack_lbl = stack_lbl })
437+
438 -- ----------------------------------------------------------------------------
439 -- Get/set the current SRT label
440 
441hunk ./compiler/codeGen/CodeGen.lhs 47
442 import TyCon
443 import Module
444 import ErrUtils
445+import FastString
446 import Panic
447hunk ./compiler/codeGen/CodeGen.lhs 49
448+import Outputable
449+import SrcLoc
450 \end{code}
451 
452 \begin{code}
453hunk ./compiler/codeGen/CodeGen.lhs 320
454 cgTopRhs bndr (StgRhsCon _cc con args)
455   = forkStatics (cgTopRhsCon bndr con args)
456 
457-cgTopRhs bndr (StgRhsClosure cc bi fvs upd_flag srt args body)
458-  = ASSERT(null fvs)    -- There should be no free variables
459-    setSRTLabel (mkSRTLabel (idName bndr) (idCafInfo bndr)) $
460-    setSRT srt $
461-    forkStatics (cgTopRhsClosure bndr cc bi upd_flag args body)
462+cgTopRhs bndr (StgRhsClosure cc bi fvs upd_flag srt args body) = do
463+    -- Construct a human-readable description of where we are in the code, for use in stack traces:
464+    stack_str <- topRhsStackLabel bndr
465+   
466+    ASSERT(null fvs)    -- There should be no free variables
467+      setSRTLabel (mkSRTLabel (idName bndr) (idCafInfo bndr)) $
468+      setSRT srt $
469+      setStackLabel stack_str $
470+      forkStatics (cgTopRhsClosure bndr cc bi upd_flag args body)
471+
472+
473+topRhsStackLabel :: Id -> FCode FastString
474+topRhsStackLabel bndr = do
475+    md <- getModuleName
476+    return $ mkFastString $ showSDoc $ pprModule md <> char '.' <> name_doc <+> loc_doc
477+  where
478+    name = getName bndr
479+    name_span = nameSrcSpan name
480+    name_doc = ppr (getOccName bndr) <> (if isSystemName name then char '_' <> ppr (nameUnique name) else empty)
481+    loc_doc = if isGoodSrcSpan name_span then parens (ppr name_span) else empty
482+
483 \end{code}
484 
485 
486hunk ./compiler/nativeGen/PPC/Ppr.hs 306
487        Data                    -> ptext (sLit ".data\n.align 2")
488        ReadOnlyData            -> ptext (sLit ".const\n.align 2")
489        RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 2")
490+       RelocatableDebugData    -> ptext (sLit ".section __DATA,__ghc_debug\n.align 2")
491        UninitialisedData       -> ptext (sLit ".const_data\n.align 2")
492        ReadOnlyData16          -> ptext (sLit ".const\n.align 4")
493        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
494hunk ./compiler/nativeGen/PPC/Ppr.hs 318
495        Data                    -> ptext (sLit ".data\n.align 2")
496        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 2")
497        RelocatableReadOnlyData -> ptext (sLit ".data\n\t.align 2")
498+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 2")
499        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 2")
500        ReadOnlyData16          -> ptext (sLit ".section .rodata\n\t.align 4")
501        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
502hunk ./compiler/nativeGen/SPARC/Ppr.hs 335
503        Data                    -> ptext (sLit ".data\n\t.align 8")
504        ReadOnlyData            -> ptext (sLit ".text\n\t.align 8")
505        RelocatableReadOnlyData -> ptext (sLit ".text\n\t.align 8")
506+       RelocatableDebugData    -> ptext (sLit ".section \".ghc_debug\"\n\t.align 8")
507        UninitialisedData       -> ptext (sLit ".bss\n\t.align 8")
508        ReadOnlyData16          -> ptext (sLit ".data\n\t.align 16")
509        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
510hunk ./compiler/nativeGen/X86/Ppr.hs 386
511        Data                    -> ptext (sLit ".data\n\t.align 2")
512        ReadOnlyData            -> ptext (sLit ".const\n.align 2")
513        RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 2")
514+       RelocatableDebugData    -> ptext (sLit ".section __DATA,__ghc_debug\n.align 2")
515        UninitialisedData       -> ptext (sLit ".data\n\t.align 2")
516        ReadOnlyData16          -> ptext (sLit ".const\n.align 4")
517        OtherSection _          -> panic "X86.Ppr.pprSectionHeader: unknown section"
518hunk ./compiler/nativeGen/X86/Ppr.hs 398
519        Data                    -> ptext (sLit ".data\n\t.align 4")
520        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 4")
521        RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 4")
522+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 4")
523        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 4")
524        ReadOnlyData16          -> ptext (sLit ".section .rodata\n\t.align 16")
525        OtherSection _          -> panic "X86.Ppr.pprSectionHeader: unknown section"
526hunk ./compiler/nativeGen/X86/Ppr.hs 413
527        Data                    -> ptext (sLit ".data\n.align 3")
528        ReadOnlyData            -> ptext (sLit ".const\n.align 3")
529        RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 3")
530+       RelocatableDebugData    -> ptext (sLit ".section __DATA,__ghc_debug\n.align 3")
531        UninitialisedData       -> ptext (sLit ".data\n\t.align 3")
532        ReadOnlyData16          -> ptext (sLit ".const\n.align 4")
533        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
534hunk ./compiler/nativeGen/X86/Ppr.hs 425
535        Data                    -> ptext (sLit ".data\n\t.align 8")
536        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 8")
537        RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 8")
538+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 8")
539        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 8")
540        ReadOnlyData16          -> ptext (sLit ".section .rodata.cst16\n\t.align 16")
541        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
542hunk ./compiler/prelude/primops.txt.pp 1135
543 
544 primop  CatchOp "catch#" GenPrimOp
545           (State# RealWorld -> (# State# RealWorld, a #) )
546-       -> (b -> State# RealWorld -> (# State# RealWorld, a #) )
547+       -> (b -> ByteArray# -> State# RealWorld -> (# State# RealWorld, a #) )
548        -> State# RealWorld
549        -> (# State# RealWorld, a #)
550    with
551hunk ./compiler/prelude/primops.txt.pp 1153
552       -- NB: result is bottom
553    out_of_line = True
554 
555+primop  RaiseWithStackOp "raiseWithStack#" GenPrimOp
556+   a -> ByteArray# -> b
557+   with
558+   strictness  = { \ _arity -> mkStrictSig (mkTopDmdType [lazyDmd, lazyDmd] BotRes) }
559+      -- NB: result is bottom
560+   out_of_line = True
561+
562 -- raiseIO# needs to be a primop, because exceptions in the IO monad
563 -- must be *precise* - we don't want the strictness analyser turning
564 -- one kind of bottom into another, as it is allowed to do in pure code.
565hunk ./ghc/InteractiveUI.hs 446
566                                    -- <progname>: <exception>
567                               io $ withProgName (progname st)
568                                    -- this used to be topHandlerFastExit, see #2228
569+#if __GLASGOW_HASKELL__ >= 613
570+                                 $ topHandler e [] -- TODO: supply the real stack trace
571+#else
572                                  $ topHandler e
573hunk ./ghc/InteractiveUI.hs 450
574+#endif
575             runInputTWithPrefs defaultPrefs defaultSettings $ do
576                 runCommands' handle (return Nothing)
577 
578hunk ./includes/Cmm.h 525
579 #define TICK_SLOW_CALL_p()             TICK_BUMP(SLOW_CALL_p_ctr)
580 #define TICK_SLOW_CALL_pv()            TICK_BUMP(SLOW_CALL_pv_ctr)
581 #define TICK_SLOW_CALL_pp()            TICK_BUMP(SLOW_CALL_pp_ctr)
582+#define TICK_SLOW_CALL_ppv()           TICK_BUMP(SLOW_CALL_ppv_ctr)
583 #define TICK_SLOW_CALL_ppp()           TICK_BUMP(SLOW_CALL_ppp_ctr)
584 #define TICK_SLOW_CALL_pppp()                  TICK_BUMP(SLOW_CALL_pppp_ctr)
585 #define TICK_SLOW_CALL_ppppp()         TICK_BUMP(SLOW_CALL_ppppp_ctr)
586hunk ./includes/Rts.h 230
587 DLL_IMPORT_RTS extern int    prog_argc;
588 DLL_IMPORT_RTS extern char  *prog_name;
589 
590+HsBool rtsShowsStackTraces(void);
591 void stackOverflow(void);
592 
593 void stg_exit(int n) GNU_ATTRIBUTE(__noreturn__);
594hunk ./includes/rts/Flags.h 140
595 struct MISC_FLAGS {
596     int tickInterval;     /* in milliseconds */
597     rtsBool install_signal_handlers;
598+    rtsBool showStackTraces;
599+    nat maxStackReificationDepth;
600     rtsBool machineReadable;
601     StgWord linkerMemBase;       /* address to ask the OS for memory
602                                   * for the linker, NULL ==> off */
603hunk ./includes/rts/storage/InfoTables.h 304
604 
605 typedef struct {
606 #if defined(TABLES_NEXT_TO_CODE)
607-    OFFSET_FIELD( srt_offset );        /* offset to the SRT table */
608+    OFFSET_FIELD( srt_offset );         /* offset to the SRT table */
609+    OFFSET_FIELD( ret_desc_offset );    /* offset to the name of the return point as: Package:Module.Name */
610     StgInfoTable i;
611 #else
612     StgInfoTable i;
613hunk ./includes/rts/storage/InfoTables.h 309
614-    StgSRT      *srt;  /* pointer to the SRT table */
615+    char        *ret_desc;  /* pointer to the name of the return point as: Package:Module.Name */
616+    StgSRT      *srt;       /* pointer to the SRT table */
617 #endif
618 } StgRetInfoTable;
619 
620hunk ./includes/rts/storage/InfoTables.h 373
621 #define GET_SRT(info) ((info)->srt)
622 #endif
623 
624+/*
625+ * GET_RET_DESC(info)
626+ * info must be a StgRetInfoTable*.
627+ */
628+#ifdef TABLES_NEXT_TO_CODE
629+#define GET_RET_DESC(info) (((info)->ret_desc_offset != 0) ? (char *)((StgWord)((info)+1) + (info->ret_desc_offset)) : 0)
630+#else
631+#define GET_RET_DESC(info) ((info)->ret_desc)
632+#endif
633+
634 /*
635  * GET_CON_DESC(info)
636  * info must be a StgConInfoTable*.
637hunk ./includes/stg/MiscClosures.h 122
638 RTS_ENTRY(stg_AP_STACK);
639 RTS_ENTRY(stg_dummy_ret);
640 RTS_ENTRY(stg_raise);
641+RTS_ENTRY(stg_raiseWithStack);
642 RTS_ENTRY(stg_raise_ret);
643 RTS_ENTRY(stg_TVAR_WATCH_QUEUE);
644 RTS_ENTRY(stg_INVARIANT_CHECK_QUEUE);
645hunk ./includes/stg/MiscClosures.h 401
646 
647 RTS_FUN_DECL(stg_catchzh);
648 RTS_FUN_DECL(stg_raisezh);
649+RTS_FUN_DECL(stg_raiseWithStackzh);
650 RTS_FUN_DECL(stg_raiseIOzh);
651 
652 RTS_FUN_DECL(stg_makeStableNamezh);
653hunk ./rts/Adjustor.c 220
654 stgAllocStable(size_t size_in_bytes, StgStablePtr *stable)
655 {
656   StgArrWords* arr;
657-  nat data_size_in_words, total_size_in_words;
658   
659hunk ./rts/Adjustor.c 221
660-  /* round up to a whole number of words */
661-  data_size_in_words  = (size_in_bytes + sizeof(W_) + 1) / sizeof(W_);
662-  total_size_in_words = sizeofW(StgArrWords) + data_size_in_words;
663
664-  /* allocate and fill it in */
665-  arr = (StgArrWords *)allocate(total_size_in_words);
666-  SET_ARR_HDR(arr, &stg_ARR_WORDS_info, CCCS, data_size_in_words);
667+  /* allocate unfilled array */
668+  arr = stgAllocArrWords(size_in_bytes);
669 
670   /* obtain a stable ptr */
671   *stable = getStablePtr((StgPtr)arr);
672hunk ./rts/Exception.cmm 347
673   jump stg_raisezh;
674 }
675 
676+INFO_TABLE(stg_raiseWithStack,2,0,THUNK_2_0,"raiseWithStack","raiseWithStack")
677+{
678+  R2 = StgThunk_payload(R1,1);
679+  R1 = StgThunk_payload(R1,0);
680+  jump stg_raiseWithStackzh;
681+}
682+
683 section "data" {
684   no_break_on_exception: W_[1];
685 }
686hunk ./rts/Exception.cmm 366
687   jump stg_raisezh;
688 }
689 
690+INFO_TABLE_RET(stg_raiseWithStack_ret, RET_SMALL, P_ arg1, P_ arg2)
691+{
692+  R1 = Sp(1);
693+  R2 = Sp(2);
694+  Sp = Sp + WDS(3);
695+  W_[no_break_on_exception] = 1; 
696+  jump stg_raiseWithStackzh;
697+}
698+
699 stg_raisezh
700 {
701hunk ./rts/Exception.cmm 377
702+    W_ reified_stack;
703+    /* args : R1 :: Exception */
704+   
705+    ("ptr" reified_stack) = foreign "C" reifyStack (MyCapability() "ptr", Sp "ptr") [];
706+    R2 = reified_stack;
707+    jump stg_raiseWithStackzh;
708+}
709+
710+stg_raiseWithStackzh
711+{
712     W_ handler;
713     W_ frame_type;
714     W_ exception;
715hunk ./rts/Exception.cmm 390
716-    /* args : R1 :: Exception */
717+    W_ reified_stack;
718+    /* args : R1 :: Exception, R2 :: stack */
719 
720    exception = R1;
721hunk ./rts/Exception.cmm 394
722+   reified_stack = R2;
723 
724 #if defined(PROFILING)
725     /* Debugging tool: on raising an  exception, show where we are. */
726hunk ./rts/Exception.cmm 466
727             // be per-thread.
728             CInt[rts_stop_on_exception] = 0;
729             ("ptr" ioAction) = foreign "C" deRefStablePtr (W_[rts_breakpoint_io_action] "ptr") [];
730-            Sp = Sp - WDS(7);
731+            Sp = Sp - WDS(8);
732+            Sp(7) = reified_stack;
733             Sp(6) = exception;
734hunk ./rts/Exception.cmm 469
735-            Sp(5) = stg_raise_ret_info;
736+            Sp(5) = stg_raiseWithStack_ret_info;
737             Sp(4) = stg_noforceIO_info;    // required for unregisterised
738             Sp(3) = exception;             // the AP_STACK
739             Sp(2) = ghczmprim_GHCziBool_True_closure; // dummy breakpoint info
740hunk ./rts/Exception.cmm 485
741         * We will leave the stack in a GC'able state, see the stg_stop_thread
742         * entry code in StgStartup.cmm.
743         */
744+       
745+        /* TODO: print the reified_stack, since we've run out of catch frames */
746+       
747        Sp = CurrentTSO + TSO_OFFSET_StgTSO_stack
748                + WDS(TO_W_(StgTSO_stack_size(CurrentTSO))) - WDS(2);
749        Sp(1) = exception;      /* save the exception */
750hunk ./rts/Exception.cmm 540
751     StgTSO_flags(CurrentTSO) = %lobits32(
752        TO_W_(StgTSO_flags(CurrentTSO)) | TSO_BLOCKEX | TSO_INTERRUPTIBLE);
753 
754-    /* Call the handler, passing the exception value and a realworld
755+    /* Call the handler, passing the exception value, stack, and a realworld
756      * token as arguments.
757      */
758hunk ./rts/Exception.cmm 543
759-    Sp_adj(-1);
760+    Sp_adj(-2);
761+    Sp(1) = reified_stack;
762     Sp(0) = exception;
763     R1 = handler;
764     Sp_adj(-1);
765hunk ./rts/Exception.cmm 549
766     TICK_UNKNOWN_CALL();
767-    TICK_SLOW_CALL_pv();
768-    jump RET_LBL(stg_ap_pv);
769+    TICK_SLOW_CALL_ppv();
770+    jump RET_LBL(stg_ap_ppv);
771 }
772 
773 stg_raiseIOzh
774hunk ./rts/Linker.c 820
775       SymI_HasProto(prog_argv)                         \
776       SymI_HasProto(stg_putMVarzh)                     \
777       SymI_HasProto(stg_raisezh)                       \
778+      SymI_HasProto(stg_raiseWithStackzh)      \
779       SymI_HasProto(stg_raiseIOzh)                     \
780       SymI_HasProto(stg_readTVarzh)                    \
781       SymI_HasProto(stg_readTVarIOzh)                  \
782hunk ./rts/RaiseAsync.c 694
783 {
784     StgRetInfoTable *info;
785     StgPtr sp, frame;
786-    StgClosure *updatee;
787+    StgClosure *updatee, *reified_stack;
788     nat i;
789 
790     debugTraceCap(DEBUG_sched, cap,
791hunk ./rts/RaiseAsync.c 730
792     dirty_TSO(cap, tso);
793 
794     sp = tso->sp;
795+    reified_stack = reifyStack(cap, sp);
796     
797     if (stop_here != NULL) {
798         updatee = stop_here->updatee;
799hunk ./rts/RaiseAsync.c 848
800            // we've got an exception to raise, so let's pass it to the
801            // handler in this frame.
802            //
803-           raise = (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
804+           raise = (StgThunk *)allocate(cap,sizeofW(StgThunk)+2);
805            TICK_ALLOC_SE_THK(1,0);
806hunk ./rts/RaiseAsync.c 850
807-           SET_HDR(raise,&stg_raise_info,cf->header.prof.ccs);
808+           SET_HDR(raise,&stg_raiseWithStack_info,cf->header.prof.ccs);
809            raise->payload[0] = exception;
810hunk ./rts/RaiseAsync.c 852
811+           raise->payload[1] = reified_stack;
812           
813            // throw away the stack from Sp up to the CATCH_FRAME.
814            //
815hunk ./rts/RtsFlags.c 151
816     RtsFlags.ConcFlags.ctxtSwitchTime  = 20;  /* In milliseconds */
817 
818     RtsFlags.MiscFlags.install_signal_handlers = rtsTrue;
819+    RtsFlags.MiscFlags.showStackTraces = rtsTrue;
820+    RtsFlags.MiscFlags.maxStackReificationDepth = 100;
821     RtsFlags.MiscFlags.machineReadable = rtsFalse;
822     RtsFlags.MiscFlags.linkerMemBase    = 0;
823 
824hunk ./rts/RtsFlags.c 328
825 #endif
826 "  --install-signal-handlers=<yes|no>",
827 "            Install signal handlers (default: yes)",
828+"  --show-stack-traces=<yes|no>",
829+"            Show stack traces (default: yes)",
830+"  -T<n>     Maximum depth of reified stack traces",
831+"            (default: 100, 0 to disable the limit)",
832 #if defined(THREADED_RTS)
833 "  -e<size>  Size of spark pools (default 100)",
834 #endif
835hunk ./rts/RtsFlags.c 550
836                                &rts_argv[arg][2])) {
837                       RtsFlags.MiscFlags.install_signal_handlers = rtsFalse;
838                   }
839+                  if (strequal("show-stack-traces=yes",
840+                               &rts_argv[arg][2])) {
841+                      RtsFlags.MiscFlags.showStackTraces = rtsTrue;
842+                  }
843+                  else if (strequal("show-stack-traces=no",
844+                               &rts_argv[arg][2])) {
845+                      RtsFlags.MiscFlags.showStackTraces = rtsFalse;
846+                  }
847                   else if (strequal("machine-readable",
848                                &rts_argv[arg][2])) {
849                       RtsFlags.MiscFlags.machineReadable = rtsTrue;
850hunk ./rts/RtsFlags.c 572
851                      error = rtsTrue;
852                   }
853                  break;
854+
855+           case 'T':
856+                 if (rts_argv[arg][2] != '\0') {
857+                     int depth = strtol(rts_argv[arg]+2, (char **) NULL, 10);
858+                     if (depth < 0) {
859+                         errorBelch("bad value for -T");
860+                         error = rtsTrue;
861+                     } else {
862+                          RtsFlags.MiscFlags.maxStackReificationDepth = (nat)depth;
863+                     }
864+                 }
865+            break;
866+                 
867              case 'A':
868                   RtsFlags.GcFlags.minAllocAreaSize
869                       = decodeSize(rts_argv[arg], 2, BLOCK_SIZE, HS_INT_MAX)
870hunk ./rts/RtsUtils.c 256
871   free(p);
872 }
873 
874+/* -----------------------------------------------------------------------------
875+   Allocating simple arrays.
876+   -------------------------------------------------------------------------- */
877+
878+StgArrWords *
879+stgAllocArrWords(Capability *cap, size_t size_in_bytes)
880+{
881+    StgArrWords* arr;
882+    nat data_size_in_words, total_size_in_words;
883+
884+    /* round up to a whole number of words */
885+    data_size_in_words  = (size_in_bytes + sizeof(W_) - 1) / sizeof(W_);
886+    total_size_in_words = sizeofW(StgArrWords) + data_size_in_words;
887+
888+    /* allocate and fill it in */
889+    arr = (StgArrWords *)allocate(cap, total_size_in_words);
890+    SET_ARR_HDR(arr, &stg_ARR_WORDS_info, CCCS, data_size_in_words);
891+   
892+    return arr;
893+}
894+
895 /* -----------------------------------------------------------------------------
896    Stack overflow
897   
898hunk ./rts/RtsUtils.c 283
899    Not sure if this belongs here.
900    -------------------------------------------------------------------------- */
901 
902+HsBool
903+rtsShowsStackTraces(void)
904+{
905+    return RtsFlags.MiscFlags.showStackTraces ? HS_BOOL_TRUE : HS_BOOL_FALSE;
906+}
907+
908 void
909 stackOverflow(void)
910 {
911hunk ./rts/RtsUtils.h 35
912  * Misc other utilities
913  * -------------------------------------------------------------------------- */
914 
915+StgArrWords *stgAllocArrWords(Capability *cap, size_t size_in_bytes);
916+
917 void heapOverflow(void);
918 
919 char *time_str(void);
920hunk ./rts/Schedule.c 2440
921     }
922 }
923 
924+/* -----------------------------------------------------------------------------
925+   reifyStack
926+   
927+   This function is called by the raise# primitve, to reify the STG stack as a
928+   null-termianted array of pointers to C strings.
929+   -------------------------------------------------------------------------- */
930+
931+StgClosure *
932+reifyStack( Capability *cap, StgPtr sp )
933+{
934+    rtsBool truncated;
935+    const StgRetInfoTable* ret_info;
936+    nat framecount;
937+    StgArrWords* reified;
938+    char **reified_payload;
939+    StgPtr orig_sp;
940+   
941+    truncated = rtsFalse;
942+    framecount = 0;
943+    orig_sp = sp;
944+   
945+    // 1) Determine the length of the array we need to allocate to store the stack frame pointer array
946+    for (; ret_info = get_ret_itbl((StgClosure *)sp), ret_info->i.type != STOP_FRAME; sp += stack_frame_sizeW((StgClosure *)sp)) {
947+        if (GET_RET_DESC(ret_info)) {
948+            if ((++framecount >= RtsFlags.MiscFlags.maxStackReificationDepth) && (RtsFlags.MiscFlags.maxStackReificationDepth != 0)) {
949+                // Signal that the stack trace was truncated
950+                truncated = rtsTrue;
951+                break;
952+            }
953+        }
954+    }
955+   
956+    // 2) Allocate array of that size. The length will be stored in the StgArrWords, so we don't need any terminators
957+    reified = stgAllocArrWords(cap, (framecount + (truncated ? 1 : 0)) * sizeof(char *));
958+    reified_payload = (char**)(&(reified->payload));
959+   
960+    // 3) Crawl the stack again, but this time filling in the newly-allocated array
961+    for (sp = orig_sp; ret_info = get_ret_itbl((StgClosure *)sp), ret_info->i.type != STOP_FRAME; sp += stack_frame_sizeW((StgClosure *)sp)) {
962+        if (GET_RET_DESC(ret_info)) {
963+            if (framecount-- == 0) {
964+                // Must have allocated a word to store the truncated indicator in, so put in the hint:
965+                *reified_payload = "... truncated, use the -T RTS option to extend ...";
966+                break;
967+            }
968+
969+            *reified_payload = GET_RET_DESC(ret_info);
970+            reified_payload++;
971+        }
972+    }
973+   
974+    // 4) Return, throwing away the ByteArray# structure
975+    return (StgClosure*)reified;
976+}
977+
978 
979 /* -----------------------------------------------------------------------------
980    findRetryFrameHelper
981hunk ./rts/Schedule.h 46
982 /* raiseExceptionHelper */
983 StgWord raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception);
984 
985+/* reifyStack */
986+StgClosure *reifyStack( Capability* cap, StgPtr sp );
987+
988 /* findRetryFrameHelper */
989 StgWord findRetryFrameHelper (StgTSO *tso);
990 
991}
992[Add the -strip-stack-info flag, which uses objcopy and RTS hooks to remove the .ghc_debug section from the binary
993Max Bolingbroke <batterseapower@hotmail.com>**20100428222002
994 Ignore-this: ecf5e9b788792111342f301ff7e28739
995] {
996hunk ./compiler/ghc.mk 86
997        @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $@
998        @echo "cMKDLL                :: String" >> $@
999        @echo "cMKDLL                = \"$(BLD_DLL)\"" >> $@
1000+       @echo "cOBJCOPY              :: String" >> $@
1001+       @echo "cOBJCOPY              = \"$(OBJCOPY)\"" >> $@
1002        @echo "cLdIsGNULd            :: String" >> $@
1003        @echo "cLdIsGNULd            = \"$(LdIsGNULd)\"" >> $@
1004        @echo "cLD_X                 :: String" >> $@
1005hunk ./compiler/main/DriverPipeline.hs 1442
1006                                  ["char *ghc_rts_opts = " ++ show opts ++ ";"]
1007                          return [fn]
1008                   Nothing -> return []
1009-
1010+    stackStrippedObj <- if dopt Opt_StripStackTraceInfo dflags
1011+                        then do fn <- mkExtraCObj dflags
1012+                                       ["#include \"Rts.h\"",
1013+                                        "const rtsBool stackTraceInfoStripped = rtsTrue;"]
1014+                                return [fn]
1015+                        else return []
1016+   
1017     pkg_link_opts <- getPackageLinkOpts dflags dep_packages
1018 
1019 #ifdef darwin_TARGET_OS
1020hunk ./compiler/main/DriverPipeline.hs 1524
1021                       ++ main_lib
1022                       ++ rtsEnabledObj
1023                       ++ rtsOptsObj
1024+                      ++ stackStrippedObj
1025                      ++ pkg_link_opts
1026 #ifdef darwin_TARGET_OS
1027                      ++ pkg_framework_path_opts
1028hunk ./compiler/main/DriverPipeline.hs 1534
1029                      ++ thread_opts
1030                    ))
1031 
1032+    -- Strip the stack trace info section if requested by the user
1033+    when (dopt Opt_StripStackTraceInfo dflags) $ do
1034+#ifndef darwin_TARGET_OS
1035+        SysTools.runObjCopy dflags "Strip stack trace information" [
1036+            SysTools.Option verb,
1037+            SysTools.Option "--remove-section=.ghc_debug",
1038+            SysTools.FileOption "" output_fn
1039+          ]
1040+#else
1041+        debugTraceMsg dflags 1 $ text $
1042+            "Warning: There is no way to strip a specific section from a binary in OS X, " ++
1043+            "so -strip-stack-info does not reduce binary sizes, although it " ++
1044+            "does suppress stack trace generation"
1045+#endif
1046+
1047     -- parallel only: move binary to another dir -- HWL
1048     success <- runPhase_MoveBinary dflags output_fn dep_packages
1049     if success then return ()
1050hunk ./compiler/main/DynFlags.hs 302
1051    | Opt_ReadUserPackageConf
1052    | Opt_NoHsMain
1053    | Opt_RtsOptsEnabled
1054+   | Opt_StripStackTraceInfo
1055    | Opt_SplitObjs
1056    | Opt_StgStats
1057    | Opt_HideAllPackages
1058hunk ./compiler/main/DynFlags.hs 436
1059   pgm_l                 :: (String,[Option]),
1060   pgm_dll               :: (String,[Option]),
1061   pgm_T                 :: String,
1062+  pgm_objcopy           :: String,
1063   pgm_sysman            :: String,
1064   pgm_windres           :: String,
1065 
1066hunk ./compiler/main/DynFlags.hs 685
1067         pgm_l                   = panic "defaultDynFlags: No pgm_l",
1068         pgm_dll                 = panic "defaultDynFlags: No pgm_dll",
1069         pgm_T                   = panic "defaultDynFlags: No pgm_T",
1070+        pgm_objcopy             = panic "defaultDynFlags: No pgm_objcopy",
1071         pgm_sysman              = panic "defaultDynFlags: No pgm_sysman",
1072         pgm_windres             = panic "defaultDynFlags: No pgm_windres",
1073         -- end of initSysTools values
1074hunk ./compiler/main/DynFlags.hs 775
1075 
1076 setObjectDir, setHiDir, setStubDir, setOutputDir, setDylibInstallName,
1077          setObjectSuf, setHiSuf, setHcSuf, parseDynLibLoaderMode,
1078-         setPgmP, setPgmL, setPgmF, setPgmc, setPgmm, setPgms, setPgma, setPgml, setPgmdll, setPgmwindres,
1079+         setPgmP, setPgmL, setPgmF, setPgmc, setPgmm, setPgms, setPgma, setPgml, setPgmdll, setPgmobjcopy, setPgmwindres,
1080          addOptL, addOptP, addOptF, addOptc, addOptm, addOpta, addOptl, addOptwindres,
1081          addCmdlineFramework, addHaddockOpts
1082    :: String -> DynFlags -> DynFlags
1083hunk ./compiler/main/DynFlags.hs 820
1084 setPgma   f d = d{ pgm_a   = (f,[])}
1085 setPgml   f d = d{ pgm_l   = (f,[])}
1086 setPgmdll f d = d{ pgm_dll = (f,[])}
1087+setPgmobjcopy f d = d{ pgm_objcopy = f}
1088 setPgmwindres f d = d{ pgm_windres = f}
1089 
1090 addOptL   f d = d{ opt_L   = f : opt_L d}
1091hunk ./compiler/main/DynFlags.hs 1034
1092   , Flag "pgma"           (HasArg (upd . setPgma)) Supported
1093   , Flag "pgml"           (HasArg (upd . setPgml)) Supported
1094   , Flag "pgmdll"         (HasArg (upd . setPgmdll)) Supported
1095+  , Flag "pgmobjcopy"     (HasArg (upd . setPgmobjcopy)) Supported
1096   , Flag "pgmwindres"     (HasArg (upd . setPgmwindres)) Supported
1097 
1098   , Flag "optL"           (HasArg (upd . addOptL)) Supported
1099hunk ./compiler/main/DynFlags.hs 1117
1100 
1101         ------- Miscellaneous ----------------------------------------------
1102   , Flag "no-auto-link-packages" (NoArg (unSetDynFlag Opt_AutoLinkPackages)) Supported
1103-  , Flag "no-hs-main"     (NoArg (setDynFlag Opt_NoHsMain)) Supported
1104-  , Flag "with-rtsopts"   (HasArg setRtsOpts) Supported
1105-  , Flag "rtsopts"        (NoArg (setDynFlag Opt_RtsOptsEnabled)) Supported
1106-  , Flag "no-rtsopts"     (NoArg (unSetDynFlag Opt_RtsOptsEnabled)) Supported
1107-  , Flag "main-is"        (SepArg setMainIs ) Supported
1108-  , Flag "haddock"        (NoArg (setDynFlag Opt_Haddock)) Supported
1109-  , Flag "haddock-opts"   (HasArg (upd . addHaddockOpts)) Supported
1110-  , Flag "hpcdir"         (SepArg setOptHpcDir) Supported
1111+  , Flag "no-hs-main"            (NoArg (setDynFlag Opt_NoHsMain)) Supported
1112+  , Flag "with-rtsopts"          (HasArg setRtsOpts) Supported
1113+  , Flag "rtsopts"               (NoArg (setDynFlag Opt_RtsOptsEnabled)) Supported
1114+  , Flag "no-rtsopts"            (NoArg (unSetDynFlag Opt_RtsOptsEnabled)) Supported
1115+  , Flag "strip-stack-info"      (NoArg (setDynFlag Opt_StripStackTraceInfo)) Supported
1116+  , Flag "no-strip-stack-info"   (NoArg (unSetDynFlag Opt_StripStackTraceInfo)) Supported
1117+  , Flag "main-is"               (SepArg setMainIs ) Supported
1118+  , Flag "haddock"               (NoArg (setDynFlag Opt_Haddock)) Supported
1119+  , Flag "haddock-opts"          (HasArg (upd . addHaddockOpts)) Supported
1120+  , Flag "hpcdir"                (SepArg setOptHpcDir) Supported
1121 
1122         ------- recompilation checker --------------------------------------
1123   , Flag "recomp"         (NoArg (unSetDynFlag Opt_ForceRecomp))
1124hunk ./compiler/main/SysTools.lhs 21
1125         runAs, runLink,          -- [Option] -> IO ()
1126         runMkDLL,
1127         runWindres,
1128+        runObjCopy,
1129 
1130         touch,                  -- String -> String -> IO ()
1131         copy,
1132hunk ./compiler/main/SysTools.lhs 188
1133               gcc_prog
1134                 | isWindowsHost = installed_mingw_bin "gcc"
1135                 | otherwise     = cGCC
1136+              objcopy_prog
1137+                | isWindowsHost = installed_mingw_bin "objcopy"
1138+                | otherwise     = cOBJCOPY
1139               perl_path
1140                 | isWindowsHost = installed_perl_bin cGHC_PERL
1141                 | otherwise     = cGHC_PERL
1142hunk ./compiler/main/SysTools.lhs 241
1143                         pgm_l   = (ld_prog,[]),
1144                         pgm_dll = (mkdll_prog,mkdll_args),
1145                         pgm_T   = touch_path,
1146-                        pgm_sysman = top_dir ++ "/ghc/rts/parallel/SysMan",
1147+                        pgm_objcopy = objcopy_prog,
1148+                        pgm_sysman  = top_dir ++ "/ghc/rts/parallel/SysMan",
1149                         pgm_windres = windres_path
1150                         -- Hans: this isn't right in general, but you can
1151                         -- elaborate it in the same way as the others
1152hunk ./compiler/main/SysTools.lhs 424
1153   mb_env <- getGccEnv gcc_args
1154   runSomethingFiltered dflags id "Windres" windres args' mb_env
1155 
1156+runObjCopy :: DynFlags -> String -> [Option] -> IO ()
1157+runObjCopy dflags purpose args =
1158+  runSomething dflags purpose (pgm_objcopy dflags) args
1159+
1160 touch :: DynFlags -> String -> String -> IO ()
1161 touch dflags purpose arg =
1162   runSomething dflags purpose (pgm_T dflags) [FileOption "" arg]
1163hunk ./configure.ac 583
1164 FP_PROG_AR_NEEDS_RANLIB
1165 FP_PROG_AR_SUPPORTS_INPUT
1166 
1167+dnl ** Find objcopy
1168+AC_CHECK_TOOL([OBJCOPY], [objcopy], [:])
1169+
1170 dnl ** Check to see whether ln -s works
1171 AC_PROG_LN_S
1172 
1173hunk ./mk/config.mk.in 606
1174 PIC                    = pic
1175 PREPROCESSCMD          = $(CC) -E
1176 RANLIB                 = @RANLIB@
1177+OBJCOPY                        = @OBJCOPY@
1178 SED                    = @SedCmd@
1179 TR                     = tr
1180 SHELL                  = /bin/sh
1181hunk ./rts/RtsOpts.h 13
1182 #define RTSOPTS_H
1183 
1184 extern const rtsBool rtsOptsEnabled;
1185+extern const rtsBool stackTraceInfoStripped;
1186 
1187 #endif /* RTSOPTS_H */
1188hunk ./rts/Schedule.c 12
1189 #include "PosixSource.h"
1190 #define KEEP_LOCKCLOSURE
1191 #include "Rts.h"
1192+#include "RtsOpts.h"
1193 
1194 #include "sm/Storage.h"
1195 #include "RtsUtils.h"
1196hunk ./rts/Schedule.c 2462
1197     framecount = 0;
1198     orig_sp = sp;
1199     
1200+    // 0) If stack information has been stripped, then following the points in the RetInfoTables would lead to disaster!
1201+    if (stackTraceInfoStripped) {
1202+        return (StgClosure*)stgAllocArrWords(cap, 0);
1203+    }
1204+   
1205     // 1) Determine the length of the array we need to allocate to store the stack frame pointer array
1206     for (; ret_info = get_ret_itbl((StgClosure *)sp), ret_info->i.type != STOP_FRAME; sp += stack_frame_sizeW((StgClosure *)sp)) {
1207         if (GET_RET_DESC(ret_info)) {
1208}
1209[Add missing RTS file for stack trace support
1210Max Bolingbroke <batterseapower@hotmail.com>**20100429074854
1211 Ignore-this: 7e224f2336456fa456cc4497bdc2c5ee
1212] {
1213hunk ./compiler/nativeGen/PPC/Ppr.hs 318
1214        Data                    -> ptext (sLit ".data\n.align 2")
1215        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 2")
1216        RelocatableReadOnlyData -> ptext (sLit ".data\n\t.align 2")
1217-       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 2")
1218+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug, \"a\"\n\t.align 2")
1219        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 2")
1220        ReadOnlyData16          -> ptext (sLit ".section .rodata\n\t.align 4")
1221        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
1222hunk ./compiler/nativeGen/SPARC/Ppr.hs 335
1223        Data                    -> ptext (sLit ".data\n\t.align 8")
1224        ReadOnlyData            -> ptext (sLit ".text\n\t.align 8")
1225        RelocatableReadOnlyData -> ptext (sLit ".text\n\t.align 8")
1226-       RelocatableDebugData    -> ptext (sLit ".section \".ghc_debug\"\n\t.align 8")
1227+       RelocatableDebugData    -> ptext (sLit ".section \".ghc_debug\", a\n\t.align 8")
1228        UninitialisedData       -> ptext (sLit ".bss\n\t.align 8")
1229        ReadOnlyData16          -> ptext (sLit ".data\n\t.align 16")
1230        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
1231hunk ./compiler/nativeGen/X86/Ppr.hs 398
1232        Data                    -> ptext (sLit ".data\n\t.align 4")
1233        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 4")
1234        RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 4")
1235-       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 4")
1236+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug, \"a\"\n\t.align 4")
1237        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 4")
1238        ReadOnlyData16          -> ptext (sLit ".section .rodata\n\t.align 16")
1239        OtherSection _          -> panic "X86.Ppr.pprSectionHeader: unknown section"
1240hunk ./compiler/nativeGen/X86/Ppr.hs 425
1241        Data                    -> ptext (sLit ".data\n\t.align 8")
1242        ReadOnlyData            -> ptext (sLit ".section .rodata\n\t.align 8")
1243        RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 8")
1244-       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug\n\t.align 8")
1245+       RelocatableDebugData    -> ptext (sLit ".section .ghc_debug, \"a\"\n\t.align 8")
1246        UninitialisedData       -> ptext (sLit ".section .bss\n\t.align 8")
1247        ReadOnlyData16          -> ptext (sLit ".section .rodata.cst16\n\t.align 16")
1248        OtherSection _          -> panic "PprMach.pprSectionHeader: unknown section"
1249hunk ./rts/Linker.c 873
1250       SymI_HasProto(rts_mkWord64)                      \
1251       SymI_HasProto(rts_unlock)                                \
1252       SymI_HasProto(rts_unsafeGetMyCapability)          \
1253+      SymI_HasProto(rtsShowsStackTraces)               \
1254       SymI_HasProto(rtsSupportsBoundThreads)           \
1255       SymI_HasProto(setProgArgv)                       \
1256       SymI_HasProto(startupHaskell)                    \
1257addfile ./rts/hooks/StackTraceStripped.c
1258hunk ./rts/hooks/StackTraceStripped.c 1
1259+/* -----------------------------------------------------------------------------
1260+ *
1261+ * (c) The GHC Team 2010
1262+ *
1263+ * Allows the compiler to mark whether stack trace information was stripped from
1264+ * the output executable
1265+ *
1266+ * ---------------------------------------------------------------------------*/
1267+
1268+#include "Rts.h"
1269+#include "RtsOpts.h"
1270+
1271+const rtsBool stackTraceInfoStripped = rtsFalse;
1272+
1273}
1274[Documentation for flags related to stack traces
1275Max Bolingbroke <batterseapower@hotmail.com>**20100429115048
1276 Ignore-this: 94dd2fa03974dd20300e5c770757e6bc
1277] {
1278hunk ./docs/users_guide/flags.xml 1855
1279              <entry>-</entry>
1280            </row>
1281            <row>
1282+             <entry><option>-strip-stack-info</option></entry>
1283+             <entry>Strip information necessary for runtime stack traces from the final executable.
1284+             Reduces executable size, but stack traces will not be available.</entry>
1285+             <entry>dynamic</entry>
1286+             <entry>-no-strip-stack-info</entry>
1287+           </row>
1288+           <row>
1289              <entry><option>-static</option></entry>
1290              <entry>Use static Haskell libraries</entry>
1291              <entry>static</entry>
1292hunk ./docs/users_guide/runtime_control.xml 137
1293      </varlistentry>
1294 
1295      <varlistentry>
1296+       <term><option>--show-stack-traces=<replaceable>yes|no</replaceable></option>
1297+       <indexterm><primary><option>--show-stack-traces</option></primary><secondary>RTS
1298+       option</secondary></indexterm></term>
1299+       <listitem>
1300+         <para>If yes (the default), stack traces will be displayed on the console for unhandled
1301+         top-level exceptions.</para>
1302+       </listitem>
1303+     </varlistentry>
1304+
1305+     <varlistentry>
1306+       <term><option>-T<replaceable>n</replaceable></option>
1307+       <indexterm><primary><option>-T</option></primary><secondary>RTS
1308+       option</secondary></indexterm></term>
1309+       <listitem>
1310+         <para>Sets the depth that stack traces are reified to by the run time. If the stack exceeds
1311+         this depth then the last item in the truncated trace will be replaced with a message informing
1312+         the user that the stack trace omits some trailing frames.</para>
1313+       </listitem>
1314+     </varlistentry>
1315+
1316+     <varlistentry>
1317        <term><option>-xm<replaceable>address</replaceable></option>
1318        <indexterm><primary><option>-xm</option></primary><secondary>RTS
1319        option</secondary></indexterm></term>
1320}
1321[Fix Linker.c so it deals with .ghc_debug sections in PE images
1322Max Bolingbroke <batterseapower@hotmail.com>**20100429195553
1323 Ignore-this: 5bcf05832fac9a26839ccdc1884474db
1324] {
1325hunk ./rts/Linker.c 2236
1326 }
1327 
1328 
1329+static UChar *
1330+cstring_from_COFF_section_name ( UChar* name, UChar* strtab )
1331+{
1332+   UChar* newstr;
1333+   /* If the name is encoded with the Microsoft extension that
1334+      allows section names to exceed 8 bytes, look up the name
1335+      in the string table.
1336+     
1337+      In theory we should only do this if the COFF is an object,
1338+      not an executable, because executables may not contain
1339+      symbol tables. In practice we rely on the tools working
1340+      in both cases, because the .ghc_debug section exceeds the 8
1341+      character limit.
1342+   */
1343+   if (name[0]=='/') {
1344+      nat strtab_offset = strtol(name+1, NULL, 10);
1345+      return strtab + strtab_offset;
1346+   }
1347+   
1348+   /* If the name is shorter than 8 bytes, return the original,
1349+      which by defn is correctly terminated. Note that per the
1350+      specification, section names must be null padded, so this
1351+      check is sufficient.
1352+   */
1353+   if (name[7]==0) return name;
1354+   
1355+   /* The only remaining case is if the section name was 8 bytes
1356+      exactly. Use the same ugly non-freed temporary thing as in
1357+      cstring_from_COFF_symbol_name.
1358+   */
1359+   newstr = stgMallocBytes(9, "cstring_from_COFF_section_name");
1360+   ASSERT(newstr);
1361+   strncpy((char*)newstr,(char*)name,8);
1362+   newstr[8] = 0;
1363+   return newstr;
1364+}
1365+
1366 static UChar *
1367 cstring_from_COFF_symbol_name ( UChar* name, UChar* strtab )
1368 {
1369hunk ./rts/Linker.c 2282
1370    */
1371    if (name[0]==0 && name[1]==0 && name[2]==0 && name[3]==0) {
1372       UInt32 strtab_offset = * (UInt32*)(name+4);
1373-      return ((UChar*)strtab) + strtab_offset;
1374+      return strtab + strtab_offset;
1375    }
1376    /* Otherwise, if shorter than 8 bytes, return the original,
1377       which by defn is correctly terminated.
1378hunk ./rts/Linker.c 2299
1379 }
1380 
1381 
1382-/* Just compares the short names (first 8 chars) */
1383 static COFF_section *
1384hunk ./rts/Linker.c 2300
1385-findPEi386SectionCalled ( ObjectCode* oc,  UChar* name )
1386+findPEi386SectionCalled ( ObjectCode* oc,  UChar* name, UChar* strtab )
1387 {
1388    int i;
1389    COFF_header* hdr
1390hunk ./rts/Linker.c 2316
1391       COFF_section* section_i
1392          = (COFF_section*)
1393            myindex ( sizeof_COFF_section, sectab, i );
1394-      n1 = (UChar*) &(section_i->Name);
1395-      n2 = name;
1396-      if (n1[0]==n2[0] && n1[1]==n2[1] && n1[2]==n2[2] &&
1397-          n1[3]==n2[3] && n1[4]==n2[4] && n1[5]==n2[5] &&
1398-          n1[6]==n2[6] && n1[7]==n2[7])
1399-         return section_i;
1400+     
1401+      UChar* sectname = cstring_from_COFF_section_name( section_i->Name, strtab );
1402+      if (0 == strcmp(sectname, name)) return section_i;
1403    }
1404 
1405    return NULL;
1406hunk ./rts/Linker.c 2592
1407       COFF_section* sectab_i
1408          = (COFF_section*)
1409            myindex ( sizeof_COFF_section, sectab, i );
1410-      if (0 != strcmp((char*)sectab_i->Name, ".bss")) continue;
1411+      UChar* sectname = cstring_from_COFF_section_name ( sectab_i->Name, strtab );
1412+      if (0 != strcmp(sectname, ".bss")) continue;
1413       /* sof 10/05: the PE spec text isn't too clear regarding what
1414        * the SizeOfRawData field is supposed to hold for object
1415        * file sections containing just uninitialized data -- for executables,
1416hunk ./rts/Linker.c 2634
1417       COFF_section* sectab_i
1418          = (COFF_section*)
1419            myindex ( sizeof_COFF_section, sectab, i );
1420-      IF_DEBUG(linker, debugBelch("section name = %s\n", sectab_i->Name ));
1421+      UChar* sectname = cstring_from_COFF_section_name ( sectab_i->Name, strtab );
1422+      IF_DEBUG(linker, debugBelch("section name = %s\n", sectname ));
1423 
1424 #     if 0
1425       /* I'm sure this is the Right Way to do it.  However, the
1426hunk ./rts/Linker.c 2647
1427          kind = SECTIONKIND_CODE_OR_RODATA;
1428 #     endif
1429 
1430-      if (0==strcmp(".text",(char*)sectab_i->Name) ||
1431-          0==strcmp(".rdata",(char*)sectab_i->Name)||
1432-          0==strcmp(".rodata",(char*)sectab_i->Name))
1433+      if (0==strcmp(".text",sectname)  ||
1434+          0==strcmp(".rdata",sectname) ||
1435+          0==strcmp(".rodata",sectname)||
1436+          0==strcmp(".ghc_debug",sectname))
1437          kind = SECTIONKIND_CODE_OR_RODATA;
1438hunk ./rts/Linker.c 2652
1439-      if (0==strcmp(".data",(char*)sectab_i->Name) ||
1440-          0==strcmp(".bss",(char*)sectab_i->Name))
1441+      if (0==strcmp(".data",sectname) ||
1442+          0==strcmp(".bss",sectname))
1443          kind = SECTIONKIND_RWDATA;
1444 
1445       ASSERT(sectab_i->SizeOfRawData == 0 || sectab_i->VirtualSize == 0);
1446hunk ./rts/Linker.c 2666
1447       if (kind == SECTIONKIND_OTHER
1448           /* Ignore sections called which contain stabs debugging
1449              information. */
1450-          && 0 != strcmp(".stab", (char*)sectab_i->Name)
1451-          && 0 != strcmp(".stabstr", (char*)sectab_i->Name)
1452+          && 0 != strcmp(".stab", sectname)
1453+          && 0 != strcmp(".stabstr", sectname)
1454           /* ignore constructor section for now */
1455hunk ./rts/Linker.c 2669
1456-          && 0 != strcmp(".ctors", (char*)sectab_i->Name)
1457+          && 0 != strcmp(".ctors", sectname)
1458           /* ignore section generated from .ident */
1459hunk ./rts/Linker.c 2671
1460-          && 0!= strcmp("/4", (char*)sectab_i->Name)
1461+          && 0 != strcmp(".rdata$zzz", sectname)
1462          /* ignore unknown section that appeared in gcc 3.4.5(?) */
1463hunk ./rts/Linker.c 2673
1464-          && 0!= strcmp(".reloc", (char*)sectab_i->Name)
1465+          && 0 != strcmp(".reloc", sectname)
1466          ) {
1467hunk ./rts/Linker.c 2675
1468-         errorBelch("Unknown PEi386 section name `%s' (while processing: %s)", sectab_i->Name, oc->fileName);
1469+         errorBelch("Unknown PEi386 section name `%s' (while processing: %s)", sectname, oc->fileName);
1470          return 0;
1471       }
1472 
1473hunk ./rts/Linker.c 2813
1474          = (COFF_reloc*) (
1475               ((UChar*)(oc->image)) + sectab_i->PointerToRelocations
1476            );
1477+      UChar* sectname = cstring_from_COFF_section_name ( sectab_i->Name, strtab );
1478 
1479       /* Ignore sections called which contain stabs debugging
1480          information. */
1481hunk ./rts/Linker.c 2817
1482-      if (0 == strcmp(".stab", (char*)sectab_i->Name)
1483-          || 0 == strcmp(".stabstr", (char*)sectab_i->Name)
1484-          || 0 == strcmp(".ctors", (char*)sectab_i->Name))
1485+      if (0 == strcmp(".stab", sectname)
1486+          || 0 == strcmp(".stabstr", sectname)
1487+          || 0 == strcmp(".ctors", sectname))
1488          continue;
1489 
1490       if ( sectab_i->Characteristics & MYIMAGE_SCN_LNK_NRELOC_OVFL ) {
1491hunk ./rts/Linker.c 2881
1492                             debugBelch("'\n" ));
1493 
1494          if (sym->StorageClass == MYIMAGE_SYM_CLASS_STATIC) {
1495+            UChar * sname = cstring_from_COFF_symbol_name ( sym->Name, strtab );
1496             COFF_section* section_sym
1497hunk ./rts/Linker.c 2883
1498-               = findPEi386SectionCalled ( oc, sym->Name );
1499+               = findPEi386SectionCalled ( oc, sname, strtab );
1500             if (!section_sym) {
1501hunk ./rts/Linker.c 2885
1502-               errorBelch("%s: can't find section `%s'", oc->fileName, sym->Name);
1503+               errorBelch("%s: can't find section `%s' (%s)", oc->fileName, sym->Name, sname);
1504                return 0;
1505             }
1506             S = ((UInt32)(oc->image))
1507}
1508
1509Context:
1510
1511[workaround for #4003, fixes HEAD build with 6.12.2
1512Simon Marlow <marlowsd@gmail.com>**20100426103428
1513 Ignore-this: c4bc445dc8052d4e6efef3f1daf63562
1514]
1515[Make sure all the clean rules are always included
1516Ian Lynagh <igloo@earth.li>**20100424181823
1517 In particular, this fixes a problem where stage3 bits weren't being cleaned
1518]
1519[Correct the name of the amd64/FreeBSD platform in PlatformSupportsSharedLibs
1520Ian Lynagh <igloo@earth.li>**20100424132830
1521 We weren't getting sharedlibs on amd64/FreeBSD because of this
1522]
1523[Include DPH docs in bindists
1524Ian Lynagh <igloo@earth.li>**20100424123101]
1525[reinstate eta-expansion during SimplGently, to fix inlining of sequence_
1526Simon Marlow <marlowsd@gmail.com>**20100423124853
1527 Ignore-this: 4fa0fd5bafe0d6b58fc81076f50d5f8d
1528]
1529[fix 64-bit value for W_SHIFT, which thankfully appears to be not used
1530Simon Marlow <marlowsd@gmail.com>**20100422213605
1531 Ignore-this: 525c062d2456c224ec8d0e083edd3b55
1532]
1533[Add missing constant folding and optimisation for unsigned division
1534Simon Marlow <marlowsd@gmail.com>**20100422213443
1535 Ignore-this: fb10d1cda0852fab0cbcb47247498fb3
1536 Noticed by Denys Rtveliashvili <rtvd@mac.com>, see #4004
1537]
1538[Fix the GHC API link in the main doc index.html
1539Ian Lynagh <igloo@earth.li>**20100422213226]
1540[Give the right exit code in darcs-all
1541Ian Lynagh <igloo@earth.li>**20100421171339
1542 Our END block was calling system, which alters $?. So now we save and
1543 restore it.
1544]
1545[Use StgWord64 instead of ullong
1546Ian Lynagh <igloo@earth.li>**20100421162336
1547 This patch also fixes ullong_format_string (renamed to showStgWord64)
1548 so that it works with values outside the 32bit range (trac #3979), and
1549 simplifies the without-commas case.
1550]
1551[Implement try10Times in Makefile
1552Ian Lynagh <igloo@earth.li>**20100420165909
1553 Avoid using seq, as FreeBSD has jot instead.
1554]
1555[Fix crash in non-threaded RTS on Windows
1556Simon Marlow <marlowsd@gmail.com>**20100420122125
1557 Ignore-this: 28b0255a914a8955dce02d89a7dfaca
1558 The tso->block_info field is now overwritten by pushOnRunQueue(), but
1559 stg_block_async_info was assuming that it still held a pointer to the
1560 StgAsyncIOResult.  We must therefore save this value somewhere safe
1561 before putting the TSO on the run queue.
1562]
1563[Expand the scope of the event_buf_mutex to cover io_manager_event
1564Simon Marlow <marlowsd@gmail.com>**20100420122026
1565 Ignore-this: 185a6d84f7d4a35997f10803f6dacef1
1566 I once saw a failure that I think was due to a race on
1567 io_manager_event, this should fix it.
1568]
1569[Flags -auto and -auto-all operate only on functions not marked INLINE.
1570Milan Straka <fox@ucw.cz>**20100331191050
1571 Ignore-this: 3b63580cfcb3c33d62ad697c36d94d05
1572]
1573[Spelling correction for LANGUAGE pragmas
1574Max Bolingbroke <batterseapower@hotmail.com>**20100413192825
1575 Ignore-this: 311b51ba8d43f6c7fd32f48db9a88dee
1576]
1577[Update the user guide so it talks about the newer "do rec" notation everywhere
1578Ian Lynagh <igloo@earth.li>**20100416205416
1579 Some of the problems highlighted in trac #3968.
1580]
1581[Fix typo
1582Ian Lynagh <igloo@earth.li>**20100416205412]
1583[Fix Trac #3950: unifying types of different kinds
1584simonpj@microsoft.com**20100412151845
1585 Ignore-this: d145b9de5ced136ef2c39f3ea4a04f4a
1586 
1587 I was assuming that the unifer only unified types of the
1588 same kind, but now we can "defer" unsolved constraints that
1589 invariant no longer holds.  Or at least is's more complicated
1590 to ensure. 
1591 
1592 This patch takes the path of not assuming the invariant, which
1593 is simpler and more robust.  See
1594 Note [Mismatched type lists and application decomposition]
1595]
1596[Fix Trac #3943: incorrect unused-variable warning
1597simonpj@microsoft.com**20100412151630
1598 Ignore-this: 52459f2b8b02c3cb120abe674dc9a060
1599 
1600 In fixing this I did the usual little bit of refactoring
1601]
1602[Convert boot and boot-pkgs to perl
1603Ian Lynagh <igloo@earth.li>**20100415143919
1604 This stops us having to worry about sh/sed/... portability.
1605]
1606[Use $(MAKE), not make, when recursively calling make
1607Ian Lynagh <igloo@earth.li>**20100415121453]
1608[Remove the ghc_ge_609 makefile variables
1609Ian Lynagh <igloo@earth.li>**20100412235658
1610 They are now guaranteed to be YES
1611]
1612[Increase the minimum version number required to 6.10 in configure.ac
1613Ian Lynagh <igloo@earth.li>**20100412235313]
1614[The bootstrapping compiler is now required to be > 609
1615Ian Lynagh <igloo@earth.li>**20100409161046]
1616[Handle IND_STATIC in isRetainer
1617Ian Lynagh <igloo@earth.li>**20100409104207
1618 IND_STATIC used to be an error, but at the moment it can happen
1619 as isAlive doesn't look through IND_STATIC as it ignores static
1620 closures. See trac #3956 for a program that hit this error.
1621]
1622[Add Data and Typeable instances to HsSyn
1623David Waern <david.waern@gmail.com>**20100330011020
1624 Ignore-this: c3f2717207b15539fea267c36b686e6a
1625 
1626 The instances (and deriving declarations) have been taken from the ghc-syb
1627 package.
1628]
1629[Fix for derefing ThreadRelocated TSOs in MVar operations
1630Simon Marlow <marlowsd@gmail.com>**20100407092824
1631 Ignore-this: 94dd7c68a6094eda667e2375921a8b78
1632]
1633[sanity check fix
1634Simon Marlow <marlowsd@gmail.com>**20100407092746
1635 Ignore-this: 9c18cd5f5393e5049015ca52e62a1269
1636]
1637[get the reg liveness right in the putMVar# heap check
1638Simon Marlow <marlowsd@gmail.com>**20100407092724
1639 Ignore-this: b1ba07a59ecfae00e9a1f8391741abc
1640]
1641[initialise the headers of MSG_BLACKHOLE objects properly
1642Simon Marlow <marlowsd@gmail.com>**20100407081712
1643 Ignore-this: 183dcd0ca6a395d08db2be12b02bdd79
1644]
1645[initialise the headers of MVAR_TSO_QUEUE objects properly
1646Simon Marlow <marlowsd@gmail.com>**20100407081514
1647 Ignore-this: 4b4a2f30cf2fb69ca4128c41744687bb
1648]
1649[undo debugging code
1650Simon Marlow <marlowsd@gmail.com>**20100406142740
1651 Ignore-this: 323c2248f817b6717c19180482fc4b00
1652]
1653[putMVar#: fix reg liveness in the heap check
1654Simon Marlow <marlowsd@gmail.com>**20100406135832
1655 Ignore-this: cddd2c7807ac7612c9b2c4c0d384d284
1656]
1657[account for the new BLACKHOLEs in the GHCi debugger
1658Simon Marlow <marlowsd@gmail.com>**20100406133406
1659 Ignore-this: 4d4aeb4bbada3f50dc1fb0123f565e8f
1660]
1661[don't forget to deRefTSO() in tryWakeupThread()
1662Simon Marlow <marlowsd@gmail.com>**20100406130411
1663 Ignore-this: 171d57c4f8653835dec0b69f9be9881c
1664]
1665[Fix bug in popRunQueue
1666Simon Marlow <marlowsd@gmail.com>**20100406091453
1667 Ignore-this: 9d3cec8f18f5c5cbd51751797386eb6f
1668]
1669[fix bug in migrateThread()
1670Simon Marlow <marlowsd@gmail.com>**20100401105840
1671 Ignore-this: 299bcf0d1ea0f8865f3e845eb93d2ad3
1672]
1673[Remove the IND_OLDGEN and IND_OLDGEN_PERM closure types
1674Simon Marlow <marlowsd@gmail.com>**20100401093519
1675 Ignore-this: 95f2480c8a45139835eaf5610217780b
1676 These are no longer used: once upon a time they used to have different
1677 layout from IND and IND_PERM respectively, but that is no longer the
1678 case since we changed the remembered set to be an array of addresses
1679 instead of a linked list of closures.
1680]
1681[Change the representation of the MVar blocked queue
1682Simon Marlow <marlowsd@gmail.com>**20100401091605
1683 Ignore-this: 20a35bfabacef2674df362905d7834fa
1684 
1685 The list of threads blocked on an MVar is now represented as a list of
1686 separately allocated objects rather than being linked through the TSOs
1687 themselves.  This lets us remove a TSO from the list in O(1) time
1688 rather than O(n) time, by marking the list object.  Removing this
1689 linear component fixes some pathalogical performance cases where many
1690 threads were blocked on an MVar and became unreachable simultaneously
1691 (nofib/smp/threads007), or when sending an asynchronous exception to a
1692 TSO in a long list of thread blocked on an MVar.
1693 
1694 MVar performance has actually improved by a few percent as a result of
1695 this change, slightly to my surprise.
1696 
1697 This is the final cleanup in the sequence, which let me remove the old
1698 way of waking up threads (unblockOne(), MSG_WAKEUP) in favour of the
1699 new way (tryWakeupThread and MSG_TRY_WAKEUP, which is idempotent).  It
1700 is now the case that only the Capability that owns a TSO may modify
1701 its state (well, almost), and this simplifies various things.  More of
1702 the RTS is based on message-passing between Capabilities now.
1703]
1704[eliminate some duplication with a bit of CPP
1705Simon Marlow <marlowsd@gmail.com>**20100330154355
1706 Ignore-this: 838f7d341f096ca14c86ab9c81193e36
1707]
1708[Make ioManagerDie() idempotent
1709Simon Marlow <marlowsd@gmail.com>**20100401100705
1710 Ignore-this: a5996b43cdb2e2d72e6e971d7ea925fb
1711 Avoids screeds of "event buffer overflowed; event dropped" in
1712 conc059(threaded1).
1713]
1714[Move a thread to the front of the run queue when another thread blocks on it
1715Simon Marlow <marlowsd@gmail.com>**20100329144521
1716 Ignore-this: c518ff0d41154680edc811d891826a29
1717 This fixes #3838, and was made possible by the new BLACKHOLE
1718 infrastructure.  To allow reording of the run queue I had to make it
1719 doubly-linked, which entails some extra trickiness with regard to
1720 GC write barriers and suchlike.
1721]
1722[remove non-existent MUT_CONS symbols
1723Simon Marlow <marlowsd@gmail.com>**20100330152600
1724 Ignore-this: 885628257a9d03f2ece2a754d993014a
1725]
1726[change throwTo to use tryWakeupThread rather than unblockOne
1727Simon Marlow <marlowsd@gmail.com>**20100329144613
1728 Ignore-this: 10ad4965e6c940db71253f1c72218bbb
1729]
1730[tiny GC optimisation
1731Simon Marlow <marlowsd@gmail.com>**20100329144551
1732 Ignore-this: 9e095b9b73fff0aae726f9937846ba92
1733]
1734[New implementation of BLACKHOLEs
1735Simon Marlow <marlowsd@gmail.com>**20100329144456
1736 Ignore-this: 96cd26793b4e6ab9ddd0d59aae5c2f1d
1737 
1738 This replaces the global blackhole_queue with a clever scheme that
1739 enables us to queue up blocked threads on the closure that they are
1740 blocked on, while still avoiding atomic instructions in the common
1741 case.
1742 
1743 Advantages:
1744 
1745  - gets rid of a locked global data structure and some tricky GC code
1746    (replacing it with some per-thread data structures and different
1747    tricky GC code :)
1748 
1749  - wakeups are more prompt: parallel/concurrent performance should
1750    benefit.  I haven't seen anything dramatic in the parallel
1751    benchmarks so far, but a couple of threading benchmarks do improve
1752    a bit.
1753 
1754  - waking up a thread blocked on a blackhole is now O(1) (e.g. if
1755    it is the target of throwTo).
1756 
1757  - less sharing and better separation of Capabilities: communication
1758    is done with messages, the data structures are strictly owned by a
1759    Capability and cannot be modified except by sending messages.
1760 
1761  - this change will utlimately enable us to do more intelligent
1762    scheduling when threads block on each other.  This is what started
1763    off the whole thing, but it isn't done yet (#3838).
1764 
1765 I'll be documenting all this on the wiki in due course.
1766 
1767]
1768[Fix warnings (allow pushOnRunQueue() to not be inlined)
1769Simon Marlow <marlowsd@gmail.com>**20100401114559
1770 Ignore-this: f40bfbfad70a5165a946d11371605b7d
1771]
1772[remove out of date comment
1773Simon Marlow <marlowsd@gmail.com>**20100401105853
1774 Ignore-this: 26af88dd418ee0bcda7223b3b7e4e8d2
1775]
1776[tidy up spacing in stderr traces
1777Simon Marlow <marlowsd@gmail.com>**20100326163122
1778 Ignore-this: 16558b0433a274be217d4bf39aa4946
1779]
1780[Fix an assertion that was not safe when running in parallel
1781Simon Marlow <marlowsd@gmail.com>**20100325143656
1782 Ignore-this: cad08fb8900eb3a475547af0189fcc47
1783]
1784[Never jump directly to a thunk's entry code, even if it is single-entry
1785Simon Marlow <marlowsd@gmail.com>**20100325114847
1786 Ignore-this: 938da172c06a97762ef605c8fccfedf1
1787 I don't think this fixes any bugs as we don't have single-entry thunks
1788 at the moment, but it could cause problems for parallel execution if
1789 we ever did re-introduce update avoidance.
1790]
1791[Rename forgotten -dverbose-simpl to -dverbose-core2core in the docs.
1792Milan Straka <fox@ucw.cz>**20100331153626
1793 Ignore-this: 2da58477fb96e1cfb80f37dddd7c422c
1794]
1795[Add -pa and -V to the documentation of time profiling options.
1796Milan Straka <fox@ucw.cz>**20100329191121
1797 Ignore-this: be74d216481ec5a19e5f40f85e6e3d65
1798]
1799[Keep gcc 4.5 happy
1800Simon Marlow <marlowsd@gmail.com>**20100330120425
1801 Ignore-this: 7811878cc2bd1ce9cfbb5bf102fe3454
1802]
1803[Fix warning compiling Linker.c for PPC Mac
1804naur@post11.tele.dk**20100403182355
1805 Ignore-this: e2d2448770c9714ce17dd6cf3e297063
1806 The warning message eliminated is:
1807 > rts/Linker.c:4756:0:
1808 >      warning: nested extern declaration of 'symbolsWithoutUnderscore'
1809]
1810[Fix error compiling AsmCodeGen.lhs for PPC Mac (mkRtsCodeLabel)
1811naur@post11.tele.dk**20100403181656
1812 Ignore-this: deb7524ea7852a15a2ac0849c8c82f74
1813 The error messages eliminated are:
1814 > compiler/nativeGen/AsmCodeGen.lhs:875:31:
1815 >     Not in scope: `mkRtsCodeLabel'
1816 > compiler/nativeGen/AsmCodeGen.lhs:879:31:
1817 >     Not in scope: `mkRtsCodeLabel'
1818 > compiler/nativeGen/AsmCodeGen.lhs:883:31:
1819 >     Not in scope: `mkRtsCodeLabel'
1820]
1821[Fix error compiling AsmCodeGen.lhs for PPC Mac (DestBlockId)
1822naur@post11.tele.dk**20100403180643
1823 Ignore-this: 71e833e94ed8371b2ffabc2cf80bf585
1824 The error message eliminated is:
1825 > compiler/nativeGen/AsmCodeGen.lhs:637:16:
1826 >     Not in scope: data constructor `DestBlockId'
1827]
1828[Fix boot-pkgs's sed usage to work with Solaris's sed
1829Ian Lynagh <igloo@earth.li>**20100401153441]
1830[Pass "-i org.haskell.GHC" to packagemaker when building the OS X installer
1831Ian Lynagh <igloo@earth.li>**20100331144707
1832 This seems to fix this failure:
1833 [...]
1834 ** BUILD SUCCEEDED **
1835 rm -f -f GHC-system.pmdoc/*-contents.xml
1836 /Developer/usr/bin/packagemaker -v --doc GHC-system.pmdoc\
1837              -o /Users/ian/to_release/ghc-6.12.1.20100330/GHC-6.12.1.20100330-i386.pkg
1838 2010-03-31 15:08:15.695 packagemaker[13909:807] Setting to : 0 (null)
1839 2010-03-31 15:08:15.709 packagemaker[13909:807] Setting to : 0 org.haskell.glasgowHaskellCompiler.ghc.pkg
1840 2010-03-31 15:08:15.739 packagemaker[13909:807] relocate: (null) 0
1841 2010-03-31 15:08:15.740 packagemaker[13909:807] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXMLDocument initWithXMLString:options:error:]: nil argument'
1842 2010-03-31 15:08:15.741 packagemaker[13909:807] Stack: (
1843     2511962091,
1844     2447007291,
1845     2511961547,
1846     2511961610,
1847     2432803204,
1848     453371,
1849     447720,
1850     436209,
1851     435510,
1852     9986,
1853     9918
1854 )
1855 make[1]: *** [framework-pkg] Trace/BPT trap
1856 make: *** [framework-pkg] Error 2
1857]
1858[Use machdepCCOpts when compiling the file to toggle -(no-)rtsopts
1859Ian Lynagh <igloo@earth.li>**20100331161302
1860 Should fix toggling on OS X "Snow Leopard". Diagnosed by Roman Leshchinskiy.
1861]
1862[Avoid a non-portable use of tar reported by Roman Leshchinskiy
1863Ian Lynagh <igloo@earth.li>**20100330145802]
1864[Don't install EXTRA_PACKAGES by default
1865Simon Marlow <marlowsd@gmail.com>**20100330142714
1866 Ignore-this: d4cc8f87a6de8d9d1d6dc9b77130b3
1867]
1868[fix a non-portable printf format
1869Simon Marlow <marlowsd@gmail.com>**20100330134437
1870 Ignore-this: d41c23c54ec29654cb2049de1e588570
1871]
1872[avoid single quote in #error
1873Simon Marlow <marlowsd@gmail.com>**20100330120346
1874 Ignore-this: 663f39e7a27fead2f648fbf22d345bb4
1875]
1876[use FMT_Word64 instead of locally-defined version
1877Simon Marlow <marlowsd@gmail.com>**20100330114650
1878 Ignore-this: 82697b8095dffb3a8e196c687006ece0
1879]
1880[remove old/unused DotnetSupport and GhcLibsWithUnix
1881Simon Marlow <marlowsd@gmail.com>**20100330123732
1882 Ignore-this: c68814868b3671abdc369105bbeafe6c
1883]
1884[fix return type cast in f.i.wrapper when using libffi (#3516)
1885Simon Marlow <marlowsd@gmail.com>**20100329154220
1886 Ignore-this: f898eb8c9ae2ca2009e539735b92c438
1887 
1888 Original fix submitted by
1889   Sergei Trofimovich <slyfox@community.haskell.org>
1890 modified by me:
1891  - exclude 64-bit types
1892  - compare uniques, not strings
1893  - #include "ffi.h" is conditional
1894]
1895[libffi: install 'ffitarget.h' header as sole 'ffi.h' is unusable
1896Simon Marlow <marlowsd@gmail.com>**20100329135734
1897 Ignore-this: f9b555ea289d8df1aa22cb6faa219a39
1898 Submitted by: Sergei Trofimovich <slyfox@community.haskell.org>
1899 Re-recorded against HEAD.
1900]
1901[avoid a fork deadlock (see comments)
1902Simon Marlow <marlowsd@gmail.com>**20100329132329
1903 Ignore-this: 3377f88b83bb3b21e42d7fc5f0d866f
1904]
1905[tidy up the end of the all_tasks list after forking
1906Simon Marlow <marlowsd@gmail.com>**20100329132253
1907 Ignore-this: 819d679875be5f344e816210274d1c29
1908]
1909[Add a 'setKeepCAFs' external function (#3900)
1910Simon Marlow <marlowsd@gmail.com>**20100329110036
1911 Ignore-this: ec532a18cad4259a09847b0b9ae2e1d2
1912]
1913[Explicitly check whether ar supports the @file syntax
1914Ian Lynagh <igloo@earth.li>**20100329123325
1915 rather than assuming that all GNU ar's do.
1916 Apparently OpenBSD's older version doesn't.
1917]
1918[Fix the format specifier for Int64/Word64 on Windows
1919Ian Lynagh <igloo@earth.li>**20100327182126
1920 mingw doesn't understand %llu/%lld - it treats them as 32-bit rather
1921 than 64-bit. We use %I64u/%I64d instead.
1922]
1923[Fix the ghci startmenu item
1924Ian Lynagh <igloo@earth.li>**20100326235934
1925 I'm not sure what changed, but it now doesn't work for me without
1926 the "Start in" field being set.
1927]
1928[Fix paths to docs in "Start Menu" entries in Windows installer; fixes #3847
1929Ian Lynagh <igloo@earth.li>**20100326155917]
1930[Add a licence file for the Windows installer to use
1931Ian Lynagh <igloo@earth.li>**20100326155130]
1932[Add gcc-g++ to the inplace mingw installation; fixes #3893
1933Ian Lynagh <igloo@earth.li>**20100326154714]
1934[Add the licence file to the Windows installer. Fixes #3934
1935Ian Lynagh <igloo@earth.li>**20100326152449]
1936[Quote the paths to alex and happy in configure
1937Ian Lynagh <igloo@earth.li>**20100325143449
1938 Ignore-this: d6d6e1a250f88985bbeea760e63a79db
1939]
1940[Use </> rather than ++ "/"
1941Ian Lynagh <igloo@earth.li>**20100325133237
1942 This stops us generating paths like
1943     c:\foo\/ghc460_0/ghc460_0.o
1944 which windres doesn't understand.
1945]
1946[Append $(exeext) to utils/ghc-pkg_dist_PROG
1947Ian Lynagh <igloo@earth.li>**20100324233447
1948 Fixes bindist creation
1949]
1950[A sanity check
1951Simon Marlow <marlowsd@gmail.com>**20100325110500
1952 Ignore-this: 3b3b76d898c822456857e506b7531e65
1953]
1954[do_checks: do not set HpAlloc if the stack check fails
1955Simon Marlow <marlowsd@gmail.com>**20100325110328
1956 Ignore-this: 899ac8c29ca975d03952dbf4608d758
1957 
1958 This fixes a very rare heap corruption bug, whereby
1959 
1960  - a context switch is requested, which sets HpLim to zero
1961    (contextSwitchCapability(), called by the timer signal or
1962    another Capability).
1963 
1964  - simultaneously a stack check fails, in a code fragment that has
1965    both a stack and a heap check.
1966 
1967 The RTS then assumes that a heap-check failure has occurred and
1968 subtracts HpAlloc from Hp, although in fact it was a stack-check
1969 failure and retreating Hp will overwrite valid heap objects.  The bug
1970 is that HpAlloc should only be set when Hp has been incremented by the
1971 heap check.  See comments in rts/HeapStackCheck.cmm for more details.
1972 
1973 This bug is probably incredibly rare in practice, but I happened to be
1974 working on a test that triggers it reliably:
1975 concurrent/should_run/throwto001, compiled with -O -threaded, args 30
1976 300 +RTS -N2, run repeatedly in a loop.
1977]
1978[comments and formatting only
1979Simon Marlow <marlowsd@gmail.com>**20100325104617
1980 Ignore-this: c0a211e15b5953bb4a84771bcddd1d06
1981]
1982[Change how perl scripts get installed; partially fixes #3863
1983Ian Lynagh <igloo@earth.li>**20100324171422
1984 We now regenerate them when installing, which means the path for perl
1985 doesn't get baked in
1986]
1987[Pass the location of gcc in the ghc wrapper script; partially fixes #3863
1988Ian Lynagh <igloo@earth.li>**20100324171408
1989 This means we don't rely on baking a path to gcc into the executable
1990]
1991[Quote the ar path in configure
1992Ian Lynagh <igloo@earth.li>**20100324162043]
1993[Remove unused cUSER_WAY_NAMES cUSER_WAY_OPTS
1994Ian Lynagh <igloo@earth.li>**20100324145048]
1995[Remove unused cCONTEXT_DIFF
1996Ian Lynagh <igloo@earth.li>**20100324145013]
1997[Remove unused cEnableWin32DLLs
1998Ian Lynagh <igloo@earth.li>**20100324144841]
1999[Remove unused cGHC_CP
2000Ian Lynagh <igloo@earth.li>**20100324144656]
2001[Fix the build for non-GNU-ar
2002Ian Lynagh <igloo@earth.li>**20100324132907]
2003[Tweak the Makefile code for making .a libs; fixes trac #3642
2004Ian Lynagh <igloo@earth.li>**20100323221325
2005 The main change is that, rather than using "xargs ar" we now put
2006 all the filenames into a file, and do "ar @file". This means that
2007 ar adds all the files at once, which works around a problem where
2008 files with the same basename in a later invocation were overwriting
2009 the existing file in the .a archive.
2010]
2011[Enable shared libraries on Windows; fixes trac #3879
2012Ian Lynagh <igloo@earth.li>**20100320231414
2013 Ignore-this: c93b35ec5b7a7fa6ddb286d17a616216
2014]
2015[Add the external core PDF to the new build system
2016Ian Lynagh <igloo@earth.li>**20100321161909]
2017[Allow specifying $threads directly when validating
2018Ian Lynagh <igloo@earth.li>**20100321112835]
2019[Remove LazyUniqFM; fixes trac #3880
2020Ian Lynagh <igloo@earth.li>**20100320213837]
2021[UNDO: slight improvement to scavenging ...
2022Simon Marlow <marlowsd@gmail.com>**20100319153413
2023 Ignore-this: f0ab581c07361f7b57eae02dd6ec893c
2024 
2025 Accidnetally pushed this patch which, while it validates, isn't
2026 correct.
2027 
2028 rolling back:
2029 
2030 Fri Mar 19 11:21:27 GMT 2010  Simon Marlow <marlowsd@gmail.com>
2031   * slight improvement to scavenging of update frames when a collision has occurred
2032 
2033     M ./rts/sm/Scav.c -19 +15
2034]
2035[slight improvement to scavenging of update frames when a collision has occurred
2036Simon Marlow <marlowsd@gmail.com>**20100319112127
2037 Ignore-this: 6de2bb9614978975f17764a0f259d9bf
2038]
2039[Don't install the utf8-string package
2040Ian Lynagh <igloo@earth.li>**20100317212709]
2041[Don't use -Bsymbolic when linking the RTS
2042Ian Lynagh <igloo@earth.li>**20100316233357
2043 This makes the RTS hooks work when doing dynamic linking
2044]
2045[Fix Trac #3920: Template Haskell kinds
2046simonpj@microsoft.com**20100317123519
2047 Ignore-this: 426cac7920446e04f3cc30bd1d9f76e2
2048 
2049 Fix two places where we were doing foldl instead of foldr
2050 after decomposing a Kind.  Strange that the same bug appears
2051 in two quite different places!
2052]
2053[copy_tag_nolock(): fix write ordering and add a write_barrier()
2054Simon Marlow <marlowsd@gmail.com>**20100316143103
2055 Ignore-this: ab7ca42904f59a0381ca24f3eb38d314
2056 
2057 Fixes a rare crash in the parallel GC.
2058 
2059 If we copy a closure non-atomically during GC, as we do for all
2060 immutable values, then before writing the forwarding pointer we better
2061 make sure that the closure itself is visible to other threads that
2062 might follow the forwarding pointer.  I imagine this doesn't happen
2063 very often, but I just found one case of it: in scavenge_stack, the
2064 RET_FUN case, after evacuating ret_fun->fun we then follow it and look
2065 up the info pointer.
2066]
2067[Add sliceP mapping to vectoriser builtins
2068benl@ouroborus.net**20100316060517
2069 Ignore-this: 54c3cafff584006b6fbfd98124330aa3
2070]
2071[Comments only
2072benl@ouroborus.net**20100311064518
2073 Ignore-this: d7dc718cc437d62aa5b1b673059a9b22
2074]
2075[TAG 2010-03-16
2076Ian Lynagh <igloo@earth.li>**20100316005137
2077 Ignore-this: 234e3bc29e2f26cc59d7b03d780cc352
2078]
2079Patch bundle hash:
2080c21dcdcda925384f8f1038801abe5997d512ba94