| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch adds the ability to generate stack traces on crashes for Windows.
When running in the interpreter this attempts to use symbol information from
the interpreter and information we know about the loaded object files to
resolve addresses to symbols.
When running compiled it doesn't have this information and then defaults
to using symbol information from PDB files. Which for now means only
files compiled with ICC or MSVC will show traces compiled.
But I have a future patch that may address this shortcoming.
Also since I don't know how to walk a pure haskell stack, I can for now
only show the last entry. I'm hoping to figure out how Apply.cmm works to
be able to walk the stalk and give more entries for pure haskell code.
In GHCi
```
$ echo main | inplace/bin/ghc-stage2.exe --interactive ./testsuite/tests/rts/derefnull.hs
GHCi, version 8.3.20170830: http://www.haskell.org/ghc/ :? for help
Ok, 1 module loaded.
Prelude Main>
Access violation in generated code when reading 0x0
Attempting to reconstruct a stack trace...
Frame Code address
* 0x77cde10 0xc370229 E:\..\base\dist-install\build\HSbase-4.10.0.0.o+0x190031
(base_ForeignziStorable_zdfStorableInt4_info+0x3f)
```
and compiled
```
Access violation in generated code when reading 0x0
Attempting to reconstruct a stack trace...
Frame Code address
* 0xf0dbd0 0x40bb01 E:\..\rts\derefnull.run\derefnull.exe+0xbb01
```
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3913
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the AP_STACK has been evaluated and a GC has run, the BLACKHOLE
indirection will have been removed, and the StablePtr for the original
AP_STACK referred to be GHCi will therefore now point directly to the
value, and may be tagged. Add a hist002 test for this, and make sure
hist001 doesn't do an idle GC, so the case when it's still a BLACKHOLE
is definitely also tested.
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4099
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, bgamari, erikd, simonmar, trofi
Reviewed By: trofi
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we wouldn't check that mmap would succeed. I suspect this may
have been the cause of #14329.
Test Plan: Validate under low-memory condition
Reviewers: simonmar, austin, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14329
Differential Revision: https://phabricator.haskell.org/D4075
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: pacak, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4068
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr, erikd, simonmar, bgamari
Reviewed By: bgamari
Subscribers: snowleopard, raichoo, rwbarton, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D3994
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new primop
compareByteArrays# :: ByteArray# -> Int# {- offset -}
-> ByteArray# -> Int# {- offset -}
-> Int# {- length -}
-> Int#
allows to compare the subrange of the first `ByteArray#` to
the (same-length) subrange of the second `ByteArray#` and returns a
value less than, equal to, or greater than zero if the range is found,
respectively, to be byte-wise lexicographically less than, to match,
or be greater than the second range.
Under the hood, the new primop is implemented in terms of the standard
ISO C `memcmp(3)` function. It is currently an out-of-line primop but
work is underway to optimise this into an inline primop for a future
follow-up Differential (see D4091).
This primop has applications in packages like `text`, `text-short`,
`bytestring`, `text-containers`, `primitive`, etc. which currently
have to incur the overhead of an ordinary FFI call to directly or
indirectly invoke `memcmp(3)` as well has having to deal with some
`unsafePerformIO`-variant.
While at it, this also improves the documentation for the existing
`copyByteArray#` primitive which has a non-trivial type-signature
that significantly benefits from a more explicit description of its
arguments.
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D4090
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The calculation was too conservative, and could result in copying zero
frames into the new stack chunk, which caused a knock-on failure in
the interpreter.
Test Plan: Tested on an in-house repro (not shareable, unfortunately)
Reviewers: niteria, bgamari, austin, erikd
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4052
|
|
|
|
| |
[skip ci]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's often hard to debug things like segfaults on Windows,
mostly because gdb isn't always of use and users don't know
how to effectively use it.
This patch provides a way to create a crash drump by passing
`+RTS --generate-crash-dumps` as an option. If any unhandled
exception is triggered a dump is made that contains enough
information to be able to diagnose things successfully.
Currently the created dumps are a bit big because I include
all registers, code and threads information.
This looks like
```
$ testsuite/tests/rts/derefnull.run/derefnull.exe +RTS
--generate-crash-dumps
Access violation in generated code when reading 0000000000000000
Crash dump created. Dump written to:
E:\msys64\tmp\ghc-20170901-220250-11216-16628.dmp
```
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd, simonmar
Reviewed By: bgamari, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3912
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
As reported by Alex Lang, R_X86_64_NONE relocations
appear in per-package object files, not per-module object
files. This diff adds _NONE relocations for x86.
Reviewers: bgamari, geekosaur, austin, erikd, simonmar
Reviewed By: geekosaur
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4062
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Knowing this is important for followup commits, where we will subtract
getProcessElapsedTime() values from each other, in a way that assumes
that there is no wrapping every 49 days.
Reviewers: bgamari, austin, erikd, simonmar, NicolasT
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #14233
Differential Revision: https://phabricator.haskell.org/D3964
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exception handling on Windows is unfortunately a bit complicated.
But essentially the VEH Handlers we currently have are running too
early.
This was a problem as it ran so early it also swallowed C++ exceptions
and other software exceptions which the system could have very well
recovered from.
So instead we use a sequence of chains to for the exception handlers to
run as late as possible. You really can't get any later than this.
Please read the comment in the patch for more details.
I'm also providing a switch to allow people to turn off the exception
handling entirely. In case it does present a problem with their code.
(Reverted and recommitted to fix authorship information)
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13911, #12110
Differential Revision: https://phabricator.haskell.org/D3911
|
|
|
|
|
|
| |
Reverting to fix authorship of commit.
This reverts commit 1825cbdbdf08ed4bd6fd6794852596078953298a.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate, add tests
Reviewers: simonmar, austin, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4021
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exception handling on Windows is unfortunately a bit complicated.
But essentially the VEH Handlers we currently have are running too
early.
This was a problem as it ran so early it also swallowed C++ exceptions
and other software exceptions which the system could have very well
recovered from.
So instead we use a sequence of chains to for the exception handlers to
run as late as possible. You really can't get any later than this.
Please read the comment in the patch for more details.
I'm also providing a switch to allow people to turn off the exception
handling entirely. In case it does present a problem with their code.
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13911, #12110
Differential Revision: https://phabricator.haskell.org/D3911
|
|
|
|
|
|
|
|
| |
Reviewers: angerman, austin, erikd, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4034
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Trac #14192 points out that currently GHC's two-step allocator results
in extremely large coredumps. It seems like WebKit may have encountered
similar issues and their apparent solution uses madvise(MADV_DONTNEED)
while reserving address space to inform the kernel that the address
space we just requested needs no backing. Perhaps this is used by the
core dump logic to trim out uncommitted pages.
Test Plan: Validate, try core-dumping a compiled executable
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14192, #14193
Differential Revision: https://phabricator.haskell.org/D3929
|
| |
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: NicolasT, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3979
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this commit, worker OS thread were renamed to "ghc_worker" when
spawned. This was annoying when reading debugging messages that print
the process name because it doesn't tell you *which* Haskell program is
generating the message.
This commit changes it to "original_process_name:w", truncating the
original name to fit in the kernel buffer if neccesary.
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: Phyx, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4001
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Something seems to be changing stderr into binary mode,
so when the `traceIO` is called, the C code that ultimately
calls `vfprintf` is using a binary mode handle.
This causes newlines not to be encoded properly.
The patch ensures we're in text mode when writing the debug
messages (% interleaving as it's not thread safe at all) and restores
the previous mode when done.
I'm slightly concerned about the performance implications of writing
large dumps out in text mode, but I think the current behavior is not
intended as I cannot see any of the printing code setting the mode of
the std handles.
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #14188
Differential Revision: https://phabricator.haskell.org/D4018
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3937
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3985
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, austin, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3958
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, austin, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3957
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is done by reusing the existing cross-platform
`getProcessElapsedTime()` function, which already provides nanosecond
monotonic clocks, and fallback for platforms that don't have those.
To do this, `getProcessElapsedTime()` had to be moved from a private RTS
symbol into the public interface.
Accuracy is improved in 2 ways:
* Use of the monotonic clock where available
* Measuring the total time spent waiting instead of a sum
of intervals (between which there are small gaps)
Reviewers: bgamari, austin, hvr, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3953
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
orzo in `#ghc` reported seeing a crash due to the retainer profiler encountering
a BLOCKING_QUEUE closure, which isRetainer didn't know about. I performed an
audit to make sure that all of the valid closure types were listed; they
weren't. This is my guess of how they should appear.
Test Plan: Validate
Reviewers: simonmar, austin, erikd
Reviewed By: simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14235
Differential Revision: https://phabricator.haskell.org/D3967
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a function to the RTS linker API which lets the
user check the status of dynamically linked objects.
It was initially proposed by @afarmer in D2068.
It's useful for testing the linker and also for detecting retention
problems in production.
It takes a path, because it's easier to use path as key instead of producing
some stable handle.
It returns an enum instead of bool, because I see no reason for destroying
information. All the complexity is already out in the open, so there's
nothing to save the users from.
Test Plan: ./validate
Reviewers: simonmar, Phyx, bgamari, austin, erikd
Reviewed By: Phyx, bgamari
Subscribers: rwbarton, afarmer, thomie
Differential Revision: https://phabricator.haskell.org/D3963
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The
problem turned out to be rather simple: the `obj` pointer was
being tagged using `obj + arity`. Because this is C, that's done
with *pointer arithmetic*, which is not at all what we want. Add
appropriate casts.
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #14036
Differential Revision: https://phabricator.haskell.org/D3983
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
db2a667655506c43dd3c8260d29031bde55f1bee added `-po` option, but
the part that parses it was missing.
Test Plan:
On a simple file:
```
./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest
```
produced test.prof file and didn't produce A.prof file.
```
./A +RTS -P
```
produced A.prof file
Reviewers: simonmar, bgamari, austin, erikd
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3946
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are helpers added in a8da0de27e600211f04601ac737c329d6603c700 to
register cost centres. They are invoked while loading profiled code and
therefore need to be in the RTS's symbol list.
Test Plan: Validate, trying starting GHCi in profiled GHC build
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie, RyanGlScott
Differential Revision: https://phabricator.haskell.org/D3950
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This sprintf is safe thanks to the guarantees on the format strings that
we pass to it. Well, almost. The GR_FILENAME_FMT_GUM format would not
have satisfied them if it was still used.
If someone makes a mistake that's a potential privilege escalation,
so I think it's reasonable to switch to snprintf to protect against
that remote possibility.
Test Plan: it builds, CI
Reviewers: simonmar, bgamari, austin, erikd
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3944
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3942
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Build, program with `-eventlog`, try running with `+RTS -h`
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14096
Differential Revision: https://phabricator.haskell.org/D3922
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #14096
Differential Revision: https://phabricator.haskell.org/D3923
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When doing profiling on startup time of ghci on Windows, both cold and
startup loading static LLVM libs, the profiler is showing a glaring red
spot on the division operation of the the hashStr function.
In fact profiling shows 14% of the time is spent hashing the keys.
So I am replacing the hash function with xxHash which is a very fast
non-crypto hash. It's faster than MurMurHash which node etc use.
It also passes SMHasher. I can provide if required the collected raw
data. But from analysis done on the keys, xxHash does not introduce
more collisions than before, the amount splits seem about the same and
the distributions among the buckets are slightly more uniform than
before.
However the runtime dropped enough to remove the function completely
from the profiler's report.
There's also a noticeable improvement in responsiveness.
xxHash is BSD licensed and can be found
https://github.com/Cyan4973/xxHash
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13165
Differential Revision: https://phabricator.haskell.org/D3909
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This tool can be used to generate dll's for any list of object files
given to it. It will then repartition them automatically to fit within
a dll and generates as many dll's as needed to do this. Cyclic dependencies
between these generated dlls are handle automatically so there is no need
to tell it how to partition.
It is also a lot more general than `dll-split` as it is able to split any
package not just `libGHC`. It also uses a trick using GNU style import libraries
to hide the splitting from the rest of the pipeline. Which means come linking time
you don't need to know which dll contains what symbol or how many split dlls were
created.
The import libraries are by default created with libtool. However since libtool is BFD
based it is very slow. So if present and detected by configure the `genlib` tool
from the msys2 project is used. This makes a difference of about ~45 minutes when compiling.
To install `genlib` run `pacman -Sy mingw-w64-$(uname -m)-tools-git`.
More detailed explaination of the process can be found here
https://ghc.haskell.org/trac/ghc/wiki/WindowsDynamicLinking
Test Plan: ./validate
Reviewers: austin, hvr, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: snowleopard, rwbarton, thomie, erikd, #ghc_windows_task_force
GHC Trac Issues: #5987
Differential Revision: https://phabricator.haskell.org/D3883
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3885
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3884
|
|
|
|
|
|
|
|
| |
Reviewers: austin, erikd, simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3877
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate
Reviewers: austin, erikd, simonmar, dfeuer
Reviewed By: dfeuer
Subscribers: rwbarton, andrewthad, thomie, dfeuer
GHC Trac Issues: #13860, #13857
Differential Revision: https://phabricator.haskell.org/D3888
|
|
|
|
|
|
|
| |
The point of fix is to handle case when loaded dll loads no
other dlls, i.e. it's import table is empty.
GHC Trac Issues: #14081
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The big-obj support (D3523) had introduced an early free on
the info structure. Because the pointer is not NULL'd
and the default of all the utility functions was to the
standard object format, it all kept working.
The one big-obj test that exists was subjected to a timing issue.
usually the test ran quickly enough that the allocator hasn't
had time to reclaim the memory yet, so it still passed.
This corrects it. Also as it so happens, static LLVM libraries
from mingw-w64 are compiled using big-obj.
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13815, #13093
Differential Revision: https://phabricator.haskell.org/D3862
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: The dtrace utility shipped with Debian expects this.
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3829
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we encode the cost centre list as static data. This means that the
initialization stubs are small functions which should be easy for GCC to
compile, even with optimization.
Fixes #7960.
Test Plan: Test profiling
Reviewers: austin, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
GHC Trac Issues: #7960
Differential Revision: https://phabricator.haskell.org/D3853
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: `GHCi.loadDll "/usr/lib/libc++.so` now works on FreeBSD.
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3841
|