Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 VA Outline parsing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

foxmuldr
Tomato Guru

USA
379 Posts

Posted - Oct 11 2019 :  09:57:58 AM  Show Profile  Reply with Quote
If you:

(1) Get the 19.00 version of 7-zip source code:

https://sourceforge.net/projects/sevenzip/files/7-Zip/19.00/
7z1900-src.7z

(2) Load it into Visual Studio (CPP\7zip\Bundles\Alone7z\)
(3) Load the dsw or dsp into a new solution
(4) Locate the Console/Main.cpp and Console/MainAr.cpp files
(5) Bring up VA Outline

You'll note it misses critical function definitions, including main() and main2(), presumably because of the way the developer writes his code:

int MY_CDECL main
(
  #ifndef _WIN32
  int numArgs, char *args[]
  #endif
)
{
   .. code here
}


int Main2(
  #ifndef _WIN32
  int numArgs, char *args[]
  #endif
)
{
   .. code here
}


You may want to augment your parser to recognize such layouts so it can provide a true outline.

I'm not sure what causes it to not identify and display those functions, but when I went into a new Console solution to try and reproduce the error in a small example, I created a simple version using only the code fragments above with some pseudo #defines added above where required, and VA Outline /WAS/ able to identify things correctly in that small file.

Something in the 7-zip source code is preventing it from showing properly in VA Outline.

Note: This was observed in the most recent 16.3.3 release of Visual Studio 2019, and VAX 2341 in a Windows 10 environment:

License: [email protected] (1-user license) Support ends 2019.08.29
VA_X.dll file version 10.9.2341.2 built 2019.08.05
DevEnv.exe version 16.3.29403.142 Community
msenv.dll version 16.0.29318.209
Comctl32.dll version 6.10.18362.418
Windows 10 10.0 1903 Build 18362.418
8 processors (x86-64, WOW64)
Language info: 1252, 0x409

Thank you.

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Oct 18 2019 :  08:45:57 AM  Show Profile  Reply with Quote
What are you seeing in VA Outline on your system for this code file? Using VS2019 and VA 2341.2 I have followed these steps, even checking on a clean system where VA has never been installed before to make sure. These functions are being listed quite happily in VA Outline for me.

With all of the nodes still collapsed, using:

VA Outline -> Right Click -> Copy Outline Content

is giving me this:

