DelveでGoglandでリモートデバッグをするときに助けが必要です。リモートデバッグGogland halting
私はIDE Goglang(1.0 EAP)とDLVリンクを使用してリモートサーバー上の私のアプリをデバッグしよう:https://github.com/derekparker/delve/
インストールして、リモートデバッグ簡単なプログラムしてみてください:まず
package main
import "fmt"
func main() {
fmt.Println("hello world")
for i:=uint(0); i< 10; i++{
fmt.Println(i)
}
}
を、リモコンのDLVを開始ホスト(コンソールからの出力):次に
$ dlv debug --headless --listen=:2345 --log --api-version=2
API server listening at: [::]:2345
、IDEでリモートデバッグを開始します。
私は予想通り2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:24 debugger.go:493: halting
2017/07/20 17:23:24 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x47bb52, File:"/....../hello/hello.go", Line:6, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:23:24 debugger.go:504: continuing
2017/07/20 17:23:28 debugger.go:516: nexting
hello world
2017/07/20 17:23:28 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
0
2017/07/20 17:23:29 debugger.go:516: nexting
02017/07/20 17:23:29 debugger.go:516: nexting
2017/07/20 17:23:29 debugger.go:516: nexting
1
2017/07/20 17:23:29 debugger.go:516: nexting
12017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
2
2017/07/20 17:23:30 debugger.go:516: nexting
42017/07/20 17:23:30 debugger.go:516: nexting
2017/07/20 17:23:30 debugger.go:516: nexting
3
2017/07/20 17:23:30 debugger.go:516: nexting
92017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
4
2017/07/20 17:23:31 debugger.go:516: nexting
162017/07/20 17:23:31 debugger.go:516: nexting
2017/07/20 17:23:31 debugger.go:516: nexting
5
2017/07/20 17:23:32 debugger.go:516: nexting
252017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
6
2017/07/20 17:23:32 debugger.go:516: nexting
362017/07/20 17:23:32 debugger.go:516: nexting
2017/07/20 17:23:32 debugger.go:516: nexting
7
2017/07/20 17:23:33 debugger.go:516: nexting
492017/07/20 17:23:33 debugger.go:516: nexting
2017/07/20 17:23:33 debugger.go:516: nexting
8
2017/07/20 17:23:34 debugger.go:516: nexting
642017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:34 debugger.go:516: nexting
9
2017/07/20 17:23:34 debugger.go:516: nexting
812017/07/20 17:23:34 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
2017/07/20 17:23:35 debugger.go:516: nexting
すべての作品(ブレークポイント、F7、F8およびなど)
はその後、私は私のアプリをデバッグしよう:アウトリモートホストコンソールから
dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:26:51 debugger.go:97: launching process with args: [/home/...../debug --v --console]
API server listening at: [::]:2345
IDE
2017/07/20 17:26:55 debugger.go:493: halting
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a73, File:"/home/..........go", Line:136, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:2, Name:"", Addr:0x6869b2, File:"/home/..........go", Line:66, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:55 debugger.go:347: created breakpoint: &api.Breakpoint{ID:3, Name:"", Addr:0x687d33, File:"/home/........go", Line:143, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:26:55 debugger.go:504: continuing
2017/07/20 17:26:57 debugger.go:516: nexting
012:
出力を開始
IDEデバッグが機能しません(ハングアップ)。私はブレークポイントを使用しない場合は、アプリの起動と通常の(ラン)のように実行します。
私は、この行は私の問題の原因だと思う:
2017年7月20日午前17時26分45秒debugger.go:493:なぜそれが起きない
を停止します?たぶん私は複雑なユーティリティ構造を持っているかもしれません(メインパッケージはいくつかのファイルに分かれていますが、もちろん外部プラグインパッケージなどあります)?
にすぎないこと、あなたはIDEを通じてないリモートサーバーに参加するが、コンソールを介して、その後、簡単な例で、私のユーティリティの場合は作品をデバッグする場合(最も興味深いのは!):
dlv connect HOSTNAME:2345
Type 'help' for list of commands.
(dlv) b ********.go:137
Breakpoint 1 set at 0x687a86 for main.main() /home/*************.go:137
(dlv) c
> main.main() /home/***************************.go:137 (hits goroutine(1):1 total:1) (PC: 0x687a86)
(dlv) n
出力:
$ dlv debug --headless --listen=:2345 --log --api-version=2 -- --v --console
2017/07/20 17:37:37 debugger.go:97: launching process with args: [/home/*****************/debug --v --console]
API server listening at: [::]:2345
2017/07/20 17:38:27 debugger.go:347: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x687a86, File:"/home/*******************.go", Line:137, FunctionName:"main.main", Cond:"", Tracepoint:false, Goroutine:false, Stacktrace:0, Variables:[]string(nil), LoadArgs:(*api.LoadConfig)(nil), LoadLocals:(*api.LoadConfig)(nil), HitCount:map[string]uint64{}, TotalHitCount:0x0}
2017/07/20 17:38:35 debugger.go:504: continuing
2017/07/20 17:38:39 debugger.go:516: nexting
もの。 IDEのエラーの疑いがある、または私は何か間違っている:)。
また、dlv exec(既にビルドアプリ)と他のコマンドでデバッグを試してみます。
質問にお答えいただきありがとうございます、本当に助けて欲しいです。
P.S.私はまた、あなたがGOアプリのためのリモートデバッグに使用できる他のものを知ってうれしく思います。
P.P.S.私はAtom.ioとVSコードでリモートデバッグを試みました Atomでは、dlvでのみロケールデバッグを行います。
VSコードでは、ローカルデバッガはdlv +リモートデバッガで動作しますが、ブレークポイントは機能しません。それら。 VSコードもオプションではありません。 の設定VSコード(launch.json)
{
"version": "0.2.0",
"configurations": [
{
"name": "REMOTE",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "{workspaceRoot}",
"port": 2345,
"host": "REMOTE_HOST_NAME",
"program": "${workspaceRoot}", //"${fileDirname}",
"env": {},
"args": ["--v", "--console"],
"showLog": true
}
]
}
Goglandの場合、ヘルプには「#com.goide.dlv.DlvVm」を付けてください。デバッグログ設定...アプリケーションを試してデバッグし、ここにログを追加します。ログはヘルプ|ログインを表示して、idea.logを見てください。代わりに、トラッカーで問題を開くことができます:https://youtrack.jetbrains.com/issues/Goそしてそこにログをアップロードしてください – dlsniper
@dlsniper、IDEのログファイル:http://s000.tinyupload.com/?file_id = 03959827677220728410 – Arseny
私が言うことができる限り、掘り下げているのはプロセスだけです。それだけです。あなたは最新のGo(1.8.3)を実行していますか?デバッグされたプロセスのホストは何ですか?デバッグされたアプリケーションをどのように構築/起動しますか?私は単純なアプリが動作するかどうかわからない?もしそうであれば、IDEからFULLログを投稿できますか?実際のアプリがうまくいかない場合、おそらくそれの背後には何か他の理由がありますが、サンプルでそれを再現する方法がなければ、私はそれについてできることはあまりありません。残念ながら、これらの種類のものはStackOverflowで解決するのには適していません。 – dlsniper