1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

backtrace.c: allow vectors for SCM_FRAME_SOURCE (frame)

* libguile/backtrace.c (display_backtrace_get_file_line): If the source
  is a vector, treat it as a #(line column file) vector, as emitted by
  the VM. Needs subsequent patches to make sense.
This commit is contained in:
Andy Wingo 2008-12-26 16:35:43 +01:00
parent eff313ed21
commit e052d29640

View file

@ -467,8 +467,21 @@ static void
display_backtrace_get_file_line (SCM frame, SCM *file, SCM *line) display_backtrace_get_file_line (SCM frame, SCM *file, SCM *line)
{ {
SCM source = SCM_FRAME_SOURCE (frame); SCM source = SCM_FRAME_SOURCE (frame);
*file = SCM_MEMOIZEDP (source) ? scm_source_property (source, scm_sym_filename) : SCM_BOOL_F; *file = *line = SCM_BOOL_F;
*line = (SCM_MEMOIZEDP (source)) ? scm_source_property (source, scm_sym_line) : SCM_BOOL_F; if (SCM_MEMOIZEDP (source))
{
*file = scm_source_property (source, scm_sym_filename);
*line = scm_source_property (source, scm_sym_line);
}
else if (scm_is_vector (source))
{
/* #(line column file), from VM compilation */
size_t len = scm_c_vector_length (source);
if (len >= 3)
*file = scm_c_vector_ref (source, 2);
if (len >= 1)
*line = scm_c_vector_ref (source, 0);
}
} }
static void static void