guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Use GNU standard for displaying backtraces. Allows Emacs integra


From: Jan Nieuwenhuizen
Subject: [PATCH] Use GNU standard for displaying backtraces. Allows Emacs integration.
Date: Fri, 8 Aug 2014 20:23:00 +0200

        * libguile/backtrace.c (display_backtrace_file_and_line): Return
        absolute file name if not accessible from here.
        (display_backtrace_file): Use GNU-standard error message; remove
        "In "-prefix, add `:line:column' suffix.
---
 libguile/backtrace.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libguile/backtrace.c b/libguile/backtrace.c
index 0c0f110..3b004b6 100644
--- a/libguile/backtrace.c
+++ b/libguile/backtrace.c
@@ -319,16 +319,19 @@ display_backtrace_get_file_line (SCM frame, SCM *file, 
SCM *line)
     {
       /* (addr . (filename . (line . column))), from vm compilation */
       *file = scm_cadr (source);
+      if (scm_is_false (scm_stat (*file, SCM_BOOL_F)))
+        {
+          SCM full = SCM_BOOL_F;
+          full = scm_sys_search_load_path (*file);
+          if (!scm_is_false (full))
+            *file = full;
+        }
       *line = scm_caddr (source);
     }
 }
 
 static void
-display_backtrace_file (frame, last_file, port, pstate)
-     SCM frame;
-     SCM *last_file;
-     SCM port;
-     scm_print_state *pstate;
+display_backtrace_file (SCM frame, SCM *last_file, SCM port, scm_print_state 
*pstate)
 {
   SCM file, line;
 
@@ -339,7 +342,6 @@ display_backtrace_file (frame, last_file, port, pstate)
 
   *last_file = file;
 
-  scm_puts_unlocked ("In ", port);
   if (scm_is_false (file))
     if (scm_is_false (line))
       scm_puts_unlocked ("unknown file", port);
@@ -349,6 +351,8 @@ display_backtrace_file (frame, last_file, port, pstate)
     {
       pstate->writingp = 0;
       scm_iprin1 (file, port, pstate);
+      scm_puts_unlocked (":", port);
+      scm_intprint (scm_to_int (line) + 1, 10, port);
       pstate->writingp = 1;
     }
   scm_puts_unlocked (":\n", port);
-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ®  http://AvatarAcademy.nl  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]