[GHC] #14510: GHC.ExecutionStack.showStackTrace broken

#14510: GHC.ExecutionStack.showStackTrace broken -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When compiled with the dwarf bindist of 8.2.2 with {{{ ghc --make -g testdwarf.hs }}} The following is output: {{{ testdwarf: Failed to get stack frames of current process: no matching address range: Success }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by duog): * Attachment "testdwarf.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by duog): * version: 8.2.2 => 8.2.1 * os: Unknown/Multiple => Linux * architecture: Unknown/Multiple => x86_64 (amd64) Comment: Happens with 8.2.1 as well, so I must assume there's a problem with my configuration. Ubuntu 16.04 libdw-dev Version: 0.165-3ubuntu1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by duog): bgamari was able to reproduce this, so it may well be a real bug. I spent some time today learning all about libdw, and I was able to determine what's going wrong, though not why. It happens at this "stack trace": [https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdw/dwarf_next_cfi.c;h... libdw/dwarf_next_cfi.c:dwarf_next_cfi:55] [https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdw/fde.c;h=f5f6fbe141... libdw/fde.c:__libdw_find_fde:283] [https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdw/dwarf_cfi_addrfram... libdw/dwarf_cfi_addrframe.c:dwarf_cfi_addrframe:42] [https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdwfl/frame_unwind.c;h... libdwfl/frame_unwind.c:handle_cfi:542] [https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdwfl/frame_unwind.c;h... libdwfl/frame_unwind.c:__libdwfl_frame_unwind:722] ... rts/libdw/libdwGetBacktrace `off + 4 >= data->d_size` is true. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bollu): * cc: bollu (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by niteria): * cc: niteria (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by niteria): I've just tried with GHC HEAD and I get: {{{ $ ./testdwarf Stack trace: set_initial_registers (rts/Libdw.c:288.0) in /data/users/bnitka/ghc-14510/testdwarf dwfl_thread_getframes in get_one_thread_cb in /usr/lib64/libdw-0.168.so dwfl_getthreads in /usr/lib64/libdw-0.168.so dwfl_getthread_frames in /usr/lib64/libdw-0.168.so libdwGetBacktrace (rts/Libdw.c:259.0) in /data/users/bnitka/ghc-14510/testdwarf base_GHCziExecutionStackziInternal_collectStackTrace1_info (libraries/base/GHC/ExecutionStack/Internal.hsc:74.10) in /data/users/bnitka/ghc-14510/testdwarf base_GHCziExecutionStackziInternal_collectStackTrace1_info (libraries/base/GHC/ExecutionStack/Internal.hsc:74.10) in /data/users/bnitka/ghc-14510/testdwarf base_GHCziExecutionStack_showStackTrace1_info (libraries/base/GHC/ExecutionStack.hs:50.1) in /data/users/bnitka/ghc-14510/testdwarf base_GHCziBase_zdfMonadIO1_info (libraries/base/GHC/Base.hs:1389.1) in /data/users/bnitka/ghc-14510/testdwarf base_GHCziBase_zdfApplicativeIO2_info (libraries/base/GHC/Base.hs:1392.1) in /data/users/bnitka/ghc-14510/testdwarf stg_catch_frame_info (rts/Exception.cmm:372.1) in /data/users/bnitka/ghc-14510/testdwarf stg_stop_thread_info (rts/StgStartup.cmm:42.1) in /data/users/bnitka/ghc-14510/testdwarf StgRunIsImplementedInAssembler (rts/StgCRun.c:370.0) in /data/users/bnitka/ghc-14510/testdwarf scheduleWaitThread (rts/Schedule.c:453.0) in /data/users/bnitka/ghc-14510/testdwarf hs_main (rts/RtsMain.c:73.0) in /data/users/bnitka/ghc-14510/testdwarf in /data/users/bnitka/ghc-14510/testdwarf __libc_start_main in _start in /data/users/bnitka/ghc-14510/testdwarf }}} I had to modify it slightly for it to print anything: {{{ import GHC.ExecutionStack import Data.Maybe main :: IO () main = do putStrLn . fromMaybe "" =<< showStackTrace return () }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by niteria): 5d3b15ecbf17b7747c2f7313a981c60a2d22904d got rid of this message for `-threaded`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by osa1): * cc: osa1 (added) Comment: What is the expected output here? I just tried this with 8.2.2, 8.4.3 and 8.6.1 on Ubuntu 18.04. I don't get any errors with 8.4.3 and 8.6.1 but `showStackTrace` returns `Nothing`. With 8.2.2 I get this compile error: {{{ [1 of 1] Compiling Main ( testdwarf.hs, testdwarf.o ) /tmp/ghc28125_0/ghc_2.s: Assembler messages: /tmp/ghc28125_0/ghc_2.s:1059:0: error: Error: invalid operands (.debug_frame and .note.GNU-stack sections) for `-' | 1059 | .uleb128 1f-.-1 | ^ /tmp/ghc28125_0/ghc_2.s:1133:0: error: Error: invalid operands (.debug_frame and .note.GNU-stack sections) for `-' | 1133 | .uleb128 1f-.-1 | ^ /tmp/ghc28125_0/ghc_2.s:1162:0: error: Error: invalid operands (.debug_frame and .note.GNU-stack sections) for `-' | 1162 | .uleb128 1f-.-1 | ^ /tmp/ghc28125_0/ghc_2.s:1191:0: error: Error: invalid operands (.debug_frame and .note.GNU-stack sections) for `-' | 1191 | .uleb128 1f-.-1 | ^ `gcc' failed in phase `Assembler'. (Exit code: 1) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14510: GHC.ExecutionStack.showStackTrace broken ---------------------------------+-------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: DWARF Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bgamari): * keywords: => DWARF -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14510#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC