PER Bit Tracing

To print out a bit trace using ASN1C, invoke the appropriate functions after encoding or decoding a message and a marked-up binary dump of the PER encoded data is produced.

To enable bit tracing logic to be embedded in the generated code, the -trace option needs to be specified on the ASN1C command-line. If using the GUI, the Add tracing diagnostic messages to code box must be checked under the 'Constraints and Debugging' tab.

If enabled, a display similar to the following will be printed out from within the Marshal or Unmarshal function:


        Dump of decoded bit fields:
        employee childrenPresent
        1xxxxxxx -------- -------- --------    80------    .---
                
        employee.name.givenName length
        -------- 00000100 -------- --------    --04----    -.--
                
        employee.name.givenName data
        -------- -------- 01001010 01101111    ----4a6f    --Jo
        01101000 01101110 -------- --------    686e----    hn--                
      

Here, a description can be seen of the field that was decoded, followed by 4 columns of a base 2 representation of the relevant input data, followed by a column with a hexadecimal representation of the same data, followed by a column with an ASCII representation of the same data. The hexadecimal and ASCII representations are only printed after all bits for a full byte have been processed, so these representations might not be printed on every line, and when they are printed, might correspond to binary bits on several preceeding lines.

The x values indicate padding bits used in aligned PER.