summaryrefslogtreecommitdiff
path: root/rts/Hpc.c
Commit message (Collapse)AuthorAgeFilesLines
* rts: Always truncate output filesBen Gamari2019-08-021-1/+1
| | | | | | | | | Previously there were numerous places in the RTS where we would fopen with the "w" flag string. This is wrong as it will not truncate the file. Consequently if we write less data than the previous length of the file we will leave garbage at its end. Fixes #16993.
* Remove MAX_PATH restrictions from RTS, I/O manager and various utilitiesTamar Christina2018-03-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This shims out fopen and sopen so that they use modern APIs under the hood along with namespaced paths. This lifts the MAX_PATH restrictions from Haskell programs and makes the new limit ~32k. There are only some slight caveats that have been documented. Some utilities have not been upgraded such as lndir, since all these things are different cabal packages I have been forced to copy the source in different places which is less than ideal. But it's the only way to keep sdist working. Test Plan: ./validate Reviewers: hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #10822 Differential Revision: https://phabricator.haskell.org/D4416
* Prefer #if defined to #ifdefBen Gamari2017-04-281-4/+4
| | | | Our new CPP linter enforces this.
* Use C99's boolBen Gamari2016-11-291-3/+3
| | | | | | | | | | | | Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
* rts: More const correct-ness fixesErik de Castro Lopo2016-05-181-1/+2
| | | | | | | | | | | | | | | | | | | | In addition to more const-correctness fixes this patch fixes an infelicity of the previous const-correctness patch (995cf0f356) which left `UNTAG_CLOSURE` taking a `const StgClosure` pointer parameter but returning a non-const pointer. Here we restore the original type signature of `UNTAG_CLOSURE` and add a new function `UNTAG_CONST_CLOSURE` which takes and returns a const `StgClosure` pointer and uses that wherever possible. Test Plan: Validate on Linux, OS X and Windows Reviewers: Phyx, hsyl20, bgamari, austin, simonmar, trofi Reviewed By: simonmar, trofi Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2231
* rts: Replace `nat` with `uint32_t`Erik de Castro Lopo2016-05-051-5/+5
| | | | | | | | | | | | The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: detabify/dewhitespace Hpc.cAustin Seipp2014-08-201-23/+23
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* 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>
* Check correct variable for NULLNicolas Trangez2014-04-271-1/+1
| | | | | | | Issue discovered by Coverity scan, CID 43163. This should fix CID 43172 as a side-effect as well. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Change the way module initialisation is done (#3252, #4417)Simon Marlow2011-04-121-90/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the code generator generated small code fragments labelled with __stginit_M for each module M, and these performed whatever initialisation was necessary for that module and recursively invoked the initialisation functions for imported modules. This appraoch had drawbacks: - FFI users had to call hs_add_root() to ensure the correct initialisation routines were called. This is a non-standard, and ugly, API. - unless we were using -split-objs, the __stginit dependencies would entail linking the whole transitive closure of modules imported, whether they were actually used or not. In an extreme case (#4387, #4417), a module from GHC might be imported for use in Template Haskell or an annotation, and that would force the whole of GHC to be needlessly linked into the final executable. So now instead we do our initialisation with C functions marked with __attribute__((constructor)), which are automatically invoked at program startup time (or DSO load-time). The C initialisers are emitted into the stub.c file. This means that every time we compile with -prof or -hpc, we now get a stub file, but thanks to #3687 that is now invisible to the user. There are some refactorings in the RTS (particularly for HPC) to handle the fact that initialisers now get run earlier than they did before. The __stginit symbols are still generated, and the hs_add_root() function still exists (but does nothing), for backwards compatibility.
* Replace some exit(n) calls with stg_exit(n); fixes trac #4445Ian Lynagh2010-10-281-2/+2
| | | | Also changed exitcode of -1 to 1 in hpc.
* use FMT_Word64 instead of locally-defined versionSimon Marlow2010-03-301-8/+1
|
* Stifle warning about printf format stringsbenl@cse.unsw.edu.au2010-02-031-1/+1
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Allow the exact HPC tix filename to be given in the HPCTIXFILE env varIan Lynagh2008-07-011-1/+7
|
* Fixing HPCTIXDIR problem with mkdir usage on Windowsandy@galois.com2008-04-111-1/+6
|
* Adding environment variable HPCTIXDIR, a directory to place tix results.andy@galois.com2008-04-081-3/+23
|
* Fix more warningsSimon Marlow2007-10-231-4/+4
|
* FIX BUILD (on 32-bit platforms): hs_hpc_module() type mismatchSimon Marlow2007-10-231-4/+4
|
* Change some ints to unsigned intsSimon Marlow2007-10-181-5/+5
| | | | Fixes some gratuitous warnings when compiling via C with -fhpc
* Writing out .tix file only if you are the original process, not a child.andy@galois.com2007-09-171-2/+11
| | | | | | | This lets us gain coverage on programs that use fork, like xmonad. * To be merged to STABLE *
* removing the functions hs_hpc_read and hs_hpc_write inside Hpc.c, they are ↵andy@galois.com2007-09-171-38/+0
| | | | | | | dead code. * To be merged to STABLE. *
* Cleaning up Hpc.c; adding support for reflection into Hpc.andy@galois.com2007-06-271-12/+9
|
* Cleanup Hpc sub-system, remove hpc-tracer implementation.andy@galois.com2007-06-261-280/+11
|
* Adding new ffi calls into the Hpc rts subsystemandy@galois.com2007-06-121-94/+117
| | | | | | | | | foreign import ccall unsafe hs_hpc_write :: CString -> IO () foreign import ccall unsafe hs_hpc_read :: CString -> IO () These write a Hpc description of the state of the world to a file, or read a description into the current Hpc tickbox subsystem.
* Changing internal data structures used by Hpcandy@galois.com2007-04-301-70/+83
| | | | | | | | | - .tix files are now a list of MixModule, which contain a hash of the contents of the .mix file. - .mix files now have (the same) hash number. This changes allow different binaries that use the same module compiled in the same way to share coverage information.
* Fixing bad allocation of tix box breakpointing array.andy@galois.com2007-02-131-1/+4
|
* Using RTS debug tracing support inside Hpc.candy@galois.com2007-02-131-61/+57
|
* Changing bootstrapping for pipes between debugger and debuggeeandy@galois.com2007-01-101-34/+48
| | | | | | | | | - Now we use two pipes and a fork rather than use named pipes - We use the HPCRIX env var to send the pipe numbers in %d:%d format - We now always breakpoint for special events - We check to see we are the original process before each breakpoint event sub processes are not debugged; this lets us debug the debugger.
* Dynamically allocating the tix box breakpoint arrayandy@galois.com2007-01-091-1/+5
|
* Adding command channel for the hpc debugger to the hpc part of the RTSandy@galois.com2007-01-091-50/+201
|
* Updating rix output to new standard.andy@galois.com2006-12-141-4/+4
|
* Removing unused argument to a printf.andy@galois.com2006-12-131-1/+1
|
* Misc Hpc improvement to dynamic tracer outputandy@galois.com2006-12-131-49/+66
| | | | | | | - Added HPCRIX support for passing tracer filename. - Added thread tracing support. - Cleaned up use of HsFFI.h
* Adding tracing supportandy@galois.com2006-12-091-4/+86
|
* Misc unsigned printing issues; adding magicTixNumber.andy@galois.com2006-11-301-8/+13
|
* Added a workaround for format specifier mismatchsven.panne@aedion.de2006-11-101-1/+8
|
* Changing Main.tix to <prog_name>.tix in the Hpc RTSandy@galois.com2006-10-251-1/+6
|
* Haskell Program Coverageandy@galois.com2006-10-241-0/+324
This large checkin is the new ghc version of Haskell Program Coverage, an expression-level coverage tool for Haskell. Parts: - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files. - Coverage.lhs - Annotates the HsSyn with coverage tickboxes. - New Note's in Core, - TickBox -- ticked on entry to sub-expression - BinaryTickBox -- ticked on exit to sub-expression, depending -- on the boolean result. - New Stg level TickBox (no BinaryTickBoxes, though) You can run the coverage tool with -fhpc at compile time. Main must be compiled with -fhpc.