VerySleepy / verysleepy

Very Sleepy, a sampling CPU profiler for Windows

Home Page:http://www.codersnotes.com/sleepy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't seem to support the VC140 compiler

krasi0 opened this issue · comments

The function names are not resolved...

Can you build and upload a test program?

To get function names resolved:

  • Go to Project -> Properties -> Linker -> Debugging -> Generate Debug Info
  • Set to "Optimize for debugging (/DEBUG)" instead of "Optimize for faster linking (/FASTLINK)"

As there has been no reply for 10 months, I'm closing this issue. Please post a message if you think this should be reopened.

Set to "Optimize for debugging (/DEBUG)" instead of "Optimize for faster linking (/FASTLINK)"

I haven't been able to reproduce this issue either way.

hi @CyberShadow , I guess vs2015 has a link optimize, see https://blogs.msdn.microsoft.com/vcblog/2015/10/16/debugfastlink-for-vs2015-update-1/

In VS2017, I found I have to set Linker->Debugging->Generate Debug Info to "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)", else I can't read all symbol names in PDB files with DIASDK(https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/debug-interface-access-sdk).

I've tried compiling with /DEBUG and /DEBUG:FASTLINK using Visual Studio 2015 and I can see symbols either way. Visual Studio 2017 RC crashes on startup for me.

Could you provide instructions on how to compile a program with symbols that Very Sleepy can't read? Preferably from the command line (see e.g. https://github.com/VerySleepy/tests/blob/master/tests/msvc14/build.bat).

please try: cl /MD /Z7 a.cpp /link /DEBUG:FASTLINK

Thanks, that works.

Should be fixed, can you try the latest build?

When I click the process that previously was not working, sleepy stop responding.
Here is the stack trace when it is not responding.

