Skip to content

Commit 3f62c3d

Browse files
authored
Merge pull request #1458 from Microsoft/master
0.14.6 release
2 parents 92d0dec + 5c8fdab commit 3f62c3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+8330
-1398
lines changed

.travis.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
language: node_js
2+
3+
node_js:
4+
- "8"
5+
6+
before_install:
7+
# Do not modify. Required for GUI based tests: See https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
8+
- if [ $TRAVIS_OS_NAME == "linux" ]; then
9+
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
10+
sh -e /etc/init.d/xvfb start;
11+
sleep 3;
12+
fi
13+
14+
addons:
15+
apt:
16+
sources:
17+
- ubuntu-toolchain-r-test
18+
- sourceline: 'deb https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main'
19+
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
20+
packages:
21+
- gdb
22+
- g++-4.9
23+
24+
25+
script:
26+
# Download debugAdapters from an existing extension version. See TravisCI settings to set CPPTOOL_VERSION
27+
- mkdir -p ~/.vscode/extensions/ms-vscode.cpptools-$CPPTOOL_VERSION
28+
- wget https://github.com/Microsoft/vscode-cpptools/releases/download/$CPPTOOL_VERSION/cpptools.vsix -O ~/cpptools.vsix
29+
- unzip ~/cpptools.vsix "extension/debugAdapters/*" -d ~/.
30+
- mv ~/extension/debugAdapters ~/.vscode/extensions/ms-vscode.cpptools-$CPPTOOL_VERSION/debugAdapters
31+
# Build and then run tests
32+
- cd Extension
33+
- npm install
34+
- npm run tslint
35+
- npm run compile
36+
- npm run test
37+
38+
after_failure:
39+
- find ~ -name "integrationTests.log" -type f -exec cat {} \;
40+
41+
after_success:
42+
- find ~ -name "integrationTests.log" -type f -exec cat {} \;
43+

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# How to Contribute Changes
2+
3+
## Contribution Steps:
4+
* [Build and debug the extension](Documentation/Getting%20started.md#build-and-debug-the-cpptools-extension).
5+
* File an [issue](https://github.com/Microsoft/vscode-cpptools/issues) and a [pull request](https://github.com/Microsoft/vscode-cpptools/pulls) with the change and we will review it.
6+
* If the change affects functionality, add a line describing the change to [CHANGELOG.md](Extension/CHANGELOG.md).
7+
* Try and add a test in [test/extension.test.ts](Extension/test/unitTests/extension.test.ts).
8+
* Run tests via opening the [Extension](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension) folder in Visual Studio Code, selecting the `Launch Tests` configuration in the Debug pane, and choosing `Start Debugging`.
9+
10+
## About the Code
11+
* Execution starts in the `activate` method in [main.ts](Extension/src/main.ts).
12+
* `processRuntimeDependencies` handles the downloading and installation of the OS-dependent files. Downloading code exists in [packageManager.ts](Extension/src/packageManager.ts).
13+
* `downloadCpptoolsJsonPkg` handles the `cpptools.json`, which can be used to enable changes to occur mid-update, such as turning the `intelliSenseEngine` to `"Default"` for a certain percentage of users.
14+
* The debugger code is in the [Debugger](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension/src/Debugger) folder.
15+
* [LanguageServer/client.ts](Extension/src/LanguageServer/client.ts) handles various language server functionality.
16+
* [LanguageServer/configurations.ts](Extension/src/LanguageServer/configurations.ts) handles functionality related to `c_cpp_properties.json`.
17+
* [telemetry.ts](Extension/src/telemetry.ts): Telemetry data gets sent to either `logLanguageServerEvent` or `logDebuggerEvent`.
18+
* The Tag Parser (symbol database) doesn't automatically expand macros, so the [cpp.hint](Extension/cpp.hint) file contains definitions of macros that should be expanded in order for symbols to be parsed correctly.

Code Samples/Fib/.vscode/launch.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "(gdb) Launch",
6+
"preLaunchTask": "build",
7+
"type": "cppdbg",
8+
"request": "launch",
9+
"args": [],
10+
"stopAtEntry": true,
11+
"cwd": "${workspaceRoot}",
12+
"environment": [],
13+
"externalConsole": true,
14+
"setupCommands": [
15+
{
16+
"description": "Enable pretty-printing for gdb",
17+
"text": "-enable-pretty-printing",
18+
"ignoreFailures": true
19+
}
20+
],
21+
"logging": {
22+
"engineLogging": false,
23+
"trace": false
24+
},
25+
"windows": {
26+
"program": "${workspaceRoot}/fib.exe",
27+
"MIMode": "gdb",
28+
"miDebuggerPath": "<Path/To/GDB>" // Path to gdb on windows
29+
},
30+
"linux": {
31+
"program": "${workspaceRoot}/fib.out",
32+
"MIMode": "gdb"
33+
},
34+
"osx": {
35+
"program": "${workspaceRoot}/fib.out",
36+
"MIMode": "lldb"
37+
}
38+
}
39+
]
40+
}

