Locate bad memory access on Solaris

2019-01-23 08:09发布

On Linux, FreeBSD and other systems I have valgrind for checking for memory errors like invalid reads and similar. I really love valgrind. Now I have to test code on Solaris/OpenSolaris and can't find a way to get information on invalid reads/writes in an as nice way (or better ;-)) as valgrind there.

When searching for this on the net I find references to libumem, but I get only reports about memory leaks there, not invalid access. What am I missing?

3条回答
Animai°情兽
2楼-- · 2019-01-23 08:44

watchmalloc is a quite useful library that can be dynamically loaded for your program (usually no need for recompiling) and then sets watchpoints at all the usually problematic memory locations, like freed areas or after an allocated memory block. If your program accesses one of these invalid areas it gets a signal and you can inspect it in the debugger.

Depending on the configuration problematic areas can be watched for writes only, or also for reads.

查看更多
姐就是有狂的资本
3楼-- · 2019-01-23 08:55

The dbx included with the Sun Studio compilers includes memory access checking support in its "Run Time Checking" feature (the check subcommand). See:

The related "Sun Memory Error Discovery Tool" is also available from http://cooltools.sunsource.net/discover/

查看更多
别忘想泡老子
4楼-- · 2019-01-23 09:00

Since version 3.11.0, Valgrind does run on Solaris. See Release Notes and Supported Platforms.

More precisely, x86/Solaris and amd64/Solaris is now supported. Support for sparc/Solaris is still in works.

查看更多
登录 后发表回答