1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

ftrace: Ensure /proc/kallsyms contains symbol addresses

The content of /proc/kallsyms depends on the value of
/proc/sys/kernel/kptr_restrict:
* If 0, restriction is lifted and kallsyms contains real addresses
* If 1, kallsyms will contain null pointers

Since trace-cmd records the content of kallsyms into the trace.dat and uses that
to pretty-print function names (function tracer/grapher), ensure that its
content is available.

Signed-off-by: Douglas RAILLARD <douglas.raillard@arm.com>
This commit is contained in:
Douglas RAILLARD 2019-11-04 17:47:06 +00:00 committed by Marc Bonnici
parent 2650a534f3
commit 0e6280ae31

View File

@ -20,6 +20,7 @@ import time
import re
import subprocess
import sys
import contextlib
from pipes import quote
from devlib.trace import TraceCollector
@ -226,6 +227,11 @@ class FtraceCollector(TraceCollector):
tracer_string = '-p {}'.format(self.tracer) if self.tracer else ''
# Ensure kallsyms contains addresses if possible, so that function the
# collected trace contains enough data for pretty printing
with contextlib.suppress(TargetStableError):
self.target.write_value('/proc/sys/kernel/kptr_restrict', 0)
self.target.write_value(self.trace_clock_file, self.trace_clock, verify=False)
try:
self.target.write_value(self.save_cmdlines_size_file, self.saved_cmdlines_nr)