Locating the source of heap corruption (setup and general guidelines)
-
I have a random heap corruption in my app which is using an external dll that exchanges data with an Internet server
The crash occurs after an arbitrary amount of time like 2-3 hours up to a couple days
So the problem is in identifying the command and, most importantly, the module where the heap gets corrupted and what leads to the corruption (not where the error manifests itself) as the issue may well be with the dll, not my code
Now I'm trying to understand how to use Application Verifier to track down heap corruptions. For demonstration purposes, I delete the same pointer twice and Application Verifier shows me the address of the offending code and the address causing the corruption
Something like this:
VERIFIER STOP 0000000000000013: pid 0x19D0: First chance access violation for current stack trace 00000267AD9BD030 : Invalid address causing the exception. 00007FF734962533 : Code address executing the invalid access. 000000D98C1289B0 : Exception record. 000000D98C1284C0 : Context record.
But this is not what I want to know as I can see that in debugger. In this case specifically, I want to know where the memory has been released for the first time (without the advantage of prior knowledge), and, more generally, to learn how to locate the source of heap corruptions, not where they manifest themselves
I've been trying to follow the steps laid out in this article:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/application-verifier-debugging-application-verifier-stopsBut the commands related to debugging heap errors simply don't work in the cdb command window in QtCreator, starting with:
!heap -p
which produces:
unable to resolve ntdll!RtlpStackTraceDataBase unable to read 0000000000000000
So how can I trace this error (and other heap corruption errors) with Application Verifier and cdb in QtCreator?
-
I have a random heap corruption in my app which is using an external dll that exchanges data with an Internet server
The crash occurs after an arbitrary amount of time like 2-3 hours up to a couple days
So the problem is in identifying the command and, most importantly, the module where the heap gets corrupted and what leads to the corruption (not where the error manifests itself) as the issue may well be with the dll, not my code
Now I'm trying to understand how to use Application Verifier to track down heap corruptions. For demonstration purposes, I delete the same pointer twice and Application Verifier shows me the address of the offending code and the address causing the corruption
Something like this:
VERIFIER STOP 0000000000000013: pid 0x19D0: First chance access violation for current stack trace 00000267AD9BD030 : Invalid address causing the exception. 00007FF734962533 : Code address executing the invalid access. 000000D98C1289B0 : Exception record. 000000D98C1284C0 : Context record.
But this is not what I want to know as I can see that in debugger. In this case specifically, I want to know where the memory has been released for the first time (without the advantage of prior knowledge), and, more generally, to learn how to locate the source of heap corruptions, not where they manifest themselves
I've been trying to follow the steps laid out in this article:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/application-verifier-debugging-application-verifier-stopsBut the commands related to debugging heap errors simply don't work in the cdb command window in QtCreator, starting with:
!heap -p
which produces:
unable to resolve ntdll!RtlpStackTraceDataBase unable to read 0000000000000000
So how can I trace this error (and other heap corruption errors) with Application Verifier and cdb in QtCreator?
-
D deisik has marked this topic as solved on