-
Notifications
You must be signed in to change notification settings - Fork 51
Support for debugging go with gdb #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |
| (require 'hexl) | ||
| (require 'tramp) | ||
| (require 'jsonrpc) | ||
| (require 'which-func) | ||
|
|
||
|
|
||
| ;;; Obsolete aliases | ||
|
|
@@ -219,6 +220,26 @@ | |
| :type "debug" | ||
| :cwd "." | ||
| :program ".") | ||
| (go-gdb-test | ||
| modes (go-mode go-ts-mode) | ||
| command "gdb" | ||
| command-args ("--interpreter=dap") | ||
| command-cwd (lambda () (file-name-directory (buffer-file-name))) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dape supports short cutting these functions as just |
||
| compile (lambda () (format "go test -c -o %s -gcflags '-N -l'" (dape--go-test-binary-name))) ;; compile without optimizations | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work for me: Same for |
||
| :request "launch" | ||
| :program dape--go-test-binary-name | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a big fan of language specific functions, this could be defined inline |
||
| :args [] | ||
| :stopAtBeginningOfMainSubprogram t) | ||
| (go-gdb | ||
| modes (go-mode go-ts-mode) | ||
| command "gdb" | ||
| command-args ("--interpreter=dap") | ||
| command-cwd dape-command-cwd | ||
| compile (lambda () (format "go build -o %s -gcflags '-N -l'" (dape--go-binary-name))) ;; compile without optimizations | ||
| :request "launch" | ||
| :program dape--go-binary-name | ||
| :args [] | ||
| :stopAtBeginningOfMainSubprogram t) | ||
| (flutter | ||
| ensure dape-ensure-command | ||
| modes (dart-mode) | ||
|
|
@@ -822,6 +843,22 @@ Non interactive global minor mode." | |
|
|
||
| ;;; Utils | ||
|
|
||
| (defun dape--go-test-name () | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I am missing something but where is this used? (also as stated above I don't want to define language specific functions)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, it's not used atm. This is a leftover from my prototype to debug test under cursor. However, the logic to construct the test runner invocation is somewhat convoluted and breaking it into pieces would help. I'll remove it for now. |
||
| "Retrieve Go test function name from current cursor position." | ||
| (if-let* ((file-name (buffer-file-name)) | ||
| ((string-suffix-p "_test.go" file-name)) | ||
| (fn-name (which-function))) | ||
| `["-test.run" ,(concat "^" (car (split-string (substring-no-properties fn-name))) "$")] | ||
| [])) | ||
|
|
||
| (defun dape--go-test-binary-name () | ||
| "Format path to Go debugged test binary executable file." | ||
| (concat (temporary-file-directory) "__test.bin")) | ||
|
|
||
| (defun dape--go-binary-name () | ||
| "Format path to Go debugger binary exectuable file." | ||
| (concat (temporary-file-directory) "__prog.bin")) | ||
|
|
||
| (defun dape--warn (format &rest args) | ||
| "Display warning/error message with FORMAT and ARGS." | ||
| (dape--repl-insert-error (format "* %s *\n" (apply #'format format args)))) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
ensuresymbol. This should be grouped with the other gdb configuration and ensure implemented once (seejs-debugconfiguration)