[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2facb99 075/215: init.el: break and clear command use %X r
From: |
Rocky Bernstein |
Subject: |
[elpa] master 2facb99 075/215: init.el: break and clear command use %X rather than %l |
Date: |
Sat, 30 Jul 2016 14:48:55 +0000 (UTC) |
branch: master
commit 2facb99aa81ae31b5d898030ca430d250f865a46
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
init.el: break and clear command use %X rather than %l
Add some support functions for invoking via gdb -p. Fixes issue #58
---
realgud/debugger/gdb/gdb.el | 45 ++++++++++++++++++++++++++++++++++++++++++
realgud/debugger/gdb/init.el | 4 ++--
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/realgud/debugger/gdb/gdb.el b/realgud/debugger/gdb/gdb.el
index c93c4db..e5d3432 100644
--- a/realgud/debugger/gdb/gdb.el
+++ b/realgud/debugger/gdb/gdb.el
@@ -21,8 +21,17 @@
(require 'load-relative)
(require-relative-list '("../../common/helper" "../../common/utils")
"realgud-")
+
+(require-relative-list '("../../common/buffer/command"
+ "../../common/buffer/source")
+ "realgud-buffer-")
+
(require-relative-list '("core" "track-mode") "realgud:gdb-")
+(declare-function realgud-cmdbuf? 'realgud-buffer-command)
+(declare-function realgud:cmdbuf-associate 'realgud-buffer-source)
+(declare-function realgud-parse-command-arg 'realgud-core)
+
;; This is needed, or at least the docstring part of it is needed to
;; get the customization menu to work in Emacs 24.
(defgroup realgud:gdb nil
@@ -53,6 +62,42 @@ This should be an executable on your path, or an absolute
file name."
;; The end.
;;
+(defun realgud:gdb-pid-command-buffer (pid)
+ "Return the command buffer used when gdb -p PID is invoked"
+ (format "*gdb %d shell*" pid)
+ )
+
+(defun realgud:gdb-find-command-buffer (pid)
+ "Find the among current buffers a buffer that is a realgud command buffer
+running gdb on process number PID"
+ (let ((find-cmd-buf (realgud:gdb-pid-command-buffer pid)))
+ (dolist (buf (buffer-list))
+ (if (and (equal find-cmd-buf (buffer-name buf))
+ (realgud-cmdbuf? buf)
+ (get-buffer-process buf))
+ (return buf)))))
+
+(defun realgud:gdb-pid (pid)
+ "Start debugging gdb process with pid PID."
+ (interactive "nEnter the pid that gdb should attach to: ")
+ (realgud:gdb (format "%s -p %d" realgud:gdb-command-name pid))
+ ;; FIXME: should add code to test if attach worked.
+ )
+
+(defun realgud:gdb-pid-associate (pid)
+ "Start debugging gdb process with pid PID and associate the
+current buffer to that realgud command buffer."
+ (interactive "nEnter the pid that gdb should attach to and associate the
current buffer to: ")
+ (let* ((command-buf)
+ (source-buf (current-buffer))
+ )
+ (realgud:gdb-pid pid)
+ (setq command-buf (realgud:gdb-find-command-buffer pid))
+ (if command-buf
+ (with-current-buffer source-buf
+ (realgud:cmdbuf-associate (buffer-name command-buf)))
+ )))
+
;;;###autoload
(defun realgud:gdb (&optional opt-cmd-line no-reset)
"Invoke the gdb debugger and start the Emacs user interface.
diff --git a/realgud/debugger/gdb/init.el b/realgud/debugger/gdb/init.el
index 547e794..a7ea767 100644
--- a/realgud/debugger/gdb/init.el
+++ b/realgud/debugger/gdb/init.el
@@ -114,8 +114,8 @@ realgud-loc-pat struct")
"Hash key is command name like 'continue' and the value is
the gdb command to use, like 'continue'")
-(setf (gethash "break" realgud:gdb-command-hash) "break %l")
-(setf (gethash "clear" realgud:gdb-command-hash) "clear %l")
+(setf (gethash "break" realgud:gdb-command-hash) "break %X:%l")
+(setf (gethash "clear" realgud:gdb-command-hash) "clear %X:%l")
(setf (gethash "continue" realgud:gdb-command-hash) "continue")
(setf (gethash "eval" realgud:gdb-command-hash) "print %s")
(setf (gethash "quit" realgud:gdb-command-hash) "quit")
- [elpa] master dd0c60a 066/215: I said remove perl5db as an alias, (continued)
- [elpa] master dd0c60a 066/215: I said remove perl5db as an alias, Rocky Bernstein, 2016/07/30
- [elpa] master 0514c68 069/215: Add melpa (nonstable) tag, Rocky Bernstein, 2016/07/30
- [elpa] master bdf317e 060/215: Try flycheck on this file., Rocky Bernstein, 2016/07/30
- [elpa] master 26fd0de 062/215: Show failure in message and in cmdbuf when we fail to invoke a debugger, Rocky Bernstein, 2016/07/30
- [elpa] master 3071b70 065/215: Try cask, Rocky Bernstein, 2016/07/30
- [elpa] master 3b0e42c 067/215: realgud-exec-shell: Make sure we switch to cmdbuf even when there is an, Rocky Bernstein, 2016/07/30
- [elpa] master 2a708cc 068/215: Error on realgud:cmdbuf-associate if you assocate a non-command buffer., Rocky Bernstein, 2016/07/30
- [elpa] master 26369c1 074/215: Typo, Rocky Bernstein, 2016/07/30
- [elpa] master 4a83877 064/215: perl5db alias messes up realgud-track-mode, so drop that name., Rocky Bernstein, 2016/07/30
- [elpa] master d3953ae 092/215: Fix bug in picking out short-key variable name introduced by recent changes, Rocky Bernstein, 2016/07/30
- [elpa] master 2facb99 075/215: init.el: break and clear command use %X rather than %l,
Rocky Bernstein <=
- [elpa] master 7edc244 063/215: wrong args in jdb invocation; issue #51. Disable some jdb commands we, Rocky Bernstein, 2016/07/30
- [elpa] master ca52896 071/215: A workaround: reinitialize shell mode when going out of realgud-track-mode, Rocky Bernstein, 2016/07/30
- [elpa] master eee3112 089/215: track.el: Allow us to separate stem variable name to get debugger config from debugger name. This will make it easier, Rocky Bernstein, 2016/07/30
- [elpa] master 1eda9a1 076/215: Partially addresses #61. Handling multiple breakpoints on a line still, Rocky Bernstein, 2016/07/30
- [elpa] master a216bf0 084/215: Last commit set wrong variables, Rocky Bernstein, 2016/07/30
- [elpa] master 1420ff1 096/215: ipdb: add hook for completion to initialization, Rocky Bernstein, 2016/07/30
- [elpa] master 924969d 095/215: ipdb: add tab completion, Rocky Bernstein, 2016/07/30
- [elpa] master 518dccd 070/215: Merge branch 'master' of github.com:rocky/emacs-dbgr, Rocky Bernstein, 2016/07/30
- [elpa] master 30398e1 099/215: ipdb: add test, Rocky Bernstein, 2016/07/30
- [elpa] master 6a5c71d 112/215: Merge pull request #80 from cpitclaudel/master, Rocky Bernstein, 2016/07/30