]> code.delx.au - gnu-emacs-elpa/blobdiff - dbgr/lang/ruby.el
Create ring of frame positions. Next/prev motion uses this. Also we have
[gnu-emacs-elpa] / dbgr / lang / ruby.el
index b2d39c237d7c73d4e5100224beddeddb3b00dd09..94abbe13d899f26685722dba7054fbf2c5599742 100644 (file)
@@ -3,7 +3,8 @@
 (eval-when-compile (require 'cl))
 
 (require 'load-relative)
-(require-relative-list '("../common/regexp" "../common/loc") "dbgr-")
+(require-relative-list '("../common/regexp" "../common/loc" "../common/track") 
+                      "dbgr-")
 
 
 (defconst dbgr-ruby-backtrace-loc-pat
   "A dbgr-loc-pat struct that describes a Ruby backtrace (or
 traceback) line."  )
 
+(defconst dbgr-rubinius-backtrace-loc-pat
+  (make-dbgr-loc-pat
+   :regexp "^\\(\e\\[0;3[1-4]m\\)?[ \t]+.* at \\([^:]+\\):\\([0-9]+\\)"
+   :file-group 2
+   :line-group 3)
+  "A dbgr-loc-pat struct that describes a Rubinius backtrace (or
+traceback) line."  )
+
 (defconst dbgr-ruby-dollar-bang
       (make-dbgr-loc-pat
        :regexp "^[ \t]*[[]?\\(.+\\):\\([0-9]+\\):in `.*'"
@@ -22,5 +31,38 @@ traceback) line."  )
   "A dbgr-loc-pat that struct that describes a Ruby $! string."
 )
 
+;; FIXME: there is probably a less redundant way to do the following
+;; FNS. 
+(defun dbgr-ruby-goto-backtrace-line (pt)
+  "Display the location mentioned by the Ruby backtrace line
+described by PT."
+  (interactive "d")
+  (dbgr-goto-line-for-pt pt "backtrace"))
+
+(defun dbgr-ruby-goto-dollarbang-backtrace-line (pt)
+  "Display the location mentioned by a Ruby $! backtrace line
+described by PT."
+  (interactive "d")
+  (dbgr-goto-line-for-pt pt "dollar-bang"))
+
+(defun dbgr-ruby-populate-command-keys (&optional map)
+  "Bind the debugger function key layout used by many debuggers.
+
+\\{dbgr-example-map-standard}"
+  (define-key map (kbd "C-c !!") 'dbgr-ruby-goto-dollarbang-backtrace-line)
+  (define-key map (kbd "C-c !b") 'dbgr-ruby-goto-backtrace-line)
+  )
+
+
+;; Some things common to all trepan debuggers (Rubinius and Ruby 1.9.2)
+(defconst dbgr-trepan-frame-start-regexp
+  "\\(?:^\\|\n\\)\\(-->\\|   \\)")
+
+(defconst dbgr-trepan-frame-num-regexp
+  "#\\([0-9]+\\)")
+
+(defconst dbgr-trepan-frame-line-regexp
+  "[ \t\n]+at line \\([0-9]+\\)\\(?:\n\\|$\\)")
+
 
 (provide-me "dbgr-lang-")