From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25195 invoked by alias); 30 Sep 2008 18:12:32 -0000 Received: (qmail 25187 invoked by uid 22791); 30 Sep 2008 18:12:31 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 30 Sep 2008 18:11:48 +0000 Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw1.br.ibm.com (Postfix) with ESMTP id 6A3D932C137 for ; Tue, 30 Sep 2008 14:40:14 -0300 (BRT) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m8UIBcH4938186 for ; Tue, 30 Sep 2008 15:11:38 -0300 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8UIBid3004544 for ; Tue, 30 Sep 2008 15:11:44 -0300 Received: from [9.18.238.184] (IBM-708585AE534-009018238184.br.ibm.com [9.18.238.184]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m8UIBiei004541 for ; Tue, 30 Sep 2008 15:11:44 -0300 Subject: [PATCH 0/4] 'catch syscall' feature From: =?ISO-8859-1?Q?S=E9rgio?= Durigan =?ISO-8859-1?Q?J=FAnior?= To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 30 Sep 2008 18:12:00 -0000 Message-Id: <1222798405.30389.22.camel@miki> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00583.txt.bz2 Hello guys, As this is my first "serious" patch to GDB, I'm sure there will be a lot of mistakes in it :-). Anyway, I hope this adds something useful to the program. The purpose of this patch is to implement a new feature in GDB called "catch syscall". In this first moment, the feature should look something like the 'strace' utility, but less "capable" (it still can't, for example, get the syscall arguments and return code - although, the way I see, this would be easy to do). With this feature, you can start over you GDB and tell it to start catching syscalls in the inferior. Whenever a syscall is called (or returns), GDB stops and tell you the name of it. You can also ask GDB to "filter" the syscalls so that you'll only see calls/returns from that specific syscall. For now the feature is only implemented for PPC32 and PPC64, but in a future not so distant I intend to send patches for x86 and x86_64 too. I've tried to organize the code the best way I could, and I've extensively used the codes for "catch fork", "catch exec" and "catch unload" as an example. I'd be glad if you could give some opinions about the way I did it :-). I've also splitted the patch into 4 logical "sequences", that are organized in this way: - First part implements the architecture-independent part of the feature. - Second part implements the architecture-dependent (PPC32 and PPC64) part of the feature. - Third part refers to the documentation. - Fourth part brings the testcase. Unfortunately, if one applies the patch and compiles GDB for PPC64, it doesn't work properly. This is due to a bug which we have found that makes the inferior segfault when there is a breakpoint inserted at its entrypoint (AT_ENTRY). Luis Machado is taking a closer look into this issue, so I think he'll have a solution soon :-). Special thanks goes to Thiago Bauermann, Luis Machado and Carlos Seo, who helped me a lot with my never-ending questions about GDB. Regards, -- Sérgio Durigan Júnior Linux on Power Toolchain - Software Engineer Linux Technology Center - LTC IBM Brazil