From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19654 invoked by alias); 30 Mar 2005 10:22:14 -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 19217 invoked from network); 30 Mar 2005 10:21:32 -0000 Received: from unknown (HELO SERRANO.CAM.ARTIMI.COM) (217.40.213.68) by sourceware.org with SMTP; 30 Mar 2005 10:21:32 -0000 Received: from 127.0.0.1 (AVG SMTP 7.0.308 [266.8.6]); Wed, 30 Mar 2005 11:21:30 +0100 Received: from mace ([192.168.1.25]) by SERRANO.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.211); Wed, 30 Mar 2005 11:21:24 +0100 From: "Dave Korn" To: "'JS'" Cc: Subject: RE: Print variable with gdb?? Date: Wed, 30 Mar 2005 10:22:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <424A71F7.2090407@netspace.net.au> Message-ID: X-OriginalArrivalTime: 30 Mar 2005 10:21:24.0874 (UTC) FILETIME=[3A00C6A0:01C53512] X-SW-Source: 2005-03/txt/msg00299.txt.bz2 ----Original Message---- >From: Russell Shaw >Sent: 30 March 2005 10:32 > JS wrote: >> I have: >> >> int p = 5; >> >> when I debug my code I would like to get a print of p's value therefore >> I start gdb and type: >> >> print p >> >> but then I get an error that the variable does not exists! >> >> Hope someone can help! >> >> JS > > Type "start" so it runs to main(). print p should work if > p is in scope. Or perhaps p has been optimised away by the compiler? Be sure and compile with -O0 so that what you're debugging bears the simplest and most direct relationship to the source code. cheers, DaveK -- Can't think of a witty .sigline today....