From: "Dave Korn" <dave.korn@artimi.com>
To: "'JS'" <fedevaps@yahoo.dk>
Cc: <gdb@sources.redhat.com>
Subject: RE: Print variable with gdb??
Date: Wed, 30 Mar 2005 10:22:00 -0000 [thread overview]
Message-ID: <SERRANOqcRonq0Xpaur0000000c@SERRANO.CAM.ARTIMI.COM> (raw)
In-Reply-To: <424A71F7.2090407@netspace.net.au>
----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....
prev parent reply other threads:[~2005-03-30 10:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-30 9:19 JS
2005-03-30 9:28 ` Russell Shaw
2005-03-30 10:22 ` Dave Korn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SERRANOqcRonq0Xpaur0000000c@SERRANO.CAM.ARTIMI.COM \
--to=dave.korn@artimi.com \
--cc=fedevaps@yahoo.dk \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox