glDrawElements crashes in the driver | debugging hints
<p><strong>Short version:</strong> How can a crash (bad memory access exception/nullptr exception) <strong>inside</strong> <code>glDrawElements/glDrawElementsInstanced</code> be debugged?</p>

<p><strong>Long version:</strong>
You have a path of OpenGL rendering code which uses <code>VAOs</code>, and commits rendering thru calling <code>glDrawElements</code> or <code>glDrawElementsInstanced</code>.  That codepath works correctly most of the time.  We are talking "editor code", which means: the data may be any geometry and is highly likely to change frequently.</p>

<p>But sometimes after commiting reproducible data changes it simply crashes within the <code>glDrawElements*</code> driver code (i.e. <code>glDrawElements</code> is called, the function parameters are OK, the crash happens inside <code>glDrawElements</code>).</p>

<p>How could you proceed debugging this problem?</p>

<p>P.S.:</p>

<ul>
<li>self-answered question: all research efforts went into the answer!</li>
<li>this is targeted at <strong>editor code</strong>.  For simple demonstrations such crashes are mostly caused by the coder not understanding the requirements of glDrawElements correctly, and as such the codepath will either work, or not - in those cases, see:

<ul>
<li><a href="https://stackoverflow.com/questions/18403708/crash-on-gldrawelements">Crash on glDrawElements</a></li>
<li><a href="https://stackoverflow.com/questions/23026612/gldrawelements-crash-opengl-3-2-windows-7">glDrawElements crash (OpenGL 3.2 / Windows 7)</a></li>
</ul></li>
</ul>