7.9.1.25. GEL Debugging

When a run time error occurs, GEL outputs a detail error message with full call stack. For example:

Test.gel:

foo_cmd2( )
{
   foo_cmd();
}

cmd()
{
   foo_cmd4();
}

Test2.gel:

foo_cmd5( )
{
   foo_cmd2();
}

foo_cmd4( )
{
   foo_cmd7();
}

Test3.gel:

foo_cmd7( )
{
   foo_cmd5();
}

foo_cmd()
{
   GEL_TextOut( "address of cmd = %x\n", 0, 0, 0, 0, &cmd2 );
}

Evaluating cmd() in the CCS scripting console, the user will get:

 js:> eval('cmd()')
    Error evaluating "cmd()": identifier not found: cmd2
        at GEL_TextOut("address of cmd = %x\n", 0, 0, 0, 0, &(cmd2)) [test3.gel:8]
        at foo_cmd() [test.gel:3]
        at foo_cmd2() [test2.gel:3]
        at foo_cmd5() [test3.gel:3]
        at foo_cmd7() [test2.gel:8]
        at foo_cmd4() [test.gel:8]
        at cmd()
(C:\ti\ccs\eclipse\configuration\org.eclipse.osgi\bundles\361\1\.cp\resources\debugserver\expression.js#10)
js:>

7.9.1.25.1. GEL_Trace

This feature allows you trace the execution of GEL scripts. You can control the feature by executing the GEL builtin function GEL_Trace( level )

where level is an integer 0, 1 or 2.
  • 0 – no trace (default value)
  • 1 – trace entry/exit of GEL functions
  • 2 – trace execution of each statement in the functions (including entry/exit)

By default, the trace will be sent to the CCS console. You can redirect the output using GEL_EnableFileOutput and GEL_DisableFileOutput. The following are some trace examples.

Tracing the GEL execution during the target launch:

:: highlight: console

Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:23 Enter function StartUp Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:25 GEL_LoadGel(“$(GEL_file_dir)/CortexM3_util.gel”) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:27 GEL_MapOff() Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:28 GEL_MapReset() Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:29 GEL_MapOn() Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:30 F28M35H52C1_Memory_Map() Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:73 Enter function F28M35H52C1_Memory_Map Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:100 GEL_MapAddStr(0x0, 0, 0x10000, “R”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:101 GEL_MapAddStr(0x200000, 0, 0x80000, “R”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:102 GEL_MapAddStr(0x600000, 0, 0x10000, “R”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:103 GEL_MapAddStr(0x680000, 0, 0x00800, “R”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:104 GEL_MapAddStr(0x680800, 0, 0x00004, “R”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:241 GEL_MapAddStr(0xE000E000, 0, 0x1000, “R|W”, 0) Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:243 GEL_TextOut(“Memory Map Initialization Completen”) Cortex_M3_0: GEL Output: Memory Map Initialization Complete Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:243 Leave function F28M35H52C1_Memory_Map Cortex_M3_0: GEL Trace: f28m35h52c1_m3.gel:30 Leave function StartUp C28xx_0: GEL Trace: f28m35h52c1_c28.gel:21 Enter function StartUp C28xx_0: GEL Trace: f28m35h52c1_c28.gel:0 Leave function StartUp

Tracing the GEL callbacks:

:: highlight: console

TMS470R2x_0: GEL Trace: ccs_modsyms.gel:65 Enter function OnHalt TMS470R2x_0: GEL Trace: ccs_modsyms.gel:66 GEL_TextOut(“Halted!!!n”) TMS470R2x_0: GEL Output: Halted!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:66 Leave function OnHalt TMS470R2x_0: GEL Trace: ccs_modsyms.gel:65 Enter function OnHalt TMS470R2x_0: GEL Trace: ccs_modsyms.gel:66 GEL_TextOut(“Halted!!!n”) TMS470R2x_0: GEL Output: Halted!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:66 Leave function OnHalt TMS470R2x_0: GEL Trace: ccs_modsyms.gel:6 Enter function load_module_symbol TMS470R2x_0: GEL Trace: ccs_modsyms.gel:7 GEL_TextOut(“Loading C:/Users/Documents/ptzfi.kon”) TMS470R2x_0: GEL Output: Loading C:/Users/Documents/ptzfi.ko TMS470R2x_0: GEL Trace: ccs_modsyms.gel:12 GEL_TextOut(“Relocate section .bss to 0xbf015964n”) TMS470R2x_0: GEL Output: Relocate section .bss to 0xbf015964 TMS470R2x_0: GEL Trace: ccs_modsyms.gel:13 GEL_SymbolShowSection(“C:/Users/Documents/ptzfi.ko”, “.bss”, 0xbf015964, 0xbf015964) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:14 GEL_TextOut(“Relocate section .data to 0xbf015208n”) TMS470R2x_0: GEL Output: Relocate section .data to 0xbf015208 TMS470R2x_0: GEL Trace: ccs_modsyms.gel:15 GEL_SymbolShowSection(“C:/Users/Documents/ptzfi.ko”, “.data”, 0xbf015208, 0xbf015208) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:16 GEL_TextOut(“Relocate section .data..cacheline_aligned to 0xbf015800n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:83 Enter function OnFileLoaded TMS470R2x_0: GEL Trace: ccs_modsyms.gel:83 Enter function OnFileLoaded TMS470R2x_0: GEL Trace: ccs_modsyms.gel:83 Enter function OnFileLoaded TMS470R2x_0: GEL Trace: ccs_modsyms.gel:83 Enter function OnFileLoaded TMS470R2x_0: GEL Trace: ccs_modsyms.gel:83 Enter function OnFileLoaded TMS470R2x_0: GEL Output: Relocate section .data..cacheline_aligned to 0xbf015800 TMS470R2x_0: GEL Trace: ccs_modsyms.gel:17 GEL_SymbolShowSection(“C:/Users/Documents/ptzfi.ko”, “.data..cacheline_aligned”, 0xbf015800, 0xbf015800) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 GEL_TextOut(“OnFileLoaded!!!n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 GEL_TextOut(“OnFileLoaded!!!n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 GEL_TextOut(“OnFileLoaded!!!n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 GEL_TextOut(“OnFileLoaded!!!n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 GEL_TextOut(“OnFileLoaded!!!n”) TMS470R2x_0: GEL Trace: ccs_modsyms.gel:18 GEL_TextOut(“Relocate section .exit.text to 0xbf01268cn”) TMS470R2x_0: GEL Output: OnFileLoaded!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 Leave function OnFileLoaded TMS470R2x_0: GEL Output: OnFileLoaded!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 Leave function OnFileLoaded TMS470R2x_0: GEL Output: OnFileLoaded!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 Leave function OnFileLoaded TMS470R2x_0: GEL Output: OnFileLoaded!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 Leave function OnFileLoaded TMS470R2x_0: GEL Output: OnFileLoaded!!! TMS470R2x_0: GEL Trace: ccs_modsyms.gel:84 Leave function OnFileLoaded