On Tue, Jun 21, 2011 at 11:49:37AM +0200, Otto Moerbeek wrote: > Hi, > > with kdump, file offsets are printed as two ints on 32-bit systems. > This diff should fix that and print a single long long. > > Tested on vax and hppa. Strange things is that hppa prints a trailing > int for lseek(2). Have to dig into that. This has nothing to do with > fancy mode, since it is also printed with -n. > > Here a sample of the test I used: > > #include <sys/mman.h> > #include <unistd.h> > > main() > { > mmap(1,2,3,4,5,0x8000000090000000LL); > lseek(3,0x12345678abcdef12LL,1); > } > > Hope I got the tricky sign-extends all covered.
Did anybody test or review this? I like to move on... -Otto > > > Index: kdump.c > =================================================================== > RCS file: /cvs/src/usr.bin/kdump/kdump.c,v > retrieving revision 1.51 > diff -u -p -r1.51 kdump.c > --- kdump.c 20 Jun 2011 17:54:48 -0000 1.51 > +++ kdump.c 21 Jun 2011 09:39:55 -0000 > @@ -325,6 +325,40 @@ ioctldecode(u_long cmd) > c = ','; \ > } while (0); > > +#ifdef __LP64__ > +#define print_llnumber(i, n, c) print_number(i, n, c) > +#elif _BYTE_ORDER == _LITTLE_ENDIAN > +#define print_llnumber(i, n, c) do { \ > + long long val = ((long long)*i) & 0xffffffff; \ > + i++; \ > + val |= ((long long)*i) << 32; \ > + i++; \ > + n -= 2; \ > + if (c) \ > + (void)putchar(c); \ > + if (decimal) \ > + (void)printf("%lld", val); \ > + else \ > + (void)printf("%#llx", val); \ > + c = ','; \ > +} while (0); > +#else > +#define print_llnumber(i, n, c) do { \ > + long long val = ((long long)*i) << 32; \ > + i++; \ > + val |= ((long long)*i) & 0xffffffff; \ > + i++; \ > + n -= 2; \ > + if (c) \ > + (void)putchar(c); \ > + if (decimal) \ > + (void)printf("%lld", val); \ > + else \ > + (void)printf("%#llx", val); \ > + c = ','; \ > +} while (0); > +#endif > + > static void > ktrsyscall(struct ktr_syscall *ktr) > { > @@ -484,7 +518,7 @@ ktrsyscall(struct ktr_syscall *ktr) > /* skip padding */ > ap++; > narg--; > - print_number(ap, narg, c); > + print_llnumber(ap, narg, c); > (void)putchar(','); > whencename((int)*ap); > ap++; > @@ -526,6 +560,7 @@ ktrsyscall(struct ktr_syscall *ktr) > /* skip padding */ > ap++; > narg--; > + print_llnumber(ap, narg, c); > break; > case SYS_mprotect: > print_number(ap, narg, c); > @@ -550,6 +585,7 @@ ktrsyscall(struct ktr_syscall *ktr) > /* skip padding */ > ap++; > narg--; > + print_llnumber(ap, narg, c); > break; > case SYS_msync: > print_number(ap, narg, c); > @@ -588,6 +624,7 @@ ktrsyscall(struct ktr_syscall *ktr) > /* skip padding */ > ap++; > narg--; > + print_llnumber(ap, narg, c); > break; > case SYS_recvmsg: > case SYS_sendmsg: > @@ -686,6 +723,7 @@ ktrsyscall(struct ktr_syscall *ktr) > /* skip padding */ > ap++; > narg--; > + print_llnumber(ap, narg, c); > break; > case SYS_wait4: > print_number(ap, narg, c);