>	dbghelpms.dll!SymCachePdb::fRegisterPDBMappings(void)	Unknown
 	dbghelpms.dll!SymCachePdb::ModCache::LoadTypes(void)	Unknown
 	dbghelpms.dll!SymCachePdb::ModCache::GetType(unsigned long,bool)	Unknown
 	dbghelpms.dll!SymbolDataSimpleImpl<1028,26>::getData(struct SYMTYPE *,unsigned int,struct SymRowImage *,class GetTheData &)	Unknown
 	dbghelpms.dll!SymbolDataGeneralImpl<struct PROCSYM32,4423>::getData(struct SYMTYPE *,unsigned int,struct SymRowImage *,class GetTheData &)	Unknown
 	dbghelpms.dll!CSymIdTrav::get(class CSymRow &)	Unknown
 	dbghelpms.dll!CDiaSession::ReturnOneObject<class CDiaSymbol,class CSymRow,struct IDiaSymbol>(class CDiaSymbol *,class CTraversal<class CSymRow> *,struct IDiaSymbol * *)	Unknown
 	dbghelpms.dll!CDiaSession::getSymbol(struct SYMBOL_ID_INTERNAL *,struct IDiaSymbol * *)	Unknown
 	dbghelpms.dll!CDiaSymbol::get_lexicalParent(struct IDiaSymbol * *)	Unknown
 	dbghelpms.dll!diaGetFpoFromAddr(struct _MODULE_ENTRY *,unsigned __int64,int *)	Unknown
 	dbghelpms.dll!LookupFunctionEntryX86(void *,struct _MODULE_ENTRY *,unsigned __int64)	Unknown
 	dbghelpms.dll!SymFunctionTableAccess64AccessRoutines�()	Unknown
 	dbghelpms.dll!DbhStackServices::GetFunctionEntry(unsigned __int64,void *,unsigned long)	Unknown
 	dbghelpms.dll!DbsX86StackUnwinder::DoUnwindUsingInternalContext(struct DbsStackUnwinder::PreviousFrameSummary const &,struct DbsStackUnwinder::AbstractContext const &,struct DbsStackUnwinder::FrameSummary *)	Unknown
 	dbghelpms.dll!DbsX86StackUnwinder::UnwindAndUpdateInternalContext(struct DbsStackUnwinder::AbstractContext const &,struct DbsStackUnwinder::PreviousFrameSummary const &)	Unknown
 	dbghelpms.dll!DbsStackUnwinder::DoDbhUnwind(struct _tagSTACKFRAME64 *,unsigned long,void *,unsigned long,void *)	Unknown
 	dbghelpms.dll!DbsStackUnwinder::DbhUnwind(struct _tagSTACKFRAME64 *,unsigned long,void *,unsigned long,void *)	Unknown
 	dbghelpms.dll!PickX86Walk(class DbsStackUnwinder *,class DbhStackServices *,struct _tagSTACKFRAME64 *,void *)	Unknown
 	dbghelpms.dll!PickX86Walk(class DbsStackUnwinder *,class DbhStackServices *,struct _tagSTACKFRAME64 *,void *)	Unknown
 	dbghelpms.dll!StackWalkEx�()	Unknown
 	dbghelpms.dll!StackWalk64�()	Unknown
 	sleepy.exe!000000014001cb59()	Unknown
 	sleepy.exe!00000001400796af()	Unknown
 	sleepy.exe!000000014007a70c()	Unknown
 	sleepy.exe!000000014007a2de()	Unknown
 	sleepy.exe!00000001400606eb()	Unknown
 	sleepy.exe!00000001400b2208()	Unknown
 	sleepy.exe!00000001400b6584()	Unknown
 	sleepy.exe!00000001400b61a3()	Unknown
 	sleepy.exe!00000001400b70fd()	Unknown
 	sleepy.exe!00000001400b64d5()	Unknown
 	sleepy.exe!00000001400b6d43()	Unknown
 	sleepy.exe!0000000140150630()	Unknown
 	sleepy.exe!00000001401311c6()	Unknown
 	sleepy.exe!00000001401337c8()	Unknown
 	sleepy.exe!0000000140137328()	Unknown
 	user32.dll!00007ffdd9ca1c24()	Unknown
 	user32.dll!00007ffdd9ca125e()	Unknown
 	user32.dll!00007ffdd9ca0ff5()	Unknown
 	comctl32.dll!00007ffdce7f4dd6()	Unknown
 	comctl32.dll!00007ffdce7941a8()	Unknown
 	comctl32.dll!00007ffdce7f5ae9()	Unknown
 	comctl32.dll!00007ffdce94a3cf()	Unknown
 	comctl32.dll!00007ffdce94a51f()	Unknown
 	comctl32.dll!00007ffdce83398c()	Unknown
 	comctl32.dll!00007ffdce7f96a4()	Unknown
 	comctl32.dll!00007ffdce7f6582()	Unknown
 	user32.dll!00007ffdd9ca1c24()	Unknown
 	user32.dll!00007ffdd9ca17bb()	Unknown
 	comctl32.dll!00007ffdce7e87c0()	Unknown
 	comctl32.dll!00007ffdce7e88da()	Unknown
 	comctl32.dll!00007ffdce7e8662()	Unknown
 	user32.dll!00007ffdd9ca1c24()	Unknown
 	user32.dll!00007ffdd9ca17bb()	Unknown
 	sleepy.exe!0000000140130584()	Unknown
 	sleepy.exe!00000001401337e0()	Unknown
 	sleepy.exe!0000000140150e48()	Unknown
 	sleepy.exe!0000000140137328()	Unknown
 	user32.dll!00007ffdd9ca1c24()	Unknown
 	user32.dll!00007ffdd9ca156c()	Unknown
 	user32.dll!00007ffdd9ca42ff()	Unknown
 	sleepy.exe!0000000140132ddf()	Unknown
 	sleepy.exe!0000000140132c17()	Unknown
 	sleepy.exe!00000001401ab52f()	Unknown
 	sleepy.exe!00000001401ab582()	Unknown
 	sleepy.exe!00000001401ab334()	Unknown
 	sleepy.exe!00000001400d70be()	Unknown
 	sleepy.exe!00000001400d72b5()	Unknown
 	sleepy.exe!000000014006c627()	Unknown
 	sleepy.exe!000000014006ac37()	Unknown
 	sleepy.exe!000000014006c1e0()	Unknown
 	sleepy.exe!000000014006a27c()	Unknown
 	sleepy.exe!000000014006bc8d()	Unknown
 	sleepy.exe!00000001400d7229()	Unknown
 	sleepy.exe!00000001400d70ac()	Unknown
 	sleepy.exe!00000001400d72b5()	Unknown
 	sleepy.exe!00000001400b3031()	Unknown
 	sleepy.exe!00000001401071ab()	Unknown
 	sleepy.exe!000000014019735e()	Unknown
 	sleepy.exe!000000014007ea89()	Unknown
 	kernel32.dll!00007ffdd7ab8364()	Unknown
 	ntdll.dll!00007ffdda2c70d1()	Unknown

