Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Richard Braun <rbraun@sceen.net>
To: Yue Lu <hacklu.newborn@gmail.com>
Cc: Luis Machado <lgustavo@codesourcery.com>,
	gdb@sourceware.org,	bug-hurd@gnu.org,
	Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: how to continue from a breakpoint in GNU/Hurd
Date: Thu, 18 Jul 2013 09:03:00 -0000	[thread overview]
Message-ID: <20130718090258.GA19287@dalaran.sceen.net> (raw)
In-Reply-To: <CAB8fV=iby=S=_=ZgkKymrESELobhDVPA-0T2B+jJWGsfpKLowA@mail.gmail.com>

On Thu, Jul 18, 2013 at 12:22:07AM +0800, Yue Lu wrote:
> On Thu, Jul 18, 2013 at 12:13 AM, Richard Braun <rbraun@sceen.net> 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


  reply	other threads:[~2013-07-18  9:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAB8fV=i04n-eHTxP=7hWRkB7O1VJobvrMc5KSHOX0SkJ3vuqhQ@mail.gmail.com>
2013-07-16 16:44 ` Luis Machado
2013-07-16 17:05   ` Yue Lu
2013-07-16 17:26     ` Luis Machado
     [not found]       ` <CAB8fV=jnOcYCGmQ_emcoE0ZYH6MjT3K3a1P8=svRR+nKSMD69A@mail.gmail.com>
2013-07-17 12:10         ` Richard Braun
2013-07-17 16:07           ` Yue Lu
2013-07-17 16:13             ` Richard Braun
2013-07-17 16:22               ` Yue Lu
2013-07-18  9:03                 ` Richard Braun [this message]
2013-07-16 16:45 Yue Lu
2013-07-16 17:29 ` Hui Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130718090258.GA19287@dalaran.sceen.net \
    --to=rbraun@sceen.net \
    --cc=bug-hurd@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=hacklu.newborn@gmail.com \
    --cc=lgustavo@codesourcery.com \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox