TApplencourt / metababel

YAML to Babeltrace 2 Component "compiler-compiler"
2 stars 2 forks source link

When pushing messages downtream we are not casting to the correct type #108

Closed DonAurelio closed 12 months ago

DonAurelio commented 1 year ago

cast_func = @cast_type ? "(#{self.class.instance_variable_get(:@bt_type)})" : '' is a dead line.

https://github.com/TApplencourt/metababel/blob/5999e715532185974ae334607c82f85a02c20a14/lib/metababel/bt2_trace_class_generator.rb#L444-L450

Possible solution

DonAurelio commented 1 year ago

Okay, I just realized that we can't cast to the @cast_type in get_setter since the user could cast to a non-babeltrace type, then we won't be able to set the field. We just need to remove the dead line.

TApplencourt commented 1 year ago

Yes, push message are more complicated. In theory, we should have the cast_type as input, and the cast to bt_type when calling the function. For struct -> string , we should do the memcopy trick