Skip to content

GHC.Conc.labelThread function can't use Unicode character for thread label.

Debug.Trace.traceEventIO fucntion uses UTF-8 encoding for outputing Strings.

http://www.haskell.org/ghc/docs/7.4.1/html/libraries/base-4.5.0.0/src/Debug-Trace.html#traceEventIO

"ghc-events show" can show Unicode characters' user event correctly.

import Debug.Trace
main = do
    traceEventIO "テスト"
    putStrLn "test"
$ ghc -O2 -threaded -eventlog Test.hs
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Linking Test.exe ...

$ .\Test.exe +RTS -l
"test"
$ ghc-events show Test.eventlog > test.log
Event Types:
  (snip)

Events:
  (snip)
  1531003: cap 0: running thread 3
  1594090: cap 0: テスト
  1805086: cap 0: stopping thread 3 (making a foreign call)
  (snip)

But GHC.Conc.labelThread function doesn't use UTF-8 encoding.

http://www.haskell.org/ghc/docs/7.4.1/html/libraries/base-4.5.0.0/src/GHC-Conc-Sync.html#labelThread

So, "ghc-events show" can't show Unicode characters' thread label correctly.

import Control.Concurrent
import GHC.Conc (labelThread)

main = do
    tid <-myThreadId
    labelThread tid "テスト"
    putStrLn "test"
Events:
  (snip)
  1438032: cap 0: running thread 3
  1454030: cap 0: thread 3 has label "????
  1637859: cap 0: stopping thread 3 (making a foreign call)
  (snip)
Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC shelarcy@gmail.com
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information