Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Steve Freeland <caucasatron@yahoo.ca>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sources.redhat.com
Subject: Re: Watchpoints in multithreaded programs
Date: Tue, 03 Oct 2006 03:53:00 -0000	[thread overview]
Message-ID: <20061003035310.80501.qmail@web34211.mail.mud.yahoo.com> (raw)

Is there anything particularly wrong with just setting the watchpoint individually in each of
the threads?  I haven't a clue about portability, but on I've checked on i386 Linux and this
seems to work... at least, it solves my problem.  I can clean this up and make it submittable
as a patch, but first I'd like to know if there's a problem with it conceptually, as I've never
worked with gdb internals before:

struct i386_linux_dr_operation
{
    int regnum;
    unsigned long value;
};

static int i386_linux_dr_set_for_tid(int tid, int regnum, unsigned long value)
{
  int result = 0;
  errno = 0;
  ptrace (PTRACE_POKEUSER, tid,
          offsetof (struct user, u_debugreg[regnum]), value);

  if (errno != 0)
  {
    perror_with_name (_("Couldn't write debug register"));
    result = 1;
  }
  return result;
}

static int i386_linux_perform_dr_operation(struct thread_info *t, void *arg)
{
    struct i386_linux_dr_operation *op = arg;
    return i386_linux_dr_set_for_tid(TIDGET(t->ptid), op->regnum, op->value);
}

static void
i386_linux_dr_set (int regnum, unsigned long value)
{
  int tid = TIDGET (inferior_ptid);
  if (tid == 0)
  {
     i386_linux_dr_set_for_tid(PIDGET(inferior_ptid), regnum, value);
  }
  else
  {
    struct i386_linux_dr_operation op = { regnum, value };
    iterate_over_threads(i386_linux_perform_dr_operation, &op);
  }
}


----- Original Message ----
From: Daniel Jacobowitz <drow@false.org>
To: Steve Freeland <caucasatron@yahoo.ca>
Cc: gdb@sources.redhat.com
Sent: Sunday, October 1, 2006 7:24:43 PM
Subject: Re: Watchpoints in multithreaded programs

On Sun, Oct 01, 2006 at 02:23:27PM -0700, Steve Freeland wrote:
> So... I'm a bit confused.  Is the manual out of date?  Did the
> "watchthreads" patch never make it into mainline builds for some
> reason?

It never did.  Discussion trailed off and we never heard anything else
about it from the submitter.

I recall seeing a few weeks ago that there is an updated version in
the Red Hat SRPMs.  Could any of the list subscribers from Red Hat
comment - is that version fit for submission?

-- 
Daniel Jacobowitz
CodeSourcery






             reply	other threads:[~2006-10-03  3:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-03  3:53 Steve Freeland [this message]
2006-10-03  4:07 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2006-10-01 21:23 Steve Freeland
2006-10-01 23:24 ` Daniel Jacobowitz
2007-04-25 20:37 ` Jan Kratochvil

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=20061003035310.80501.qmail@web34211.mail.mud.yahoo.com \
    --to=caucasatron@yahoo.ca \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.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