Commit c1d9ae0c authored by Brendan Gregg's avatar Brendan Gregg

docs for kaddr

parent 0b868fb9
...@@ -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
......
...@@ -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()`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment