[OT - gdb-specific] Re: Print variable with gdb??
From: Anthony Borla (ajborla_at_bigpond.com)
Date: 03/30/05
- Next message: wwwolf: "How do I do something every x increment in time?"
- Previous message: Mark P: "Re: Print variable with gdb??"
- In reply to: JS: "Print variable with gdb??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Mar 2005 00:01:55 GMT
"JS" <d44sf@44ada.com> wrote in message
news:d2ck1b$kol$1@news.net.uni-c.dk...
> 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!
>
Things to check:
* Compiled with -g switch
* Correct file name [correct case, and extension if any]
specified e.g. gdb myFile.exe, and file is loaded i.e. the
preamble display appears
* Symbol file has been loaded i.e. it has not been been
deleted [should say so on preamble display]
* Set breakpoint at 'main' e.g. after loading file, issue:
break main
command
* In 'stepping through' the executable you are currently
in a context in which 'i' exists i.e. it is in scope
You may wish to access the 'man' page documention ['man gdb'], or the 'help'
command within gdb, or perhaps search for a gdb tutorial, for more
information
I hope this helps.
Anthony Borla
- Next message: wwwolf: "How do I do something every x increment in time?"
- Previous message: Mark P: "Re: Print variable with gdb??"
- In reply to: JS: "Print variable with gdb??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|