microsoft / microsoft/vscode-cpptools

Natvis format specifier `,s` doesn't work

Open
#7,750 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Issue Type: Bug

Format specifier ,s doesn't work.

How to reproduce

  1. Compile and debug the following code:
    (Mingw gcc 11 is used)
#include <string>

int main()
{
    std::string string("test");

    return 0;
}
  1. Use the following natvis entity:
    <Type Name="std::string">
        <AlternativeType Name="std::__cxx11::basic_string&lt;*&gt;"/>
        <DisplayString>{_M_dataplus._M_p,s}</DisplayString>
        <Expand>
            <Item Name="size">_M_string_length</Item>
            <Item Name="capacity" Condition="_M_dataplus._M_p == _M_local_buf">sizeof(_M_local_buf)</Item>
            <Item Name="capacity" Condition="_M_dataplus._M_p != _M_local_buf">_M_allocated_capacity</Item>
            <Item Name="string">_M_dataplus._M_p,s</Item>
        </Expand>
    </Type>
  1. See that ,s format specifier in <DisplayString> and <Item Name="string"> doesn't change anything in debug view, hover and showDisplayString.

Actual result:
image

Expected result: string = "test" (without leading address)

Extension version: 1.5.0-insiders2
VS Code version: Code 1.57.1 (507ce72a4466fbb27b715c3722558bb15afa9f48, 2021-06-17T13:28:07.755Z)
OS version: Windows_NT x64 10.0.17763
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.85GB (8.96GB free)
Process Argv --locale=en --crash-reporter-id c8510ba5-736a-4465-9c29-9471122a68c5
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551cf:30311713
vspre833:30321513
pythonptprofiler:30281270
vshan820:30294714
pythondataviewer:30285071
vscus158:30321503
pythonvsuse255cf:30323309
vscorehov:30309549
vscod805cf:30301675
pythonvspyt200:30324779
binariesv615:30325510

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Reproduce the behavior with the supplied C++ program and Natvis entity, then trace handling of the ,s format specifier in DisplayString and Item expressions. Done means the debug view, hover, and showDisplayString render string = "test" without the leading address.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.