Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
6c08dcbb
Commit
6c08dcbb
authored
Mar 29, 2016
by
Brenden Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #456 from yadutaf/jt-endian
Minor endian and debug enhancement
parents
354ee0c0
7d37bf4d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
11 deletions
+15
-11
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+1
-1
src/cc/frontends/clang/b_frontend_action.h
src/cc/frontends/clang/b_frontend_action.h
+2
-0
src/cc/frontends/clang/kbuild_helper.cc
src/cc/frontends/clang/kbuild_helper.cc
+3
-0
src/cc/frontends/clang/loader.cc
src/cc/frontends/clang/loader.cc
+1
-1
src/python/bcc/__init__.py
src/python/bcc/__init__.py
+8
-9
No files found.
src/cc/frontends/clang/b_frontend_action.cc
View file @
6c08dcbb
...
...
@@ -688,7 +688,7 @@ BFrontendAction::BFrontendAction(llvm::raw_ostream &os, unsigned flags)
}
void
BFrontendAction
::
EndSourceFileAction
()
{
if
(
flags_
&
0x4
)
if
(
flags_
&
DEBUG_PREPROCESSOR
)
rewriter_
->
getEditBuffer
(
rewriter_
->
getSourceMgr
().
getMainFileID
()).
write
(
llvm
::
errs
());
rewriter_
->
getEditBuffer
(
rewriter_
->
getSourceMgr
().
getMainFileID
()).
write
(
os_
);
os_
.
flush
();
...
...
src/cc/frontends/clang/b_frontend_action.h
View file @
6c08dcbb
...
...
@@ -26,6 +26,8 @@
#include "table_desc.h"
#define DEBUG_PREPROCESSOR 0x4
namespace
clang
{
class
ASTConsumer
;
class
ASTContext
;
...
...
src/cc/frontends/clang/kbuild_helper.cc
View file @
6c08dcbb
...
...
@@ -82,6 +82,9 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
cflags
->
push_back
(
"-include"
);
cflags
->
push_back
(
"./include/linux/kconfig.h"
);
cflags
->
push_back
(
"-D__KERNEL__"
);
cflags
->
push_back
(
"-D__HAVE_BUILTIN_BSWAP16__"
);
cflags
->
push_back
(
"-D__HAVE_BUILTIN_BSWAP32__"
);
cflags
->
push_back
(
"-D__HAVE_BUILTIN_BSWAP64__"
);
cflags
->
push_back
(
"-Wno-unused-value"
);
cflags
->
push_back
(
"-Wno-pointer-sign"
);
...
...
src/cc/frontends/clang/loader.cc
View file @
6c08dcbb
...
...
@@ -155,7 +155,7 @@ int ClangLoader::parse(unique_ptr<llvm::Module> *mod, unique_ptr<vector<TableDes
// Initialize a compiler invocation object from the clang (-cc1) arguments.
const
driver
::
ArgStringList
&
ccargs
=
cmd
.
getArguments
();
if
(
flags_
&
0x4
)
{
if
(
flags_
&
DEBUG_PREPROCESSOR
)
{
llvm
::
errs
()
<<
"clang"
;
for
(
auto
arg
:
ccargs
)
llvm
::
errs
()
<<
" "
<<
arg
;
...
...
src/python/bcc/__init__.py
View file @
6c08dcbb
...
...
@@ -40,11 +40,10 @@ ksyms = []
ksym_names
=
{}
ksym_loaded
=
0
_kprobe_limit
=
1000
BASE_CFLAGS
=
[
'-D__HAVE_BUILTIN_BSWAP16__'
,
'-D__HAVE_BUILTIN_BSWAP32__'
,
'-D__HAVE_BUILTIN_BSWAP64__'
,
]
DEBUG_LLVM_IR
=
0x1
DEBUG_BPF
=
0x2
DEBUG_PREPROCESSOR
=
0x4
@
atexit
.
register
def
cleanup_kprobes
():
...
...
@@ -137,8 +136,9 @@ class BPF(object):
hdr_file (Optional[str]): Path to a helper header file for the `src_file`
text (Optional[str]): Contents of a source file for the module
debug (Optional[int]): Flags used for debug prints, can be |'d together
0x1: print LLVM IR to stderr
0x2: print BPF bytecode to stderr
DEBUG_LLVM_IR: print LLVM IR to stderr
DEBUG_BPF: print BPF bytecode to stderr
DEBUG_PREPROCESSOR: print Preprocessed C file to stderr
"""
self
.
_reader_cb_impl
=
_CB_TYPE
(
BPF
.
_reader_cb
)
...
...
@@ -146,7 +146,6 @@ class BPF(object):
self
.
debug
=
debug
self
.
funcs
=
{}
self
.
tables
=
{}
cflags
=
BASE_CFLAGS
+
cflags
cflags_array
=
(
ct
.
c_char_p
*
len
(
cflags
))()
for
i
,
s
in
enumerate
(
cflags
):
cflags_array
[
i
]
=
s
.
encode
(
"ascii"
)
if
text
:
...
...
@@ -198,7 +197,7 @@ class BPF(object):
lib
.
bpf_module_kern_version
(
self
.
module
),
log_buf
,
ct
.
sizeof
(
log_buf
)
if
log_buf
else
0
)
if
self
.
debug
&
0x2
:
if
self
.
debug
&
DEBUG_BPF
:
print
(
log_buf
.
value
.
decode
(),
file
=
sys
.
stderr
)
if
fd
<
0
:
...
...
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