-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[mono] Make mono_inst_name less misleading #83545
Copy link
Copy link
Closed
Labels
area-VM-meta-monogood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Metadata
Metadata
Assignees
Labels
area-VM-meta-monogood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently
mono_inst_nameis defined like this:The problem is that when logging is disabled, this function is uncallable (the
#elsebranch, above). Any call to it will crash the runtime.On Android, iOS and WASM we build the runtime with
DISABLE_LOGGINGdefined. Below is Android, but wasm and ios are similar:Why this is bad:
If someone incorrectly leaves in a call to
mono_inst_namein a branch that isn't guarded by#ifndef DISABLE_LOGGING, the runtime will crash. We tend to usemono_inst_namein code that is trying to provide additional diagnostics. So something bad has already happened, we try to gather more info, and instead we crash the runtime.What we should do instead:
Wrap both the declaration and definition of
mono_inst_namein#ifndef DISABLE_LOGGING. Turn any use ofmono_inst_namethat isn't protected by#ifndef DISABLE_LOGGINGinto a compile-time error that will fail to build the runtime.That way, we don't get random crashes during unrelated investigations just because we called some diagnostic functionality