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

gdb: 'next' command confused by cgo calls #6346

Open
gopherbot opened this issue Sep 9, 2013 · 8 comments

Comments

@gopherbot
Copy link

commented Sep 9, 2013

by kaoshi.juan82:

What steps will reproduce the problem?
write these code:
package main

//#include <stdio.h>
/*
void Print(int i){
        printf("result:%d\n",i);
}
*/
import "C"


func A() {
        a := 1
        b := 2
        c := 4
        C.Print((C.int)(a+b+c))
}

func main() {
        a := 1
        b := 2
        c := 3
        A()   //gdb n command will step into this function
        C.Print((C.int)(a+b+c))
}

What is the expected output?
if you press n at the line function call of A() while debugging, you should step over
the function call

What do you see instead?
instead, you step into the function.

Which compiler are you using (5g, 6g, 8g, gccgo)?
compiler is gcc (cgo) + 6g, 


Which operating system are you using?
under centos x86_64, gdb 7.4, and gcc 4.1.2

Which version are you using?  (run 'go version')
go 1.1.2
@gopherbot

This comment has been minimized.

Copy link
Author

commented Sep 9, 2013

Comment 1 by kaoshi.juan82:

https://groups.google.com/forum/#!topic/golang-nuts/QElJJv3vJnY
also discussed on golang-nuts
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2013

Comment 2:

Does the behaviour change if you compile with the -l option?  See
http://golang.org/doc/gdb .
@gopherbot

This comment has been minimized.

Copy link
Author

commented Sep 12, 2013

Comment 3 by kaoshi.juan82:

yes, the -N -l flags does not help.
@gopherbot

This comment has been minimized.

Copy link
Author

commented Sep 12, 2013

Comment 4 by kaoshi.juan82:

the -N -l flag does not help and it still step into functions
@rsc

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2013

Comment 5:

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

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 6:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 7:

Labels changed: added repo-main.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Mar 5, 2014

Comment 8:

Labels changed: added gdb.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.