microsoft / microsoft/vscode-cpptools
[OSX] lldb cannot read bitfield dwarf debug info generated by -mmacosx-version-min=10.11
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: Debugger
Describe the bug
- OS and Version: MacOSX 10.4.1
- VS Code Version: 1.29.0
- C/C++ Extension Version: 0.20.1
- A clear and concise description of what the bug is.
Starting from MacOSX target 10.11, clang tunes it's debug information for lldb. This causes the version of lldb embedded in the cpptools extension to misreport bitfield values.
To Reproduce
#include <stdio.h>
int main() {
struct Test {
unsigned short a;
unsigned short b : 1;
unsigned short c: 15;
};
Test x = {0};
x.a = 5;
printf("%hu", x.b);
return 0;
}
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb"
}
]
}
Steps to reproduce the behavior:
- Run
clang++ test.cc -mmacosx-version-min=10.11 -g - Place a breakpoint at line 10:
x.a = 5 - Launch debugger
- Step over
x.a = 5and see thatx.borx.cchanges value (lldb cannot find the right addresses for the bitfields.
Additional context
Compilation where older lldb works:
clang++ -c test.cc -mmacosx-version-min=10.10 -gclang++ -c test.cc -mmacosx-version-min=10.11 -ggdb
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal test.cc case with clang++ using -mmacosx-version-min=10.10 and 10.11, then launch it with the provided .vscode/launch.json configuration. Compare how the debugger reports x.b and x.c after stepping over x.a = 5; done means bitfield values remain correct for the 10.11 target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100