]> code.delx.au - gnu-emacs-elpa/commitdiff
Add gdb debugger backtrace regexpl. More to come
authorrocky <rocky@gnu.org>
Thu, 14 Apr 2011 16:46:30 +0000 (12:46 -0400)
committerrocky <rocky@gnu.org>
Thu, 14 Apr 2011 16:46:30 +0000 (12:46 -0400)
dbgr/debugger/gdb/init.el

index 76ec45f191822d8c0e0aa0d7ec1282019d4d5a74..ceb20cae66e61abe337c63c688e1befd2b6c0360 100644 (file)
@@ -16,11 +16,15 @@ dbgr-loc-pat struct")
 
 (declare-function make-dbgr-loc "dbgr-loc" (a b c d e f))
 
+(defconst dbgr-gdb-frame-file-regexp
+ "\\(.+\\):\\([0-9]+\\)")
+
 ;; regular expression that describes a gdb location generally shown
 ;; before a command prompt. NOTE: we assume annotate 1!
 (setf (gethash "loc" dbgr-gdb-pat-hash)
       (make-dbgr-loc-pat
-       :regexp "^\1a\1a\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):beg:0x\\([0-9a-f]+\\)"
+       :regexp (format "^\1a\1a%s:\\([0-9]+\\):beg:0x\\([0-9a-f]+\\)"
+                      dbgr-gdb-frame-file-regexp)
        :file-group 1
        :line-group 2
        :char-offset-group 3))
@@ -38,6 +42,27 @@ dbgr-loc-pat struct")
        :file-group 3
        :line-group 4))
 
+(defconst dbgr-gdb-frame-start-regexp
+  "\\(?:^\\|\n\\)")
+
+(defconst dbgr-gdb-frame-num-regexp
+  "#\\([0-9]+\\)  ")
+
+;; Regular expression that describes a remake "backtrace" command line.
+;; For example:
+;; #0  main (argc=2, argv=0xbffff564, envp=0xbffff570) at main.c:935
+(setf (gethash "debugger-backtrace" dbgr-gdb-pat-hash)
+      (make-dbgr-loc-pat
+       :regexp         (concat dbgr-gdb-frame-start-regexp 
+                       dbgr-gdb-frame-num-regexp
+                       "\\(.*\\)[ \n]+at "
+                       dbgr-gdb-frame-file-regexp
+                       )
+       :num 1
+       :file-group 3
+       :line-group 4)
+      )
+
 (defvar dbgr-gdb-command-hash (make-hash-table :test 'equal)
   "Hash key is command name like 'continue' and the value is 
   the gdb command to use, like 'continue'")