Update the building and installing lldb docs. (#74)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 21 Sep 2018 04:33:12 +0000 (21:33 -0700)
committerGitHub <noreply@github.com>
Fri, 21 Sep 2018 04:33:12 +0000 (21:33 -0700)
Add embedded pdbs to testing.

Add scripts to build/install lldb for some distros.

Fix the build on certain distros after testing docs.

Add RuntimeFrameworkVersionMajor.

25 files changed:
Directory.Build.props
README.md
documentation/building/freebsd-instructions.md
documentation/building/linux-instructions.md
documentation/building/osx-instructions.md
documentation/building/ubuntu18.04/build-install-curl.sh [new file with mode: 0755]
documentation/lldb/buildinglldb.md
documentation/lldb/centos7/build-install-lldb.sh [new file with mode: 0755]
documentation/lldb/fedora24/build-install-lldb.sh [new file with mode: 0755]
documentation/lldb/freebsd-instructions.md [new file with mode: 0644]
documentation/lldb/linux-instructions.md
documentation/lldb/netbsd-instructions.md [new file with mode: 0644]
documentation/lldb/opensuse/build-install-lldb.sh [new file with mode: 0755]
documentation/lldb/osx-instructions.md [new file with mode: 0644]
eng/Build-Native.cmd
eng/CreateVersionFile.csproj
eng/build-native.sh
eng/common/build.sh
eng/setup-vs-tools.cmd [new file with mode: 0644]
eng/setup_vs_tools.cmd [deleted file]
src/Microsoft.Diagnostic.TestHelpers/TestConfiguration.cs
src/Microsoft.Diagnostic.TestHelpers/TestRunner.cs
src/SOS/SOS.UnitTests/Debuggees/SymbolTestApp/SymbolTestApp/SymbolTestApp.cs
src/SOS/SOS.UnitTests/SOS.cs
src/SOS/SOS.UnitTests/Scripts/StackAndOtherTests.script

index 7cb64a97beb1fa1094ad61e0ddf8f2a89accbadd..920036cb9c4cbdf422235b080658934997795ef9 100644 (file)
@@ -5,5 +5,11 @@
     <PackageLicenseUrl>http://go.microsoft.com/fwlink/?LinkId=529443</PackageLicenseUrl>
     <PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</PackageIconUrl>
     <NoPackageAnalysis>true</NoPackageAnalysis>
+
+    <!-- Disable source link until issue https://github.com/dotnet/roslyn/issues/29289#issuecomment-413294637 is fixed -->
+    <EnableSourceLink>false</EnableSourceLink>
+    <DeterministicSourcePaths>false</DeterministicSourcePaths>
+    <EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
+    <RepositoryUrl>https://github.com/dotnet/diagnostics.git</RepositoryUrl>
   </PropertyGroup>
 </Project>
index ee5f263f22c0b2439f73c6f477294228774f0c58..0200c4501ff2b4318f1ec2b39b85ff1ff0686f86 100644 (file)
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ To install the platform's prerequisites:
 To build under Windows, run build.cmd from the root of the repository:
 
 ```bat
-build.cmd 
+build.cmd 
 
 [Lots of build spew]
 
@@ -42,19 +42,19 @@ BUILD: Product binaries are available at c:\git\diagnostics\artifacts\Debug\bin\
 To build for x86:
 
 ```bat
-build.cmd -architecture x86
+build.cmd -architecture x86
 ```
 
 To test the resulting SOS:
 
 ```bat
-test.cmd
+test.cmd
 ```
 
 To build under Linux, MacOS, FreeBSD, or NetBSD, run build.sh from the root of the repository:
 
 ```sh
-./build.sh
+./build.sh
 
 [Lots of build spew]
 
@@ -65,30 +65,17 @@ BUILD: Product binaries are available at /home/mikem/diagnostics/artifacts/Debug
 To test the resulting SOS and plugin:
 
 ```sh
-./test.sh
+./test.sh
 ```
 
 ## Getting lldb 
 
 Getting a version of lldb that works for your platform can be a problem sometimes. The version has to be at least 3.9 or greater because of a bug running SOS on a core dump that was fixed. Some Linux distros like Ubuntu it is easy as `sudo apt-get install lldb-3.9 python-lldb-3.9`. On other distros, you will need to build lldb. The directions below should give you some guidance.
 
-### [Linux Instructions](documentation/lldb/linux-instructions.md)
-
-### FreeBSD Instructions (10.1)
-```sh
-% sudo pkg install llvm39 gettext python27
-```
-
-### NetBSD/OpenBSD Instructions
-
-TBD
-
-### macOS (Sierra 10.12.6) Instructions
-
-The version of lldb that comes with Xcode 9.2 will now work with SOS. We no longer have to build lldb locally.
-
-Later versions of macOS/Xcode TBD. 
+ * [Linux Instructions](documentation/lldb/linux-instructions.md)
+ * [macOS Instructions](documentation/lldb/osx-instructions.md)
+ * [FreeBSD Instructions](documentation/lldb/freebsd-instructions.md) 
+ * [NetBSD Instructions](documentation/lldb/netbsd-instructions.md)
 
 ## Useful Links
 
index 34a3495ef2c4363ea059e91eefadaa840756226e..b598855d9bb20b8ddde06774507b75f9f7c19996 100644 (file)
@@ -27,5 +27,5 @@ Install the following packages for the toolchain:
 To install the packages you need:
 
 ```sh
-sudo pkg install bash cmake llvm39 gettext python27
+sudo pkg install bash cmake llvm39 gettext python27
 ```
index 786c7f585ac4c32851feea273459156e52b3dfa5..791895197b47437700888f8bd8c7a02d139e243a 100644 (file)
 Linux Prerequisites 
 ===================
 
-These instructions will lead you through preparing to build the diagnostics repo on Linux. We'll start by showing how to set up your environment from scratch.
+These instructions will lead you through preparing to build and test the diagnostics repo on Linux. We'll start by showing how to set up your environment from scratch. In some cases, a version lldb/llvm that works the best on the distro will have to be built and installed.
 
-Environment
-===========
+Toolchain Setup
+---------------
 
-These instructions are written assuming the Ubuntu 14.04 LTS, since that's the distro the team uses. Pull Requests are welcome to address other environments as long as they don't break the ability to use Ubuntu 14.04 LTS.
+The following instructions will install the required packages. This only needs to be done once per machine. These instructions assume that you already have "sudo" installed. It is also recommended to create a github fork of the diagnostics repo and cloning that instead of https://github.com/dotnet/diagnostics.git directly.
 
-There have been reports of issues when using other distros or versions of Ubuntu (e.g. [Issue 95](https://github.com/dotnet/coreclr/issues/95)). If you're on another distribution, consider using docker's `ubuntu:14.04` image.
+#### Ubuntu 14.04 ####
 
-Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs ([Issue 536](https://github.com/dotnet/coreclr/issues/536)).
+In order to get clang-3.9, llvm-3.9 and lldb-3.9, we need to add additional package sources (see [http://llvm.org/apt/](http://llvm.org/apt/) for the other Ubuntu versions not listed here):
 
-Toolchain Setup
----------------
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
 
-#### Ubuntu (14.04, 16.04, 16.10, 17.10, 18.04) ####
+Then install the required packages:
 
-Install the following packages: 
+    sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip
 
-- cmake
-- make 
-- llvm-3.9
-- clang-3.9
-- lldb-3.9
-- liblldb-3.9-dev
-- wget
-- gettext
-- python27
+The lldb 3.9 package needs a lib file symbolic link fixed:
 
-In order to get clang-3.9, llvm-3.9 and lldb-3.9 on Ubuntu 14.04 (see [http://llvm.org/apt/](http://llvm.org/apt/) for the other versions), we need to add an additional package source:
+    cd /usr/lib/llvm-3.9/lib
+    sudo ln -s ../../x86_64-linux-gnu/liblldb-3.9.so.1 liblldb-3.9.so.1
 
-    ~$ echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee /etc/apt/sources.list.d/llvm.list
-    ~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
-    ~$ sudo apt-get update
+See the section below on how to clone, build and test the repo.
 
-Note: arm clang has a known issue with CompareExchange (#15074), so for arm you have to use clang-4.0 or higher, the official build uses clang-5.0.
-    
-For other version of Debian/Ubuntu, please visit http://apt.llvm.org/.
+#### Ubuntu 16.04 ####
 
-Then install the packages you need:
+Add the additional package sources:
+
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
+
+Then install the required packages:
 
-    ~$ sudo apt-get install make wget cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev gettext
+    sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip
 
 The lldb 3.9 package needs a lib file symbolic link fixed:
 
     cd /usr/lib/llvm-3.9/lib
     sudo ln -s ../../x86_64-linux-gnu/liblldb-3.9.so.1 liblldb-3.9.so.1
 
-You now have all the required components.
+See the section below on how to clone, build and test the repo.
+
+#### Ubuntu 17.10 ####
+
+Add the additional package sources:
+
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
 
-#### Alpine (3.6) ####
+Then install the required packages:
 
+    sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python python-lldb-3.9 tar zip
 
-```sh
-~$ sudo apk add clang clang-dev cmake coreutils gcc gettext-dev linux-headers llvm lldb-dev make python
+#### Ubuntu 18.04 ####
 
-```
+Install the required packages:
 
-#### CentOS (6, 7) ####
+    sudo apt-get update
+    sudo apt-get install cmake clang-3.9 curl gdb gettext git libicu-dev libssl1.0-dev lldb-3.9 liblldb-3.9-dev libunwind8 llvm-3.9 make python-lldb-3.9 tar wget zip 
 
-llvm, clang and lldb 3.9 will have to be built for this distro ([TBD] add instructions).
+See the section below on how to clone, build and test the repo.
 
-```sh
-~$ sudo yum install centos-release-SCL epel-release
-~$ sudo yum install which wget make cmake cmake3 gcc gcc-c++ python27 python-argparse python-devel
+#### Alpine 3.6 ####
 
-```
+Currently there is no lldb that works on Alpine.
 
-#### Debian (8.2) ####
+Issue https://github.com/dotnet/diagnostics/issues/73
+
+#### CentOS 6 ####
 
 [TBD]
 
-#### Fedora (23, 24, 27, 28) ####
+#### CentOS 7 ####
+
+llvm, clang and lldb 3.9 will have to be built for this distro.
+
+First the prerequisites:
+
+    sudo yum install centos-release-SCL epel-release
+    sudo yum install cmake cmake3 gcc gcc-c++ gdb git libicu libunwind make python27 tar wget which zip
+
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/centos7/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/centos7/build-install-lldb.sh
+
+This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo:
+
+    cd diagnostics
+    ./build.sh
+    ./test.sh
+
+#### Debian 8.2/8.7 ####
+
+In order to get lldb-5.0 (3.9 doesn't seem to work that well on 8.x), we need to add additional package sources:
+
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-5.0 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
+
+Then install the packages you need:
+
+    sudo apt-get install cmake clang-5.0 gdb gettext git libicu-dev liblldb-5.0-dev libunwind8 lldb-5.0 llvm make python-lldb-5.0 tar wget zip
+
+See the section below on how to clone, build and test the repo. Add "--clang5.0" to the ./build.sh command.
+
+#### Debian 9 (Stretch) ####
+
+    sudo apt-get install cmake clang-3.9 gdb gettext git libicu-dev liblldb-3.9-dev libunwind8 lldb-3.9 llvm make python-lldb-3.9 tar wget zip
+
+See the section below on how to clone, build and test the repo.
+
+#### Fedora 24 ####
+
+    sudo dnf install clang cmake findutils gdb git libicu libunwind make python tar wget which zip
+
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/fedora24/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/fedora24/build-install-lldb.sh
+
+This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo:
+
+    cd diagnostics
+    ./build.sh
+    ./test.sh
 
-```sh
-~$ sudo dnf install which wget cmake make clang llvm-devel lldb-devel python27 
+#### Fedora 27, 28 ####
 
-```
+    sudo dnf install clang cmake compat-openssl10 findutils gdb git libicu libunwind lldb-devel llvm-devel make python python2-lldb tar wget which zip
 
-#### OpenSuse (42.1, 42.3) ####
+See the section below on how to clone, build and test the repo.
+
+#### OpenSuse 42.1, 42.3 ####
+
+    sudo zypper install cmake gcc-c++ gdb git hostname libicu libunwind lldb-devel llvm-clang llvm-devel make python python-xml tar wget which zip
+    ln -s /usr/bin/clang++ /usr/bin/clang++-3.5
+
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/opensuse/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/opensuse/build-install-lldb.sh
+
+This will take some time to complete, but after it is finished all the required components will be built and installed. To build and test the repo:
+
+    cd diagnostics
+    ./build.sh
+    ./test.sh
+
+#### RHEL 7.5 ####
+
+[TBD]
+
+#### SLES ####
 
 [TBD]
 
 Set the maximum number of file-handles
 --------------------------------------
 
-To ensure that your system can allocate enough file-handles for the corefx build run `sysctl fs.file-max`. If it is less than 100000, add `fs.file-max = 100000` to `/etc/sysctl.conf`, and then run `sudo sysctl -p`.
+To ensure that your system can allocate enough file-handles for the build run `sysctl fs.file-max`. If it is less than 100000, add `fs.file-max = 100000` to `/etc/sysctl.conf`, and then run `sudo sysctl -p`.
+
+Clone, build and test the repo
+------------------------------
+
+You now have all the required components. To clone, build and test the repo:
 
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    cd diagnostics
+    ./build.sh
+    ./test.sh
index e9898bdbbcb8d4188dcf286f7767c1ff121293ff..0bd70b3afa929163c90b6742c2842d3fa122b3dd 100644 (file)
@@ -14,7 +14,7 @@ Git Setup
 Clone the diagnostics repository (either upstream or a fork).
 
 ```sh
-git clone https://github.com/dotnet/diagnostics
+git clone https://github.com/dotnet/diagnostics
 ```
 
 CMake
diff --git a/documentation/building/ubuntu18.04/build-install-curl.sh b/documentation/building/ubuntu18.04/build-install-curl.sh
new file mode 100755 (executable)
index 0000000..ee0e368
--- /dev/null
@@ -0,0 +1,18 @@
+# Install cmake version 3.10.2 without installing libcurl.so.4
+wget https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz
+sudo tar -xf cmake-3.10.2-Linux-x86_64.tar.gz --strip 1 -C /usr/local
+rm cmake-3.10.2-Linux-x86_64.tar.gz
+
+# Build and install curl 7.45.0 to get the right version of libcurl.so.4
+wget https://curl.haxx.se/download/curl-7.45.0.tar.lzma
+tar -xf curl-7.45.0.tar.lzma
+rm curl-7.45.0.tar.lzma
+cd curl-7.45.0
+./configure --disable-dict --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-ldaps --disable-libcurl-option --disable-manual --disable-pop3 --disable-rtsp --disable-smb --disable-smtp --disable-telnet --disable-tftp --enable-ipv6 --enable-optimize --enable-symbol-hiding --with-ca-path=/etc/ssl/certs/ --with-nghttp2 --with-gssapi --with-ssl --without-librtmp
+make
+sudo make install
+cd ..
+rm -r curl-7.45.0
+
+# Install curl
+sudo apt-get install curl
index 05e69f0aa5a05259b94c0cff2ffd98dbc1ce48f3..0020200de3273d3e2777c827808bca66e2952ef2 100644 (file)
@@ -1,5 +1,7 @@
-Building LLDB
-=============
+Building LLDB from the LLVM repos
+=================================
+
+These instructions have been replace with better and more through documentation. See [Getting lldb](../../../README.md#getting-lldb) in the main readme.
 
 1. Clone the llvm, clang, and lldb repos like this:
 
diff --git a/documentation/lldb/centos7/build-install-lldb.sh b/documentation/lldb/centos7/build-install-lldb.sh
new file mode 100755 (executable)
index 0000000..1c4cda2
--- /dev/null
@@ -0,0 +1,37 @@
+# These are needed to build lldb 3.9
+sudo yum install doxygen libedit-devel libxml2-devel python-argparse python-devel readline-devel swig xz
+
+cd $HOME
+wget ftp://sourceware.org/pub/binutils/snapshots/binutils-2.29.1.tar.xz
+wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/compiler-rt-3.9.1.src.tar.xz
+
+tar -xf binutils-2.29.1.tar.xz
+tar -xf llvm-3.9.1.src.tar.xz
+mkdir llvm-3.9.1.src/tools/clang
+mkdir llvm-3.9.1.src/tools/lldb
+mkdir llvm-3.9.1.src/projects/compiler-rt
+tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang
+tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb
+tar -xf compiler-rt-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/projects/compiler-rt
+rm binutils-2.29.1.tar.xz
+rm cfe-3.9.1.src.tar.xz
+rm lldb-3.9.1.src.tar.xz
+rm llvm-3.9.1.src.tar.xz
+rm compiler-rt-3.9.1.src.tar.xz
+
+mkdir llvmbuild
+cd llvmbuild
+cmake3 -DCMAKE_BUILD_TYPE=Release -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BINUTILS_INCDIR=../binutils-2.29.1/include ../llvm-3.9.1.src
+make -j $(($(getconf _NPROCESSORS_ONLN)+1))
+sudo make install
+cd ..
+rm -r llvmbuild
+rm -r llvm-3.9.1.src
+rm -r binutils-2.29.1
+
+# Remove the no longer needed packages 
+sudo yum remove doxygen libedit-devel libxml2-devel python-argparse python-devel readline-devel swig xz
+sudo yum clean all
diff --git a/documentation/lldb/fedora24/build-install-lldb.sh b/documentation/lldb/fedora24/build-install-lldb.sh
new file mode 100755 (executable)
index 0000000..6a77974
--- /dev/null
@@ -0,0 +1,30 @@
+# These are needed to build lldb
+sudo dnf install doxygen libedit-devel libxml2-devel python-argparse python-devel readline-devel swig xz
+
+cd $HOME
+wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz
+
+tar -xf llvm-3.9.1.src.tar.xz
+mkdir llvm-3.9.1.src/tools/clang
+mkdir llvm-3.9.1.src/tools/lldb
+tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang
+tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb
+rm cfe-3.9.1.src.tar.xz
+rm lldb-3.9.1.src.tar.xz
+rm llvm-3.9.1.src.tar.xz
+
+mkdir llvmbuild
+cd llvmbuild
+cmake -DCMAKE_BUILD_TYPE=Release -DLLDB_DISABLE_CURSES=1 -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BUILD_DOCS=0 ../llvm-3.9.1.src
+
+make -j $(($(getconf _NPROCESSORS_ONLN)+1))
+sudo make install
+cd ..
+rm -r llvmbuild
+rm -r llvm-3.9.1.src
+
+# Remove the no longer needed packages 
+sudo dnf remove doxygen libedit-devel libxml2-devel readline-devel swig
+sudo dnf clean all
diff --git a/documentation/lldb/freebsd-instructions.md b/documentation/lldb/freebsd-instructions.md
new file mode 100644 (file)
index 0000000..7deb219
--- /dev/null
@@ -0,0 +1,6 @@
+Installing lldb on FreeBSD
+==========================
+
+Working in progress.
+
+    sudo pkg install llvm39 gettext python27
index 786c7f585ac4c32851feea273459156e52b3dfa5..10f61a6c1fdeb9dcad1e8188aee30f1ca267c0e8 100644 (file)
-Linux Prerequisites 
-===================
+Installing LLDB on Linux
+========================
 
-These instructions will lead you through preparing to build the diagnostics repo on Linux. We'll start by showing how to set up your environment from scratch.
+These instructions will lead you through installing or building the best version of lldb for your distro to use with SOS. If you have already followed the diagnostics repo build [prerequisites](../building/linux-instructions.md) and built the diagnostics repo, then the best version of lldb is already installed.
 
-Environment
-===========
+SOS needs at least lldb 3.9 or greater. Some distros only have older versions available by default so there are directions and scripts to build lldb 3.9 for that platform. These instructions assume that you have dotnet cli and its prerequisites installed.
 
-These instructions are written assuming the Ubuntu 14.04 LTS, since that's the distro the team uses. Pull Requests are welcome to address other environments as long as they don't break the ability to use Ubuntu 14.04 LTS.
+The libsosplugin.so built for lldb 3.9 does work with lldb 4.0, 5.0 and 6.0 but most of the testing has been on lldb 3.9.
 
-There have been reports of issues when using other distros or versions of Ubuntu (e.g. [Issue 95](https://github.com/dotnet/coreclr/issues/95)). If you're on another distribution, consider using docker's `ubuntu:14.04` image.
+#### Ubuntu 14.04 ####
 
-Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs ([Issue 536](https://github.com/dotnet/coreclr/issues/536)).
+In order to get lldb-3.9, we need to add additional package sources (see [http://llvm.org/apt/](http://llvm.org/apt/) for the other Ubuntu versions not listed here):
 
-Toolchain Setup
----------------
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
 
-#### Ubuntu (14.04, 16.04, 16.10, 17.10, 18.04) ####
+Install the lldb packages:
 
-Install the following packages: 
+    sudo apt-get install lldb-3.9 python-lldb-3.9
 
-- cmake
-- make 
-- llvm-3.9
-- clang-3.9
-- lldb-3.9
-- liblldb-3.9-dev
-- wget
-- gettext
-- python27
+To launch lldb:
 
-In order to get clang-3.9, llvm-3.9 and lldb-3.9 on Ubuntu 14.04 (see [http://llvm.org/apt/](http://llvm.org/apt/) for the other versions), we need to add an additional package source:
+    lldb-3.9
 
-    ~$ echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee /etc/apt/sources.list.d/llvm.list
-    ~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
-    ~$ sudo apt-get update
+#### Ubuntu 16.04 ####
 
-Note: arm clang has a known issue with CompareExchange (#15074), so for arm you have to use clang-4.0 or higher, the official build uses clang-5.0.
-    
-For other version of Debian/Ubuntu, please visit http://apt.llvm.org/.
+Add the additional package sources:
 
-Then install the packages you need:
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
 
-    ~$ sudo apt-get install make wget cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev gettext
+Install the lldb packages:
 
-The lldb 3.9 package needs a lib file symbolic link fixed:
+    sudo apt-get install lldb-3.9 python-lldb-3.9
 
-    cd /usr/lib/llvm-3.9/lib
-    sudo ln -s ../../x86_64-linux-gnu/liblldb-3.9.so.1 liblldb-3.9.so.1
+To launch lldb:
 
-You now have all the required components.
+    lldb-3.9
 
-#### Alpine (3.6) ####
+#### Ubuntu 17.10 ####
 
+Add the additional package sources:
 
-```sh
-~$ sudo apk add clang clang-dev cmake coreutils gcc gettext-dev linux-headers llvm lldb-dev make python
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/artful/ llvm-toolchain-artful-3.9 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
 
-```
+Install the lldb packages:
 
-#### CentOS (6, 7) ####
+    sudo apt-get install lldb-3.9 python-lldb-3.9
 
-llvm, clang and lldb 3.9 will have to be built for this distro ([TBD] add instructions).
+To launch lldb:
 
-```sh
-~$ sudo yum install centos-release-SCL epel-release
-~$ sudo yum install which wget make cmake cmake3 gcc gcc-c++ python27 python-argparse python-devel
+    lldb-3.9
 
-```
+#### Ubuntu 18.04 ####
 
-#### Debian (8.2) ####
+To install the lldb packages:
 
-[TBD]
+    sudo apt-get update
+    sudo apt-get install lldb-3.9 llvm-3.9 python-lldb-3.9
+
+To launch lldb:
+
+    lldb-3.9
 
-#### Fedora (23, 24, 27, 28) ####
+#### Alpine 3.6 ####
 
-```sh
-~$ sudo dnf install which wget cmake make clang llvm-devel lldb-devel python27 
+Currently there is no lldb that works on Alpine.
 
-```
+Issue https://github.com/dotnet/diagnostics/issues/73
 
-#### OpenSuse (42.1, 42.3) ####
+#### CentOS 6 ####
 
 [TBD]
 
-Set the maximum number of file-handles
---------------------------------------
+#### CentOS 7 ####
+
+lldb 3.9 will have to be built for this distro.
+
+First the prerequisites:
+
+    sudo yum install centos-release-SCL epel-release
+    sudo yum install cmake cmake3 gcc gcc-c++ git libicu libunwind make python27 tar wget which zip
+
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/centos7/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/centos7/build-install-lldb.sh
+
+This will take some time to complete.
+
+To launch lldb:
+
+    lldb-3.9.1
+
+#### Debian 8.2/8.7 ####
+
+In order to get lldb-5.0 (3.9 doesn't seem to work that well), we need to add additional package sources:
+
+    sudo apt-get update
+    sudo apt-get install wget
+    echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie main" | sudo tee /etc/apt/sources.list.d/llvm.list
+    echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-5.0 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
+    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+    sudo apt-get update
+
+Install the lldb packages:
+
+    sudo apt-get install lldb-5.0 python-lldb-5.0
+
+To launch lldb:
+
+    lldb-3.9
+
+#### Debian 9 (Stretch) ####
+
+    sudo apt-get install lldb-3.9 python-lldb-3.9
+
+To launch lldb:
+
+    lldb-3.9
+
+#### Fedora 24 ####
 
-To ensure that your system can allocate enough file-handles for the corefx build run `sysctl fs.file-max`. If it is less than 100000, add `fs.file-max = 100000` to `/etc/sysctl.conf`, and then run `sudo sysctl -p`.
+    sudo dnf install clang cmake findutils git libicu libunwind make python tar wget which zip
 
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/fedora24/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/fedora24/build-install-lldb.sh
+
+This will take some time to complete.
+
+To launch lldb:
+
+    lldb
+
+#### Fedora 27, 28 ####
+
+    sudo dnf install lldb python2-lldb
+
+To launch lldb:
+
+    lldb
+
+#### OpenSuse 42.1, 42.3 ####
+
+    sudo zypper install cmake gcc-c++ git hostname libicu libunwind lldb-devel llvm-clang llvm-devel make python python-xml tar wget which zip
+    ln -s /usr/bin/clang++ /usr/bin/clang++-3.5
+
+Now build and install llvm/lldb 3.9 using the script provided here: [build-install-lldb.sh](../lldb/opensuse/build-install-lldb.sh).
+
+WARNING: this script installs llvm and lldb and may overwrite any previously installed versions.
+
+    cd $HOME
+    git clone https://github.com/dotnet/diagnostics.git
+    $HOME/diagnostics/documentation/lldb/opensuse/build-install-lldb.sh
+
+This will take some time to complete.
+
+To launch lldb:
+
+    lldb-3.9.1
+
+#### RHEL 7.5 ####
+
+[TBD]
+
+#### SLES ####
+
+[TBD]
diff --git a/documentation/lldb/netbsd-instructions.md b/documentation/lldb/netbsd-instructions.md
new file mode 100644 (file)
index 0000000..e148326
--- /dev/null
@@ -0,0 +1,4 @@
+Installing lldb for NetBSD 
+==========================
+
+[TBD]
diff --git a/documentation/lldb/opensuse/build-install-lldb.sh b/documentation/lldb/opensuse/build-install-lldb.sh
new file mode 100755 (executable)
index 0000000..61716fa
--- /dev/null
@@ -0,0 +1,36 @@
+# These are need to build lldb
+sudo zypper install doxygen libedit-devel libxml2-devel ncurses-devel python-argparse python-devel readline-devel swig
+
+cd $HOME
+
+wget http://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.tar.gz
+wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
+wget http://releases.llvm.org/3.9.1/lldb-3.9.1.src.tar.xz
+
+tar -xf cmake-3.11.4-Linux-x86_64.tar.gz
+tar -xf llvm-3.9.1.src.tar.xz
+mkdir llvm-3.9.1.src/tools/clang
+mkdir llvm-3.9.1.src/tools/lldb
+tar -xf cfe-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/clang
+tar -xf lldb-3.9.1.src.tar.xz --strip 1 -C llvm-3.9.1.src/tools/lldb
+rm cmake-3.11.4-Linux-x86_64.tar.gz
+rm cfe-3.9.1.src.tar.xz
+rm lldb-3.9.1.src.tar.xz
+rm llvm-3.9.1.src.tar.xz
+
+mkdir llvmbuild
+cd llvmbuild
+../cmake-3.11.4-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Release -DLLDB_DISABLE_CURSES=1 -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=1 -DLLVM_BUILD_DOCS=0 ../llvm-3.9.1.src
+
+make -j $(($(getconf _NPROCESSORS_ONLN)+1))
+sudo make install
+cd ..
+rm -r llvmbuild
+rm -r llvm-3.9.1.src
+rm -r cmake-3.11.4-Linux-x86_64
+
+# Remove the no longer needed packages 
+sudo zypper rm doxygen libedit-devel libxml2-devel ncurses-devel python-argparse python-devel readline-devel swig
+sudo zypper clean -a
+
diff --git a/documentation/lldb/osx-instructions.md b/documentation/lldb/osx-instructions.md
new file mode 100644 (file)
index 0000000..cf202fe
--- /dev/null
@@ -0,0 +1,12 @@
+MacOS
+=====
+
+### MacOS (Sierra 10.12.6) Instructions
+
+The version of lldb that comes with Xcode 9.2 will now work with SOS. We no longer have to build lldb locally.
+
+### MacOS (High Sierra 10.13.4) Instructions
+
+Xcode 9.2/9.3 swift-4.1
+
+[TBD]
index e9ecd61d8faff404c602d2ca49ccde5e5581870c..9e92c7dc5e1c6a808b0950f21d0d084022f0b174 100644 (file)
@@ -9,7 +9,7 @@ echo %__MsgPrefix%Starting Build at %TIME%
 set __ThisScriptFull="%~f0"
 set __ThisScriptDir="%~dp0"
 
-call "%__ThisScriptDir%"\setup_vs_tools.cmd
+call "%__ThisScriptDir%"\setup-vs-tools.cmd
 if NOT '%ERRORLEVEL%' == '0' exit /b 1
 
 if defined VS150COMNTOOLS (
@@ -218,7 +218,7 @@ if %__Build% EQU 1 (
 :GenVSSolution
     echo Generating Version Header
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    %DotNetCli% %MSBuildPath% %__ProjectDir%\eng\CreateVersionFile.csproj /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionHeader2 /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    %DotNetCli% %MSBuildPath% %__ProjectDir%\eng\CreateVersionFile.csproj /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         exit /b 1
index 525194beb31089de8581afac8bf8630163a72ac8..534a557d0c3290e82b646e634b863a8f8f5381b2 100644 (file)
 
   <Import Condition="Exists('$(BuildVersionFileOverride)')" Project="$(BuildVersionFileOverride)" />
 
-  <Target Name="GenerateVersionHeader2" DependsOnTargets="CreateVersionFileOverride;GenerateVersionHeader"/>
+  <Target Name="GenerateVersionFiles" DependsOnTargets="CreateVersionFileOverride;GenerateVersionFileInternal;GenerateVersionSourceFileInternal"/>
 
-  <Target Name="GenerateVersionSourceFile2" DependsOnTargets="CreateVersionFileOverride;GenerateVersionSourceFile"/>
+  <Target Name="GenerateVersionFileInternal" Condition="'$(GenerateVersionHeader)' == 'true'" DependsOnTargets="GenerateVersionHeader"/>
+
+  <Target Name="GenerateVersionSourceFileInternal" Condition="'$(GenerateVersionSourceFile)' == 'true'" DependsOnTargets="GenerateVersionSourceFile"/>
 
   <Target Name="CreateVersionFileOverride" 
           Condition="'$(SkipVersionGeneration)' != 'true' AND '$(ShouldCreateVersionFileOverride)' == 'true'"
index c4e9d4c3265663a399db3683d00fd41caff45a64..3452603819b9d67ba0702afbe96e3cff78ba1964 100755 (executable)
@@ -24,12 +24,12 @@ __PortableBuild=1
 __ExtraCmakeArgs=""
 __ClangMajorVersion=0
 __ClangMinorVersion=0
-__CrossBuild=0
+__CrossBuild=false
 __NumProc=1
-__Build=0
-__Test=0
+__Build=false
+__Test=false
 __DailyTest=
-__CI=0
+__CI=false
 __TestArgs=
 __UnprocessedBuildArgs=
 
@@ -155,12 +155,12 @@ while :; do
             ;;
 
         --build-native)
-            __Build=1
+            __Build=true
             ;;
 
         # Passed to common build script when testing
         --test)
-            __Test=1
+            __Test=true
             ;;
 
         --daily-test)
@@ -168,7 +168,7 @@ while :; do
             ;;
 
         --ci)
-            __CI=1
+            __CI=true
             __TestArgs="$__TestArgs $1"
             ;;
 
@@ -253,13 +253,15 @@ fi
 
 # Needs to be set for generate version source file/msbuild
 if [[ -z $NUGET_PACKAGES ]]; then
-    if [[ $__CI ]]; then
+    if [[ $__CI == true ]]; then
         export NUGET_PACKAGES="$__ProjectRoot/.packages"
     else
         export NUGET_PACKAGES="$HOME/.nuget/packages"
     fi
 fi
 
+echo $NUGET_PACKAGES
+
 # Resolve python-version to use
 if [ "$PYTHON" == "" ] ; then
     if ! PYTHON=$(command -v python2.7 || command -v python2 || command -v python)
@@ -392,7 +394,7 @@ initHostDistroRid()
 
 initTargetDistroRid()
 {
-    if [ $__CrossBuild == 1 ]; then
+    if [ $__CrossBuild == true ]; then
         if [ "$__BuildOS" == "Linux" ]; then
             if [ ! -e $ROOTFS_DIR/etc/os-release ]; then
                 if [ -e $ROOTFS_DIR/android_platform ]; then
@@ -455,20 +457,25 @@ if [ "$__HostOS" == "OSX" ]; then
 fi
 
 # Build native components
-if [ $__Build == 1 ]; then
-    echo "Generating Version Source File"
-    __GenerateVersionLog="$__LogDir/GenerateVersion.binlog"
-    $__DotNetCli $__MSBuildPath $__ProjectRoot/eng/CreateVersionFile.csproj /noconlog /bl:$__GenerateVersionLog /t:GenerateVersionSourceFile2 /p:GenerateVersionSourceFile=true /p:NativeVersionSourceFile="$__IntermediatesDir/version.cpp" /p:Configuration="$__BuildType" /p:Platform="$__BuildArch" $__UnprocessedBuildArgs
-    if [ $? != 0 ]; then
-        echo "Generating Version Source File FAILED"
-        exit 1
+if [ $__Build == true ]; then
+    if [[ $__CI == true ]]; then
+        echo "Generating Version Source File"
+        __GenerateVersionLog="$__LogDir/GenerateVersion.binlog"
+        $__DotNetCli $__MSBuildPath $__ProjectRoot/eng/CreateVersionFile.csproj /noconlog /bl:$__GenerateVersionLog /t:GenerateVersionFiles /p:GenerateVersionSourceFile=true /p:NativeVersionSourceFile="$__IntermediatesDir/version.cpp" /p:Configuration="$__BuildType" /p:Platform="$__BuildArch" $__UnprocessedBuildArgs
+        if [ $? != 0 ]; then
+            echo "Generating Version Source File FAILED"
+            exit 1
+        fi
+    else
+        echo "Generating Empty Version Source File"
+       echo "" > "$__IntermediatesDir/version.cpp"
     fi
 
     build_native "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs"
 fi
 
 # Run SOS/lldbplugin tests
-if [ $__Test == 1 ]; then
+if [ $__Test == true ]; then
     # Install the other versions of .NET Core runtime we are going to test on
     "$__ProjectRoot/eng/install-test-runtimes.sh" --dotnet-directory "$__ProjectRoot/.dotnet" --temp-directory "$__IntermediatesDir" --architecture "$__BuildArch" $__DailyTest
 
index 9600f1b9503f770a65652afc6f9ba08c0804a14d..22a3b69a4647ffda73be6cf4896d6120ea55a28b 100755 (executable)
@@ -323,7 +323,7 @@ function Main {
   fi
 
   if [[ -z $NUGET_PACKAGES ]]; then
-    if [[ $ci ]]; then
+    if [[ $ci == true ]]; then
       export NUGET_PACKAGES="$repo_root/.packages"
     else
       export NUGET_PACKAGES="$HOME/.nuget/packages"
@@ -333,7 +333,7 @@ function Main {
   mkdir -p "$toolset_dir"
   mkdir -p "$log_dir"
   
-  if [[ $ci ]]; then
+  if [[ $ci == true ]]; then
     mkdir -p "$temp_dir"
     export TEMP="$temp_dir"
     export TMP="$temp_dir"
diff --git a/eng/setup-vs-tools.cmd b/eng/setup-vs-tools.cmd
new file mode 100644 (file)
index 0000000..9af06e5
--- /dev/null
@@ -0,0 +1,48 @@
+@if not defined _echo @echo off
+
+REM This script is responsible for setting up either the vs2015 or vs2017 env
+REM All passed arguments are ignored
+REM Script will return with 0 if pass, 1 if there is a failure to find either
+REM vs2015 or vs2017
+
+:: Default to highest Visual Studio version available
+::
+:: For VS2015 (and prior), only a single instance is allowed to be installed on a box
+:: and VS140COMNTOOLS is set as a global environment variable by the installer. This
+:: allows users to locate where the instance of VS2015 is installed.
+::
+:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
+:: is no longer set as a global environment variable and is instead only set if the user
+:: has launched the VS2017 Developer Command Prompt.
+::
+:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
+:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
+:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
+:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
+:: can be found.
+
+if defined VisualStudioVersion (
+    if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
+    goto skip_setup
+)
+
+echo %__MsgPrefix%Searching ^for Visual Studio 2017 or 2015 installation
+set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
+if exist %_VSWHERE% (
+    for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
+    goto call_vs
+)
+if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
+echo VS2017 not found, using VS2015
+:call_vs
+if not exist "%_VSCOMNTOOLS%" (
+    echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required.
+    echo        Please see https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
+    exit /b 1
+)
+echo %__MsgPrefix%"%_VSCOMNTOOLS%\VsDevCmd.bat"
+call "%_VSCOMNTOOLS%\VsDevCmd.bat"
+
+:skip_setup
+
+exit /b 0
\ No newline at end of file
diff --git a/eng/setup_vs_tools.cmd b/eng/setup_vs_tools.cmd
deleted file mode 100644 (file)
index 9af06e5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-@if not defined _echo @echo off
-
-REM This script is responsible for setting up either the vs2015 or vs2017 env
-REM All passed arguments are ignored
-REM Script will return with 0 if pass, 1 if there is a failure to find either
-REM vs2015 or vs2017
-
-:: Default to highest Visual Studio version available
-::
-:: For VS2015 (and prior), only a single instance is allowed to be installed on a box
-:: and VS140COMNTOOLS is set as a global environment variable by the installer. This
-:: allows users to locate where the instance of VS2015 is installed.
-::
-:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
-:: is no longer set as a global environment variable and is instead only set if the user
-:: has launched the VS2017 Developer Command Prompt.
-::
-:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
-:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
-:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
-:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
-:: can be found.
-
-if defined VisualStudioVersion (
-    if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
-    goto skip_setup
-)
-
-echo %__MsgPrefix%Searching ^for Visual Studio 2017 or 2015 installation
-set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
-if exist %_VSWHERE% (
-    for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
-    goto call_vs
-)
-if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
-echo VS2017 not found, using VS2015
-:call_vs
-if not exist "%_VSCOMNTOOLS%" (
-    echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required.
-    echo        Please see https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
-    exit /b 1
-)
-echo %__MsgPrefix%"%_VSCOMNTOOLS%\VsDevCmd.bat"
-call "%_VSCOMNTOOLS%\VsDevCmd.bat"
-
-:skip_setup
-
-exit /b 0
\ No newline at end of file
index 68bfca4138b6303dfdbb06dba5adf1f5eceecae5..09a7430071dc4a3f525e25816fabb27d47bfe4a3 100644 (file)
@@ -476,6 +476,25 @@ namespace Microsoft.Diagnostic.TestHelpers
             get { return GetValue("RuntimeFrameworkVersion"); }
         }
 
+        /// <summary>
+        /// The major portion of the runtime framework version
+        /// </summary>
+        public int RuntimeFrameworkVersionMajor
+        {
+            get {
+                string version = RuntimeFrameworkVersion;
+                if (version != null) {
+                    string[] parts = version.Split('.');
+                    if (parts.Length > 0) {
+                        if (int.TryParse(parts[0], out int major)) {
+                            return major;
+                        }
+                    }
+                }
+                return 0;
+            }
+        }
+
         /// <summary>
         /// The type of PDB: "full" (Windows PDB) or "portable".
         /// </summary>
@@ -555,15 +574,16 @@ namespace Microsoft.Diagnostic.TestHelpers
         /// </summary>
         public bool CreateDumpExists
         {
-            get { return OS.Kind == OSKind.Linux && IsNETCore && !RuntimeFrameworkVersion.StartsWith("1."); }
+            get { return OS.Kind == OSKind.Linux && IsNETCore && RuntimeFrameworkVersionMajor > 1; }
         }
 
         /// <summary>
-        /// Returns true if a stack overflow causes dump to be generated with createdump. Currently no .NET Core version does.
+        /// Returns true if a stack overflow causes dump to be generated with createdump. 3.x has now started to
+        /// create dumps on stack overflow.
         /// </summary>
         public bool StackOverflowCreatesDump
         {
-            get { return false; }
+            get { return IsNETCore && RuntimeFrameworkVersionMajor >= 3; }
         }
 
         /// <summary>
@@ -571,7 +591,7 @@ namespace Microsoft.Diagnostic.TestHelpers
         /// </summary>
         public bool StackOverflowSIGSEGV
         {
-            get { return OS.Kind == OSKind.Linux && IsNETCore && RuntimeFrameworkVersion.StartsWith("1."); }
+            get { return OS.Kind == OSKind.Linux && IsNETCore && RuntimeFrameworkVersionMajor == 1; }
         }
 
         #endregion
index ecef8d2976c42f083458987c2423abeb42fe49a5..0bc1b6ef49b099769071b8243076437ecddae835 100644 (file)
@@ -98,17 +98,13 @@ namespace Microsoft.Diagnostic.TestHelpers
         /// <returns>new configs for each supported PDB type</returns>
         public static IEnumerable<TestConfiguration> EnumeratePdbTypeConfigs(TestConfiguration config)
         {
-            // Enabled after an official dotnet cli supports "embedded" PDBs - issue #244
-            // string[] pdbTypes = { "portable", "embedded" };
-            string[] pdbTypes = { "portable" };
+            string[] pdbTypes = { "portable", "embedded" };
 
             if (OS.Kind == OSKind.Windows)
             {
                 if (config.IsNETCore)
                 {
-                    // Enabled after an official dotnet cli supports "embedded" PDBs - issue #244
-                    // pdbTypes = new string[] { "portable", "full", "embedded" };
-                    pdbTypes = new string[] { "portable", "full" };
+                    pdbTypes = new string[] { "portable", "full", "embedded" };
                 }
                 else
                 {
index 289d91ec073f121c417941270058fd79339be2c7..f576c5d37b7cca34047e586dec3b1f82cfcaa0af 100644 (file)
@@ -34,11 +34,19 @@ namespace SymbolTestApp
         {
 #if FULL_CLR
             byte[] dll = File.ReadAllBytes(Path.Combine(dllPath, @"SymbolTestDll.dll"));
-            byte[] pdb = File.ReadAllBytes(Path.Combine(dllPath, @"SymbolTestDll.pdb"));
+            byte[] pdb = null;
+            string pdbFile = Path.Combine(dllPath, @"SymbolTestDll.pdb");
+            if (File.Exists(pdbFile)) {
+                pdb = File.ReadAllBytes(pdbFile);
+            }
             Assembly assembly = Assembly.Load(dll, pdb);
 #else
             Stream dll = File.OpenRead(Path.Combine(dllPath, @"SymbolTestDll.dll"));
-            Stream pdb = File.OpenRead(Path.Combine(dllPath, @"SymbolTestDll.pdb"));
+            Stream pdb = null;
+            string pdbFile = Path.Combine(dllPath, @"SymbolTestDll.pdb");
+            if (File.Exists(pdbFile)) {
+                pdb = File.OpenRead(pdbFile);
+            }
             Assembly assembly = AssemblyLoadContext.Default.LoadFromStream(dll, pdb);
 #endif
             Type dllType = assembly.GetType("SymbolTestDll.TestClass");
index 636bc486163beefbf6b6fa43d47c85009bb1c0f5..70d222f630a45c9d032ac5bedce8ff00012370a8 100644 (file)
@@ -127,7 +127,7 @@ public class SOS
     public async Task StackAndOtherTests(TestConfiguration config)
     {
         SkipIfArm(config);
-        if (config.RuntimeFrameworkVersion != null && config.RuntimeFrameworkVersion.StartsWith("1.1"))
+        if (config.RuntimeFrameworkVersionMajor == 1)
         {
             throw new SkipTestException("The debuggee (SymbolTestApp) doesn't work on .NET Core 1.1 because of a AssemblyLoadContext problem");
         }
index a05bb39303bd23f4497716691cff6b8e26ac85a0..b180edd7c41e7ccb409c2a102c0af12aa5261ff3 100644 (file)
@@ -13,7 +13,7 @@ ENDIF:LIVE
 SOSCOMMAND:ClrStack
 VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
 VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
-VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>.*\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 46\]\s*
+VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>.*\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 54\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo2\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 29\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo1\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 24\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Main\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 19\]\s*
@@ -23,7 +23,7 @@ IFDEF:PROJECTK
 SOSCOMMAND:ClrStack -f
 VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
 VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
-VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.(dll|exe)!SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 46\]\s*
+VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.(dll|exe)!SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 54\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.(dll|exe)!SymbolTestApp\.Program\.Foo2\(.*\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 29\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.(dll|exe)!SymbolTestApp\.Program\.Foo1\(.*\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 24\]\s*
 VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.(dll|exe)!SymbolTestApp\.Program\.Main\(.*\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 19\]\s*
@@ -34,7 +34,7 @@ IFDEF:PROJECTK
 SOSCOMMAND:ClrStack -a
 VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
 VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
-VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 46\]\s*
+VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 54\]\s*
 VERIFY:\s+PARAMETERS:\s+
 VERIFY:\s+dllPath \(0x<HEXVAL>\) = 0x<HEXVAL>\s+
 VERIFY:.*\s+LOCALS:\s+
@@ -49,7 +49,7 @@ IFDEF:PROJECTK
 SOSCOMMAND:ClrStack -r
 VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
 VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
-VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 46\]\s*
+VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 54\]\s*
 VERIFY:\s+[r|e]sp=<HEXVAL>\s+[r|e]bp=<HEXVAL>\s+[r|e]ip=<HEXVAL>\s+
 VERIFY:\s+|r|e]ax=<HEXVAL>\s+[r|e]bx=<HEXVAL>\s+[r|e]cx=<HEXVAL>\s+
 VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo2\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 29\]\s*
@@ -139,7 +139,7 @@ ENDIF:PROJECTK
 SOSCOMMAND:ClrStack
 SOSCOMMAND:IP2MD <POUT>.*\s+(<HEXVAL>)\s+SymbolTestApp\.Program\.Foo4.*\s+<POUT>
 VERIFY:.*\s+Method Name:\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+
-VERIFY:.*\s+Source file:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 46\s+
+VERIFY:.*\s+Source file:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 54\s+
 
 # Verify that "u" works (depends on the IP2MD right above)
 IFDEF:PROJECTK
@@ -147,7 +147,7 @@ SOSCOMMAND:u <POUT>\s*MethodDesc:\s+(<HEXVAL>)\s*<POUT>
 VERIFY:\s*Normal JIT generated code\s+
 VERIFY:\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+
 VERIFY:\s+Begin\s+<HEXVAL>,\s+size\s+<HEXVAL>\s+
-VERIFY:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 46:\s+
+VERIFY:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 54:\s+
 ENDIF:PROJECTK
 
 # Verify that "u" with no line info works
@@ -164,7 +164,7 @@ SOSCOMMAND:u -o <PREVPOUT>
 VERIFY:\s*Normal JIT generated code\s+
 VERIFY:\s+SymbolTestApp\.Program\.Foo4\(System\.String\)\s+
 VERIFY:\s+Begin\s+<HEXVAL>,\s+size\s+<HEXVAL>\s+
-VERIFY:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 46:\s+
+VERIFY:\s+(?i:.*[\\|/]SymbolTestApp\.cs) @ 54:\s+
 ENDIF:PROJECTK
 
 # Verify that Name2EE works