home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Source / GNU / perl / Perl / emacs / emacs19 < prev    next >
Encoding:
Text File  |  1994-10-18  |  11.7 KB  |  313 lines

  1. Article 15041 of comp.lang.perl:
  2. Path: netlabs!news.cerf.net!usc!sol.ctr.columbia.edu!news.kei.com!bloom-beacon.mit.edu!paperboy.osf.org!meissner
  3. From: meissner@osf.org (Michael Meissner)
  4. Newsgroups: comp.lang.perl
  5. Subject: Re: question on using perldb.el  with emacs
  6. Date: 17 Oct 1993 21:10:21 GMT
  7. Organization: Open Software Foundation
  8. Lines: 297
  9. Message-ID: <MEISSNER.93Oct17171021@pasta.osf.org>
  10. References: <BSHAW.93Oct17143524@bobasun.spdc.ti.com>
  11. NNTP-Posting-Host: pasta.osf.org
  12. In-reply-to: bshaw@bobasun.spdc.ti.com's message of Sun, 17 Oct 1993 19:35:24 GMT
  13.  
  14. In article <BSHAW.93Oct17143524@bobasun.spdc.ti.com> bshaw@bobasun.spdc.ti.com
  15. (Bob Shaw) writes:
  16.  
  17. | Hi folks
  18. | Say, I'm trying to use perldb with emacs.  I can invoke perldb 
  19. | within emacs ok and get the window *perldb-foo*  but when it asks
  20. | for "additional command line arguments" , no matter what I give it
  21. | I get the error message   Symbol's function definition is void:  make-
  22. | shell.
  23. | The debugger , by itself, works fine but wanted to try out perldb in
  24. | emacs.
  25.  
  26. This is a symptom of using Emacs 19.xx with perldb.el which was originally made
  27. for emacs version 18.xx.  You can either install the emacs19 replacement for
  28. perldb that hooks it in with GUD (grand unified debugger), or apply the patches
  29. that I picked off of the net (I use the perldb replacement that uses GUD
  30. myself):
  31.  
  32. #!/bin/sh
  33. # This is a shell archive (produced by shar 3.49)
  34. # To extract the files from this archive, save it to a file, remove
  35. # everything above the "!/bin/sh" line above, and type "sh file_name".
  36. #
  37. # made 10/17/1993 21:07 UTC by meissner@pasta.osf.org
  38. # Source directory /usr/users/meissner/elisp
  39. #
  40. # existing files will NOT be overwritten unless -c is specified
  41. #
  42. # This shar contains:
  43. # length  mode       name
  44. # ------ ---------- ------------------------------------------
  45. #   4761 -rw-r--r-- emacs19-perldb.el
  46. #   3845 -rw-rw-r-- emacs19-perldb.patches
  47. #
  48. # ============= emacs19-perldb.el ==============
  49. if test -f 'emacs19-perldb.el' -a X"$1" != X"-c"; then
  50.     echo 'x - skipping emacs19-perldb.el (File already exists)'
  51. else
  52. echo 'x - extracting emacs19-perldb.el (Text)'
  53. sed 's/^X//' << 'SHAR_EOF' > 'emacs19-perldb.el' &&
  54. X;; Author : Stephane Boucher
  55. X;; Note : This is an add on for gud (Part of GNU Emacs 19). It is
  56. X;;        derived from the gdb section that is part of gud.
  57. X
  58. X;; Copyright (C) 1993 Stephane Boucher.
  59. X
  60. X;; Perldb is free software; you can redistribute it and/or modify
  61. X;; it under the terms of the GNU General Public License as published by
  62. X;; the Free Software Foundation; either version 2, or (at your option)
  63. X;; any later version.
  64. X
  65. X;; Perldb Emacs is distributed in the hope that it will be useful,
  66. X;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  67. X;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  68. X;; GNU General Public License for more details.
  69. X
  70. X;; You should have received a copy of the GNU General Public License
  71. X;; along with GNU Emacs; see the file COPYING.  If not, write to
  72. X;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  73. X
  74. X(require 'gud)
  75. X
  76. X;; ======================================================================
  77. X;; perldb functions
  78. X
  79. X;;; History of argument lists passed to perldb.
  80. X(defvar gud-perldb-history nil)
  81. X
  82. X(defun gud-perldb-massage-args (file args)
  83. X  (cons "-d" (cons file (cons "-emacs" args))))
  84. X
  85. X;; There's no guarantee that Emacs will hand the filter the entire
  86. X;; marker at once; it could be broken up across several strings.  We
  87. X;; might even receive a big chunk with several markers in it.  If we
  88. X;; receive a chunk of text which looks like it might contain the
  89. X;; beginning of a marker, we save it here between calls to the
  90. X;; filter.
  91. X(defvar gud-perldb-marker-acc "")
  92. X
  93. X(defun gud-perldb-marker-filter (string)
  94. X  (save-match-data
  95. X    (setq gud-perldb-marker-acc (concat gud-perldb-marker-acc string))
  96. X    (let ((output ""))
  97. X
  98. X      ;; Process all the complete markers in this chunk.
  99. X      (while (string-match "^\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
  100. X               gud-perldb-marker-acc)
  101. X    (setq
  102. X
  103. X     ;; Extract the frame position from the marker.
  104. X     gud-last-frame
  105. X     (cons (substring gud-perldb-marker-acc (match-beginning 1) (match-end 1))
  106. X           (string-to-int (substring gud-perldb-marker-acc
  107. X                     (match-beginning 2)
  108. X                     (match-end 2))))
  109. X
  110. X     ;; Append any text before the marker to the output we're going
  111. X     ;; to return - we don't include the marker in this text.
  112. X     output (concat output
  113. X            (substring gud-perldb-marker-acc 0 (match-beginning 0)))
  114. X
  115. X     ;; Set the accumulator to the remaining text.
  116. X     gud-perldb-marker-acc (substring gud-perldb-marker-acc (match-end 0))))
  117. X
  118. X      ;; Does the remaining text look like it might end with the
  119. X      ;; beginning of another marker?  If it does, then keep it in
  120. X      ;; gud-perldb-marker-acc until we receive the rest of it.  Since we
  121. X      ;; know the full marker regexp above failed, it's pretty simple to
  122. X      ;; test for marker starts.
  123. X      (if (string-match "^\032.*\\'" gud-perldb-marker-acc)
  124. X      (progn
  125. X        ;; Everything before the potential marker start can be output.
  126. X        (setq output (concat output (substring gud-perldb-marker-acc
  127. X                           0 (match-beginning 0))))
  128. X
  129. X        ;; Everything after, we save, to combine with later input.
  130. X        (setq gud-perldb-marker-acc
  131. X          (substring gud-perldb-marker-acc (match-beginning 0))))
  132. X
  133. X    (setq output (concat output gud-perldb-marker-acc)
  134. X          gud-perldb-marker-acc ""))
  135. X
  136. X      output)))
  137. X
  138. X(defun gud-perldb-find-file (f)
  139. X  (find-file-noselect f))
  140. X
  141. X;;;###autoload
  142. X(defun perldb (command-line)
  143. X  "Run perldb on program FILE in buffer *gud-FILE*.
  144. XThe directory containing FILE becomes the initial working directory
  145. Xand source-file directory for your debugger."
  146. X  (interactive
  147. X   (list (read-from-minibuffer "Run perldb (like this): "
  148. X                   (if (consp gud-perldb-history)
  149. X                   (car gud-perldb-history)
  150. X                 "perl ")
  151. X                   nil nil
  152. X                   '(gud-perldb-history . 1))))
  153. X  (gud-overload-functions '((gud-massage-args . gud-perldb-massage-args)
  154. X                (gud-marker-filter . gud-perldb-marker-filter)
  155. X                (gud-find-file . gud-perldb-find-file)
  156. X                ))
  157. X
  158. X  (gud-common-init command-line)
  159. X
  160. X  (gud-def gud-break  "b %l"         "\C-b" "Set breakpoint at current line.")
  161. X  (gud-def gud-remove "d %l"         "\C-d" "Remove breakpoint at current line")
  162. X  (gud-def gud-step   "s"            "\C-s" "Step one source line with display.")
  163. X  (gud-def gud-next   "n"            "\C-n" "Step one line (skip functions).")
  164. X  (gud-def gud-cont   "c"            "\C-r" "Continue with display.")
  165. X;  (gud-def gud-finish "finish"       "\C-f" "Finish executing current function.")
  166. X;  (gud-def gud-up     "up %p"        "<" "Up N stack frames (numeric arg).")
  167. X;  (gud-def gud-down   "down %p"      ">" "Down N stack frames (numeric arg).")
  168. X  (gud-def gud-print  "%e"           "\C-p" "Evaluate perl expression at point.")
  169. X
  170. X  (setq comint-prompt-regexp "^  DB<[0-9]+> ")
  171. X  (run-hooks 'perldb-mode-hook)
  172. X  )
  173. SHAR_EOF
  174. chmod 0644 emacs19-perldb.el ||
  175. echo 'restore of emacs19-perldb.el failed'
  176. Wc_c="`wc -c < 'emacs19-perldb.el'`"
  177. test 4761 -eq "$Wc_c" ||
  178.     echo 'emacs19-perldb.el: original size 4761, current size' "$Wc_c"
  179. fi
  180. # ============= emacs19-perldb.patches ==============
  181. if test -f 'emacs19-perldb.patches' -a X"$1" != X"-c"; then
  182.     echo 'x - skipping emacs19-perldb.patches (File already exists)'
  183. else
  184. echo 'x - extracting emacs19-perldb.patches (Text)'
  185. sed 's/^X//' << 'SHAR_EOF' > 'emacs19-perldb.patches' &&
  186. XFrom dmm0t@rincewind.mech.virginia.edu Fri Jul 16 23:17:10 1993
  187. XPath: paperboy.osf.org!bloom-beacon.mit.edu!biosci!uwm.edu!ux1.cso.uiuc.edu!howland.reston.ans.net!darwin.sura.net!news-feed-2.peachnet.edu!concert!uvaarpa!murdoch!rincewind.mech.virginia.edu!dmm0t
  188. XFrom: dmm0t@rincewind.mech.virginia.edu (David Meyer)
  189. XNewsgroups: gnu.emacs.sources
  190. XSubject: patches to perldb.el for emacs-19
  191. XMessage-ID: <CA7uq9.30J@murdoch.acc.Virginia.EDU>
  192. XDate: 15 Jul 93 17:18:07 GMT
  193. XSender: usenet@murdoch.acc.Virginia.EDU
  194. XOrganization: University of Virginia
  195. XLines: 97
  196. X
  197. X
  198. XHere are my patches to perldb.el (the perl debugger mode that comes
  199. Xwith perl 4.0xx).  Basically, all I've done is to hack perldb.el to
  200. Xuse comint.el stuff rather than the old shell.el stuff (i.e. change
  201. Xshell-mode-map to comint-mode-map).
  202. X
  203. XI've been using my patched version without problem, but if anyone sees
  204. Xsomething I've missed, please post or send e-mail.
  205. X
  206. X                Thanks,
  207. X                        Dave
  208. X
  209. X
  210. X*** /Users/dmm0t/perldb.el    Thu Jul 15 13:06:59 1993
  211. X--- perldb.el    Tue Jul  6 22:24:41 1993
  212. X***************
  213. X*** 65,71 ****
  214. X  
  215. X  (if perldb-mode-map
  216. X     nil
  217. X!   (setq perldb-mode-map (copy-keymap shell-mode-map))
  218. X    (define-key perldb-mode-map "\C-l" 'perldb-refresh))
  219. X  
  220. X  (define-key ctl-x-map " " 'perldb-break)
  221. X--- 65,71 ----
  222. X  
  223. X  (if perldb-mode-map
  224. X     nil
  225. X!   (setq perldb-mode-map (copy-keymap comint-mode-map))
  226. X    (define-key perldb-mode-map "\C-l" 'perldb-refresh))
  227. X  
  228. X  (define-key ctl-x-map " " 'perldb-break)
  229. X***************
  230. X*** 122,131 ****
  231. X    (setq mode-name "Inferior Perl")
  232. X    (setq mode-line-process '(": %s"))
  233. X    (use-local-map perldb-mode-map)
  234. X!   (make-local-variable 'last-input-start)
  235. X!   (setq last-input-start (make-marker))
  236. X!   (make-local-variable 'last-input-end)
  237. X!   (setq last-input-end (make-marker))
  238. X    (make-local-variable 'perldb-last-frame)
  239. X    (setq perldb-last-frame nil)
  240. X    (make-local-variable 'perldb-last-frame-displayed-p)
  241. X--- 122,131 ----
  242. X    (setq mode-name "Inferior Perl")
  243. X    (setq mode-line-process '(": %s"))
  244. X    (use-local-map perldb-mode-map)
  245. X!   (make-local-variable 'comint-last-input-start)
  246. X!   (setq comint-last-input-start (make-marker))
  247. X!   (make-local-variable 'comint-last-input-end)
  248. X!   (setq comint-last-input-end (make-marker))
  249. X    (make-local-variable 'perldb-last-frame)
  250. X    (setq perldb-last-frame nil)
  251. X    (make-local-variable 'perldb-last-frame-displayed-p)
  252. X***************
  253. X*** 134,142 ****
  254. X    (setq perldb-delete-prompt-marker nil)
  255. X    (make-local-variable 'perldb-filter-accumulator)
  256. X    (setq perldb-filter-accumulator nil)
  257. X!   (make-local-variable 'shell-prompt-pattern)
  258. X!   (setq shell-prompt-pattern perldb-prompt-pattern)
  259. X!   (run-hooks 'shell-mode-hook 'perldb-mode-hook))
  260. X  
  261. X  (defvar current-perldb-buffer nil)
  262. X  
  263. X--- 134,142 ----
  264. X    (setq perldb-delete-prompt-marker nil)
  265. X    (make-local-variable 'perldb-filter-accumulator)
  266. X    (setq perldb-filter-accumulator nil)
  267. X!   (make-local-variable 'comint-prompt-regexp)
  268. X!   (setq comint-prompt-regexp perldb-prompt-pattern)
  269. X!   (run-hooks 'comint-mode-hook 'perldb-mode-hook))
  270. X  
  271. X  (defvar current-perldb-buffer nil)
  272. X  
  273. X***************
  274. X*** 189,195 ****
  275. X      (setq default-directory dir)
  276. X      (or (bolp) (newline))
  277. X      (insert "Current directory is " default-directory "\n")
  278. X!     (apply 'make-shell
  279. X         (concat "perldb-" file) perldb-command-name nil "-d" path "-emacs"
  280. X         (parse-args args))
  281. X      (perldb-mode)
  282. X--- 189,195 ----
  283. X      (setq default-directory dir)
  284. X      (or (bolp) (newline))
  285. X      (insert "Current directory is " default-directory "\n")
  286. X!     (apply 'make-comint
  287. X         (concat "perldb-" file) perldb-command-name nil "-d" path "-emacs"
  288. X         (parse-args args))
  289. X      (perldb-mode)
  290. X-- 
  291. XDavid M. Meyer                             Mechanical & Aerospace Engineering
  292. Xdmm0t@rincewind.mech.virginia.edu          University of Virginia
  293. XNeXTmail ok
  294. X
  295. SHAR_EOF
  296. chmod 0664 emacs19-perldb.patches ||
  297. echo 'restore of emacs19-perldb.patches failed'
  298. Wc_c="`wc -c < 'emacs19-perldb.patches'`"
  299. test 3845 -eq "$Wc_c" ||
  300.     echo 'emacs19-perldb.patches: original size 3845, current size' "$Wc_c"
  301. fi
  302. exit 0
  303.  
  304. --
  305. Michael Meissner    email: meissner@osf.org        phone: 617-621-8861
  306. Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
  307.  
  308. Old hackers never die, their bugs just increase.
  309.  
  310.  
  311.