Skip to content

Commit fcedf0b

Browse files
aykevldeadprogram
authored andcommitted
stacksize: deal with DW_CFA_advance_loc1
In some cases this operation is emitted. It appears to be emitted when a switch is lowered to a jump table in the ARM backend.
1 parent 4dadb31 commit fcedf0b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stacksize/dwarf.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ func (fi *frameInfo) exec(bytecode []byte) ([]frameInfoLine, error) {
207207
switch lowBits {
208208
case 0: // DW_CFA_nop
209209
// no operation
210+
case 0x02: // DW_CFA_advance_loc1
211+
// Very similar to DW_CFA_advance_loc but allows for a slightly
212+
// larger range.
213+
offset, err := r.ReadByte()
214+
if err != nil {
215+
return nil, err
216+
}
217+
fi.loc += uint64(offset) * fi.cie.codeAlignmentFactor
218+
entries = append(entries, fi.newLine())
219+
// TODO: DW_CFA_advance_loc2 etc
210220
case 0x07: // DW_CFA_undefined
211221
// Marks a single register as undefined. This is used to stop
212222
// unwinding in tinygo_startTask using:

0 commit comments

Comments
 (0)