Re: [go-nuts] user process instruction pointer symbol lookup

2024-06-20 Thread Massimiliano Giovagnoli
Thank you all. I was looking at the same goal, having collected stack traces from eBPF helper with IPs. With debug/elf I've been able to resolve symbols for the use cases I tested, thank you Ian. In example the right symbol is the one that satisfy ip >= sym.Value && ip < (sym.Value+sym.Size) (

[go-nuts] VS Code debugger running on Beaglebone Black

2024-06-20 Thread Daniel Jankins
HI, I am running VS code with Remote-SSH connected to Beaglebone black. Writing and compiling code is not a problem. Up to now I have been debugging with print statements. I would like to use the VS code debugger. It looks like the Delve debugger does not support armv7l. Does anybody know how to

[go-nuts] Re: Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread tapi...@gmail.com
see: https://github.com/golang/go/issues/65878 package main var a, b [0]int var p, q = &a, &b func main() { if (p == q) { p, q = &a, &b println(p == q) // false } } On Thursday, June 20, 2024 at 12:59:43 AM UTC+8 Oliver Eikemeier wrote: > I'm observing some strange behavior and could use some

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread 'Axel Wagner' via golang-nuts
I want to re-emphasise that both of these examples violate the allowed usages of unsafe.Pointer defined by gc. So I would argue that, yes, its expectation is reasonable, because it explicitly told you not to create this situation. If you can construct a program that does not violate the unsafe.Poi

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Oliver Eikemeier
> Am 20.06.2024 um 14:12 schrieb Axel Wagner : > > On Thu, 20 Jun 2024 at 13:48, Oliver Eikemeier > wrote: > > I think you should acknowledge that the spec *is* already trying to be very > clear about this. The fact that you can poke holes in it is because

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Robert Engels
What I asked did not require the first, I was referring more about the latter. So regardless of how it is implemented it is always false. On Jun 20, 2024, at 7:39 AM, Axel Wagner wrote:On Thu, 20 Jun 2024 at 14:21, Robert Engels wrote:I would add that I think the Go team s

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread 'Axel Wagner' via golang-nuts
FYI, filed https://github.com/golang/go/issues/68086 for the spec-hole that conversions between unsafe.Pointer and other pointer types are not implementation defined. On Thu, 20 Jun 2024 at 14:12, Axel Wagner wrote: > > > On Thu, 20 Jun 2024 at 13:48, Oliver Eikemeier < > eikeme...@fillmore-labs

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Robert Engels
I would add that I think the Go team should strive to remove as much “implementation defined” or “undefined” from the spec as possible. Forgo the optimizations. It’s this language that makes C++ such a pain to work with especially in a cross platform manner. I think you can safely narrow the spec i

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread 'Axel Wagner' via golang-nuts
On Thu, 20 Jun 2024 at 13:48, Oliver Eikemeier wrote: > > Am 20.06.2024 um 13:24 schrieb Axel Wagner >: > > We can see that 1. `unsafe.Pointer` is definitionally a pointer type, 2. > in your example, the two `unsafe.Pointers` do not point to the same > variable and do not have the value `nil` an

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Oliver Eikemeier
> Am 20.06.2024 um 13:24 schrieb Axel Wagner : > > We can see that 1. `unsafe.Pointer` is definitionally a pointer type, 2. in > your example, the two `unsafe.Pointers` do not point to the same variable and > do not have the value `nil` and 3. are not pointing at distinct zero-sized > variable

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 1:26 PM 'Axel Wagner' via golang-nuts wrote: > (apologies for the abundance of grammatical and spelling errors that occurred > during editing and of course only became visible after hitting "send") (Send collapses the wave function ;-) -- You received this message bec

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread 'Axel Wagner' via golang-nuts
(apologies for the abundance of grammatical and spelling errors that occurred during editing and of course only became visible after hitting "send") On Thu, 20 Jun 2024 at 13:24, Axel Wagner wrote: > On Thu, 20 Jun 2024 at 12:28, Oliver Eikemeier < > eikeme...@fillmore-labs.com> wrote: > >> Let

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 1:16 PM Oliver Eikemeier wrote: > • Pointer types are comparable. Two pointer values are equal if they point to > the same variable or if both have value nil. Pointers to distinct zero-size > variables may or may not be equal. Compare to (made up) "NaNs always compare n

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread 'Axel Wagner' via golang-nuts
On Thu, 20 Jun 2024 at 12:28, Oliver Eikemeier wrote: > Let me start with this: I’m fine with the behavior, it is exotic enough > that even the optimizer should be allowed to assume something that doesn’t > hold during runtime, since it simplifies things. > > What I think is at least surprising a

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Oliver Eikemeier
https://go.dev/ref/spec#Comparison_operators • Pointer types are comparable. Two pointer values are equal if they point to the same variable or if both have value nil. Pointers to distinct zero-size variables may or may not be equal. Another example (Go Playground

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 12:28 PM Oliver Eikemeier wrote: > It mentions “pointers” (plural) to zero-sized variables, but for this > behavior it is sufficient when only one pointer derives from a pointer to a > zero-sized variable, as demonstrated in the example below. The plural is there becaus

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Oliver Eikemeier
Let me start with this: I’m fine with the behavior, it is exotic enough that even the optimizer should be allowed to assume something that doesn’t hold during runtime, since it simplifies things. What I think is at least surprising and at worst lacking is the documentation. It mentions “pointer