1755723 Members
3091 Online
108837 Solutions
New Discussion юеВ

reading process memory

 
EML
Advisor

reading process memory

When a process starts, it reads a configuration file. My question concerns these running configurations. Is there a tool in HP-UX to read the process memory to see the variables and constants that process is using? Or is it to be hardcoded so that the memory could be read? Any suggestions?
7 REPLIES 7
Paula J Frazer-Campbell
Honored Contributor

Re: reading process memory

Hi

Will glance and tusc not give you the information you require?

Paula
If you can spell SysAdmin then you is one - anon
EML
Advisor

Re: reading process memory

I suppose glance is giving memory reports.
To elaborate further, example is that a process would read a file before it starts. On the file, there is a parameter:
retry =

I would like to see if the running process really uses the "", by reading the process memory.

I am not familiar with that tusc, what would that be?
James R. Ferguson
Acclaimed Contributor

Re: reading process memory

Hi Edmund:

Have a look at the man pages for 'environ' and 'env' along with 'getenv()' and 'putenv()'.

Regards!

...JRF...
Ken Hubnik_2
Honored Contributor

Re: reading process memory

I would try using glance. You can do a ? in glance to get the command options and I beleive an R will give you resources used for a particular process.
Bill Hassell
Honored Contributor

Re: reading process memory

What you are asking is very specific to every process. While a script can easily be traced (sh -x) to see what decisions and steps it makes, an executable will require extensive instrumentation (ie, rewrite to add debug statements, recompile and run) or use execution tracing, but this all assumes you have the source code. While you could look at the process's memory with adb (very large number of steps to determine where the process is located, find the data map and search for something you know should be associated with the values you are seeking), there isn't much you can do without the source code.


Bill Hassell, sysadmin
Klaus Crusius
Trusted Contributor

Re: reading process memory

If you have access to the source code, best solution would be to write a configuration protocol to a dedicated file, after the configuration is read.

If you have only the binary, you can check, if the configuration file is still open by the process using "lsof".

You could send a SIBBUS signal to provoke a core dump, and then inspect all character strings in the core dump using "strings -a core".
There is a live before death!
Todd Larchuk
Advisor

Re: reading process memory

Sounds to me like you want to use a debugger, like wdb or gdb to attach to the process and examine the values of the variables that the process is actually using.