Parsing of stderr

Parsing of stderr

1
NewbieNewbie
1

    Aug 26, 2013#1

    Hi,

    I'm new to UEStudio and I am trying to integrate the COSMIC HCS12X compiler. Building works fine, exept of the parsing of the compiler outputs. I expect, that a double click on the outputs line with the error message takes me to the error in the corresponding file and to the wrong line, but it only takes me to the file, not to the line. This is a sample output:

    Code: Select all

    cxs12x -v -i "E:\COSMIC\EVAL12X\HS12x" +hcs +proto main.c
    #error cps12x main.c:40(2+4) klpo undefined
    main.c:
    "cps12x" -o "f:\TMP\s50c.cx1" -i "E:\COSMIC\EVAL12X\HS12x" -i "E:\COSMIC\EVAL12X\HS12X" -u -p -d"__VERS__=\"V4.7.11\"" "main.c"
    Clnk -m ETEST.map -o ETEST.h12 9s12xx128.lkf
    #error clnk 9s12xx128.lkf:17 can't open file main.o
    ETEST.h12 - 0 Fehler, 0 Warnung(en)
    Funny enough, if I click the line

    Code: Select all

    #error clnk 9s12xx128.lkf:17 can't open file main.o
    it does what it should.

    But if I click the line

    Code: Select all

    #error cps12x main.c:40(2+4) klpo undefined
    it only opens the file main.c but does not move the cursor to line 40.

    And what else is strange, is that at the bottom it says, that there were 0 Errors, 0 Warnings.

    Any ideas?

    Thank you
    Matmik

    6,680583
    Grand MasterGrand Master
    6,680583

      Aug 27, 2013#2

      0 Errors, 0 Warnings is output from your compiler, see the line ETEST.h12 - 0 Fehler, 0 Warnung(en).

      UEStudio does not write itself anything to the output window except you enable option Show build commands when executing in dialog window opened by clicking on Build - Advanced Build Options. With this option enabled you can see the called commands with all the options. You should enable this option to see in detail what is going on during a build process while developing the configuration for a new compiler.

      Parsing an output line of a compiler is very difficult for an editor not written for a specific compiler output format. Usually warning/error lines of compilers start with one of the following information formats
      • file name(line number)
      • file name/line number
      • file name:line number
      File names with full path are best. File names without path or with a relative path are already more difficult to detect and find.

      But COSMIC HCS12X compiler obviously uses a completely different format for output of a warning/error. There is

      #error name of executable outputing the error file name :line number(...)

      If you double click on such a line, UEStudio tries to find out if the line contains a file name, and if this file can be found, and if there is additionally a line number. Most likely UltraEdit makes several file system accesses to find out if the lines

      Code: Select all

      #error cps12x main.c:40(2+4) klpo undefined
      #error clnk 9s12xx128.lkf:17 can't open file main.o
      contain a file name. I suppose that UEStudio first checks for a file with name #error in several directories (current working directory, project directory, ...), next for name of executable outputing the error, next perhaps for "#error name of executable outputing the error" and so on with having success finding a file with name "main.c" and a file with name "9s12xx128.lkf".

      As a colon is not valid for a file name, UEStudio assumes that 17 after file name "9s12xx128.lkf" is a line number and positions therefore the caret on this line in the file.

      main.c:40(2+4) is obviously more problematic for UEStudio output line parser as this string contains a number after a colon and additionally also a string within round brackets. I think, UEStudio gives strings in round brackets a higher priority on being interpreted as line number than the string after the colon. But "2+4" is not a valid integer string and therefore just the file is opened without positioning caret to any line.

      Perhaps the COSMIC HCS12X compiler offers a command line option to determine format of error and warning messages and one of the supported formats can be better parsed by UEStudio. You need to read the documentation of the compiler to find out if such an option exists.

      If the compiler has no such option to determine format of error and warning messages, the only possibility for being able to simple open a file with caret positioned on correct line would be to write a small console application in C or C++ which reads strings from stdin and stderr, checks for lines with a warning or error and reformats those lines to a format supported by UEStudio before outputing them to stdout while all other lines read in are output to stdout without any modification. Such a console application is called a "filter application" which is appended at end of the command line of the compiler with | filter.exe

      I have twice written such a small filter application to reformat output of two C/C++ compilers/assemblers/linkers to a format which can be easily parsed by UE/UES. Writing such a filter application is a not really difficult task for an experienced C/C++ programmer as long as the format of input strings (errors and warnings) is well known.

      PS: With the free tool Process Monitor of Sysinternals (Microsoft) it can be quite easily watched what UEStudio tries when double clicking on a line in output window.