mirror of
https://github.com/go-delve/delve.git
synced 2025-11-03 13:57:33 +08:00
Don't export ULEB128 decode func
This commit is contained in:
@ -94,9 +94,9 @@ func Parse(data []byte) CommonEntries {
|
|||||||
return pctx.Entries
|
return pctx.Entries
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeLEB128 decodes a Little Endian Base 128
|
// decodeULEB128 decodes a Little Endian Base 128
|
||||||
// represented number.
|
// represented number.
|
||||||
func DecodeLEB128(reader *bytes.Buffer) (uint64, uint32) {
|
func decodeULEB128(reader *bytes.Buffer) (uint64, uint32) {
|
||||||
var (
|
var (
|
||||||
result uint64
|
result uint64
|
||||||
shift uint64
|
shift uint64
|
||||||
@ -196,7 +196,7 @@ func parseAugmentation(ctx *parseContext) (parsefunc, *parseContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseCodeAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
|
func parseCodeAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
|
||||||
var caf, c = DecodeLEB128(ctx.Buf)
|
var caf, c = decodeULEB128(ctx.Buf)
|
||||||
|
|
||||||
ctx.Common.CodeAlignmentFactor = caf
|
ctx.Common.CodeAlignmentFactor = caf
|
||||||
ctx.Length -= c
|
ctx.Length -= c
|
||||||
@ -205,7 +205,7 @@ func parseCodeAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseDataAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
|
func parseDataAlignmentFactor(ctx *parseContext) (parsefunc, *parseContext) {
|
||||||
var daf, c = DecodeLEB128(ctx.Buf)
|
var daf, c = decodeULEB128(ctx.Buf)
|
||||||
|
|
||||||
ctx.Common.DataAlignmentFactor = daf
|
ctx.Common.DataAlignmentFactor = daf
|
||||||
ctx.Length -= c
|
ctx.Length -= c
|
||||||
|
|||||||
@ -32,10 +32,10 @@ func grabDebugFrameSection(fp string, t *testing.T) []byte {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDecodeLEB128(t *testing.T) {
|
func TestdecodeULEB128(t *testing.T) {
|
||||||
var leb128 = bytes.NewBuffer([]byte{0xE5, 0x8E, 0x26})
|
var leb128 = bytes.NewBuffer([]byte{0xE5, 0x8E, 0x26})
|
||||||
|
|
||||||
n, c := DecodeLEB128(leb128)
|
n, c := decodeULEB128(leb128)
|
||||||
if n != 624485 {
|
if n != 624485 {
|
||||||
t.Fatal("Number was not decoded properly, got: ", n, c)
|
t.Fatal("Number was not decoded properly, got: ", n, c)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user