Local windows debugger это

Download Debugging Tools for Windows

The Windows Debugger (WinDbg) can be used to debug kernel-mode and user-mode code, analyze crash dumps, and examine the CPU registers while the code executes.

To get started with Windows debugging, see Getting Started with Windows Debugging.

Download WinDbg Preview

WinDbg Preview is a new version of WinDbg with more modern visuals, faster windows, and a full-fledged scripting experience. It is built with the extensible object-orientated debugger data model front and center. WinDbg Preview is using the same underlying engine as WinDbg today, so all the commands, extensions, and workflows still work as they did before.

Download WinDbg Preview from the Microsoft Store: WinDbg Preview.

Learn more about installation and configuration in WinDbg Preview — Installation.

Debugging Tools for Windows 10 (WinDbg)

Get Debugging Tools for Windows (WinDbg) from the SDK: Windows 10 SDK. Use the download link on the Windows 10 SDK page, as the Debugging Tools for Windows are not available as part of Visual Studio.

If you just need the Debugging Tools for Windows, and not the Windows Driver Kit (WDK) for Windows 10, you can install the debugging tools as a standalone component from the Windows Software Development Kit (SDK).

In the SDK installation wizard, select Debugging Tools for Windows, and deselect all other components.

Adding the Debugging Tools for Windows if the SDK is already installed

If the Windows SDK is already installed, open Settings, navigate to Apps & features, select Windows Software Development Kit, and then select Modify to change the installation to add Debugging Tools for Windows.

Looking for the debugging tools for earlier versions of Windows?

To download the debugger tools for previous versions of Windows, you need to download the Windows SDK for the version you are debugging from the Windows SDK and emulator archive. In the installation wizard of the SDK, select Debugging Tools for Windows, and deselect all other components.

Learn more about the debuggers

Learn more about WinDbg and other debuggers in Debugging Tools for Windows (WinDbg, KD, CDB, NTSD).

Проверка переменных в окнах «Видимые» и «Локальные» в Visual Studio Inspect variables in the Autos and Locals windows

В окнах Видимые и Локальные отображаются значения переменных во время отладки. The Autos and Locals windows show variable values while you are debugging. Окна доступны только во время сеанса отладки. The windows are only available during a debugging session. В окне Видимые отображаются переменные, используемые вокруг текущей точки останова. The Autos window shows variables used around the current breakpoint. В окне Локальные отображаются переменные, определенные в локальной области, которая обычно является текущей функцией или методом. The Locals window shows variables defined in the local scope, which is usually the current function or method.

Если вы не знакомы с процессом отладки кода, перед выполнением задач в этой статье рекомендуется прочесть документ об отладке для начинающих и статью Методы и инструменты отладки. If this is the first time that you’ve tried to debug code, you may want to read Debugging for absolute beginners and Debugging techniques and tools before going through this article.

Читайте также:  Лучший браузер под linux

Окно Видимые доступно для кода на C#, Visual Basic, C++ и Python, но не для кода на JavaScript или F#. The Autos window is available for C#, Visual Basic, C++, and Python code, but not for JavaScript or F#.

Чтобы открыть окно Видимые, во время отладки последовательно выберите пункты Отладка > Окна > Видимые или нажмите сочетание клавиш CTRL+ALT+V > A. To open the Autos window, while debugging, select Debug > Windows > Autos, or press Ctrl+Alt+V > A.

Чтобы открыть окно Локальные, во время отладки последовательно выберите пункты Отладка > Окна > Локальные или нажмите сочетание клавиш ALT+4. To open the Locals window, while debugging, select Debug > Windows > Locals, or press Alt+4.

Этот раздел относится к Visual Studio в Windows. This topic applies to Visual Studio on Windows. Информацию о Visual Studio для Mac см. в статье Визуализации данных в Visual Studio для Mac. For Visual Studio for Mac, see Data visualizations in Visual Studio for Mac.

Использование окон «Видимые» и «Локальные» Use the Autos and Locals windows

Массивы и объекты отображаются в окнах Видимые и Локальные как элементы управления в виде дерева. Arrays and objects show in the Autos and Locals windows as tree controls. Щелкните стрелку слева от имени переменной, чтобы развернуть представление и увидеть поля и свойства. Select the arrow to the left of a variable name to expand the view to show fields and properties. Далее приведен пример объекта System.IO.FileStream в окне Локальные. Here is an example of a System.IO.FileStream object in the Locals window:

Значение красного цвета в окне Локальные или Видимые означает, что значение изменилось с момента последнего вычисления. A red value in the Locals or Autos window means the value has changed since the last evaluation. Изменение могло произойти во время предыдущего сеанса отладки или быть выполнено в окне. The change could be from a previous debugging session, or because you have changed the value in the window.

