Menu

COMPILERDEBUG as a parameter in use.ini

Anobium
2024-11-27
2024-11-27
  • Anobium

    Anobium - 2024-11-27

    An interesting hidden feature of the compiler is COMPILERDEBUG.

    The COMPILERDEBUG setting in the USE.INI file for GCBASIC is used to enable or disable debugging features for the compiler. When the bits of the setting COMPILERDEBUG are set to 1, it activates additional debug information during compilation, which can be helpful for developers to diagnose and fix issues.

    I do add more as I delve into the compiler. You can always see the permissible bits for COMPILERDEBUG first opening and closing the PREFERENCES editor, and then edit USE.INI. The help section will display the following:

    'Preferences file for GCBASIC Preferences 3.14
    
    ... lots of help, then
    
    '   compilerdebug =  0  - 1 = COMPILECALCADD 
    '                       - 2 = VAR SET
    '                       - 4 = CALCOPS 
    '                       - 8 = COMPILECALCMULT
    '                       - 16 = AUTOPINDIR 
    '                       - 32 = ADRDX
    '                       - 64 = GCASM
    '                       - 128 = COMPILESUBCALLS
    '                       - 256 = COMPILEUPDATESUBMAP
    

    To see the debug add or edit the [gcbasic] section of USE.INI.

    [gcbasic]
    'change to a bitwise value
    compilerdebug = 0   
    

    As I have already stated. This setting can be helpful for developers to diagnose and fix issues within the compiler.


    I used COMPILERDEBUG very recently to isolate a compiler crash. The root cause was an unchecked assignment to a fixed array. Hugh did not do a lot of checking for constraints. So, using COMPILERDEBUG I was able to isolate quickly where the crash was occurring.

    I hope this insight proves useful.

     
  • jackjames

    jackjames - 2024-11-27

    Wery interesting

     
    • Anobium

      Anobium - 2024-11-27

      To have real fun, and, blow your mind.

      Set the following:

      COMPILERDEBUG  = 1023
      methodstructuredebug = y
      showprogresscounters = y
      verbose = y
      evbs = y
      extendedverbosemessages = y
      

      This will show the method ( sub/functions ) start and end, then
      shows the method maps. then,
      shows all the calls to sub, then.
      show compilation of all subs, then
      shows all calls to subs with parameters, then
      all the calcs, then
      setting of variables, then,
      the state of all the pins.
      then all the ASM converted into Hex.

      There is more shown on more complex program.

      A decent size program can generated 40k lines of debug. Hence, the bitwise settings to focus on specific areas. The standard GLCD calculator test generaets 23k lines of debug. So, see it all.... within GCCode change the settings/SCROLLBACK to 40000, then you press F2/Terminal: Select All, then, you can cut and paste.

      Add I go I will add more and more debug to this capabillty. Meaning this is only showing a small part of what the compiler processes.

      This is pretty hard to use when using SynWrite. But, I only use SynWrite when someone has an issue.

      :-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.