Operating System - HP-UX
1748169 Members
4145 Online
108758 Solutions
New Discussion

Re: Display a Memory Buffer

 
SOLVED
Go to solution
bill-clayton
Advisor

Display A Memory Buffer

If I know the location of a memory buffer (in HP-UX 11.00), how can I display the memory contents. I would prefer to display a number of memory locations if possibel. Are ther any tools, scripts, etc. to allow me to view memory at specific locations?

bc
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: Display a Memory Buffer

Are you talking about in a debugger for a user application using gdb?

bill-clayton
Advisor

Re: Display a Memory Buffer

No I'm not talking about GDB. I wish I had an object code debugger like OllyDbg for PARISC, but alas I don't. All I want to be able to do is point to a memory address and then read one to 256 words of memory -- much like one would see with a hex editor -- but not for a file, but for memory locations. Is that clearer? I hope I'm saying it right!

bc
Dennis Handly
Acclaimed Contributor

Re: Display a Memory Buffer

>I want to be able to do is point to a memory address and then read one to 256 words of memory

 

Again, are you talking about a user process or the kernel?

gdb's x command can dump memory of a user process.  For the kernel, you need to use adb.

Matti_Kurkela
Honored Contributor
Solution

Re: Display a Memory Buffer

In Unix, "everything is a file".

 

With /dev/mem and /dev/kmem, you can access the main memory if you are root or a member of the "sys" group. Just open the device, seek to the location you want and read. /dev/mem gives access to physical memory, and /dev/kmem to kernel virtual memory.

 

However, the big challenge will be knowing the right address (which translates into file position when reading the /dev/(k)mem device file). Any memory addresses you might get from the debug output of an application will normally refer to the virtual address space of that particular process: a mapping operation is required to find the corresponding address in the kernel virtual address space, and another mapping operation to find the corresponding physical address.

 

But if you're debugging hardware that is located in a known physical memory address and/or can read the kernel data structures to find the necessary information to translate the addresses, more power to you.

MK
bill-clayton
Advisor

Re: Display a Memory Buffer

Thanks Matti and also Dennis Handly -- points to both of you. I will try the easiest first, but I doubt it will work since I am trying to look at locations populated by kernel system calls. This leads me to believe I will have to use ADB (do not know if I have it) or try your method Matti. Thanks to both of you.

bc
Dennis Handly
Acclaimed Contributor

Re: Display a Memory Buffer

>This leads me to believe I will have to use adb (do not know if I have it)

 

It's in /usr/bin/adb.  Something like:

# adb /stand/vmunix /dev/kmem