Escape backslashes in json profiling reports properly.

I also took the liberty to do away the fixed buffer size for escaping.
Using a fixed size here can only lead to issues down the line.

Fixes #18438.
24 jobs for !3675 with wip/andreask/jsonProfEscaping in 490 minutes and 27 seconds (queued for 1 second)
detached
Status Job ID Name Coverage
  Lint
passed #390793
lint
ghc-linters

00:00:14

passed #390794
lint
lint-linters

00:00:14

passed #390797
lint
lint-submods

00:00:22

passed #390795
lint
lint-testsuite

00:00:16

passed #390796
lint
typecheck-testsuite

00:00:15

 
  Quick Build
passed #390798
x86_64-linux
hadrian-ghc-in-ghci

00:10:04

 
  Build
passed #390799
x86_64-linux
validate-x86_64-linux-deb9-hadrian

01:28:37

 
  Full Build
failed #390802
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

03:27:31

failed #390803
armv7-linux allowed to fail
validate-armv7-linux-deb9

03:12:43

passed #390804
x86_64-linux
validate-i386-linux-deb9

00:55:34

failed #390811
new-x86_64-windows test allowed to fail
validate-i386-windows

00:02:54

passed #390801
x86_64-darwin
validate-x86_64-darwin

01:09:15

passed #390805
x86_64-linux
validate-x86_64-linux-deb9-debug

01:44:49

passed #393967
x86_64-linux
validate-x86_64-linux-deb9-dwarf

02:04:10

passed #390806
x86_64-linux
validate-x86_64-linux-deb9-integer-simple

00:54:24

passed #390800
x86_64-linux
validate-x86_64-linux-deb9-unreg-hadrian

01:35:05

passed #390808
x86_64-linux
validate-x86_64-linux-fedora27

01:01:37

failed #390810
new-x86_64-windows test allowed to fail
validate-x86_64-windows

03:03:19

failed #390809
new-x86_64-windows test allowed to fail
validate-x86_64-windows-hadrian

03:36:12

failed #390807
x86_64-linux
validate-x86_64-linux-deb9-dwarf

01:43:36

 
  Cleanup
passed #390812
x86_64-darwin
cleanup-darwin

00:00:18

 
  Packaging
passed #390813
x86_64-linux
doc-tarball

00:12:08

 
  Testing
manual #390814
x86_64-linux allowed to fail manual
hackage
passed #390815
x86_64-linux
perf-nofib

00:37:59

 
Name Stage Failure
failed
validate-i386-windows Full Build
Git branch:   13-1-stable
GO version: go1.13.8
Built: 2020-06-19T21:12:23+0000
OS/Arch: windows/amd64
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=4456 revision=6214287e version=13.1.0
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit status 1
failed
validate-aarch64-linux-deb9 Full Build
Uploading artifacts...
ghc-aarch64-linux-deb9.tar.xz: found 1 matching files

junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

Uploading artifacts to coordinator... ok
id=390802 responseStatus=201 Created token=5Z_zySvQ
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=390802 responseStatus=201 Created token=5Z_zySvQ
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows-hadrian Full Build
GO version:   go1.13.8
Built: 2020-06-19T21:12:23+0000
OS/Arch: windows/amd64
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=1056 revision=6214287e version=13.1.0
junit.xml: found 1 matching files and directories

WARNING: Failed to load system CertPool: crypto/x509: system root pool is not available on Windows
Uploading artifacts as "junit" to coordinator... ok
id=390809 responseStatus=201 Created token=zjrWmFZK
ERROR: Job failed: exit status 1
failed
validate-x86_64-windows Full Build
GO version:   go1.13.8
Built: 2020-06-19T21:12:23+0000
OS/Arch: windows/amd64
Uploading artifacts...
Runtime platform
arch=amd64 os=windows pid=5356 revision=6214287e version=13.1.0
junit.xml: found 1 matching files and directories

WARNING: Failed to load system CertPool: crypto/x509: system root pool is not available on Windows
Uploading artifacts as "junit" to coordinator... ok
id=390810 responseStatus=201 Created token=vrkdWqbb
ERROR: Job failed: exit status 1
failed
validate-armv7-linux-deb9 Full Build
Uploading artifacts...
ghc-armv7-linux-deb9.tar.xz: found 1 matching files

junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

Uploading artifacts to coordinator... ok
id=390803 responseStatus=201 Created token=poL-uVza
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=390803 responseStatus=201 Created token=poL-uVza
ERROR: Job failed: exit code 1