summaryrefslogtreecommitdiff
path: root/rts/RtsMessages.c
Commit message (Collapse)AuthorAgeFilesLines
* Change assertions in Stats.c to warnings (and introduce WARN macro)Matthew Pickering2022-01-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | ASSERT should be used in situations where something very bad will happen later on if a certain invariant doesn't hold. The idea is that IF we catch the assertion earlier then it will be easier to work out what's going on at that point rather than at some indeterminate point in the future of the program. The assertions in Stats.c do not obey this philsophy and it is quite annoying if you are running a debug build (or a ticky compiler) and one of these assertions fails right at the end of your program, before the ticky report is printed out so you don't get any profiling information. Given that nothing terrible happens if these assertions are not true, or at least the terrible thing will happen in very close proximity to the assertion failure, these assertions use the new WARN macro which prints the assertion failure to stdout but does not exit the program. Of course, it would be better to fix these metrics to not trigger the assertion in the first place but if they did fail again in the future it is frustrating to be bamboozled in this manner. Fixes #20899
* codeGen: Introduce flag to bounds-check array accessesBen Gamari2021-12-211-0/+9
| | | | | | | Here we introduce code generator support for instrument array primops with bounds checking, enabled with the `-fcheck-prim-bounds` flag. Introduced to debug #20769.
* Kill a use of %n format specifierGreg Steuck2021-11-251-6/+7
| | | | | | | | | | | | | | This format has been used as a security exploit vector for decades now. Some operating systems (OpenBSD, Android, MSVC). It is targeted for removal in C2X standard: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2834.htm This requires extending the debug message function to return the number of bytes written (like printf(3)), to permit %n format specifier in one in one invocation of statsPrintf() in report_summary(). Implemented by Matthias Kilian (kili<AT>outback.escape.de)
* Make `PosixSource.h` installed and under `rts/`John Ericson2021-08-091-1/+1
| | | | | | is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained.
* rts: Fix erroneous usage of vsnprintfBen Gamari2020-09-161-1/+1
| | | | | | | As pointed out in #18685, this should be snprintf not vsnprintf. This appears to be due to a cut-and-paste error. Fixes #18658.
* Expunge #ifdef and #ifndef from the codebaseJohn Ericson2019-07-141-1/+1
| | | | | | | | These are unexploded minds as far as the linter is concerned. I don't want to hit in my MRs by mistake! I did this with `sed`, and then rolled back some changes in the docs, config.guess, and the linter itself.
* Use https links in user-facing startup and error messagesBen Gamari2018-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I consider myself lucky that in my circle of friends, `http` urls (as opposed to `https` urls) are frowned upon in that we generally apologize in the rase cases that we share an `http` url. This pull request changes `http` links into their `https` analogues in the following places: * In the GHCI startup message (and parts of the User's Guide, where there are verbatim transcripts of GHCi sessions). * In a couple of error messages, asking the user to report a bug. (I also took the liberty to change a single space before the reportabug url into two spaces, harmonizing this occurence with the others.) I'm not trying to start a war. I just had a moment to spare and felt like preparing this diff. Merge or don't merge as you wish! Reviewers: bgamari, erikd, simonmar Subscribers: goldfire, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5450
* Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try)Bartosz Nitka2018-05-171-3/+1
| | | | | | | | | | | | | | | | | Summary: See the new note. This should fix cb5c2fe875965b7aedbc189012803fc62e48fb3f enough to unbreak Windows and OS X builds. Test Plan: manual testing with patched gdb Reviewers: bgamari, simonmar, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4694
* Revert "Fix unwinding of C -> Haskell FFI calls with -threaded"Bartosz Nitka2018-05-121-1/+3
| | | | | | This reverts commit cb5c2fe875965b7aedbc189012803fc62e48fb3f. It appears to have broken OSX and Windows builds.
* Fix unwinding of C -> Haskell FFI calls with -threadedBartosz Nitka2018-05-111-3/+1
| | | | | | | | | | | | | See the new note. Test Plan: manual testing with patched gdb Reviewers: bgamari, simonmar, erikd Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4666
* Add -falignment-sanitization flagBen Gamari2017-10-291-0/+10
| | | | | | | | | | | | | | | | | | | Here we add a flag to instruct the native code generator to add alignment checks in all info table dereferences. This is helpful in catching pointer tagging issues. Thanks to @jrtc27 for uncovering the tagging issues on Sparc which inspired this flag. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, trofi, thomie, jrtc27 Differential Revision: https://phabricator.haskell.org/D4101
* rts: Print newline after "Stack trace:" on barfBen Gamari2017-10-031-1/+1
| | | | [skip ci]
* Ensure text mode when calling debug functionsTamar Christina2017-09-251-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Prefer #if defined to #ifdefBen Gamari2017-04-281-2/+2
| | | | Our new CPP linter enforces this.
* rts: Produce stack trace on fatal errorBen Gamari2015-11-011-0/+12
| | | | | | | | | | | | Test Plan: Validate Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: simonmar, thomie, scpmw Differential Revision: https://phabricator.haskell.org/D1418
* Remove cygwin32_HOST_OS #ifdefsErik de Castro Lopo2015-10-261-7/+7
| | | | | | | | | | | | | | | | | Build system support for Cygwin was removed in b6be81b841. Test Plan: - Validate on x86_64/linux - Cross-compile rts/RtsSymbols.c and rts/Linker.c to Windows using the i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc cross compilers. Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1371
* [skip ci] rts: Detabify RtsMessages.cAustin Seipp2014-10-211-44/+44
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Use message-passing to implement throwTo in the RTSSimon Marlow2010-03-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces some complicated locking schemes with message-passing in the implementation of throwTo. The benefits are - previously it was impossible to guarantee that a throwTo from a thread running on one CPU to a thread running on another CPU would be noticed, and we had to rely on the GC to pick up these forgotten exceptions. This no longer happens. - the locking regime is simpler (though the code is about the same size) - threads can be unblocked from a blocked_exceptions queue without having to traverse the whole queue now. It's a rare case, but replaces an O(n) operation with an O(1). - generally we move in the direction of sharing less between Capabilities (aka HECs), which will become important with other changes we have planned. Also in this patch I replaced several STM-specific closure types with a generic MUT_PRIM closure type, which allowed a lot of code in the GC and other places to go away, hence the line-count reduction. The message-passing changes resulted in about a net zero line-count difference.
* Print the prog name in errorBelch() even if prog_argv is not set yetSimon Marlow2009-11-191-1/+1
| | | | This means we get the prog name in error messages from the flag parser
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* sysErrorBelch: don't put an extra \n on WindowsSimon Marlow2008-09-031-0/+5
|
* fix Unix buildSimon Marlow2006-08-301-0/+2
|
* add sysErrorBelch() for reporting system call errorsSimon Marlow2006-08-301-1/+72
|
* add 'const' modifiers to types where appropriateSimon Marlow2006-06-071-10/+10
|
* TARGET_OS ==> HOST_OSSimon Marlow2006-05-241-4/+4
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+201
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.