├── lib ├── libdtrace │ ├── compat │ │ ├── win32 │ │ │ ├── alloca.h │ │ │ ├── libelf.h │ │ │ ├── libgen.h │ │ │ ├── inc │ │ │ │ ├── netdb.h │ │ │ │ ├── sys │ │ │ │ │ ├── elf.h │ │ │ │ │ ├── ipc.h │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── ioccom.h │ │ │ │ │ ├── isa_defs.h │ │ │ │ │ ├── linker.h │ │ │ │ │ ├── mman.h │ │ │ │ │ ├── modctl.h │ │ │ │ │ ├── module.h │ │ │ │ │ ├── objfs.h │ │ │ │ │ ├── param.h │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── stdint.h │ │ │ │ │ ├── sysctl.h │ │ │ │ │ ├── ucred.h │ │ │ │ │ ├── wait.h │ │ │ │ │ ├── processor.h │ │ │ │ │ ├── socket.h │ │ │ │ │ ├── sysmacros.h │ │ │ │ │ ├── time.h │ │ │ │ │ ├── errno.h │ │ │ │ │ ├── fasttrap_isa.h │ │ │ │ │ ├── utsname.h │ │ │ │ │ ├── atomic.h │ │ │ │ │ ├── cpuvar.h │ │ │ │ │ └── zmod.h │ │ │ │ ├── arpa │ │ │ │ │ ├── inet.h │ │ │ │ │ └── nameser.h │ │ │ │ ├── netinet │ │ │ │ │ └── in.h │ │ │ │ ├── strings.h │ │ │ │ ├── ucontext.h │ │ │ │ ├── unistd.h │ │ │ │ └── dirent.h │ │ │ ├── libproc.h │ │ │ ├── typeinfo │ │ │ │ ├── dtrace.amd64.ctf │ │ │ │ └── dtrace.arm64.ctf │ │ │ ├── dtrace.rc │ │ │ ├── dt_symsrv.h │ │ │ ├── gelf.h │ │ │ ├── dllmain.c │ │ │ └── dt_disasm.h │ │ └── freebsd │ │ │ ├── alloca.h │ │ │ ├── strings.h │ │ │ ├── stdio.h │ │ │ ├── fcntl.h │ │ │ ├── unistd.h │ │ │ └── libproc.h │ ├── common │ │ ├── mknames.pl │ │ ├── mkerrtags.pl │ │ ├── mkerrno.sh │ │ ├── mksignal.sh │ │ ├── dt_pq.h │ │ ├── dt_string.h │ │ ├── mknames.sh │ │ ├── dt_list.h │ │ ├── mkerrtags.sh │ │ ├── dt_regset.h │ │ ├── dt_as.h │ │ ├── dt_program.h │ │ └── dt_buf.h │ └── mips │ │ └── dt_isadep.c ├── libz │ ├── ChangeLog │ ├── default_allocator.c │ ├── inffast.h │ ├── infcodes.h │ ├── infblock.h │ └── adler32.c ├── libuutil │ └── common │ │ ├── libuutil_common.h │ │ ├── uu_string.c │ │ └── uu_open.c ├── ucpp │ ├── CHANGELOG │ └── LICENSE ├── libnvpair │ └── nvpair_alloc_system.c └── libctf │ └── common │ ├── libctf.h │ └── ctf_subr.c ├── sys ├── compat │ ├── freebsd │ │ ├── sys │ │ │ ├── systeminfo.h │ │ │ ├── objfs.h │ │ │ ├── cpupart.h │ │ │ ├── freebsd_rwlock.h │ │ │ ├── feature_tests.h │ │ │ ├── pcpu.h │ │ │ ├── refstr.h │ │ │ ├── mnttab.h │ │ │ ├── debug_compat.h │ │ │ ├── mman.h │ │ │ ├── disp.h │ │ │ ├── varargs.h │ │ │ ├── sema.h │ │ │ ├── modctl.h │ │ │ ├── param.h │ │ │ ├── callo.h │ │ │ ├── mount.h │ │ │ ├── random.h │ │ │ ├── string.h │ │ │ ├── acl.h │ │ │ ├── debug.h │ │ │ ├── kidmap.h │ │ │ ├── dirent.h │ │ │ ├── dnlc.h │ │ │ ├── pathname.h │ │ │ ├── sdt.h │ │ │ ├── systm.h │ │ │ ├── stat.h │ │ │ ├── lock.h │ │ │ ├── cmn_err.h │ │ │ ├── misc.h │ │ │ ├── vm.h │ │ │ └── kobj.h │ │ └── kern │ │ │ ├── opensolaris_dtrace.c │ │ │ └── opensolaris_proc.c │ └── win32 │ │ ├── dtrace.def │ │ └── dtrace.rc ├── dev │ ├── dtrace │ │ ├── dtrace_hacks.c │ │ ├── dtrace_modevent.c │ │ ├── aarch64 │ │ │ └── regset.h │ │ ├── riscv │ │ │ └── regset.h │ │ ├── arm │ │ │ └── regset.h │ │ ├── mips │ │ │ └── regset.h │ │ └── powerpc │ │ │ └── regset.h │ └── fbt │ │ ├── arm │ │ └── fbt_isa.h │ │ ├── x86 │ │ └── fbt_isa.h │ │ ├── aarch64 │ │ └── fbt_isa.h │ │ ├── mips │ │ └── fbt_isa.h │ │ ├── powerpc │ │ └── fbt_isa.h │ │ ├── riscv │ │ └── fbt_isa.h │ │ └── fbt.h ├── uts │ ├── arm │ │ └── dtrace │ │ │ └── fasttrap_isa.c │ ├── riscv │ │ ├── dtrace │ │ │ └── fasttrap_isa.c │ │ └── sys │ │ │ └── fasttrap_isa.h │ ├── aarch64 │ │ ├── dtrace │ │ │ └── fasttrap_isa.c │ │ └── sys │ │ │ └── fasttrap_isa.h │ ├── mips │ │ ├── dtrace │ │ │ └── fasttrap_isa.c │ │ └── sys │ │ │ └── fasttrap_isa.h │ └── common │ │ ├── sys │ │ ├── compress.h │ │ ├── list_impl.h │ │ ├── acl_impl.h │ │ ├── note.h │ │ ├── list.h │ │ ├── zmod.h │ │ └── nvpair_impl.h │ │ ├── os │ │ └── nvpair_alloc_system.c │ │ └── dtrace │ │ └── dtrace_xoroshiro128_plus.h └── common │ └── atomic │ └── amd64 │ └── opensolaris_atomic.S ├── cmd └── dtrace.rc ├── .gitignore ├── cgmanifest.json ├── releng ├── ConvertTo-Names.ps1 ├── ConvertTo-ErrorTags.ps1 └── Get-ExternalTools.ps1 ├── samples └── windows │ ├── widestring │ ├── newprocesstracker.d │ └── IoCreateDevice.d │ ├── pooltracking │ ├── PoolTrackingVerbose.d │ ├── anyPoolTracking.d │ ├── KsecPoolTrackingSummary.d │ └── PoolTrackingSummary.d │ ├── file │ └── fileiorwbypid.d │ ├── etw │ └── AddNewETWEvent.d │ ├── memory │ └── virtualmemoryallocfree.d │ └── devices │ └── dev_enum.d ├── COMPILING.md └── azure-pipelines.yml /lib/libdtrace/compat/win32/alloca.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/libelf.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/libgen.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/netdb.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/elf.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/ipc.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/arpa/nameser.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/netinet/in.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/strings.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/debug.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/ioccom.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/isa_defs.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/linker.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/mman.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/modctl.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/module.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/objfs.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/param.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/resource.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/stdint.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/sysctl.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/ucred.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/wait.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/ucontext.h: -------------------------------------------------------------------------------- 1 | /* placeholder */ 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/unistd.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/processor.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/socket.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/sysmacros.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/libproc.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/time.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/errno.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | -------------------------------------------------------------------------------- /lib/libz/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/DTrace-on-Windows/HEAD/lib/libz/ChangeLog -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/typeinfo/dtrace.amd64.ctf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/DTrace-on-Windows/HEAD/lib/libdtrace/compat/win32/typeinfo/dtrace.amd64.ctf -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/typeinfo/dtrace.arm64.ctf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/DTrace-on-Windows/HEAD/lib/libdtrace/compat/win32/typeinfo/dtrace.arm64.ctf -------------------------------------------------------------------------------- /sys/compat/freebsd/sys/systeminfo.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_SYSTEMINFO_H_ 2 | #define _SYS_SYSTEMINFO_H_ 3 | 4 | #define HW_HOSTID_LEN 11 5 | 6 | #endif /* !_SYS_SYSTEMINFO_H_ */ 7 | -------------------------------------------------------------------------------- /sys/dev/dtrace/dtrace_hacks.c: -------------------------------------------------------------------------------- 1 | /* $FreeBSD$ */ 2 | /* XXX Hacks.... */ 3 | 4 | dtrace_cacheid_t dtrace_predcache_id; 5 | 6 | boolean_t 7 | priv_policy_only(const cred_t *a, int b, boolean_t c) 8 | { 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /cmd/dtrace.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define VER_FILETYPE VFT_APP 5 | #define VER_FILESUBTYPE VFT2_UNKNOWN 6 | #define VER_FILEDESCRIPTION_STR "DTrace/NT" 7 | 8 | #define VER_INTERNALNAME_STR "dtrace.exe" 9 | #define VER_ORIGINALFILENAME_STR "dtrace.exe" 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /lib/libz/default_allocator.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | 6 | void * zcalloc (void *opaque, unsigned items, unsigned size) 7 | { 8 | return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size*items); 9 | } 10 | 11 | void zcfree (void *opaque, void *ptr) 12 | { 13 | HeapFree(GetProcessHeap(), 0, ptr); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /sys/compat/win32/dtrace.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | 3 | dtrace_register 4 | dtrace_unregister 5 | dtrace_invalidate 6 | dtrace_condense 7 | dtrace_attached 8 | dtrace_probe_create 9 | dtrace_probe_lookup 10 | dtrace_probe_arg 11 | dtrace_probe 12 | 13 | dtrace_module_unloaded 14 | 15 | dtrace_meta_register 16 | dtrace_meta_unregister 17 | 18 | dtrace_gethrtime 19 | dtrace_sync 20 | dtrace_interrupt_disable 21 | dtrace_interrupt_enable 22 | dtrace_panic 23 | dtrace_vpanic 24 | 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # Release Engineering Files 55 | build/ 56 | releng/external 57 | 58 | # Visual Studio user artifacts 59 | .vs/ 60 | *.user 61 | *.filters -------------------------------------------------------------------------------- /cgmanifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/component-detection-manifest.json", 3 | "Registrations": [ 4 | { 5 | "Component": { 6 | "Type": "git", 7 | "git": { 8 | "repositoryUrl": "https://github.com/opendtrace/opendtrace", 9 | "commitHash": "385fe75e3a186975eb8beace965fa67f229da67e" 10 | } 11 | } 12 | }, 13 | { 14 | "Component": { 15 | "Type": "git", 16 | "git": { 17 | "repositoryUrl": "https://github.com/lpsantil/ucpp", 18 | "commitHash": "3e62f13c6e786d2c8eff38fbfd1da4c2ffac4a53" 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /releng/ConvertTo-Names.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [Parameter(Mandatory=$true)][String] $File, 3 | [Parameter(Mandatory=$true)][String] $OutFile 4 | ) 5 | 6 | Set-Content $OutFile @" 7 | /* 8 | * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 9 | * Use is subject to license terms. 10 | */ 11 | 12 | #pragma ident`t`"%Z%%M%`t%I%`t%E% SMI`" 13 | 14 | #include 15 | 16 | /*ARGSUSED*/ 17 | const char * 18 | dtrace_subrstr(dtrace_hdl_t *dtp, int subr) 19 | { 20 | switch (subr) { 21 | "@ 22 | 23 | foreach($line in Get-Content -Path $File) { 24 | $expr = '#define[ ]*(DIF_SUBR_(\w*))' 25 | if($line -match $expr -and $Matches[1] -ne "DIF_SUBR_MAX") { 26 | "`t`t" + "case $($Matches[1]): return (`"$($Matches[2].ToLowerInvariant())`");" | 27 | Add-Content $OutFile 28 | } 29 | } 30 | 31 | Add-Content $OutFile @" 32 | `t`tdefault: return (`"unknown`"); 33 | } 34 | } 35 | "@ 36 | -------------------------------------------------------------------------------- /releng/ConvertTo-ErrorTags.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [Parameter(Mandatory=$true)][String] $File, 3 | [Parameter(Mandatory=$true)][String] $OutFile 4 | ) 5 | 6 | Set-Content $OutFile @" 7 | /* 8 | * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 9 | * Use is subject to license terms. 10 | */ 11 | 12 | #pragma ident`t`"%Z%%M%`t%I%`t%E% SMI`" 13 | 14 | #include 15 | 16 | static const char *const _dt_errtags[] = { 17 | "@ 18 | 19 | foreach($line in Get-Content -Path $File) { 20 | $expr = '^\s*(D_[A-Z0-9_]*),*' 21 | if($line -match $expr) { 22 | $line -replace $expr, ' "${1}",' | Add-Content $OutFile 23 | } 24 | } 25 | 26 | Add-Content $OutFile @' 27 | }; 28 | 29 | static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]); 30 | 31 | const char * 32 | dt_errtag(dt_errtag_t tag) 33 | { 34 | return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]); 35 | } 36 | '@ 37 | -------------------------------------------------------------------------------- /samples/windows/widestring/newprocesstracker.d: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | newprocesstracker.d 8 | 9 | Abstract: 10 | 11 | This script tracks and reports all new process created in the system. 12 | 13 | Requirements: 14 | 15 | This script needs symbols. 16 | 17 | Usage: 18 | 19 | dtrace.exe -s newprocesstracker.d 20 | 21 | --*/ 22 | 23 | syscall::NtCreateUserProcess:entry 24 | { 25 | this->ImagePathName = ((nt`_RTL_USER_PROCESS_PARAMETERS*) 26 | copyin(arg8, sizeof(nt`_RTL_USER_PROCESS_PARAMETERS)))->ImagePathName; 27 | 28 | this->fname = wstr2str((wchar_t*) 29 | copyin((uintptr_t)this->ImagePathName.Buffer, 30 | this->ImagePathName.Length), this->ImagePathName.Length/2); 31 | 32 | printf("Process %s PID %d created %s \n", execname, pid, this->fname); 33 | } 34 | -------------------------------------------------------------------------------- /lib/libz/inffast.h: -------------------------------------------------------------------------------- 1 | //$TAG BIZDEV 2 | // $IPCategory: 3 | // $DealPointID: 41723 4 | // $AgreementName: zlib license 5 | // $AgreementType: oss license 6 | // $ExternalOrigin: mark adler;jean-loup gailly 7 | //$ENDTAG 8 | 9 | //$TAG ENGR 10 | // $Owner: bryant 11 | // $Module: base_zlib 12 | // 13 | //$ENDTAG 14 | 15 | /* inffast.h -- header to use inffast.c 16 | * Copyright (C) 1995-2002 Mark Adler 17 | * For conditions of distribution and use, see copyright notice in zlib.h 18 | */ 19 | 20 | /* WARNING: this file should *not* be used by applications. It is 21 | part of the implementation of the compression library and is 22 | subject to change. Applications should only use zlib.h. 23 | */ 24 | 25 | extern int inflate_fast OF(( 26 | uInt, 27 | uInt, 28 | inflate_huft *, 29 | inflate_huft *, 30 | inflate_blocks_statef *, 31 | z_streamp )); 32 | -------------------------------------------------------------------------------- /COMPILING.md: -------------------------------------------------------------------------------- 1 | # Compiling OpenDTrace for Windows (user-mode components) 2 | 3 | ## Requirements 4 | 5 | * [Windows WDK and SDK](https://docs.microsoft.com/windows-hardware/drivers/download-the-wdk) (version 1903 or later) 6 | * [Git for Windows](https://git-scm.com/download/win) 7 | * [Windows 10 Anniversary Update](https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update/#GD97Eq04wJA7S4P7.97) (or newer) 8 | 9 | ## Steps 10 | 11 | 1. Install WDK/SDK following instructions in https://docs.microsoft.com/windows-hardware/drivers/download-the-wdk 12 | 13 | 2. Install Git for Windows. 14 | 15 | 3. Clone the repository (`git clone https://github.com/microsoft/DTrace-on-Windows`). 16 | 17 | 4. Execute `releng\Get-ExternalTools.ps1` in PowerShell. (Right-click the script and select Run with PowerShell.) 18 | 19 | 5. Open `opendtrace.sln` in Visual Studio. 20 | 21 | 6. Change the target platform as needed and build the solution. -------------------------------------------------------------------------------- /releng/Get-ExternalTools.ps1: -------------------------------------------------------------------------------- 1 | $WasRootDir = (Get-Item .).Name -ne "releng" 2 | if ($WasRootDir) { 3 | Set-Location -Path releng 4 | } 5 | 6 | $Url = "https://github.com/lexxmark/winflexbison/releases/download/v2.5.17/winflexbison-2.5.17.zip" 7 | $ExpectedHash = "3DC27A16C21B717BCC5DE8590B564D4392A0B8577170C058729D067D95DED825" 8 | 9 | [IO.Directory]::CreateDirectory('external\tools\bin') | Out-Null 10 | Invoke-WebRequest -UseBasicParsing $Url -OutFile 'winflexbison.zip' 11 | $Results = Get-FileHash 'winflexbison.zip' -Algorithm SHA256 12 | if ($Results.Hash -ne $ExpectedHash) { 13 | Write-Output "Expected hash: $ExpectedHash" 14 | Write-Output "Actual hash : $($Results.Hash)" 15 | Write-Error "Downloaded file hash does not match expected hash" 16 | } 17 | 18 | Expand-Archive -Path 'winflexbison.zip' -DestinationPath 'external\tools\bin' -Force 19 | Remove-Item 'winflexbison.zip' 20 | 21 | if ($WasRootDir) { 22 | Set-Location -Path .. 23 | } 24 | -------------------------------------------------------------------------------- /lib/libdtrace/common/mknames.pl: -------------------------------------------------------------------------------- 1 | #-----------------------------------------------------------------// 2 | # 3 | # Copyright (c) Microsoft Corporation 4 | # 5 | # Module Name: 6 | # 7 | # mknames.pl 8 | # 9 | # Abstract: 10 | # 11 | # This program generates the code to translate DIF subroutine ID 12 | # to its name. 13 | # 14 | #-----------------------------------------------------------------// 15 | 16 | print < 22 | 23 | const char * 24 | dtrace_subrstr(dtrace_hdl_t *dtp, int subr) 25 | { 26 | switch (subr) { 27 | 28 | HEADER 29 | 30 | while (<>) { 31 | my $line = $_; 32 | my ($sym) = $line =~ /^#define\t(DIF_SUBR_[A-Z0-9_]*).*$/; 33 | if (!$sym or ($sym eq "DIF_SUBR_MAX")) { 34 | next; 35 | } 36 | my $name = lc substr $sym, 9; 37 | print "\tcase $sym: return (\"$name\");\n"; 38 | next; 39 | } 40 | 41 | 42 | print < 21 | 22 | static const char *const _dt_errtags[] = { 23 | 24 | HEADER 25 | 26 | while (<>) { 27 | my $line = $_; 28 | my ($sym, $comment) = $line =~ /^\s*(D_[A-Z0-9_]*)\s*,(.*)$/; 29 | if (!$sym) { 30 | next; 31 | } 32 | 33 | print "\t\"$sym\",$comment\n"; 34 | next; 35 | } 36 | 37 | 38 | print < 0 && tag < _dt_ntag) ? tag : 0]); 47 | } 48 | 49 | FOOTER 50 | 51 | 52 | -------------------------------------------------------------------------------- /sys/uts/arm/dtrace/fasttrap_isa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /* 23 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 | * Use is subject to license terms. 25 | */ 26 | 27 | 28 | /* 29 | * XXX: Placeholder for ARM fasttrap code 30 | */ 31 | -------------------------------------------------------------------------------- /sys/uts/riscv/dtrace/fasttrap_isa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /* 23 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 | * Use is subject to license terms. 25 | */ 26 | 27 | /* 28 | * XXX: Placeholder for RISC-V fasttrap code 29 | */ 30 | -------------------------------------------------------------------------------- /sys/uts/aarch64/dtrace/fasttrap_isa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /* 23 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 | * Use is subject to license terms. 25 | */ 26 | 27 | /* 28 | * XXX: Placeholder for AArch64 fasttrap code 29 | */ 30 | -------------------------------------------------------------------------------- /sys/uts/mips/dtrace/fasttrap_isa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /* 23 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 | * Use is subject to license terms. 25 | */ 26 | 27 | 28 | /* 29 | * XXX: Placeholder for MIPS fasttrap code 30 | */ 31 | -------------------------------------------------------------------------------- /lib/libz/infcodes.h: -------------------------------------------------------------------------------- 1 | //$TAG BIZDEV 2 | // $IPCategory: 3 | // $DealPointID: 41723 4 | // $AgreementName: zlib license 5 | // $AgreementType: oss license 6 | // $ExternalOrigin: mark adler;jean-loup gailly 7 | //$ENDTAG 8 | 9 | //$TAG ENGR 10 | // $Owner: bryant 11 | // $Module: base_zlib 12 | // 13 | //$ENDTAG 14 | 15 | /* infcodes.h -- header to use infcodes.c 16 | * Copyright (C) 1995-2002 Mark Adler 17 | * For conditions of distribution and use, see copyright notice in zlib.h 18 | */ 19 | 20 | /* WARNING: this file should *not* be used by applications. It is 21 | part of the implementation of the compression library and is 22 | subject to change. Applications should only use zlib.h. 23 | */ 24 | 25 | struct inflate_codes_state; 26 | typedef struct inflate_codes_state FAR inflate_codes_statef; 27 | 28 | extern inflate_codes_statef *inflate_codes_new OF(( 29 | uInt, uInt, 30 | inflate_huft *, inflate_huft *, 31 | z_streamp )); 32 | 33 | extern int inflate_codes OF(( 34 | inflate_blocks_statef *, 35 | z_streamp , 36 | int)); 37 | 38 | extern void inflate_codes_free OF(( 39 | inflate_codes_statef *, 40 | z_streamp )); 41 | 42 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/fasttrap_isa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /*++ 23 | 24 | Copyright (c) Microsoft Corporation 25 | 26 | Module Name: 27 | 28 | fasttrap_isa.h 29 | 30 | Abstract: 31 | 32 | This file contains fasttrap interface definitions for specific instruction 33 | set. 34 | 35 | --*/ 36 | 37 | #pragma once 38 | 39 | typedef uint32_t fasttrap_instr_t; 40 | 41 | -------------------------------------------------------------------------------- /lib/libuutil/common/libuutil_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /* 23 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 | * Use is subject to license terms. 25 | */ 26 | 27 | #ifndef _LIBUUTIL_COMMON_H 28 | #define _LIBUUTIL_COMMON_H 29 | 30 | #pragma ident "%Z%%M% %I% %E% SMI" 31 | 32 | #include 33 | #include 34 | 35 | #endif /* _LIBUUTIL_COMMON_H */ 36 | -------------------------------------------------------------------------------- /sys/compat/freebsd/sys/objfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | * 21 | * $FreeBSD$ 22 | */ 23 | 24 | #ifndef _COMPAT_OPENSOLARIS_SYS_OBJFS_H 25 | #define _COMPAT_OPENSOLARIS_SYS_OBJFS_H 26 | 27 | /* 28 | * Private data structure found in '.info' section 29 | */ 30 | typedef struct objfs_info { 31 | int objfs_info_primary; 32 | } objfs_info_t; 33 | 34 | 35 | #endif /* _COMPAT_OPENSOLARIS_SYS_OBJFS_H */ 36 | -------------------------------------------------------------------------------- /lib/ucpp/CHANGELOG: -------------------------------------------------------------------------------- 1 | Changes by Akash Trehan for DTrace on Windows: 2 | * Cleanup compiler warnings - potentially uninitialized variables, 3 | unreferenced format parameters, possible loss of data due to 4 | implicit casts 5 | * Undefine UCPP_MMAP flag in tune.h 6 | * Rename CHAR and CONTEXT tokens enum to DT_CHAR and DT_CONTEXT to 7 | avoid conflict with existing definitions with the same name 8 | * Remove Makefile, .gitignore 9 | 10 | ucpp-1.3.2 11 | * Fixed Issue 8, Included files missing a "terminating carriage 12 | return character" will interrupt preprocessing in sample.c/LEXER 13 | mode. 14 | (http://code.google.com/p/ucpp/issues/detail?id=8) 15 | 16 | ucpp-1.3.1 17 | * Fixed Issue 5, "\r\n" carriage return characters are double 18 | counted. 19 | (http://code.google.com/p/ucpp/issues/detail?id=5) 20 | * Fixed Issue 6, Included files missing a "terminating carriage 21 | return character" will interrupt preprocessing in ucpp 22 | (STAND_ALONE mode). 23 | (http://code.google.com/p/ucpp/issues/detail?id=6) 24 | * Fixed Issue 7, STD_MACROS & STD_ASSERTS undefined when trying to 25 | build ucpp -DSTAND_ALONE. 26 | (http://code.google.com/p/ucpp/issues/detail?id=7) 27 | * Build ucpp & libucpp with 'make'. 28 | 29 | ucpp-1.3 30 | * Original import into svn at code.google.com/p/ucpp 31 | -------------------------------------------------------------------------------- /sys/compat/win32/dtrace.rc: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #define VER_FILETYPE VFT_DRV 26 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 27 | #define VER_FILEDESCRIPTION_STR "DTrace/NT" 28 | 29 | #define VER_INTERNALNAME_STR "dtrace.sys" 30 | #define VER_ORIGINALFILENAME_STR "dtrace.sys" 31 | 32 | #include 33 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - windows 3 | 4 | pool: 5 | vmImage: windows-latest 6 | 7 | steps: 8 | - task: PowerShell@2 9 | displayName: "Get External Tools" 10 | inputs: 11 | filePath: 'releng\Get-ExternalTools.ps1' 12 | 13 | - task: VSBuild@1 14 | displayName: "VSBuild - x64" 15 | inputs: 16 | solution: '**\*.sln' 17 | platform: 'x64' 18 | configuration: 'Release' 19 | clean: true 20 | 21 | - task: VSBuild@1 22 | displayName: "VSBuild - ARM64" 23 | inputs: 24 | solution: '**\*.sln' 25 | platform: 'ARM64' 26 | configuration: 'Release' 27 | clean: true 28 | 29 | - task: CopyFiles@2 30 | displayName: "Copy output files" 31 | inputs: 32 | SourceFolder: '$(System.DefaultWorkingDirectory)' 33 | Contents: | 34 | **\build\** 35 | !**\tmp\**\* 36 | TargetFolder: '$(Build.ArtifactStagingDirectory)' 37 | 38 | - task: PublishBuildArtifacts@1 39 | displayName: "Publish output files" 40 | inputs: 41 | PathtoPublish: '$(Build.ArtifactStagingDirectory)' 42 | ArtifactName: 'DTrace' 43 | publishLocation: 'Container' 44 | 45 | - task: ComponentGovernanceComponentDetection@0 46 | displayName: "Component Detection and Governance" 47 | inputs: 48 | scanType: 'Register' 49 | verbosity: 'Verbose' 50 | alertWarningLevel: 'High' 51 | -------------------------------------------------------------------------------- /lib/libdtrace/compat/win32/inc/sys/utsname.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | */ 21 | 22 | /*++ 23 | 24 | Copyright (c) Microsoft Corporation 25 | 26 | Module Name: 27 | 28 | utsname.h 29 | 30 | Abstract: 31 | 32 | This file defines a minimal interface to the utsname for the DTrace/NT 33 | compatibility layer. 34 | 35 | --*/ 36 | 37 | #pragma once 38 | 39 | typedef struct utsname { 40 | int placeholder; 41 | } utsname_t; 42 | 43 | -------------------------------------------------------------------------------- /samples/windows/widestring/IoCreateDevice.d: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | IoCreateDevice.d 8 | 9 | Abstract: 10 | 11 | This script tracks and reports all new device creation. Plug in a USB like device to validate output. 12 | 13 | Requirements: 14 | 15 | This script has no special requirements. 16 | 17 | Usage: 18 | 19 | dtrace.exe -s IoCreateDevice.d 20 | 21 | --*/ 22 | 23 | fbt:nt:IoCreateDeviceSecure:entry 24 | { 25 | temp = wstr2str((wchar_t*) ((PUNICODE_STRING)arg2)->Buffer, ((PUNICODE_STRING)arg2)->Length/2); 26 | self->spec = speculation(); 27 | speculate (self->spec); 28 | printf( "Created device %s \n", temp); 29 | self->sddlstring = 1; 30 | } 31 | 32 | fbt:nt:SeConvertStringSecurityDescriptorToSecurityDescriptor:entry 33 | / self->sddlstring && self->spec / 34 | { 35 | speculate (self->spec); 36 | printf(" Device SDDL %s \n ", wstr2str((wchar_t*)arg0, 128)); 37 | } 38 | 39 | fbt:nt:IoCreateDeviceSecure:return 40 | { 41 | if (arg1 == 0) 42 | { 43 | commit(self->spec); 44 | /* printf("Device creation success \n");*/ 45 | } 46 | else 47 | { 48 | discard(self->spec); 49 | /* printf("Device creation failed %x \n ", arg1); */ 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sys/dev/dtrace/dtrace_modevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CDDL HEADER START 3 | * 4 | * The contents of this file are subject to the terms of the 5 | * Common Development and Distribution License (the "License"). 6 | * You may not use this file except in compliance with the License. 7 | * 8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 | * or http://www.opensolaris.org/os/licensing. 10 | * See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | * 13 | * When distributing Covered Code, include this CDDL HEADER in each 14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 | * If applicable, add the following below this CDDL HEADER, with the 16 | * fields enclosed by brackets "[]" replaced with your own identifying 17 | * information: Portions Copyright [yyyy] [name of copyright owner] 18 | * 19 | * CDDL HEADER END 20 | * 21 | * $FreeBSD$ 22 | * 23 | */ 24 | 25 | /* ARGSUSED */ 26 | static int 27 | dtrace_modevent(module_t mod __unused, int type, void *data __unused) 28 | { 29 | int error = 0; 30 | 31 | switch (type) { 32 | case MOD_LOAD: 33 | break; 34 | 35 | case MOD_UNLOAD: 36 | break; 37 | 38 | case MOD_SHUTDOWN: 39 | break; 40 | 41 | default: 42 | error = EOPNOTSUPP; 43 | break; 44 | 45 | } 46 | return (error); 47 | } 48 | -------------------------------------------------------------------------------- /samples/windows/pooltracking/PoolTrackingVerbose.d: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Usage:dtrace -s