How do I call a function in my code from the debugger?

Comments

7 comments

  • Avatar
    Michael Johnson

    You can call functions from the debug immediate window - don't call functions that use debug_printf.

     

    Regards

    Michael

    0
    Comment actions Permalink
  • Avatar
    Harjit Singh

    I couldn't find any info. in the help file(s) on the debug immediate window, the commands it supports and their syntax.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    C expressions e.g.

    fn(3)

    Regards

    Michael

    0
    Comment actions Permalink
  • Avatar
    Harjit Singh

    I found the Debug Immediate window but when I type in my function name, it doesn't appear to run. I also then tried putting a breakpoint in the routine and the breakpoint doesn't fire.

    Also, is there any documentation on the capabilites and usage of the Immediate window?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Are you stopped on a breakpoint when you type in the expression?

    Breakpoints in the function won't work.

    Try it on a simple function.

    0
    Comment actions Permalink
  • Avatar
    Harjit Singh

    I originally was sitting at a breakpoint and it didn't do anything. I then tried it with the CPU sitting in a loop and for "simple" functions it works.

    I can't get it to work on a function that has debug_fwrite() in it - based on your response of 4/22 above, I assume all debug_* functions won't work?

    My need is that after I've captured data on the robot, I want to ship it over to the PC and wanted to use this mechanism. Any suggestions?

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    None of the debug_ functions work when called from the debugger - we should support this but it's easier said than done.

    You could use the JavaScript console to save the contents of a variable to a file when at a breakpoint

    d = TargetInterface.peekBytes(Debug.evaluate("&var"), Debug.evaluate("sizeof(var)"));

    TargetInterface.writeBinary("c:/tmp/var.bin", d);

     

    Regards

    Michael

    0
    Comment actions Permalink

Please sign in to leave a comment.