#include "StdAfx.h"
#ifdef _WIN32
#includes
using namespace NWindows;
File scope variables
Main2( #ifndef _WIN32 int numArgs, char *args[] #endif );
File scope variables
FlushStreams()
PrintError(const char *message)
#define NT_CHECK_FAIL_ACTION *g_StdStream << "Unsupported Windows version"; return NExitCode::kFatalError;
main ( #ifndef _WIN32 int numArgs, char *args[] #endif )


which includes both of these function definitions.

zen is the art of being at one with the two'ness
Go to Top of Page

foxmuldr
Tomato Guru

USA
379 Posts

Posted - Oct 23 2019 :  2:21:59 PM  Show Profile  Reply with Quote
When I download the src file, unzip to c:\temp\7zip\, open the project C:\temp\7zip\CPP\7zip\Bundles\Alone7z\alone.dsp, and bring up main.cpp, I see this. I don't see Main2() listed anywhere, and it's not included in the text below.

https://cdn1.imggmi.com/uploads/2019/10/23/b32206bcee6b2aa52400beee152b2f51-full.png

#includes
#ifdef _WIN32
#includes
#ifdef EXTERNAL_CODECS
#includes
#ifdef PROG_VARIANT_R
#else
using
#ifdef _WIN32
Forward declarations
#ifndef EXTERNAL_CODECS
kCopyrightString = "\n7-Zip"
#ifndef EXTERNAL_CODECS
#ifndef _NO_CRYPTO
File scope variables
#define kDefaultSfxModule "7zCon.sfx"
ShowMessageAndThrowException(LPCSTR message, NExitCode::EEnum code)
#ifndef _WIN32
	GetArguments(int numArgs, const char *args[], UStringVector &parts)
	#endif
ShowCopyrightAndHelp(CStdOutStream *so, bool needHelp)
PrintStringRight(CStdOutStream &so, const char *s, unsigned size)
PrintUInt32(CStdOutStream &so, UInt32 val, unsigned size)
PrintLibIndex(CStdOutStream &so, int libIndex)
PrintString(CStdOutStream &so, const UString &s, unsigned size)
GetHex(unsigned val)
PrintWarningsPaths(const CErrorPathCodes &pc, CStdOutStream &so)
WarningsCheck(HRESULT result, const CCallbackConsoleBase &callback, const CUpdateErrorInfo &errorInfo, CStdOutStream *so, CStdOutStream *se, bool showHeaders)
ThrowException_if_Error(HRESULT res)
PrintNum(UInt64 val, unsigned numDigits, char c = ' ')
PrintTime(const char *s, UInt64 val, UInt64 total)
#ifndef UNDER_CE
	#define SHIFT_SIZE_VALUE(x, num) (((x) + (1 << (num)) - 1) >> (num))
	PrintMemUsage(const char *s, UInt64 val)
	Func_GetProcessMemoryInfo(HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb);
	Func_QueryProcessCycleTime(HANDLE Process, PULONG64 CycleTime);
	#endif
GetTime64(const FILETIME &t)
PrintStat()


Info about my version:
Microsoft Visual Studio Community 2019
Version 16.3.6
VisualStudio.16.Release/16.3.6+29418.71
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Community

Visual C++ 2019   00435-60000-00000-AA402
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019   16.3.286.43615
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0   16.3.286.43615
Azure App Service Tools v3.0.0

C# Tools   3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Debugging Tools for Windows   10.0.18346.1000
Integrates the Windows Debugger functionality (http://go.microsoft.com/fwlink/?linkid=223405) in Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

NuGet Package Manager   5.3.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.61908.27190
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio

Visual Assist   10.9.2341.2
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c)1997-2019 Whole Tomato Software, LLC

Visual Basic Tools   3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Linux Development   1.0.9.29230
Visual C++ for Linux Development

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Windows Driver Kit   10.0.18346.1000
Headers, libraries, and tools needed to develop, debug, and test Windows drivers (msdn.microsoft.com/en-us/windows/hardware/gg487428.aspx)


System info (manually copied):

OS Name -- Microsoft Windows 10 Enterprise
Version -- 10.0.18362 Build 18362
System Type -- x64-based PC
Processor -- Intel(R) Core(TM) i7-770HQ CPU @ 2.80 GHz, 2808 MHz, 4 Core(s), 8 Logical


Same version of VAX as my original post:

License: [email protected] (1-user license) Support ends 2019.08.29
VA_X.dll file version 10.9.2341.2 built 2019.08.05
DevEnv.exe version 16.3.29403.142 Community
msenv.dll version 16.0.29318.209
Comctl32.dll version 6.10.18362.418
Windows 10 10.0 1903 Build 18362.418
8 processors (x86-64, WOW64)
Language info: 1252, 0x409
Go to Top of Page

foxmuldr
Tomato Guru

USA
379 Posts

Posted - Oct 23 2019 :  2:25:26 PM  Show Profile  Reply with Quote
If I expand all, and copy outline content I see this:

#includes
	#include "StdAfx.h"
	#include "../../../Common/MyWindows.h"
#ifdef _WIN32
	#include <Psapi.h>
	#endif
#includes
	#include "../../../../C/CpuArch.h"
	#include "../../../Common/MyInitGuid.h"
	#include "../../../Common/CommandLineParser.h"
	#include "../../../Common/IntToString.h"
	#include "../../../Common/MyException.h"
	#include "../../../Common/StringConvert.h"
	#include "../../../Common/StringToInt.h"
	#include "../../../Common/UTFConvert.h"
	#include "../../../Windows/ErrorMsg.h"
	#include "../../../Windows/TimeUtils.h"
	#include "../Common/ArchiveCommandLine.h"
	#include "../Common/Bench.h"
	#include "../Common/ExitCode.h"
	#include "../Common/Extract.h"
#ifdef EXTERNAL_CODECS
	#include "../Common/LoadCodecs.h"
	#endif
#includes
	#include "../../Common/RegisterCodec.h"
	#include "BenchCon.h"
	#include "ConsoleClose.h"
	#include "ExtractCallbackConsole.h"
	#include "List.h"
	#include "OpenCallbackConsole.h"
	#include "UpdateCallbackConsole.h"
	#include "HashCon.h"
#ifdef PROG_VARIANT_R
	#include "../../../../C/7zVersion.h"
#else
	#include "../../MyVersion.h"
	#endif
using
	using namespace NWindows;
	using namespace NFile;
	using namespace NCommandLineParser;
#ifdef _WIN32
	g_hInstance = 0;
	#endif
Forward declarations
	g_StdStream;
	g_ErrStream;
	g_NumCodecs;
	g_Codecs[];
	g_NumHashers;
	g_Hashers[];
#ifndef EXTERNAL_CODECS
	#ifdef PROG_VARIANT_R
	#else
		#endif
	#endif
kCopyrightString = "\n7-Zip"
#ifndef EXTERNAL_CODECS
	#ifdef PROG_VARIANT_R
	#else
		#endif
	#endif
#ifndef _NO_CRYPTO
	#endif
File scope variables
	kHelpString =
	kEverythingIsOk = "Everything is Ok";
	kUserErrorMessage = "Incorrect command line";
	kNoFormats = "7-Zip cannot find the code that works with archives.";
	kUnsupportedArcTypeMessage = "Unsupported archive type";
#define kDefaultSfxModule "7zCon.sfx"
ShowMessageAndThrowException(LPCSTR message, NExitCode::EEnum code)
#ifndef _WIN32
	GetArguments(int numArgs, const char *args[], UStringVector &parts)
	#endif
ShowCopyrightAndHelp(CStdOutStream *so, bool needHelp)
PrintStringRight(CStdOutStream &so, const char *s, unsigned size)
PrintUInt32(CStdOutStream &so, UInt32 val, unsigned size)
PrintLibIndex(CStdOutStream &so, int libIndex)
PrintString(CStdOutStream &so, const UString &s, unsigned size)
GetHex(unsigned val)
PrintWarningsPaths(const CErrorPathCodes &pc, CStdOutStream &so)
WarningsCheck(HRESULT result, const CCallbackConsoleBase &callback, const CUpdateErrorInfo &errorInfo, CStdOutStream *so, CStdOutStream *se, bool showHeaders)
ThrowException_if_Error(HRESULT res)
PrintNum(UInt64 val, unsigned numDigits, char c = ' ')
PrintTime(const char *s, UInt64 val, UInt64 total)
#ifndef UNDER_CE
	#define SHIFT_SIZE_VALUE(x, num) (((x) + (1 << (num)) - 1) >> (num))
	PrintMemUsage(const char *s, UInt64 val)
	Func_GetProcessMemoryInfo(HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb);
	Func_QueryProcessCycleTime(HANDLE Process, PULONG64 CycleTime);
	#endif
GetTime64(const FILETIME &t)
PrintStat()
	PrintHexId(CStdOutStream &so, UInt64 id)
	Main2( #ifndef _WIN32 int numArgs, char *args[] #endif )



It shows Main2() below PrintStat(), which is incorrect. PrintStat() ends above the function PrintHexId() which is above Main2().

There's clearly some incorrect parsing there. If you're not seeing the same thing, I can try re-installing.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Oct 25 2019 :  09:09:51 AM  Show Profile  Reply with Quote
I have found the confusion, in your first post you listed two different code files, I was looking at "MainAr.cpp" while you were looking at "Main.cpp". I will now check "Main.cpp" and see what is going on.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Oct 25 2019 :  11:06:17 AM  Show Profile  Reply with Quote
It turns out this is a known problem, caused by the code containing mismatched brackets, which confuse VA Outline. The problem bit of code is:

static void PrintStat()
{
  FILETIME creationTimeFT, exitTimeFT, kernelTimeFT, userTimeFT;
  if (!
      #ifdef UNDER_CE
        ::GetThreadTimes(::GetCurrentThread()
      #else
        // NT 3.5
        ::GetProcessTimes(::GetCurrentProcess()
      #endif
      , &creationTimeFT, &exitTimeFT, &kernelTimeFT, &userTimeFT))
    return;
  FILETIME curTimeFT;


Once the pre-processor has finished then the brackets do match, but until this has happened, this is "invalid" code. Since VA is parsing the code as is, without doing everything the preprocessor does, this can confuse us, which is happening here:

case=59101

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000