aboutsummaryrefslogtreecommitdiffhomepage
path: root/stacksize
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-01-06 01:05:33 +0100
committerRon Evans <[email protected]>2021-01-06 19:41:47 +0100
commita4d0877cf0707c10585cdce8cd2bc02b13004efd (patch)
tree81d8eb1efacd13f7138bcc8d399309dcad8939b7 /stacksize
parent6ec868710bc70ba1e40413f23df5bbc4f8cd889a (diff)
downloadtinygo-a4d0877cf0707c10585cdce8cd2bc02b13004efd.tar.gz
tinygo-a4d0877cf0707c10585cdce8cd2bc02b13004efd.zip
stacksize: add support for DW_CFA_offset_extended
It should be possible to ignore this directive, but we still have to consume the two operands.
Diffstat (limited to 'stacksize')
-rw-r--r--stacksize/dwarf.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/stacksize/dwarf.go b/stacksize/dwarf.go
index d4e714277..0ba880a4c 100644
--- a/stacksize/dwarf.go
+++ b/stacksize/dwarf.go
@@ -190,6 +190,8 @@ func (fi *frameInfo) exec(bytecode []byte) ([]frameInfoLine, error) {
}
return nil, err
}
+ // For details on the various opcodes, see:
+ // http://dwarfstd.org/doc/DWARF5.pdf (page 239)
highBits := op >> 6 // high order 2 bits
lowBits := op & 0x1f
switch highBits {
@@ -217,6 +219,17 @@ func (fi *frameInfo) exec(bytecode []byte) ([]frameInfoLine, error) {
fi.loc += uint64(offset) * fi.cie.codeAlignmentFactor
entries = append(entries, fi.newLine())
// TODO: DW_CFA_advance_loc2 etc
+ case 0x05: // DW_CFA_offset_extended
+ // Semantics are the same as DW_CFA_offset, but the encoding is
+ // different. Ignore it just like DW_CFA_offset.
+ _, err := readULEB128(r) // ULEB128 register
+ if err != nil {
+ return nil, err
+ }
+ _, err = readULEB128(r) // ULEB128 offset
+ if err != nil {
+ return nil, err
+ }
case 0x07: // DW_CFA_undefined
// Marks a single register as undefined. This is used to stop
// unwinding in tinygo_startTask using: