Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger shows only first element of dynamic array #688

Open
salda opened this issue May 4, 2017 · 17 comments
Open

Debugger shows only first element of dynamic array #688

salda opened this issue May 4, 2017 · 17 comments

Comments

@salda
Copy link

salda commented May 4, 2017

If I have a pointer to some type and give the pointer address of an array, is it possible to display all of the elements instead of the first one only?
For example:
Rectangle* baz = new Rectangle[2] { {2,5}, {3,6} };
displays
image
both via hovering over the baz variable and in VARIABLES->Locals section.

I think that issue #585 is different (I don't understand the problem of that issue).

@pieandcakes
Copy link
Contributor

@salda which OS and debugger are you using?

@pieandcakes pieandcakes added debugger more info needed The issue report is not actionable in its current state labels May 4, 2017
@adentinger
Copy link

I'm not on the cpptools team, but, in my opinion, if this works like Visual Studio, then everything is normal.

To view the pointer as a table, you should add a new watched variable under the Debug panel like so:

(Rectangle[2]) baz

See image below.

screenshot from 2017-05-04 13-56-28

@salda
Copy link
Author

salda commented May 4, 2017

Windows 10 with GDB.

@pieandcakes
Copy link
Contributor

@salda Does what @AnthonyD973 suggested work for you in the watch window? I know the hover won't work. Unfortunately this would require work on gdb's side to allow visualization OR a custom visualizer (aka natvis). I'll mark it as a feature request in the meantime that we can investigate for a future release.

@pieandcakes pieandcakes added Feature Request and removed more info needed The issue report is not actionable in its current state labels May 4, 2017
@deep529
Copy link

deep529 commented May 31, 2018

(int[5]) arr or arr,5 None of them works for me.

What works is *arr@5.

have a look.
ss
OS:Linux VSC Version:1.23.1

@toxmc
Copy link

toxmc commented Jun 28, 2018

debugger PHP7 shows only first element of zend_string
image
image

sos...
how can i do display all?

@toxmc
Copy link

toxmc commented Jun 29, 2018

image
vscode VS lldb
image
lldb can shows all

@subramanyakrishna
Copy link

Can anyone please tell how to use watch window

@WardenGnaw
Copy link
Member

@kulalsk2 While debugging, in the left pane you will see an area for Watch under Variables.
image

In there you can type any expression want to look at.
image

You can look at variables, you can try to see int variable + 1 or see array[index]

@subramanyakrishna
Copy link

Thanks a lot sir

@Trass3r
Copy link

Trass3r commented Sep 2, 2020

(int[5]) arr or arr,5 None of them works for me.

The former usually works in gdb, the latter is not implemented yet, see microsoft/MIEngine#1031.

What works is *arr@5.

Interesting.

@Arora-Sir
Copy link

Screenshot 08-02-21 17;56;28

Vector:
Screenshot 08-02-21 17;39;06

Static Array:
Screenshot 08-02-21 17;41;21

Dynamic Array:
Screenshot 08-02-21 17;45;42

Screenshot 08-02-21 17;57;39

asialasr pushed a commit to asialasr/vscode-cpptools that referenced this issue Mar 12, 2021
@g-berthiaume
Copy link

g-berthiaume commented Jul 17, 2021

(int[5]) arr or arr,5 None of them works for me.

What works is *arr@5.

Interesting
What is the "language" of the WATCH window?
It seems like the array slicing syntax arr[0:5] would be more intuitive for me.

@Trass3r
Copy link

Trass3r commented Jul 17, 2021

Whatever the debugger supports, so usually gdb.

@Trass3r
Copy link

Trass3r commented Jun 9, 2022

@szw0407
Copy link

szw0407 commented Nov 8, 2022

So, now in the year 2022, the problem is still here. Why? And how can I make it automatically show the whole array?

@Trass3r
Copy link

Trass3r commented Nov 8, 2022

arr,5 syntax got implemented, arr,[n] not yet: microsoft/MIEngine#1369
Use natvis to show it automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests