[qnx] fix empty proc maps info

Qnx pmap file starts with a header line, skip it to make ForEachLine
continue feeding next valid proc maps line.

vaddr,size,flags,prot,maxprot,dev,ino,offset,rsv,guardsize,refcnt,mapcnt,path
0x0000001c0ae92000,0x0000000000002000,0x00010071,0x05,0x0d,0x00000802,0x00000000c00000ab, \
  0x0000000000000000,0x0000000000000000,0x00000000,0x0000017e,0x0000017c,/bin/cat
This commit is contained in:
Xiang.Lin 2024-08-08 10:41:03 +08:00 committed by Aliaksey Kandratsenka
parent 285908e8c7
commit 68ae9e624e
1 changed files with 8 additions and 5 deletions

View File

@ -354,17 +354,20 @@ bool DoIterateLinux(const char* path, void (*body)(const ProcMapping& mapping, v
inline
bool DoIterateQNX(void (*body)(const ProcMapping& mapping, void* arg), void* arg) {
return ForEachLine(
"proc/self/pmap",
"/proc/self/pmap",
[&] (char* line_start, char* line_end) {
// https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.sys_arch/topic/vm_calculations.html
// vaddr,size,flags,prot,maxprot,dev,ino,offset,rsv,guardsize,refcnt,mapcnt,path
// 0x00000025e9df9000,0x0000000000053000,0x00000071,0x05,0x0f,0x0000040b,0x0000000000000094,
// 0x0000000000000000,0x0000000000000000,0x00000000,0x00000005,0x00000003,/system/xbin/cat
ProcMapping mapping;
unsigned filename_offset;
uint64_t q_vaddr, q_size, q_ino, q_offset;
uint32_t q_flags, q_dev, q_prot;
// pmap file start with below header info, skip it.
// vaddr,size,flags,prot,maxprot,dev,ino,offset,rsv,guardsize,refcnt,mapcnt,path
if (!strncmp(line_start, "vaddr,size,", 11)) {
return true;
}
if (sscanf(line_start,
"0x%" SCNx64 ",0x%" SCNx64 ",0x%" SCNx32 \
",0x%" SCNx32 ",0x%*x,0x%" SCNx32 ",0x%" SCNx64 \