Viladoman / StructLayout

Visual Studio Extension for C++ struct memory layout visualization
MIT License
477 stars 22 forks source link

[ERROR] Unable to scan the given location. #8

Closed ericthobbs closed 3 years ago

ericthobbs commented 3 years ago

running 0.2.1 (0.2.0 also didn't work):

struct.h:13:10: fatal error: 'Base Project'\NA-Project Constants.h' file not found

include "Base Project\NA-Project Constants.h"

          ^~~~~~~~~~~~~~~~~~~~~~~

1 error generated. Error while processing C:\Users\Eric\source\Proj\NA-Project\VS\VerXXXXXX\MsgHdrs\struct.h. [ERROR] Unable to scan the given location. (394.0328 ms)

no configuration file was generated so I can't attempt to include additional paths. My Additional Include Directories is set as "$(ProjectDir);$(SolutionDir);%(AdditionalIncludeDirectories)"

Viladoman commented 3 years ago

Interesting! Sorry to hear that. You can add additional additional arguments and directories in the extension options ( located in the bottom left corner of the tool window ). I would really appreciate if you could play around a little with those, checking the actual command line passed into the parser for something ill-formatted or missing.

image

Try to force include that file so we can test if the commandline argument forwarding has issues or from the parser itself.

I don't think it is a white space issue as 0.2.1 should have fixed those.

ericthobbs commented 3 years ago

Ok, getting farther along and I was able to get the config file generated, but then VS crashed and I have the following error in the ActivityLog.xml:

The StructLayoutPackage' package did not load correctly.

SetSite failed for package [StructLayoutPackage]Source: &apos:NewtonSoft.Json' Description: Bad JSON escape sequence: \U. Path 'AdditionalIncludeDirs&apos, line 3, position 32.

Viladoman commented 3 years ago

Wow! sorry about that!

It looks like those back slashes in the paths are creating some bad strings in there. Could you delete the config file (so it does not crash) and rebuild it again with forward slashes instead?

I will have a look at that json serialization/deserialization to fix the crashes.

ericthobbs commented 3 years ago

Getting farther - C:\Program files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h:978:5: error: MS-style inline assembly is not available: Unable to find target for this triple (no targets are registered). __asm {

Viladoman commented 3 years ago

I have never seen this before, but I found this

It looks like it is related to compiling in 32bits. I would have to apply the specified patch to clang in order to suppress it. You could try ( if possible ) to either use a x64 configuration or add -m64 in the extra arguments in the extension options.

I will note this as something to investigate when I have some time.

ericthobbs commented 3 years ago

I just noticed that it seems to be picking up the wrong compiler version as well (I have preview installed, but 16.7 is running): C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29331\include\intrin.h:56:1: error: expected function body after function declarator __MACHINE(void * _AddressOfReturn(void) .... C:\Users\Eric\source\Proj\a proj\source\VS\PROJ Base\some_h.h: error: pasting formed .my_struct_t, an invalid pre-processing token [-Winvalid-token-paste] MY_MACRO(my_struct_t); C:\Users\Eric\source\Proj\a proj\source\VS\PROJ Base\another_h.h: note: expanded from macro 'MY_MACRO'

at this point, it may be a non-issue for you if clang can't compile the project.

Viladoman commented 3 years ago

I would say this is out of my scope, but I would like to still be able to help if I can. Still, the json issue and includes not found need to be fixed. At some point I will explore this too, which should help with such projects.

ericthobbs commented 3 years ago

I'm currently using windbg to get the struct layout (and have looked into that cl flag for our tooling - but have not had the time to implement it). Thanks!

Viladoman commented 3 years ago

I am closing this as I already created a new entry in the parser project for the __asm{} investigation. as the json loading issue has already been fixed.