Go, VSCODE IDE, Delve debugger: am having problem debugging my console app

407 views
Skip to first unread message

evan

unread,
Jan 31, 2018, 12:50:02 AM1/31/18
to golang-nuts
i can debug my web app server code with no problem with the Go, VSCODE, and Delve setup.

the client connecting to that web app is a console app, which primarily does the following:

gets json data from the server, stuffs the data into the table widget of the terminal user interface (3rd party Go package) for display, lets users edit the data, etc

the console app runs fine when i go run client.go. but when i want to debug the code, the client app doesn't show up :-)

so i'm currently forced to log println's out to a file so i can keep moving forward.

any suggestion what i can do so that i can start up my console app in debug mode and when it shows up, interact with it until i get to preset breakpoints, etc (or other set of steps that might work)?

i'm working in a windows 10 development machine, go version 1.9.2, and VSCODE 1.19.3

thanks for any help!

depa...@redhat.com

unread,
Jan 31, 2018, 9:50:54 AM1/31/18
to golang-nuts
Console app as in some sort of GUI application? Also, what actually happens when you run the app under Delve, like when you actually run `continue`? 

evan

unread,
Jan 31, 2018, 10:29:19 AM1/31/18
to golang-nuts
hi! thanks for responding!

when i hit F5 initially to Start Debugging, the debugger stops at a preset breakpoint. i hit F5 to continue... the Debug Console prints out it's continuing ... nothing happens after ... so i hit F5 to continue again, and again the Debug Console prints out the debugger is continuing .... but the app / screen doesnt show up/get displayed


****Here is what I see in the Debug Console in totality:

2018/01/31 23:12:36 server.go:73: Using API v1
2018/01/31 23:12:36 debugger.go:96: launching process with args: [f:\gowork\src\test\debug]
API server listening at: 127.0.0.1:2345
2018/01/31 23:12:36 debugger.go:335: created breakpoint: &api.Breakpoint{ID:1, Name:"", Addr:0x5c036b, File:"f:/gowork/src/test/test.go", Line:8, 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}
2018/01/31 23:12:36 debugger.go:492: continuing
2018/01/31 23:12:44 debugger.go:492: continuing

i'm using a terminal user interface package that i like (.github.com/rivo/tview)  my code is longer than the small demo code below, but i get the above behavior when i try to debug the code below (a tview demo example) inside VSCODE.  when i go run test.go (the demo go file) in a command prompt, a button widget appears at the top corner of the command prompt.

****  test.go  (tview demo code example)

// Demo code for the Button primitive.
package main


func main() {
app := tview.NewApplication()
button := tview.NewButton("Hit Enter to close").SetSelectedFunc(func() {
app.Stop()
})
button.SetBorder(true).SetRect(0, 0, 22, 3)
if err := app.SetRoot(button, false).SetFocus(button).Run(); err != nil {
panic(err)
}
}


*** what am i not doing correctly?  what can i do to learn more what's going on?

Daniel Jankins

unread,
Feb 9, 2023, 9:19:24 AM2/9/23
to golang-nuts
Hi,  I can not get the console app to run with the debugger.  When I start the debugger I do not get the console display only 

Starting: C:\Users\djankins\go\bin\dlv.exe dap --listen=127.0.0.1:52239 from c:\Users\djankins\Repositories\UT\adpf-simulation\GUI
DAP server listening at: 127.0.0.1:52239
Type 'dlv help' for list of commands.


Marcello H

unread,
Feb 10, 2023, 7:01:29 AM2/10/23
to golang-nuts
You could try to debug it from within VSC.

Op donderdag 9 februari 2023 om 15:19:24 UTC+1 schreef Daniel Jankins:
Reply all
Reply to author
Forward
0 new messages