From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28646 invoked by alias); 21 Jun 2006 15:28:18 -0000 Received: (qmail 28636 invoked by uid 22791); 21 Jun 2006 15:28:17 -0000 X-Spam-Check-By: sourceware.org Received: from web80332.mail.yahoo.com (HELO web80332.mail.yahoo.com) (66.94.235.44) by sourceware.org (qpsmtpd/0.31) with SMTP; Wed, 21 Jun 2006 15:28:13 +0000 Received: (qmail 56443 invoked by uid 60001); 21 Jun 2006 15:28:10 -0000 Message-ID: <20060621152810.56441.qmail@web80332.mail.yahoo.com> Received: from [192.249.47.9] by web80332.mail.yahoo.com via HTTP; Wed, 21 Jun 2006 08:28:10 PDT Date: Wed, 21 Jun 2006 15:31:00 -0000 From: Ron McCall Subject: Hacking gdbserver to capture instruction-level code coverage To: gdb@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00174.txt.bz2 Hi, I have attempted to hack gdbserver 6.5 to log instruction-level code coverage on a powerpc-linux system and it seems to work except that examining variables is broken as a result. Turning on remote debugging in gdb and comparing a run using an unmodified gdbserver and the modified gdbserver seems to show a difference with the DBAT0 register mapping in the 'g' packet responses. It would seem that my changes have somehow violated something and perhaps has confused the Linux kernel? More specifically, I have changed handle_v_cont() in server.c to do a repeated single step rather than a continue. I let the resume_info get built as usual (and only once), except in the 'c' or 'C' case where I set resume_info[i].step=1 (since we'll be stepping repeatedly instead). Then, at the bottom of the function, I loop repeatedly, resuming the inferior, waiting for it to stop, getting the PC of the inferior and logging it, and then determining whether to repeat or break out of the loop (based on whether we are single stepping, continuing or there's a breakpoint at the current PC location). After the loop, I free the resume_info and prepare the resume reply as usual. Does any of this sound particularly evil? I can provide the small patch against the 6.5 source if anyone needs to see the changes in more detail. Thanks! Ron McCall