Skip to content
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

cmd/ld: gdb information is wrong when using cgo #5719

Closed
gopherbot opened this issue Jun 17, 2013 · 7 comments
Closed

cmd/ld: gdb information is wrong when using cgo #5719

gopherbot opened this issue Jun 17, 2013 · 7 comments
Milestone

Comments

@gopherbot
Copy link
Contributor

by huangmipi:

What is the expected output?
Right variable's value in GDB breakpoint.

What do you see instead?
Wrong variable's value in GDB breakpoint.

Which compiler are you using (5g, 6g, 8g, gccgo)?
go build test.go

Which operating system are you using?
ubuntu 11.04 i386
gdb 7.6

Which version are you using?  (run 'go version')
go 1.1

example files:
================================
src/test.go
------------------------
package main
import (
  . "clib"
)
func main() {
  a := "123";
  b := "456";
  c := "789";
  println(a,b,c);
  Output("ABC");
}
------------------------
src/clib/clib.h
------------------------
#ifndef CLIB
void output(char* str);
#endif
------------------------
src/clib/clib.c
------------------------
#include "clib.h"
#include <stdio.h>
void output(char* str)
{
    printf("%s\n", str);
}
------------------------
src/clib/clib.go
------------------------
package clib
/*
#cgo CFLAGS:-g
#include "clib.h"
*/
import "C"
func Output(s string) {
  p := C.CString(s);
  C.output(p);
}
================================
go build -gcflags "-N -l" test.go
gdb ./test
b 10
r
info locals  // <- every variable's value is wrong!
@davecheney
Copy link
Contributor

Comment 1:

Issue #5658 has been merged into this issue.

@davecheney
Copy link
Contributor

Comment 2:

Issue #5711 has been merged into this issue.

@davecheney
Copy link
Contributor

Comment 3:

Hello,
Thank you for registering this issue. I have merged your two previous issues into this
one as I believe they are the same problem.
I understand that is it frustrating that you are blocked on your work, but please
remember that Go is an open source project and many of the people who contribute to Go
do so on a volunteer basis. 
I am marking this issue as Accepted but it will require someone who understands cgo and
gdb to investigate further. I cannot make any promises when this issue will be looked at
or resolved, but I do ask that you refrain from raising more issues about this problem
as it will not bring a resolution any sooner.
Many thanks
Dave Cheney

Status changed to Accepted.

@gopherbot
Copy link
Contributor Author

Comment 4 by huangminping@4399.com:

T_T...sad answer, GDB is a very important way to solve the bug of program, when i cant
use the GDB to debug the program, that look like say the sky is black, you nerver see
the sunshine....T_T

@rsc
Copy link
Contributor

rsc commented Jul 25, 2013

Comment 5:

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

@ianlancetaylor
Copy link
Member

Comment 6:

Owner changed to @ianlancetaylor.

Status changed to Started.

@ianlancetaylor
Copy link
Member

Comment 7:

This issue was closed by revision 28bbc6c.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants