This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

stack backtrace in sys/bios6

Other Parts Discussed in Thread: SYSBIOS

Hi

I'm wonder how I get hold of the call stack for the running task in SYS/BIOS6 when I get an exception?

BR

Niklas

  • For which supported device/core are you asking? For C6x and arm devices, you can plug the PC and SP values reported by the exception into the CCS register view and get an idea of where the exception occurred. The debug window will show a stack back trace.

     

    Alan

  • It's on a C674x core on a DRA6xx device. I would like to get hold of the call stack on target (without a JTAG connection to CCS), so that I can store it for later retrieval

     

    Niklas

  • Programmatically, you can add a hook function to the ti.sysbios.family.c64p.Exception module that will get called within the internal exception handler:

        var Exception = xdc.useModule("ti.sysbios.family.c64p.Exception");

        Exception.internalHook = '&myExceptionHook';

    within myExceptionHook(), you can obtain all of the exception context using something like below:

    Void myExceptionHook(Void)
    {
        Exception_Status status;
        Ptr a31, a30;
        Ptr b31, b30;

        Exception_getLastStatus(&status);

        a31 = status.excContext->A31;
        a30 = status.excContext->A30;
        b31 = status.excContext->B31;
        b30 = status.excContext->B30;
    }

    See the CDOC for the Exception module within your BIOS installation.

    Alan

  • OK, so this means that I have to unwind the running task's stack by my self? SYS/BIOS contains no helper functions for this?

    Can you assist me in where to find details on how the compiler generates the call frame on the task's stack, register allocation (which CPU register that functions as a frame pointer), and compiler switches that might affect how the callframe is generated?

    BR

    Niklas

     

  • Currently, BIOS provides no stack back trace support. However, TI has an offline tool available that might help you. There’s a crash dump wiki page available here: http://processors.wiki.ti.com/index.php/Crash_Dump_Analysis  It’s currently describing how to take saved dump information and convert it into a format that CCS can understand and to use that to print out a call stack.  The technique described requires accurate register data at the time of the crash.

  • Thanks for your tip!

     

    However, new questions arise when reading that wiki.  It says I should have a file: "\ccsv4\scripting\examples\DebugServerExamples\ExampleCrashDump.txt" in my CCS installation directory as well as file "\ccsv4\scripting\examples\DebugServerExamples\CrashDumpAnalysis (64+).ccxml."  None of those exists in my installation directory.

    Also, the wiki is vague on what memory I need to dump. Is the task stack enough?

     

    BR

    Niklas

  • Hmm... Seems like we need to upgrade to a newer version of CCS4. These files aren't present in my installation either. I'll look into this.

  • Hi again

    tried using the snapshot viewer target, and loaded my symbols, got the following response

    C674X_0: Trouble Setting Breakpoint with the Action "Process CIO" at 0xcc9d85b8: This operation is not supported by this driver
    C674X_0: Trouble Setting Breakpoint with the Action "Terminate Program Execution" at 0xcc9d9b60: This operation is not supported by this driver
    C674X_0: Trouble Setting Breakpoint with the Action "Terminate Program Execution" at 0xcc9d9b60: This operation is not supported by this driver

    next, tried with a simple Crashlog.txt (just setting register A15 to 0x23 on my C674x target) in the scripting window: Crashlog.txt look like this

    521177 103
    R A15 0x0000000B 0x00000023

    In the scripting window, I get the following reply

    js:> eval "GEL_SystemRestoreState(\"c:\\RMC_code\\RMC_PLUS\\Crashlog.txt\")"

    Error evaluating "GEL_SystemRestoreState("c:\RMC_code\RMC_PLUS\Crashlog.txt")": Timed out after 60000ms (C:\Program Files\Texas Instruments\ccsv4\eclipse\configuration\org.eclipse.osgi\bundles\119\1\.cp\resources\debugserver\expression.js#10

     

     

    So I can't get it working at all here

     

    Br

    Niklas

     

     

  • Niklas,

    Because of the earlier breakpoint errors you saw, I believe you're not using CCS 4.2 or later (or at least you're not using the RTM release, but an earlier beta or something).  Would you be able to update your version of CCS?

    As for why it times out, I don't know.  I tried a data file with just include one register and no memory data, and it returned fairly quickly for me.  If you upgrade and still have the same issue, could you collect the debugger logs and attach them to this thread?  The procedure is described here: http://processors.wiki.ti.com/index.php/Troubleshooting_CCS#Debug_Server_Logging

    Darian

  • In the CCSv4.2 you should include exception module with exception printout option switched on.

     

    var ti_sysbios_family_c64p_Exception = xdc.useModule("ti.sysbios.family.c64p.Exception");
    ti_sysbios_family_c64p_Exception.enablePrint = true;

     

    When exception occurs you would see in console window registers printout.

    You should insert B3 content to PC register and B15 content to SP register in the registers window.

    In the debug window you would see call stack backtrace

    It works with C6747 and ti.sysbios.family.c64p.Exception module

    Best regards,

    Yuriy