Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
c07b54f6
Commit
c07b54f6
authored
Oct 16, 2018
by
Rodney Lorrimar
Committed by
Alastair Robertson
Oct 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: Allow hard-coding a default kernel headers directory
parent
c0dbeaf5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
src/CMakeLists.txt
src/CMakeLists.txt
+6
-0
src/clang_parser.cpp
src/clang_parser.cpp
+10
-4
No files found.
src/CMakeLists.txt
View file @
c07b54f6
...
...
@@ -28,3 +28,9 @@ target_link_libraries(bpftrace ${binary_dir}/src/cc/frontends/clang/libclang_fro
target_link_libraries
(
bpftrace
${
LIBELF_LIBRARIES
}
)
install
(
TARGETS bpftrace DESTINATION bin
)
set
(
KERNEL_HEADERS_DIR
""
CACHE PATH
"Hard-code kernel headers directory"
)
if
(
KERNEL_HEADERS_DIR
)
MESSAGE
(
STATUS
"Using KERNEL_HEADERS_DIR=
${
KERNEL_HEADERS_DIR
}
"
)
target_compile_definitions
(
bpftrace PUBLIC KERNEL_HEADERS_DIR=
"
${
KERNEL_HEADERS_DIR
}
"
)
endif
()
src/clang_parser.cpp
View file @
c07b54f6
...
...
@@ -161,15 +161,21 @@ void ClangParser::parse(ast::Program *program, StructMap &structs)
struct
utsname
utsname
;
uname
(
&
utsname
);
const
char
*
kpath_env
=
::
getenv
(
"BPFTRACE_KERNEL_SOURCE"
);
std
::
string
kdir
=
kpath_env
?
std
::
string
(
kpath_env
)
:
const
char
*
kpath_fixed
=
#ifdef KERNEL_HEADERS_DIR
kpath_env
?
kpath_env
:
KERNEL_HEADERS_DIR
;
#else
kpath_env
;
#endif
std
::
string
kdir
=
kpath_fixed
?
std
::
string
(
kpath_fixed
)
:
std
::
string
(
"/lib/modules/"
)
+
utsname
.
release
;
auto
kpath_info
=
get_kernel_path_info
(
kdir
);
auto
kpath
=
kpath_
env
?
auto
kpath
=
kpath_
fixed
?
kdir
:
kdir
+
"/"
+
kpath_info
.
second
;
bool
has_kpath_source
=
kpath_
env
?
false
:
kpath_info
.
first
;
bool
has_kpath_source
=
kpath_
fixed
?
false
:
kpath_info
.
first
;
std
::
vector
<
std
::
string
>
kflags
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment