On Saturday 09 August 2008 13:11:16, Mark Kettenis wrote: > > From: Pedro Alves > > Date: Sat, 9 Aug 2008 12:27:34 +0100 > > > > On Saturday 09 August 2008 09:32:57, Mark Kettenis wrote: > > > > From: Pedro Alves > > > > > > Hmm, it is unfortunate that a process ID of 0 is "verboten", since > > > that's what you are really looking at with "target kvm". And it > > > should be possible for me to actually make all the running processes > > > visible as kernel "threads". > > > > > > > > > I guess your diff is right, although I'd prefer a less arbitrary ptid > > > to be used. Would something like ptid_build(0, 1, 0) work? > > > > I'd prefer to get away without pid == 0. I'm going to > > introduce later a "struct inferior" which holds an "int pid", and > > we will match a ptid to a struct inferior by its ptid.pid. > > I'd rather avoid having an inferior with pid == 0. > > > > Does something like this work for you? > > Something like that'd work fine for the OpenBSD kernel. > Sure, I'd just think you should use something that's a bit less > arbitrary than 42000 (which could be confused with a real process ID) > here. Eh, 42 carries some history. :-) It was used in several targets already, even before I started changing then to use ptid(pid,0,tid), and always registering a thread. monitor used 42000, remote used 42000, remote-sim used 42, go32-nat.c uses 42. I just thought that carrying it around would make it easier to spot what it is. > I see that remote.c uses negative numbers for special cases. > Would using -1 or -2 work for you? Those are in the tid field, which I just carried around when I made the remote target use ptid(pid,0,tid) for threads instead of ptid(tid,0,0). The magic is in using lwp != 0. The special -1,-2 numbers have has some binding to the remote stub current thread. Let's not use -1, as that conflicts a bit with the special ptid(-1,0,0) (aka, minus_one_ptid). I actually have a patchlet in my series to bring back the 42000: remote.c: /* Take advantage of the fact that the LWP field is not used, to tag special ptids with it set to != 0. */ - magic_null_ptid = ptid_build (0, 1, -1); - not_sent_ptid = ptid_build (0, 1, -2); - any_thread_ptid = ptid_build (0, 1, 0); + magic_null_ptid = ptid_build (42000, 1, -1); + not_sent_ptid = ptid_build (42000, 1, -2); + any_thread_ptid = ptid_build (42000, 1, 0); I guess we're numerically converging :-) How about the attached? With your fix for the %eip in, I now get, (gdb) tar kvm #0 0xd034ee05 in ?? () (gdb) info threads * 1 0xd034ee05 in ?? () OK? -- Pedro Alves