TRACE order problems

We have developped a gateway application for a M1306B and we have this problem:

The traces that we send to the Target Monitor with TRACE are shown in different sequence that the one used to create them. For example:

TRACE ((1,“aaa”);

(…)

TRACE ((2,“sss”));

(…)

TRACE ((1,“kdkdk”));

This sequence is shown in Target Monitor as follows:

sss
aaa
kdkdk

With this problem is really hard to debug the sequence that the software is doing. There is a way to flush the TRACE buffer or something like this to sort the traces with the right timing?

Thanks in advance.

Fixed. Was a bug in a recursive call. The traces are show in the right order now, thanks.

Thread can be closed.