SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: Gilvin on February 28, 2016, 09:25:55 PM

Title: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Gilvin on February 28, 2016, 09:25:55 PM
I'm using SE v20.0.1.3 under Windows 10 to do some Windows application / driver debugging and I found something really weird.

***The "Default Compiler" is "Visual Studio 2015", but I manually added paths of Windows Kits 8.1 in the "Compiler Include Directories" and "Project Directories" since some of the APIs I use only exists in Windows Kits 8.1 not Windows Kits 10, which SlickEdit (or SE just grabbed VS2015 paths on my system?) does not have them in the includes by default.

Projects are first created via VS2015. In the code, some structures which have "STRUCT, *PSTRUCT;" kind of tag style, their members cannot be listed, furthermore, the non-pointer ones are not even visible in the project.

A quick example:
Code: [Select]
int _tmain (
  int argc,
  _TCHAR* argv[]
  )
{
  PSTORAGE_DEVICE_DESCRIPTOR    PStoreDev;
  STORAGE_DEVICE_DESCRIPTOR      StoreDev;

  PStoreDev->  //I can see the definition in the preview window, but
                         //members behind this pointer cannot be listed.

  StoreDev.       //I can't even find the definition of this variable.
 
  return 0;
}


I try it on three machines, and seems like a stable error.


Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Gilvin on February 28, 2016, 09:45:47 PM
Some personal murmur :( : Since SE updated to 2014, I found it it always breaks on some of the strangest places I have seen in an IDE, sometimes it gets fixed in a hotfix / patch / major release, then breaks again in another.


As a mediocre firmware engineer who only knows what he does, I am not capable of dealing with these kind of come-and-go issues, which are obviously causing me more trouble than helping in the past 2 or 3 years at work. I'm not a person who likes to throw issue to the Devs and do nothing about it, if you can see my post these years, you'll know what I mean.


Courtesy of my company, IBM, I can definitely apply SE at work and not paying a dime myself, but I still purchase it because I love it, and now I'm seriously thinking about changing to others.
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Dennis on February 29, 2016, 05:31:53 PM
The Windows 8.1 SDK introduces new proprocessing #defines that we did not add to our preconfigured set.

If you go to Document > C/C++ Options > C/C++ Preprocessing and add _Struct_size_bytes(Size), then allow it to retag your workspace and then also manually rebuild your Visual Studio 2015 compiler tag file from Tools > Tag Files, you should be off and running.

FWIW:  The reason that it can not find the definition of the local "StoreDev" in your example is because it is qualified with "PStoreDev->".  Put a semicolon between those statements and you'll see StoreDev is correctly defined.

PPS:  While we do have occasional regressions, this is not an example of a regression in SlickEdit.  It is a problem introduced when Microsoft headers changed between releases.  Nothing changed in SlickEdit to trigger this problem.
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Gilvin on March 01, 2016, 02:37:56 AM
I'm using a bad example, in fact adding semicolon cannot fix this problem, this only occurs when I use VS community 2015, in my office which is using VS2013, it is okay, so I felt kind of weird because from this single portion it is a legit structure definition.

Similar issue can be also found when I'm programming Linux core and UEFI, this is when I have no idea why. Based on the same configuration and policy I set in the SE, sometimes issue occurs on low-end laptops or PCs, but acts normal on multi-core (14~28 cores) workstations, mostly on context tagging, just seems like SE tags policy alters between high / low end machines. Same codebase, same configuration brings out different experiences.
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Dennis on March 01, 2016, 04:35:25 PM
Are you saying that adding the preprocessing I suggested did not fix the problem on Windows with Visual Studio 2015?

We recently added more preprocessing for UEFI, but if you have more examples, bring them on.

As for low end vs. high end machines.  Auto-complete and some other context tagging features do have timeouts, so if you do have a slow enough machine, you could be experiencing that, otherwise, it's the same code.  I think the core of the problem you are facing is that you are working with kernel and device level code that is by nature riddled with preprocessing.
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Gilvin on March 02, 2016, 12:24:49 PM
Dennis:

Yes, I added _Struct_size_bytes(Size) just like you described and retagged the tool chain, it did not work, same problem still occurs, I'm using Windows 10, now I'm trying to uninstall the whole thing and setup SE once again, my configuration folder has been used since VS2009, and I think it saw its better days, I'll reconfigure it.

And yes again, you know what I mean (sorry for my Chinglish), low level portable code has tons of spaghetti preprocessors riddles all over, old days I'd have used ctags to do all the cross language tagging; And as for SE, the tagging was great and complete when 2009 / 2010 (but extremely slow), and become thunder fast in 2013/2014 but it did not do full tagging, I sometimes lost my track on code because of this..
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Dennis on March 02, 2016, 11:41:26 PM
You should have double-checked my work.  :-)  The define you needed is _Struct_size_bytes_(size) [note the trailing underscore].

The fix will be in the next revision of the cumulative hot fix.
Title: Re: Strange (C/C++) structure member listing under v20.0.1.3
Post by: Gilvin on March 11, 2016, 05:21:06 AM
Thanks! ;D