<div dir="ltr">Hi,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 1:56 PM, Jim Ingham <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><br>
On Feb 22, 2013, at 1:51 PM, Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br>
<br></div><div class="im">
><br>
> Also, dealing with the arguments is going to be tricky.<br>
> Problems I can see at a glance:<br>
> - how do you deal with each SBValue while making the string? expression path? numeric value + a cast? neither way looks perfect at a glance<br>
<br>
</div>I don't think you would make up a string. You would implement this lower down than that, where we are directly populating the "arguments structure" that we are going to call, a la the Clang Functions. And by the time we get there, we would have the method signature, so we'd know how to interpret the SBValues from the input arguments.<br>
<div class="im"><br></div></blockquote><div style>Yes, bypassing the string building and just going for the clang AST or something.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">
> - for ObjC you need to also extract the “names of the arguments” (i.e. foo:arg1 bar:arg2 baz:arg3), while in C++ (arg1,arg2,arg3) is enough<br>
<br>
</div>Again, you would be consing up a call to objc_msgSend with the arguments passed directly, so that would not be an issue.<br>
<span class=""><font color="#888888"><br>
Jim<br>
</font></span><div class=""><div class="h5"><br></div></div></blockquote><div style>I think you could even bypass objc_msgSend (though I don't know what it does internally). You would get a reference to either a function, an ObjC method that implements a selector (is my nomenclature right? :-P), or a C++ method, and then just creating something close to an llvm call instruction (but going through clang first, to validate the call, perform any needed conversions, and lower the arguments).</div>
<div style><br></div><div style>Regards,</div><div style><br></div><div style> Filipe</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
<br>
><br>
> Of course, there are ways around these issues, but I am not sure this is useful enough to warrant the work required to get it right.<br>
><br>
> The data formatters need a much more constrained subset of this functionality, so they implement their own wrapper.<br>
> Any special subset should be trivial to implement, the general case looks tricky.<br>
><br>
> Enrico Granata<br>
> ✉ egranata@.com<br>
> ✆ 27683<br>
><br>
> On Feb 22, 2013, at 12:14 PM, Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br>
><br>
>> I'm not arguing for this, but you could do a fairly straightforward API like:<br>
>><br>
>> SBValue<br>
>> SBValue::CallMethod(const char *methodName, SBValueList arguments);<br>
>><br>
>> This would only work if the SBValue was a C++ or ObjC object. In the ObjC case "methodName" would be the selector, and the value list would have to be in parameter order.<br>
>><br>
>> I can see this being useful, though probably under the covers it would take some work to get it right...<br>
>><br>
>> Jim<br>
>><br>
>> On Feb 22, 2013, at 11:51 AM, Filipe Cabecinhas <<a href="mailto:filcab%2Blldb-dev@gmail.com">filcab+lldb-dev@gmail.com</a>> wrote:<br>
>><br>
>>> I also don't think it should be in the SB layer. There's lots of stuff to deal with (arguments and their types, variable arguments selectors/functions, etc). I think creating an expression is better (maybe we can use clang so one doesn't have to generate an expression string?).<br>
>>><br>
>>> Regards,<br>
>>><br>
>>> filipe<br>
>>><br>
>>><br>
>>> On Fri, Feb 22, 2013 at 10:23 AM, Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br>
>>> Currently, no.<br>
>>> You would have to craft your own expression and run it.<br>
>>><br>
>>> The C++ data formatters have their own helper functions to do so. You can refer to lldb_private::formatters::ExtractValueFromObjCExpression for an example.<br>
>>><br>
>>> I am not sure if this kind of API belongs in the SB layer. Ideas?<br>
>>><br>
>>> Enrico Granata<br>
>>> ✉ egranata@.com<br>
>>> ✆ 27683<br>
>>><br>
>>> On Feb 22, 2013, at 5:29 AM, Carlo Kok <<a href="mailto:ck@remobjects.com">ck@remobjects.com</a>> wrote:<br>
>>><br>
>>>> Does the api expose any way to execute an objc selector a given value (SBValue)? (for example I have an NSException instance in an SBValue, and want to call "name" on it).<br>
>>>><br>
>>>><br>
>>>> What about global (c) functions?<br>
>>>><br>
>>>><br>
>>>> If not the api, how can I do the equivalent with the underlying api?<br>
>>>><br>
>>>><br>
>>>> Thanks,<br>
>>>> --<br>
>>>><br>
>>>> Carlo Kok<br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> lldb-dev mailing list<br>
>>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>