13
13
14
14
#if SANITIZER_AIX
15
15
# include < assert.h>
16
- # include < stdlib.h>
17
16
# include < stdio.h>
17
+ # include < stdlib.h>
18
18
# include < sys/procfs.h>
19
19
20
20
# include " sanitizer_common.h"
21
- # include " sanitizer_procmaps.h"
22
21
# include " sanitizer_file.h"
22
+ # include " sanitizer_procmaps.h"
23
23
24
24
namespace __sanitizer {
25
25
26
- static int qsort_comp (const void *va, const void * vb) {
26
+ static int qsort_comp (const void *va, const void *vb) {
27
27
const prmap_t *a = (const prmap_t *)va;
28
28
const prmap_t *b = (const prmap_t *)vb;
29
29
@@ -37,12 +37,11 @@ static int qsort_comp(const void *va, const void * vb) {
37
37
}
38
38
39
39
static prmap_t *SortProcMapEntries (char *buffer) {
40
- prmap_t *begin = (prmap_t *)buffer;
40
+ prmap_t *begin = (prmap_t *)buffer;
41
41
prmap_t *mapIter = begin;
42
42
// The AIX procmap utility detects the end of the array of `prmap`s by finding
43
43
// an entry where pr_size and pr_vaddr are both zero.
44
- while (mapIter->pr_size != 0 || mapIter->pr_vaddr != 0 )
45
- ++mapIter;
44
+ while (mapIter->pr_size != 0 || mapIter->pr_vaddr != 0 ) ++mapIter;
46
45
prmap_t *end = mapIter;
47
46
48
47
size_t count = end - begin;
@@ -57,7 +56,8 @@ void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
57
56
constexpr unsigned BUFFER_SIZE = 128 ;
58
57
char filenameBuf[BUFFER_SIZE] = {};
59
58
internal_snprintf (filenameBuf, BUFFER_SIZE, " /proc/%d/map" , pid);
60
- if (!ReadFileToBuffer (filenameBuf, &proc_maps->data , &proc_maps->mmaped_size , &proc_maps->len )) {
59
+ if (!ReadFileToBuffer (filenameBuf, &proc_maps->data , &proc_maps->mmaped_size ,
60
+ &proc_maps->len )) {
61
61
proc_maps->data = nullptr ;
62
62
proc_maps->mmaped_size = 0 ;
63
63
proc_maps->len = 0 ;
@@ -106,15 +106,17 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
106
106
constexpr unsigned BUFFER_SIZE = 128 ;
107
107
char objPath[BUFFER_SIZE] = {};
108
108
// Use path /proc/<pid>/object/<object_id> to pass to the symbolizer.
109
- internal_snprintf (objPath, BUFFER_SIZE, " /proc/%d/object/%s" , internal_getpid (), mapIter->pr_mapname );
109
+ internal_snprintf (objPath, BUFFER_SIZE, " /proc/%d/object/%s" ,
110
+ internal_getpid (), mapIter->pr_mapname );
110
111
len = Min ((uptr)internal_strlen (objPath), segment->filename_size - 1 );
111
112
internal_strncpy (segment->filename , objPath, len);
112
113
segment->filename [len] = 0 ;
113
114
114
- // We don't have the full path to user libraries, so we use what we have available as the
115
- // display name.
115
+ // We don't have the full path to user libraries, so we use what we have
116
+ // available as the display name.
116
117
const char *displayPath = data_.proc_self_maps .data + mapIter->pr_pathoff ;
117
- len = Min ((uptr)internal_strlen (displayPath), segment->displayname_size - 1 );
118
+ len =
119
+ Min ((uptr)internal_strlen (displayPath), segment->displayname_size - 1 );
118
120
internal_strncpy (segment->displayname , displayPath, len);
119
121
segment->displayname [len] = 0 ;
120
122
} else if (segment->filename ) {
@@ -126,7 +128,7 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
126
128
segment->offset = 0 ;
127
129
128
130
++mapIter;
129
- data_.current = (const char *)mapIter;
131
+ data_.current = (const char *)mapIter;
130
132
131
133
return true ;
132
134
}
0 commit comments