microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

expression breakpoint not working as expected #9503

Open ericzhucode opened 2 years ago

ericzhucode commented 2 years ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: If I use expression breakpoint and expression contains strcmp, when this breakpoint is hit, gdb will crash unexpectedly

image

Steps to reproduce:

  1. Only on Linux environment(both local and remote to it via remote-ssh), it works well on local windows environment
  2. Just a demo project will reproduce this issue

Besides, if I don't use strcmp and just set very simple expression like 1==1, breakpoint will be hit successfully and there's no error.

Sorry to let you guys work on this, looking forward to your reply.

Debugger Configurations

{
    // 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": "C++ Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
            "stopAtEntry": false,
            "cwd": ".",
            "launchCompleteCommand": "exec-run",
            "linux": {
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb"
            },
            "preLaunchTask": "default compile",
            "externalConsole": false
        }
    ]
}

Debugger Logs

Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.

Breakpoint 1, main () at /home/eric/Dev/c-test/test.c:5
5   {
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded.
ERROR: GDB exited unexpectedly. Debugging will now abort.
The program '/home/eric/Dev/c-test/test.exe' has exited with code -1 (0xffffffff).

Other Extensions

Other extensions have been disabled when I test on this

Additional Information

No response

WardenGnaw commented 2 years ago

In your launch.json file can you add the following block to your configuration and share the output in the Debug Console?

"logging": {
   "engineLogging": true,
   "traceResponse": true
}
ericzhucode commented 2 years ago

In your launch.json file can you add the following block to your configuration and share the output in the Debug Console?

"logging": {
   "engineLogging": true,
   "traceResponse": true
}

Thank you for your suggestion. Here's the output from Debug Console. Since the content is too long so I just copy the output near error message. Please let me know if you want more information.

1: (2800) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2801) 1023: elapsed time 1\n"},"seq":363} 1: (2801) 1023: elapsed time 1 --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2802) Send Event AD7EntryPointEvent\n"},"seq":365} 1: (2802) Send Event AD7EntryPointEvent --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2804) <--exec-continue\n"},"seq":367} 1: (2804) <--exec-continue --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2805) ->^running\n"},"seq":369} 1: (2805) ->^running --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2805) ->running,thread-id=\"all\"\n"},"seq":371} 1: (2805) ->running,thread-id="all" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2805) ->(gdb)\n"},"seq":373} 1: (2805) ->(gdb) --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5441) Shell exited, stop debugging\n"},"seq":375} 1: (5441) Shell exited, stop debugging --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/MIEngine/DebuggerAborted","data":{"VS.Diagnostics.Debugger.MIEngine.DebuggerName":"GDB","VS.Diagnostics.Debugger.MIEngine.LastSentCommandName":"-exec-continue"}},"seq":377} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5449) Send Event AD7MessageEvent\n"},"seq":379} 1: (5449) Send Event AD7MessageEvent --> E (output): {"type":"event","event":"output","body":{"category":"stderr","output":"ERROR: GDB exited unexpectedly. Debugging will now abort.\n"},"seq":381}

ERROR: GDB exited unexpectedly. Debugging will now abort.

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5451) Send Event AD7ProgramDestroyEvent\n"},"seq":383} 1: (5451) Send Event AD7ProgramDestroyEvent --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"The program '/home/eric/Dev/c-test/test.exe' has exited with code -1 (0xffffffff).\r\n\n"},"seq":385} The program '/home/eric/Dev/c-test/test.exe' has exited with code -1 (0xffffffff).

--> E (exited): {"type":"event","event":"exited","body":{"exitCode":-1},"seq":387} --> E (terminated): {"type":"event","event":"terminated","body":{},"seq":389} --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/DebugCompleted","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"17.1.20608.1","VS.Diagnostics.Debugger.HostVersion":"17.1.20608.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.DebugCompleted.BreakCounter":0}},"seq":391} <-- C (disconnect-12): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":12} --> R (disconnect-12): {"type":"response","request_seq":12,"success":true,"command":"disconnect","body":{},"seq":394}

ericzhucode commented 2 years ago

In your launch.json file can you add the following block to your configuration and share the output in the Debug Console?

"logging": {
   "engineLogging": true,
   "traceResponse": true
}

Just want to check if there's any update? Sorry to bother.