From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel,gmane.emacs.devel Subject: Re: [PATCH] Initial Guile REPL (guiler) debugger support for GUD. Date: Sat, 09 Aug 2014 18:10:48 +0200 Organization: AvatarAcademy.nl Message-ID: <87wqah3apj.fsf@drakenvlieg.flower> References: <1407244906-12754-1-git-send-email-janneke@gnu.org> <1407244906-12754-3-git-send-email-janneke@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1407600682 20421 80.91.229.3 (9 Aug 2014 16:11:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2014 16:11:22 +0000 (UTC) Cc: guile-devel , emacs-devel To: Stefan Monnier Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Aug 09 18:11:10 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XG9Ec-0005Cf-Ep for guile-devel@m.gmane.org; Sat, 09 Aug 2014 18:11:10 +0200 Original-Received: from localhost ([::1]:56753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG9Eb-0001RL-Tx for guile-devel@m.gmane.org; Sat, 09 Aug 2014 12:11:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG9EV-0001RB-2C for guile-devel@gnu.org; Sat, 09 Aug 2014 12:11:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XG9EO-0002cs-Pw for guile-devel@gnu.org; Sat, 09 Aug 2014 12:11:02 -0400 Original-Received: from smtp-vbr10.xs4all.nl ([194.109.24.30]:2468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG9EO-0002a3-CN; Sat, 09 Aug 2014 12:10:56 -0400 Original-Received: from drakenvlieg.flower.peder.onsbrabantnet.nl (static.kpn.net [92.70.116.82] (may be forged)) (authenticated bits=0) by smtp-vbr10.xs4all.nl (8.13.8/8.13.8) with ESMTP id s79GAm6b012900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 9 Aug 2014 18:10:52 +0200 (CEST) (envelope-from janneke@gnu.org) X-Url: http://AvatarAcademy.nl In-Reply-To: (Stefan Monnier's message of "Sat, 09 Aug 2014 11:35:11 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 194.109.24.30 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17319 gmane.emacs.devel:173510 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> * progmodes/gud.el (guiler): New function. Starts the Guile REPL; >> add Guile debugger support for GUD. > > Looks OK, That's great, we're going to guile support in GUD! > tho please use the new `setq-local' when setting variables > buffer-locally. New patch attached. Greetings, Jan --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-Initial-Guile-REPL-guiler-debugger-support-for-GUD.patch Content-Transfer-Encoding: quoted-printable >From 3db1acfeb281f6fbbc8df19164b7f313e37b81ee Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 4 Aug 2014 11:15:59 +0200 Subject: [PATCH] Initial Guile REPL (guiler) debugger support for GUD. * lisp/progmodes/gud.el (guiler): New function. Starts the Guile REPL; add Guile debugger support for GUD. --- lisp/ChangeLog | 5 +++ lisp/progmodes/gud.el | 89 +++++++++++++++++++++++++++++++++++++++++++++++= +--- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6f16ea..b3da957 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-08-05 Jan Nieuwenhuizen + + * progmodes/gud.el (guiler): New function. Starts the Guile REPL; + add Guile debugger support for GUD. + 2014-08-03 Paul Eggert =20 Don't mishandle year-9999 dates (Bug#18176). diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index c6fc944..09085f7 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -34,7 +34,8 @@ ;; and added a menu. Brian D. Carlstrom combined the IRIX ;; kluge with the gud-xdb-directories hack producing gud-dbx-directories. ;; Derek L. Davies added support for jdb (Java -;; debugger.) +;; debugger.) Jan Nieuwenhuizen added support for the Guile REPL (Guile +;; debugger). =20 ;;; Code: =20 @@ -140,7 +141,7 @@ Used to gray out relevant toolbar icons.") (display-graphic-p) (fboundp 'x-show-tip)) :visible (memq gud-minor-mode - '(gdbmi dbx sdb xdb pdb)) + '(gdbmi guiler dbx sdb xdb pdb)) :button (:toggle . gud-tooltip-mode)) ([refresh] "Refresh" . gud-refresh) ([run] menu-item "Run" gud-run @@ -170,11 +171,11 @@ Used to gray out relevant toolbar icons.") ([up] menu-item "Up Stack" gud-up :enable (not gud-running) :visible (memq gud-minor-mode - '(gdbmi gdb dbx xdb jdb pdb))) + '(gdbmi gdb guiler dbx xdb jdb pdb))) ([down] menu-item "Down Stack" gud-down :enable (not gud-running) :visible (memq gud-minor-mode - '(gdbmi gdb dbx xdb jdb pdb))) + '(gdbmi gdb guiler dbx xdb jdb pdb))) ([pp] menu-item "Print S-expression" gud-pp :enable (and (not gud-running) (bound-and-true-p gdb-active-process)) @@ -195,7 +196,7 @@ Used to gray out relevant toolbar icons.") ([finish] menu-item "Finish Function" gud-finish :enable (not gud-running) :visible (memq gud-minor-mode - '(gdbmi gdb xdb jdb pdb))) + '(gdbmi gdb guiler xdb jdb pdb))) ([stepi] menu-item "Step Instruction" gud-stepi :enable (not gud-running) :visible (memq gud-minor-mode '(gdbmi gdb dbx))) @@ -1704,6 +1705,83 @@ and source-file directory for your debugger." (run-hooks 'pdb-mode-hook)) ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +;; Guile REPL (guiler) functions + +;; History of argument lists passed to guiler. +(defvar gud-guiler-history nil) + +(defvar gud-guiler-lastfile nil) + +(defun gud-guiler-marker-filter (string) + (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) s= tring)) + + (let ((start 0)) + (while + (cond + ((string-match "^In \\(.*\\):" gud-marker-acc start) + (setq gud-guiler-lastfile (match-string 1 gud-marker-acc))) + ((string-match "^\\([^:\n]+\\):\\([0-9]+\\):\\([0-9]+\\):[^\n]*" + gud-marker-acc start) + (setq gud-guiler-lastfile (match-string 1 gud-marker-acc)) + (setq gud-last-frame + (cons gud-guiler-lastfile + (string-to-number (match-string 2 gud-marker-acc))))) + ((string-match "^[ ]*\\([0-9]+\\):\\([0-9]+\\) [^\n]*" + gud-marker-acc start) + (if gud-guiler-lastfile + (setq gud-last-frame + (cons gud-guiler-lastfile + (string-to-number (match-string 1 gud-marker-acc= )))))) + ((string-match comint-prompt-regexp gud-marker-acc start) t) + ((string=3D (substring gud-marker-acc start) "") nil) + (t nil)) + (setq start (match-end 0))) + + ;; Search for the last incomplete line in this chunk + (while (string-match "\n" gud-marker-acc start) + (setq start (match-end 0))) + + ;; If we have an incomplete line, store it in gud-marker-acc. + (setq gud-marker-acc (substring gud-marker-acc (or start 0)))) + string) + + +(defcustom gud-guiler-command-name "guile" + "File name for executing the Guile debugger. +This should be an executable on your path, or an absolute file name." + :type 'string + :group 'gud) + +;;;###autoload +(defun guiler (command-line) + "Run guiler on program FILE in buffer `*gud-FILE*'. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive + (list (gud-query-cmdline 'guiler))) + + (gud-common-init command-line nil 'gud-guiler-marker-filter) + (setq-local gud-minor-mode 'guiler) + +;; FIXME: absolute file-names are not grokked yet by Guile's ,break-at-sou= rce +;; and relative file names only when relative to %load-path. +;; (gud-def gud-break ",break-at-source %d%f %l" "\C-b" "Set breakpoint= at current line.") + (gud-def gud-break ",break-at-source %f %l" "\C-b" "Set breakpoint at = current line.") +;; FIXME: remove breakpoint with file-line not yet supported by Guile +;; (gud-def gud-remove ",delete ---> %d%f:%l" "\C-d" "Remove breakpoint = at current line") + (gud-def gud-step ",step" "\C-s" "Step one source line with di= splay.") + (gud-def gud-next ",next" "\C-n" "Step one line (skip function= s).") +;; (gud-def gud-cont "continue" "\C-r" "Continue with display.") + (gud-def gud-finish ",finish" "\C-f" "Finish executing current fun= ction.") + (gud-def gud-up ",up" "<" "Up one stack frame.") + (gud-def gud-down ",down" ">" "Down one stack frame.") + (gud-def gud-print "%e" "\C-p" "Evaluate Guile expression at= point.") + + (setq comint-prompt-regexp "^scheme@([^>]+> ") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'guiler-mode-hook)) + +;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; ;; JDB support. ;; @@ -3450,6 +3528,7 @@ With arg, dereference expr if ARG is positive, otherw= ise do not dereference." "Return a suitable command to print the expression EXPR." (pcase gud-minor-mode (`gdbmi (concat "-data-evaluate-expression \"" expr "\"")) + (`guiler expr) (`dbx (concat "print " expr)) ((or `xdb `pdb) (concat "p " expr)) (`sdb (concat expr "/")))) --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20 --=-=-=--