OpenCores
no use no use 1/1 no use no use
How to print local variables using GDB
by avamsi on Jun 4, 2012
avamsi
Posts: 54
Joined: Apr 16, 2012
Last seen: Jul 30, 2014
Hi,
or32-elf-gdb could print the global variable's values during debug process. But it could not print the local variables with in the functions though the control stays in that context. I tried with the file name (melloctest.c) syntax also like

(gdb) p melloctest:x
No symbol "melloctest" in current context.
(gdb) print x
No symbol "x" in current context.


Can any one suggest the commands to print the local variables on or32-elf-gdb.

Thanks,
A.Vamsi
RE: How to print local variables using GDB
by jeremybennett on Jun 5, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi A Vamsi,

have you compiled your code with -g? Without the DWARF2 debug info, gdb cannot find out about local variables.

If it still does not work, please post a full testcase - program, command line and the commands you used in GDB.

HTH,

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com

no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.