[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud 690385d 28/72: gdb: handle ANSI escape codes, r
From: |
Stefan Monnier |
Subject: |
[elpa] externals/realgud 690385d 28/72: gdb: handle ANSI escape codes, relative paths, blacklist, and doc fix |
Date: |
Fri, 26 Mar 2021 22:49:07 -0400 (EDT) |
branch: externals/realgud
commit 690385d91259ea8420ea0b01957e3a0631743c8f
Author: John Ciolfi <ciolfi@mathworks.com>
Commit: John Ciolfi <ciolfi@mathworks.com>
gdb: handle ANSI escape codes, relative paths, blacklist, and doc fix
1. track.el: gdb will generate ANSI escape sequences (emacs 25, Debian 9,
gdb 7.12) into the comint
buffer which was causing the regex matches to fail resulting in no
location tracking. Fix by
stripping the ANSI escape sequences when we extract the buffer text from
the comint buffer.
2. gdb.el: When setting a breakpoint to a function, gdb by default displays
a relative path, e.g.
(gdb) b functionName
Breakpoint 1 at 0x7fff607e4dd6: file dir/file.cpp, line 273.
where dir/file.cpp is relative which occurs when you compile using a
relative path,
g++ -c dir/file.cpp
We want it to display
(gdb) b functionName
Breakpoint 1 at 0x7fff607e4dd6: file /abs/path/to/file.cpp, line 273.
which is achieved by setting "set filename-display absolute" at gdb
startup.
3. file.el: Improve the prompt on file blacklist to indicate why
blacklisting is occurring, i.e. the
file is not found. (Also fix typo, black-list is spelled blacklist).
4. Minor doc fixes on how to use ./configure.
---
INSTALL.md | 10 +++++++++-
configure.ac | 2 +-
realgud/common/file.el | 4 ++--
realgud/common/track.el | 14 +++++++++++++-
realgud/debugger/gdb/gdb.el | 8 ++++++++
5 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/INSTALL.md b/INSTALL.md
index 0bfc18e..ec7b524 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -7,9 +7,17 @@ Have `test-simple`, `loc-changes`, `cl-lib` and
`load-relative` installed.
From inside emacs, evaluate:
```lisp
- (compile (format "EMACSLOADPATH=:%s:%s:%s:%s ./autogen.sh"
(file-name-directory (locate-library "test-simple.elc")) (file-name-directory
(locate-library "load-relative.elc")) (file-name-directory (locate-library
"loc-changes.elc")) (file-name-directory (locate-library "realgud.elc")) ))
+ (compile (format "EMACSLOADPATH=:%s:%s:%s:%s ./autogen.sh"
(file-name-directory (locate-library "test-simple.elc")) (file-name-directory
(locate-library "load-relative.elc")) (file-name-directory (locate-library
"loc-changes.elc")) default-directory) )
```
+
+Optional: if you want to install to a custom location, use ./configure as
shown.
+Note, that --prefix does not prefix the lispdir, you must use --with-lispdir in
+addition to --prefix.
+
+ ./configure --prefix=INSTALL_DIR
--with-lispdir=INSTALL_DIR/share/emacs/site-lisp
+
+
After this you should be able to run:
$ make # byte compile everything
diff --git a/configure.ac b/configure.ac
index 944513e..b0a1804 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE
AC_PATH_PROG([EMACS], [emacs], [emacs])
-AC_ARG_WITH(emacs, AC_HELP_STRING([--with-emacs],
+AC_ARG_WITH(emacs, AC_HELP_STRING([--with-emacs=VALUE],
[location of emacs program]), EMACS=$withval)
AC_MSG_NOTICE("Checking emacs version")
diff --git a/realgud/common/file.el b/realgud/common/file.el
index a542e89..dd923f5 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -122,8 +122,8 @@ problem as best as we can determine."
(setq matching-file-list (realgud--file-matching-suffix buffer-files
filename))
(car matching-file-list)))
- ;; Do we want to black-list this?
- ((y-or-n-p (format "Black-list file %s for location tracking?"
filename))
+ ;; Do we want to blacklist this?
+ ((y-or-n-p (format "Unable to locate %s\nBlacklist it for location
tracking?" filename))
;; FIXME: there has to be a simpler way to set ignore-file-list
(with-current-buffer cmdbuf
(push filename ignore-re-file-list)
diff --git a/realgud/common/track.el b/realgud/common/track.el
index fe4f3a2..483b672 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -228,7 +228,19 @@ evaluating (realgud-cmdbuf-info-loc-regexp
realgud-cmdbuf-info)"
(interactive "r")
(if (> from to) (cl-psetq to from from to))
- (let* ((text (buffer-substring-no-properties from to))
+ (let* ((text (replace-regexp-in-string
+ ;; Strip ANSI escape codes, e.g. gdb produces ^[[?2004h and
^[[?2004l before
+ ;; prompts. This regex handles these sequences, colors, and
more. However, it
+ ;; doesn't cover all. To cover all, we'd need something like
+ ;; "\033\\[\\??[0-9;]*[a-zA-Z]" but this covers non-defined
escape sequences and is
+ ;; missing sequences that have multiple ending letters. The
multi-letter ending
+ ;; escape sequences probably won't occur because these are
cursor movement
+ ;; sequences. Examining the escape code spec, this regex
should cover all cases
+ ;; we'd hit from a debugger.
+ ;; https://github.com/realgud/realgud/issues/257
+ ;; https://en.wikipedia.org/wiki/ANSI_escape_code
+ "\033\\[\\??[0-9;]*[CDGKJhlm]" ""
+ (buffer-substring-no-properties from to)))
(loc (realgud-track-loc text cmd-mark))
;; If we see a selected frame number, it is stored
;; in frame-num. Otherwise, nil.
diff --git a/realgud/debugger/gdb/gdb.el b/realgud/debugger/gdb/gdb.el
index 6f410e5..dbbf247 100644
--- a/realgud/debugger/gdb/gdb.el
+++ b/realgud/debugger/gdb/gdb.el
@@ -134,6 +134,14 @@ fringe and marginal icons.
(if (and process (eq 'run (process-status process)))
(with-current-buffer cmd-buf
(realgud-command "set annotate 1" nil nil nil)
+ ;; In gdb, when setting breakpoint on function, we want it to
produce an absolute
+ ;; path, so set filename-display to absolute. We want:
+ ;; (gdb) b functionName
+ ;; Breakpoint 1 at 0x7fff607e4dd6: file
/abs/path/to/file.cpp, line 273.
+ ;; Without this, gdb will display the path supplied when the
code was compiled, i.e.
+ ;; if a relative path is supplied to gcc, gdb will display the
relative path
+ ;; tripping up realgud, causing it to ask if you want to
blacklist the file.
+ (realgud-command "set filename-display absolute" nil nil nil)
)))
)
))
- [elpa] externals/realgud 4e4d1d2 70/72: fix issue: failed to load file buffer/locals., (continued)
- [elpa] externals/realgud 4e4d1d2 70/72: fix issue: failed to load file buffer/locals., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud ff66001 71/72: Merge pull request #288 from yangyingchao/hotfix_failed_to_load_helper, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud b5ee91c 51/72: Introduce realgud-update-hook and add locals auto-refresh, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 42bb9af 53/72: Remove circular-causing require, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud bd1942e 60/72: Use list of variables as ID for frames, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud f73c039 72/72: trepan2-loc-fn-callback allow for optional callback, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 8064615 12/72: 10th travis try, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 3e11e2a 20/72: Travis has changed - attempted fix #2, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 2cca776 30/72: Merge pull request #259 from JohnC32/master, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 5a5381f 26/72: Travis has changed - attempted fix #8, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 690385d 28/72: gdb: handle ANSI escape codes, relative paths, blacklist, and doc fix,
Stefan Monnier <=
- [elpa] externals/realgud 74c2780 39/72: Add a missing require-relative in gdb.el, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud f70405f 38/72: Correct some declare-function locations, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 7e940af 40/72: debbugers: Fix void realgud:run-process error in gdb and gub., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 493a4da 41/72: Merge pull request #270 from Apteryks/fix-unbound-realgud-run-process, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud f23d0c8 49/72: allow displaying multi-line values, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 6acb987 50/72: Add comments, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 843885c 52/72: fix function declaration to calm down travis, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud de31e77 55/72: Merge pull request #276 from 813gan/locals-window-v2.1, Stefan Monnier, 2021/03/26
- [elpa] externals/realgud 75a6e60 56/72: Fix #275. Add srcbuf-mode to allow cleaning up shortcuts at quit., Stefan Monnier, 2021/03/26
- [elpa] externals/realgud d496bcd 57/72: add test/test-keymap-cleanup.el for #275, Stefan Monnier, 2021/03/26