0

I would like to know what would be the best way to map/represent the memory. I mean, how to describe, for example, a structure with all its field to be serialized.

I am creating a RPC library that will create the client and server using the dwarf debug data, so i need to create a function wrapper to serialize and deserialize the functions´s parameters.

Now, i am using the gcc mangling types to identify all the fields, but the compiler sometimes creates holes to optimize the memory access time;

DwarfDumpIDE

Any idea ?

1 Answers1

1

I use the "cereal" library for serialization (http://uscilab.github.io/cereal/)

Alternatives include Google's Protocol Buffers, although I found it too difficult to integrate for my comparably simple serialization tasks.

For communication between processes, and languages, I've had a good experience with ZeroC's ICE library (https://zeroc.com/products/ice). You specific the structure as an external compilation step similar to Google's Protocol Buffers. The nice part is that the network connect was also taken care off.

Mikhail
  • 7,749
  • 11
  • 62
  • 136
  • I am already serializing using CBOR library. I need only to represent the memory. Pointers, char, int, double, float, long etc. I am using the gcc mangling letters... – Marcelo Aleksandravicius Sep 26 '16 at 01:26
  • 2
    @MarceloAleksandravicius: A tangential word of caution: Never attempt to demangle untrusted data. The existing name mangling scheme is not robust against malicious use, and existing implementations are exploitable. – Kerrek SB Sep 26 '16 at 01:28
  • 1
    @MarceloAleksandravicius Your question isn't clear. You stated the problem was `the compiler sometimes creates holes` which can be solved by using a serialization library. – Mikhail Sep 26 '16 at 01:29
  • What did you mean about that ? Could you illustrate with an example ? – Marcelo Aleksandravicius Sep 26 '16 at 01:30
  • @Mikhail, I know it wasn´t clear. It is a small part (subsystem) of a IOT system. In small lines: I would like to define any method as a shared method and have it called as a RPC function. To do that, i need to create the stub and skeleton, after that serialize the parameters, send, execute the call, receive the resturn data, serialize it and return to the sender. So i need to represent the memory to easy the memory filling from the serialized data. – Marcelo Aleksandravicius Sep 26 '16 at 01:35
  • 1
    @MarceloAleksandravicius I think the entirety of the communication you described can be handled by ICE. – Mikhail Sep 26 '16 at 01:38