vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Unable to step out. Operation failed with error code 0x80004004.

Open ekkkkki opened this issue 2 years ago • 2 comments

Environment

  • OS and version: Ubuntu 16
  • VS Code: 1.70.2
  • C/C++ extension: 1.2.0
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: 9.2

Bug Summary and Steps to Reproduce

Bug Summary: I could "Step in" or "Step over" when debugging, while when I want to "Step out", errors occurs: "Unable to step out. Operation failed with error code 0x80004004.

Debugger Configurations

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ 生成活动文件",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++: g++ 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ 生成活动文件",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

Debugger Logs

No ogs or error messages were outputed in the terminal.
VSCode show error messages"Unable to step out. Operation failed with error code 0x80004004."

Other Extensions

No response

Additional Information

No response

ekkkkki avatar Aug 28 '22 15:08 ekkkkki

Can you enable logging? You can do this by adding the following to your launch.json.

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

Then copy what appears in the Debug Console window here.

WardenGnaw avatar Aug 29 '22 15:08 WardenGnaw

@WardenGnaw Thanks for replying.

Here is the error in Debug Console when steping out: ERROR: Unexpected GDB output from command "-exec-finish". "finish" not meaningful in the outermost frame.

ekkkkki avatar Sep 13 '22 05:09 ekkkkki

Hello, I'm currently facing the same problem, And my Environment is: OS and version : Windows 11 22h2 VS Code: 1.77.0 C/C++ extension: 1.14.5 GDB version: 13.1

Debugger Configurations

{
    "configurations": [
        {
            "name": "C/C++:g++.exe 鐢熸垚鍜岃皟璇曟椿鍔ㄦ枃浠?quot;,
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "internalConsoleOptions": "neverOpen",
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\msys64\\mingw64\\bin\\gdb.exe", // 璋冭瘯鍣ㄨ矾寰勶紝濡傛灉鎮ㄤ娇鐢ㄩ粯璁よ矾寰勫畨瑁?UCRT64 鍒欐棤闇€淇敼
            "setupCommands": [
                {
                    "description": "涓?gdb 鍚敤鏁撮綈鎵撳嵃",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "灏嗗弽姹囩紪椋庢牸璁剧疆涓?Intel",
                    "text": "-gdb-set disassembly-flavorintel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++:g++.exe 鐢熸垚娲诲姩鏂囦欢",

            "logging": {
                "engineLogging" : true,
                "traceResponse": true
            }
        }
    ],
    "version": "2.0.0"
}
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++:g++.exe 鐢熸垚娲诲姩鏂囦欢",
            "command": "D:\\msys64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-fexec-charset=GBK"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "璋冭瘯鍣ㄧ敓鎴愮殑浠诲姟銆?quot;
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 鐢熸垚娲诲姩鏂囦欢",
            "command": "D:\\msys64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "璋冭瘯鍣ㄧ敓鎴愮殑浠诲姟銆?quot;
        }
    ],
    "version": "2.0.0"
}

Debugger Logs

=thread-group-added,id="i1" GNU gdb (GDB) 13.1 Copyright (C) 2023 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. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-w64-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help".

Type "apropos word" to search for commands related to "word". Warning: Debuggee TargetArchitecture not detected, assuming x86_64. =cmd-param-changed,param="pagination",value="off" [New Thread 4004.0x471c] [New Thread 4004.0x57fc] [New Thread 4004.0x2868]

Thread 1 hit Breakpoint 1, main () at D:\vsCodeProjects\C++\Luogu\Fundamentals\string.cpp:11 11 cin >> input; Loaded 'C:\WINDOWS\SYSTEM32\ntdll.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\kernel32.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\KernelBase.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\ucrtbase.dll'. Symbols loaded. Loaded 'D:\msys64\ucrt64\bin\libstdc++-6.dll'. Symbols loaded. Loaded 'D:\msys64\ucrt64\bin\libwinpthread-1.dll'. Symbols loaded. Loaded 'D:\msys64\ucrt64\bin\libgcc_s_seh-1.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\advapi32.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\msvcrt.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\sechost.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\rpcrt4.dll'. Symbols loaded. Loaded 'C:\WINDOWS\SYSTEM32\cryptbase.dll'. Symbols loaded. Loaded 'C:\WINDOWS\System32\bcryptprimitives.dll'. Symbols loaded.

Thread 1 hit Breakpoint 2, main () at D:\CodeProjects\C++\A\Fundamentals\string.cpp:14 14 for (int i = 1; i < 10; i+=3) { Execute debugger commands using "-exec ", for example "-exec info registers" will list registers in use (when GDB is the debugger) ERROR: Unexpected GDB output from command "-exec-finish". "finish" not meaningful in the outermost frame. ERROR: Unexpected GDB output from command "-exec-finish". "finish" not meaningful in the outermost frame. Kill the program being debugged? (y or n) [answered Y; input not from terminal] [Inferior 1 (process 4004) killed] The program 'D:\CodeProjects\C++\A\Fundamentals\string.exe' has exited with code 0 (0x00000000).

michael1735 avatar Mar 31 '23 13:03 michael1735

"step out "should not be applied to main function, which is not meaningful. you can use "step out " in other functions exclude main and it will never cause this error

iconicon111 avatar Jul 28 '23 12:07 iconicon111