По умолчанию в окнах отладчика используется десятичный числовой формат. The default numeric format in debugger windows is decimal. Чтобы изменить его на шестнадцатеричный, щелкните правой кнопкой мыши в окне Локальные или Видимые и выберите пункт Шестнадцатеричный вывод. To change it to hexadecimal, right-click in the Locals or Autos window and select Hexadecimal Display. Это изменение распространяется на все окна отладчика. This change affects all debugger windows.

Изменение значений переменных в окне «Видимые» и «Локальные» Edit variable values in the Autos or Locals window

Чтобы изменить значения большинства переменных в окнах Видимые или Локальные, дважды щелкните текущее значение и введите новое. To edit the values of most variables in the Autos or Locals windows, double-click the value and enter the new value.

В качестве значения можно ввести выражение, например a + b . You can enter an expression for a value, for example a + b . Отладчик принимает большинство допустимых выражений языка. The debugger accepts most valid language expressions.

При работе с машинным кодом C++ может потребоваться определить контекст имени переменной. In native C++ code, you might have to qualify the context of a variable name. Дополнительные сведения см. в разделе Оператор контекста (C++). For more information, see Context operator (C++).

Перед изменением значений и выражений нужно оценить его возможные последствия. Make sure you understand the consequences before you change values and expressions. Возможны следующие проблемы. Some possible issues are:

Вычисление некоторых выражений может привести к изменению значения некоторой переменной или иным образом повлиять на состояние программы. Evaluating some expressions can change the value of a variable or otherwise affect the state of your program. Например, вычисление var1 = ++var2 изменяет значения var1 и var2 . For example, evaluating var1 = ++var2 changes the value of both var1 and var2 . Такие выражения называют выражениями с побочными эффектами. These expressions are said to have side effects. Если вы не осведомлены о побочных эффектах, они могут привести к непредвиденным результатам. Side effects can cause unexpected results if you are not aware of them.

Читайте также:  Как удалить скрипт линукс

Изменение значений с плавающей запятой может привести к незначительной погрешности, связанной с преобразованием дробных компонентов из десятичной формы в двоичную. Editing floating-point values can result in minor inaccuracies because of decimal-to-binary conversion of fractional components. Даже внешне кажущееся безвредным редактирование может привести к изменениям некоторых младших разрядов переменной с плавающей запятой. Even a seemingly harmless edit can result in changes to some of the bits in the floating-point variable.

Используя панель поиска над каждым окном, можно искать ключевые слова в столбцах «Имя», «Значение» и «Тип» в окнах Видимые или Локальные. You can search for keywords in the Name, Value, and Type columns of the Autos or Locals window using the search bar above each window. Нажмите клавишу ВВОД или щелкните одну из стрелок, чтобы выполнить поиск. Hit ENTER or select one of the arrows to execute a search. Чтобы отменить текущий поиск, нажмите значок «x» на панели поиска. To cancel an ongoing search, select the «x» icon in the search bar.

Для перехода между найденными совпадениями используйте стрелки влево и вправо (SHIFT + F3 и F3 соответственно). Use the left and right arrows (Shift+F3 and F3, respectively) to navigate between found matches.

![Поиск в окне «Локальные»](../debugger/media/ee-search-locals.png «Поиск в окне «Локальные»»)

Чтобы сделать поиск более или менее детальным, воспользуйтесь раскрывающимся списком Поиск на уровень глубже в верхней части окна Видимые или Локальные, чтобы выбрать число уровней детализации поиска во вложенных объектах. To make your search more or less thorough, use the Search Deeper dropdown at the top of the Autos or Locals window to select how many levels deep you want to search into nested objects.

Закрепление свойств в окне «Видимые» или «Локальные» Pin properties in the Autos or Locals window

Эта возможность поддерживается для .NET Core 3.0 или более поздних версий. This feature is supported for .NET Core 3.0 or higher.

С помощью средства Закрепляемые свойства можно быстро проверить объекты на основе их свойств в окнах «Видимые» и «Локальные». You can quickly inspect objects by their properties in the Autos and Locals windows with the Pinnable Properties tool. Чтобы воспользоваться этим средством, наведите указатель мыши на свойство и выберите значок булавки либо щелкните правой кнопкой мыши и в контекстном меню выберите пункт Закрепить элемент в избранном. To use this tool, hover over a property and select the pin icon that appears or right-click and select the Pin Member as Favorite option in the resulting context menu. Свойство будет размещено в верхней части списка свойств объекта, а имя и значение свойства будут отображаться в столбце Значение. This bubbles up that property to the top of the object’s property list, and the property name and value is displayed in the Value column. Чтобы открепить свойство, щелкните значок булавки еще раз или в контекстном меню выберите пункт Открепить элемент в избранном. To unpin a property, select the pin icon again or select the Unpin Member as Favorite option in the context menu.

