I'm trying to extract the exception handler records for a given function. My current plan of attack is as follows:
- Get the functions RVA using IMetaDataImport.GetMethodProps()
- Get the module's base address from ICorDebugModule.GetBaseAddress()
- Use ICorDebugProcess.ReadMemory() to read the method header at base address + RVA to find if/where the first data section can be found (taking into account that the method may be using a tiny header).
- Continue reading successive data section headers with ReadMemory(), taking into account that they may also be using small/fat headers.
- Read the exception handler records from any data sections that claim to have them.
Is there a better/simpler approach to getting at the exception handlers? Is this approach EnC safe?
Sunday, November 04, 2012 12:55 PM
- Changed type Mike FengModerator Thursday, November 08, 2012 11:06 AM General discussion
Welcome to the MSDN Forum.
Since you already have a solution, but still open for another suggestions, I changed this thread type to discussion for more options.
Thank you for your understanding and support.
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Thursday, November 08, 2012 11:08 AMModerator
On the off chance that anyone else has the same questions, the answer seems to be no on both counts.
1) There doesn't appear to be any alternative let alone a better one, It's a shame that we can't access this information through a proper ICD interface but I suppose it's not something that many other debuggers need.
2) From what I have read, ICorDebugFunction also encapsulates the functions version whereas the MethodDef token used to get the RVA does not, therefor it can't possibly be ENC safe. Anyone that want's to get this information in a debugger that supports edit and continue will need to track the changes to the exception handlers themselves.Saturday, December 15, 2012 6:26 AM