communicating with other program ( creating debug program )

Hello everyone!

I was thinking about creating a simple debug program.
Here's how it should work:

If my real program have been compiled in my own debug mode:
1
2
3
4
5
#define SPdebug

#if defined SPdebug
// this is my debug mode or the way to enable it and use it
#endif 


I need to write a information for example
( in real program )
1
2
3
4
void testfunc()
{
    debuglog("testfunc() called")
}

and if the program will crash at the end of the testfunc() then
that debug program will write a file what will contain the inbuffer of
debuglog

What i need is the fast way to call function from other program or somehow communicate with the other program and then detect when my real program has been crashed.

The thing is that in debug mode, the function debuglog may be called x times each app frame.
( i don't want everything into file what debuglog gets, just some last buffers )

first idea for windows was creating that black console thing and then
using std::cout << but this is really slow yet i would see the last
activity before the app has crashed.
but that is really slow. Even slower than writing a file if i remember correctly.

So, 2 simple things i need:
1. a fast way to communicate with other program.
2. to know when did my real program crashed.


Since i'm needing it for both, linux and windows
I need some sort of global way or something.

PS: please don't lead me to a already existing complicated libraries what
will contain function what i wont be using and alot of confusing.
I want my debug program to be just a few lines of code.
I hope thats possible but if not then those libraries have to do the trick.

Thanks!



Look at ptrace. It lets you look at system calls from other programs, and change the values of registers.
Topic archived. No new replies allowed.