[英]How can I easily show multiple values from a pointer in the Visual Studio Code debugger?
According to the answers on this stackoverflow post , in Visual Studio, the debugger watch window can show multiple values of an array by using this syntax: arrName,20
.根据此stackoverflow post上的答案,在 Visual Studio 中,调试器监视窗口可以使用以下语法显示数组的多个值:
arrName,20
。
Is there a similar way to easily show multiple values from a pointer and the following memory addresses in the Visual Studio Code debugger?是否有类似的方法可以在 Visual Studio Code 调试器中轻松显示来自指针和以下内存地址的多个值?
As an example, here is the struct I'm working with:例如,这是我正在使用的结构:
struct student *students = malloc(NUM_STUDENTS * sizeof *students);
I can show individual values using students[idx]
, but trying to use the given Visual Studio syntax doesn't work.我可以使用
students[idx]
显示单个值,但尝试使用给定的 Visual Studio 语法不起作用。
Looks like you are asking the Visual Studio -> lldb version of this gdb -> lldb question:看起来你在问 Visual Studio -> 这个 gdb 的 lldb 版本 -> lldb 问题:
View array in LLDB: equivalent of GDB's '@' operator in Xcode 4.1 在 LLDB 中查看数组:相当于 Xcode 4.1 中 GDB 的“@”运算符
There are a bunch of "by hand" answers in that question, which were necessary at the time the question was asked, but for the past couple of years lldb has had built-in functionality for this (which is given in one of the answers):该问题中有一堆“手工”答案,在提出问题时是必需的,但在过去几年中,lldb 已经为此提供了内置功能(在其中一个答案中给出) ):
(lldb) parray 20 <Expression resulting in a pointer to your array>
您可以在 vs 代码监视器中使用 *some_pointer@3 来显示指针指向的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.