You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The logic to parse the moduledata and types is split by version as the underlying structures change every few versions. Originally this was done by creating a Go structure for each version and the marshalling the raw bytes into the appropriate structure by version. Over time this has gotten quite hard to maintain. Refactor this logic, consider if a generic function can be written somehow to avoid the duplicative switch statements.
Potential lead -- "The Go runtime essentially just creates pointers with Go structure types to read the data when it is needed, removing the need for any decoding/unmarshalling." via discussion on pclntab (https://github.com/elastic/otel-profiling-agent/blob/main/docs/gopclntab.md) Maybe a method similar to how loaded PE files get their FirstThunk and OriginalFirstThunks filled out?
I think that's probably a much easier to maintain approach. If you move forward with this consider making some const global offsets into the structures named by the field they access so it's clear to see what's being accessed through any pointer math.
The logic to parse the moduledata and types is split by version as the underlying structures change every few versions. Originally this was done by creating a Go structure for each version and the marshalling the raw bytes into the appropriate structure by version. Over time this has gotten quite hard to maintain. Refactor this logic, consider if a generic function can be written somehow to avoid the duplicative switch statements.
GoReSym/objfile/objfile.go
Line 297 in cc91ae7
GoReSym/objfile/objfile.go
Line 1176 in cc91ae7
The text was updated successfully, but these errors were encountered: