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

No structure found at the given location. #14

Closed
Zingam opened this issue Oct 31, 2020 · 5 comments
Closed

No structure found at the given location. #14

Zingam opened this issue Oct 31, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@Zingam
Copy link

Zingam commented Oct 31, 2020

In VS 2019 16.2.0

I get the following error at Last l{};:

[10:56:29] Looking for structures at C:\Users\Source\Repos\StructLayout\StructLayout\StructLayout.cpp:24:7...
[10:56:29] COMMAND LINE: C:\Users\Source\Repos\StructLayout\StructLayout\StructLayout.cpp -- -x c++ -m32 -w -DWIN32 -D_DEBUG -D_CONSOLE -working-directory=C:\Users\Source\Repos\StructLayout\StructLayout
[10:56:31] No structure found at the given location. (1.0630 s)

Note: This message is printed in Output. It would be nice to have some other popup or way to report that nothing happened. As I didn't notice the Output I thought that the extension failed.

Is VS 2019 16.2.0 adequate for this extension?

#include <iostream>
#include <string>

struct Base {
	int i;
};

struct Derived: Base {

	int i;
	bool c;
	Base b;
};

struct Last : Derived {
	std::string c;
};

int main()
{
	Last l{};
    std::cout << "Hello World!\n" << l.c << std::endl;
}
@Viladoman Viladoman added the bug Something isn't working label Oct 31, 2020
@Viladoman
Copy link
Owner

Hi, I love the idea of the popup on failure to make it more obvious.

At the moment the 'show struct layout' does not work at instance points, you should trigger the command inside the structure declaration:

struct Last : Derived {
	std::string c;
};

image

I will leave the issue open as a reminder until the popups are submitted.

Thanks for the feedback! Super appreciated!

@Viladoman Viladoman added enhancement New feature or request and removed bug Something isn't working labels Oct 31, 2020
@Zingam
Copy link
Author

Zingam commented Nov 1, 2020

It also appears that the graphics gets zoomed in when you have more elements (like when you uncomment the commented lines):

EDIT: I understand why this happens.

#include <iostream>
#include <string>
#include <cstdint>
#include <set>

struct Base {
	int i;
};

struct Base2 {
	float d;
	bool m;
	bool n;
	std::uint64_t a;
};

struct alignas (16) Derived: Base, Base2 {
	int i;
	float b3;
	double n4;
	bool c;
	bool d;
	bool m;
        Base b;
	double u5;
	bool b2;
	bool b7;
	double u7;
	//std::uint32_t ir[7];
	//bool n[43];
	//double yo;
	//float mu;
	//int intr[10];
	//int int_;
	//long long int lint;
	//short sint;
	//std::byte by[3];
	//std::set<int> sset;
};

struct Last : Derived {
    std::string c;
};

int main()
{
    Last l{};
    std::cout << "Hello World!\n" << l.c << std::endl;
}

Screenshot 2020-11-01 105943
Screenshot 2020-11-01 110022

And thank you for the great tool! I very much appreciate the effort!

@Zingam
Copy link
Author

Zingam commented Nov 1, 2020

@Viladoman Well, my bad. Thank you! :) It is documented but I read no documentation. I think it would be helpful to have a hint in the error message like ("Did you select a struct definition?", etc.)
I also would like to suggest to display the name of the expanded parent structure (on the top or at the sides) as well (it can be a checkbox option) and maybe a little clickable anchor as pinpointing the parent rectangles is a bit difficult (that could also be an option).
And a few more suggestions:

  1. In dark mode the hints could be dark as the type/intellisensehints displayed by VS. I guess VS uses a different type of control for them.
  2. Display the name of the top structure somewhere.
  3. Display multiple structure layouts (maybe in separate tabs).
  4. A few more standard presets for the Display alignment list.
  5. Wrap-around mode for the Cacheline (if that's possible).
  6. Is it possible to display the layout of arrays?
  7. Zoom

@Viladoman
Copy link
Owner

Thanks for the feedback.
My current focus is to fix the issues with missing properties to capture from different project setups. I am planning to do a big UX pass afterwards. Your feedback is really valuable and I will move those requests to a GH project to better keep track of them.

Answering your points:

  • The size of the visualization grows because you are in stack mode. And it will compute the cell size based on the most stacked element, in order to have always the most nested box with enough space to render its text. you can validate that by pressing the 'Expand All' button and seeing that std::set is adding a lot of nesting. The rest of the view grows with it because I wanted to keep a uniform grid, this way getting the hover position becomes a trivial operation. You can always use the Flat mode if the struct is too big or complex. I might play in the future with no uniform cell sizes, but that won't happen soon, maybe on a different view mode.
  1. I agree with this. I can't guarantee to have the same visuals exactly as Intellisense, but I can easily do a style pass on the tooltips. I also wanted to add a timers before display, they show up too fast.
  2. The top structure name, size and alignment are displayed at the bottom right of the window. I agree that it is not the greatest spot, but it is something. I also have this as a pending UX pass.
  3. That's a nice idea to compare between configurations or before/after. We only need to find the best UX way to make this seamless and not annoying. As I also don't want to keep opening a new window for every query.
  4. What other presets would you like to have? Adding those is 10s work on my end.
  5. Wraparound visualization is trickier than it seems. ( at least for stack mode ) as the UI paddings and sizes are computed based on how many columns are displayed. This means that the cell size depends on the columns. For this you can use the custom display and input the number that works best for your use case.
  6. This is on my todo list too, I want to have a thought on the best UX for arrays. It would be nice to see the contents of at least the first 2 elements. My issue is more about big arrays like [1024*1024] I don't want to hang the viewer rendering millions of nested elements.
  7. Zoom is also in the UX todo list.

@Viladoman
Copy link
Owner

Most of the requests have been added to the projects as Suggestion or UX improvements.

Please feel free to reopen this issue if you want to answer or give more details on the points above.

Thank you for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants