From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10283 invoked by alias); 24 Dec 2009 20:47:32 -0000 Received: (qmail 10274 invoked by uid 22791); 24 Dec 2009 20:47:31 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-qy0-f180.google.com (HELO mail-qy0-f180.google.com) (209.85.221.180) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Dec 2009 20:47:27 +0000 Received: by qyk10 with SMTP id 10so4425550qyk.12 for ; Thu, 24 Dec 2009 12:47:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.43.68 with SMTP id v4mr5305481qce.95.1261687646169; Thu, 24 Dec 2009 12:47:26 -0800 (PST) From: Aravinda Date: Thu, 24 Dec 2009 20:47:00 -0000 Message-ID: <26eb53620912241247i718992d6i422451f4b7f9931@mail.gmail.com> Subject: Problem with manual watchpoints To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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 X-SW-Source: 2009-12/txt/msg00150.txt.bz2 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