Return to BSD News archive
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sunic!chalmers.se!dtek.chalmers.se!dxper From: dxper@dtek.chalmers.se (Per Anders Olausson) Newsgroups: comp.unix.bsd Subject: Re: ps and tcsh Message-ID: <13233@chalmers.se> Date: 8 Aug 92 20:04:01 GMT References: <weV00lC00WB3AzbkUI@andrew.cmu.edu> Sender: news@chalmers.se Organization: Chalmers University of Technology, Gothenburg Sweden Lines: 84 tj2n+@andrew.cmu.edu (Tao Jiang) writes: >Hi, >I patched kvm.cand rebuild libutil.a and ps, but ps -u still did not work. >Any hints? I have been debugging ps today and all I can say is, that I'm not so sure about there being anything wrong with it. I think ps must be doing something other programs don't which have made some old bug deep in 386bsd break out. Why? Well, this is what I get from gdb: /usr/src/bin/ps (21:13) 127 # gdb ps Reading symbol data from /usr/src/bin/ps/ps...done. (gdb) set args u (gdb) run Starting program: /usr/src/bin/ps/ps u USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND v->width: 8, uid: 0 Program received signal 8, Floating point exception 0xd059 in write () (gdb) info stack #0 0xd059 in write () #1 0xcc06 in __swrite (68908, 196608, 22) #2 0xcb44 in __sflush () #3 0xcb01 in fflush (68908) #4 0xc665 in __sfvwrite () #5 0xac2d in _exit () #6 0xbd02 in vfprintf () #7 0x4208 in printf () #8 0xbf6 in uname (...) #9 0x1c74 in main (...) (gdb) This is my altered uname(): uname(k, v) KINFO *k; VAR *v; { #ifndef NEWVM (void) printf("%-*s", v->width, user_from_uid(k->ki_p->p_uid, 0)); #else /* NEWVM */ /* printf("v->width: %d, uid: %d\n", v->width, k->ki_e->e_ucred.cr_uid);*/ printf("Hello!\n"); printf("Hello!\n"); (void) printf("%-*s", v->width, user_from_uid(k->ki_e->e_ucred.cr_uid, 0)); #endif /* NEWVM */ } The debugging output above is something I got when I had the first printf uncommented. Then it occured to me, that perhaps it was something wrong with arguments passed to it so I changed it to one printf("Hello\n"); and it still failed at the same place. Then I thought, it will bug out regardless of what I put there so I added another one and I know get: /usr/src/bin/ps (21:54) 259 # obj/ps u USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND Hello! Floating exception (core dumped) Regardless of whether or not gdb is debugging it... As you see it never reaches the second printf()... God knows what floating points has to do with my printf("Hello\n"); B-) By the way, before I started mucking with this it would fail in setpassent() which was called during the user_from_uid() transformation in uname(). Lovely, ain't it? Btw, I am using a kernel compiled with ddb so it may have something to do with it? pao -- -------------------------------Andrew Olausson-------------------------------- --------------------------Unemployed Unix Specialist-------------------------- ------------------------------pao@cd.chalmers.se------------------------------ -------------------------------pa-ola@proxxi.se-------------------------------