From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24652 invoked by alias); 26 Mar 2009 21:36:54 -0000 Received: (qmail 24642 invoked by uid 22791); 26 Mar 2009 21:36:53 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Mar 2009 21:36:48 +0000 Received: from zps78.corp.google.com (zps78.corp.google.com [172.25.146.78]) by smtp-out.google.com with ESMTP id n2QLaisp026107 for ; Thu, 26 Mar 2009 21:36:44 GMT Received: from localhost (ruffy.mtv.corp.google.com [172.18.118.116]) by zps78.corp.google.com with ESMTP id n2QLagjG009486 for ; Thu, 26 Mar 2009 14:36:43 -0700 Received: by localhost (Postfix, from userid 67641) id B9E771C74E3; Thu, 26 Mar 2009 14:36:42 -0700 (PDT) To: gdb@sourceware.org Subject: when can find_thread_pid (inferior_ptid) return NULL? Message-Id: <20090326213642.B9E771C74E3@localhost> Date: Thu, 26 Mar 2009 21:36:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00169.txt.bz2 Hi. Some places in gdb assert that find_thread_pid (inferior_ptid) is never NULL. e.g. struct thread_info* inferior_thread (void) { struct thread_info *tp = find_thread_pid (inferior_ptid); gdb_assert (tp); return tp; } Other places check. E.g. make_cleanup_restore_current_thread: tp = find_thread_pid (inferior_ptid); if (tp) tp->refcount++; Since delete_thread_1 has this: /* If this is the current thread, or there's code out there that relies on it existing (refcount > 0) we can't delete yet. Mark it as exited, and notify it. */ if (tp->refcount > 0 || ptid_equal (tp->ptid, inferior_ptid)) { I would expect that one can always assert find_thread_pid (inferior_ptid) != NULL. Is that true? Or are there situations where it's not true?