[FEATURE] Added new option: follow child processes#68
[FEATURE] Added new option: follow child processes#68hasherezade merged 3 commits intohasherezade:masterfrom
Conversation
|
Hi @cecio ! Thank you for your contribution, I will check it as soon as I get some free time.
This parameter should not be removed, because it do serve an important purpose. It is for tracing DLLs (https://github.com/hasherezade/tiny_tracer/wiki/Tracing-DLLs#tracing-a-dll-within-an-exe). In this case, the traced module is different than the main module - and we define it by the |
|
Very good point, you are absolutely right. Let me re-work the callback then: I'll modify it to handle this the proper way. |
|
Hi @hasherezade ! |
|
Thank you @cecio ! I will just rework a bit the way in which the log is saved. I want it to have a |
|
Thanks a lot! |
|
BTW @cecio - I think we don't have to add the follow option to the INI file, because anyways the argument |
|
Are you sure that the process will be followed with default initialization if the callback returns FALSE? I see the following for So it seems that if the callback returns FALSE the child is not injected at all. But may be you tested it directly? |
|
Hmm, ok I see, you have the point... What I tried was, removing this function fully: and I saw that then PIN followed the child processes: But indeed when I registered the function and made it return |
|
yeah, actually the callback is not mandatory, so if you don't set it everything it will be executed with default init as you said. |
|
Thank you! Maybe you already saw it, I reverted back to have this option in the INI, and made some small changes. I think it should be fine now, but if you notice something, please let me know! |


Hey!
First of all thanks a lot for your work on this project!
As you can see in the commit, I didn't wrote too much code to implement this, it was more about reading the PIN docs actually :-).
I'd like to go through the mods:
Settings.cpp,Settings.handTinyTracer.iniare basically done to implement the switch to turn the feature on/off, so nothing fancy thererun_me.bat: I added the proper-follow-execvoption to the execution. This instruct PIN to re-execute the command line in case of a process creation. As you can see I removed the-moption used here. I had to do this because when a new process is spawned, PIN re-execute the original command line adding the new process at the end. If I leave the-m, this is going to impact the execution and it tries to execute again the parent process. If you prefer to keep this param here, it is possible to remove it in the callback (see later), but since I didn't found a reason to keep it, I thought to follow the "simple" wayTinyTracer.cpp: since themainneeds to be "idempotent" and it could be executed multiple times, I changed some things to allow the execution without collateral effects, like adding the PID to the tag file name (to avoid overwrites). Then I added a callback function called in case of subprocess creation (FollowChild): I kept it very simple for the time being, just checking if the follow child option is enabled and if so, go ahead with tracking. Here we can do also other things (like manipulating the command line as I said before), but it works perfectly even as it is.It should work also for Linux, but I was not able to test it tbh.
Let me know what do you think and if any rework is needed.
Thanks again