-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
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!