Skip to main content
Visitor II
September 11, 2014
Question

STVD (/w COMSIC Compiler) not able to debug double / float datatype

  • September 11, 2014
  • 6 replies
  • 1287 views
Posted on September 11, 2014 at 08:20

Hello all,

I`m having some issues using the double or float datatype in STVD with the COSMIC C compiler.

I am able to declare those data types but when i start debugging and would like to watch the varibles, STVD shows weird values. for example the simple division  5.0 / 3.0 resolutes in 1,...E-37 which is something like 0.

Using float data type has the same effect.

I was using break points and the command 'quick watch'.

Dennis
    This topic has been closed for replies.

    6 replies

    Visitor II
    September 12, 2014
    Posted on September 12, 2014 at 06:35

    Hello ,

    Please try this(Image atached).

    and Display item :Standard(After right click on the Display item in WATCH).

    Thanks& Regards,

    Balmukund Prasad

    ________________

    Attachments :

    stvd1.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htrk&d=%2Fa%2F0X0000000aY5%2FVR2TZqKCIJtg3UcZDOz0t2NM9NJXh0bBk8kEaBOuQF8&asPdf=false
    Visitor II
    September 15, 2014
    Posted on September 15, 2014 at 08:07

    Hey,

    thanks. Yeah this doesn`t work :(

    Dennis

    Visitor II
    September 15, 2014
    Posted on September 15, 2014 at 09:49

    if you post a small bit of code I can take a look with another debugger: that will allow to determine if it's an issue with the code (or the linker file / linked libraries), the compiler, or the debugger.

    Regards,

    Luca (Cosmic)

    Visitor II
    October 9, 2014
    Posted on October 09, 2014 at 16:09

    Hello Luca,

    not even simple programs work. For example:

    main(){

    double test = 0.0;

    test = 5 / 3;

    }

    And watching this variable test shows the same ...

    Thanks.

    Visitor II
    October 10, 2014
    Posted on October 10, 2014 at 10:59

    Hello,

    as it is posted, your division will return 1.0, as it makes 5/3 as an integer division and then assigns the result to a float variable. If you add a cast, implicit or explicit

    test = 5.0 / 3.0;

    it works ok on my simulator/debugger.

    Also take care of the fact that, with very simple examples, some variables that are never used later are just optimized away by the compiler.

    I suggest you try the following

    main(){

    volatile float test = 0.0;

    test = 5.0 / 3.0;

    }

    It works ok on my PC (zap debugger): if it still does not work for you I can try to get a copy of STVD and see where it goes wrong.

    Visitor II
    November 4, 2014
    Posted on November 04, 2014 at 13:02

    Hi Luca,

    thanks for your reply.

    In this case it was my fault and everything is going fine.

    Thanks!