microsoft / microsoft/vscode-cpptools

Natvis unable to parse C structs defined like 'struct XXX'

Open
#592 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Consider we have struct (I am talking about C language, not C++):

struct __STKFRM__
{
	uint32_t r4, r5, r6, r7, r8, r9, r10, r11;
 ................
};

Both variants struct __STKFRM__ and __STKFRM__ of Name attribute in natvis Type rule does not produce expected result (it just ignores the rule).

The log contains the following lines:

1: (3662) <-1020-var-create - * "Running->psp"
1: (3688) ->1020^done,name="var1",numchild="16",value="0x2000465c <DisplayTaskStack+860>",type="struct __STKFRM__ *",has_more="0"
1: (3688) ->(gdb)
1: (3688) 1020: elapsed time 26
1: (3691) Natvis failed to parse typename: struct __STKFRM__ *

If I define the struct using typedef everything works.

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

The issue concerns Natvis parsing of the Name attribute for C struct types, with the GDB log showing struct __STKFRM__ * rejected. Start by reproducing the shown struct and testing both Name forms against the typedef case; done when tagged C struct names are accepted by Natvis.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.