summaryrefslogtreecommitdiff
path: root/libguile/programs.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-07 23:03:45 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-07 23:03:45 +0100
commit581a4eb82b1534970060e3cbd79b9a96d351edf9 (patch)
treeffd7c1b175ca1746f63f697b4259e52c6c66597a /libguile/programs.c
parent72b82b0f210ef47798133dabf2a81eef3e036ba6 (diff)
downloadguile-581a4eb82b1534970060e3cbd79b9a96d351edf9.tar.gz
frame-instruction-pointer is absolute; rewrite (system vm coverage)
* 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.
Diffstat (limited to 'libguile/programs.c')
-rw-r--r--libguile/programs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libguile/programs.c b/libguile/programs.c
index 77b6417c7..3e228f79c 100644
--- a/libguile/programs.c
+++ b/libguile/programs.c
@@ -399,6 +399,22 @@ scm_i_program_properties (SCM program)
#undef FUNC_NAME
SCM
+scm_find_source_for_addr (SCM ip)
+{
+ static SCM source_for_addr = SCM_BOOL_F;
+
+ if (scm_is_false (source_for_addr)) {
+ if (!scm_module_system_booted_p)
+ return SCM_BOOL_F;
+
+ source_for_addr =
+ scm_c_private_variable ("system vm program", "source-for-addr");
+ }
+
+ return scm_call_1 (scm_variable_ref (source_for_addr), ip);
+}
+
+SCM
scm_program_source (SCM program, SCM ip, SCM sources)
{
static SCM program_source = SCM_BOOL_F;