FAQ
Hi all,

I've defined some variables in a .go file:

package main

var (
     foo uint8
     bar uint64
     test_arr [2048]uint8
)

func main() {
}

I want to use absolute address information to measure them with the XCP
protocol (XCP Protocol <http://en.wikipedia.org/wiki/XCP_%28Protocol%29>).
XCP is address orientated, it works very well with any C based binary. If
I've actived MAP or PDB file generation and found the base and relative
address information for all variables in the map file. Is it possible to
dump out the symbol table for a Go binary? Can I find the absolute address
of foo, bar and test_arr in memory at runtime?

Thanks,

         Jens

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

Search Discussions

  • Russ Cox at Sep 12, 2014 at 11:32 am

    On Fri, Sep 12, 2014 at 6:49 AM, Jens Frederich wrote:

    Hi all,

    I've defined some variables in a .go file:

    package main

    var (
    foo uint8
    bar uint64
    test_arr [2048]uint8
    )

    func main() {
    }

    I want to use absolute address information to measure them with the XCP
    protocol (XCP Protocol <http://en.wikipedia.org/wiki/XCP_%28Protocol%29>).
    XCP is address orientated, it works very well with any C based binary. If
    I've actived MAP or PDB file generation and found the base and relative
    address information for all variables in the map file. Is it possible to
    dump out the symbol table for a Go binary?
    Yes: 'go tool nm binary'.

    Can I find the absolute address of foo, bar and test_arr in memory at
    runtime?
    Yes: &

    http://play.golang.org/p/W3ZL8-5Sy1

    Russ

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jens Frederich at Sep 12, 2014 at 12:02 pm

    On Friday, September 12, 2014 1:32:27 PM UTC+2, rsc wrote:
    On Fri, Sep 12, 2014 at 6:49 AM, Jens Frederich <jfred...@gmail.com
    <javascript:>> wrote:
    Hi all,

    I've defined some variables in a .go file:

    package main

    var (
    foo uint8
    bar uint64
    test_arr [2048]uint8
    )

    func main() {
    }

    I want to use absolute address information to measure them with the XCP
    protocol (XCP Protocol <http://en.wikipedia.org/wiki/XCP_%28Protocol%29>).
    XCP is address orientated, it works very well with any C based binary. If
    I've actived MAP or PDB file generation and found the base and relative
    address information for all variables in the map file. Is it possible to
    dump out the symbol table for a Go binary?
    Yes: 'go tool nm binary'.

    Can I find the absolute address of foo, bar and test_arr in memory at
    runtime?
    Yes: &

    http://play.golang.org/p/W3ZL8-5Sy1
    That's perfect!

    Thanks,
             Jens

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jens Frederich at Sep 12, 2014 at 12:27 pm

    On Friday, September 12, 2014 1:32:27 PM UTC+2, rsc wrote:
    On Fri, Sep 12, 2014 at 6:49 AM, Jens Frederich <jfred...@gmail.com
    <javascript:>> wrote:
    Hi all,

    I've defined some variables in a .go file:

    package main

    var (
    foo uint8
    bar uint64
    test_arr [2048]uint8
    )

    func main() {
    }

    I want to use absolute address information to measure them with the XCP
    protocol (XCP Protocol <http://en.wikipedia.org/wiki/XCP_%28Protocol%29>).
    XCP is address orientated, it works very well with any C based binary. If
    I've actived MAP or PDB file generation and found the base and relative
    address information for all variables in the map file. Is it possible to
    dump out the symbol table for a Go binary?
    Yes: 'go tool nm binary'.

    Can I find the absolute address of foo, bar and test_arr in memory at
    runtime?
    Yes: &

    http://play.golang.org/p/W3ZL8-5Sy1
    Russ, are addresses fix in memory or can they change on program launch,
    like heap addresses in C?

    Thanks,
             Jens

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Ian Lance Taylor at Sep 12, 2014 at 1:27 pm

    On Fri, Sep 12, 2014 at 5:27 AM, Jens Frederich wrote:
    Russ, are addresses fix in memory or can they change on program launch, like
    heap addresses in C?
    Addresses are fixed while a program is running.

    At the moment, when using the gc compiler, addresses will be fixed at
    the time the program is built. That is, every time you run the
    program you will always get the same address. However, that will not
    necessarily always be the case in the future.

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jens Frederich at Sep 12, 2014 at 2:17 pm

    On Friday, September 12, 2014 3:27:09 PM UTC+2, Ian Lance Taylor wrote:
    On Fri, Sep 12, 2014 at 5:27 AM, Jens Frederich <jfred...@gmail.com
    <javascript:>> wrote:
    Russ, are addresses fix in memory or can they change on program launch, like
    heap addresses in C?
    Addresses are fixed while a program is running.

    At the moment, when using the gc compiler, addresses will be fixed at
    the time the program is built. That is, every time you run the
    program you will always get the same address. However, that will not
    necessarily always be the case in the future.

    Ian
    Thanks, good to know.


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 12, '14 at 10:49a
activeSep 12, '14 at 2:17p
posts6
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase