get pid mapping.
refet to test.lua
local Cpidmap = require("pidmap")
local m = Cpidmap.new("self", 'x', true)
local res = m:elfInfo(".*libc")
assert(res, "get libc position failed.")
local libc = res[4]
res = m:query(res[1] + 400)
assert(res, "check libc position failed.")
assert(libc == res[4], "check libc name failed.")
- new
create a new pidmap object, args list:
- pid of task or self.
- filter for segment permissions, use lua regular expression, eg to filter code segment, use 'x'. By default, no filtering.
- Whether to filter only files. By default, no filtering.
- elfInfo
Gets the ELF file information in the first match. args list:
- filter for segment file name, use lua regular expression,
the result is a table, {segment start address, segment end address, segment permissions, elf file name}.
- elfInfos
reter to elfInfo, the result is tables for matching elf name.
- query
Gets the ELF file information for address match.
- The address within the process.
the result is a table, {segment start address, segment end address, segment permissions, elf file name}.