crazy
All the solution you proposed could work for my scenario I guess. I'll look more into what's really happening behind the code and tell you about it.
@Arithma: I'm guessing that process A is allocating the variable I want a place in memory, and is using the value stored in memory to dynamically recalculate something. It won't work if I change the config file because the process forgets about it after parsing it the first time. So its option 2 I need, create a Process B that will change a variable in memory that was allocated by A.
edit: I just saw your edit ;)
I don't want the 2 process to communicate, I just want one process to hack the memory of the other ^^ and change one variable that he keeps on using.
arithma
HACK is the word. This is truly a no no. Imagine if the other program was actually written over a VM (C#/Mono, Java).. There wouldn't even be a variable address to change (most of the time)
Anyway, what makes you sure that getting the address of the variable on one run won't change on the next run?
Why are you sure that the whole program isn't shifted around in memory?
Processes don't contain their code information, they are flattened out logic. Most probably, you will not be able to make guarantees, and the best bet you could have is to use xterms technique every time you want to change it (which defeats the purpose)...
This in other words is me telling you: This is impossible and insane.
crazy
Hehe :) This is why I want to track this variable in memory, so I could guarantee that it would work anywhere.
I'll give you a bit more details so you can see what I see.
I have a routing protocol that is running, this protocol is parsing a conf file at first. In this conf file, there is a variable used to calculate the metric (like a weight), I want to be able to change this value (weight) without stopping the protocol.
There are no commands to do it manually like opsf ip cost etc... That is why I see accessing memory is a viable thing to do, even if it is a hack, an ugly one I might say too.
crazy
Ok, some updates:
I didn't install eclipse yet, but i manage to install scanmem on a UML image which I run in Cloonix (its like a network simulator).
scanmem lets me search for the value of the variable in memory and change it. And the process is considering the change, so it works. Now does anyone have an idea how can I automate this hack?
(I don't need a complete solution, its fun messing with it, but some ideas won't make any harm ^^)
Padre
just look into memory scanners -_-