[Lldb-commits] [lldb] [lldb] Extend frame recognizers to hide frames from backtraces (PR #104523)

Dmitri Gribenko via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 04:13:41 PDT 2024


gribozavr wrote:

@adrian-prantl I'm going to revert this PR because it fails msan due to uninitialized variables.

Specifically, `StackFrame::m_frame_recognizer_generation` and `StackFrameRecognizerManager::m_generation` are never initialized.

Sample msan failure on `lldb/test/Shell/Unwind/eh-frame-small-fde`:

```
==4576==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5579999c5364 in lldb_private::StackFrame::GetRecognizedFrame() third_party/llvm/llvm-project/lldb/source/Target/StackFrame.cpp:1986:7
    #1 0x5579999d24e7 in lldb_private::StackFrameList::SelectMostRelevantFrame() third_party/llvm/llvm-project/lldb/source/Target/StackFrameList.cpp:817:58
    #2 0x5579999d2ba2 in lldb_private::StackFrameList::GetSelectedFrameIndex(SelectMostRelevant) third_party/llvm/llvm-project/lldb/source/Target/StackFrameList.cpp:838:5
    #3 0x55799920ee11 in lldb_private::Thread::GetSelectedFrameIndex(SelectMostRelevant) third_party/llvm/llvm-project/lldb/include/lldb/Target/Thread.h:445:33
    #4 0x557999971af0 in lldb_private::Process::HandleProcessStateChangedEvent(std::__msan::shared_ptr<lldb_private::Event> const&, lldb_private::Stream*, SelectMostRelevant, bool&) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:939:26
    #5 0x55799997025d in lldb_private::Process::WaitForProcessToStop(lldb_private::Timeout<std::__msan::ratio<1l, 1000000l>> const&, std::__msan::shared_ptr<lldb_private::Event>*, bool, std::__msan::shared_ptr<lldb_private::Listener>, lldb_private::Stream*, bool, SelectMostRelevant) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:722:5
    #6 0x55799997676f in lldb_private::Process::ResumeSynchronous(lldb_private::Stream*) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:1415:9
    #7 0x557999a198e1 in lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::Stream*) third_party/llvm/llvm-project/lldb/source/Target/Target.cpp:3339:21
    #8 0x557999274a55 in CommandObjectProcessLaunch::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp:236:28
    #9 0x55799933f44c in lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandObject.cpp:835:9
    #10 0x55799916d868 in lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, bool) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2071:14
    #11 0x557999176120 in lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string<char, std::__msan::char_traits<char>, std::__msan::allocator<char>>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3167:3
    #12 0x55799917656c in non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string<char, std::__msan::char_traits<char>, std::__msan::allocat
or<char>>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp
    #13 0x55799902338c in lldb_private::IOHandlerEditline::Run() third_party/llvm/llvm-project/lldb/source/Core/IOHandler.cpp:600:22
    #14 0x557998fdbbff in lldb_private::Debugger::RunIOHandlerSync(std::__msan::shared_ptr<lldb_private::IOHandler> const&) third_party/llvm/llvm-project/lldb/source/Core/Debugger.cpp:1131:20
    #15 0x5579991715f9 in lldb_private::CommandInterpreter::HandleCommandsFromFile(lldb_private::FileSpec&, lldb_private::CommandInterpreterRunOptions const&, lldb_private::CommandReturnObject&) third_party/llvm/ll
vm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2853:12
    #16 0x5579991ab51e in CommandObjectCommandsSource::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp:169:19
    #17 0x55799933f44c in lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandObject.cpp:835:9
    #18 0x55799916d868 in lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, bool) third_party/llvm/llvm-project/lldb/source/Interpreter/Command
Interpreter.cpp:2071:14
    #19 0x557999176120 in lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string<char, std::__msan::char_traits<char>, std::__msan::allocator<char>>&) third_par
ty/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3167:3
    #20 0x55799917656c in non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string<char, std::__msan::char_traits<char>, std::__msan::allocat
or<char>>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp
    #21 0x55799902338c in lldb_private::IOHandlerEditline::Run() third_party/llvm/llvm-project/lldb/source/Core/IOHandler.cpp:600:22
    #22 0x557998fdb7d6 in lldb_private::Debugger::RunIOHandlers() third_party/llvm/llvm-project/lldb/source/Core/Debugger.cpp:1105:16
    #23 0x5579991788cd in lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInterpreterRunOptions&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3433:16
    #24 0x557997f8bae9 in lldb::SBDebugger::RunCommandInterpreter(lldb::SBCommandInterpreterRunOptions const&) third_party/llvm/llvm-project/lldb/source/API/SBDebugger.cpp:1291:14
    #25 0x557997f4d89a in Driver::MainLoop() third_party/llvm/llvm-project/lldb/tools/driver/Driver.cpp:558:20
    #26 0x557997f4eed5 in main third_party/llvm/llvm-project/lldb/tools/driver/Driver.cpp:807:26
    #27 0x7f5d2d3983d3 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x613d3) (BuildId: 9a996398ce14a94560b0c642eb4f6e94)
    #28 0x557997ebfbe9 in _start /usr/grte/v5/debug-src/src/csu/../sysdeps/x86_64/start.S:120
```

When re-landing please also take into account the fixup that I committed yesteray: https://github.com/llvm/llvm-project/commit/65281570afd7e35e01533b07c6c2937de410fc52

https://github.com/llvm/llvm-project/pull/104523


More information about the lldb-commits mailing list