Code Samples/Fib/.vscode/tasks.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"taskName": "build",
8+
"type": "shell",
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
},
13+
"presentation": {
14+
"echo": true,
15+
"reveal": "always",
16+
"focus": false,
17+
"panel": "shared"
18+
},
19+
"windows": {
20+
"command": "${workspaceRoot}/build.cmd",
21+
"args": [
22+
"<Path/To/MinGW/Cygwin/Bin/Folder>", // Path to the bin folder containing g++ to compile
23+
"fib.exe" // Output executable name
24+
]
25+
},
26+
"linux": {
27+
"command": "g++",
28+
"args": [
29+
"-g",
30+
"*.cpp",
31+
"-lpthread",
32+
"--std=c++11",
33+
"-o",
34+
"fib.out"
35+
]
36+
},
37+
"osx": {
38+
"command": "g++",
39+
"args": [
40+
"-g",
41+
"*.cpp",
42+
"-lpthread",
43+
"--std=c++11",
44+
"-o",
45+
"fib.out"
46+
]
47+
}
48+
}
49+
]
50+
}

Code Samples/Fib/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Fib
2+
3+
This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug.

Code Samples/Fib/build.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SET PATH=%PATH%;%1
2+
g++ -g *.cpp -lpthread --std=c++11 -O0 -o %2

Code Samples/Fib/main.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <iostream>
2+
#include <unistd.h>
3+
#include <sys/types.h>
4+
#include <pthread.h>
5+
#include <stdio.h>
6+
#include <stdlib.h>
7+
#include <time.h>
8+
#include <string.h>
9+
10+
#include "thread.h"
11+
12+
#define THREAD_COUNT 10
13+
14+
static char block[] = "--block";
15+
int test = 0;
16+
17+
int main(int argc, char **argv)
18+
{
19+
srand(time(NULL));
20+
21+
static char pidText[] = "PID: ";
22+
std::string helpText = "Attach a debugger and execute 'set foo=0' to continue";
23+
char helloText[] = "Hello World!";
24+
25+
std::cout << helloText << std::endl;
26+
27+
pthread_t threads[THREAD_COUNT];
28+
29+
if (argc == 2 && !strcmp(block, argv[1]))
30+
{
31+
std::cout << helpText << std::endl;
32+
volatile int foo = 1;
33+
while (foo)
34+
;
35+
}
36+
37+
if (argc == 2 && !strcmp("--crash", argv[1]))
38+
{
39+
int foo = 0;
40+
int bar = 1 / foo;
41+
}
42+
43+
for (int i = 0; i < THREAD_COUNT; i++)
44+
{
45+
std::cout << "Test " << i << std::endl;
46+
pthread_create(&threads[i], NULL, &thread_proc, NULL);
47+
}
48+
49+
for (int i = 0; i < THREAD_COUNT; i++)
50+
{
51+
pthread_join(threads[i], NULL);
52+
test++;
53+
}
54+
55+
std::cout << "All threads exited!" << std::endl;
56+
57+
return 1;
58+
}

Code Samples/Fib/thread.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <iostream>
2+
#include <unistd.h>
3+
#include <sys/types.h>
4+
#include <pthread.h>
5+
#include <stdio.h>
6+
#include <stdlib.h>
7+
#include <time.h>
8+
#include <string.h>
9+
10+
#include "thread.h"
11+
12+
static int g_tid = 0;
13+
14+
static int fib(int n){
15+
switch (n) {
16+
case 0: return 1;
17+
case 1: return 1;
18+
default: return (fib(n-2) + fib(n-1));
19+
}
20+
}
21+
22+
void * thread_proc(void* ctx)
23+
{
24+
int tid = g_tid++;
25+
26+
char thread_name[16];
27+
sprintf(thread_name, "Thread %d", tid);
28+
#ifdef __APPLE__
29+
pthread_setname_np(thread_name);
30+
#else
31+
pthread_setname_np(pthread_self(), thread_name);
32+
#endif
33+
34+
// Random delay, 0 - 0.5 sec
35+
timespec ts;
36+
ts.tv_sec = 0;
37+
ts.tv_nsec = 500000000 + ((float)rand() / (float)RAND_MAX) * 500000000;
38+
nanosleep(&ts, NULL);
39+
40+
volatile int i = 0;
41+
while (i <= 30) {
42+
std::cout << "Thread " << tid << ": fib(" << i << ") = " << fib(i) << std::endl;
43+
i++;
44+
nanosleep(&ts, NULL);
45+
}
46+
47+
std::cout << thread_name << " exited!" << std::endl;
48+
}

Code Samples/Fib/thread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void * thread_proc(void* ctx);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Natvis - Custom views for native objects
2+
3+
Natvis framework is a framework that allows developers to write custom schemas to help visualize native objects.
4+
5+
For gdb/lldb debugging (`"type": "cppdbg"`), a subset of the Natvis framework has been ported to the C/C++ extension and the code resides in the [MIEngine](https://github.com/Microsoft/MIEngine) shared component. If additional features that are not implemented are requested, please file an [issue](https://github.com/Microsoft/MIEngine/issues) on the MIEngine GitHub page with details of what is missing.
6+
7+
For Visual C++ debugging (`"type": "cppvsdbg"`), the debugger contains the full implementation of the Natvis framework as Visual Studio.
8+
9+
## Documentation
10+
11+
Official documentation can be found [here](https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects).
12+
13+
## Schema
14+
15+
The natvis schema can be found [here](natvis.xsd).

0 commit comments

Comments
 (0)