tyoma / micro-profiler

Cross-platform low-footprint realtime C/C++ Profiler
https://visualstudiogallery.msdn.microsoft.com/133d5764-b32b-4ec9-8ee8-5546eca64584
MIT License
244 stars 28 forks source link

Select a process... window is unusable #81

Open webloft opened 2 years ago

webloft commented 2 years ago

If I click on the menu 'Profile Process...' some window opens that lists the processes to select put the PID column is out of the viewport and the pid numbers are hidden under the scroll pane with some opacity.

There is some oder by Name-arrow(?) button but it has no function.

Clicking on the process to debug (if you finally can find it) crashes VS 2019

tyoma commented 2 years ago

Hi @webloft, the "profile process" is still in beta, as it only allows to attach to the processes of the bitness same with the Visual Studio you use (64 for 2022, 32 for everything older). Will be ready within a month, as i'm reorganizing table data internally. Nonetheless, to attach you can just double-click the process in the list. For functions to be able to hook to you'll need to set /hotpatch command line option in compiler settings and /functionpadmin:14 in linker command line. This is the safest way i came up with as of now, but this will become unnecessary with the new patcher (will be done later).

webloft commented 2 years ago

Thx for the info.

Is this patcher assumed to work as some injection-DLL? Because I want to profile a native build, not compile it again with VS. I have source and pdb-files.

tyoma commented 2 years ago

The profiler works only with native images (dll/exe). You're right - the patcher works through dll injection via CreateRemoteThread. As of now for the realtime patching to work, the image must be linked with enough space in-between functions (/functionpadmin) to allow the patcher thunks to be injected into that space. i experimented with different kind of thunking that moved function code away, but that way required much more effort. having padding enabled can be permanent, as it marginally affects the performance. the upside of profiling this way (comparing to the original penter/pexit approach) is that it allows you to define the scope of interest, w/o affecting the overall performance much.