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
a7342b4c
Commit
a7342b4c
authored
Feb 22, 2016
by
Sasha Goldshtein
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into argdist-silent
parents
c9551307
db454655
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
.gitignore
.gitignore
+4
-0
INSTALL.md
INSTALL.md
+3
-0
README.md
README.md
+4
-0
examples/tracing/tcpv4connect.py
examples/tracing/tcpv4connect.py
+13
-4
No files found.
.gitignore
View file @
a7342b4c
# Editor's files
*.swp
*.swo
*.pyc
# Build artefacts
/build/
INSTALL.md
View file @
a7342b4c
...
...
@@ -112,12 +112,15 @@ To build the toolchain from source, one needs:
### Install build dependencies
```
# Trusty and older
VER=trusty
echo "deb http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main
deb-src http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main" | \
sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
# All versions
sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
libllvm3.7 llvm-3.7-dev libclang-3.7-dev python zlib1g-dev
```
...
...
README.md
View file @
a7342b4c
...
...
@@ -47,6 +47,10 @@ many possible capabilities.
See
[
INSTALL.md
](
INSTALL.md
)
for installation steps on your platform.
## FAQ
See
[
FAQ.txt
](
FAQ.txt
)
for the most common troubleshoot questions.
## Contents
Some of these are single files that contain both C and Python, others have a
...
...
examples/tracing/tcpv4connect.py
View file @
a7342b4c
...
...
@@ -62,7 +62,7 @@ int kretprobe__tcp_v4_connect(struct pt_regs *ctx)
bpf_probe_read(&dport, sizeof(dport), &skp->__sk_common.skc_dport);
// output
bpf_trace_printk("%x %x %d
\
\
n", saddr, daddr, ntohs(dport));
bpf_trace_printk("
trace_tcp4connect
%x %x %d
\
\
n", saddr, daddr, ntohs(dport));
currsock.delete(&pid);
...
...
@@ -86,10 +86,19 @@ def inet_ntoa(addr):
addr
=
addr
>>
8
return
dq
# format output
# f
ilter and f
ormat output
while
1
:
# Read messages from kernel pipe
try
:
(
task
,
pid
,
cpu
,
flags
,
ts
,
msg
)
=
b
.
trace_fields
()
(
saddr_hs
,
daddr_hs
,
dport_s
)
=
msg
.
split
(
" "
)
(
_tag
,
saddr_hs
,
daddr_hs
,
dport_s
)
=
msg
.
split
(
" "
)
except
ValueError
:
# Ignore messages from other tracers
continue
# Ignore messages from other tracers
if
_tag
!=
"trace_tcp4connect"
:
continue
print
(
"%-6d %-12.12s %-16s %-16s %-4s"
%
(
pid
,
task
,
inet_ntoa
(
int
(
saddr_hs
,
16
)),
...
...
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