Skip to content

Commit 0fec337

Browse files
authored
Merge pull request #13228 from delmyers/dev/delmyers/symbolsettings
Update debug pdb documentation.
2 parents 9a5b145 + b332801 commit 0fec337

File tree

4 files changed

+79
-15
lines changed

4 files changed

+79
-15
lines changed
34.3 KB
Loading
26.8 KB
Loading
40 KB
Loading

docs/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ The debugger searches for symbol files in the following locations:
8787

8888
**Third-party symbol servers**: Third-party providers of Windows applications and libraries can provide access to symbol server on the internet.
8989

90-
> [!WARNING]
91-
> If you use a symbol server other than the public Microsoft Symbol Servers, make sure that the symbol server and its path are trustworthy. Because symbol files can contain arbitrary executable code, you can be exposed to security threats.
90+
> [!WARNING]
91+
> If you use a symbol server other than the public Microsoft Symbol Servers, make sure that the symbol server and its path are trustworthy. Because symbol files can contain arbitrary executable code, you can be exposed to security threats.
9292
9393
## Configure location of symbol files and loading options
9494

@@ -103,6 +103,11 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
103103

104104
**To specify symbol locations and loading options:**
105105

106+
::: moniker range="= vs-2022"
107+
> [!NOTE]
108+
> These options were updated in Visual Studio 2022 Version 17.12 Preview 1.
109+
::: moniker-end
110+
106111
1. In Visual Studio, open **Tools** > **Options** > **Debugging** > **Symbols** (or **Debug** > **Options** > **Symbols**).
107112

108113
2. Under **Symbol file (.pdb) locations**,
@@ -112,15 +117,15 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
112117
1. Select the **+** symbol in the toolbar.
113118
1. Type the URL (http), network share, or local path of the symbol server or symbol location in the text field. Statement completion helps you find the correct format.
114119

