简体   繁体   中英

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 .

Is there a similar way to easily show multiple values from a pointer and the following memory addresses in the Visual Studio Code debugger?

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.

在此处输入图片说明

Looks like you are asking the Visual Studio -> lldb version of this gdb -> lldb question:

View array in LLDB: equivalent of GDB's '@' operator in Xcode 4.1

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) parray 20 <Expression resulting in a pointer to your array>

您可以在 vs 代码监视器中使用 *some_pointer@3 来显示指针指向的值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM