Unable to use NX CPU profiler on Nintendo Switch

Hello, I’m trying to profile the CPU usage of a simple Unity test project on the Switch using the NX CPU Profiler. If I include the FMOD library I am unable to load the .nss file required to attach the profiler.

Any guidance would be greatly appreciated. Thanks!

Below is the error and stack trace from the profiler, in case it is helpful.

"Unable to load functions from the ELF. This ELF cannot be used for profiling."
0:
'los.nss' had a problem being loaded.
Value cannot be null.
Parameter name: key
Stack:    at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Nintendo.ELF.ARM.Helper.ObtainPayloads(ElfBase elf, Dictionary`2 MappingSymbolsDict, List`1 Functions, ProgressUpdate callback)
   at Nintendo.ELF.ARM.Helper.GenerateFunctionInfo(ElfBase elf, String[] mappingSymbols, List`1& staticSymbols, List`1& dynamicSymbols, ProgressUpdate callback)
   at Nintendo.ELF.ARM.Elf64.Elf.GetFunctionInfo(ProgressUpdate callback)
   at Nintendo.ELF.ARM.Elf64.Elf.GetStaticFunctions(ProgressUpdate callback)
   at Nintendo.ELF.NX.Elf64.Elf.Nintendo.ELF.Core.IDataProvider.GetStaticFunctions(ProgressUpdate callback)
   at Nintendo.CPU.Profiler.Data.NX.NXElfFunctionInfo.LoadFunctions(Stream elf, ProgressUpdate progressUpdateCallback)
   at Nintendo.CPU.Profiler.Data.NX.NXElfLoader.CreateElfFunctionInfo(Stream elf, UInt64 baseAddress, UInt32 size, UInt64 timeBegin, UInt64 timeEnd, String elfName, Boolean fixBaseAddress, Boolean isRelocatable, Boolean obfuscateFunctionNames, ProgressUpdate progressUpdateCallback)
   at Nintendo.CPU.Profiler.Data.ElfFunctionInfo.Create(Stream elf, UInt64 baseAddress, UInt32 size, UInt64 timeBegin, UInt64 timeEnd, String filename, Boolean fixBaseAddress, Boolean isRelocatable, Boolean obfuscateFunctionNames, ProgressUpdate progressUpdateCallback)
   at Nintendo.CPU.Profiler.Data.FunctionInfoManager.Add(Stream elf, UInt64 baseAddress, UInt32 size, UInt64 timeBegin, UInt64 timeEnd, String relocatableName, Boolean fixBaseAddress, Boolean isRelocatable, Boolean obfuscateFunctionNames, ProgressUpdate progressUpdateCallback)

What versions are you using (FMOD, Unity and Switch SDK)?

FMOD 1.09.05
Tested using Unity for Switch 1.0.1/Switch SDK 1.4.0 and Unity for Switch 1.1.1/Switch SDK 1.6.0

Repro project is available here: [REDACTED]

I also suggest following the steps here to actually build it, since the Unity Switch + FMOD build process is a bit broken at the moment: https://developer.nintendo.com/group/development/g1kr9vj6/forums/english/-/gts_message_boards/thread/17050524

The latest Unity Switch (1.09.06) release has the fix for this and for issue not allowing Rom files to be built.

1 Like

Confirmed. Thanks Cameron!