Re: Display a Memory Buffer (491 Views)
Reply
Advisor
bill-clayton
Posts: 16
Registered: ‎03-08-2011
Message 1 of 7 (552 Views)
Accepted Solution

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
Acclaimed Contributor
Dennis Handly
Posts: 25,089
Registered: ‎03-06-2006
Message 2 of 7 (543 Views)

Re: Display a Memory Buffer

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

Advisor
bill-clayton
Posts: 16
Registered: ‎03-08-2011
Message 3 of 7 (537 Views)

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
Acclaimed Contributor
Dennis Handly
Posts: 25,089
Registered: ‎03-06-2006
Message 4 of 7 (531 Views)

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.

Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 5 of 7 (509 Views)

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
Advisor
bill-clayton
Posts: 16
Registered: ‎03-08-2011
Message 6 of 7 (500 Views)

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
Acclaimed Contributor
Dennis Handly
Posts: 25,089
Registered: ‎03-06-2006
Message 7 of 7 (491 Views)

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.