mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
On Solaris and Linux, mmap() is an optimized function without prologue and epilogue. However, Solaris libc does not currently bear any DWARF CFI. Therefore stack chain unwinder grabs only two entries: IP inside mmap() and return address from the previous frame which points inside _start(), right after where main() is invoked. By introducing an intermediate function f(), main() is now visible in the stack trace even on Solaris. n-i-bz git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15749
20 lines
343 B
C
20 lines
343 B
C
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include "tests/sys_mman.h"
|
|
|
|
static void *f(void)
|
|
{
|
|
return mmap(NULL, 80 * 1000 * 1024,
|
|
PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
|
|
-1, 0);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
void *m = f();
|
|
munmap(m, 80 * 1000 * 1024);
|
|
return 0;
|
|
}
|