From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15300 invoked by alias); 30 Jul 2003 11:47:45 -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 15273 invoked from network); 30 Jul 2003 11:47:44 -0000 Received: from unknown (HELO blues) (217.26.192.93) by sources.redhat.com with SMTP; 30 Jul 2003 11:47:44 -0000 Received: from madwaves.com (193.251.10.44) by blues with MERCUR Mailserver (v4.02.11 MTY0NzMtNjE1MC00ODc3) for ; Wed, 30 Jul 2003 13:06:06 +0200 Date: Wed, 30 Jul 2003 11:47:00 -0000 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: User-defined macros and C string From: Daniel Chiaramello To: gdb@sources.redhat.com Content-Transfer-Encoding: 7bit Message-Id: X-SW-Source: 2003-07/txt/msg00338.txt.bz2 Hi gdb gurus. Well, I'm a total gdb newbie, so sorry if the question sounds stupid... I failed to find a forum on which I could post it, so... Here is it! I try to define a user-defined macro, to display parameters used when a specific function is called. IE there a the following function: void dosomething (long theValue, char *theString) {...} I want to put a breakpoint on that function and display a line like that: "dosomething(10, "coucou");\n" each time that function is called. Of course, that function is not in my code, and the caller is not either. I tried the following: define DisplayFunctionCall echo dosomething( output $r3 output , \" output $r4 echo \");\n end I planned to put a breakpoint at the function entrance, and then execute my macro: b * command $bpnum > DisplayFunctionCall > continue > end But the output I get is: dosomething(0, "145ae0"); dosomething(1, "145be0"); dosomething(2, "145ce0"); dosomething(3, "145de0"); ie the content of the r4 register (I'm on a PowerPC machine) is not dumped as a C string, but its value is displayed... Is there a way to display the C string pointed to by r4, in its simplest form, ie only the C string? x/s $r4 displays the C string, but also its address as well as the estimated position in a function... echo $r4 displays a "$r4" string... I hope you understand what I am trying to do... Thanks for your attention, Daniel, aka Souricette