summaryrefslogtreecommitdiff
path: root/module/system/vm/coverage.scm
AgeCommit message (Collapse)AuthorFilesLines
2022-06-16Add missing #:modules argument for coverage-data->lcov.Jessica Tallon1-3/+9
The code coverage function `coverage-data->lcov` has a documented `modules` argument, however that was missing from the source. I have added it so when supplied it only converts the coverage data for the supplied modules. If not supplied it defaults the old behavour of including all the modules currently loaded. * module/system/vm/coverage.scm (coverage-data->lcov): Add #:modules parameter and honor it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-09-14VM manages hook sets itselfAndy Wingo1-5/+4
* libguile/vm.h (SCM_VM_ABORT_HOOK): Rename from SCM_VM_ABORT_CONTINUATION_HOOK. * libguile/vm-engine.c (ABORT_HOOK): * libguile/vm.c (invoke_abort_hook): Adapt to SCM_VM_ABORT_HOOK name change. (reset_vm_hook_enabled): New helper. (VM_ADD_HOOK, VM_REMOVE_HOOK): New helper macros, replacing VM_DEFINE_HOOK. (scm_vm_add_abort_hook_x, scm_vm_remove_abort_hook_x) (scm_vm_add_apply_hook_x, scm_vm_remove_apply_hook_x) (scm_vm_add_return_hook_x, scm_vm_remove_return_hook_x) (scm_vm_add_next_hook_x, scm_vm_remove_next_hook_x): New functions, replacing direct access to the hooks. Allows us to know in a more fine-grained way when to enable hooks. (scm_set_vm_trace_level_x): Use reset_vm_hook_enabled to update the individual hook_enabled flags. * module/statprof.scm: * module/system/vm/coverage.scm: * module/system/vm/traps.scm: * module/system/vm/vm.scm: Adapt VM hook users to the new API.
2013-11-21No more VM objects visible to SchemeAndy Wingo1-3/+4
* libguile/vm.h: * libguile/vm.c (scm_the_vm): Don't expose to Scheme. (scm_vm_p): Remove, as it is not needed. * module/system/vm/vm.scm: Remove the-vm and vm? exports. * doc/ref/api-coverage.texi (Code Coverage): * test-suite/tests/coverage.test: * module/system/vm/coverage.scm (with-code-coverage): Don't take a VM argument. Adapt documentation and tests. * module/ice-9/command-line.scm: Remove the-vm autoload. * module/system/vm/trace.scm (trace-calls-to-procedure): (trace-calls-in-procedure): (trace-instructions-in-procedure): (call-with-trace): Remove #:vm kwarg, and adapt to trap changes. * module/system/vm/trap-state.scm (the-trap-state): Rework to use a parameter underneath instead of a weak key on (the-vm). * module/system/vm/traps.scm (new-disabled-trap): (new-enabled-trap): Remove vm argument. (trap-at-procedure-call): (trap-in-procedure): (trap-instructions-in-procedure): (trap-at-procedure-ip-in-range): (trap-at-source-location): (trap-frame-finish): (trap-in-dynamic-extent): (trap-calls-in-dynamic-extent): (trap-instructions-in-dynamic-extent): (trap-calls-to-procedure): (trap-matching-instructions): Remove vm keyword arguments. * test-suite/tests/control.test ("unwind"): Adapt test. * test-suite/tests/eval.test (test-suite): Remove the-vm import.
2013-11-21VM accessors take VM as implicit argument, not explicit argumentAndy Wingo1-5/+5
* libguile/vm.h: * libguile/vm.c: (scm_vm_apply_hook, scm_vm_push_continuation_hook, scm_vm_pop_continuation_hook, scm_vm_abort_continuation_hook, scm_vm_restore_continuation_hook, scm_vm_next_hook, scm_vm_trace_level, scm_set_vm_trace_level_x, scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): The VM argument is now implicit: the VM for the current thread. * doc/ref/api-debug.texi (VM Hooks): Try to adapt. * module/ice-9/command-line.scm: * module/statprof.scm: * module/system/vm/coverage.scm: * module/system/vm/trace.scm: * module/system/vm/trap-state.scm: * module/system/vm/traps.scm: * test-suite/tests/control.test: * test-suite/tests/eval.test: Adapt users that set hooks or ensure that we have a debug engine.
2013-11-19rtl-program-code -> program-codeAndy Wingo1-1/+1
* libguile/programs.h: * libguile/programs.c (scm_program_code): Rename from scm_rtl_program_code. Also renames rtl-program-code to program-code. * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * test-suite/tests/dwarf.test: * test-suite/tests/rtl.test: Adapt callers.
2013-11-19rtl-program? -> program?Andy Wingo1-2/+2
* libguile/programs.c (scm_program_p): Rename from scm_rtl_program_p. Changes name also from rtl-program? to program?. * libguile/programs.h: * module/ice-9/session.scm: * module/language/tree-il/analyze.scm: * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/frame.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * module/system/xref.scm: Adapt.
2013-11-07frame-instruction-pointer is absolute; rewrite (system vm coverage)Andy Wingo1-197/+165
* libguile/frames.c (scm_frame_source): Instead of assuming that scm_frame_procedure is correct, use the IP to get the source. (scm_frame_instruction_pointer): Return an absolute value instead of assuming that slot 0 is correct. (It isn't, when preparing for a tail call.) * libguile/programs.h: * libguile/programs.c (scm_find_source_for_addr): New internal helper. * module/system/repl/debug.scm (print-registers): Readably print absolute instruction pointers. * module/system/vm/coverage.scm: Complete rewrite to use absolute IP's. We can't assume that frame-procedure is cheap if it is correct, or correct if it is cheap. Anyway using the address is better anyway. (coverage-data->lcov): Disable per-function info temporarily. (loaded-modules, module-procedures, closest-source-line) (closed-over-procedures): Remove these. Instead of going from procedures to source info, now we go from ELF image to source info. * module/system/vm/debug.scm (debug-context-length): New interface. * module/system/vm/program.scm (source-for-addr): New internal helper.
2013-10-17(system vm coverage) works with RTL programsAndy Wingo1-10/+25
* module/system/vm/coverage.scm (hashq-proc, assq-proc) (program-sources*, closed-over-procedures, coverage-data->lcov): Work with RTl procedures.
2010-10-01add source:line-for-user, returning a 1-indexed line numberAndy Wingo1-3/+3
* module/system/vm/program.scm (source:line-for-user): New exported procedure, returns a 1-indexed line, suitable for presentation to a user. (write-program): Use source:line-for-user when making fallback names. * module/system/vm/coverage.scm (coverage-data->lcov): * module/language/assembly/disassemble.scm (source->string): * module/system/repl/debug.scm (print-frame): Use source:line-for-user.
2010-09-27add call-with-vm; remove thread-vm bits; remove vm-apply; engines settable.Andy Wingo1-6/+6
* libguile/vm.h (scm_c_vm_run): Make internal. * libguile/vm.c (vm_default_engine): New static global variable. (make_vm): Set vp->engine based on (scm_vm_apply): Remove in favor of call-with-vm. (scm_thread_vm, scm_set_thread_vm_x): Remove these, as they did not have a well-defined meaning, and were dangerous to call on other threads. (scm_the_vm): Reinstate previous definition. (symbol_to_vm_engine, vm_engine_to_symbol) (vm_has_pending_computation): New helpers. (scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): New accessors for VM engines. (scm_c_set_default_vm_engine_x, scm_set_default_vm_engine_x): New setters for the default VM engine. (scm_call_with_vm): New function, applies a procedure to arguments in a context in which a given VM is current. * libguile/eval.c (eval, scm_apply): VM dispatch goes through scm_call_with_vm. * test-suite/tests/control.test ("the-vm"): * module/system/vm/coverage.scm (with-code-coverage): Use call-with-vm. * module/system/vm/vm.scm: Update exports. * test-suite/vm/run-vm-tests.scm (run-vm-program): * test-suite/tests/compiler.test ("current-reader"): Just rely on the result of make-program being an applicable. * test-suite/tests/eval.test ("stack overflow"): Add a note that this test does not test what it should.
2010-09-24Make `procedure-execution-count' fail gracefully when no source info is ↵Ludovic Courtès1-6/+8
available. * module/system/vm/coverage.scm (procedure-execution-count): Handle the case where (null? (program-sources PROC)).
2010-09-24Fix coverage analysis of procedures called from C.Ludovic Courtès1-3/+6
* module/system/vm/coverage.scm (with-code-coverage): Switch current thread to VM, using `set-thread-vm!'. * test-suite/tests/coverage.test ("procedure-execution-count")["called from C"]: New test.
2010-05-07Add (system vm coverage).Ludovic Courtès1-0/+362
* module/system/vm/coverage.scm: New file. * module/Makefile.am (SYSTEM_SOURCES): Add `system/vm/coverage.scm'. * test-suite/guile-test (main): Use (system vm coverage). Handle `--coverage' and `-c'. * test-suite/tests/coverage.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/coverage.test'. * doc/ref/Makefile.am (guile_TEXINFOS): Add `api-coverage.texi'. * doc/ref/api-coverage.texi: New file. * doc/ref/guile.texi (API Reference): Include it.