<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 9 Apr 2019 at 04:36, Milian Wolff <<a href="mailto:milian.wolff@kdab.com" target="_blank">milian.wolff@kdab.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thursday, April 4, 2019 8:25:51 PM CEST Jérémie Galarneau wrote:<br>
> Hi Milian,<br>
> <br>
> I have pushed a fix [1] in the stable-1.5 branch that addresses the<br>
> issue you have encountered with using bt_ctf_get_field_list().<br>
> This makes it possible to consume a character sequence's content.<br>
> <br>
> The commit message contains an example to show how to essentially<br>
> perform what the 'ctf-text' format plug-in achieves by accessing the<br>
> internal string field.<br>
> <br>
> Let me know if that works for you and I'll release an updated version<br>
> of the 1.5 branch.<br>
<br>
Thank you, I'll try that out in the next days!<br>
<br>
But: why can't we make bt_ctf_get_string return the string for us? Why do we <br>
need to reinvent the wheel in consumers of the babeltrace API? You point out <br>
</blockquote><div><br></div><div><div></div><div>Hi,<br></div><br><div class="gmail_quote"><div>Strings, sequences and arrays are three different types in CTF.</div><div><br></div><div>bt_ctf_get_string() can only be used on CTF strings. In the babeltrace 1.x</div><div>API, those are expressed through 'bt_definition's that have a 'bt_declaration'</div><div>of type CTF_TYPE_STRING. It is not a general-purpose accessor to get</div><div>a field's content as a C-string.</div><div><br></div><div>Changing this in the 1.x release series goes against the design of the</div><div>API (dedicated functions per definition type) and would, arguably, be an</div><div>ABI breaking change.<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div>As pointed out in the commit message, bt_ctf_get_char_array() is</div><div>a convenience function to access a character-array's contents as</div><div>a C-string. An equivalent function could be added for sequences.</div><div><br></div><div><div>Since you pointed-out a bug in the existing API, my priority was</div><div>in fixing that bug which prevented users from accessing the sequences'</div><div>contents at all in the "looks like a string" case. That fix can be</div><div>back-ported into existing releases and made available in a point-release.</div><div><br></div><div>Adding new APIs is an orthogonal concern. I'm not against a</div><div>convenience function that does what you want; but it won't be</div><div>shoe-horned into an existing one.</div></div><div><br></div><div>Jérémie<br></div><div><br></div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Cheers<br>
</blockquote></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">that it's non-trivial to get the strings decoded properly, so I'd really <br>
appreciate if we get that code implemented once and then can leverage it <br>
everywhere.<br></blockquote><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Generally, I don't understand why there's both, bt_ctf_get_string and <br>
bt_ctf_get_char_array in the first place....<br></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-- <br>
Milian Wolff | <a href="mailto:milian.wolff@kdab.com" target="_blank">milian.wolff@kdab.com</a> | Senior Software Engineer<br>
KDAB (Deutschland) GmbH, a KDAB Group company<br>
Tel: +49-30-521325470<br>
KDAB - The Qt, C++ and OpenGL Experts</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_-777251763788995089gmail_signature">Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div></div>