> On Apr 16, 2020, at 2:37 PM, Shafik Yaghmour via lldb-commits 
> <lldb-commits@lists.llvm.org> wrote:
> 
>> 
>> On Apr 16, 2020, at 2:04 PM, Jonas Devlieghere via lldb-commits 
>> <lldb-commits@lists.llvm.org> wrote:
>> 
>> 
>> Author: Jonas Devlieghere
>> Date: 2020-04-16T14:03:55-07:00
>> New Revision: 9f6a308457d1bfebf1cee94b0306e738f270e512
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/9f6a308457d1bfebf1cee94b0306e738f270e512
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/9f6a308457d1bfebf1cee94b0306e738f270e512.diff
>> 
>> LOG: [lldb/Utility] Fix a bug in stringify_append for printing addresses.
>> 
>> The recent change in the API macros revealed that we were not printing
>> the pointer address for a bunch of methods, but rather the address of
>> the pointer. It's something I had already noticed while looking at some
>> reproducer traces, but hadn't made it to the top of my list yet. This
>> fixes the issue by providing a more specific overload.
>> 
>> Added: 
>> 
>> 
>> Modified: 
>>   lldb/include/lldb/Utility/ReproducerInstrumentation.h
>> 
>> Removed: 
>> 
>> 
>> 
>> ################################################################################
>> diff  --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h 
>> b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
>> index 3728e19386d1..3b5dde3d2e2a 100644
>> --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h
>> +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
>> @@ -32,6 +32,11 @@ inline void stringify_append(llvm::raw_string_ostream 
>> &ss, const T &t) {
>>  ss << &t;
>> }
>> 
> 
> 
> Note you can use the narrower static_cast<void*>
> 

That would be wrong.

>> +template <typename T>
>> +inline void stringify_append(llvm::raw_string_ostream &ss, T *t) {
>> +  ss << reinterpret_cast<void *>(t);
>> +}
>> +
>> template <typename T>
>> inline void stringify_append(llvm::raw_string_ostream &ss, const T *t) {
>>  ss << reinterpret_cast<const void *>(t);
>> @@ -115,7 +120,7 @@ template <typename... Ts> inline std::string 
>> stringify_args(const Ts &... ts) {
>> 
>> #define LLDB_CONSTRUCT_(T, ...)                                              
>>   \
>>  lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION,               
>>  \
>> -                                          stringify_args(__VA_ARGS__));     
>>    \
>> +                                          stringify_args(this, 
>> __VA_ARGS__));  \
>>  if (lldb_private::repro::InstrumentationData _data =                        
>>  \
>>          LLDB_GET_INSTRUMENTATION_DATA()) {                                  
>>  \
>>    _recorder.Record(_data.GetSerializer(), _data.GetRegistry(),              
>>  \
>> 
>> 
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits>
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to