提交 0a3b4106 编写于 作者: D Derek Parker

FIX: Parse data alignment factor as SLEB128

上级 012c6e8c
......@@ -29,7 +29,7 @@ type CommonInformationEntry struct {
Version uint8
Augmentation string
CodeAlignmentFactor uint64
DataAlignmentFactor uint64
DataAlignmentFactor int64
ReturnAddressRegister byte
InitialInstructions []byte
FrameDescriptorEntries []*FrameDescriptorEntry
......@@ -237,7 +237,7 @@ func parseCodeAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
}
func parseDataAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
var daf, c = decodeULEB128(ctx.Buf)
var daf, c = decodeSLEB128(ctx.Buf)
ctx.Common.DataAlignmentFactor = daf
ctx.Length -= c
......
......@@ -83,8 +83,8 @@ func TestParse(t *testing.T) {
t.Fatal("Code Alignment Factor was not parsed correctly")
}
if ce.DataAlignmentFactor != 0x7c {
t.Fatal("Data Alignment Factor was not parsed correctly")
if ce.DataAlignmentFactor != -4 {
t.Fatalf("Data Alignment Factor was not parsed correctly got %#v", ce.DataAlignmentFactor)
}
fe := ce.FrameDescriptorEntries[0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册