Are you trying to attach to an existing process? What about launching a new process from Sleepy, does that work?

How can I reproduce this?

Could you download this: http://pan.baidu.com/s/1qYJaxcg
And click "a.exe" in sleepy process list, then sleepy will stop responding.
But other exe is working.

Lauching a.exe in sleepy, and click "Stop", it show "Waiting for symbol query to start...". And cancel button is not working.

Could you download this: http://pan.baidu.com/s/1qYJaxcg

Link doesn't seem to work.

I think that if you put it in a .zip file, you can just attach it here, on GitHub.

Everything works fine here... :/ Windows 10 x64

Sorry it doesn't work for me. Windows 10 x64 too.
If I rename the a.pdb or compile without fastlink, it will not hang.
Looks like there is an infinity loop in SymCachePdb::fRegisterPDBMappings(void).

There might be a problem with your symbol settings. Check your symbol paths and try disabling using the symbol server.

BTW, if it actually gets stuck in that function (and it's not just Very Sleepy calling that function in a loop), then the problem is in Microsoft's dbghelp.dll...

I already tried disable the use symbol server in options
Just before it hand, it print "DBGHELP: Symbol Search Path: ;D:\temp"

Can you check whether the infinite loop occurs in Very Sleepy code, or in dbghelp code?

You can do this by building Very Sleepy from source code, then placing a breakpoint on the StackWalk64 call in profiler.cpp.

Yes, I am sure it's in dbghelp code. StackWalk64(Actually SymCachePdb::fRegisterPDBMappings(void)) never returns.
I made a very simple program to test it with removing all wxWidget codes.

int main()
{
	if (!dbgHelpInit())
	{
		printf("dbghelp error\n");
		return 0;
	}

	std::vector<ProcessInfo> pInfos;
	ProcessInfo::enumProcesses(pInfos);
	for (auto& info : pInfos)
	{
		if (info.getName() == L"a.exe")
		{
			SymbolInfo si;
			si.loadSymbols(info.getProcessHandle(), false);
			std::map<CallStack, SAMPLE_TYPE> callstacks;
			std::map<PROFILER_ADDR, SAMPLE_TYPE> flatcounts;
			Profiler p(info.getProcessHandle(),info.threads[0].getThreadHandle(),callstacks,flatcounts);
			p.sampleTarget(0.0, &si);
			break;
		}
	}
    return 0;
}

Thanks. Do you know if it only happens with the version of dbghelp.dll (dbghelpms.dll) shipped with Very Sleepy? Maybe it's a bug with that specific version.

I use Process Explorer to view a.exe's thread callstack, it stop responding too.

I had tried many dbghelp.dll, 32bit/64bit, in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\dbghelp.dll, in C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll. Either it doesn't resolve the symbol names or stop responding.

I tried adding

BOOL (WINAPI *SymEnumSymbols)(
		_In_           HANDLE                         hProcess,
		_In_           ULONG64                        BaseOfDll,
		_In_opt_       PCTSTR                         Mask,
		_In_           PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
		_In_opt_ const PVOID                          UserContext
	); 
	BOOL (WINAPI *SymEnumTypes)(
		_In_     HANDLE                         hProcess,
		_In_     ULONG64                        BaseOfDll,
		_In_     PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
		_In_opt_ PVOID                          UserContext
	);

in class DbgHelp.
And nothing enumerated when it is built with fastlink.
Did you see the a.exe!foo function in verysleepy?

And nothing enumerated when it is built with fastlink.

Strange... I am out of ideas. I guess this is a MS DbgHelp bug.

I don't know if it would help since it doesn't seem to depend on any other components, but maybe you could try installing the latest Windows SDK. The version this DbgHelp is from is 10.0.14393.0.

Did you see the a.exe!foo function in verysleepy?

Yes:

foo

Could you please see if this issue occurs with the latest release:
https://github.com/VerySleepy/verysleepy/releases

As the latest release includes many fixes, it's likely that this particular problem was fixed as well. If you encounter further problems, please leave a comment or open a new issue. Thanks!