recommendations please: go source level debugger for linux

163 views
Skip to first unread message

Pat Farrell

unread,
Feb 2, 2023, 9:50:56 PM2/2/23
to golang-nuts
I've been using PMD to debug my go code since I started.
(PMD => Poor Man's Debugger, i.e fmt.Printf statements)
and it was OK for my initial simple stuff. But as I am writing
more complex code, I think its time to find a nice source level debugger.

Any recommendations?
I guess I could use an IDE if that it popular, I'm kinda old
school and just use vim

Thanks
Pat

Kurtis Rader

unread,
Feb 2, 2023, 10:26:24 PM2/2/23
to Pat Farrell, golang-nuts
FWIW, I still use the Poor Man's Debugger most of the time to understand the behavior of running programs where I can afford to iterate while trying to understand a problem. Having said that I do regularly use an actual debugger to examine core dumps (both user space and from a Unix operating system panic). I simply find using a debugger less efficient on "live" programs where I can afford to run the program multiple times.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5f9a909c-ef29-4669-b1bd-b2dd941f03f2n%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Ian Lance Taylor

unread,
Feb 2, 2023, 10:49:40 PM2/2/23
to Pat Farrell, golang-nuts
On Thu, Feb 2, 2023 at 6:51 PM Pat Farrell <pat2...@gmail.com> wrote:
>
Have you tried Delve? https://github.com/go-delve/delve

Ian

Pat Farrell

unread,
Feb 4, 2023, 8:09:58 PM2/4/23
to golang-nuts
On Thursday, February 2, 2023 at 10:49:40 PM UTC-5 Ian Lance Taylor wrote:
Have you tried Delve? https://github.com/go-delve/delve

Thanks I will check into it.
One point about go and PMD, because the compile time is so fast, using PMD is not nearly as painful as it
would be in other languages that have long compile/link times. I know this was one of the design
goals way back when go was invented. Sure is neat. 

I've recently discovered how handy it is to stick a "panic()" into the code, giving me a very nice stack trace
that has come in handy.

Jason E. Aten

unread,
Feb 7, 2023, 9:25:32 PM2/7/23
to golang-nuts
https://github.com/glycerine/vprint  shows you how to get 
source file and line numbers (and timestamps) automatically 
in your PMD print statements. 

For examples, I use vv() or VV() for unconditional prints, and pp() or PP() for condition prints that only print if Verbose is true.  Debuggers are 100x slower; combining vprint's approach with debug.Stack() calls and an editor that understands stack traces (e.g. emacs)... makes for rapid debugging.
Reply all
Reply to author
Forward
0 new messages