mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-09 15:10:29 +02:00
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.
This commit is contained in:
parent
72b82b0f21
commit
581a4eb82b
7 changed files with 204 additions and 220 deletions
|
@ -104,18 +104,9 @@ SCM_DEFINE (scm_frame_source, "frame-source", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_frame_source
|
||||
{
|
||||
SCM proc;
|
||||
|
||||
SCM_VALIDATE_VM_FRAME (1, frame);
|
||||
|
||||
proc = scm_frame_procedure (frame);
|
||||
|
||||
if (SCM_PROGRAM_P (proc) || SCM_RTL_PROGRAM_P (proc))
|
||||
return scm_program_source (scm_frame_procedure (frame),
|
||||
scm_frame_instruction_pointer (frame),
|
||||
SCM_UNDEFINED);
|
||||
|
||||
return SCM_BOOL_F;
|
||||
return scm_find_source_for_addr (scm_frame_instruction_pointer (frame));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -254,22 +245,9 @@ SCM_DEFINE (scm_frame_instruction_pointer, "frame-instruction-pointer", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_frame_instruction_pointer
|
||||
{
|
||||
SCM program;
|
||||
const struct scm_objcode *c_objcode;
|
||||
|
||||
SCM_VALIDATE_VM_FRAME (1, frame);
|
||||
program = scm_frame_procedure (frame);
|
||||
|
||||
if (SCM_RTL_PROGRAM_P (program))
|
||||
return scm_from_ptrdiff_t (SCM_VM_FRAME_IP (frame) -
|
||||
(scm_t_uint8 *) SCM_RTL_PROGRAM_CODE (program));
|
||||
|
||||
if (!SCM_PROGRAM_P (program))
|
||||
return SCM_INUM0;
|
||||
|
||||
c_objcode = SCM_PROGRAM_DATA (program);
|
||||
return scm_from_unsigned_integer ((SCM_VM_FRAME_IP (frame)
|
||||
- SCM_C_OBJCODE_BASE (c_objcode)));
|
||||
return scm_from_uintptr_t ((scm_t_uintptr) SCM_VM_FRAME_IP (frame));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue