SL-RU/stm32-emacs

arm-none-eabi-gdb is not compatible with Emacs built in gdb?

Opened this issue · 0 comments

Thanks your effort to share this package.

When I am exploring stm32-emacs, encounter a problem.

Try: M-x stm32-start-gdb-elf then select cfg file and elf file. "stm32-gdb-server" starts successfully,
then Emacs ask "Enable querying debuginfod servers for this session? (y or n) ",
then I enter "y" and hit "Enter" to comfirm.
But "gud-target extended-remote localhost:3333" thow a error:

Debugger entered--Lisp error: (wrong-type-argument gdb-handler nil)
  signal(wrong-type-argument (gdb-handler nil))
  gdb-get-handler-function(1)
  gdb-handle-reply(1)
  gdb-done-or-error("1" error "msg=\"Support for debuginfod is not compiled into G..." t)
  gdb-error("1" "msg=\"Support for debuginfod is not compiled into G..." t)
  gdbmi-bnf-incomplete-record-result("1" (gdb-error . progressive))
  #f(compiled-function () #<bytecode 0x1f930131137fb>)()
  gdbmi-bnf-result-and-async-record-impl()
  gdbmi-bnf-async-record()
  gdbmi-bnf-out-of-band-record()
  gdbmi-bnf-output()
  gud-gdbmi-marker-filter("1^error,msg=\"Support for debuginfod is not compile...")
  apply(gud-gdbmi-marker-filter "1^error,msg=\"Support for debuginfod is not compile...")
  gud-marker-filter("1^error,msg=\"Support for debuginfod is not compile...")
  gud-filter(#<process gud-target extended-remote localhost:3333> "1^error,msg=\"Support for debuginfod is not compiled into GDB.\"\n(gdb) \n2^done\n(gdb) \n3^done\n(gdb) \n4^done\n(gdb) \n5^done\n(gdb) \n6^done,files=[{file=\"Mid...")
  read-from-minibuffer(#("Enable querying debuginfod servers for this session? (y or n) " 54 55 (face help-key-binding font-lock-face help-key-binding) 59 60 (face help-key-binding font-lock-face help-key-binding)) nil (keymap (keymap (C-M-left . backward-sexp) (C-M-right . forward-sexp) (escape . abort-recursive-edit) (remap keymap (quit . abort-recursive-edit) (exit-prefix . abort-recursive-edit) (exit . y-or-n-p-insert-other) (scroll-other-window-down . minibuffer-scroll-other-window-down) (scroll-other-window . minibuffer-scroll-other-window) (scroll-down . minibuffer-scroll-down-command) (scroll-up . minibuffer-scroll-up-command) (recenter . minibuffer-recenter-top-bottom) (self-insert-command . y-or-n-p-insert-other) (ignore . y-or-n-p-insert-other) (delete-and-edit . y-or-n-p-insert-other) (edit-replacement . y-or-n-p-insert-other) (edit . y-or-n-p-insert-other) (undo-all . y-or-n-p-insert-other) (undo . y-or-n-p-insert-other) (backup . y-or-n-p-insert-other) (skip . y-or-n-p-insert-n) (automatic . y-or-n-p-insert-y) (act-and-exit . y-or-n-p-insert-y) (act-and-show . y-or-n-p-insert-y) (act . y-or-n-p-insert-y)) keymap (16 . previous-line-or-history-element) (14 . next-line-or-history-element) (escape . keyboard-escape-quit) (18 . counsel-minibuffer-history) (23 . evil-delete-backward-word) (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the min...") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuf...") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\15" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (24 keymap (down . minibuffer-complete-defaults) (up . minibuffer-complete-history)) (13 . exit-minibuffer) (10 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (60 . minibuffer-beginning-of-buffer) (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) keymap (escape . exit-prefix) (M-prior . scroll-other-window-down) (M-next . scroll-other-window) (prior . scroll-down) (next . scroll-up) (27 keymap (33554454 . scroll-other-window-down) (22 . scroll-other-window) (118 . scroll-down)) (22 . scroll-up) (29 . quit) (7 . quit) (63 . help) (help . help) (f1 . help) (8 . help) (85 . undo-all) (117 . undo) (94 . backup) (33 . automatic) (12 . recenter) (23 . delete-and-edit) (18 . edit) (46 . act-and-exit) (return . exit) (13 . exit) (113 . exit) (44 . act-and-show) (69 . edit-replacement-exact-case) (101 . edit-replacement) (78 . skip) (89 . act) (110 . skip) (121 . act) (backspace . skip) (delete . skip) (127 . skip) (32)) nil t)
  y-or-n-p("Enable querying debuginfod servers for this sessio...")
  gdb-init-1()
  gdb-update()
  gdb("arm-none-eabi-gdb -iex \"target extended-remote localhost:3333\" -i=mi  /Users/c/Downloads/STM32Project/STM32F103ZET6__CubeMX__/FreeRTOS/Demo8-1_Notify_ADC/./build/Demo8-1_Notify_ADC.elf")
  (progn (gdb (s-concat stm32-gdb-command " " (concat root file))))
  (unwind-protect (progn (gdb (s-concat stm32-gdb-command " " (concat root file)))) (set-window-configuration wconfig))
  (let ((wconfig (current-window-configuration))) (unwind-protect (progn (gdb (s-concat stm32-gdb-command " " (concat root file)))) (set-window-configuration wconfig)))
  (progn (let ((wconfig (current-window-configuration))) (unwind-protect (progn (gdb (s-concat stm32-gdb-command " " (concat root file)))) (set-window-configuration wconfig))))
  (if file (progn (let ((wconfig (current-window-configuration))) (unwind-protect (progn (gdb (s-concat stm32-gdb-command " " (concat root file)))) (set-window-configuration wconfig)))))
  (let ((file (stm32--select-file root "*.elf"))) (if file (progn (let ((wconfig (current-window-configuration))) (unwind-protect (progn (gdb (s-concat stm32-gdb-command " " ...))) (set-window-configuration wconfig))))))
  (progn (let ((file (stm32--select-file root "*.elf"))) (if file (progn (let ((wconfig (current-window-configuration))) (unwind-protect (progn (gdb ...)) (set-window-configuration wconfig)))))))
  (if (and 'root 'server-started) (progn (let ((file (stm32--select-file root "*.elf"))) (if file (progn (let ((wconfig ...)) (unwind-protect (progn ...) (set-window-configuration wconfig))))))))
  (let* ((root (projectile-project-root)) (p (get-buffer-process "*stm32-gdb-server*")) (server-started (if (not p) (progn (stm32-start-gdb-server))))) (if (and 'root 'server-started) (progn (let ((file (stm32--select-file root "*.elf"))) (if file (progn (let (...) (unwind-protect ... ...))))))))
  stm32-start-gdb-elf()
  funcall-interactively(stm32-start-gdb-elf)
  call-interactively(stm32-start-gdb-elf record nil)
  command-execute(stm32-start-gdb-elf record)
  counsel-M-x-action("stm32-start-gdb-elf")
  ivy-call()
  ivy-read("M-x " ("toggle-debug-on-error" "stm32-kill-gdb" "stm32-flash-to-mcu" "gud-gdb" "stm32-start-gdb-server" "gdb" "eval-region" "erase-buffer" "project-compile" "project-find-file" "diredp-paste-files" "hurricane/dired-duplicate-this-file" "blink-search" "eaf-open-pdf-from-history" "lsp-bridge-restart-process" "imenu" "helm-imenu" "lsp-format-region" "clang-format-buffer" "lsp-bridge-code-format" "lsp-format-buffer" "align-regexp" "org-noter" "eaf-stop-process" "blink-search-restart-process" "hurricane/now" "calc-now" "hurricane/open-link-in-chrome" "treemacs" "counsel-org-goto" "vera-mode" "dap-debug" "dap-hydra" "lsp-bridge-peek" "dap-gdb-lldb-setup" "hurricane//org-noter-store-link" "lsp-mode" "evil-surround-delete" "hurricane/insert-chrome-current-tab-url" "dap-mode" "activities-resume" "dap-debug-edit-template" "hurricane/manage-chrome-tabs" "activities-new" "activities-save-all" "find-lisp-find-dired" "dap-ui-show-many-windows" "auto-save-mode" "dap-delete-session" "eaf-restart-process" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (C-M-left . backward-sexp) (C-M-right . forward-sexp) (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)

So I decide to do a litter dig into this.

I try to run

  gdb("arm-none-eabi-gdb -iex \"target extended-remote localhost:3333\" -i=mi  /Users/c/Downloads/STM32Project/STM32F103ZET6__CubeMX__/FreeRTOS/Demo8-1_Notify_ADC/./build/Demo8-1_Notify_ADC.elf")

this command string:

arm-none-eabi-gdb -iex "target extended-remote localhost:3333" -i=mi  /Users/c/Downloads/STM32Project/STM32F103ZET6__CubeMX__/FreeRTOS/Demo8-1_Notify_ADC/./build/Demo8-1_Notify_ADC.elf

in Emacs built in gdb manually.

It throws error too.

2024-04-17 00 51 19

Then I try the same command string in gub-gdb, It runs successfully.

2024-04-17 00 53 23

Here is my Emacs information:

System Info 💻

  • OS: darwin
  • Emacs: 29.3
  • Spacemacs: 0.999.0
  • Spacemacs branch: nil (rev. nil)
  • Graphic display: t
  • Running in daemon: nil
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(ivy better-defaults
     (search-engine :variables search-engine-config-list
                    '((CAAC :name "CAAC" :url "http://www.caac.gov.cn/so/s?tab=all&qt=%s" :keywords
                            (:keybinding "c" :docstring "**民用航空局智能云搜索"))
                      (SOGOU :name "SOGOU" :url "https://weixin.sogou.com/weixin?type=2&s_from=input&query=%s" :keywords
                             (:keybinding "s" :docstring "搜狗微信搜索" :browser 'eaf-open-browser))
                      (WEIXIN :name "WEIXIN" :url "https://weixin.sogou.com/weixin?type=2&s_from=input&query=%s" :keywords
                              (:keybinding "w" :docstring "搜狗微信搜索"))
                      (MERRIAM-WEBSTER :name "MERRIAM-WEBSTER" :url "https://www.merriam-webster.com/dictionary/%s" :keywords
                                       (:keybinding "m" :docstring "韦氏词典" :browser 'eaf-open-browser))))
     (syntax-checking :variables syntax-checking-enable-by-default t syntax-checking-enable-tooltips t)
     (vinegar :variables vinegar-reuse-dired-buffer t)
     (git :variables git-magit-status-fullscreen t magit-push-always-verify nil magit-save-repository-buffers 'dontask magit-revert-buffers 'silent magit-refs-show-commit-count 'all magit-revision-show-gravatars nil)
     (auto-completion :variables auto-completion-enable-sort-by-usage t auto-completion-enable-snippets-in-popup t auto-completion-enable-help-tooltip nil :disabled-for org markdown)
     emacs-lisp
     (org :variables org-want-to-do-binding t org-enable-github-support t org-enable-reveal-js-support t org-enable-roam-support t org-enable-roam-support t org-enable-roam-protocol t org-enable-roam-server t org-roam-v2-ack t org-enable-valign t org-enable-hugo-support t org-enable-transclusion-support t)
     fasd
     (chinese :variables chinese-default-input-method nil chinese-enable-youdao-dict t)
     (eaf :variables eaf-python-command "python3.10" eaf-pdf-dark-mode nil browse-url-browser-function 'browse-url-default-browser eaf-proxy-type "http" eaf-proxy-host "0.0.0.0" eaf-proxy-port "7890")
     pdf hurricane)
  • System configuration features: ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

Finally, if I change from gdb to gub-gdb in this line:

(gdb (s-concat stm32-gdb-command " " (concat root file)))))))))

I can run command stm32-start-gdb-elf to start gdb server and debugger succesfully.

So what causes the difference?