diff options
| author | Stefan Monnier | 2002-12-05 16:51:56 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-12-05 16:51:56 +0000 |
| commit | 9f6991fd86e5ab434a99e87f8b40b35de776a313 (patch) | |
| tree | 40f1b801f3b3d88d9aaf42d7880d63e4a7dd4a75 | |
| parent | 31d2006902a092d74cacb5827e550b410c82db0b (diff) | |
| download | emacs-9f6991fd86e5ab434a99e87f8b40b35de776a313.tar.gz emacs-9f6991fd86e5ab434a99e87f8b40b35de776a313.zip | |
Use match-string.
(gud-menu-map): Re-fix gdb-running to gud-running.
Activate up/down and finish for pdb.
(gud-def): Use backquotes.
(gdb, sdb, dbx, xdb, pdb, jdb, bashdb): Remove redundant menu bindings.
(gud-gdb-complete-in-progress, gud-gdb-complete-string)
(gud-gdb-complete-break, gud-gdb-complete-list):
Rename to gud-gdb-fetch-lines-in-progress, gud-gdb-fetch-lines-string,
gud-gdb-fetch-lines-break and gud-gdb-fetched-lines.
(gud-gdb-fetch-lines-filter): Rename from gud-gdb-complete-filter.
Add a `filter' argument and run it on `string'.
(gud-gdb-run-command-fetch-lines): Use it instead of
gud-gdb-speedbar-stack-filter. Add a `skip' arg.
Return the fetched lines.
(gud-gdb-complete-command): Use it instead of cooking up
something by hand using gud-gdb-complete-filter.
(gud-gdb-get-stackframe): Use the new calling convention of
gud-gdb-run-command-fetch-lines.
(gud-gdb-fetched-stack-frame-list): Remove.
(gud-gdb-speedbar-stack-filter): Remove.
(gud-jdb-marker-filter): Change RE for easier extraction of submatches.
(gud-bashdb-command-name): Add "--debugger" argument here.
(bashdb): Use default gud-find-file and don't bother with
a massage-args function now that --debugger is make explicit.
(gud-bashdb-massage-args, gud-bashdb-find-file): Remove.
(bashdb): Don't provide.
(gud-target-name): New var.
(gud-common-init): Set it.
Also reset gud-running and gud-last-last-frame.
| -rw-r--r-- | lisp/gud.el | 380 |
1 files changed, 125 insertions, 255 deletions
diff --git a/lisp/gud.el b/lisp/gud.el index 8c6350463d9..c24ccb02741 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -104,22 +104,22 @@ Used to grey out relevant toolbar icons.") | |||
| 104 | ([break] menu-item "Set Breakpoint" gud-break | 104 | ([break] menu-item "Set Breakpoint" gud-break |
| 105 | :enable (not gud-running)) | 105 | :enable (not gud-running)) |
| 106 | ([up] menu-item "Up Stack" gud-up | 106 | ([up] menu-item "Up Stack" gud-up |
| 107 | :enable (and (not gdb-running) | 107 | :enable (and (not gud-running) |
| 108 | (memq gud-minor-mode | 108 | (memq gud-minor-mode |
| 109 | '(gdba gdb dbx xdb jdb bashdb)))) | 109 | '(gdba gdb dbx xdb jdb pdb bashdb)))) |
| 110 | ([down] menu-item "Down Stack" gud-down | 110 | ([down] menu-item "Down Stack" gud-down |
| 111 | :enable (and (not gdb-running) | 111 | :enable (and (not gud-running) |
| 112 | (memq gud-minor-mode | 112 | (memq gud-minor-mode |
| 113 | '(gdba gdb dbx xdb jdb bashdb)))) | 113 | '(gdba gdb dbx xdb jdb pdb bashdb)))) |
| 114 | ([print] menu-item "Print Expression" gud-print | 114 | ([print] menu-item "Print Expression" gud-print |
| 115 | :enable (not gud-running)) | 115 | :enable (not gud-running)) |
| 116 | ([display] menu-item "Display Expression" gud-display | 116 | ([display] menu-item "Display Expression" gud-display |
| 117 | :enable (and (not gud-running) | 117 | :enable (and (not gud-running) |
| 118 | (eq gud-minor-mode 'gdba))) | 118 | (eq gud-minor-mode 'gdba))) |
| 119 | ([finish] menu-item "Finish Function" gud-finish | 119 | ([finish] menu-item "Finish Function" gud-finish |
| 120 | :enable (and (not gdb-running) | 120 | :enable (and (not gud-running) |
| 121 | (memq gud-minor-mode | 121 | (memq gud-minor-mode |
| 122 | '(gdba gdb xdb jdb bashdb)))) | 122 | '(gdba gdb xdb jdb pdb bashdb)))) |
| 123 | ([stepi] "Step Instruction" . gud-stepi) | 123 | ([stepi] "Step Instruction" . gud-stepi) |
| 124 | ([step] menu-item "Step Line" gud-step | 124 | ([step] menu-item "Step Line" gud-step |
| 125 | :enable (not gud-running)) | 125 | :enable (not gud-running)) |
| @@ -223,20 +223,15 @@ step (if we're in the GUD buffer). | |||
| 223 | The `current' line is that of the current buffer (if we're in a | 223 | The `current' line is that of the current buffer (if we're in a |
| 224 | source file) or the source line number at the last break or step (if | 224 | source file) or the source line number at the last break or step (if |
| 225 | we're in the GUD buffer)." | 225 | we're in the GUD buffer)." |
| 226 | (list 'progn | 226 | `(progn |
| 227 | (list 'defun func '(arg) | 227 | (defun ,func (arg) |
| 228 | (or doc "") | 228 | ,@(if doc (list doc)) |
| 229 | '(interactive "p") | 229 | (interactive "p") |
| 230 | (list 'gud-call cmd 'arg)) | 230 | ,(if (stringp cmd) |
| 231 | (if key | 231 | `(gud-call ,cmd arg) |
| 232 | (list 'define-key | 232 | cmd)) |
| 233 | '(current-local-map) | 233 | ,(if key `(local-set-key ,(concat "\C-c" key) ',func)) |
| 234 | (concat "\C-c" key) | 234 | ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func)))) |
| 235 | (list 'quote func))) | ||
| 236 | (if key | ||
| 237 | (list 'global-set-key | ||
| 238 | (list 'concat 'gud-key-prefix key) | ||
| 239 | (list 'quote func))))) | ||
| 240 | 235 | ||
| 241 | ;; Where gud-display-frame should put the debugging arrow; a cons of | 236 | ;; Where gud-display-frame should put the debugging arrow; a cons of |
| 242 | ;; (filename . line-number). This is set by the marker-filter, which scans | 237 | ;; (filename . line-number). This is set by the marker-filter, which scans |
| @@ -395,11 +390,8 @@ off the specialized speedbar mode." | |||
| 395 | (setq | 390 | (setq |
| 396 | 391 | ||
| 397 | ;; Extract the frame position from the marker. | 392 | ;; Extract the frame position from the marker. |
| 398 | gud-last-frame | 393 | gud-last-frame (cons (match-string 1 gud-marker-acc) |
| 399 | (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) | 394 | (string-to-int (match-string 2 gud-marker-acc))) |
| 400 | (string-to-int (substring gud-marker-acc | ||
| 401 | (match-beginning 2) | ||
| 402 | (match-end 2)))) | ||
| 403 | 395 | ||
| 404 | ;; Append any text before the marker to the output we're going | 396 | ;; Append any text before the marker to the output we're going |
| 405 | ;; to return - we don't include the marker in this text. | 397 | ;; to return - we don't include the marker in this text. |
| @@ -481,10 +473,6 @@ and source-file directory for your debugger." | |||
| 481 | (gud-def gud-run "run" nil "Run the program.") | 473 | (gud-def gud-run "run" nil "Run the program.") |
| 482 | 474 | ||
| 483 | (local-set-key "\C-i" 'gud-gdb-complete-command) | 475 | (local-set-key "\C-i" 'gud-gdb-complete-command) |
| 484 | (local-set-key [menu-bar debug tbreak] '("Temporary Breakpoint" . gud-tbreak)) | ||
| 485 | (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish)) | ||
| 486 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 487 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 488 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") | 476 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") |
| 489 | (setq paragraph-start comint-prompt-regexp) | 477 | (setq paragraph-start comint-prompt-regexp) |
| 490 | (run-hooks 'gdb-mode-hook) | 478 | (run-hooks 'gdb-mode-hook) |
| @@ -495,16 +483,16 @@ and source-file directory for your debugger." | |||
| 495 | ;; in the GUD buffer by using a GDB command designed just for Emacs. | 483 | ;; in the GUD buffer by using a GDB command designed just for Emacs. |
| 496 | 484 | ||
| 497 | ;; The completion process filter indicates when it is finished. | 485 | ;; The completion process filter indicates when it is finished. |
| 498 | (defvar gud-gdb-complete-in-progress) | 486 | (defvar gud-gdb-fetch-lines-in-progress) |
| 499 | 487 | ||
| 500 | ;; Since output may arrive in fragments we accumulate partials strings here. | 488 | ;; Since output may arrive in fragments we accumulate partials strings here. |
| 501 | (defvar gud-gdb-complete-string) | 489 | (defvar gud-gdb-fetch-lines-string) |
| 502 | 490 | ||
| 503 | ;; We need to know how much of the completion to chop off. | 491 | ;; We need to know how much of the completion to chop off. |
| 504 | (defvar gud-gdb-complete-break) | 492 | (defvar gud-gdb-fetch-lines-break) |
| 505 | 493 | ||
| 506 | ;; The completion list is constructed by the process filter. | 494 | ;; The completion list is constructed by the process filter. |
| 507 | (defvar gud-gdb-complete-list) | 495 | (defvar gud-gdb-fetched-lines) |
| 508 | 496 | ||
| 509 | (defvar gud-comint-buffer nil) | 497 | (defvar gud-comint-buffer nil) |
| 510 | 498 | ||
| @@ -515,34 +503,24 @@ available with older versions of GDB." | |||
| 515 | (interactive) | 503 | (interactive) |
| 516 | (let* ((end (point)) | 504 | (let* ((end (point)) |
| 517 | (command (buffer-substring (comint-line-beginning-position) end)) | 505 | (command (buffer-substring (comint-line-beginning-position) end)) |
| 518 | command-word) | 506 | (command-word |
| 519 | ;; Find the word break. This match will always succeed. | 507 | ;; Find the word break. This match will always succeed. |
| 520 | (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) | 508 | (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) |
| 521 | (setq gud-gdb-complete-break (match-beginning 2) | 509 | (substring command (match-beginning 2)))) |
| 522 | command-word (substring command gud-gdb-complete-break)) | 510 | (complete-list |
| 523 | ;; Temporarily install our filter function. | 511 | (gud-gdb-run-command-fetch-lines (concat "complete " command) |
| 524 | (let ((gud-marker-filter (if (eq gud-minor-mode 'gdba) | 512 | (current-buffer) |
| 525 | 'gdba-complete-filter | 513 | ;; From string-match above. |
| 526 | 'gud-gdb-complete-filter))) | 514 | (match-beginning 2)))) |
| 527 | ;; Issue the command to GDB. | ||
| 528 | (gud-basic-call (concat "complete " command)) | ||
| 529 | (setq gud-gdb-complete-in-progress t | ||
| 530 | gud-gdb-complete-string nil | ||
| 531 | gud-gdb-complete-list nil) | ||
| 532 | ;; Slurp the output. | ||
| 533 | (while gud-gdb-complete-in-progress | ||
| 534 | (accept-process-output (get-buffer-process gud-comint-buffer)))) | ||
| 535 | ;; Protect against old versions of GDB. | 515 | ;; Protect against old versions of GDB. |
| 536 | (and gud-gdb-complete-list | 516 | (and complete-list |
| 537 | (string-match "^Undefined command: \"complete\"" | 517 | (string-match "^Undefined command: \"complete\"" (car complete-list)) |
| 538 | (car gud-gdb-complete-list)) | ||
| 539 | (error "This version of GDB doesn't support the `complete' command")) | 518 | (error "This version of GDB doesn't support the `complete' command")) |
| 540 | ;; Sort the list like readline. | 519 | ;; Sort the list like readline. |
| 541 | (setq gud-gdb-complete-list | 520 | (setq complete-list (sort complete-list (function string-lessp))) |
| 542 | (sort gud-gdb-complete-list (function string-lessp))) | ||
| 543 | ;; Remove duplicates. | 521 | ;; Remove duplicates. |
| 544 | (let ((first gud-gdb-complete-list) | 522 | (let ((first complete-list) |
| 545 | (second (cdr gud-gdb-complete-list))) | 523 | (second (cdr complete-list))) |
| 546 | (while second | 524 | (while second |
| 547 | (if (string-equal (car first) (car second)) | 525 | (if (string-equal (car first) (car second)) |
| 548 | (setcdr first (setq second (cdr second))) | 526 | (setcdr first (setq second (cdr second))) |
| @@ -550,33 +528,36 @@ available with older versions of GDB." | |||
| 550 | second (cdr second))))) | 528 | second (cdr second))))) |
| 551 | ;; Add a trailing single quote if there is a unique completion | 529 | ;; Add a trailing single quote if there is a unique completion |
| 552 | ;; and it contains an odd number of unquoted single quotes. | 530 | ;; and it contains an odd number of unquoted single quotes. |
| 553 | (and (= (length gud-gdb-complete-list) 1) | 531 | (and (= (length complete-list) 1) |
| 554 | (let ((str (car gud-gdb-complete-list)) | 532 | (let ((str (car complete-list)) |
| 555 | (pos 0) | 533 | (pos 0) |
| 556 | (count 0)) | 534 | (count 0)) |
| 557 | (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos) | 535 | (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos) |
| 558 | (setq count (1+ count) | 536 | (setq count (1+ count) |
| 559 | pos (match-end 0))) | 537 | pos (match-end 0))) |
| 560 | (and (= (mod count 2) 1) | 538 | (and (= (mod count 2) 1) |
| 561 | (setq gud-gdb-complete-list (list (concat str "'")))))) | 539 | (setq complete-list (list (concat str "'")))))) |
| 562 | ;; Let comint handle the rest. | 540 | ;; Let comint handle the rest. |
| 563 | (comint-dynamic-simple-complete command-word gud-gdb-complete-list))) | 541 | (comint-dynamic-simple-complete command-word complete-list))) |
| 564 | 542 | ||
| 565 | ;; The completion process filter is installed temporarily to slurp the | 543 | ;; The completion process filter is installed temporarily to slurp the |
| 566 | ;; output of GDB up to the next prompt and build the completion list. | 544 | ;; output of GDB up to the next prompt and build the completion list. |
| 567 | (defun gud-gdb-complete-filter (string) | 545 | (defun gud-gdb-fetch-lines-filter (string filter) |
| 568 | (setq string (concat gud-gdb-complete-string string)) | 546 | "Filter used to read the list of lines output by a command. |
| 547 | STRING is the output to filter. | ||
| 548 | It is passed through FILTER before we look at it." | ||
| 549 | (setq string (funcall filter string)) | ||
| 550 | (setq string (concat gud-gdb-fetch-lines-string string)) | ||
| 569 | (while (string-match "\n" string) | 551 | (while (string-match "\n" string) |
| 570 | (setq gud-gdb-complete-list | 552 | (push (substring string gud-gdb-fetch-lines-break (match-beginning 0)) |
| 571 | (cons (substring string gud-gdb-complete-break (match-beginning 0)) | 553 | gud-gdb-fetched-lines) |
| 572 | gud-gdb-complete-list)) | ||
| 573 | (setq string (substring string (match-end 0)))) | 554 | (setq string (substring string (match-end 0)))) |
| 574 | (if (string-match comint-prompt-regexp string) | 555 | (if (string-match comint-prompt-regexp string) |
| 575 | (progn | 556 | (progn |
| 576 | (setq gud-gdb-complete-in-progress nil) | 557 | (setq gud-gdb-fetch-lines-in-progress nil) |
| 577 | string) | 558 | string) |
| 578 | (progn | 559 | (progn |
| 579 | (setq gud-gdb-complete-string string) | 560 | (setq gud-gdb-fetch-lines-string string) |
| 580 | ""))) | 561 | ""))) |
| 581 | 562 | ||
| 582 | ;; gdb speedbar functions | 563 | ;; gdb speedbar functions |
| @@ -590,9 +571,6 @@ available with older versions of GDB." | |||
| 590 | (defvar gud-gdb-fetched-stack-frame nil | 571 | (defvar gud-gdb-fetched-stack-frame nil |
| 591 | "Stack frames we are fetching from GDB.") | 572 | "Stack frames we are fetching from GDB.") |
| 592 | 573 | ||
| 593 | (defvar gud-gdb-fetched-stack-frame-list nil | ||
| 594 | "List of stack frames we are fetching from GDB.") | ||
| 595 | |||
| 596 | ;(defun gud-gdb-get-scope-data (text token indent) | 574 | ;(defun gud-gdb-get-scope-data (text token indent) |
| 597 | ; ;; checkdoc-params: (indent) | 575 | ; ;; checkdoc-params: (indent) |
| 598 | ; "Fetch data associated with a stack frame, and expand/contract it. | 576 | ; "Fetch data associated with a stack frame, and expand/contract it. |
| @@ -607,15 +585,14 @@ available with older versions of GDB." | |||
| 607 | (defun gud-gdb-get-stackframe (buffer) | 585 | (defun gud-gdb-get-stackframe (buffer) |
| 608 | "Extract the current stack frame out of the GUD GDB BUFFER." | 586 | "Extract the current stack frame out of the GUD GDB BUFFER." |
| 609 | (let ((newlst nil) | 587 | (let ((newlst nil) |
| 610 | (gud-gdb-fetched-stack-frame-list nil)) | 588 | (fetched-stack-frame-list |
| 611 | (gud-gdb-run-command-fetch-lines "backtrace" buffer) | 589 | (gud-gdb-run-command-fetch-lines "backtrace" buffer))) |
| 612 | (if (and (car gud-gdb-fetched-stack-frame-list) | 590 | (if (and (car fetched-stack-frame-list) |
| 613 | (string-match "No stack" (car gud-gdb-fetched-stack-frame-list))) | 591 | (string-match "No stack" (car fetched-stack-frame-list))) |
| 614 | ;; Go into some other mode??? | 592 | ;; Go into some other mode??? |
| 615 | nil | 593 | nil |
| 616 | (while gud-gdb-fetched-stack-frame-list | 594 | (dolist (e fetched-stack-frame-list) |
| 617 | (let ((e (car gud-gdb-fetched-stack-frame-list)) | 595 | (let ((name nil) (num nil)) |
| 618 | (name nil) (num nil)) | ||
| 619 | (if (not (or | 596 | (if (not (or |
| 620 | (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([:0-9a-zA-Z_]+\\) (" e) | 597 | (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([:0-9a-zA-Z_]+\\) (" e) |
| 621 | (string-match "^#\\([0-9]+\\) +\\([:0-9a-zA-Z_]+\\) (" e))) | 598 | (string-match "^#\\([0-9]+\\) +\\([:0-9a-zA-Z_]+\\) (" e))) |
| @@ -636,18 +613,17 @@ available with older versions of GDB." | |||
| 636 | (list name num (match-string 1 e) | 613 | (list name num (match-string 1 e) |
| 637 | (match-string 2 e)) | 614 | (match-string 2 e)) |
| 638 | (list name num)) | 615 | (list name num)) |
| 639 | newlst)))) | 616 | newlst))))) |
| 640 | (setq gud-gdb-fetched-stack-frame-list | ||
| 641 | (cdr gud-gdb-fetched-stack-frame-list))) | ||
| 642 | (nreverse newlst)))) | 617 | (nreverse newlst)))) |
| 643 | 618 | ||
| 644 | ;(defun gud-gdb-selected-frame-info (buffer) | 619 | ;(defun gud-gdb-selected-frame-info (buffer) |
| 645 | ; "Learn GDB information for the currently selected stack frame in BUFFER." | 620 | ; "Learn GDB information for the currently selected stack frame in BUFFER." |
| 646 | ; ) | 621 | ; ) |
| 647 | 622 | ||
| 648 | (defun gud-gdb-run-command-fetch-lines (command buffer) | 623 | (defun gud-gdb-run-command-fetch-lines (command buffer &optional skip) |
| 649 | "Run COMMAND, and return when `gud-gdb-fetched-stack-frame-list' is full. | 624 | "Run COMMAND, and return the list of lines it outputs. |
| 650 | BUFFER is the GUD buffer in which to run the command." | 625 | BUFFER is the GUD buffer in which to run the command. |
| 626 | SKIP is the number of chars to skip on each lines, it defaults to 0." | ||
| 651 | (save-excursion | 627 | (save-excursion |
| 652 | (set-buffer buffer) | 628 | (set-buffer buffer) |
| 653 | (if (save-excursion | 629 | (if (save-excursion |
| @@ -657,35 +633,18 @@ BUFFER is the GUD buffer in which to run the command." | |||
| 657 | nil | 633 | nil |
| 658 | ;; Much of this copied from GDB complete, but I'm grabbing the stack | 634 | ;; Much of this copied from GDB complete, but I'm grabbing the stack |
| 659 | ;; frame instead. | 635 | ;; frame instead. |
| 660 | (let ((gud-marker-filter 'gud-gdb-speedbar-stack-filter)) | 636 | (let ((gud-gdb-fetch-lines-in-progress t) |
| 637 | (gud-gdb-fetched-lines nil) | ||
| 638 | (gud-gdb-fetch-lines-string nil) | ||
| 639 | (gud-gdb-fetch-lines-break (or skip 0)) | ||
| 640 | (gud-marker-filter | ||
| 641 | `(lambda (string) (gud-gdb-fetch-lines-filter string ',gud-marker-filter)))) | ||
| 661 | ;; Issue the command to GDB. | 642 | ;; Issue the command to GDB. |
| 662 | (gud-basic-call command) | 643 | (gud-basic-call command) |
| 663 | (setq gud-gdb-complete-in-progress t ;; use this flag for our purposes. | ||
| 664 | gud-gdb-complete-string nil | ||
| 665 | gud-gdb-complete-list nil) | ||
| 666 | ;; Slurp the output. | 644 | ;; Slurp the output. |
| 667 | (while gud-gdb-complete-in-progress | 645 | (while gud-gdb-fetch-lines-in-progress |
| 668 | (accept-process-output (get-buffer-process gud-comint-buffer))) | 646 | (accept-process-output (get-buffer-process buffer))) |
| 669 | (setq gud-gdb-fetched-stack-frame nil | 647 | (nreverse gud-gdb-fetched-lines))))) |
| 670 | gud-gdb-fetched-stack-frame-list | ||
| 671 | (nreverse gud-gdb-fetched-stack-frame-list)))))) | ||
| 672 | |||
| 673 | (defun gud-gdb-speedbar-stack-filter (string) | ||
| 674 | ;; checkdoc-params: (string) | ||
| 675 | "Filter used to read in the current GDB stack." | ||
| 676 | (setq string (concat gud-gdb-fetched-stack-frame string)) | ||
| 677 | (while (string-match "\n" string) | ||
| 678 | (setq gud-gdb-fetched-stack-frame-list | ||
| 679 | (cons (substring string 0 (match-beginning 0)) | ||
| 680 | gud-gdb-fetched-stack-frame-list)) | ||
| 681 | (setq string (substring string (match-end 0)))) | ||
| 682 | (if (string-match comint-prompt-regexp string) | ||
| 683 | (progn | ||
| 684 | (setq gud-gdb-complete-in-progress nil) | ||
| 685 | string) | ||
| 686 | (progn | ||
| 687 | (setq gud-gdb-complete-string string) | ||
| 688 | ""))) | ||
| 689 | 648 | ||
| 690 | 649 | ||
| 691 | ;; ====================================================================== | 650 | ;; ====================================================================== |
| @@ -710,32 +669,24 @@ BUFFER is the GUD buffer in which to run the command." | |||
| 710 | ((string-match "\\(^\\|\n\\)\\*?\\(0x\\w* in \\)?\\([^:\n]*\\):\\([0-9]*\\):.*\n" | 669 | ((string-match "\\(^\\|\n\\)\\*?\\(0x\\w* in \\)?\\([^:\n]*\\):\\([0-9]*\\):.*\n" |
| 711 | gud-marker-acc start) | 670 | gud-marker-acc start) |
| 712 | (setq gud-last-frame | 671 | (setq gud-last-frame |
| 713 | (cons | 672 | (cons (match-string 3 gud-marker-acc) |
| 714 | (substring gud-marker-acc (match-beginning 3) (match-end 3)) | 673 | (string-to-int (match-string 4 gud-marker-acc))))) |
| 715 | (string-to-int | ||
| 716 | (substring gud-marker-acc (match-beginning 4) (match-end 4)))))) | ||
| 717 | ;; System V Release 4.0 quite often clumps two lines together | 674 | ;; System V Release 4.0 quite often clumps two lines together |
| 718 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" | 675 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" |
| 719 | gud-marker-acc start) | 676 | gud-marker-acc start) |
| 720 | (setq gud-sdb-lastfile | 677 | (setq gud-sdb-lastfile (match-string 2 gud-marker-acc)) |
| 721 | (substring gud-marker-acc (match-beginning 2) (match-end 2))) | ||
| 722 | (setq gud-last-frame | 678 | (setq gud-last-frame |
| 723 | (cons | 679 | (cons gud-sdb-lastfile |
| 724 | gud-sdb-lastfile | 680 | (string-to-int (match-string 3 gud-marker-acc))))) |
| 725 | (string-to-int | ||
| 726 | (substring gud-marker-acc (match-beginning 3) (match-end 3)))))) | ||
| 727 | ;; System V Release 4.0 | 681 | ;; System V Release 4.0 |
| 728 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" | 682 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" |
| 729 | gud-marker-acc start) | 683 | gud-marker-acc start) |
| 730 | (setq gud-sdb-lastfile | 684 | (setq gud-sdb-lastfile (match-string 2 gud-marker-acc))) |
| 731 | (substring gud-marker-acc (match-beginning 2) (match-end 2)))) | ||
| 732 | ((and gud-sdb-lastfile (string-match "^\\([0-9]+\\):" | 685 | ((and gud-sdb-lastfile (string-match "^\\([0-9]+\\):" |
| 733 | gud-marker-acc start)) | 686 | gud-marker-acc start)) |
| 734 | (setq gud-last-frame | 687 | (setq gud-last-frame |
| 735 | (cons | 688 | (cons gud-sdb-lastfile |
| 736 | gud-sdb-lastfile | 689 | (string-to-int (match-string 1 gud-marker-acc))))) |
| 737 | (string-to-int | ||
| 738 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))))) | ||
| 739 | (t | 690 | (t |
| 740 | (setq gud-sdb-lastfile nil))) | 691 | (setq gud-sdb-lastfile nil))) |
| 741 | (setq start (match-end 0))) | 692 | (setq start (match-end 0))) |
| @@ -778,8 +729,6 @@ and source-file directory for your debugger." | |||
| 778 | 729 | ||
| 779 | (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") | 730 | (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") |
| 780 | (setq paragraph-start comint-prompt-regexp) | 731 | (setq paragraph-start comint-prompt-regexp) |
| 781 | (local-set-key [menu-bar debug tbreak] | ||
| 782 | '("Temporary Breakpoint" . gud-tbreak)) | ||
| 783 | (run-hooks 'sdb-mode-hook) | 732 | (run-hooks 'sdb-mode-hook) |
| 784 | ) | 733 | ) |
| 785 | 734 | ||
| @@ -822,10 +771,8 @@ containing the executable being debugged." | |||
| 822 | "signal .* in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" | 771 | "signal .* in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" |
| 823 | gud-marker-acc start)) | 772 | gud-marker-acc start)) |
| 824 | (setq gud-last-frame | 773 | (setq gud-last-frame |
| 825 | (cons | 774 | (cons (match-string 2 gud-marker-acc) |
| 826 | (substring gud-marker-acc (match-beginning 2) (match-end 2)) | 775 | (string-to-int (match-string 1 gud-marker-acc))) |
| 827 | (string-to-int | ||
| 828 | (substring gud-marker-acc (match-beginning 1) (match-end 1)))) | ||
| 829 | start (match-end 0))) | 776 | start (match-end 0))) |
| 830 | 777 | ||
| 831 | ;; Search for the last incomplete line in this chunk | 778 | ;; Search for the last incomplete line in this chunk |
| @@ -871,10 +818,8 @@ containing the executable being debugged." | |||
| 871 | 818 | ||
| 872 | ;; Extract the frame position from the marker. | 819 | ;; Extract the frame position from the marker. |
| 873 | gud-last-frame | 820 | gud-last-frame |
| 874 | (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) | 821 | (cons (match-string 1 gud-marker-acc) |
| 875 | (string-to-int (substring gud-marker-acc | 822 | (string-to-int (match-string 2 gud-marker-acc))) |
| 876 | (match-beginning 2) | ||
| 877 | (match-end 2)))) | ||
| 878 | 823 | ||
| 879 | ;; Append any text before the marker to the output we're going | 824 | ;; Append any text before the marker to the output we're going |
| 880 | ;; to return - we don't include the marker in this text. | 825 | ;; to return - we don't include the marker in this text. |
| @@ -978,26 +923,19 @@ a better solution in 6.1 upwards.") | |||
| 978 | ((string-match | 923 | ((string-match |
| 979 | "^[^ ][^[]*\\[\"\\([^\"]+\\)\":\\([0-9]+\\), [^]]+]\n" | 924 | "^[^ ][^[]*\\[\"\\([^\"]+\\)\":\\([0-9]+\\), [^]]+]\n" |
| 980 | result) | 925 | result) |
| 981 | (let ((file (substring result (match-beginning 1) | 926 | (let ((file (match-string 1 result))) |
| 982 | (match-end 1)))) | ||
| 983 | (if (file-exists-p file) | 927 | (if (file-exists-p file) |
| 984 | (setq gud-last-frame | 928 | (setq gud-last-frame |
| 985 | (cons | 929 | (cons (match-string 1 result) |
| 986 | (substring | 930 | (string-to-int (match-string 2 result)))))) |
| 987 | result (match-beginning 1) (match-end 1)) | ||
| 988 | (string-to-int | ||
| 989 | (substring | ||
| 990 | result (match-beginning 2) (match-end 2))))))) | ||
| 991 | result) | 931 | result) |
| 992 | ((string-match ; kluged-up marker as above | 932 | ((string-match ; kluged-up marker as above |
| 993 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) | 933 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) |
| 994 | (let ((file (gud-file-name (match-string 2 result)))) | 934 | (let ((file (gud-file-name (match-string 2 result)))) |
| 995 | (if (and file (file-exists-p file)) | 935 | (if (and file (file-exists-p file)) |
| 996 | (setq gud-last-frame | 936 | (setq gud-last-frame |
| 997 | (cons | 937 | (cons file |
| 998 | file | 938 | (string-to-int (match-string 1 result)))))) |
| 999 | (string-to-int | ||
| 1000 | (match-string 1 result)))))) | ||
| 1001 | (setq result (substring result 0 (match-beginning 0)))))) | 939 | (setq result (substring result 0 (match-beginning 0)))))) |
| 1002 | (or result ""))) | 940 | (or result ""))) |
| 1003 | 941 | ||
| @@ -1033,10 +971,8 @@ This was tested using R4.11.") | |||
| 1033 | ;; Process all complete markers in this chunk. | 971 | ;; Process all complete markers in this chunk. |
| 1034 | (while (string-match re gud-marker-acc start) | 972 | (while (string-match re gud-marker-acc start) |
| 1035 | (setq gud-last-frame | 973 | (setq gud-last-frame |
| 1036 | (cons | 974 | (cons (match-string 4 gud-marker-acc) |
| 1037 | (substring gud-marker-acc (match-beginning 4) (match-end 4)) | 975 | (string-to-int (match-string 3 gud-marker-acc))) |
| 1038 | (string-to-int (substring gud-marker-acc | ||
| 1039 | (match-beginning 3) (match-end 3)))) | ||
| 1040 | start (match-end 0))) | 976 | start (match-end 0))) |
| 1041 | 977 | ||
| 1042 | ;; Search for the last incomplete line in this chunk | 978 | ;; Search for the last incomplete line in this chunk |
| @@ -1110,8 +1046,6 @@ and source-file directory for your debugger." | |||
| 1110 | 1046 | ||
| 1111 | (setq comint-prompt-regexp "^[^)\n]*dbx) *") | 1047 | (setq comint-prompt-regexp "^[^)\n]*dbx) *") |
| 1112 | (setq paragraph-start comint-prompt-regexp) | 1048 | (setq paragraph-start comint-prompt-regexp) |
| 1113 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 1114 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 1115 | (run-hooks 'dbx-mode-hook) | 1049 | (run-hooks 'dbx-mode-hook) |
| 1116 | ) | 1050 | ) |
| 1117 | 1051 | ||
| @@ -1189,10 +1123,6 @@ directories if your program contains sources from more than one directory." | |||
| 1189 | 1123 | ||
| 1190 | (setq comint-prompt-regexp "^>") | 1124 | (setq comint-prompt-regexp "^>") |
| 1191 | (setq paragraph-start comint-prompt-regexp) | 1125 | (setq paragraph-start comint-prompt-regexp) |
| 1192 | (local-set-key [menu-bar debug tbreak] '("Temporary Breakpoint" . gud-tbreak)) | ||
| 1193 | (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish)) | ||
| 1194 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 1195 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 1196 | (run-hooks 'xdb-mode-hook)) | 1126 | (run-hooks 'xdb-mode-hook)) |
| 1197 | 1127 | ||
| 1198 | ;; ====================================================================== | 1128 | ;; ====================================================================== |
| @@ -1260,10 +1190,8 @@ into one that invokes an Emacs-enabled debugging session. | |||
| 1260 | 1190 | ||
| 1261 | ;; Extract the frame position from the marker. | 1191 | ;; Extract the frame position from the marker. |
| 1262 | gud-last-frame | 1192 | gud-last-frame |
| 1263 | (cons (substring gud-marker-acc (match-beginning 1) (match-end 1)) | 1193 | (cons (match-string 1 gud-marker-acc) |
| 1264 | (string-to-int (substring gud-marker-acc | 1194 | (string-to-int (match-string 3 gud-marker-acc))) |
| 1265 | (match-beginning 3) | ||
| 1266 | (match-end 3)))) | ||
| 1267 | 1195 | ||
| 1268 | ;; Append any text before the marker to the output we're going | 1196 | ;; Append any text before the marker to the output we're going |
| 1269 | ;; to return - we don't include the marker in this text. | 1197 | ;; to return - we don't include the marker in this text. |
| @@ -1425,9 +1353,6 @@ and source-file directory for your debugger." | |||
| 1425 | ;; Is this right? | 1353 | ;; Is this right? |
| 1426 | (gud-def gud-statement "! %e" "\C-e" "Execute Python statement at point.") | 1354 | (gud-def gud-statement "! %e" "\C-e" "Execute Python statement at point.") |
| 1427 | 1355 | ||
| 1428 | (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish)) | ||
| 1429 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 1430 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 1431 | ;; (setq comint-prompt-regexp "^(.*pdb[+]?) *") | 1356 | ;; (setq comint-prompt-regexp "^(.*pdb[+]?) *") |
| 1432 | (setq comint-prompt-regexp "^(Pdb) *") | 1357 | (setq comint-prompt-regexp "^(Pdb) *") |
| 1433 | (setq paragraph-start comint-prompt-regexp) | 1358 | (setq paragraph-start comint-prompt-regexp) |
| @@ -1845,21 +1770,15 @@ extension EXTN. Normally EXTN is given as the regular expression | |||
| 1845 | ((string-match "-classpath\\(.+\\)" (car args)) | 1770 | ((string-match "-classpath\\(.+\\)" (car args)) |
| 1846 | (setq massaged-args | 1771 | (setq massaged-args |
| 1847 | (append massaged-args | 1772 | (append massaged-args |
| 1848 | (list "-classpath") | 1773 | (list "-classpath" |
| 1849 | (list | 1774 | (setq gud-jdb-classpath-string |
| 1850 | (setq gud-jdb-classpath-string | 1775 | (match-string 1 (car args))))))) |
| 1851 | (substring | ||
| 1852 | (car args) | ||
| 1853 | (match-beginning 1) (match-end 1))))))) | ||
| 1854 | ((string-match "-sourcepath\\(.+\\)" (car args)) | 1776 | ((string-match "-sourcepath\\(.+\\)" (car args)) |
| 1855 | (setq massaged-args | 1777 | (setq massaged-args |
| 1856 | (append massaged-args | 1778 | (append massaged-args |
| 1857 | (list "-sourcepath") | 1779 | (list "-sourcepath" |
| 1858 | (list | 1780 | (setq gud-jdb-sourcepath |
| 1859 | (setq gud-jdb-sourcepath | 1781 | (match-string 1 (car args))))))) |
| 1860 | (substring | ||
| 1861 | (car args) | ||
| 1862 | (match-beginning 1) (match-end 1))))))) | ||
| 1863 | (t (setq massaged-args (append massaged-args (list (car args)))))) | 1782 | (t (setq massaged-args (append massaged-args (list (car args)))))) |
| 1864 | (setq args (cdr args))) | 1783 | (setq args (cdr args))) |
| 1865 | 1784 | ||
| @@ -1946,8 +1865,7 @@ nil) | |||
| 1946 | (setq gud-jdb-classpath | 1865 | (setq gud-jdb-classpath |
| 1947 | (gud-jdb-parse-classpath-string | 1866 | (gud-jdb-parse-classpath-string |
| 1948 | (setq gud-jdb-classpath-string | 1867 | (setq gud-jdb-classpath-string |
| 1949 | (substring gud-marker-acc | 1868 | (match-string 1 gud-marker-acc))))) |
| 1950 | (match-beginning 1) (match-end 1)))))) | ||
| 1951 | 1869 | ||
| 1952 | ;; We process STRING from left to right. Each time through the | 1870 | ;; We process STRING from left to right. Each time through the |
| 1953 | ;; following loop we process at most one marker. After we've found a | 1871 | ;; following loop we process at most one marker. After we've found a |
| @@ -1979,7 +1897,7 @@ nil) | |||
| 1979 | ;; | 1897 | ;; |
| 1980 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII | 1898 | ;; FIXME: Java ID's are UNICODE strings, this matches ASCII |
| 1981 | ;; ID's only. | 1899 | ;; ID's only. |
| 1982 | "\\(\[[0-9]+\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ | 1900 | "\\(?:\[\\([0-9]+\\)\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ |
| 1983 | \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9]+\\)" | 1901 | \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9]+\\)" |
| 1984 | gud-marker-acc) | 1902 | gud-marker-acc) |
| 1985 | 1903 | ||
| @@ -1993,24 +1911,15 @@ nil) | |||
| 1993 | ;; (<file-name> . <line-number>) . | 1911 | ;; (<file-name> . <line-number>) . |
| 1994 | (if (if (match-beginning 1) | 1912 | (if (if (match-beginning 1) |
| 1995 | (let (n) | 1913 | (let (n) |
| 1996 | (setq n (string-to-int (substring | 1914 | (setq n (string-to-int (match-string 1 gud-marker-acc))) |
| 1997 | gud-marker-acc | ||
| 1998 | (1+ (match-beginning 1)) | ||
| 1999 | (- (match-end 1) 2)))) | ||
| 2000 | (if (< n gud-jdb-lowest-stack-level) | 1915 | (if (< n gud-jdb-lowest-stack-level) |
| 2001 | (progn (setq gud-jdb-lowest-stack-level n) t))) | 1916 | (progn (setq gud-jdb-lowest-stack-level n) t))) |
| 2002 | t) | 1917 | t) |
| 2003 | (if (setq file-found | 1918 | (if (setq file-found |
| 2004 | (gud-jdb-find-source | 1919 | (gud-jdb-find-source (match-string 2 gud-marker-acc))) |
| 2005 | (substring gud-marker-acc | ||
| 2006 | (match-beginning 2) | ||
| 2007 | (match-end 2)))) | ||
| 2008 | (setq gud-last-frame | 1920 | (setq gud-last-frame |
| 2009 | (cons file-found | 1921 | (cons file-found |
| 2010 | (string-to-int | 1922 | (string-to-int (match-string 4 gud-marker-acc)))) |
| 2011 | (substring gud-marker-acc | ||
| 2012 | (match-beginning 4) | ||
| 2013 | (match-end 4))))) | ||
| 2014 | (message "Could not find source file."))) | 1923 | (message "Could not find source file."))) |
| 2015 | 1924 | ||
| 2016 | ;; Set the accumulator to the remaining text. | 1925 | ;; Set the accumulator to the remaining text. |
| @@ -2081,9 +1990,6 @@ gud, see `gud-mode'." | |||
| 2081 | (gud-def gud-finish "step up" "\C-f" "Continue until current method returns.") | 1990 | (gud-def gud-finish "step up" "\C-f" "Continue until current method returns.") |
| 2082 | (gud-def gud-up "up\C-Mwhere" "<" "Up one stack frame.") | 1991 | (gud-def gud-up "up\C-Mwhere" "<" "Up one stack frame.") |
| 2083 | (gud-def gud-down "down\C-Mwhere" ">" "Up one stack frame.") | 1992 | (gud-def gud-down "down\C-Mwhere" ">" "Up one stack frame.") |
| 2084 | (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish)) | ||
| 2085 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 2086 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 2087 | 1993 | ||
| 2088 | (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") | 1994 | (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") |
| 2089 | (setq paragraph-start comint-prompt-regexp) | 1995 | (setq paragraph-start comint-prompt-regexp) |
| @@ -2126,38 +2032,13 @@ gud, see `gud-mode'." | |||
| 2126 | ;; Run bashdb (like this): bash | 2032 | ;; Run bashdb (like this): bash |
| 2127 | ;; | 2033 | ;; |
| 2128 | 2034 | ||
| 2129 | ;;; History of argument lists passed to bashdb. | 2035 | ;; History of argument lists passed to bashdb. |
| 2130 | (defvar gud-bashdb-history nil) | 2036 | (defvar gud-bashdb-history nil) |
| 2131 | 2037 | ||
| 2132 | ;; Convert a command line as would be typed normally to run a script | 2038 | ;; Convert a command line as would be typed normally to run a script |
| 2133 | ;; into one that invokes an Emacs-enabled debugging session. | 2039 | ;; into one that invokes an Emacs-enabled debugging session. |
| 2134 | ;; "--debugger" in inserted as the first switch. | 2040 | ;; "--debugger" in inserted as the first switch. |
| 2135 | 2041 | ||
| 2136 | (defun gud-bashdb-massage-args (file args) | ||
| 2137 | (let* ((new-args (list "--debugger")) | ||
| 2138 | (seen-e nil) | ||
| 2139 | (shift (lambda () | ||
| 2140 | (setq new-args (cons (car args) new-args)) | ||
| 2141 | (setq args (cdr args))))) | ||
| 2142 | |||
| 2143 | ;; Pass all switches and -e scripts through. | ||
| 2144 | (while (and args | ||
| 2145 | (string-match "^-" (car args)) | ||
| 2146 | (not (equal "-" (car args))) | ||
| 2147 | (not (equal "--" (car args)))) | ||
| 2148 | (funcall shift)) | ||
| 2149 | |||
| 2150 | (if (or (not args) | ||
| 2151 | (string-match "^-" (car args))) | ||
| 2152 | (error "Can't use stdin as the script to debug")) | ||
| 2153 | ;; This is the program name. | ||
| 2154 | (funcall shift) | ||
| 2155 | |||
| 2156 | (while args | ||
| 2157 | (funcall shift)) | ||
| 2158 | |||
| 2159 | (nreverse new-args))) | ||
| 2160 | |||
| 2161 | ;; There's no guarantee that Emacs will hand the filter the entire | 2042 | ;; There's no guarantee that Emacs will hand the filter the entire |
| 2162 | ;; marker at once; it could be broken up across several strings. We | 2043 | ;; marker at once; it could be broken up across several strings. We |
| 2163 | ;; might even receive a big chunk with several markers in it. If we | 2044 | ;; might even receive a big chunk with several markers in it. If we |
| @@ -2179,10 +2060,8 @@ gud, see `gud-mode'." | |||
| 2179 | 2060 | ||
| 2180 | ;; Extract the frame position from the marker. | 2061 | ;; Extract the frame position from the marker. |
| 2181 | gud-last-frame | 2062 | gud-last-frame |
| 2182 | (cons (substring gud-marker-acc (match-beginning 2) (match-end 2)) | 2063 | (cons (match-string 2 gud-marker-acc) |
| 2183 | (string-to-int (substring gud-marker-acc | 2064 | (string-to-int (match-string 4 gud-marker-acc))) |
| 2184 | (match-beginning 4) | ||
| 2185 | (match-end 4)))) | ||
| 2186 | 2065 | ||
| 2187 | ;; Append any text before the marker to the output we're going | 2066 | ;; Append any text before the marker to the output we're going |
| 2188 | ;; to return - we don't include the marker in this text. | 2067 | ;; to return - we don't include the marker in this text. |
| @@ -2212,13 +2091,7 @@ gud, see `gud-mode'." | |||
| 2212 | 2091 | ||
| 2213 | output)) | 2092 | output)) |
| 2214 | 2093 | ||
| 2215 | (defun gud-bashdb-find-file (f) | 2094 | (defcustom gud-bashdb-command-name "bash --debugger" |
| 2216 | (save-excursion | ||
| 2217 | (let ((buf (find-file-noselect f 'nowarn))) | ||
| 2218 | (set-buffer buf) | ||
| 2219 | buf))) | ||
| 2220 | |||
| 2221 | (defcustom gud-bashdb-command-name "bash" | ||
| 2222 | "File name for executing bash debugger." | 2095 | "File name for executing bash debugger." |
| 2223 | :type 'string | 2096 | :type 'string |
| 2224 | :group 'gud) | 2097 | :group 'gud) |
| @@ -2237,8 +2110,7 @@ and source-file directory for your debugger." | |||
| 2237 | gud-minibuffer-local-map nil | 2110 | gud-minibuffer-local-map nil |
| 2238 | '(gud-bashdb-history . 1)))) | 2111 | '(gud-bashdb-history . 1)))) |
| 2239 | 2112 | ||
| 2240 | (gud-common-init command-line 'gud-bashdb-massage-args | 2113 | (gud-common-init command-line nil 'gud-bashdb-marker-filter) |
| 2241 | 'gud-bashdb-marker-filter 'gud-bashdb-find-file) | ||
| 2242 | 2114 | ||
| 2243 | (set (make-local-variable 'gud-minor-mode) 'bashdb) | 2115 | (set (make-local-variable 'gud-minor-mode) 'bashdb) |
| 2244 | 2116 | ||
| @@ -2256,18 +2128,11 @@ and source-file directory for your debugger." | |||
| 2256 | ;; Is this right? | 2128 | ;; Is this right? |
| 2257 | (gud-def gud-statement "eval %e" "\C-e" "Execute Python statement at point.") | 2129 | (gud-def gud-statement "eval %e" "\C-e" "Execute Python statement at point.") |
| 2258 | 2130 | ||
| 2259 | (local-set-key [menu-bar debug tbreak] '("Temporary Breakpoint" . gud-tbreak)) | ||
| 2260 | (local-set-key [menu-bar debug finish] '("Finish Function" . gud-finish)) | ||
| 2261 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | ||
| 2262 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 2263 | |||
| 2264 | (setq comint-prompt-regexp "^bashdb<+[0-9]*>+ ") | 2131 | (setq comint-prompt-regexp "^bashdb<+[0-9]*>+ ") |
| 2265 | (setq paragraph-start comint-prompt-regexp) | 2132 | (setq paragraph-start comint-prompt-regexp) |
| 2266 | (run-hooks 'bashdb-mode-hook) | 2133 | (run-hooks 'bashdb-mode-hook) |
| 2267 | ) | 2134 | ) |
| 2268 | 2135 | ||
| 2269 | (provide 'bashdb) | ||
| 2270 | |||
| 2271 | ;; | 2136 | ;; |
| 2272 | ;; End of debugger-specific information | 2137 | ;; End of debugger-specific information |
| 2273 | ;; | 2138 | ;; |
| @@ -2391,6 +2256,9 @@ comint mode, which see." | |||
| 2391 | :group 'gud | 2256 | :group 'gud |
| 2392 | :type 'boolean) | 2257 | :type 'boolean) |
| 2393 | 2258 | ||
| 2259 | (defvar gud-target-name "--unknown--" | ||
| 2260 | "The apparent name of the program being debugged in a gud buffer.") | ||
| 2261 | |||
| 2394 | ;; Perform initializations common to all debuggers. | 2262 | ;; Perform initializations common to all debuggers. |
| 2395 | ;; The first arg is the specified command line, | 2263 | ;; The first arg is the specified command line, |
| 2396 | ;; which starts with the program to debug. | 2264 | ;; which starts with the program to debug. |
| @@ -2445,12 +2313,15 @@ comint mode, which see." | |||
| 2445 | (if w | 2313 | (if w |
| 2446 | (setcar w file))) | 2314 | (setcar w file))) |
| 2447 | (apply 'make-comint (concat "gud" filepart) program nil | 2315 | (apply 'make-comint (concat "gud" filepart) program nil |
| 2448 | (if massage-args (funcall massage-args file args) args))) | 2316 | (if massage-args (funcall massage-args file args) args)) |
| 2449 | ;; Since comint clobbered the mode, we don't set it until now. | 2317 | ;; Since comint clobbered the mode, we don't set it until now. |
| 2450 | (gud-mode) | 2318 | (gud-mode) |
| 2451 | (make-local-variable 'gud-marker-filter) | 2319 | (set (make-local-variable 'gud-target-name) |
| 2452 | (setq gud-marker-filter marker-filter) | 2320 | (and file-word (file-name-nondirectory file)))) |
| 2321 | (set (make-local-variable 'gud-marker-filter) marker-filter) | ||
| 2453 | (if find-file (set (make-local-variable 'gud-find-file) find-file)) | 2322 | (if find-file (set (make-local-variable 'gud-find-file) find-file)) |
| 2323 | (setq gud-running nil) | ||
| 2324 | (setq gud-last-last-frame nil) | ||
| 2454 | 2325 | ||
| 2455 | (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) | 2326 | (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) |
| 2456 | (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) | 2327 | (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) |
| @@ -2572,12 +2443,11 @@ It is saved for when this flag is not set.") | |||
| 2572 | "Find and obey the last filename-and-line marker from the debugger. | 2443 | "Find and obey the last filename-and-line marker from the debugger. |
| 2573 | Obeying it means displaying in another window the specified file and line." | 2444 | Obeying it means displaying in another window the specified file and line." |
| 2574 | (interactive) | 2445 | (interactive) |
| 2575 | (if gud-last-frame | 2446 | (when gud-last-frame |
| 2576 | (progn | 2447 | (gud-set-buffer) |
| 2577 | (gud-set-buffer) | 2448 | (gud-display-line (car gud-last-frame) (cdr gud-last-frame)) |
| 2578 | (gud-display-line (car gud-last-frame) (cdr gud-last-frame)) | 2449 | (setq gud-last-last-frame gud-last-frame |
| 2579 | (setq gud-last-last-frame gud-last-frame | 2450 | gud-last-frame nil))) |
| 2580 | gud-last-frame nil)))) | ||
| 2581 | 2451 | ||
| 2582 | ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen | 2452 | ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen |
| 2583 | ;; and that its line LINE is visible. | 2453 | ;; and that its line LINE is visible. |
| @@ -2625,7 +2495,7 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2625 | (frame (or gud-last-frame gud-last-last-frame)) | 2495 | (frame (or gud-last-frame gud-last-last-frame)) |
| 2626 | result) | 2496 | result) |
| 2627 | (while (and str (string-match "\\([^%]*\\)%\\([adeflpc]\\)" str)) | 2497 | (while (and str (string-match "\\([^%]*\\)%\\([adeflpc]\\)" str)) |
| 2628 | (let ((key (string-to-char (substring str (match-beginning 2)))) | 2498 | (let ((key (string-to-char (match-string 2 str))) |
| 2629 | subst) | 2499 | subst) |
| 2630 | (cond | 2500 | (cond |
| 2631 | ((eq key ?f) | 2501 | ((eq key ?f) |
| @@ -2878,9 +2748,9 @@ pathname standards using file-truename." | |||
| 2878 | (while (and cplist (not class-found)) | 2748 | (while (and cplist (not class-found)) |
| 2879 | (if (string-match (car cplist) f) | 2749 | (if (string-match (car cplist) f) |
| 2880 | (setq class-found | 2750 | (setq class-found |
| 2881 | (mapconcat (lambda(x) x) | 2751 | (mapconcat 'identity |
| 2882 | (split-string | 2752 | (split-string |
| 2883 | (substring f (+ (match-end 0) 1)) | 2753 | (substring f (+ (match-end 0) 1)) |
| 2884 | "/") "."))) | 2754 | "/") "."))) |
| 2885 | (setq cplist (cdr cplist))) | 2755 | (setq cplist (cdr cplist))) |
| 2886 | (if (not class-found) | 2756 | (if (not class-found) |