Skip to content

LLDB debugger hangs (using 100% cpu) at launch if std::map is uninitialised  #5805

@zwangz

Description

@zwangz

Type: Debugger

Describe the bug

  • OS and Version: macOS 10.14.6 (Darwin x64 18.7.0)
  • VS Code Version: 1.47.2
  • C/C++ Extension Version: 0.29.0
  • Issue:

Similar log to #860
When using include <map>and std::map/std::multimap without initialisation the debugger hangs at launch and is stuck at -var-create - - "map_variable_name" --thread 1 --frame 0; seems like no garbage value can be created
See example A below

However this does not happen, if before the (one) std::map declaration there is another container such as std::vector
or std::unordered_map declared, even uninitialised.
See example B below

And the problem re-surfaces if more than two <map> contrainers are used.
See example C below

Therefore this seems to strangely happen only to std::map containers; a few other stl containers and std::vector alone uninitialised can launch fine and be seen in the local variables window

Please could you investigate? many thanks in advance

To Reproduce

Steps to reproduce the behavior:

  1. tasks.json
{
    "version": "2.0.0",
    "tasks": [
             {
            "type": "shell",
            "label": "clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++17", 			
                "-stdlib=libc++",
                "-Wall",
                "-g",
                "${fileDirname}/**.cpp",
                "-o",
		"${fileBasenameNoExtension}",
            ],
	    "options": {"cwd": "${fileDirname}"},
            "problemMatcher": ["$gcc"],
	    "group": "build",
		},
     ]
}
  1. launch.json
    "version": "0.2.0",
    "configurations": [
        {
            "name": "vscpp - Build and Debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "preLaunchTask": "clang++ build active file",
            "logging": {"engineLogging": true},
            "miDebuggerPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi"
        },
    ]
  1. main.cpp using examples below:

EXAMPLE A

#include <iostream>
#include <string>
#include <map> 
#include <unordered_map>
#include <vector>

int main() {
    std::cout << "ISSUE" << std::endl;

    // std::unordered_map<int, int> unord_map;
    // std::vector<int> my_v;             // Same effect as using unordered_map

    std::map<int,int> my_map;
    // std::multimap<int, int> multi_map; // Same issue as my_map
    // std::map<int,int> my_map2;

    std::cout << "ISSUE" << std::endl;
    return 0;
}

image

EXAMPLE B

int main() {
    std::cout << "ISSUE" << std::endl;

    std::unordered_map<int, int> unord_map;
    // std::vector<int> my_v;             // Same effect as using unordered_map

    std::map<int,int> my_map;
    // std::multimap<int, int> multi_map; // Same issue as my_map
    // std::map<int,int> my_map2;

    std::cout << "ISSUE" << std::endl;
    return 0;
}

image

EXAMPLE C - stuck at multi_map

int main() {
    std::cout << "ISSUE" << std::endl;

    std::unordered_map<int, int> unord_map;
    // std::vector<int> my_v;             // Same effect as using unordered_map

    std::map<int,int> my_map;
    std::multimap<int, int> multi_map; // Same issue as my_map
    // std::map<int,int> my_map2;

    std::cout << "ISSUE" << std::endl;
    return 0;
}

image

  1. launch debugger
    Full log for example A
    log.txt
    cpu usage when hanging
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerinvestigate: reproThis issue's repro steps needs to be investigated/confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions