Author Topic: Plotting variables during debug?  (Read 6734 times)

Offline ScotlandTheScared

  • Single posting newcomer
  • *
  • Posts: 3
Plotting variables during debug?
« on: April 14, 2011, 11:04:34 am »
Hi - I am new to code::blocks. I am wondering if there is any way to plot a graph of a 1-dimensional array (i.e. list) variable when I stop at breakpoints during debug?

Any help would be much appreciated.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Plotting variables during debug?
« Reply #1 on: April 14, 2011, 11:19:16 am »
I don't think there is a way to do it inside codeblocks.
Newer gdbs have python scripting support, so probably you can do it inside a python pretty printer or you could define a plot command in python.

I think, you could write the values to a file and then use gnuplot to generate the image.

Then in c::b you can send this command "python my_plot myvar" to gdb.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ScotlandTheScared

  • Single posting newcomer
  • *
  • Posts: 3
Re: Plotting variables during debug?
« Reply #2 on: April 14, 2011, 02:24:47 pm »
Thanks - shame there seems to be no easy way of doing this. I dont want to have to write out any data to files - that is extremely clunky. And I have no idea how to run a python script from within the debugger anyway. I really am not a good programmer. I am trying to debug someone else's program - I have previously simply managed to find errors without using a debugger, but its proving difficult this time, hence the need for a debugger that can allow me to view a plot of an array.

Anyone else got anything that might help? I'm running on ubuntu 10.10.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Plotting variables during debug?
« Reply #3 on: April 14, 2011, 03:53:57 pm »
look at this as a reference.
http://code.google.com/p/qp-gcc/wiki/GDB
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ScotlandTheScared

  • Single posting newcomer
  • *
  • Posts: 3
Re: Plotting variables during debug?
« Reply #4 on: April 14, 2011, 05:12:42 pm »
Thanks - but being a novice programmer this is getting beyond me. I had just hoped that code::blocks might provide something build-in already so that I can view a 1D array/list. I'm generating these in fortran and I can print the variables to the screen. But the size of the arrays (length=1000) mean a graph would be far more useful.

The inclusion of something like this would open up code::blocks as a debugger for a lot of people I know where array processing is the bread and butter of their work.

Offline m.29

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: Plotting variables during debug?
« Reply #5 on: April 14, 2011, 09:06:44 pm »
You can try DDD on Ubuntu.
Windows XP SP3, wxWidgets 2.8.11, C::B DEBUGGER BRANCH nightly builds