Giter Site home page Giter Site logo

Comments (18)

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

Compiling with optimizations disabled might improve things. From http://golang.org/doc/gdb :

These optimizations can sometimes make debugging with gdb harder. To disable them when debugging, pass the flags -gcflags "-N -l" to the go command used to build the code being debugged.

Unfortunately there is no way yet to add this extra options to the Go build performed from Eclipse. (I want to get that done for the next release). You can try building the executable from the command-line, and then debugging it from Eclipse (place the executable somewhere in the GoClipse project, then right-click and do "Debug As").

Also, what is your platform? Is it Windows? That could be another problem because debug output support in Windows seems buggier than in Linux (this is a problem with the Go toolchain itself, not GoClipse)

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

Also, what is the full output of the gdb console in Eclipse? (not the gdb traces console)

from goclipse.

panmari avatar panmari commented on May 28, 2024

Unfortunately there is no way yet to add this extra options to the Go build performed from Eclipse. (I want to get that done for the next release). You can try building the executable from the command-line, and then debugging it from Eclipse (place the executable somewhere in the GoClipse project, then right-click and do "Debug As").

Just tried that after compiling it with -gcflags "-N -l" y hand, did not change the result. For testing I replaced the existing bin/main executable before debugging (it was not compiled newly before debugging, I checked with md5sum)

Also, what is your platform?

I'm on Linux x64

Also, what is the full output of the gdb console in Eclipse?

warning: Missing auto-load scripts referenced in section .debug_gdb_scripts
of file /home/panmari/go_workspace/gort/bin/main
Use `info auto-load python-scripts [REGEXP]' to list them.
The target endianness is set automatically (currently little endian)

from goclipse.

panmari avatar panmari commented on May 28, 2024

And if I list the python-scripts

info auto-load python-scripts
Loaded  Script                                                                 
No      /usr/local/go/src/pkg/runtime/runtime-gdb.py 

from goclipse.

panmari avatar panmari commented on May 28, 2024

On the golang gdb page they state

To help GDB find the Go runtime sources and the accompanying support script, pass your $GOROOT with the '-d' flag

Can I add such arguments in Debug Configuration > Debugger > GDB Debugger ? Doesn't seem to work for me, though.

By making a symlink from /usr/local/go to /opt/go and adding

 add-auto-load-safe-path /

to the .gdbinit in the project home, I could get rid of the error in gdb. It now says

Loading Go Runtime support.
The target endianness is set automatically (currently little endian)

But the issue mentioned in the initial comment still remains.

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

I was about to point you to the thread detailing how to deal with loading the Go debugging runtime ( https://groups.google.com/forum/#!topic/goclipse/ce8vJn3KU9s ) but it seems you got there already.

If the initial problems remains, I need more info. Can you post a minimal Go source that reproduces the problem? Also, what is your GDB version?

from goclipse.

panmari avatar panmari commented on May 28, 2024

Hmmm, I'll try to find one.
I'm using the default gdb from the repositories of Ubuntu 14.04:

GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7

from goclipse.

panmari avatar panmari commented on May 28, 2024

Even this little example

package main

import (
    "fmt"
)

func main() {
    a := "Test"
    fmt.Println(a)
}

Can not show debugging informations when stoped on fmt.Println(a), see screenshot attached:
golang_debugger_simple_debug_flags
I used golang 1.3.1, gdb 7.7, eclipse luna for generating this. I compiled the binary through the console with debugging flags (-gcflags "-N -l") and made sure gdb had go runtim support using the configuration mentioned above.

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

Can you try again the example above with the latest Goclipse (0.8.1) ? If the problem persists, please attach the full contents of the "gdb traces" console, and the normal "gdb" console. (You can use https://gist.github.com/ to upload attachments)

from goclipse.

panmari avatar panmari commented on May 28, 2024

Nope, still the same behavior. See gdb output

https://gist.github.com/panmari/aecbc7395b77d4095f8f

and gdb traces

https://gist.github.com/panmari/bad22281ed0b31beb68c

from goclipse.

csterryliu avatar csterryliu commented on May 28, 2024

I also have the same issue. My platform is Windows 7 64-bit. The problem is I get weird values in the Variable window. I cannot do debugging in the situation like this. Please help.
I use the latest version of Goclipse. IDE is Eclipse Luna. GDB version 7.8 (64-bit). And GO language (64-bit).

image

from goclipse.

sunshineo avatar sunshineo commented on May 28, 2024

I am on Mac and GDB 7.8
A lot of variables shows up empty
screen shot 2014-10-17 at 2 56 48 am

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

@csterryliu I'm afraid variable inspection doesn't work on Windows. This is a limitation of the Go toolchain, not Goclipse. I've added that info the UserGuide though.

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

@sunshineo That looks like it might be a different issue. Please take a look at
https://github.com/GoClipse/goclipse/blob/latest/documentation/ReportIssue.md#debugger-issues and if the problem persists open a new issue.

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

@panmari I just tried that basic hello world with a local variable in Lubuntu, with the command-line GDB, and the display of local vars didn't work either... They either are missing or show garbage values. So, this seems to indicate it's a go toolchain problem. I'd like to investigate this further though, check in with the Go user group.

from goclipse.

lopperma avatar lopperma commented on May 28, 2024

@bruno-medeiros the faulty display of variables is also mentioned here: https://code.google.com/p/go/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Stars%20Release%20Owner%20Repo%20Summary&groupby=&sort=&id=8256

I'm having the same issue on Mac. Basically, debugging seems to generally broken in a way that is not GoClipse related.

I'll check how far I get with a gccgo based build...

from goclipse.

bruno-medeiros avatar bruno-medeiros commented on May 28, 2024

The Go issue is now at: golang/go#8256
We'll keep an eye on that issue to see if the debugging situation improves.
In the meanwhile, if someone could experiment with gccgo to see if the debug support there is better, that would be helpful.

from goclipse.

lopperma avatar lopperma commented on May 28, 2024

I've had quite a hard time getting the full toolchain to work with gccgo on Mac. I've gotten to a point where the compiler seems to work but I still don't get all dependencies/packages of projects to be linked correctly. I'll keep trying it a bit more but I cannot currently allocate a lot of time to this effort...

from goclipse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.