Skip to content

Commit e277785

Browse files
committed
[Backtracing] Add support for repeats to Compact Backtrace Format.
This lets us repeat a frame over and over; it only works for a single frame, but that's the common case for infinite recursions. rdar://124913332
1 parent 8037b5d commit e277785

File tree

3 files changed

+292
-49
lines changed

3 files changed

+292
-49
lines changed

docs/CompactBacktraceFormat.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The following instructions are currently defined
5454
| `0010axxx` | `ra` | A return address value follows |
5555
| `0011axxx` | `async` | An async resume point follows |
5656
| `01xxxxxx` | `omit` | Indicates frames have been omitted |
57+
| `1000xxxx` | `rep` | Repeat the previous frame |
5758
| `1xxxxxxx` | reserved | Reserved for future expansion |
5859

5960
### `end`/`trunc`
@@ -139,3 +140,24 @@ machine word length) that are zero-extended to machine word length and
139140
that represent a count of the number of frames that were omitted.
140141

141142
If `x` is `0`, `count + 1` is the number of frames that were omitted.
143+
144+
### `rep`
145+
146+
#### Encoding
147+
148+
~~~
149+
7 6 5 4 3 2 1 0
150+
┌────────────────┬───┬──────────┐
151+
│ 1 0 0 0 │ x │ count │ repeat
152+
└────────────────┴───┴──────────┘
153+
~~~
154+
155+
#### Meaning
156+
157+
Repeat the previous frame.
158+
159+
If `x` is `1`, the instruction is followed by `count + 1` bytes that are zero
160+
extended to machine word length and that represent a count of the number of
161+
times to repeat the preceding frame.
162+
163+
If `x` is `0`, the previous frame should be repeated `count + 1` times.

0 commit comments

Comments
 (0)