Implement initial next implementation

This current implementation does not cover the following:

* Setting correct breakpoint when exiting loop
* Setting correct breakpoint when returning from function
    * All facilities are available for this, it just is not taken into
      account in the current `next` implementation.
This commit is contained in:
Derek Parker
2014-06-29 11:52:21 -05:00
parent ea335b3d7e
commit a788e03c7b
20 changed files with 886 additions and 272 deletions

37
dwarf/util/util_test.go Normal file
View File

@ -0,0 +1,37 @@
package util
import (
"bytes"
"testing"
)
func TestDecodeULEB128(t *testing.T) {
var leb128 = bytes.NewBuffer([]byte{0xE5, 0x8E, 0x26})
n, c := DecodeULEB128(leb128)
if n != 624485 {
t.Fatal("Number was not decoded properly, got: ", n, c)
}
if c != 3 {
t.Fatal("Count not returned correctly")
}
}
func TestDecodeSLEB128(t *testing.T) {
sleb128 := bytes.NewBuffer([]byte{0x9b, 0xf1, 0x59})
n, c := DecodeSLEB128(sleb128)
if n != -624485 {
t.Fatal("Number was not decoded properly, got: ", n, c)
}
}
func TestParseString(t *testing.T) {
bstr := bytes.NewBuffer([]byte{'h', 'i', 0x0, 0xFF, 0xCC})
str, _ := ParseString(bstr)
if str != "hi" {
t.Fatal("String was not parsed correctly")
}
}