microsoft / vscode-cpptools

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

Could not load source './csu/../sysdeps/nptl/llibc_start_call_main.h': SourceRequest not supported #10206

Open AlexanderRuhwinkel opened 1 year ago

AlexanderRuhwinkel commented 1 year ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: At the end of a debugging session when i step over the last statement of a program (i.e. return (0);) VS Code opens a window/tab saying "Could not load source './csu/../sysdeps/nptl/libc_start_call_main.h': 'SourceRequest' not supported.."

The window/tab title gives the path "./csu/../sysdeps/nptl/libc_start_call_main.h"

I have to click F10 or "Step over" again to end the debugging session.

Richt clicking on the tab an chose "Reveal in explorer" gives "Unable to open ./csu/../sysdeps/nptl/libc_start_call_main.h in the Windows explorer."

Steps to reproduce:

Windows 10, Linux in a WSL 2 environment.. Create a c++ project (e.g. helloworld) in Linux home folder. Debug in VS Code. Set breakpoint. Step Over (F10) until end of program. Produces the issue described above.

Debugger Configurations

tasks.json
{
    "tasks": [  
        {
            "type": "cppbuild",
            "label": "Compile",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "/home/alex/projects/helloworld/hello.cpp",                
                "-o",
                "/home/alex/projects/helloworld/hello"                
            ],
            "options": {
                "cwd": "/home/alex/projects/helloworld/"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: /usr/bin/g++"
        }
    ],
    "version": "2.0.0"
}

launch.json
{    
    "version": "0.2.0",
    "logging": { "engineLogging": true, "trace": true, "traceResponse": true },
    "configurations": [
      {
        "name": "Debug",
        "type": "cppdbg",
        "request": "launch",
        "program": "/home/alex/projects/helloworld/hello",
        "args": [],
        "stopAtEntry": false,
        "cwd": "/home/alex/projects/helloworld",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "/usr/bin/gdb",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "C/C++: g++ build active file"      
      }

    ]

  }

Debugger Logs

=thread-group-added,id="i1"
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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-linux-gnu".
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"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main () at /home/alex/projects/helloworld/hello.cpp:5
5       std::cout << "Hello, world!" << std::endl;
Loaded '/lib/x86_64-linux-gnu/libstdc++.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libm.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libgcc_s.so.1'. Symbols loaded.
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
[Inferior 1 (process 7040) exited normally]
The program '/home/alex/projects/helloworld/hello' has exited with code 0 (0x00000000).

Other Extensions

WSL CMake CMake Tools C/C++ C/C++ Extension Pack C/C++ Themes

Additional Information

No response

WardenGnaw commented 1 year ago

Can you move "logging": { "engineLogging": true, "trace": true, "traceResponse": true }, into the configuration object and share the Debug Console output here?

AlexanderRuhwinkel commented 1 year ago

Thank you @WardenGnaw for your reply.

I moved the "logging": { "engineLogging": true, "trace": true, "traceResponse": true }, into the configuration object but it doesn't give me any other output in Debug Console as without this line:

Debug Console:

=thread-group-added,id="i1"
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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-linux-gnu".
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"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main () at /home/alex/projects/helloworld/hello.cpp:5
5       std::cout << "Hello, world!" << std::endl;
Loaded '/lib/x86_64-linux-gnu/libstdc++.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libm.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libgcc_s.so.1'. Symbols loaded.
[Inferior 1 (process 2465) exited normally]
The program '/home/alex/projects/helloworld/hello' has exited with code 0 (0x00000000).

However, i tried to debug the program in a terminal (not using VS Code) and it gives me the same issue:

...
Starting program: /home/alex/projects/helloworld/hello hello.cpp
Using PIE (Position Independent Executable) displacement 0x555555554000 for "/home/alex/projects/helloworld/hello".
Reading symbols from /lib64/ld-linux-x86-64.so.2...
Reading symbols from /usr/lib/debug/.build-id/61/ef896a699bb1c2e4e231642b2e1688b2f1a61e.debug...
Reading symbols from system-supplied DSO at 0x7ffff7fc2000...
(No debugging symbols found in system-supplied DSO at 0x7ffff7fc2000)
Reading symbols from /lib/x86_64-linux-gnu/libstdc++.so.6...
(No debugging symbols found in /lib/x86_64-linux-gnu/libstdc++.so.6)
Registering libstdc++-v6 pretty-printer for /lib/x86_64-linux-gnu/libstdc++.so.6 ...
Registering xmethod matcher '%s' with %s' ...
...
Registering xmethod matcher '%s' with %s' ...
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...
Reading symbols from /usr/lib/debug/.build-id/69/389d485a9793dbe873f0ea2c93e02efaa9aa3d.debug...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...
Reading symbols from /usr/lib/debug/.build-id/27/e82301dba6c3f644404d504e1bb1c97894b433.debug...
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...
(No debugging symbols found in /lib/x86_64-linux-gnu/libgcc_s.so.1)

Breakpoint 3, main () at /home/alex/projects/helloworld/hello.cpp:5
5       std::cout << "Hello, world!" << std::endl;
Reading in symbols for ../sysdeps/x86/libc-start.c...
7       return (0);
8   }
__libc_start_call_main (main=main@entry=0x5555555551a9 <main()>, argc=argc@entry=2, argv=argv@entry=0x7fffffffde78) at ../sysdeps/nptl/libc_start_call_main.h:74
74  ../sysdeps/nptl/libc_start_call_main.h: No such file or directory.
Current language:  auto
The current source language is "auto; currently c".
...

Apperently i am missing some sources or dev packages i guess, should have tried that beforehand.

So it is not an issue with VS Code or any extension.

Please apologize for bringing it up here.

tien4112004 commented 1 year ago

I met the same problem on Ubuntu 22.10. Has the problem been solved?

HiddenStar1 commented 1 year ago

Has this problem been solved?Hope you can get an answer, thank you

only-a-little commented 1 year ago

The same problem, is there an answer to the problem?

starlitsky2010 commented 4 months ago

I also met this problem. Any good suggestion?

dualrelax commented 2 months ago

Use step into to debug c language built-in functions will appear this problems.

1.Use step over to skip debug built-in functions.

2.Install glibc.

For debian

sudo apt install glibc-source

cd /usr/src/glibc

sudo tar -xvf glibc-2.36.tar.xz

In your launch.json set

"cwd": "/usr/src/glibc/glibc-2.36",

Than can use step into to debug built-in functions