0

The GNU linker emits error messages in this style:

 _Boot/Debug/libs\Common.a(oled.o):V:\OneDrive\Emb\App_M2S_S32G/Common/src/oled.c:40: multiple definition of `time'; _Boot/Debug/libs\Boot.a(bootloader.o):V:\OneDrive\Emb\App_M2S_S32G/Boot/src/bootloader.c:27: first defined here

I want to create two problems from this single line, for the two files and line numbers mentioned in the message, so that I can click both of them and navigate to the offending lines (oled.c:40 and bootloader.c:27). It's possible to create patterns for the compiler and for both parts of the linker message:

    "problemMatcher": [
        // Compiler
        {
            "base": "$gcc",
            "fileLocation": [
                "autodetect",
                "${workspaceFolder}"
            ]
        },
        // Linker 1
        {
            "source": "ld",
            "pattern": {
                "regexp": "^.+; .*(.:.+):([0-9]+): (.+)",
                "file": 1,
                "line": 2,
                "message": 3
            },
            "fileLocation": [
                "autodetect",
                "${workspaceFolder}"
            ]
        },
        // Linker 2
        {
            "source": "ld",
            "pattern": {
                "regexp": "^.+; .*(.:.+):([0-9]+): (.+)",
                "file": 1,
                "line": 2,
                "message": 3
            },
            "fileLocation": [
                "autodetect",
                "${workspaceFolder}"
            ]
        }
    ],

This does not work, because if the Linker 1 pattern matched, the Linker 2 is not executed at all. If I copy the regexp from Linker 2 to Linker 1, the second part of the message is parsed properly. Is it somehow possible to tell Code to always attempt to match all patterns, even if a previous one already matched? Or any other way to create multiple problems from one message line?

4

0 回答 0