简体   繁体   English

如何从 Visual Studio Code 调试器中的指针轻松显示多个值?

[英]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.

相关问题 如何在 C(visual studio 代码)中运行多个文件? - How can i run multiple files in C (visual studio code)? 如何轻松地对 C 代码进行基准测试? - How can I benchmark C code easily? 在 Visual Studio Code 的 C/C++ 扩展中启动调试器后,如何运行命令? - How do I run a command after launching the debugger in the C/C++ extension for Visual Studio Code? 如何从命令行运行 Visual Studio 调试器? - How to run the Visual Studio Debugger from the command line? 如何使用集成的 Visual Studio Code 终端从标准输入读取数据? - How can I read from stdin using the integrated Visual Studio Code terminal? 我想知道是否有可能在使用调试器 Visual Studio 代码进入之前检查 if 语句的计算结果 - I was wondering if its possible to check what an if statement evaluates to before stepping into it using debugger visual studio code 如何在Atmel Studio中使用调试器来使用scanf? - How can I use scanf using the debugger in Atmel Studio? 如何将用C编写的源代码从另一个项目包含到我自己的Visual Studio C ++项目中 - How can I include source code written in C from another project into my own project in C++ in Visual Studio 如何将 Visual Studio Code 编译器/调试器设置为 GCC? - How does one set up the Visual Studio Code compiler/debugger to GCC? 如何从主机上的Eclipse调试器远程调试在Debian虚拟机上运行的某些代码? - How can I debug remotely some code running on a Debian Virtual Machine from Eclipse debugger on host machine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM