New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: TestGdbPythonCgo fails with the gold linker #26868
Comments
I had forgotten to include the |
It doesn't make sense to me, but I guess the scripts section is getting compressed. Does .zdebug_gdb_scripts exist? If so that's surprising, since the linker won't compress a section unless it gets smaller, and I've never seen the script path be compressible enough. But maybe your home directory path is the first. If GDB doesn't decompress this it's simple enough to keep it uncompressed. |
@heschik you're right - on Go master,
|
Oh, right, cgo, so external linker, so it's gcc/ld that's doing the compression. I think this is a bug/misfeature in the version of ld you're using. My version of ld (2.30, possibly with patches) doesn't compress .debug_gdb_scripts. What are you using? I can't think of any workaround for this other than figuring out which versions of ld behave this way and not passing --compress-debug-sections to them. We could ask for gdb to understand it. But really I'd expect most people to be using Delve at this point. |
I see. I simply raised this issue as there was a runtime test not passing. Perhaps the test can be skipped if people are using the same linker that I am, to avoid the failures we can't really fix.
|
@ianlancetaylor -- should we check for gold in this test and skip? |
It sounds like a bug that gold might compress that section. Filed https://sourceware.org/bugzilla/show_bug.cgi?id=23495 . For test purposes can we just check for an uncompress .debug_gdb_scripts section? |
Thanks Ian, that makes sense. I've retitled the bug. I have a temporary fix stashed on git which should do the job on the cgo test - using |
Change https://golang.org/cl/128815 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No - all seems fine on Go 1.10.3. Hence this is a potential regression.
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
A
PASS
.What did you see instead?
I investigated for a while, and I think I know the reason for the failure. Please keep in mind that my understanding of gdb and ELF binaries is limited, so I might be wrong.
I first noted that adding a line to the test to manually load
runtime-gdb.py
made the test pass, so it seemed like the file wasn't being automatically loaded:Then, from reading the python file:
Note that
TestGdbPythonCgo
fails, butTestGdbPython
succeeds. So I wondered if a cgo binary was missing this section. On Go 1.10, both binaries have the section:However, on master, the cgo binary is lacking the section:
Am I missing something obvious here, or misunderstanding how all this works?
@ianlancetaylor any help or pointers appreciated. Since this is very likely a linker fix, I'll leave the CL (if any) to someone else.
The text was updated successfully, but these errors were encountered: