microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
817 stars 218 forks source link

Error Segmentation fault #968

Open azuric opened 4 years ago

azuric commented 4 years ago

Hi

Can someone explain why this is occuring?:

/tmp/Microsoft-MIEngine-Cmd-vwck80tg.cmu: line 2: 26010 Segmentation fault "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-maxuldtf.8re" > "/tmp/Microsoft-MIEngine-Out-ppbm2189.vli"

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/*****/code/cmake_bin/build/Debug/g_execution/abc",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
pieandcakes commented 4 years ago

@azuric It sounds like gdbis crashing with a Segmentation fault. Can you run gdb manually with the --interpreter=mi flag against your executable and see if it works?

ArduinoHocam commented 2 years ago

Hi @pieandcakes, I faced with the same issue as well. /tmp/Microsoft-MIEngine-Cmd-f1wgyfm4.5lb: line 2: 18214 Segmentation fault (core dumped) "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-l4pj20ih.r15" > "/tmp/Microsoft-MIEngine-Out-qz1ueems.v15"

I run the gdb manually and put breakpoints to the same lines, which throws seg. fault, and the result is the same. I think the problem is about g++ gdb side, not related to VS Code. But the behavior is quite strange, I would say. I had the problem with following codes:

I have 2 classes ( derived and base) I have another file for helper function to display derived and base class attributes etc. I am creating object from the classes and pushing back to the vector. In the helper function, with range based for loop, I am trying to iterate over them and at the beginning of the for loop gdb crashes. At the terminal, I see the *stopped,reason="end-stepping-range" FYI.

afzaalhussain50 commented 1 year ago

Hi @ArduinoHocam , i am facing the same issue, did you get any solution?

@pieandcakes i tried to run gdb using command line it is working fine but when i launch using launcher.json it gives me the same error

/tmp/Microsoft-MIEngine-Cmd-tzitmyxf.dfn: line 2: 28315 Segmentation fault "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-nqusu1sl.of2" > "/tmp/Microsoft-MIEngine-Out-mzbfe3ik.yy0"

Thanks

ArduinoHocam commented 1 year ago

Hi @ArduinoHocam , i am facing the same issue, did you get any solution?

@pieandcakes i tried to run gdb using command line it is working fine but when i launch using launcher.json it gives me the same error

/tmp/Microsoft-MIEngine-Cmd-tzitmyxf.dfn: line 2: 28315 Segmentation fault "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-nqusu1sl.of2" > "/tmp/Microsoft-MIEngine-Out-mzbfe3ik.yy0"

Thanks

Hi, It's been a while for this issue but as far as I remember, it was related to VSCode and thus I just skipped that :(

n1ckmoore commented 1 year ago

@ArduinoHocam @afzaalhussain50 Were either of you able to figure out a solution? Encountering the same issue.

afzaalhussain50 commented 1 year ago

@n1ckmoore I searched a lot and didn't found the reason and verified solution, but a hack worked for me "try to restart your system and then try again".

I was using vscode with wsl2 when i faced this issue.

GRDazzle commented 1 year ago

Hi,

I have encountered this issue as well, and it turned out that my build was not compatible with that version of GDB, and I resolved the issue by trying a newer version GDB.