Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Moduledata and Type Version Parsing #55

Open
stevemk14ebr opened this issue May 13, 2024 · 2 comments
Open

Refactor Moduledata and Type Version Parsing #55

stevemk14ebr opened this issue May 13, 2024 · 2 comments
Labels

Comments

@stevemk14ebr
Copy link
Collaborator

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.

switch version {

switch runtimeVersion {

@brigadier-general
Copy link
Collaborator

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?

@stevemk14ebr
Copy link
Collaborator Author

stevemk14ebr commented May 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants