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
c1d9ae0c
Commit
c1d9ae0c
authored
Sep 09, 2018
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs for kaddr
parent
0b868fb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
README.md
README.md
+2
-0
docs/reference_guide.md
docs/reference_guide.md
+26
-5
No files found.
README.md
View file @
c1d9ae0c
...
@@ -222,6 +222,7 @@ Variables:
...
@@ -222,6 +222,7 @@ Variables:
-
`arg0`
,
`arg1`
, ... etc. - Arguments to the function being traced
-
`arg0`
,
`arg1`
, ... etc. - Arguments to the function being traced
-
`retval`
- Return value from function being traced
-
`retval`
- Return value from function being traced
-
`func`
- Name of the function currently being traced
-
`func`
- Name of the function currently being traced
-
`name`
- Full name of the probe
-
`curtask`
- Current task_struct as a u64.
-
`curtask`
- Current task_struct as a u64.
-
`rand`
- Random number of type u32.
-
`rand`
- Random number of type u32.
...
@@ -241,6 +242,7 @@ Functions:
...
@@ -241,6 +242,7 @@ Functions:
-
`clear(@x)`
- Delet all key/values from a map
-
`clear(@x)`
- Delet all key/values from a map
-
`sym(void *p)`
- Resolve kernel address
-
`sym(void *p)`
- Resolve kernel address
-
`usym(void *p)`
- Resolve user space address (incomplete)
-
`usym(void *p)`
- Resolve user space address (incomplete)
-
`kaddr(char *name)`
- Resolve kernel symbol name
-
`reg(char *name)`
- Returns the value stored in the named register
-
`reg(char *name)`
- Returns the value stored in the named register
-
`join(char *arr[])`
- Prints the string array
-
`join(char *arr[])`
- Prints the string array
-
`time(char *fmt)`
- Print the current time
-
`time(char *fmt)`
- Print the current time
...
...
docs/reference_guide.md
View file @
c1d9ae0c
...
@@ -42,8 +42,9 @@ This is a work in progress. If something is missing or incomplete, check the bpf
...
@@ -42,8 +42,9 @@ This is a work in progress. If something is missing or incomplete, check the bpf
-
[
5. `str()`: Strings
](
#5-str-strings
)
-
[
5. `str()`: Strings
](
#5-str-strings
)
-
[
6. `sym()`: Symbol Resolution, Kernel-Level
](
#6-str-symbol-resolution-kernel-level
)
-
[
6. `sym()`: Symbol Resolution, Kernel-Level
](
#6-str-symbol-resolution-kernel-level
)
-
[
7. `usym()`: Symbol Resolution, User-Level
](
#7-usym-symbol-resolution-user-level
)
-
[
7. `usym()`: Symbol Resolution, User-Level
](
#7-usym-symbol-resolution-user-level
)
-
[
8. `reg()`: Registers
](
#8-reg-registers
)
-
[
8. `kaddr()`: Address Resolution, Kernel-Level
](
#8-kaddr-address-resolution-kernel-level
)
-
[
9. `exit()`: Exit
](
#9-exit-exit
)
-
[
9. `reg()`: Registers
](
#9-reg-registers
)
-
[
10. `exit()`: Exit
](
#10-exit-exit
)
-
[
Map Functions
](
#map-functions
)
-
[
Map Functions
](
#map-functions
)
-
[
1. Builtins
](
#1-builtins-2
)
-
[
1. Builtins
](
#1-builtins-2
)
-
[
2. `count()`: Count
](
#2-count-count
)
-
[
2. `count()`: Count
](
#2-count-count
)
...
@@ -763,7 +764,8 @@ Note that for this example to work, bash had to be recompiled with frame pointer
...
@@ -763,7 +764,8 @@ Note that for this example to work, bash had to be recompiled with frame pointer
-
`join(char *arr[])`
- Print the array
-
`join(char *arr[])`
- Print the array
-
`str(char *s)`
- Returns the string pointed to by s
-
`str(char *s)`
- Returns the string pointed to by s
-
`sym(void *p)`
- Resolve kernel address
-
`sym(void *p)`
- Resolve kernel address
-
`usym(void *p)`
- Resolve user space address (incomplete)
-
`usym(void *p)`
- Resolve user space address
-
`kaddr(char *name)`
- Resolve kernel symbol name
-
`reg(char *name)`
- Returns the value stored in the named register
-
`reg(char *name)`
- Returns the value stored in the named register
-
`exit()`
- Quit bpftrace
-
`exit()`
- Quit bpftrace
...
@@ -874,7 +876,26 @@ readline
...
@@ -874,7 +876,26 @@ readline
^C
^C
```
```
## 8. `reg()`: Registers
## 8. `kaddr()`: Address resolution, kernel-level
Syntax:
`kaddr(char *name)`
Examples:
```
# bpftrace -e 'BEGIN { printf("%s\n", str(*kaddr("usbcore_name"))); }'
Attaching 1 probe...
usbcore
^C
```
This is printing the
`usbcore_name`
string from drivers/usb/core/usb.c:
```
const char *usbcore_name = "usbcore";
```
## 9. `reg()`: Registers
Syntax:
`reg(char *name)`
Syntax:
`reg(char *name)`
...
@@ -890,7 +911,7 @@ Attaching 1 probe...
...
@@ -890,7 +911,7 @@ Attaching 1 probe...
See src/arch/x86_64.cpp for the register name list.
See src/arch/x86_64.cpp for the register name list.
##
9
. `exit()`: Exit
##
10
. `exit()`: Exit
Syntax:
`exit()`
Syntax:
`exit()`
...
...
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