Thread overview
Any tools to track heap/stack corruptions?
Feb 03, 2021
JN
Feb 03, 2021
Imperatorn
Feb 03, 2021
H. S. Teoh
Feb 03, 2021
Imperatorn
Feb 03, 2021
H. S. Teoh
February 03, 2021
I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot. Seems like I am corrupting some memory somewhere (I interact a lot with C libraries). Do you know of any tools I could use to try to narrow it down?

I've used Application Verifier but so far it didn't point me to anything specific.
February 03, 2021
On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote:
> I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot. Seems like I am corrupting some memory somewhere (I interact a lot with C libraries). Do you know of any tools I could use to try to narrow it down?
>
> I've used Application Verifier but so far it didn't point me to anything specific.

I don't see where exactly you're having wierd issues.

Can you use a debugger?
https://wiki.dlang.org/Debuggers

Or dustmite?
https://dlang.org/blog/2020/04/13/dustmite-the-general-purpose-data-reduction-tool/
February 03, 2021
On Wed, Feb 03, 2021 at 02:00:23PM +0000, JN via Digitalmars-d-learn wrote:
> I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot. Seems like I am corrupting some memory somewhere (I interact a lot with C libraries). Do you know of any tools I could use to try to narrow it down?
> 
> I've used Application Verifier but so far it didn't point me to anything specific.

Valgrind maybe?  Most of the tools that work with C/C++ should also work with little or no modifications for D programs.


T

-- 
Real men don't take backups. They put their source on a public FTP-server and let the world mirror it. -- Linus Torvalds
February 03, 2021
On Wed, Feb 03, 2021 at 03:47:34PM +0000, Imperatorn via Digitalmars-d-learn wrote:
> On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote:
> > I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot. Seems like I am corrupting some memory somewhere (I interact a lot with C libraries). Do you know of any tools I could use to try to narrow it down?
[...]
> Or dustmite? https://dlang.org/blog/2020/04/13/dustmite-the-general-purpose-data-reduction-tool/

Dustmite generally does not do well with errors that move around and/or occasionally go away when the code changes slightly.  It tends to misidentify the problem in such cases and reduce to something that isn't related to the original program.  It's more suitable for problems that are 100% reliably reproduced.  Pointer bugs / memory corruption often do not fall into that category.


T

-- 
It is not the employer who pays the wages. Employers only handle the money. It is the customer who pays the wages. -- Henry Ford
February 03, 2021
On Wednesday, 3 February 2021 at 15:59:28 UTC, H. S. Teoh wrote:
> On Wed, Feb 03, 2021 at 03:47:34PM +0000, Imperatorn via Digitalmars-d-learn wrote:
>> On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote:
>> > [...]
> [...]
>> Or dustmite? https://dlang.org/blog/2020/04/13/dustmite-the-general-purpose-data-reduction-tool/
>
> Dustmite generally does not do well with errors that move around and/or occasionally go away when the code changes slightly.  It tends to misidentify the problem in such cases and reduce to something that isn't related to the original program.  It's more suitable for problems that are 100% reliably reproduced.  Pointer bugs / memory corruption often do not fall into that category.
>
>
> T

Yes, Valgrind is the way to go