I have a coredump with encoded protobuf data and I want to decode this data and see the content. I have the .proto file which defines this message in raw protocol buffer. My proto file looks like this:
$ cat my.proto
message header {
required uint32 u1 = 1;
required uint32 u2 = 2;
optional uint32 u3 = 3 [default=0];
optional bool b1 = 4 [default=true];
optional string s1 = 5;
optional uint32 u4 = 6;
optional uint32 u5 = 7;
optional string s2 = 9;
optional string s3 = 10;
optional uint32 u6 = 8;
}
And protoc version:
$ protoc --version
libprotoc 2.3.0
I have tried the following:
Dump the raw data from the core
(gdb) dump memory b.bin 0x7fd70db7e964 0x7fd70db7e96d
Pass it to protoc
//proto file (my.proto) is in the current dir
$ protoc --decode --proto_path=$pwd my.proto < b.bin
Missing value for flag: --decode
To decode an unknown message, use --decode_raw.
$ protoc --decode_raw < /tmp/b.bin
Failed to parse input.
Any thoughts on how to decode it? The documentation doesn’t explain much on how to go about it.
Edit: Data in binary format (10 bytes)
(gdb) x/10xb 0x7fd70db7e964
0x7fd70db7e964: 0x08 0xff 0xff 0x01 0x10 0x08 0x40 0xf7
0x7fd70db7e96c: 0xd4 0x38