From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21524 invoked by alias); 5 Dec 2001 10:11:23 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21438 invoked from network); 5 Dec 2001 10:11:18 -0000 Received: from unknown (HELO fja.de) (194.120.150.20) by sources.redhat.com with SMTP; 5 Dec 2001 10:11:18 -0000 Received: from muc.fja.de (susi02.muc.fja.de [172.16.40.16]) by fja.de (8.11.6/8.11.6) with ESMTP id fB5ABH219962 for ; Wed, 5 Dec 2001 11:11:17 +0100 Received: from MUC-SERVER7.muc.fja.de (node1.muc.fja.de [172.16.30.61]) by muc.fja.de (8.11.6/8.11.6) with ESMTP id fB5A51K20272 for ; Wed, 5 Dec 2001 11:05:01 +0100 Received: by muc-server7.muc.fja.de with Internet Mail Service (5.5.2650.21) id ; Wed, 5 Dec 2001 11:06:52 +0100 Message-ID: <6380966D8BCFD5119C9300306E1C8487057727@clg-server7.clg.fja.de> From: "Howind Axel, Externer Dienstleister" To: "'gdb@sources.redhat.com'" Subject: expanding c-macros in gdb Date: Wed, 05 Dec 2001 02:11:00 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-SW-Source: 2001-12/txt/msg00025.txt.bz2 Hello, we are using gcc/gdb for development in C. The C code uses some macros for accessing data, for example: #define REFP_XYZ(i) xyz_ptr->s_xyz.r_xyz[i].xyz ... if (REFP_XYZ(a).abc != 0) ... ... Is there a way to make gdb understand that the command print REFP_XYZ(a).abc is the same as print xyz_ptr->s_xyz.r_xyz[i].xyz.abc? I have read in the gcc manual that compiling with -g3 stores information about all defined macros, so that "Some debuggers support macro expansion when you use `-g3'." This does not seem to work with gdb (gcc 2.95.2, gdb 5.0, on HP-UX 10.20). Then I thought about defining a macro printmac in gdb, but I have not found a way to do the expansion. What I'm thinking about is to call a shell- or sed-skript that does the expansion and pass the result on to the print command, something like this (transform is the name of a sed-script, that does the actual expansion): define printmac(arg) print `echo $arg | sed -f transform` Is something like this possible in gdb? Can I use a hook? Thanks in advance, Axel Howind