/[emacs]/emacs/lisp/progmodes/gdb-ui.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/gdb-ui.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.44 by nickrob, Sat Feb 5 05:31:36 2005 UTC revision 1.45 by nickrob, Tue Feb 8 11:53:43 2005 UTC
# Line 248  detailed description of this mode. Line 248  detailed description of this mode.
248    (setq gdb-output-sink 'user)    (setq gdb-output-sink 'user)
249    (setq gdb-server-prefix "server ")    (setq gdb-server-prefix "server ")
250    (setq gdb-flush-pending-output nil)    (setq gdb-flush-pending-output nil)
251      (setq gdb-location-list nil)
252    ;;    ;;
253    (setq gdb-buffer-type 'gdba)    (setq gdb-buffer-type 'gdba)
254    ;;    ;;
# Line 1046  happens to be appropriate." Line 1047  happens to be appropriate."
1047    ;; buffer specific functions    ;; buffer specific functions
1048    gdb-info-breakpoints-custom)    gdb-info-breakpoints-custom)
1049    
1050  (defvar gdb-cdir nil "Compilation directory.")  (defvar gdb-location-list nil "List of directories for source files.")
1051    
1052  (defconst breakpoint-xpm-data  (defconst breakpoint-xpm-data
1053    "/* XPM */    "/* XPM */
# Line 1145  static char *magick[] = { Line 1146  static char *magick[] = {
1146                  (setq bptno (match-string 1))                  (setq bptno (match-string 1))
1147                  (setq flag (char-after (match-beginning 2)))                  (setq flag (char-after (match-beginning 2)))
1148                  (beginning-of-line)                  (beginning-of-line)
1149                  (if (re-search-forward "in.*at\\s-+" nil t)                  (if (re-search-forward " in .* at\\s-+" nil t)
1150                      (progn                      (progn
1151                        (looking-at "\\(\\S-+\\):\\([0-9]+\\)")                        (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
1152                        (let ((line (match-string 2)) (buffer-read-only nil)                        (let ((line (match-string 2)) (buffer-read-only nil)
# Line 1153  static char *magick[] = { Line 1154  static char *magick[] = {
1154                          (add-text-properties (point-at-bol) (point-at-eol)                          (add-text-properties (point-at-bol) (point-at-eol)
1155                           '(mouse-face highlight                           '(mouse-face highlight
1156                             help-echo "mouse-2, RET: visit breakpoint"))                             help-echo "mouse-2, RET: visit breakpoint"))
1157                          (with-current-buffer                          (unless (file-exists-p file)
1158                              (find-file-noselect                             (setq file (cdr (assoc bptno gdb-location-list))))
1159                               (if (file-exists-p file) file                          (unless (string-equal file "File not found")
1160                                 (expand-file-name file gdb-cdir)))                            (if file
1161                            (save-current-buffer                                (with-current-buffer
1162                              (set (make-local-variable 'gud-minor-mode) 'gdba)                                    (find-file-noselect file)
1163                              (set (make-local-variable 'tool-bar-map)                                  (save-current-buffer
1164                                   gud-tool-bar-map))                                    (set (make-local-variable 'gud-minor-mode)
1165                            ;; only want one breakpoint icon at each location                                       'gdba)
1166                            (save-excursion                                    (set (make-local-variable 'tool-bar-map)
1167                              (goto-line (string-to-number line))                                         gud-tool-bar-map))
1168                              (gdb-put-breakpoint-icon (eq flag ?y) bptno))))))))                                  ;; only want one breakpoint icon at each location
1169                                    (save-excursion
1170                                      (goto-line (string-to-number line))
1171                                      (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
1172                                (gdb-enqueue-input
1173                                 (list (concat gdb-server-prefix "list "
1174                                               (match-string-no-properties 1) ":1\n")
1175                                       'ignore))
1176                                (gdb-enqueue-input
1177                                 (list (concat gdb-server-prefix "info source\n")
1178                                       `(lambda ()
1179                                          (gdb-get-location
1180                                           ,bptno ,line ,flag)))))))))))
1181            (end-of-line)))))            (end-of-line)))))
1182    (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))    (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))
1183    
# Line 1300  static char *magick[] = { Line 1313  static char *magick[] = {
1313    (save-excursion    (save-excursion
1314      (beginning-of-line 1)      (beginning-of-line 1)
1315      (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))      (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
1316              (looking-at ".*in.*at\\s-+\\(\\S-*\\):\\([0-9]+\\)")              (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)")
1317            (looking-at            (looking-at
1318       "[0-9]+\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)"))   "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)"))
1319          (let ((line (match-string 2))          (let ((bptno (match-string 1))
1320                (file (match-string 1)))                (file  (match-string 2))
1321                  (line  (match-string 3)))
1322            (save-selected-window            (save-selected-window
1323              (let* ((buf (find-file-noselect (if (file-exists-p file)              (let* ((buf (find-file-noselect (if (file-exists-p file)
1324                                                  file                                                  file
1325                                                (expand-file-name file gdb-cdir))))                                                (cdr (assoc bptno gdb-location-list)))))
1326                     (window (display-buffer buf)))                     (window (display-buffer buf)))
1327                (with-current-buffer buf                (with-current-buffer buf
1328                  (goto-line (string-to-number line))                  (goto-line (string-to-number line))
# Line 2039  Kills the gdb buffers and resets the sou Line 2053  Kills the gdb buffers and resets the sou
2053    "Find the source file where the program starts and displays it with related    "Find the source file where the program starts and displays it with related
2054  buffers."  buffers."
2055    (goto-char (point-min))    (goto-char (point-min))
   (if (search-forward "directory is " nil t)  
       (if (looking-at "\\S-*:\\(\\S-*\\)")  
           (setq gdb-cdir (match-string 1))  
         (looking-at "\\S-*")  
         (setq gdb-cdir (match-string 0))))  
2056    (if (search-forward "Located in " nil t)    (if (search-forward "Located in " nil t)
2057        (if (looking-at "\\S-*")        (if (looking-at "\\S-*")
2058            (setq gdb-main-file (match-string 0))))            (setq gdb-main-file (match-string 0))))
2059   (if gdb-many-windows   (if gdb-many-windows
2060        (gdb-setup-windows)        (gdb-setup-windows)
2061      (gdb-get-create-buffer 'gdb-breakpoints-buffer)     (gdb-get-create-buffer 'gdb-breakpoints-buffer)
2062      (if gdb-show-main      (if gdb-show-main
2063        (let ((pop-up-windows t))        (let ((pop-up-windows t))
2064          (display-buffer (gud-find-file gdb-main-file))))))          (display-buffer (gud-find-file gdb-main-file))))))
2065    
2066    (defun gdb-get-location (bptno line flag)
2067      "Find the directory containing the relevant source file.
2068    Put in buffer and place breakpoint icon."
2069      (goto-char (point-min))
2070      (if (search-forward "Located in " nil t)
2071          (if (looking-at "\\S-*")
2072              (push (cons bptno (match-string 0)) gdb-location-list))
2073        (gdb-resync)
2074        (push (cons bptno "File not found") gdb-location-list)
2075        (error "Cannot find source file for breakpoint location.
2076    Add directory to search path for source files using the GDB command, dir."))
2077      (with-current-buffer
2078          (find-file-noselect (match-string 0))
2079        (save-current-buffer
2080          (set (make-local-variable 'gud-minor-mode) 'gdba)
2081          (set (make-local-variable 'tool-bar-map) gud-tool-bar-map))
2082        ;; only want one breakpoint icon at each location
2083        (save-excursion
2084          (goto-line (string-to-number line))
2085          (gdb-put-breakpoint-icon (eq flag ?y) bptno))))
2086    
2087  ;;from put-image  ;;from put-image
2088  (defun gdb-put-string (putstring pos &optional dprop)  (defun gdb-put-string (putstring pos &optional dprop)
2089    "Put string PUTSTRING in front of POS in the current buffer.    "Put string PUTSTRING in front of POS in the current buffer.

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26