RudjiGames / MTuner

MTuner is a C/C++ memory profiler and memory leak finder for Windows, PlayStation 4 and 3, Android and other platforms
BSD 2-Clause "Simplified" License
2.63k stars 145 forks source link

32/64-bit detection for MTunerInject misjudges .net executables #17

Closed Bashky closed 7 years ago

Bashky commented 7 years ago

Running a 64-bit .net (managed) executable from the MTuner Project manager screen gives an error: "Failed to launch [path]". It uses MTunerInject32.exe which then obviously doesn't work.

Reproduce:

Workaround: Renaming MTunerInject64.exe to MTunerInject32.exe works as expected.

Maybe the issue is actually in rdebug::processIs64bitBinary.

Bashky commented 7 years ago

From reading the code I guess GetBinaryTypeW doesn't work as expected for .net binaries. I don't know if there is an alternative that does, maybe it's even determined on start-up of the process (depending maybe on your processor and/or .config file)? Otherwise, we could just try both injectors in case of doubt... :relieved:

milostosic commented 7 years ago

Yes, trying both is an easy workaround, that was even how it was setup in the past. However, even if it did work you wouldn't get any meaningful information as walking the call stack for managed code would have to be done differently.

Purpose of MTuner never was to profile managed code but if you know an easy, fast and reliable way to walk the stack for managed code and resolve debug symbols later on - I'm all ears! :)

Bashky commented 7 years ago

My .net code is just a small wrapper around a native dll. I want to profile the things my dll does, MTuner does this splendidly :)

milostosic commented 7 years ago

Added code to try different arch on failure, new release is up (v4.0.2). I'll close this one as managed code profiling is not a target (for now).