Repository navigation
Conversation
| custom_types::logger.critical("HasParentUnsafe return: {}", ret); | ||
| if (filterClass) { | ||
| custom_types::logger.critical("Attempting HasParentUnsafe({}, {})...", fmt::ptr(GET_CLASS(val)), fmt::ptr(filterClass)); | ||
| auto ret = HasParentUnsafe(GET_CLASS(val), filterClass); |
There was a problem hiding this comment.
Iirc, there were two reasons for this.
- We want to still print even when filter class was null
- Calling with a null filter class would behave the same as what hasparentunsafe did, that is, if this function was already called with a null filter class, then it would crash in the same place if there were no checks inside the logic of hasparentunsafe
| // specifically, val is a pointer to: 39D0 before obj | ||
| // Offset of filter class | ||
| auto filterClass = *reinterpret_cast<Il2CppClass**>(reinterpret_cast<uintptr_t>(state) + 0x10); | ||
| auto filterClass = *reinterpret_cast<Il2CppClass**>(reinterpret_cast<uintptr_t>(state) + 0x08); |
There was a problem hiding this comment.
Can we swap this to the actual state structure from the il2cpp headers? I think that'll make it work more cleanly and across different versions of unity too.
There was a problem hiding this comment.
The struct is in a .cpp, we dont have access
There was a problem hiding this comment.
I've discussed this before with you. Just copy the struct and use it :I
There was a problem hiding this comment.
No, we shouldn't copy it here since that'll effectively be the same issue as the hard coded offset, but it'll be better than the hard coded offset, so we can do that if there's too much garbage in the cpp to include it directly.
I think we can try getting pieces of this structure out, but that's probably out of scope. I'm mostly worried about support for different unity versions. Can we guard this with the unity_* defines to one or the other?
There was a problem hiding this comment.
I think the struct would make the easier far easier to resolve in future versions instead of offset math that we can easily get wrong.
There was a problem hiding this comment.
No, we shouldn't copy it here since that'll effectively be the same issue as the hard coded offset, but it'll be better than the hard coded offset, so we can do that if there's too much garbage in the cpp to include it directly.
I think we can try getting pieces of this structure out, but that's probably out of scope. I'm mostly worried about support for different unity versions. Can we guard this with the unity_* defines to one or the other?
We can but so far i observed same offset on unity2022 & 6
| // specifically, val is a pointer to: 39D0 before obj | ||
| // Offset of filter class | ||
| auto filterClass = *reinterpret_cast<Il2CppClass**>(reinterpret_cast<uintptr_t>(state) + 0x10); | ||
| auto filterClass = *reinterpret_cast<Il2CppClass**>(reinterpret_cast<uintptr_t>(state) + 0x08); |
There was a problem hiding this comment.
I've discussed this before with you. Just copy the struct and use it :I
We do this by forcibly including the il2cpp source directly. This required some hackiness to get around the bs-hook typedefs.h issues, but ultimately this should be an improvement, since that source is relatively stable across Unity updates so far. This should also help prevent many of spurious liveness issues that were plaguing people in the past. Atomic logic and HasParentUnsafe logic taken from: #24
We do this by forcibly including the il2cpp source directly. This required some hackiness to get around the bs-hook typedefs.h issues, but ultimately this should be an improvement, since that source is relatively stable across Unity updates so far. This should also help prevent many of spurious liveness issues that were plaguing people in the past. Atomic logic and HasParentUnsafe logic taken from: #24
We do this by forcibly including the il2cpp source directly. This required some hackiness to get around the bs-hook typedefs.h issues, but ultimately this should be an improvement, since that source is relatively stable across Unity updates so far. This should also help prevent many of spurious liveness issues that were plaguing people in the past. Atomic logic and HasParentUnsafe logic taken from: #24
We do this by forcibly including the il2cpp source directly. This required some hackiness to get around the bs-hook typedefs.h issues, but ultimately this should be an improvement, since that source is relatively stable across Unity updates so far. This should also help prevent many of spurious liveness issues that were plaguing people in the past. Atomic logic and HasParentUnsafe logic taken from: #24
|
Resolved in: #26 |
Fix wrong offset for reading filterClass on liveness log
Evidence from Unity6 Editor/Data/il2cpp/libil2cpp/vm/Liveness.cpp:45.
