[all-commits] [llvm/llvm-project] 633b00: [lldb] Fix PR52702 by fixing bool conversion of Ma...

PoYao Chang via All-commits all-commits at lists.llvm.org
Wed Dec 29 01:19:36 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 633b002944b966ddb64c85f4a8c017a858afb4fc
      https://github.com/llvm/llvm-project/commit/633b002944b966ddb64c85f4a8c017a858afb4fc
  Author: PoYao Chang <rZhBoYao at gmail.com>
  Date:   2021-12-29 (Wed, 29 Dec 2021)

  Changed paths:
    M lldb/include/lldb/Core/Mangled.h
    M lldb/source/Core/Mangled.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/unittests/Core/MangledTest.cpp

  Log Message:
  -----------
  [lldb] Fix PR52702 by fixing bool conversion of Mangled

Remove the Mangled::operator! and Mangled::operator void* where the
comments in header and implementation files disagree and replace them
with operator bool.

This fix PR52702 as https://reviews.llvm.org/D106837 used the buggy
Mangled::operator! in Symbol::SynthesizeNameIfNeeded. For example,
consider the symbol "puts" in a hello world C program:

// Inside Symbol::SynthesizeNameIfNeeded
(lldb) p m_mangled
(lldb_private::Mangled) $0 = (m_mangled = None, m_demangled = "puts")
(lldb) p !m_mangled
(bool) $1 = true          # should be false!!
This leads to Symbol::SynthesizeNameIfNeeded overwriting m_demangled
part of Mangled (in this case "puts").

In conclusion, this patch turns
callq  0x401030                  ; symbol stub for: ___lldb_unnamed_symbol36
back into
callq  0x401030                  ; symbol stub for: puts .

Differential Revision: https://reviews.llvm.org/D116217




More information about the All-commits mailing list