I'm trying to debug Access Violation error in C++ components running in process of Java-based service via JNI with WinDBG. There are two problems I currently face:
- Java itself uses first-chance access violation exceptions to do some internal thread syncronization (at least that's how it seems), so I can't just break on all first-chance access violations (according to Java bugs database this is intended behavior, so we should not expect any fix)
- Exception is handled in outer code (that should protect production environment against misbehaving of C++ code)
Currently I see one way to distinguish between Java's AV and mine - Java's are happening at the addresses that belong to modules that does not have any symbols loaded, or at any other point of the memory, and I'm interested in catching AVs that happen at the places that have symbols loaded.
Seems I have all elements on how to achieve it with WinDbg, but can't assemble them together:
sxe -c ".if (ln) {gN}" av
The problem is I can't specify input of ln command in .if statement (because it expects an expression), and also I'm not sure how to check if output of ln is empty.