diff -ruN kozos21/i386-stub.c kozos22/i386-stub.c --- kozos21/i386-stub.c Sat Nov 24 11:35:14 2007 +++ kozos22/i386-stub.c Sat Nov 24 14:39:50 2007 @@ -831,6 +831,11 @@ ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); /* PC */ *ptr++ = ';'; + strcpy(ptr, "thread:"); + ptr += 7; + ptr = intNToHex(ptr, (int)gen_thread->id, 4); + *ptr++ = ';'; + *ptr = '\0'; putpacket (remcomOutBuffer); @@ -962,6 +967,20 @@ #endif break; + case 'T': + { + int threadid; + kz_thread *thp; + hexToInt(&ptr, &threadid); + thp = (kz_thread *)threadid; + if (thp->id) { + strcpy (remcomOutBuffer, "OK"); + } else { + strcpy (remcomOutBuffer, "E01"); + } + } + break; + case 'q': switch (*ptr++) { @@ -1029,7 +1048,16 @@ mode = hexToIntN(&ptr, 4); threadid[0] = hexToIntN(&ptr, 4); threadid[1] = hexToIntN(&ptr, 4); - thp = (kz_thread *)threadid[1]; + if (threadid[1] == 0xffffffff) + { + /* + * 何を返すべきかちょっと不明なので,とりあえず + * カレントスレッドを返す. + */ + thp = gen_thread; /* current を返すべきか? 不明... */ + } else { + thp = (kz_thread *)threadid[1]; + } ptr = remcomOutBuffer; *ptr++ = 'Q'; @@ -1041,13 +1069,13 @@ if (mode & TAG_THREADID) { ptr = intNToHex(ptr, TAG_THREADID, 4); /* mode */ ptr = intNToHex(ptr, 16, 1); /* length */ - ptr = intNToHex(ptr, threadid[0], 4); - ptr = intNToHex(ptr, threadid[1], 4); + ptr = intNToHex(ptr, 0, 4); + ptr = intNToHex(ptr, (int)thp->id, 4); } if (mode & TAG_EXISTS) { ptr = intNToHex(ptr, TAG_EXISTS, 4); /* mode */ ptr = intNToHex(ptr, 1, 1); /* length */ - *ptr++ = '1'; + *ptr++ = thp->id ? '1' : '0'; } if (mode & TAG_DISPLAY) { ptr = intNToHex(ptr, TAG_DISPLAY, 4); /* mode */ @@ -1098,6 +1126,7 @@ { if (rev) val = -val; stub_restore_regs(gen_thread); + if (val == -1) val = (int)current; gen_thread = (kz_thread *)val; stub_store_regs(gen_thread); strcpy (remcomOutBuffer, "OK");