News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Trace and log values of a variable with GDB

Started by Martin1987, September 07, 2013, 03:20:53 PM

Previous topic - Next topic

Martin1987

Hi,

I am not an experienced programmer but I recently have to check a C code translated from Matlab, in order to ensure that with the same data set, C and Matlab are giving the identical results.

Watches are what I am able to use until now but that requires me to sit in front of the screen and watch the values of a variable change at each loop. Is there a way to trace and log the values of a variable into a .txt file so that I can plot it later to compare with the results from Matlab?  ???

I have already tried to write the values into some .txt file with 'fwrite' but there is not the ideal solution as I have to do that in the C code that I want to check.  :-[  I am currently reading about tracepoint of gdb and will try to use that but I am still unsure if that is what I need. If you have some tips about what else I try.

Thanks!  :)

oBFusCATed

As far as I know you need tracepoints for this, but they are not natively supported by C::B, so you'll either have to manually set them up (entering commands by hand) or you'll have to use a gdb script which you can source, with the "source" gdb command in the initial commands or manually.
(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!]