When logging memory reads/writes, make sure we are inside an event action

Should always be the case, but this way we guard against crashes due to
insufficient instrumentation coverage and/or upstream introduced changes, which
cause the said insufficient instrumentation coverage.
Handle writes of function literals and functon declarations
Handle function entry/exit calls

Now race analyzer can display backtrace and source