File: check_mmaps.py

package info (click to toggle)
hotspot 1.6.0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,756 kB
  • sloc: cpp: 27,071; ansic: 281; sh: 261; python: 75; xml: 48; makefile: 16
file content (29 lines) | stat: -rwxr-xr-x 681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/env python3
#
# SPDX-FileCopyrightText: Milian Wolff <milian.wolff@kdab.com>
# SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
#
# SPDX-License-Identifier: GPL-2.0-or-later
#

import sys
import re

prog = re.compile(r"\[(0x[a-z0-9]+)((0x[a-z0-9]+)\)")

for line in sys.stdin:
    if not "PERF_RECORD_MMAP" in line:
        continue

    m = prog.search(line)
    if not m:
        print("no match: ", line.rstrip())
        continue

    start = int(m[1], 16)
    length = int(m[2], 16)
    end = start + length

    for arg in sys.argv[1:]:
        if start <= int(arg, 16) < end:
            print(arg, "matched in:", line)