augusto2112 wrote:

> Maybe I'm missing something. In the host case, m_address is set to invalid, 
> but m_value has the address in it and is a host address, so then we get to:
> 
> // m_address could be invalid but we could still have a local buffer // 
> containing the dynamic value. if ((m_address.IsValid() || 
> m_value.GetValueType() == Value::ValueType::HostAddress) && 
> m_dynamic_type_info) { // The variable value is in the Scalar value inside 
> the m_value. We can // point our m_data right to it. m_error = 
> m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
> 
> So that's going to try to call GetValueAsData on a value you've added the 
> dynamic type info to, and that type could be bigger than the static value, 
> causing us to read too much from the data buffer.

What I mean is `GetDynamicTypeAndAddress` will only return 
value_type=host_address and point address to that buffer if it knows that the 
dynamic type fits in that buffer. I'm implementing that downstream by comparing 
the static type size against the dynamic type size (since the buffer needs to 
fit the static size).

If you're still not comfortable to that I'm open to changing the API of 
`GetDynamicTypeAndAddress` to return a buffer or an address + size when it 
finds a host address.

https://github.com/llvm/llvm-project/pull/125143
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to