Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Martin1987 on September 07, 2013, 03:20:53 pm

Title: Trace and log values of a variable with GDB
Post by: Martin1987 on September 07, 2013, 03:20:53 pm
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!  :)
Title: Re: Trace and log values of a variable with GDB
Post by: oBFusCATed on September 07, 2013, 06:52:50 pm
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.