[GHC] #11338: Unwind information is incorrect in region surrounding a safe foreign call
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #11337 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Safe foreign calls can occur at the end of a block. Like #11337, these produce incorrect debug information. However, the situation is worse in the case of foreign calls since these return to the calling block. This means that we are currently unable to unwind out of a safe foreign call. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * failure: None/Unknown => Debugging information is incorrect -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * related: #11337 => #11337, #11353 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * cc: simonmar (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * component: Compiler => Compiler (CodeGen) * milestone: => 8.2.1 @@ -1,4 +1,3 @@ - Safe foreign calls can occur at the end of a block. Like #11337, these - produce incorrect debug information. However, the situation is worse in - the case of foreign calls since these return to the calling block. This - means that we are currently unable to unwind out of a safe foreign call. + The code generator produces a prologue and epilogue around a safe foreign + call to suspend and resume the thread state. This needs to be decorated + with proper unwind information. New description: The code generator produces a prologue and epilogue around a safe foreign call to suspend and resume the thread state. This needs to be decorated with proper unwind information. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 (CodeGen) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Phab:D2743 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * differential: => Phab:D2743 * resolution: => invalid Comment: It turns out that this actually isn't a problem. I don't recall what my original reasoning here was, but there seems to be no reason why we can't rely on the value of the STG `Sp` register in the vicinity of a safe foreign call. My DWARF patches work fine, even without Phab:D2743. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 (CodeGen) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Phab:D2743 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"3eb737ee3f900f256a7474b199a4ab40178a8cac/ghc" 3eb737e/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="3eb737ee3f900f256a7474b199a4ab40178a8cac" Generalize CmmUnwind and pass unwind information through NCG As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack unwinding information produced by GHC is currently quite approximate. Essentially we assume that register values do not change at all within a basic block. While this is somewhat true in normal Haskell code, blocks containing foreign calls often break this assumption. This results in unreliable call stacks, especially in the code containing foreign calls. This is worse than it sounds as unreliable unwinding information can at times result in segmentation faults. This patch set attempts to improve this situation by tracking unwinding information with finer granularity. By dispensing with the assumption of one unwinding table per block, we allow the compiler to accurately represent the areas surrounding foreign calls. Towards this end we generalize the representation of unwind information in the backend in three ways, * Multiple CmmUnwind nodes can occur per block * CmmUnwind nodes can now carry unwind information for multiple registers (while not strictly necessary; this makes emitting unwinding information a bit more convenient in the compiler) * The NCG backend is given an opportunity to modify the unwinding records since it may need to make adjustments due to, for instance, native calling convention requirements for foreign calls (see #11353). This sets the stage for resolving #11337 and #11338. Test Plan: Validate Reviewers: scpmw, simonmar, austin, erikd Subscribers: qnikst, thomie Differential Revision: https://phabricator.haskell.org/D2741 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11338: Unwind information is incorrect in region surrounding a safe foreign call -------------------------------------+------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 (CodeGen) | Resolution: invalid | Keywords: DWARF Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: #11337, #11353 | Differential Rev(s): Phab:D2743 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => DWARF -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11338#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC