Re: [go-nuts] Getting a function's linked address?

2020-01-15 Thread Julio Guerra
For the record, I could do what I needed using the `//go:linkname` directive. My instrumentation tool injects statements that need features from another package that I cannot import. So I forward declare functions using a given link name that is implemented in another package - similarly to

[go-nuts] Re: How to print an AST without formatting?

2020-01-09 Thread Julio Guerra
I saw `go tool cover` does it, but I don't see anything else but a simple call to printer.Fprint(w, f.fset, f.astFile) at https://github.com/golang/tools/blob/master/cmd/cover/cover.go#L384 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] How to print an AST without formatting?

2020-01-09 Thread julio
Hello, I am looking for a way to keep to original token positioning but I cannot find how to avoid it when using `go/printer` or `go/format`. Basically, how to make this example print the same string that was parsed: https://play.golang.org/p/dI7WcevQJAZ Thanks for your help! Julio -- You

[go-nuts] Re: Enforcing a type name rather than a variable name

2020-01-03 Thread julio
By the way, here is the function having this in package `net`: https://golang.org/src/net/lookup.go#L81 -- 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

[go-nuts] Enforcing a type name rather than a variable name

2020-01-03 Thread julio
Hello, Is there any way to avoid the compilation error "*error is not a type" of this example https://play.golang.org/p/gWNStGSCfTm ? I understand the variable named `error` hides the type named `error` but is there some other syntax to specify the error type? I am facing this issue while

Re: [go-nuts] Assigning a value to a function pointer

2019-12-23 Thread julio
> > But I cannot find any way of assigning a value to the function pointer > `f` even using the `unsafe` package. > > https://play.golang.org/p/qP5kuSCW6dO > Thanks, unfortunately the asm shows that what gets into `f` is the stack address of `f0` and not the address of the function: LEAQ

[go-nuts] Assigning a value to a function pointer

2019-12-23 Thread julio
using instead `*interface{}` (that I can atomically load + type-assert + call). Thanks for your help, Julio -- 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

Re: [go-nuts] Getting a function's linked address?

2019-10-31 Thread julio . nemesis
> > You can create a lookup table at run time. What would change if you > could do it at link time? Can you show us the code you want to write? > This is actually linked to my remark on build-time source instrumentation on https://github.com/golang/go/issues/35204 : I insert hooks into

Re: [go-nuts] Getting a function's linked address?

2019-10-30 Thread julio . nemesis
I was meaning an equivalent to declaring an extern function using the same name as the symbol we want. The function address will be the linked symbol address. I indeed use the reflect package today, but this happen at run time while I would like to get those values at link time. I'd like to

[go-nuts] Getting a function's linked address?

2019-10-29 Thread julio . nemesis
Hello, I am wondering if it is possible to get the address of a function but at link-time. Kind of the equivalent to the C keyword `extern`. Maybe using the link name directive? But it is not super clear to me. I would like to get them instead at link time instead of using the gosymtab. Thank

[go-nuts] Distributing Go bindings: Go plugin vs Go archive vs Go shared package

2019-09-10 Thread julio
the resulting Go package archive in the repo, and simply use some go CLI option in order to use the correct archive for the target GOOS/GOARCH? I couldn't find out how to pass such option to the go compiler so far, so I was hoping for some help. Thanks for your help, Julio -- You received this message

[go-nuts] How to safely convert a pointer to *unsafe.Pointer

2019-07-19 Thread julio
which performs two atomic operations and possible disable preemption ( https://golang.org/src/sync/atomic/value.go?s=1233:1269#L35). Thanks for your help, Julio -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] [RFC] Dynamically instrumentation Go binaries

2018-11-19 Thread Julio Guerra
wice slower. So it may be a very good solution for a first linux-only version, as I don't need return probes (uretprobes seem to be a problem with Go's dynamic stack management). -- Julio Guerra -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] [RFC] Dynamically instrumentation Go binaries

2018-11-19 Thread Julio Guerra
t doesn't use any plugin interface :( -- Julio Guerra -- 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+unsubscr...@googlegroups.com. For

Re: [go-nuts] Re: [RFC] Dynamically instrumentation Go binaries

2018-11-19 Thread Julio Guerra
ikely the best option for performance and to avoid code relocation at run time... Unfortunately, the go toolchain currently doesn't have any "plugin" interface to add extra compilation stages. -- Julio Guerra -- You received this message because you are subscribed to the Google Groups &quo

[go-nuts] [RFC] Dynamically instrumentation Go binaries

2018-11-15 Thread julio
, which is linux-specific. And at the opposite, there are user-space binary code instrumentation libraries such as dyninst that modify the code at run time... So I am wondering if anyone here has any thoughts on this subject, that doesn't seem to be solved for Go programs. Thanks! Julio

Re: [go-nuts] Is it safe to invoke len(channel) on multi-gorountine

2017-06-17 Thread julio . nemesis
I almost got into the trap with this, trying to prioritize selected channel... https://play.golang.org/p/VOrPwx7HC_ -- 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