> On Jul 14, 2020, at 3:13 PM, Vadim Chugunov via lldb-dev
> <[email protected]> wrote:
>
> Hi,
> I've a couple of questions:
>
> 1. Is there a way to get numeric values of C++ template parameters? SBType
> has a method for discovering argument kind and type, but I couldn't find
> anything for values.
You are correct, this isn't implemented. Any patches for adding this would be
great! A nice API might be:
class SBType {
SBValue GetTemplateArgumentValue(uint32_t idx);
};
We would need to use SBValue because the argument value can have any type
(bool, int, etc). It might also not have a value for non-numeric template
types, in which case a SBValue would be returned and if you ask it for its
error, it would return a SBError value with a suitable error message declaring
so.
>
> 2. Can I enumerate static variables of a class via SBType? (and read their
> values)
No, but this would be another nice addition to the interface. The interesting
issue here is a type declaration is not tied to a location for the variable.
Any SBModule could contain a type declaration that includes static variables,
but only one module might actually contain the actual values. So the API we add
will need to take a SBTarget. Something like:
class SBType {
SBValue GetClassVariable(SBTarget target, uint32_t idx);
};
If the target isn't valid, we can probably still return a SBValue that has the
name, type and kind that matches the global or static variable. You can ask the
SBValue fo:
ValueType SBValue::GetValueType();
Which would return eValueTypeVariableGlobal or eValueTypeVariableStatic. I
would guess eValueTypeVariableGlobal is the more correct value here as static
is a C++ terminology for a class global variable.
If the target is valid, then the code would need to try and locate the module
that actually contains this variable and find its address using the symbol
table or debug info and return the SBValue with everything set correctly.
So yes, neither of these are in the API, but would be great additions! We are
more than willing to help review any patches that make this happen.
Greg
>
> thanks!
> _______________________________________________
> lldb-dev mailing list
> [email protected]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
_______________________________________________
lldb-dev mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev