unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#36677: [PATCH] Don't truncate backtraces
@ 2019-07-15 20:29 Robert Vollmert
  2019-07-17 17:57 ` Mark H Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Vollmert @ 2019-07-15 20:29 UTC (permalink / raw)
  To: 36677; +Cc: Robert Vollmert

* module/system/repl/debug.scm (print-frame): Print full object if
width keyword is #f.
* libguile/backtrace.c (display_backtrace_body): Call print-frames
with #:width #f.
---

This change was prompted by recent discussion on the Guix lists:
  https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
In Guix, the truncation of stack traces frequently obscures
important information due to the long filenames.

Apologies if this misses some obvious things, I'm not particularly
at home in the Guile sources. Let me know, happy to adapt!

Cheers
Robert

 libguile/backtrace.c         |  6 ++++--
 module/system/repl/debug.scm | 13 +++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libguile/backtrace.c b/libguile/backtrace.c
index 4a19d4b8a..4d0b4ab94 100644
--- a/libguile/backtrace.c
+++ b/libguile/backtrace.c
@@ -77,6 +77,7 @@ boot_print_exception (SCM port, SCM frame, SCM key, SCM args)
 static SCM print_exception_var;
 static SCM print_frame_var;
 static SCM kw_count;
+static SCM kw_width;
 static SCM print_frames_var;
 static SCM frame_to_stack_vector_var;
 
@@ -99,6 +100,7 @@ static void
 init_print_frames_var_and_frame_to_stack_vector_var (void)
 {
   kw_count = scm_from_latin1_keyword ("count");
+  kw_width = scm_from_latin1_keyword ("width");
   print_frames_var =
     scm_c_public_variable ("system repl debug", "print-frames");
   frame_to_stack_vector_var =
@@ -236,8 +238,8 @@ display_backtrace_body (struct display_backtrace_args *a)
                        scm_stack_ref (a->stack, a->first));
 
   /* FIXME: highlight_objects */
-  scm_call_4 (scm_variable_ref (print_frames_var), frames, a->port,
-              kw_count, a->depth);
+  scm_call_6 (scm_variable_ref (print_frames_var), frames, a->port,
+              kw_count, a->depth, kw_width, SCM_BOOL_F);
   
   return SCM_UNSPECIFIED;
 }
diff --git a/module/system/repl/debug.scm b/module/system/repl/debug.scm
index 383d37921..7422bf980 100644
--- a/module/system/repl/debug.scm
+++ b/module/system/repl/debug.scm
@@ -135,10 +135,15 @@
          (col (and=> source source:column)))
     (if (and file (not (equal? file (source:pretty-file last-source))))
         (format port "~&In ~a:~&" file))
-    (format port "~9@a~:[~*~3_~;~3d~] ~v:@y~%"
-            (if line (format #f "~a:~a" line col) "")
-            index index width
-            (frame-call-representation frame #:top-frame? (zero? index)))
+    (if width
+      (format port "~9@a~:[~*~3_~;~3d~] ~v:@y~%"
+              (if line (format #f "~a:~a" line col) "")
+              index index width
+              (frame-call-representation frame #:top-frame? (zero? index)))
+      (format port "~9@a~:[~*~3_~;~3d~] ~a~%"
+              (if line (format #f "~a:~a" line col) "")
+              index index
+              (frame-call-representation frame #:top-frame? (zero? index))))
     (if full?
         (print-locals frame #:width width
                       #:per-line-prefix "     "))))
-- 
2.20.1 (Apple Git-117)






^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-25 16:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-15 20:29 bug#36677: [PATCH] Don't truncate backtraces Robert Vollmert
2019-07-17 17:57 ` Mark H Weaver
2019-07-17 18:11   ` Robert Vollmert
2019-07-21 15:35     ` Robert Vollmert
2019-07-21 22:59   ` David Pirotte
2019-07-22  0:33     ` Mark H Weaver
2019-07-25 16:27       ` David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).