struct mapinfo {
mapinfo *next;
- unsigned start;
- unsigned end;
+ unsigned long start;
+ unsigned long end;
unsigned size;
unsigned swap;
unsigned rss;
/* b6e82000-b6e83000 rw-p 00020000 b3:19 714 /usr/lib/ld-2.20-2014.11.so : TM1
+ * 7f9389d000-7f9389e000 rw-p 0001f000 b3:12 618 /usr/lib64/ld-2.20-2014.11.so : TM2
* 7fae2e4b2000-7fae2e4b3000 r--p 00021000 fe:01 603 /usr/lib64/ld-2.20-2014.11.so : x86-64 Emulator
- * 7f9389d000-7f9389e000 rw-p 0001f000 b3:12 618 /usr/lib64/ld-2.20-2014.11.so : Note4
* 01234567890123456789012345678901234567890123456789012345678901234567890123456789
* 0 1 2 3 4 5 6 7
*/
char* line;
mapinfo *mi;
int len;
- int tmp;
+ int n;
if ((--line_cnt <= 0) || (line = cgets(smaps)) == 0)
return 0;
if (mi == 0)
return 0;
- mi->start = strtoul(line, 0, 16);
- mi->end = strtoul(line + 9, 0, 16);
+ n = sscanf(line, "%lx-%lx %s %*s %*s %*s %s",
+ &mi->start, &mi->end, &mi->perm, &mi->name);
- mi->perm[0] = line[18]; /* read */
- mi->perm[1] = line[19]; /* write */
- mi->perm[2] = line[20]; /* execute */
- mi->perm[3] = line[21]; /* may share or private */
-
- if (len < 50)
+ if (n == 3)
strncpy(mi->name, "[anon]", strlen("[anon]")+1);
- else
- strncpy(mi->name, line + 49, len);
while (line_cnt-- && (line = cgets(smaps))) {
if (sscanf(line, "Size: %d kB", &mi->size) == 1) {}
unsigned private_dirty = 0;
unsigned private_clean = 0;
unsigned pss = 0;
- unsigned start = 0;
- unsigned end = 0;
+ unsigned long start = 0;
+ unsigned long end = 0;
unsigned private_clean_total = 0;
unsigned private_dirty_total = 0;
unsigned shared_clean_total = 0;
if (!sum) {
printf(" S(CODE) S(DATA) P(CODE) P(DATA) ADDR(start-end)"
- "OBJECT NAME\n");
+ " OBJECT NAME\n");
printf("-------- -------- -------- -------- -----------------"
"------------------------------\n");
} else {
duplication = 0;
if (!sum) {
- printf("%8d %8d %8d %8d %08x-%08x %s\n",
- shared_clean, shared_dirty, private_clean, private_dirty,
- start, end, mi->name);
+ printf("%8d %8d %8d %8d %08lx-%08lx %s\n",
+ shared_clean, shared_dirty, private_clean,
+ private_dirty, start, end, mi->name);
}
shared_clean = 0;
shared_dirty = 0;