[Lldb-commits] [lldb] r227289 - Emit a warning the first time that one tries to resolve the size of a type passing a nullptr ExecutionContext - but only when it might actually make a difference

Enrico Granata egranata at apple.com
Tue Jan 27 21:59:21 PST 2015


I just realized that this code could skip doing all that heavyweight work when g_printed is already true. Will fix it up tomorrow!

Sent from my iPhone

> On Jan 27, 2015, at 5:41 PM, Enrico Granata <egranata at apple.com> wrote:
> 
> Author: enrico
> Date: Tue Jan 27 19:41:00 2015
> New Revision: 227289
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=227289&view=rev
> Log:
> Emit a warning the first time that one tries to resolve the size of a type passing a nullptr ExecutionContext - but only when it might actually make a difference
> 
> This should help us find these cases and act on them
> 
> 
> Modified:
>    lldb/trunk/source/Symbol/ClangASTType.cpp
> 
> Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=227289&r1=227288&r2=227289&view=diff
> ==============================================================================
> --- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
> +++ lldb/trunk/source/Symbol/ClangASTType.cpp Tue Jan 27 19:41:00 2015
> @@ -2081,6 +2081,20 @@ ClangASTType::GetBitSize (ExecutionConte
>                             return bit_size;
>                     }
>                 }
> +                else
> +                {
> +                    static bool g_printed = false;
> +                    StreamString s;
> +                    s.Printf("warning: trying to determine the size of type ");
> +                    DumpTypeDescription(&s);
> +                    s.Printf("\n without a valid ExecutionContext. this is not reliable. please file a bug against LLDB.\nbacktrace:\n");
> +                    Host::Backtrace(s, 10);
> +                    if (!g_printed)
> +                    {
> +                        printf("%s\n", s.GetData());
> +                        g_printed = true;
> +                    }
> +                }
>                 // fallthrough
>             default:
>                 const uint32_t bit_size = m_ast->getTypeSize (qual_type);
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list