Code::Blocks Forums

User forums => Help => Topic started by: a6146319 on August 18, 2014, 12:38:52 pm

Title: How to access array elements during debugging C++?
Post by: a6146319 on August 18, 2014, 12:38:52 pm
Hello, I am new to Code::Blocks and have a question in debugging. How I can access array elements during debugging? Things get worse if I cannot access array or matrix elements while using a numerical library, such as eigen. If I create watch, it doesn't show contents or array or matrix.  I read this http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Script_support (http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Script_support) link on debugging with Code::Blocks, but couldn't find what I needed. Any help or comments are very welcome.
BTW, I am using GNU GCC compiler, Code::Blocks 13.12 on Windows.
Title: Re: How to access array elements during debugging C++?
Post by: oBFusCATed on August 18, 2014, 08:03:06 pm
1. Right click -> Properties
2. Enable Treat as array
3. Specify start and count
4. Press Ok and you should be able to see your array
Title: Re: How to access array elements during debugging C++?
Post by: a6146319 on August 19, 2014, 12:27:15 am
Thanks for your reply. What about if I am using a numerical library such as eigen? Your method does not work there. Is there any different way by which I can extract elements of an array or matrix using eigen (or other) library?
Title: Re: How to access array elements during debugging C++?
Post by: oBFusCATed on August 19, 2014, 01:28:59 am
It depends on the library. If you're using new enough GDB you can probably write a python pretty printers for the data structures of your library.