Re: how to continue from a breakpoint in GNU/Hurd

Richard Braun <[email protected]>
Newsgroups gmane.os.hurd.bugs,gmane.comp.gdb.devel
Message-ID <[email protected]>
On Thu, Jul 18, 2013 at 12:22:07AM +0800, Yue Lu wrote:
> On Thu, Jul 18, 2013 at 12:13 AM, Richard Braun <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.