diff --git a/mem.c b/mem.c index 3e37da19..a58c1aca 100644 --- a/mem.c +++ b/mem.c @@ -76,7 +76,17 @@ SYS_FUNC(brk) static void print_mmap_flags(kernel_ulong_t flags) { - printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???"); + if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV) + tprintf("%#lx", flags); + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return; + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) + tprints(" /* "); + + printxvals_ex(flags & MAP_TYPE, "MAP_???", XLAT_STYLE_ABBREV, + mmap_flags, NULL); flags &= ~MAP_TYPE; const unsigned int mask = MAP_HUGE_MASK << MAP_HUGE_SHIFT; @@ -85,12 +95,16 @@ print_mmap_flags(kernel_ulong_t flags) flags &= ~mask; if (flags) { tprints("|"); - printflags64(mmap_flags, flags, NULL); + printflags_ex(flags, NULL, XLAT_STYLE_ABBREV, + mmap_flags, NULL); } if (hugetlb_value) tprintf("|%u<> MAP_HUGE_SHIFT); + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) + tprints(" */"); } static void diff --git a/tests/mmap.c b/tests/mmap.c index f797e685..39597005 100644 --- a/tests/mmap.c +++ b/tests/mmap.c @@ -77,15 +77,14 @@ main(int ac, char **av) perror_msg_and_fail("mmap"); #if XLAT_RAW printf("%s(%p, %lu, %#x, " - "%#x|%#x, %d, %#jx) = %p\n", - name, addr, length1, PROT_READ | PROT_WRITE, MAP_PRIVATE, - MAP_ANONYMOUS, fd, uoffset, p); + "%#x, %d, %#jx) = %p\n", + name, addr, length1, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, fd, uoffset, p); #elif XLAT_VERBOSE printf("%s(%p, %lu, %#x /* PROT_READ|PROT_WRITE */, " - "%#x /* MAP_PRIVATE */|%#x /* MAP_ANONYMOUS */, %d, %#jx) " - "= %p\n", - name, addr, length1, PROT_READ | PROT_WRITE, MAP_PRIVATE, - MAP_ANONYMOUS, fd, uoffset, p); + "%#x /* MAP_PRIVATE|MAP_ANONYMOUS */, %d, %#jx) = %p\n", + name, addr, length1, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, fd, uoffset, p); #else printf("%s(%p, %lu, PROT_READ|PROT_WRITE, " "MAP_PRIVATE|MAP_ANONYMOUS, %d, %#jx) = %p\n", diff --git a/tests/old_mmap.c b/tests/old_mmap.c index 07d572cf..8da50f6b 100644 --- a/tests/old_mmap.c +++ b/tests/old_mmap.c @@ -80,14 +80,13 @@ main(void) rc = syscall(__NR_mmap, args); # if XLAT_RAW - printf("mmap(%#lx, %lu, %#x, %#x|%#x, %d, %#lx) = %ld %s (%m)\n", - args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE, MAP_FIXED, + printf("mmap(%#lx, %lu, %#x, %#x, %d, %#lx) = %ld %s (%m)\n", + args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE | MAP_FIXED, (int) args1_c[4], args1_c[5], rc, errno2name()); # elif XLAT_VERBOSE printf("mmap(%#lx, %lu, %#x /* PROT_READ|PROT_EXEC */" - ", %#x /* MAP_FILE */|%#x /* MAP_FIXED */" - ", %d, %#lx) = %ld %s (%m)\n", - args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE, MAP_FIXED, + ", %#x /* MAP_FILE|MAP_FIXED */, %d, %#lx) = %ld %s (%m)\n", + args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE | MAP_FIXED, (int) args1_c[4], args1_c[5], rc, errno2name()); # else printf("mmap(%#lx, %lu, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED" @@ -100,14 +99,13 @@ main(void) rc = syscall(__NR_mmap, args); # ifndef PATH_TRACING # if XLAT_RAW - printf("mmap(NULL, %lu, %#x, %#x|%#x, %d, %#lx) = %#lx\n", - args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE, MAP_ANONYMOUS, + printf("mmap(NULL, %lu, %#x, %#x, %d, %#lx) = %#lx\n", + args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, (int) args2_c[4], args2_c[5], rc); # elif XLAT_VERBOSE printf("mmap(NULL, %lu, %#x /* PROT_READ|PROT_WRITE */" - ", %#x /* MAP_PRIVATE */|%#x /* MAP_ANONYMOUS */" - ", %d, %#lx) = %#lx\n", - args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE, MAP_ANONYMOUS, + ", %#x /* MAP_PRIVATE|MAP_ANONYMOUS */, %d, %#lx) = %#lx\n", + args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, (int) args2_c[4], args2_c[5], rc); # else printf("mmap(NULL, %lu, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS"