[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2ca160c 080/215: Merge pull request #63 from cohomology/fe
From: |
Rocky Bernstein |
Subject: |
[elpa] master 2ca160c 080/215: Merge pull request #63 from cohomology/feature/empty_command_line |
Date: |
Sat, 30 Jul 2016 14:48:55 +0000 (UTC) |
branch: master
commit 2ca160c8f7b0368a02f7bee1ecd63ee592fbbdaf
Merge: ff1dfe9 0a17ada
Author: R. Bernstein <address@hidden>
Commit: R. Bernstein <address@hidden>
Merge pull request #63 from cohomology/feature/empty_command_line
Fix several issues when calling gdb, Fixes #59
---
realgud/common/core.el | 12 +++++++-----
realgud/debugger/gdb/gdb.el | 4 ++--
test/test-gdb-core.el | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/realgud/common/core.el b/realgud/common/core.el
index fd2799c..cecd5ee 100644
--- a/realgud/common/core.el
+++ b/realgud/common/core.el
@@ -186,7 +186,7 @@ the buffer and data associated with it are already gone."
(message "That's all folks.... %s" string))
(defun realgud:binary (file-name)
-"Return a priority for wehther file-name is likely we can run gdb on"
+"Return a priority for whether file-name is likely we can run gdb on"
(let ((output (shell-command-to-string (format "file %s" file-name))))
(cond
((string-match "ELF" output) t)
@@ -214,9 +214,10 @@ marginal icons is reset."
(or (file-name-directory script-filename)
default-directory "./"))
(cmdproc-buffer-name
- (format "*%s %s shell*"
- (file-name-nondirectory debugger-name)
- (file-name-nondirectory script-filename)))
+ (replace-regexp-in-string "\s+" "\s"
+ (format "*%s %s shell*"
+ (file-name-nondirectory debugger-name)
+ (file-name-nondirectory script-filename))))
(cmdproc-buffer (get-buffer-create cmdproc-buffer-name))
(realgud-buf (current-buffer))
(cmd-args (cons program args))
@@ -240,7 +241,8 @@ marginal icons is reset."
(setq process nil)
))
- (unless (and process (eq 'run (process-status process)))
+ (if (and process (eq 'run (process-status process)))
+ cmdproc-buffer
(with-current-buffer cmdproc-buffer
(and (realgud-cmdbuf?) (not no-reset) (realgud:reset))
(setq default-directory default-directory)
diff --git a/realgud/debugger/gdb/gdb.el b/realgud/debugger/gdb/gdb.el
index e5d3432..892d8af 100644
--- a/realgud/debugger/gdb/gdb.el
+++ b/realgud/debugger/gdb/gdb.el
@@ -119,9 +119,9 @@ fringe and marginal icons.
(cmd-args (split-string-and-unquote cmd-str))
(parsed-args (realgud:gdb-parse-cmd-args cmd-args))
(script-args (caddr parsed-args))
- (script-name (car script-args))
+ (script-name (or (car script-args) ""))
(parsed-cmd-args
- (cl-remove-if 'nil (realgud:flatten parsed-args)))
+ (cl-remove-if-not 'stringp (realgud:flatten parsed-args)))
(cmd-buf (realgud:run-process realgud:gdb-command-name
script-name parsed-cmd-args
'realgud:gdb-minibuffer-history
diff --git a/test/test-gdb-core.el b/test/test-gdb-core.el
new file mode 100644
index 0000000..c3d2b87
--- /dev/null
+++ b/test/test-gdb-core.el
@@ -0,0 +1,34 @@
+;; 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)
+
+(require 'test-simple)
+(load-file "../realgud/debugger/gdb/core.el")
+
+(test-simple-start)
+
+(note "invoke gdb without command line arguments")
+(assert-equal '(("gdb") nil nil nil)
+ (realgud:gdb-parse-cmd-args
+ '("gdb")))
+
+(note "invoke gdb with annotate command line parameter")
+(assert-equal '(("gdb" "--annotate" "1") nil nil t)
+ (realgud:gdb-parse-cmd-args
+ '("gdb" "--annotate" "1")))
+
+(note "invoke gdb with annotate command line parameter and file")
+(assert-equal '(("gdb" "--annotate" "1") nil ("file.c") t)
+ (realgud:gdb-parse-cmd-args
+ '("gdb" "--annotate" "1" "file.c")))
+
+(note "invoke gdb with annotate command line parameter and pid")
+(assert-equal '(("gdb" "--annotate" "1" "-p") nil ("4812") t)
+ (realgud:gdb-parse-cmd-args
+ '("gdb" "--annotate" "1" "-p" "4812")))
+
+(note "invoke gdb with pid")
+(assert-equal '(("gdb" "-p") nil ("4511") nil)
+ (realgud:gdb-parse-cmd-args
+ '("gdb" "-p" "4511")))
+
+(end-tests)
- [elpa] master d6b879d 042/215: Merge branch 'trepanjs', (continued)
- [elpa] master d6b879d 042/215: Merge branch 'trepanjs', Rocky Bernstein, 2016/07/30
- [elpa] master f3420e9 151/215: Merge pull request #105 from rocky/new-README, Rocky Bernstein, 2016/07/30
- [elpa] master 1c3d8c2 171/215: Add a bit of padding around the logo to make GitHub happy, Rocky Bernstein, 2016/07/30
- [elpa] master 678ec6b 139/215: Use `buffer-live-p' instead of `buffer-name' in `buffer-killed?', Rocky Bernstein, 2016/07/30
- [elpa] master daac75b 175/215: Add a C-u interface to break and clear, Rocky Bernstein, 2016/07/30
- [elpa] master fe679e9 077/215: Don't try source buffer initialization if it doesn't exist., Rocky Bernstein, 2016/07/30
- [elpa] master 3f08b2b 165/215: Update screenshot, Rocky Bernstein, 2016/07/30
- [elpa] master 4ac3ca2 147/215: Fill in missing bits of Cask file, Rocky Bernstein, 2016/07/30
- [elpa] master 785eb68 168/215: Remove unwanted argument in call to cmd-run-command, Rocky Bernstein, 2016/07/30
- [elpa] master bc3fa20 162/215: Add some enable/disble patterns, Rocky Bernstein, 2016/07/30
- [elpa] master 2ca160c 080/215: Merge pull request #63 from cohomology/feature/empty_command_line,
Rocky Bernstein <=
- [elpa] master 4f5c91f 177/215: Add basic support for jumping, Rocky Bernstein, 2016/07/30
- [elpa] master b7a7fe9 213/215: Release 1.4.0 which will be on melpa stable and elpa, Rocky Bernstein, 2016/07/30
- [elpa] master 260bc5a 187/215: Mark debuggers that don't have "jump"., Rocky Bernstein, 2016/07/30
- [elpa] master 3cb53e0 210/215: Assign more copyrights to FSF, Rocky Bernstein, 2016/07/30
- [elpa] master 6f54316 161/215: Update README.md, Rocky Bernstein, 2016/07/30
- [elpa] master 51cd14b 173/215: Clarify %p in documentation of expand-format, Rocky Bernstein, 2016/07/30
- [elpa] master 13a3d4e 140/215: Minor docstring and code cleanups, Rocky Bernstein, 2016/07/30
- [elpa] master c919f96 115/215: Update IPDB in accordance with PDB, Rocky Bernstein, 2016/07/30
- [elpa] master 9358b1b 144/215: Merge pull request #104 from rocky/36-auto-attach, Rocky Bernstein, 2016/07/30
- [elpa] master 480cbb3 159/215: Remove leftover debugging message, Rocky Bernstein, 2016/07/30