First off, we are always happy to have new users in the group. But one more bit of etiquette - Please don't post screenshots of text. Instead copy paste the text into the message. I like to use fixed width font, or put it in a code block. See the recent discussion at https://groups.google.com/d/topic/golang-nuts/KR_JXhBWCk8/discussion for the many reasons why.
Looking at the screenshot, I see that you are trying to debug into a runtime library function. That is why it is optimized. IIRC, the way you have built will only build main.go without optimization, but it will not effect the standard libraries. I think you want something like *go build -o main -gcflags "all=-N -l" main.go *. The "all=" is the key here. Good luck On Friday, March 15, 2019 at 3:26:28 AM UTC-4, mount...@gmail.com wrote: > > > > 在 2019年3月15日星期五 UTC+8上午12:49:51,Jake Montgomery写道: >> >> First off. Please don't use a giant font in this group. It adds no >> valuable information, and makes it seem like you are yelling at the reader. >> >> I use delve <https://github.com/go-delve/delve> not gdb, so I can not >> speak directly to that. I use -gcflags="-N -l", and so far it has always >> produced a reasonably debuggable (with delve >> <https://github.com/go-delve/delve> at least) executable. >> >> Your question is probably too vague to answer though. What, specifically, >> are you experiencing as being "optimized out"? If you provided code for a >> small sample program, and told us what you actually see, and what you >> expect to see, you would have a better chance of a useful response. >> >> >> On Thursday, March 14, 2019 at 12:03:50 AM UTC-4, mount...@gmail.com >> wrote: >>> >>> >>> Very strange, when I compile with go build -o main -gcflags "-N -l" >>> main.go, it appears optimized out when debugging with gdb. >>> >>> Who knows why? >>> >>> -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.