FAQ
Greetings gophers,

I'm having trouble running GDB on a go binary (output pasted below). Here
are the best explanations I can come up with:

1) GDB needs updating. I find this unlikely -- the docs say GDB 7.x is
fine, but a stackoverflow comment implied that I actually need 7.5
2) My environment variables aren't set properly. I have GOPATH=~/go, but I
don't have a GOROOT. I don't know if this matters...

Any thoughts appreciated. Thanks!

mori@tek:~/go/src/github.com/nchoosek/hello$ go build hello.go
mori@tek:~/go/src/github.com/nchoosek/hello$ gdb hello -d /usr/local/go
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from
/home/mori/go/src/github.com/nchoosek/hello/hello...done.
Loading Go Runtime support.
(gdb) l
6 MOVL 8(SP), AX
7 LEAL 12(SP), BX
8 MOVL AX, 0(SP)
9 MOVL BX, 4(SP)
10 CALL runtime·linux_setup_vdso(SB)
11 CALL main(SB)
12 INT $3
13
14 TEXT main(SB),7,$0
15 JMP _rt0_386(SB)
(gdb)

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Kyle Lemons at Jun 24, 2013 at 11:36 pm
    What are you expecting to see instead? Have you tried setting and running
    to a breakpoint?

    On Mon, Jun 24, 2013 at 11:21 AM, wrote:

    Greetings gophers,

    I'm having trouble running GDB on a go binary (output pasted below). Here
    are the best explanations I can come up with:

    1) GDB needs updating. I find this unlikely -- the docs say GDB 7.x is
    fine, but a stackoverflow comment implied that I actually need 7.5
    2) My environment variables aren't set properly. I have GOPATH=~/go, but I
    don't have a GOROOT. I don't know if this matters...

    Any thoughts appreciated. Thanks!

    mori@tek:~/go/src/github.com/nchoosek/hello$ go build hello.go
    mori@tek:~/go/src/github.com/nchoosek/hello$ gdb hello -d /usr/local/go
    GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <
    http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu".
    For bug reporting instructions, please see:
    <http://bugs.launchpad.net/gdb-linaro/>...
    Reading symbols from /home/mori/go/src/
    github.com/nchoosek/hello/hello...done.
    Loading Go Runtime support.
    (gdb) l
    6 MOVL 8(SP), AX
    7 LEAL 12(SP), BX
    8 MOVL AX, 0(SP)
    9 MOVL BX, 4(SP)
    10 CALL runtime·linux_setup_vdso(SB)
    11 CALL main(SB)
    12 INT $3
    13
    14 TEXT main(SB),7,$0
    15 JMP _rt0_386(SB)
    (gdb)

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Mori Bellamy at Jun 24, 2013 at 11:46 pm
    D'oh. I had, but I had just done "b main" rather than "b main.main". The
    former took me to something confusing and low-level, but the latter does
    what I want.

    Sorry for the noise, thanks!

    On Mon, Jun 24, 2013 at 4:35 PM, Kyle Lemons wrote:

    What are you expecting to see instead? Have you tried setting and running
    to a breakpoint?

    On Mon, Jun 24, 2013 at 11:21 AM, wrote:

    Greetings gophers,

    I'm having trouble running GDB on a go binary (output pasted below). Here
    are the best explanations I can come up with:

    1) GDB needs updating. I find this unlikely -- the docs say GDB 7.x is
    fine, but a stackoverflow comment implied that I actually need 7.5
    2) My environment variables aren't set properly. I have GOPATH=~/go, but
    I don't have a GOROOT. I don't know if this matters...

    Any thoughts appreciated. Thanks!

    mori@tek:~/go/src/github.com/nchoosek/hello$ go build hello.go
    mori@tek:~/go/src/github.com/nchoosek/hello$ gdb hello -d /usr/local/go
    GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <
    http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu".
    For bug reporting instructions, please see:
    <http://bugs.launchpad.net/gdb-linaro/>...
    Reading symbols from /home/mori/go/src/
    github.com/nchoosek/hello/hello...done.
    Loading Go Runtime support.
    (gdb) l
    6 MOVL 8(SP), AX
    7 LEAL 12(SP), BX
    8 MOVL AX, 0(SP)
    9 MOVL BX, 4(SP)
    10 CALL runtime·linux_setup_vdso(SB)
    11 CALL main(SB)
    12 INT $3
    13
    14 TEXT main(SB),7,$0
    15 JMP _rt0_386(SB)
    (gdb)

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Thanks,
    Mori Bellamy

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Jun 25, 2013 at 12:20 am
    yup, b main breaks at a point very early on in the runtime
    initialization, which is actually written in asm, you'll find it in
    $GOROOT/src/pkg/runtime/rt0_$GOOS_$GOARCH.s.

    As Kyle said, you want b main.main.

    On Tue, Jun 25, 2013 at 9:46 AM, Mori Bellamy
    wrote:
    D'oh. I had, but I had just done "b main" rather than "b main.main". The
    former took me to something confusing and low-level, but the latter does
    what I want.

    Sorry for the noise, thanks!

    On Mon, Jun 24, 2013 at 4:35 PM, Kyle Lemons wrote:

    What are you expecting to see instead? Have you tried setting and running
    to a breakpoint?

    On Mon, Jun 24, 2013 at 11:21 AM, wrote:

    Greetings gophers,

    I'm having trouble running GDB on a go binary (output pasted below). Here
    are the best explanations I can come up with:

    1) GDB needs updating. I find this unlikely -- the docs say GDB 7.x is
    fine, but a stackoverflow comment implied that I actually need 7.5
    2) My environment variables aren't set properly. I have GOPATH=~/go, but
    I don't have a GOROOT. I don't know if this matters...

    Any thoughts appreciated. Thanks!

    mori@tek:~/go/src/github.com/nchoosek/hello$ go build hello.go
    mori@tek:~/go/src/github.com/nchoosek/hello$ gdb hello -d /usr/local/go
    GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show
    copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu".
    For bug reporting instructions, please see:
    <http://bugs.launchpad.net/gdb-linaro/>...
    Reading symbols from
    /home/mori/go/src/github.com/nchoosek/hello/hello...done.
    Loading Go Runtime support.
    (gdb) l
    6 MOVL 8(SP), AX
    7 LEAL 12(SP), BX
    8 MOVL AX, 0(SP)
    9 MOVL BX, 4(SP)
    10 CALL runtime·linux_setup_vdso(SB)
    11 CALL main(SB)
    12 INT $3
    13
    14 TEXT main(SB),7,$0
    15 JMP _rt0_386(SB)
    (gdb)

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    Thanks,
    Mori Bellamy

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 24, '13 at 11:19p
activeJun 25, '13 at 12:20a
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase