Skip to content

Commit

Permalink
Add ProtoBuf, fix 1.19 type parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Eckels committed Nov 16, 2022
1 parent 5eb0e53 commit 3e21179
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
75 changes: 75 additions & 0 deletions GoReSym.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
syntax = "proto3";
package GoReSym;
option go_package = "protobuf/GoReSym/";

message PcLnTabMetadata {
uint64 va = 1;
string version = 2;
string endianess = 3;
uint32 cpuQuantum = 4;
string cpuQuantumStr = 5;
uint32 pointerSize = 6;
}

message FuncMetadata {
uint64 start = 1;
uint64 end = 2;
string packageName = 3;
string fullName = 4;
}

message GoSlice {
uint64 data = 1;
uint64 len = 2;
uint64 capacity = 3;
}

message ModuleData {
uint64 va = 1;
uint64 types = 2;
uint64 etypes = 3;
GoSlice typeLinks = 4;
GoSlice itabLinks = 5;
GoSlice legacyTypes = 6;
}

message Type {
uint64 va = 1;
string str = 2;
string kind = 3;
string reconstructed = 4;
}

message Module {
string path = 1;
string version = 2;
string sum = 3;
}

message BuildSetting {
string key = 1;
string value = 2;
}

message BuildInfo {
string goVersion = 1;
string path = 2;
Module main = 3;
repeated Module deps = 4;
repeated BuildSetting settings = 5;
}

message ExtractMetadata {
string version = 1;
string buildId = 2;
string arch = 3;
string os = 4;
PcLnTabMetadata tabMeta = 5;
ModuleData moduleMeta = 6;
repeated Type types = 7;
repeated Type interfaces = 8;
BuildInfo buildInfo = 9;
repeated string files = 10;
repeated FuncMetadata userFunctions = 11;
repeated FuncMetadata stdFunctions = 12;
}
6 changes: 6 additions & 0 deletions objfile/objfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,8 @@ func (e *Entry) readRTypeName(runtimeVersion string, typeFlags tflag, namePtr ui
case "1.17":
fallthrough
case "1.18":
fallthrough
case "1.19":
varint_len, namelen, err := e.readVarint(namePtr + 1)
if err != nil {
return "", fmt.Errorf("Failed to read name")
Expand Down Expand Up @@ -943,6 +945,8 @@ func (e *Entry) ParseType_impl(runtimeVersion string, moduleData *ModuleData, ty
case "1.17":
fallthrough
case "1.18":
fallthrough
case "1.19":
if is64bit {
var rtype Rtype114_115_116_117_118_64
rtype_raw, err := e.raw.read_memory(typeAddress, uint64(unsafe.Sizeof(rtype)))
Expand Down Expand Up @@ -1321,6 +1325,8 @@ func (e *Entry) ParseType_impl(runtimeVersion string, moduleData *ModuleData, ty
case "1.17":
fallthrough
case "1.18":
fallthrough
case "1.19":
// type structType struct {
// rtype
// pkgPath name // pointer
Expand Down

0 comments on commit 3e21179

Please sign in to comment.