From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13860 invoked by alias); 9 Jan 2008 10:50:45 -0000 Received: (qmail 13850 invoked by uid 22791); 9 Jan 2008 10:50:43 -0000 X-Spam-Check-By: sourceware.org Received: from s200aog17.obsmtp.com (HELO s200aog17.obsmtp.com) (207.126.144.131) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 10:50:21 +0000 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob017.postini.com ([207.126.147.11]) with SMTP; Wed, 09 Jan 2008 10:50:18 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B055ADA65; Wed, 9 Jan 2008 10:50:17 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6C82D4BEEE; Wed, 9 Jan 2008 10:50:17 +0000 (GMT) Received: from [164.129.12.194] (bri0669.bri.st.com [164.129.12.194]) by mail1.bri.st.com (MOS 3.7.5a-GA) with ESMTP id CJO55558 (AUTH stubbsa); Wed, 9 Jan 2008 10:50:16 GMT Message-ID: <4784A6E8.7090209@st.com> Date: Wed, 09 Jan 2008 10:50:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "'ranjith kumar'" Cc: gdb@sourceware.org Subject: Re: printing a string References: <509320.35245.qm@web27407.mail.ukl.yahoo.com> <003701c8520c$2842c9d0$2e08a8c0@CAM.ARTIMI.COM> In-Reply-To: <003701c8520c$2842c9d0$2e08a8c0@CAM.ARTIMI.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2008-01/txt/msg00056.txt.bz2 Dave Korn wrote: > On 08 January 2008 06:06, ranjith kumar wrote: > >> I know that a variable can be print in gdb by >> "print var". >> >> But how to print a string??? > > "print" will display a string, if you're printing a variable of type "char > *", or a std::string. > > Or you can use "x" (examine) with the "/s" modifier if you just have a > memory address. Or, if your string is to long, or x/s is too ugly: printf "%s\n", mystring Andrew