![Закрепление свойств в окне «Локальные»](../debugger/media/basic-pin.gif «Закрепление свойств в окне «Локальные»»)

При просмотре списка свойств объекта в окнах «Видимые» или «Локальные» можно также включать и отключать отображение имен свойств и отфильтровывать незакрепленные свойства. You can also toggle property names and filter out non-pinned properties when viewing the object’s property list in the Autos or Locals windows. Доступ к каждому параметру можно получить, нажимая кнопки на панели инструментов над окнами «Видимые» или «Локальные». You can access each option by selecting the buttons in the toolbar above the Autos or Locals windows.

Изменение контекста для окна «Видимые» или «Локальные» Change the context for the Autos or Locals window

С помощью панели инструментов Место отладки можно выбирать нужную функцию, поток или процесс, что приводит к изменению контекста для окон Видимые и Локальные. You can use the Debug Location toolbar to select a desired function, thread, or process, which changes the context for the Autos and Locals windows.

Читайте также:  Что такое play on linux

Чтобы включить панель инструментов Место отладки, щелкните в пустой части области панели инструментов и в раскрывающемся списке выберите Место отладки или последовательно выберите пункты Вид > Панели инструментов > Место отладки. To enable the Debug Location toolbar, click in an empty part of the toolbar area and select Debug Location from the dropdown, or select View > Toolbars > Debug Location.

Задайте точку останова и начните отладку. Set a breakpoint and start debugging. При достижении точки останова выполнение приостанавливается и вы можете увидеть расположение на панели инструментов Место отладки. When the breakpoint is hit, execution pauses and you can see the location in the Debug Location toolbar.

Переменные в окне «Видимые» (C#, C++, Visual Basic, Python) Variables in the Autos window (C#, C++, Visual Basic, Python)

При работе с разными языками в окне Видимые отображаются разные переменные. Different code languages display different variables in the Autos window.

При использовании C# или Visual Basic в окне Видимые отображаются все переменные, используемые в текущей или предыдущей строках. In C# and Visual Basic, the Autos window displays any variable used on the current or preceding line. Например, в коде C# или Visual Basic объявите следующие четыре переменные. For example, in C# or Visual Basic code, declare the following four variables:

Задайте точку останова в строке c = 3; и запустите отладчик. Set a breakpoint on the line c = 3; , and start the debugger. Когда выполнение приостановится, в окне Видимые будет отображено следующее. When execution pauses, the Autos window will display:

Значение c равно 0, так как строка c = 3 еще не была выполнена. The value of c is 0, because the line c = 3 has not yet been executed.

При использовании C++ в окне Видимые отображаются переменные, которые используются по крайней мере в трех строках до текущей строки (строки, в которой выполнение приостановлено). In C++, the Autos window displays the variables used in at least three lines before the current line where execution is paused. Например, в коде C++ объявите шесть переменных. For example, in C++ code, declare six variables:

Задайте точку останова в строке e = 5; и запустите отладчик. Set a breakpoint on the line e = 5; and run the debugger. Когда выполнение остановится, в окне Видимые будет отображено следующее. When execution stops, the Autos window will display:

Переменная e не инициализирована, так как код в строке e = 5 еще не выполнен. The variable e is uninitialized, because the line e = 5 has not yet been executed.

View return values of method calls View return values of method calls

В коде .NET и C++ можно просматривать возвращаемые значения в окне Видимые при выполнении шага с обходом вызова метода или выходом из него. In .NET and C++ code, you can examine return values in the Autos window when you step over or out of a method call. Просмотр возвращаемых значений вызова метода может быть полезен, если они не хранятся в локальных переменных. Viewing method call return values can be useful when they are not stored in local variables. Метод можно использовать в качестве параметра или возвращаемого значения другого метода. A method could be used as a parameter, or as the return value of another method.

Например, следующий код C# добавляет возвращаемые значения двух функций. For example, the following C# code adds the return values of two functions:

Чтобы просмотреть возвращаемые значения вызовов методов sumVars() и subtractVars() в окне «Видимые», выполните следующие действия. To see the return values of the sumVars() and subtractVars() method calls in the Autos window:

Установите точку останова на строке int x = sumVars(a, b) + subtractVars(c, d); . Set a breakpoint on the int x = sumVars(a, b) + subtractVars(c, d); line.

Начните отладку и, когда выполнение приостановится в точке останова, выберите Шаг с обходом или нажмите клавишу F10. Start debugging, and when execution pauses at the breakpoint, select Step Over or press F10. Вы увидите следующие возвращаемые значения в окне Видимые. You should see the following return values in the Autos window:

Оцените статью