tools: support -I abspath in trace, argdist
diff --git a/tools/trace.py b/tools/trace.py
index 5ea5e4b..aa2c62a 100755
--- a/tools/trace.py
+++ b/tools/trace.py
@@ -624,7 +624,8 @@
help="probe specifier (see examples)")
parser.add_argument("-I", "--include", action="append",
metavar="header",
- help="additional header files to include in the BPF program")
+ help="additional header files to include in the BPF program "
+ "as either full path, or relative to '/usr/include'")
self.args = parser.parse_args()
if self.args.tgid and self.args.pid:
parser.error("only one of -p and -t may be specified")
@@ -644,7 +645,11 @@
"""
for include in (self.args.include or []):
- self.program += "#include <%s>\n" % include
+ if include.startswith((".", "/")):
+ include = os.path.abspath(include)
+ self.program += "#include \"%s\"\n" % include
+ else:
+ self.program += "#include <%s>\n" % include
self.program += BPF.generate_auto_includes(
map(lambda p: p.raw_probe, self.probes))
for probe in self.probes: