From dbdd63a94df244b7d62f9c40db9c876df609f6bb Mon Sep 17 00:00:00 2001 From: Zifei Tong Date: Wed, 23 Jul 2014 19:11:31 +0800 Subject: [PATCH] mmu: show path and offset for file-mapped vma Signed-off-by: Zifei Tong Signed-off-by: Pekka Enberg --- core/mmu.cc | 9 +++++++-- include/osv/mmu.hh | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/mmu.cc b/core/mmu.cc index a952c68590..3b631a9c21 100644 --- a/core/mmu.cc +++ b/core/mmu.cc @@ -1764,8 +1764,13 @@ std::string procfs_maps() char write = vma.perm() & perm_write ? 'w' : '-'; char execute = vma.perm() & perm_exec ? 'x' : '-'; char priv = 'p'; - osv::fprintf(os, "%x-%x %c%c%c%c 00000000 00:00 0\n", - vma.start(), vma.end(), read, write, execute, priv); + osv::fprintf(os, "%x-%x %c%c%c%c ", vma.start(), vma.end(), read, write, execute, priv); + if (vma.flags() & mmap_file) { + const file_vma &f_vma = static_cast(vma); + osv::fprintf(os, "%08x 00:00 0 %s\n", f_vma.offset(), f_vma.file()->f_dentry->d_path); + } else { + osv::fprintf(os, "00000000 00:00 0\n"); + } } } return os.str(); diff --git a/include/osv/mmu.hh b/include/osv/mmu.hh index 3c29ff2c08..85588b6bc7 100644 --- a/include/osv/mmu.hh +++ b/include/osv/mmu.hh @@ -103,6 +103,8 @@ public: virtual error sync(uintptr_t start, uintptr_t end) override; virtual int validate_perm(unsigned perm); virtual void fault(uintptr_t addr, exception_frame *ef) override; + fileref file() const { return _file; } + f_offset offset() const { return _offset; } private: f_offset offset(uintptr_t addr); fileref _file;