c++ - Changing STL container (std::string) values in debugger - Stack Overflow

时间: 2025-01-06 admin 业界

If I understand correctly, VSCode uses -var-assign to set variables in the debugger. This doesn't work for e.g. std::string.

A workaround is to use -exec call string_variable_name.assign("new_value") (or string_variable_name.operator=("new_value")) from within the VSCode debugger shell window.

Is it possible to apply this trick so that I can use the Variables window to assign values for strings (e.g. a specific configuration or an extension)?

I tried some more extensions, launch.json configurations etc. but since I'm quite new to VSCode i might also be doing something else completely wrong here (coming from vim)

See also: