From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7244 invoked by alias); 18 Jul 2013 09:03:09 -0000 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 Received: (qmail 7216 invoked by uid 89); 18 Jul 2013 09:03:08 -0000 X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO mail.sceen.net) (5.39.75.216) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Jul 2013 09:03:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sceen.net (Postfix) with ESMTP id 78F851206AC; Thu, 18 Jul 2013 11:02:59 +0200 (CEST) Received: from mail.sceen.net ([127.0.0.1]) by localhost (mail.sceen.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0R_e31VloTp1; Thu, 18 Jul 2013 11:02:59 +0200 (CEST) Received: by mail.sceen.net (Postfix, from userid 1000) id 095CD1214D8; Thu, 18 Jul 2013 11:02:58 +0200 (CEST) Date: Thu, 18 Jul 2013 09:03:00 -0000 From: Richard Braun To: Yue Lu Cc: Luis Machado , gdb@sourceware.org, bug-hurd@gnu.org, Thomas Schwinge Subject: Re: how to continue from a breakpoint in GNU/Hurd Message-ID: <20130718090258.GA19287@dalaran.sceen.net> References: <51E5785D.1050904@codesourcery.com> <51E58223.5040505@codesourcery.com> <20130717120954.GA26158@dalaran.sceen.net> <20130717161348.GA14402@dalaran.sceen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-07/txt/msg00065.txt.bz2 On Thu, Jul 18, 2013 at 12:22:07AM +0800, Yue Lu wrote: > On Thu, Jul 18, 2013 at 12:13 AM, Richard Braun wrote: > > On Thu, Jul 18, 2013 at 12:07:20AM +0800, Yue Lu wrote: > >> when I used thread_info() to check the suspend count, they are zero. > >> But I met a strange thing. > >> this is my code snippet: > >> thread_basic_info_data_t _info; > >> thread_basic_info_t info = &_info; > >> mach_msg_type_number_t info_len = THREAD_BASIC_INFO_COUNT; > >> error_t err = > >> thread_info (thread->port, THREAD_BASIC_INFO, (int *) &info, &info_len); > >> > >> after this call, the info turn out to be a _NULL_ pointer. I think > > > > If the info pointer is NULL, how do you determine the suspend count ? > > > I used this (&_info)->suspend_count to get the sc value. > > > Something does look wrong. Check all the parameters of your call, one > > by one, rigorously. > > The only one parameter I used is the first one, I give it as the > thread port, something like 119 (I have printf it), the left three > parameters are all the same as the code in gnu-nat.c. So, in the end, the code (which is taken from GDB) is wrong. It uses &info, the address of a pointer to _info, where it should use &_info or info instead. The kernel happily writes the thread info there, erasing the pointer on the way. -- Richard Braun