comparison lisp/gdb-ui.el @ 48827:dc51e4b2d5c1

Improve documentation strings. (gdb-many-windows): Set default value to nil.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 13 Dec 2002 00:41:36 +0000
parents 81dc78298a54
children f774c94b3b5e
comparison
equal deleted inserted replaced
48826:bb748ac5d3a1 48827:dc51e4b2d5c1
33 33
34 (defvar gdb-main-or-pc nil "Initialisation for Assembler buffer.") 34 (defvar gdb-main-or-pc nil "Initialisation for Assembler buffer.")
35 (defvar gdb-current-address nil) 35 (defvar gdb-current-address nil)
36 (defvar gdb-display-in-progress nil) 36 (defvar gdb-display-in-progress nil)
37 (defvar gdb-dive nil) 37 (defvar gdb-dive nil)
38 (defvar gdb-first-time nil)
39 38
40 ;;;###autoload 39 ;;;###autoload
41 (defun gdba (command-line) 40 (defun gdba (command-line)
42 "Run gdb on program FILE in buffer *gdb-FILE*. 41 "Run gdb on program FILE in buffer *gud-FILE*.
43 The directory containing FILE becomes the initial working directory 42 The directory containing FILE becomes the initial working directory
44 and source-file directory for your debugger. 43 and source-file directory for your debugger.
45 44
46 If `gdb-many-windows' is set to t this works best in X (depending on the size 45 If `gdb-many-windows' is nil (the default value) then gdb starts with
47 of your monitor) using most of the screen. After a short delay the following 46 just two windows : the GUD and the source buffer. If it is t the
48 layout will appear (keybindings given in relevant buffer) : 47 following layout will appear (keybindings given in relevant buffer) :
49 48
50 --------------------------------------------------------------------- 49 ---------------------------------------------------------------------
51 GDB Toolbar 50 GDB Toolbar
52 --------------------------------------------------------------------- 51 ---------------------------------------------------------------------
53 GUD buffer (I/O of gdb) | Locals buffer 52 GUD buffer (I/O of GDB) | Locals buffer
54 | 53 |
55 | 54 |
56 | 55 |
57 --------------------------------------------------------------------- 56 ---------------------------------------------------------------------
58 Source buffer | Input/Output (of debuggee) buffer 57 Source buffer | Input/Output (of debuggee) buffer
73 All the buffers share the toolbar and source should always display in the same 72 All the buffers share the toolbar and source should always display in the same
74 window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint 73 window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint
75 icons are displayed both by setting a break with gud-break and by typing break 74 icons are displayed both by setting a break with gud-break and by typing break
76 in the GUD buffer. 75 in the GUD buffer.
77 76
77 This works best (depending on the size of your monitor) using most of the
78 screen.
79
78 Displayed expressions appear in separate frames. Arrays may be displayed 80 Displayed expressions appear in separate frames. Arrays may be displayed
79 as slices and visualised using the graph program from plotutils if installed. 81 as slices and visualised using the graph program from plotutils if installed.
80 82 Pointers in structures may be followed in a tree-like fashion.
81 If `gdb-many-windows' is set to nil then gdb starts with just two windows :
82 the GUD and the source buffer.
83 83
84 The following interactive lisp functions help control operation : 84 The following interactive lisp functions help control operation :
85 85
86 `gdb-many-windows' - Toggle the number of windows gdb uses. 86 `gdb-many-windows' - Toggle the number of windows gdb uses.
87 `gdb-restore-windows' - to restore the layout if its lost. 87 `gdb-restore-windows' - To restore the window layout.
88 `gdb-quit' - to delete (most) of the buffers used by gdb." 88 `gdb-quit' - To delete (most) of the buffers used by GDB-UI and
89 reset variables."
89 90
90 (interactive (list (gud-query-cmdline 'gdba))) 91 (interactive (list (gud-query-cmdline 'gdba)))
91 92
92 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. 93 ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
93 (gdb command-line) 94 (gdb command-line)
1382 (use-local-map gdb-breakpoints-mode-map) 1383 (use-local-map gdb-breakpoints-mode-map)
1383 (setq buffer-read-only t) 1384 (setq buffer-read-only t)
1384 (gdb-invalidate-breakpoints)) 1385 (gdb-invalidate-breakpoints))
1385 1386
1386 (defun gdb-toggle-bp-this-line () 1387 (defun gdb-toggle-bp-this-line ()
1387 "Enable/disable the breakpoint on this line." 1388 "Enable/disable the breakpoint of the current line."
1388 (interactive) 1389 (interactive)
1389 (save-excursion 1390 (save-excursion
1390 (beginning-of-line 1) 1391 (beginning-of-line 1)
1391 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) 1392 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
1392 (error "Not recognized as break/watchpoint line") 1393 (error "Not recognized as break/watchpoint line")
1399 (match-string 1) 1400 (match-string 1)
1400 "\n") 1401 "\n")
1401 'ignore))))) 1402 'ignore)))))
1402 1403
1403 (defun gdb-delete-bp-this-line () 1404 (defun gdb-delete-bp-this-line ()
1404 "Delete the breakpoint on this line." 1405 "Delete the breakpoint of the current line."
1405 (interactive) 1406 (interactive)
1406 (beginning-of-line 1) 1407 (beginning-of-line 1)
1407 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) 1408 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
1408 (error "Not recognized as break/watchpoint line") 1409 (error "Not recognized as break/watchpoint line")
1409 (gdb-instance-enqueue-idle-input 1410 (gdb-instance-enqueue-idle-input
1415 'ignore)))) 1416 'ignore))))
1416 1417
1417 (defvar gdb-source-window nil) 1418 (defvar gdb-source-window nil)
1418 1419
1419 (defun gdb-goto-bp-this-line () 1420 (defun gdb-goto-bp-this-line ()
1420 "Display the file at the specified breakpoint." 1421 "Display the file in the source buffer at the specified breakpoint."
1421 (interactive) 1422 (interactive)
1422 (save-excursion 1423 (save-excursion
1423 (beginning-of-line 1) 1424 (beginning-of-line 1)
1424 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) 1425 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
1425 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")) 1426 (looking-at "\\(\\S-*\\):\\([0-9]+\\)"))
1500 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) 1501 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t))
1501 (n (or (and pos (string-to-int (match-string 1))) 0))) 1502 (n (or (and pos (string-to-int (match-string 1))) 0)))
1502 n))) 1503 n)))
1503 1504
1504 (defun gdb-frames-mouse-select (e) 1505 (defun gdb-frames-mouse-select (e)
1505 "Display the source of the selected frame." 1506 "Make the selected frame become the current frame and
1507 display the source in the source buffer."
1506 (interactive "e") 1508 (interactive "e")
1507 (let (selection) 1509 (let (selection)
1508 (save-excursion 1510 (save-excursion
1509 (set-buffer (window-buffer (posn-window (event-end e)))) 1511 (set-buffer (window-buffer (posn-window (event-end e))))
1510 (save-excursion 1512 (save-excursion
1692 (interactive) 1694 (interactive)
1693 (switch-to-buffer-other-frame 1695 (switch-to-buffer-other-frame
1694 (gdb-get-create-instance-buffer 'gdb-display-buffer))) 1696 (gdb-get-create-instance-buffer 'gdb-display-buffer)))
1695 1697
1696 (defun gdb-toggle-disp-this-line () 1698 (defun gdb-toggle-disp-this-line ()
1697 "Enable/disable the displayed expression on this line." 1699 "Enable/disable the displayed expression of the current line."
1698 (interactive) 1700 (interactive)
1699 (save-excursion 1701 (save-excursion
1700 (beginning-of-line 1) 1702 (beginning-of-line 1)
1701 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)")) 1703 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)"))
1702 (error "No expression on this line") 1704 (error "No expression on this line")
1709 (match-string 1) 1711 (match-string 1)
1710 "\n") 1712 "\n")
1711 'ignore))))) 1713 'ignore)))))
1712 1714
1713 (defun gdb-delete-disp-this-line () 1715 (defun gdb-delete-disp-this-line ()
1714 "Delete the displayed expression on this line." 1716 "Delete the displayed expression of the current line."
1715 (interactive) 1717 (interactive)
1716 (save-excursion 1718 (save-excursion
1717 (set-buffer 1719 (set-buffer
1718 (gdb-get-instance-buffer 'gdb-display-buffer)) 1720 (gdb-get-instance-buffer 'gdb-display-buffer))
1719 (beginning-of-line 1) 1721 (beginning-of-line 1)
1888 (other-window 1)) 1890 (other-window 1))
1889 1891
1890 (define-minor-mode gdb-many-windows 1892 (define-minor-mode gdb-many-windows
1891 "Toggle the number of windows in the basic arrangement." 1893 "Toggle the number of windows in the basic arrangement."
1892 :group 'gud 1894 :group 'gud
1893 :init-value t 1895 :init-value nil
1894 (gdb-restore-windows)) 1896 (gdb-restore-windows))
1895 1897
1896 (defun gdb-restore-windows () 1898 (defun gdb-restore-windows ()
1897 "Restore the basic arrangement of windows used by gdba. 1899 "Restore the basic arrangement of windows used by gdba.
1898 This arrangement depends on the value of `gdb-many-windows'." 1900 This arrangement depends on the value of `gdb-many-windows'."
1941 (find-image `((:type xpm :data ,breakpoint-xpm-data 1943 (find-image `((:type xpm :data ,breakpoint-xpm-data
1942 :conversion laplace))) 1944 :conversion laplace)))
1943 "Icon for disabled breakpoint in display margin") 1945 "Icon for disabled breakpoint in display margin")
1944 1946
1945 (defun gdb-quit () 1947 (defun gdb-quit ()
1946 "Kill the GUD and ancillary (including source) buffers. 1948 "Kill the GUD and instance buffers and reset variables.
1947 Just the partial-output buffer is left." 1949 Use this command to exit a debugging session cleanly and reset
1950 things like the toolbar and margin in the source buffers."
1948 (interactive) 1951 (interactive)
1949 (let ((buffers (buffer-list))) 1952 (let ((buffers (buffer-list)))
1950 (save-excursion 1953 (save-excursion
1951 (while buffers 1954 (while buffers
1952 (set-buffer (car buffers)) 1955 (set-buffer (car buffers))