Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard output parsing changes lines with @ (at) symbol in them to "undefined" #432

Open
4 tasks done
kmARC opened this issue Jun 17, 2024 · 0 comments
Open
4 tasks done

Comments

@kmARC
Copy link

kmARC commented Jun 17, 2024

When the debugged process tries to print lines with an @ (at) symbol, some parsing mechanism removes it from the debug console output and eventually prints undefined

  • If you are using gdb
    • gdb --version >= 7.7.1
    • it works on the command line with gdb
    • cwd and target are properly set

Screenshot from Debug Console:

Screenshot 2024-06-17 at 15 02 20

Screenshot from terminal gdb:

Screenshot 2024-06-17 at 15 14 35

Reproducible example

Example main.cpp
#include <iostream>

// $ g++ -g main.cpp

int main()
{
    std::cout << "test: FOO@BAR" << std::endl;
    std::cerr << "test: FOO@BAR" << std::endl;
    std::cout << "test: FOO<at>BAR" << std::endl;
    std::cerr << "test: FOO<at>BAR" << std::endl;
}
Example launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "target": "a.out",
            "cwd": "${workspaceRoot}",
            "valuesFormatting": "parseText"
        }
    ]
}

System details (linux, gdb, code version)

$ gdb --version
GNU gdb (GDB) Rocky Linux 10.2-11.1.el9_3
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ uname -a
Linux <...> 5.10.154-1.base.x86_64 #1 SMP Tue Nov 15 15:31:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ code --version
1.90.1
611f9bfce64f25108829dd295f54a6894e87339d
x64

Workaround

I found that removing \@ from src/backend/mi2/mi2.ts#L15 would result in keeping the lines with @ in it, however an undefined output still appear

± git diff
diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts
index e641160..156dc41 100644
--- a/src/backend/mi2/mi2.ts
+++ b/src/backend/mi2/mi2.ts
@@ -12,7 +12,7 @@ export function escape(str: string) {
        return str.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
 }
 
-const nonOutput = /^(?:\d*|undefined)[\*\+\=]|[\~\@\&\^]/;
+const nonOutput = /^(?:\d*|undefined)[\*\+\=]|[\~\&\^]/;
 const gdbMatch = /(?:\d*|undefined)\(gdb\)/;
 const numRegex = /\d+/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant