Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I attach a trace listener to a running process?

I'm not sure if this is possible in the manner I am envisioning or not so I'm hoping someone can help me wrap my head around this.

I'm wanting to inject a TraceListener into a running process - kind of. I don't actually care how I attach to the process, but the end goal is to listen to the trace output of the running process and dump it out to a console window.

I can attach to the process okay, and I can write a TraceListener okay... where I'm coming unstuck is the bit in the middle. Anyone got any clue if this can be done? If so, can you give me a push in the right direction because I can't see the forest for the trees here.

Maybe I'm trying to approach this in the wrong way?

like image 649
BenAlabaster Avatar asked Aug 17 '09 21:08

BenAlabaster


2 Answers

I don't think this is practical. It would be easy to create a listener at runtime, but that is something the App has to do, it involves adding something to a list.

You may want to make sure the Default listener isn't removed and use an OutputDebug tool to listen in.

like image 184
Henk Holterman Avatar answered Oct 20 '22 05:10

Henk Holterman


Would DbgView from Sysinternals be enough for your needs? It will show you the trace messages of all running processes without having you to configure a trace listener prior to starting the process.

like image 39
Dirk Vollmar Avatar answered Oct 20 '22 03:10

Dirk Vollmar