Debugging data field

Hi,

I'm trying to debug my data field, but am having problems. I downloaded the new SDK v.1.1.2 and ran my field on the simulator: it works fine.
I then side-loaded the field on my Fenix3 through the "Build project for device" option in Eclipse. Whenever I run the Bike app I'm presented with the CIQ crash symbol (with exclamation mark). I looked up the CIQ_LOG.txt and it contains the following:

@PC = 0x100003CB
@PC = 0x100006F2
TVM ERROR:
Unexpected Type Error
Failed invoking <symbol>


Interestingly it does load the data field when I go through Settings --> Apps --> Bike --> Data Fields --> Screen 1 --> Layout
Also, the field used to work on SDK 1.1.1; the problems started after updating to 1.1.2

Any ideas as to what the problem could be and/or how do I proceed from here?

Thanks in advance!
  • Anybody? I know that apparently I'm performing an operation on a type that doesn't support it, but it would be so much easier to find the problem if I knew where to look..

    Thanks for any help..
  • Should I be able to make a debug configuration? Connect IQ is not available under debug configurations. Should it be?

  • Former Member
    Former Member over 10 years ago
    You should be able to find the "@PC = 0xXXXXXXXX" in the <app name>.debug.xml file in your bin folder. There's an entry in that file that will map the PC value to a line number. The stack trace not automatically doing that just means there wasn't enough memory to build a "pretty" stack trace.
  • You should be able to find the "@PC = 0xXXXXXXXX" in the <app name>.debug.xml file in your bin folder. There's an entry in that file that will map the PC value to a line number. The stack trace not automatically doing that just means there wasn't enough memory to build a "pretty" stack trace.


    Should convert the 0xXXXXXXXX in some way? My debug xml looks like this:
    <entry filename="/Users/lfanchi/Development/Eclipse/workspaces/RideData/source/RideDataView.mc" lineNum="22" pc="268435464" symbol="drawLines"/>
    <entry filename="/Users/lfanchi/Development/Eclipse/workspaces/RideData/source/RideDataView.mc" lineNum="24" pc="268435490" symbol="drawLines"/>
  • Convert from Hex to Decimial.

    0x100003CB in hex is 268436427 in decimal

    Then find the closest pc="268435490" number in the debug.xml file to find the line number of the offending code.
  • Convert from Hex to Decimial.

    0x100003CB in hex is 268436427 in decimal

    Then find the closest pc="268435490" number in the debug.xml file to find the line number of the offending code.


    Thank you both for your help so far!

    Could you please explain why the following code doesn't work? I stripped all of the code from my, previously working, data field.
    The following code crashes when starting the Bike app:
    using Toybox.WatchUi as Ui;
    using Toybox.Graphics as Gfx;
    using Toybox.System as Sys;
    using Toybox.Time as Time;

    class TestDataView extends Ui.DataField {

    var secElaps;

    function initialize(){
    // Sys.println("");
    }

    function onLayout(dc){
    }

    function onUpdate(dc) {
    View.onUpdate(dc);
    // set the view background to white
    dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_WHITE);
    dc.clear();
    // set the color for the text
    dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_TRANSPARENT);
    // update elapsed time
    dc.drawText(180, 43, Gfx.FONT_NUMBER_MILD, secElaps, Gfx.TEXT_JUSTIFY_LEFT);
    }

    function compute(info) {
    // Get elapsed time and convert
    if(info.timerTime!=null){
    secElaps = (info.timerTime/1000).format("%02d");
    return(secElaps);
    }
    else{
    secElaps=0.format("%02d");
    return(secElaps);
    }
    }
    }


    It's been driving me crazy! Why doesn't this work?
  • if onUpdate() is called before compute() has been called secElaps will be null and not a string.

    where you have var secElaps; try var secElaps=""; or set it to "" in initialize().
  • if onUpdate() is called before compute() has been called secElaps will be null and not a string.

    where you have var secElaps; try var secElaps=""; or set it to "" in initialize().


    Thank you, I will try when I get home from work! One more Q though:
    Since I'm checking for !=null, shouldn't this not be an issue? Or am I missing something?

    Edit:
    Okay, I see what you mean now! I will set a value when I initialize!
  • The PC-to-debug.xml translation process seems like a good thing to have documented. I've created a case to have this added to the programmer's guide at some point.
  • The PC-to-debug.xml translation process seems like a good thing to have documented. I've created a case to have this added to the programmer's guide at some point.


    As the dump has the PC in hex, it might also be good if the xml had the PC in hex, so people don't have to do hex to decimal conversions to read them.