Skip to content
Advertisement

Retrieving the memory map of its own process in QNX

In Linux if we look at the /proc/self/maps:

00400000-004ef000 r-xp 00000000 08:01 12845058                           /bin/bash
006ef000-006f0000 r--p 000ef000 08:01 12845058                           /bin/bash
006f0000-006f9000 rw-p 000f0000 08:01 12845058                           /bin/bash
006f9000-006ff000 rw-p 00000000 00:00 0
00d5a000-010a2000 rw-p 00000000 00:00 0                                  [heap]
7f6fe582a000-7f6fe5835000 r-xp 00000000 08:01 1048595                    /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f6fe5835000-7f6fe5a34000 ---p 0000b000 08:01 1048595                    /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f6fe5a34000-7f6fe5a35000 r--p 0000a000 08:01 1048595                    /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f6fe5a35000-7f6fe5a36000 rw-p 0000b000 08:01 1048595                    /lib/x86_64-linux-gnu/libnss_files-2.19.so

I want information like pathname and starting address for Qnx. How can I get that information?

My analysis says that there is not /proc/self/maps file in Qnx.

Advertisement

Answer

We have self file in QNX too !!

The address space is represented by a binary file called “as” in every folder in /proc. /proc/self/as contains the address space of the current process.

Problem is that its not human readable directly. You need to use devctl() to read it. Below is the link for all the devctl commands regarding address space decoding.

http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_cookbook%2Fs3_procfs.html

Example – devctl(“/proc/self/as”,DCMD_PROC_TIDSTATUS,&debug_data, sizeof(debug_data)

This command will give you debug data of the thread in a struct _debug_thread_info structure.

Similarly DCMD_PROC_PAGEDATA and DCMD_PROC_MAPINFO can be used to get the segment mapping ( in linux maps file does this) information of a process’s address space.

Hope this helps.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement