Add support for new exception trace storage format
To eliminate global spinlock in stack trace saving to exceptions, the format of the stack trace storage has changed. The _stackTrace array can now be either a byte[] with the actual stack trace as before or an object[] where the first element references the byte[] with the actual stack trace and the following elements contain references to System.Resolver or System.Reflection.LoaderAllocator instances that keep code of methods that can be collected alive.
This change modifies SOS to handle the object[] case properly, while staying compatible with the old way. Since the same code to get the stack trace was duplicated at two places, I have taken this opportunity to refactor it into a separate function.
@janvorli - This looks like all previous versions of SOS that don't have this change won't work against new runtime versions so we probably want to bump the breaking change version number. Anyone who tries to use a version of SOS containing the old version number gets an error saying their SOS is out-of-date and they should update it.
I'll let Mike take a look at the rest of the code change but it looked good to me 👍
fyi @elinor-fung @lambdageek - this looks like an example where SOS is directly inspecting runtime internal data structures without using a DAC API. Whether the code stays in SOS or migrates to a new API that cDAC implements this parsing code would not work cross-bitness as-is.
@noahfalk thank you for pointing it out, I'll add bumping the version in the runtime change.