115-
::: moniker range=">= vs-2022"
120+
::: moniker range=">= vs-2022"
116121
![Tools - Options - Debugging - Symbols page](media/vs-2022/dbg-options-symbols.png "Tools - Options - Debugging - Symbols page")
117-
::: moniker-end
118-
::: moniker range="<= vs-2019"
122+
::: moniker-end
123+
::: moniker range="<= vs-2019"
119124
![Tools &#45; Options &#45; Debugging &#45; Symbols page](media/dbg-options-symbols.gif "Tools &#45; Options &#45; Debugging &#45; Symbols page")
120-
::: moniker-end
125+
::: moniker-end
121126

122-
>[!NOTE]
123-
>Only the specified folder is searched. You must add entries for any subfolders that you want to search.
127+
> [!NOTE]
128+
> Only the specified folder is searched. You must add entries for any subfolders that you want to search.
124129
125130
- To add a new Azure DevOps Symbol Server location:
126131

@@ -135,20 +140,79 @@ On the **Tools** > **Options** > **Debugging** > **Symbols** page, you can:
135140

136141
3. (Optional) To improve symbol loading performance, under **Cache symbols in this directory**, type a local folder path that symbol servers can copy symbols to.
137142

138-
> [!NOTE]
139-
> Do not place the local symbol cache in a protected folder, like C:\Windows or a subfolder. Use a read-write folder instead.
143+
> [!NOTE]
144+
> Do not place the local symbol cache in a protected folder, like C:\Windows or a subfolder. Use a read-write folder instead.
140145
141-
> [!NOTE]
142-
> For C++ projects, if you have the `_NT_SYMBOL_PATH` environment variable set, it will override the value set under **Cache symbols in this directory**.
146+
> [!NOTE]
147+
> If you have the `_NT_SYMBOL_PATH` environment variable set, it overrides the value set under **Cache symbols in this directory**.
143148
144149
4. Specify the modules that you want the debugger to load from the **Symbol file (.pdb) locations** when it starts.
145150

151+
::: moniker range=">= vs-2022"
152+
153+
- Select **Automatically choose what module symbols to search for** (recommended) to allow
154+
Visual studio to decide what symbols to search for and load. By default, Visual Studio
155+
automatically loads symbols that were built by your opened solution, and loads any
156+
additional symbols that are needed to perform common debugging operations. This reduces
157+
the number of files that must be searched for and loaded by Visual Studio, which
158+
improves debugger performance. You can force additional symbols to load by clicking the
159+
**Specify module filters** link.
160+
161+
- Select **Search for all module symbols unless excluded** to force Visual Studio to
162+
load all symbols in your debugged process. This is not recommended because it may
163+
slow down your debugging experience. If you select this option, you can force
164+
Visual Studio to ignore certain symbols by clicking the **Specify module filters**
165+
link.
166+
167+
::: moniker-end
168+
::: moniker range="<= vs-2019"
169+
146170
- Select **Load all modules, unless excluded** (the default) to load all the symbols for all modules in the symbol file location, except modules you specifically exclude. To exclude certain modules, select **Specify excluded modules**, select the **+** icon, type the names of the modules to exclude, and select **OK**.
147171

148172
- To load only modules you specify from the symbol file locations, select **Load only specified modules**. Select **Specify included modules**, select the **+** icon, type the names of the modules to include, and then select **OK**. The symbol files for other modules are not loaded.
173+
::: moniker-end
149174

150175
5. Select **OK**.
151176

177+
::: moniker range=">= vs-2022"
178+
179+
### Specify module filters
180+
Both the **Automatically choose what module symbols to search for** and **Search for all
181+
module symbols unless excluded** options allow you to have more fine control over what symbols
182+
are searched for while debugging. Choose **Specify module filters** to fine-tune your experience.
183+
184+
By default, you see the following dialog when **Automatically choose what module symbols to search for** is selected:
185+
186+
![Screenshot of specifying module filters.](media/vs-2022/specify-include-list.png)
187+
188+
You can add a module to the filter by using the '+' icon. Module filters support simple wild-card
189+
matching. A '\*' matches any group of characters. For example '\*myproduct\*' will match files such
190+
as 'myproduct.utilities.dll' and 'entrypoint.myproduct.exe', among others.
191+
192+
There are several additional options to further customize your experience:
193+
194+
- **Always load symbols located next to modules** instructs visual studio to load pdb files that
195+
are stored in the file system beside their corresponding .dll or .exe files. This can be helpful,
196+
for example, when attempting to debug a deployed web app.
197+
198+
- **Automatically load additional symbols when needed** instructs Visual Studio to search for
199+
symbols to perform common debug actions, such as stepping, even if the module that you will be
200+
stepping to is not in your project or in the modules filter. The way that searching is determined
201+
might be affected by your [Just My Code](just-my-code.md) settings.
202+
203+
If you have selected **Search for all module symbols unless excluded**, then the module filter
204+
dialog looks like this:
205+
206+
![Screenshot of specifying excluded modules.](media/vs-2022/specify-exclude-list.png)
207+
208+
In this dialog, you can choose what modules you *do not* want Visual Studio to load symbols for.
209+
In this scenario, Visual Studio attempts to load symbols for every module in your debugged
210+
proces (including modules by third parties), unless you add a matching filter to exclude them.
211+
The only other way that this behavior will be modified is by your [Just My Code](just-my-code.md)
212+
settings.
213+
214+
::: moniker-end
215+
152216
## Other symbol options for debugging
153217

154218
You can select additional symbol options in **Tools** > **Options** > **Debugging** > **General** (or **Debug** > **Options** > **General**):
@@ -169,10 +233,10 @@ You can select additional symbol options in **Tools** > **Options** > **Debuggin
169233

170234
You can limit the commands that *srcsrv.dll* can execute from the app's *.pdb* file by listing the allowed commands in a file named *srcsrv.ini*. Place the *srcsrv.ini* file in the same folder as *srcsrv.dll* and *devenv.exe*.
171235

172-
>[!IMPORTANT]
173-
>Arbitrary commands can be embedded in an app's *.pdb* file, so make sure to put only the commands you want to execute into a *srcsrv.ini* file. Any attempt to execute a command not in the *srcsvr.ini* file will cause a confirmation dialog box to appear. For more information, see [Security Warning: Debugger Must Execute Untrusted Command](../debugger/security-warning-debugger-must-execute-untrusted-command.md).
236+
> [!IMPORTANT]
237+
> Arbitrary commands can be embedded in an app's *.pdb* file, so make sure to put only the commands you want to execute into a *srcsrv.ini* file. Any attempt to execute a command not in the *srcsvr.ini* file will cause a confirmation dialog box to appear. For more information, see [Security Warning: Debugger Must Execute Untrusted Command](../debugger/security-warning-debugger-must-execute-untrusted-command.md).
174238
>
175-
>No validation is done on command parameters, so be careful with trusted commands. For example, if you listed *cmd.exe* in your *srcsrv.ini*, a malicious user might specify parameters on *cmd.exe* that would make it dangerous.
239+
> No validation is performed on command parameters, so be careful with trusted commands. For example, if you listed *cmd.exe* in your *srcsrv.ini*, a malicious user might specify parameters on *cmd.exe* that would make it dangerous.
176240
177241
Select this item and the child items you want. **Allow source server for partial trust assemblies (Managed only)** and **Always run untrusted source server commands without prompting** can increase the security risks.
178242

0 commit comments

Comments
 (0)