function.c (assign_parm_adjust_stack_rtl): Revise STRICT_ALIGNMENT check to use targe...
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_procmaps_solaris.cc
blob9e5e37e6b9dcd28e0a9e1ac9817f921dd5da40f6
1 //===-- sanitizer_procmaps_solaris.cc -------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Information about the process mappings (Solaris-specific parts).
9 //===----------------------------------------------------------------------===//
11 #include "sanitizer_platform.h"
12 #if SANITIZER_SOLARIS
13 #include "sanitizer_common.h"
14 #include "sanitizer_procmaps.h"
16 // Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
17 #undef _FILE_OFFSET_BITS
18 #include <procfs.h>
19 #include <limits.h>
21 namespace __sanitizer {
23 void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
24 ReadFileToBuffer("/proc/self/xmap", &proc_maps->data, &proc_maps->mmaped_size,
25 &proc_maps->len);
28 bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
29 char *last = data_.proc_self_maps.data + data_.proc_self_maps.len;
30 if (data_.current >= last) return false;
32 prxmap_t *xmapentry = (prxmap_t*)data_.current;
34 segment->start = (uptr)xmapentry->pr_vaddr;
35 segment->end = (uptr)(xmapentry->pr_vaddr + xmapentry->pr_size);
36 segment->offset = (uptr)xmapentry->pr_offset;
38 segment->protection = 0;
39 if ((xmapentry->pr_mflags & MA_READ) != 0)
40 segment->protection |= kProtectionRead;
41 if ((xmapentry->pr_mflags & MA_WRITE) != 0)
42 segment->protection |= kProtectionWrite;
43 if ((xmapentry->pr_mflags & MA_EXEC) != 0)
44 segment->protection |= kProtectionExecute;
46 if (segment->filename != NULL && segment->filename_size > 0) {
47 internal_snprintf(segment->filename,
48 Min(segment->filename_size, (uptr)PATH_MAX), "%s",
49 xmapentry->pr_mapname);
52 data_.current += sizeof(prxmap_t);
54 return true;
57 } // namespace __sanitizer
59 #endif // SANITIZER_SOLARIS