branch: externals/realgud
commit 77f3130c930c3e3ab9c6ab9b4d9ddf928051d169
Author: rocky <[email protected]>
Commit: rocky <[email protected]>
Changes to accomodate upcoming trepan3k...
This supports column positions in tracking info.
Column position tracking is something we should have independent of trepan3k
---
realgud/common/buffer/command.el | 3 ++-
realgud/debugger/trepan3k/init.el | 4 +++-
realgud/lang/python.el | 30 ++++++++++++++++++++++--------
test/test-regexp-trepan3k.el | 17 ++++++++++++++++-
4 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index 887970895c..767cd69382 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2019 Free Software Foundation, Inc
+;; Copyright (C) 2015-2019, 2026 Free Software Foundation, Inc
;; Author: Rocky Bernstein <[email protected]>
;; This program is free software; you can redistribute it and/or modify
@@ -105,6 +105,7 @@
loc-regexp ;; Location regular expression string
file-group
line-group
+ column-group
alt-file-group
alt-line-group
text-group
diff --git a/realgud/debugger/trepan3k/init.el
b/realgud/debugger/trepan3k/init.el
index e44f364dc8..46318f88ef 100644
--- a/realgud/debugger/trepan3k/init.el
+++ b/realgud/debugger/trepan3k/init.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2010-2019, 2020 Free Software Foundation, Inc
+;; Copyright (C) 2010-2019, 2020, 2026 Free Software Foundation, Inc
;; Author: Rocky Bernstein <[email protected]>
@@ -42,6 +42,7 @@ realgud-loc-pat struct")
;; For example:
;; (/usr/bin/zonetab2pot.py:15 @3): <module>
;; (/usr/bin/zonetab2pot.py:15 remapped <string>): <module>
+;; (/usr/bin/zonetab2pot.py:15:1 remapped <string>): <module>
;; or MS Windows:
;; (c:\\mydirectory\\gcd.py:10): <module>
(setf (gethash "loc" realgud:trepan3k-pat-hash)
@@ -80,6 +81,7 @@ realgud-loc-pat struct")
;; realgud-loc-pat that describes a line a Python "info break" line.
;; For example:
;; 1 breakpoint keep y at /usr/local/bin/trepan3k:7
+;; 1 breakpoint keep y at /usr/local/bin/trepan3k:7:3
(setf (gethash "debugger-breakpoint" realgud:trepan3k-pat-hash)
realgud-python-breakpoint-pat)
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index 1cb3ba48ad..ed92146acf 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2011, 2014-2016 Free Software Foundation, Inc
+;; Copyright (C) 2011, 2014-2016, 2025-2026 Free Software Foundation, Inc
;; Author: Rocky Bernstein <[email protected]>
@@ -60,15 +60,21 @@ traceback) line." )
;;
;; For example:
;; (/usr/bin/zonetab2pot.py:15 @10): <module>
+;; (/usr/bin/zonetab2pot.py:15:3 @10): <module>
;; (/usr/bin/zonetab2pot.py:15 remapped <string>): <module>
+;; (/usr/bin/zonetab2pot.py:15:3 remapped <string>): <module>
;; or MS Windows:
;; (c:\\mydirectory\\gcd.py:10): <module>
-
+;; (c:\\mydirectory\\gcd.py:10:0): <module>
+;;
+;; In the regexp below, note that we need \\| for the column so as to preserve
the numbered placeholder for file-group.
+;; The elisp code handles column-group nil correctly.
(defconst realgud:python-trepan-loc-pat
(make-realgud-loc-pat
- :regexp "^(\\(\\(?:[a-zA-Z]:\\)?[-a-zA-Z0-9_/.\\\\
]+\\):\\([0-9]+\\)\\(?: @[0-9]+\\)?\\(?: remapped .*?\\)?):
\\(?:<module>\\)?\\(?:\n.. [0-9]+ \\(.*?\\)\n\\)?"
+ :regexp "^(\\(\\(?:[a-zA-Z]:\\)?[-a-zA-Z0-9_/.\\\\
]+\\):\\([0-9]+\\)\\(?:[:]\\([0-9]+\\)?\\|\\)\\(?: @[0-9]+\\)?\\(?: remapped
.*?\\)?): \\(?:<module>\\)?\\(?:\n.. [0-9]+ \\(.*?\\)\n\\)?"
:file-group 1
:line-group 2
+ :column-group 3
:text-group 3
:ignore-file-re realgud-python-ignore-file-re)
"A realgud-loc-pat struct that describes a Python trepan
@@ -111,13 +117,21 @@ traceback) line." )
:line-group 6)
"A realgud-loc-pat struct that describes a Python breakpoint." )
-;; Regular expression that describes a "breakpoint set" line
+;; Regular expression that describes a "breakpoint set" line.
+;; For example:
+;; Breakpoint 1 set at line 17, column 9 in check_args() of file /tmp/gcd.py
+;; Breakpoint 1 set at line 17 in check_args() of file /tmp/gcd.py
+;;
+;; In the regexp below, note that we need \\| for the column so as to preserve
the numbered placeholder for file-group.
+;; The elisp code handles column-group nil correctly.
(defconst realgud:python-trepan-brkpt-set-pat
(make-realgud-loc-pat
- :regexp "^Breakpoint \\([0-9]+\\) set at line \\([0-9]+\\)[ \t\n]+of file[
\t\n]+\\(.+\\)\\(\n\\|$\\)"
+ :regexp "^Breakpoint \\([0-9]+\\) set at line \\([0-9]+\\)\\(?:[,] column
\\([0-9]+\\)\\|\\)[ \t\n]+of file[ \t\n]+\\(.+\\)\\(\n\\|$\\)"
:num 1
- :file-group 3
- :line-group 2))
+ :file-group 4
+ :column-group 3
+ :line-group 2)
+ )
;; Regular expression that describes a debugger "delete" (breakpoint) response.
(defconst realgud:python-trepan-brkpt-del-pat
@@ -212,7 +226,7 @@ traceback) line." )
:regexp "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): [EFWCN]\\([0-9]+\\) "
:file-group 1
:line-group 2
- :char-offset-group 3
+ :column-group 3
)
"A realgud-loc-pat struct that describes a flake8 warning or error line"
)
diff --git a/test/test-regexp-trepan3k.el b/test/test-regexp-trepan3k.el
index 87e948144e..a40a0559de 100644
--- a/test/test-regexp-trepan3k.el
+++ b/test/test-regexp-trepan3k.el
@@ -1,5 +1,5 @@
;; Press C-x C-e at the end of the next line to run this file test
non-interactively
-;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory
(locate-library "test-simple.elc")) buffer-file-name)
+;; (test-simple-run "emacs -batch -L %s -L %s -L %s -l %s"
(file-name-directory (locate-library "load-relative.elc")) (file-name-directory
(locate-library "test-simple.elc")) (file-name-directory (locate-library
"loc-changes.elc")) buffer-file-name)
(require 'test-simple)
(require 'load-relative)
@@ -118,6 +118,21 @@
(match-string (realgud-loc-pat-line-group helper-bps)
test-s1)
"extract breakpoint line number")
+
+
+(setq test-s1
+ "Breakpoint 1 set at line 13, column 5 of file /src/git/code/gcd.py")
+
+(assert-t (numberp (loc-match test-s1 helper-bps))
+ "basic breakpoint location")
+(assert-equal "/src/git/code/gcd.py"
+ (match-string (realgud-loc-pat-file-group helper-bps)
+ test-s1) "extract breakpoint file name")
+(assert-equal "13"
+ (match-string (realgud-loc-pat-line-group helper-bps)
+ test-s1)
+ "extract breakpoint line number")
+
(setq test-s1 "(c:\\working\\python\\helloworld.py:30): <module>")
(assert-t (numberp (loc-match test-s1 helper-loc))
"MS DOS position location")