-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce migration guide for breaking changes
The idea is that the document will contain one section for each breaking change with: - link to the PR introducing the change - brief description of the change - example of an error message - simple guide to fix existing scripts As an example, add entry for the recent change of the type of the `pid` and `tid` builtins.
- Loading branch information
1 parent
279301d
commit 07e8c21
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Breaking changes (migration guide) | ||
|
||
This document lists changes introduced in bpftrace which break backwards | ||
compatibility in some way. Each entry should contain: | ||
- a link to the PR introducing the change | ||
- a brief description of the change | ||
- an example of an error message | ||
- a simple guide to fix existing scripts | ||
|
||
## Versions 0.21.x (or earlier) to 0.22.x (or later) | ||
|
||
### `pid` and `tid` builtins return `uint32` | ||
|
||
https://github.com/bpftrace/bpftrace/pull/3441 | ||
|
||
Previously, `pid` and `tid` builtins returned `uint64` so it is now possible to | ||
get an error when storing the builtin in a variable and overriding it with | ||
`uint64` later: | ||
``` | ||
# bpftrace -e 'BEGIN { $x = pid; $x = cgroup; }' # cgroup is uint64 | ||
stdin:1:19-30: ERROR: Integer size mismatch. Assignment type 'uint64' is larger than the variable type 'uint32'. | ||
BEGIN { $x = pid; $x = cgroup; } | ||
~~~~~~~~~~~ | ||
``` | ||
|
||
To mitigate such an error, just typecast `pid` or `tid` to `uint64`: | ||
``` | ||
# bpftrace -e 'BEGIN { $x = (uint64)pid; $x = cgroup; }' | ||
Attaching 1 probe... | ||
``` | ||
|