[Lldb-commits] [lldb] r226088 - Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got
Jason Molenda
jmolenda at apple.com
Wed Jan 14 21:24:06 PST 2015
I think the problem was that the code for LLDB_USE_BUILTIN_DEMANGLER used to be
char *demangled_name = FastDemangle (mangled_cstr,
m_mangled.GetLength());
if (!demangled_name)
demangled_name = __cxa_demangle (mangled_cstr, NULL, NULL, NULL);
if (demangled_name)
{
m_demangled.SetCStringWithMangledCounterpart(demangled_name, m_mangled);
free (demangled_name);
}
but with r226017 the code path for LLDB_USE_BUILTIN_DEMANGLER became
char *demangled_name = FastDemangle (mangled_cstr,
m_mangled.GetLength());
if (!demangled_name)
demangled_name = __cxa_demangle (mangled_cstr, NULL, NULL, NULL);
(i.e. m_demangled was never set)
J
> On Jan 14, 2015, at 7:40 PM, Zachary Turner <zturner at google.com> wrote:
>
> Err, was that code wrong? I malloc it unconditionally, so it should be freed unconditionally (don't have source in front of me, so I'm going from memory)
> On Wed, Jan 14, 2015 at 7:36 PM Jim Ingham <jingham at apple.com> wrote:
> Author: jingham
> Date: Wed Jan 14 21:34:31 2015
> New Revision: 226088
>
> URL: http://llvm.org/viewvc/llvm-project?rev=226088&view=rev
> Log:
> Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got
> moved into the #else branch of the #if/#elif/#endif, so it wasn't getting done in the #if case anymore.
>
> Keep the code to add the demangled name outside of the #if, and then just free the demangled_name
> and set it back to NULL in the Windows case.
>
> <rdar://problem/19479499>
>
> Modified:
> lldb/trunk/source/Core/Mangled.cpp
>
> Modified: lldb/trunk/source/Core/Mangled.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=226088&r1=226087&r2=226088&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/Mangled.cpp (original)
> +++ lldb/trunk/source/Core/Mangled.cpp Wed Jan 14 21:34:31 2015
> @@ -5240,18 +5240,20 @@ Mangled::GetDemangledName () const
> UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc specifiers
> UNDNAME_NO_MS_KEYWORDS // Strip all MS extension keywords
> );
> - if (result > 0)
> - m_demangled.SetCStringWithMangledCounterpart(demangled_name, m_mangled);
> - free(demangled_name);
> + if (result == 0)
> + {
> + free (demangled_name);
> + demangled_name = nullptr;
> + }
> #else
> char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
> +#endif
>
> if (demangled_name)
> {
> m_demangled.SetCStringWithMangledCounterpart(demangled_name, m_mangled);
> free (demangled_name);
> }
> -#endif
> }
> }
> if (!m_demangled)
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> _______________________________________________
> 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