From a5675467db63223c48c077b5d11728af70c0d848 Mon Sep 17 00:00:00 2001 From: rpaulo Date: Thu, 16 Sep 2010 11:33:31 +0000 Subject: [PATCH] When generating functions to print the arguments of system calls with bitwise parameters (e.g. mmap), print the syscall parameter value first. The resulting output looks like the %b specifier of printf(9). Before: mmap(0,0x8000,PROT_READ|PROT_WRITE,... After: mmap(0,0x8000,0x3,... Submitted by: Norberto Lopes Idea from: freebsd-arch/2006-April/005116.html --- usr.bin/kdump/mksubr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 797c32c82cd..043d71205ea 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -49,6 +49,7 @@ void $name (int arg) { int or = 0; + printf("%#x<", arg); _EOF_ egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ $include_dir/$file | \ @@ -58,6 +59,7 @@ _EOF_ ++i; \ printf "\tif(!((arg>0)^((%s)>0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' cat <<_EOF_ + printf(">"); if (or == 0) (void)printf("%ld", (long)arg); } @@ -432,6 +434,8 @@ sendrecvflagsname (int flags) (void)printf("0"); return; } + + printf("%#x<", flags); _EOF_ egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \ awk '{ for (i = 1; i <= NF; i++) \ @@ -440,6 +444,7 @@ egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]] ++i; \ printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }' cat <<_EOF_ + printf(">"); } _EOF_ -- 2.45.0