本文介绍了在QNX中检索其自身进程的内存映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在Linux中,如果我们查看/proc/self/maps:

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

我想要诸如Qnx的路径名和起始地址之类的信息.我如何获得这些信息?

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

我的分析表明Qnx中没有/proc/self/maps文件.

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

推荐答案

我们在QNX中也有自己的文件!

We have self file in QNX too !!

在/proc中的每个文件夹中,地址空间由一个名为"as"的二进制文件表示./proc/self/as包含当前进程的地址空间.

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.

问题是它不能被人类直接读取.您需要使用devctl()来读取它.以下是有关地址空间解码的所有devctl命令的链接.

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

示例-devctl("/proc/self/as",DCMD_PROC_TIDSTATUS,& debug_data,sizeof(debug_data)

Example -devctl("/proc/self/as",DCMD_PROC_TIDSTATUS,&debug_data, sizeof(debug_data)

此命令将为您提供struct _debug_thread_info结构中的线程调试数据.

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

类似地,DCMD_PROC_PAGEDATA和DCMD_PROC_MAPINFO可用于获取进程地址空间的段映射信息(在linux maps 文件中是这样做的).

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.

希望这会有所帮助.

这篇关于在QNX中检索其自身进程的内存映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 07:23