2

When running gdb -i=miand then attach to the process for debugging, emacs hangs for like 5 minutes before I can type anything. After trial and error I found it is caused by the following line in my init.el file:

(setq gdb-many-windows t)

Start software to debug->Get Process ID->Start Emacs->Start gdb inside Emacs (with many-window)->Attach to Process->Set break point->Continue->Do things in software GUI to trigger breakpoint->Emacs show break point hit and hangs for 5 minutes

The configuration was never changed, and I only start experiencing this problem recently. So is gdb-many-windows really affecting the performance so bad or if there is some thing else possibly, like the version of emacs or debugger?

GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4). GNU gdb (GDB) 7.10.

0

1 Answer 1

1

If thats indeed gdb-many-windows problem. One can avoid using gdb-many-windows and define similar functionality inside the function gdb-get-source-file. You can modify the source file and build from source, but can also defadvice gdb-get-source-file, e.g.

(defadvice gdb-get-source-file (after new-setup-gdb-windows activate)
    (goto-char (point-min))
  (if (re-search-forward gdb-source-file-regexp nil t)
      (setq gdb-main-file (read (match-string 1))))
    (gdb-get-buffer-create 'gdb-stack-buffer)
  (set-window-dedicated-p (selected-window) nil)
  (switch-to-buffer gud-comint-buffer)
  (delete-other-windows)
     (let ((win0 (selected-window))
        (win1 (split-window nil nil 'left))      ;code and output
        (win2 (split-window-below (/ (* (window-height) 2) 3)))     ;stack
        )
    (select-window win2)
    (gdb-set-window-buffer (gdb-stack-buffer-name))
    (select-window win1)
    (set-window-buffer
     win1
     (if gud-last-last-frame
         (gud-find-file (car gud-last-last-frame))
       (if gdb-main-file
           (gud-find-file gdb-main-file)
         ;; Put buffer list in window if we
         ;; can't find a source file.
         (list-buffers-noselect))))
    (setq gdb-source-window (selected-window))
    (let ((win3 (split-window nil (/ (* (window-height) 3) 4)))) ;io
      (gdb-set-window-buffer (gdb-get-buffer-create 'gdb-inferior-io) nil win3))
    (select-window win0)
;;(if gdb-many-windows
;;gdb-setup-windows is previously called here
            )
      (gdb-force-mode-line-update
       (propertize "ready" 'face font-lock-variable-name-face)))

Right now gdb-get-source-file is doing something similar to the original gdb-many-windows file but with fewer buffers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.