[llvm-bugs] [Bug 40827] New: lldb crashes on a file compiled with clang-3.8 at -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 22 15:34:28 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40827

            Bug ID: 40827
           Summary: lldb crashes on a file compiled with clang-3.8 at -O3
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: qrzhang at gatech.edu
                CC: llvm-bugs at lists.llvm.org

It affects the latest lldb trunk version.
It only happens with clang-3.8 at -O3. 4.0 and later versions work fine.

$ lldb-trunk -v
lldb version 9.0.0 (https://llvm.org/svn/llvm-project/lldb/trunk revision
354654)
  clang revision 354654
  llvm revision 354654

$ cat abc.c
char a;
int main() {
  int i;
  int b[] = {7, 7, 7};
  a = b[2];
  i = 0;
  for (; i < 5; i++)
    ;
  optimize_me_not();
}


$ cat outer.c
optimize_me_not() {}


$ cat cmds
b 9
r
p i
kill
q



$ clang-3.8 -O3 -g outer.c abc.c

$ lldb-trunk -s cmds -b a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) command source -s 0 'cmds'
Executing commands in '/home/absozero/projects/LLDB-testing/reduce/cmds'.
(lldb) b 9
Breakpoint 1: where = a.out`main + 10 at abc.c:9:3, address =
0x00000000004004aa
(lldb) r
a.out was compiled with optimization - stepping may behave oddly; variables may
not be available.
 #0 0x00005573e13b3d4a (lldb-trunk+0x25d4a)
 #1 0x00005573e13b2074 (lldb-trunk+0x24074)
 #2 0x00005573e13b21b2 (lldb-trunk+0x241b2)
 #3 0x00007f89a0687890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f8998b78c40 (/lib/x86_64-linux-gnu/libc.so.6+0x18ec40)
 #5 0x00007f899a6a6641 lldb_private::DataBufferHeap::CopyData(void const*,
unsigned long)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xd62641)
 #6 0x00007f899a4e94d7 lldb_private::DWARFExpression::CopyOpcodeData(unsigned
long, unsigned long, unsigned char)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xba54d7)
 #7 0x00007f899a9b8674
SymbolFileDWARF::ParseVariableDIE(lldb_private::SymbolContext const&, DWARFDIE
const&, unsigned long)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x1074674)
 #8 0x00007f899a9b93c4
SymbolFileDWARF::ParseVariables(lldb_private::SymbolContext const&, DWARFDIE
const&, unsigned long, bool, bool, lldb_private::VariableList*)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x10753c4)
 #9 0x00007f899a9ba150
SymbolFileDWARF::ParseVariablesForContext(lldb_private::SymbolContext const&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x1076150)
#10 0x00007f899a5a8e82
lldb_private::SymbolVendor::ParseVariablesForContext(lldb_private::SymbolContext
const&) (/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xc64e82)
#11 0x00007f899a56312e lldb_private::Block::GetBlockVariableList(bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xc1f12e)
#12 0x00007f899a450b14
lldb_private::FormatEntity::Format(lldb_private::FormatEntity::Entry const&,
lldb_private::Stream&, lldb_private::SymbolContext const*,
lldb_private::ExecutionContext const*, lldb_private::Address const*,
lldb_private::ValueObject*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb0cb14)
#13 0x00007f899a4500b1
lldb_private::FormatEntity::Format(lldb_private::FormatEntity::Entry const&,
lldb_private::Stream&, lldb_private::SymbolContext const*,
lldb_private::ExecutionContext const*, lldb_private::Address const*,
lldb_private::ValueObject*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb0c0b1)
#14 0x00007f899a4500b1
lldb_private::FormatEntity::Format(lldb_private::FormatEntity::Entry const&,
lldb_private::Stream&, lldb_private::SymbolContext const*,
lldb_private::ExecutionContext const*, lldb_private::Address const*,
lldb_private::ValueObject*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb0c0b1)
#15 0x00007f899a450167
lldb_private::FormatEntity::Format(lldb_private::FormatEntity::Entry const&,
lldb_private::Stream&, lldb_private::SymbolContext const*,
lldb_private::ExecutionContext const*, lldb_private::Address const*,
lldb_private::ValueObject*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb0c167)
#16 0x00007f899a626288
lldb_private::StackFrame::DumpUsingSettingsFormat(lldb_private::Stream*, bool,
char const*)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xce2288)
#17 0x00007f899a6265b0
lldb_private::StackFrame::GetStatus(lldb_private::Stream&, bool, bool, bool,
char const*)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xce25b0)
#18 0x00007f899a62d25a
lldb_private::StackFrameList::GetStatus(lldb_private::Stream&, unsigned int,
unsigned int, bool, unsigned int, bool, char const*)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xce925a)
#19 0x00007f899a65a0e0 lldb_private::Thread::GetStatus(lldb_private::Stream&,
unsigned int, unsigned int, unsigned int, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xd160e0)
#20 0x00007f899a60b960
lldb_private::Process::GetThreadStatus(lldb_private::Stream&, bool, unsigned
int, unsigned int, unsigned int, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xcc7960)
#21 0x00007f899a60c14f
lldb_private::Process::HandleProcessStateChangedEvent(std::shared_ptr<lldb_private::Event>
const&, lldb_private::Stream*, bool&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xcc814f)
#22 0x00007f899a60c3e0
lldb_private::Process::WaitForProcessToStop(lldb_private::Timeout<std::ratio<1l,
1000000l> > const&, std::shared_ptr<lldb_private::Event>*, bool,
std::shared_ptr<lldb_private::Listener>, lldb_private::Stream*, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xcc83e0)
#23 0x00007f899a64a549
lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&,
lldb_private::Stream*)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xd06549)
#24 0x00007f899bdb3f38
CommandObjectProcessLaunch::DoExecute(lldb_private::Args&,
lldb_private::CommandReturnObject&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x246ff38)
#25 0x00007f899a534279 lldb_private::CommandObjectParsed::Execute(char const*,
lldb_private::CommandReturnObject&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbf0279)
#26 0x00007f899a52deea lldb_private::CommandInterpreter::HandleCommand(char
const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&,
lldb_private::ExecutionContext*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbe9eea)
#27 0x00007f899a52f1a8
lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
>&) (/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbeb1a8)
#28 0x00007f899a4672c1 lldb_private::IOHandlerEditline::Run()
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb232c1)
#29 0x00007f899a43021f
lldb_private::Debugger::RunIOHandler(std::shared_ptr<lldb_private::IOHandler>
const&) (/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xaec21f)
#30 0x00007f899a523752
lldb_private::CommandInterpreter::HandleCommandsFromFile(lldb_private::FileSpec&,
lldb_private::ExecutionContext*, lldb_private::CommandInterpreterRunOptions&,
lldb_private::CommandReturnObject&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbdf752)
#31 0x00007f899bd70491
CommandObjectCommandsSource::DoExecute(lldb_private::Args&,
lldb_private::CommandReturnObject&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x242c491)
#32 0x00007f899a534279 lldb_private::CommandObjectParsed::Execute(char const*,
lldb_private::CommandReturnObject&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbf0279)
#33 0x00007f899a52deea lldb_private::CommandInterpreter::HandleCommand(char
const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&,
lldb_private::ExecutionContext*, bool, bool)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbe9eea)
#34 0x00007f899a52f1a8
lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
>&) (/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbeb1a8)
#35 0x00007f899a4672c1 lldb_private::IOHandlerEditline::Run()
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xb232c1)
#36 0x00007f899a42f0cb lldb_private::Debugger::ExecuteIOHandlers()
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xaeb0cb)
#37 0x00007f899a521a45
lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool,
lldb_private::CommandInterpreterRunOptions&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0xbdda45)
#38 0x00007f899a2982f0 lldb::SBDebugger::RunCommandInterpreter(bool, bool,
lldb::SBCommandInterpreterRunOptions&, int&, bool&, bool&)
(/home/absozero/trunk/root-clang/bin/../lib/liblldb.so.9svn+0x9542f0)
#39 0x00005573e1398fa5 (lldb-trunk+0xafa5)
#40 0x00005573e13966a9 (lldb-trunk+0x86a9)
#41 0x00007f8998a0bb97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#42 0x00005573e1397b1a (lldb-trunk+0x9b1a)
Stack dump:
0.      Program arguments: lldb-trunk -s cmds -b a.out
Segmentation fault (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190222/ce91d487/attachment.html>


More information about the llvm-bugs mailing list