Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Aravinda <aravindakidambi@gmail.com>
To: gdb@sourceware.org
Subject: Problem with manual watchpoints
Date: Thu, 24 Dec 2009 20:47:00 -0000	[thread overview]
Message-ID: <26eb53620912241247i718992d6i422451f4b7f9931@mail.gmail.com> (raw)

Hi,

Im facing a very wierd problem. Its nothing to do with GDB, but i was
just wondering if theres something about 'hardware watchpoints' im
missing here.

I have a kernel module that can add watchpoints for a process. The
module can be invoked by __add_watchpoint(pid, address).
I wrote the program below to test the module. In the below program, I
have allocated a buffer 'a' and access 'a[0], a[1] .... a[25]'. I have
the address of a[20] loaded in one of the debug register.

a = malloc(20);
__add_watchpoint(getpid(), &a[20]);

for (i = 0; i < 25; i ++) {
	/* getc(stdin); ----> without this, no SIGTRAP is getting generated */
	printf("Accessing now %x\n", &a[i]);
	a[i]++;
}

While I expect the program to be interrupted by a tracepoint exception
on accessing a[20], it actually does not. It runs to completion
without catching any trap exception. However, if I just add a
'getc(stdin)' before accessing every element, it does get the
exception on accessing a[20].

Does anyone know what could be going on ?

Thanks,
Aravinda


             reply	other threads:[~2009-12-24 20:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-24 20:47 Aravinda [this message]
2009-12-24 21:08 ` Jan Kratochvil
2009-12-24 21:42   ` Aravinda
2009-12-24 21:52     ` Jan Kratochvil
2009-12-28 21:22       ` Aravinda
2009-12-28 21:49         ` Jan Kratochvil
2009-12-29  3:00           ` Aravinda

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=26eb53620912241247i718992d6i422451f4b7f9931@mail.gmail.com \
    --to=aravindakidambi@gmail.com \
    --cc=gdb@sourceware.org \
    /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