@@ -1051,8 +1051,7 @@ HAS-CHILDREN should be t when this node has children."
1051
1051
(gdb--set-window-buffer middle-right (gdb--frames-get-buffer session))
1052
1052
(gdb--set-window-buffer bottom-left (gdb--watchers-get-buffer session))
1053
1053
(gdb--set-window-buffer bottom-right (gdb--variables-get-buffer session))
1054
- (setf (gdb--session-source-window session) top-left)
1055
- (gdb--display-source-buffer))))
1054
+ (gdb--display-source-buffer top-left))))
1056
1055
1057
1056
(defun gdb--switch-buffer (buffer-fun )
1058
1057
(gdb--with-valid-session
@@ -1825,15 +1824,19 @@ stopped thread before running the command. If FORCE-STOPPED is
1825
1824
1826
1825
; ; ------------------------------------------------------------------------------------------
1827
1826
; ; Source buffers
1828
- (defun gdb--display-source-buffer (&optional override-file override-line force )
1827
+ (defun gdb--display-source-buffer (&optional force override-file override-line )
1829
1828
" Display buffer of the selected source, and mark the current line.
1829
+ When FORCE is non-nil, the source window will be created and shown.
1830
+ FORCE may be the new window to display the source buffer.
1831
+
1830
1832
The source file and line are fetched from the selected frame, unless OVERRIDE-FILE and OVERRIDE-LINE are set,
1831
1833
in which case those will be used.
1832
- OVERRIDE-LINE may also be `no-mark' , which forces it to not mark any line.
1833
- When FORCE is non-nil, it will display it, even if the window does not exist and a disassembly buffer is visible."
1834
+ OVERRIDE-LINE may also be `no-mark' , which forces it to not mark any line."
1834
1835
(gdb--with-valid-session
1835
1836
(gdb--remove-all-symbols session 'source-indicator t )
1836
1837
1838
+ (when (window-live-p force) (setf (gdb--session-source-window session) force))
1839
+
1837
1840
(let* ((frame (gdb--session-selected-frame session))
1838
1841
(file (cond (override-file)
1839
1842
(frame (gdb--frame-file frame))))
@@ -1843,7 +1846,8 @@ When FORCE is non-nil, it will display it, even if the window does not exist and
1843
1846
(window (gdb--session-source-window session))
1844
1847
recenter-redisplay)
1845
1848
1846
- (unless (or (window-live-p window) (and (not force) (gdb--disassembly-is-visible)))
1849
+ (when (and (not (window-live-p window))
1850
+ (or force (and buffer (not (gdb--disassembly-is-visible)))))
1847
1851
(setq window (gdb--create-frame-for-buffer session (gdb--comint-get-buffer session)))
1848
1852
(setf (gdb--session-source-window session) window))
1849
1853
@@ -1910,7 +1914,7 @@ it from the list."
1910
1914
(cl-pushnew 'gdb--frames (gdb--session-buffer-types-to-update session))))))
1911
1915
1912
1916
(defun gdb--set-initial-file (file )
1913
- (gdb--display-source-buffer (gdb--complete-path file) 'no-mark ))
1917
+ (gdb--display-source-buffer nil (gdb--complete-path file) 'no-mark ))
1914
1918
1915
1919
(defun gdb--get-thread-info (&optional id-str )
1916
1920
(gdb--command (concat " -thread-info " id-str) 'gdb--context-thread-info ))
@@ -2514,7 +2518,7 @@ _i_nferior i/o | _f_rames | _d_isassembly | _w_atcher | ^ ^ |
2514
2518
(" r" (gdb--switch-buffer 'gdb--registers-get-buffer ))
2515
2519
(" s" (progn (setf (gdb--session-source-window (gdb--infer-session)) (and (not gdb--open-buffer-new-frame)
2516
2520
(selected-window )))
2517
- (gdb--display-source-buffer nil nil t )))
2521
+ (gdb--display-source-buffer t )))
2518
2522
(" <f12>" (setq gdb--open-buffer-new-frame (not gdb--open-buffer-new-frame)) :exit nil ))
2519
2523
2520
2524
(defun gdb-toggle-breakpoint (&optional arg )
0 commit comments