├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .gitattributes ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── SmartDump.exe ├── SmartDump64.exe ├── main.cpp └── smartdetector.png /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/cpp/.devcontainer/base.Dockerfile 2 | ARG VARIANT="buster" 3 | FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} 4 | 5 | # [Optional] Uncomment this section to install additional packages. 6 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 7 | # && apt-get -y install --no-install-recommends 8 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.159.0/containers/cpp 3 | { 4 | "name": "C++", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | // Update 'VARIANT' to pick an Debian OS version: buster, stretch 8 | "args": { "VARIANT": "buster" } 9 | }, 10 | "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], 11 | 12 | // Set *default* container specific settings.json values on container create. 13 | "settings": { 14 | "terminal.integrated.shell.linux": "/bin/bash" 15 | }, 16 | 17 | // Add the IDs of extensions you want installed when the container is created. 18 | "extensions": [ 19 | "ms-vscode.cpptools" 20 | ], 21 | 22 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 23 | // "forwardPorts": [], 24 | 25 | // Use 'postCreateCommand' to run commands after the container is created. 26 | // "postCreateCommand": "gcc -v", 27 | 28 | // Comment out this line to run as root instead. 29 | "remoteUser": "vscode" 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.{cmd,[cC][mM][dD]} text eol=crlf 3 | *.{bat,[bB][aA][tT]} text eol=crlf 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | 332 | # Build output for this sample 333 | *.out -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch Main", 6 | "type": "cppdbg", 7 | "request": "launch", 8 | "program": "${workspaceFolder}/main.out", 9 | "args": [], 10 | "stopAtEntry": false, 11 | "cwd": "${workspaceFolder}", 12 | "environment": [], 13 | "externalConsole": false, 14 | "MIMode": "gdb", 15 | "setupCommands": [ 16 | { 17 | "description": "Enable pretty-printing for gdb", 18 | "text": "-enable-pretty-printing", 19 | "ignoreFailures": true 20 | } 21 | ], 22 | "preLaunchTask": "Build Main" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build Main", 6 | "type": "shell", 7 | "command": "g++ -g main.cpp -o main.out", 8 | "group": { 9 | "kind": "build", 10 | "isDefault": true 11 | } 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction: 2 | 3 | SmartDump is a flexible command line utility to capture exception logs and memory dump files against a target process based on user specified settings like filter strings or memory addresses of breakpoints. This tool also focuses on addressing several scenarios that we cannot utilize some well-known and most widely used debugging tools, for example: 4 | 5 | 1. iDNA Trace(TTT/TTD) cannot be used within Kudu console or RDP for Azure Web Sites related debugging scenarios. 6 | 2. Debug Diagnostic Tool(DebugDiag) cannot be installed and used for Kudu console or RDP as well. 7 | 3. Procdump works with Kudu but may not successfully capture managed exceptions against web hosts with .Net Core runtime. 8 | 4. For intermittent issues, capturing iDNA Trace(TTT/TTD) may not be an appropriate approach even with selective recording. 9 | 10 | Currently SmartDump is still under development. New features are continuously being added. 11 | Bug reports, suggestions and feedback from you will be very much appreciated. 12 | 13 | 14 | # New feature: 15 | 16 | **New feature in release 1.13.** 17 | 18 | Support new argument: 19 | -exit Dettach and exit a SmartDump instance with pid specified with -p . This is useful in situations that Ctrl-C or Ctrl-Break doesn't work. 20 | Another way is to create a **config.ini** file in the same path of SmartDump.exe. Create a [Runtime] section and set Exit = 1, i.e: 21 | ``` 22 | [Runtime] 23 | Exit=1 24 | ``` 25 | (This works well in more specific cases like Kudu console.) 26 | 27 | **Support of .Net 6 has been added in release 1.12.** 28 | 29 | Now -v option can real-time display manage callstack when a .net exception is thrown. Moreover using function name as filter to capture memory dump is supported. 30 | 31 | (NOTE: this feature is only available on 32bit version currently and hasn't been added into 64bit version. 32 | 33 | ![SD09](https://user-images.githubusercontent.com/32285008/134506066-196c33c0-782f-42da-bf6b-d84ea75b0bbf.gif) 34 | 35 | 36 | # How to Use: 37 | 38 | Below is a detailed step-to-step demo. 39 | 40 | 1. First of all, we need to open Kudu console and drag/upload the tool into the site folder. 41 | 42 | ![SD01](https://user-images.githubusercontent.com/32285008/122495908-775acb00-d01d-11eb-8e95-7c1bbef34290.gif) 43 | 44 | 45 | 46 | 2. Next, we need to find the PID of our site’s w3wp.exe from Process Explorer. 47 | 48 | NOTE: the one with (scm) is for Kudu console. Hence we always have to focus on w3wp.exe without (scm). 49 | 50 | ![SD02](https://user-images.githubusercontent.com/32285008/122495932-7e81d900-d01d-11eb-8bda-68c05beadb8f.gif) 51 | 52 | 53 | 54 | 3. Then we can run SmartDump.exe and use -p option to specify the PID found in step #2. 55 | 56 | This makes SmartDump attach to the target process and start to monitor any exception thrown in it. By default, the tool captures 5 exceptions. 57 | 58 | ![SD03](https://user-images.githubusercontent.com/32285008/122495954-893c6e00-d01d-11eb-8701-4c90cb879242.gif) 59 | 60 | After submitting requests to generate some exceptions, SmartDump will be able to capture them within the console. 61 | 62 | ![SD04](https://user-images.githubusercontent.com/32285008/122495968-8e99b880-d01d-11eb-8758-6fbcc3a0b7e3.gif) 63 | 64 | 65 | 66 | 4. If you want to see more exceptions, just use -n option to specify number of exceptions to be captured. 67 | 68 | NOTE: using -n 0 to start an unlimited/endless capture. However please be careful to use this in Kudu because it doesn’t support Ctrl+C to exit a process. Run inside a common cmd.exe without such issue. 69 | 70 | Tips: you can also add: > filename.log at the end of a command to make Kudu write output into a log file for you. 71 | 72 | ![SD05](https://user-images.githubusercontent.com/32285008/122495986-98bbb700-d01d-11eb-93d7-e2b65da75b0d.gif) 73 | 74 | 75 | 76 | 5. To generate dump, use -d option to set number of dumps to be captured. Associating it with -f(filter include) allows you to capture dumps against specific exceptions. Also, use -fv (filter exclude) options to filter/exclude any unnecessary exceptions from output. 77 | 78 | - -f Filter exception based on specified string(s). Use '|' as delimiter for multiple strings. 79 | - -fv Exclude exceptions contain specified filter. Use '|' as delimiter for multiple strings. 80 | 81 | ![SD06](https://user-images.githubusercontent.com/32285008/122496003-a1ac8880-d01d-11eb-80be-ba1ca557b5e7.gif) 82 | 83 | 84 | 85 | 6. The tool also supports to set memory address of breakpoint to generate dump files. 86 | 87 | You can capture a dump first and then open it in debugger to find the code entry address of a function you interest in(or code address of any line). 88 | Then use -a option of SmartDump to set the address as breakpoint for capture: 89 | 90 | ![SD07](https://user-images.githubusercontent.com/32285008/122496017-a96c2d00-d01d-11eb-9195-420c959c6ec8.gif) 91 | ![SD08](https://user-images.githubusercontent.com/32285008/122496030-af620e00-d01d-11eb-8901-2fdda0c46d20.gif) 92 | 93 | 94 | 95 | 96 | # Usage: 97 | 98 | SmartDump x86/x64 - exception and memory dump capture utility 99 | 100 | **Options:** 101 | 102 | -p PID of target process. 103 | 104 | -n Number of exceptions to be captured. Default is 5. Set to 0 means unlimited. 105 | 106 | -d Collect number of dumps. 107 | 108 | -de Collect number of dumps in 'Dump for each' mode. Dumps will be captured for each of different exception types. 109 | 110 | -f Filter(include) exception based on specified string(s). Use '|' as delimiter for multiple strings. 111 | 112 | -fv Exclude exceptions contain specified filter. Use '|' as delimiter for multiple strings. 113 | 114 | -s Skip the first number of exceptions for dump capture. 115 | 116 | -ma Capture a manual dump. 117 | 118 | -mn Option to captue a mini dump. Default setting is to capture full memory dumps. 119 | 120 | -v Enable verbose output to list managed callstacks and function entry addresses that can be utilized to set breakpoints with -a option. 121 | 122 | -a Dump with address of breakpoint. 123 | 124 | -o Output path of dump(s). 125 | 126 | -exit Dettach and exit a SmartDump instance with pid specified with -p . 127 | 128 | -h Or -?/-help. Display usage and examples. 129 | 130 | 131 | Examples: 132 | ------------------------------------------ 133 | 134 | - Write a manual dump against process with id 4567: 135 | SmartDump.exe -ma -p 4567 136 | 137 | - Monitor and print 10 managed exceptions against process with id 4567: 138 | SmartDump.exe -p 4567 -n 10 139 | 140 | - Capture two dumps based on filtered strings of managed exceptions: 141 | SmartDump.exe -p 4567 -f "Object reference not set|ArgumentException" -n 10 -d 2 142 | 143 | - Exclude exceptions contain specified filter string from output: 144 | SmartDump.exe -p 4567 -n 10 -fv "InvalidOperationException|FileNotFoundException" 145 | 146 | - Skip the first 3 NullReferenceException. Capture a memory dump for the 4th one and specify output path to: c:\home\dump. 147 | SmartDump.exe -p 4567 -n 10 -f "NullReferenceException" -s 3 -d 1 -o c:\home\dump 148 | 149 | - Capture 3 mini dumps for each of the exception types: NullReferenceException, SocketException and ArgumentException 150 | SmartDump.exe -p 4567 -n 10 -de 3 -mn -f "NullReferenceException|SocketException|ArgumentException" 151 | 152 | - Display verbose output to list managed callstacks. 153 | After that, we can use function name as filter to capture dumps or utilize function entry address to set breakpoint with -a option to dump an interested call. 154 | SmartDump.exe -p 4567 -n 20 -v 155 | 156 | - Capture a dump based on specified address of breakpoint: 157 | SmartDump.exe -d 1 -p 4567 -a 7a64e9d0 -n 1 158 | 159 | The following are several sample commands that uses the tool with Kudu debug console. 160 | 161 | 1) Show options and examples 162 | 163 | ![image](https://user-images.githubusercontent.com/32285008/122183087-79a61380-cebd-11eb-9276-a34d6ccf1e05.png) 164 | 165 | 166 | 2) Monitor and display exceptions 167 | 168 | ![image](https://user-images.githubusercontent.com/32285008/121565037-a934c600-ca4e-11eb-9f3d-f287933ed944.png) 169 | 170 | 171 | 3) Capture a manual dump 172 | 173 | ![image](https://user-images.githubusercontent.com/32285008/121565536-19434c00-ca4f-11eb-9312-e4e8f6086c4b.png) 174 | 175 | 176 | 4) Capture two exception dumps based on filter string. 177 | 178 | ![image](https://user-images.githubusercontent.com/32285008/121566060-b56d5300-ca4f-11eb-8ff3-5caca299f0b8.png) 179 | 180 | 181 | 5) Exclude/filter uninterested exceptions based on specified strings delimited with '|' 182 | 183 | ![image](https://user-images.githubusercontent.com/32285008/121568609-7391dc00-ca52-11eb-83d6-696c973e4a06.png) 184 | 185 | 6) Collect dump based on specified address of breakpoint. 186 | 187 | ![image](https://user-images.githubusercontent.com/32285008/122042223-769f1a80-ce0c-11eb-9529-8c5ca17c6b02.png) 188 | 189 | 190 | 7) Skip the first 3 SqlException. Capture two memory dumps for the 4th and 5th ones and specify output path to: c:\home\dump. 191 | 192 | ![image](https://user-images.githubusercontent.com/32285008/122184337-b32b4e80-cebe-11eb-88f5-cf91a546e8c5.png) 193 | 194 | 195 | 8) Use -de 'Dump for each' option to capture 3 mini dump files for 3 specified exception types: InvalidOperationException, SqlException and ServiceOperationsProviderException. 196 | 197 | ![image](https://user-images.githubusercontent.com/32285008/124462318-2dffcf00-ddc4-11eb-98e8-397f4be01ae1.png) 198 | 199 | 200 | 9) Use SmartDump to write a log of exceptions for your site. 201 | 202 | ![image](https://user-images.githubusercontent.com/32285008/122149025-fd480c00-ce8d-11eb-8ae9-650f4367ecf3.png) 203 | ![image](https://user-images.githubusercontent.com/32285008/122149126-28326000-ce8e-11eb-9b6a-cee89a2d77bd.png) 204 | 205 | 206 | 10) Capture against process of onpromise environment 207 | 208 | ![image](https://user-images.githubusercontent.com/32285008/121570281-4f36ff00-ca54-11eb-8089-df7fb2e14924.png) 209 | 210 | 11) Verbose(-v) option can real-time display manage callstack when a .net exception is thrown. Moreover using function name as filter to capture memory dump is supported in this build. 211 | (NOTE: this feature is only available on 32bit version currently and hasn't been added into 64bit version. 212 | 213 | SmartDump.exe -p 4567 -n 20 -v 214 | 215 | ![SD09](https://user-images.githubusercontent.com/32285008/134506066-196c33c0-782f-42da-bf6b-d84ea75b0bbf.gif) 216 | 217 | Also a function entry address of a function can be used to dump its corresponding interested call. 218 | The frame output indicates the entry code address of the first managed call that threw the exception is 0x00007ffd`551f0eb0. 219 | 220 | ![image](https://user-images.githubusercontent.com/32285008/127641176-398496c7-d0c3-476b-8c32-9fd9ef1ce2b7.png) 221 | 222 | So we use address: 00007ffd`551f0eb0 as breakpoint to capture dump with -a option: 223 | 224 | ![image](https://user-images.githubusercontent.com/32285008/127641192-1cd3deb0-5372-4327-8d47-57fd4322e4be.png) 225 | 226 | As we can see, 00007ffd`551f0eb0 is just the entry address of function: System.Data.SqlClient.SqlConnection.OnError 227 | 228 | ![image](https://user-images.githubusercontent.com/32285008/127642176-79245fbc-5fa9-4ffd-8d2f-af553567db82.png) 229 | 230 | # Project 231 | 232 | > This repo has been populated by an initial template to help get you started. Please 233 | > make sure to update the content to build a great experience for community-building. 234 | 235 | As the maintainer of this project, please make a few updates: 236 | 237 | - Improving this README.MD file to provide a great experience 238 | - Updating SUPPORT.MD with content about this project's support experience 239 | - Understanding the security reporting process in SECURITY.MD 240 | - Remove this section from the README 241 | 242 | ## Contributing 243 | 244 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 245 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 246 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. 247 | 248 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 249 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 250 | provided by the bot. You will only need to do this once across all repos using our CLA. 251 | 252 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 253 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 254 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 255 | 256 | ## Trademarks 257 | 258 | This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 259 | trademarks or logos is subject to and must follow 260 | [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 261 | Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. 262 | Any use of third-party trademarks or logos are subject to those third-party's policies. 263 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). 40 | 41 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # TODO: The maintainer of this repo has not yet edited this file 2 | 3 | **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? 4 | 5 | - **No CSS support:** Fill out this template with information about how to file issues and get help. 6 | - **Yes CSS support:** Fill out an intake form at [aka.ms/spot](https://aka.ms/spot). CSS will work with/help you to determine next steps. More details also available at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). 7 | - **Not sure?** Fill out a SPOT intake as though the answer were "Yes". CSS will help you decide. 8 | 9 | *Then remove this first heading from this SUPPORT.MD file before publishing your repo.* 10 | 11 | # Support 12 | 13 | ## How to file issues and get help 14 | 15 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 16 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 17 | feature request as a new Issue. 18 | 19 | For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE 20 | FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER 21 | CHANNEL. WHERE WILL YOU HELP PEOPLE?**. 22 | 23 | ## Microsoft Support Policy 24 | 25 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above. 26 | -------------------------------------------------------------------------------- /SmartDump.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/SmartDump/d60c1235d0edbf7ac79acdd4a15be169d525a17c/SmartDump.exe -------------------------------------------------------------------------------- /SmartDump64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/SmartDump/d60c1235d0edbf7ac79acdd4a15be169d525a17c/SmartDump64.exe -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | cout << "Hello World\n"; 8 | cout << "Input: "; 9 | string data; 10 | getline(cin, data); 11 | cout << "Output: " << data << "\n\n"; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /smartdetector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/SmartDump/d60c1235d0edbf7ac79acdd4a15be169d525a17c/smartdetector.png --------------------------------------------------------------------------------