This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Still cannot print variable


JS <fedevaps@yahoo.dk> writes:


> I run "gdb test" followed by "print d" and then I get this error:

You must explicitly start test with the run command from gdb:

bash% gdb test
<...>
(gdb) run


However, that is also not enough because the current program will
immediately complete, and hence when you get back to the (gdb) prompt
the context of the (no longer) running program is void. Hence you must
set a breakpoint to halt the execution:


bash% gdb test
<...>
(gdb) break test.c:5    # Break at line 5 in file test.c
(gdb) run
(gdb) print d



HTH - Joakim

-- 
Joakim Hove
hove AT ift uib no                 /    
Tlf: +47 (55 5)8 27 90            /     Stabburveien 18		 
Fax: +47 (55 5)8 94 40           /      N-5231 Paradis		 
http://www.ift.uib.no/~hove/    /      	55 91 28 18 / 92 68 57 04


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]