From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Vollmert Newsgroups: gmane.lisp.guile.bugs Subject: bug#36677: [PATCH] Don't truncate backtraces Date: Mon, 15 Jul 2019 22:29:19 +0200 Message-ID: <20190715202918.92925-1-rob@vllmrt.net> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="54262"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Robert Vollmert To: 36677@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jul 15 22:33:13 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hn7ep-000DyV-NP for guile-bugs@m.gmane.org; Mon, 15 Jul 2019 22:33:11 +0200 Original-Received: from localhost ([::1]:43142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hn7eo-0006yf-Aq for guile-bugs@m.gmane.org; Mon, 15 Jul 2019 16:33:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33079) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hn7ek-0006tT-2t for bug-guile@gnu.org; Mon, 15 Jul 2019 16:33:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hn7eh-0000L7-Q9 for bug-guile@gnu.org; Mon, 15 Jul 2019 16:33:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hn7eg-0000Ig-6E for bug-guile@gnu.org; Mon, 15 Jul 2019 16:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hn7eg-0001Rf-2o for bug-guile@gnu.org; Mon, 15 Jul 2019 16:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 15 Jul 2019 20:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36677 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15632227385498 (code B ref -1); Mon, 15 Jul 2019 20:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Jul 2019 20:32:18 +0000 Original-Received: from localhost ([127.0.0.1]:49240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hn7dy-0001QZ-Fi for submit@debbugs.gnu.org; Mon, 15 Jul 2019 16:32:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hn7du-0001QR-SL for submit@debbugs.gnu.org; Mon, 15 Jul 2019 16:32:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60724) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hn7dt-0006lU-LG for bug-guile@gnu.org; Mon, 15 Jul 2019 16:32:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hn7ds-00083W-Cv for bug-guile@gnu.org; Mon, 15 Jul 2019 16:32:13 -0400 Original-Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:23474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hn7ds-0007yj-5l for bug-guile@gnu.org; Mon, 15 Jul 2019 16:32:12 -0400 Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id BCCA95064E; Mon, 15 Jul 2019 22:32:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 860isLs0iTBf; Mon, 15 Jul 2019 22:31:58 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9395 Archived-At: * 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; =20 @@ -99,6 +100,7 @@ static void init_print_frames_var_and_frame_to_stack_vector_var (void) { kw_count =3D scm_from_latin1_keyword ("count"); + kw_width =3D scm_from_latin1_keyword ("width"); print_frames_var =3D scm_c_public_variable ("system repl debug", "print-frames"); frame_to_stack_vector_var =3D @@ -236,8 +238,8 @@ display_backtrace_body (struct display_backtrace_args= *a) scm_stack_ref (a->stack, a->first)); =20 /* 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); =20 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=3D> 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 " ")))) --=20 2.20.1 (Apple Git-117)