[Lldb-commits] [lldb] r343726 - Fix buildbot regression by rL339929: NameError: global name 'test_directory' is not defined

2018-10-03 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Oct  3 14:42:54 2018
New Revision: 343726

URL: http://llvm.org/viewvc/llvm-project?rev=343726&view=rev
Log:
Fix buildbot regression by rL339929: NameError: global name 'test_directory' is 
not defined

With buildbot slave under test - I get after rL339929:
http://lab.llvm.org:8014/builders/lldb-x86_64-fedora-28-cmake/builds/243/steps/test1/logs/stdio

  File 
"/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/scripts/../llvm/tools/lldb/test/dotest.py",
 line 7, in 
lldbsuite.test.run_suite()
  File 
"/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dotest.py",
 line 1177, in run_suite
configuration.results_formatter_object)
  File 
"/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dosep.py",
 line 1692, in main
dst = core.replace(test_directory, "")[1:]
NameError: global name 'test_directory' is not defined

Patch by Vedant Kumar.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dosep.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=343726&r1=343725&r2=343726&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Wed Oct  3 14:42:54 2018
@@ -1689,7 +1689,7 @@ def main(num_threads, test_runner_name,
 # move core files into session dir
 cores = find('core.*', test_subdir)
 for core in cores:
-dst = core.replace(test_directory, "")[1:]
+dst = core.replace(test_subdir, "")[1:]
 dst = dst.replace(os.path.sep, "-")
 os.rename(core, os.path.join(session_dir, dst))
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D46810: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-10-14 Thread Jan Kratochvil via lldb-commits
On Thu, 27 Sep 2018 18:21:13 +0200, Greg Clayton via lldb-commits wrote:
> One fix that would work it to make the DWARFDebugInfoEntry* inside the 
> DWARFDie to be mutable and allow it to "fix" itself when a call is made. So 
> the flow would be:
> 
> auto CUDie = cu->GetUnitDIEOnly();
> for (auto child = CUDie.GetFirstChild(); 
> 
> The call to DWARFDie::GetFirstChild() would replace "DWARFDebugInfoEntry 
> *m_die" with the correct version by tracking if m_die is just the unit die 
> only by making "DWARFDebugInfoEntry *m_die" into a llvm::PointerIntPair:
> 
> PointerIntPair< DWARFDebugInfoEntry *, 1> m_die;
> 
> 
> We set the bit to 1 if m_die is just the unit DIE. Then we have an accessor 
> on DWARFDie that can promote m_die to the full version if needed:
> 
> void DWARFDie::PromoteIfNeeded() {
>   if (m_die.getInt()) {
> m_die.setPointer(m_cu->DIEPtr());
> m_die.setInt(false);
>   }
> }

Thanks for the mail but I believe this issue has been already fixed by:
  2/3: Use DWARFBaseDIE as compile-time protection
  https://reviews.llvm.org/D47276

The assertion-regression of this commit is unrelated to stale pointers.
And it has been addressed by now filed:
  Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), 
function ExtractDIEsRWLocked
  https://reviews.llvm.org/D53255

Or do I miss something?


Thanks,
Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344605 - Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), function ExtractDIEsRWLocked

2018-10-16 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Oct 16 04:38:22 2018
New Revision: 344605

URL: http://llvm.org/viewvc/llvm-project?rev=344605&view=rev
Log:
Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), 
function ExtractDIEsRWLocked

xbolva00 bugreported $subj in: https://reviews.llvm.org/D46810#1247410
It can happen only from the line:
m_die_array.back().SetEmptyChildren(true);

In the case DW_TAG_compile_unit has DW_CHILDREN_yes but there is only 0 (end of
list, no children present). Therefore the assertion can fortunately happen only
with a hand-crafted DWARF or with DWARF from some suboptimal compilers.

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=344605&r1=344604&r2=344605&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue Oct 16 
04:38:22 2018
@@ -261,7 +261,11 @@ void DWARFUnit::ExtractDIEsRWLocked() {
   }
 
   if (!m_die_array.empty()) {
-lldbassert(!m_first_die || m_first_die == m_die_array.front());
+if (m_first_die) {
+  // Only needed for the assertion.
+  m_first_die.SetEmptyChildren(m_die_array.front().GetEmptyChildren());
+  lldbassert(m_first_die == m_die_array.front());
+}
 m_first_die = m_die_array.front();
   }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r344644 - Code cleanup: Remove DWARFDebugInfoEntry::m_empty_children

2018-10-16 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Oct 16 13:49:15 2018
New Revision: 344644

URL: http://llvm.org/viewvc/llvm-project?rev=344644&view=rev
Log:
Code cleanup: Remove DWARFDebugInfoEntry::m_empty_children

It merges DWARFDebugInfoEntry's m_empty_children into m_has_children.
m_empty_children was implemented by rL144983.

As Greg confirmed m_has_children was used to represent what was in the DWARF in
the byte that follows the DW_TAG. m_empty_children was used for DIEs that said
they had children but actually only contain a single NULL tag. It is fine to
not differentiate between the two.

Also changed assert()->lldbassert() for m_abbr_idx 16-bit overflow check as
that could be a tough bug to catch if it ever happens.

I have checked all calls of HasChildren() that this change should not matter to
them. The code even wants to know if there are any children - it does not
matter how the children presence is coded in the binary.

Patch written based on suggestions by Greg Clayton.

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=344644&r1=344643&r2=344644&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Oct 
16 13:49:15 2018
@@ -40,9 +40,8 @@ bool DWARFDebugInfoEntry::FastExtract(
   m_offset = *offset_ptr;
   m_parent_idx = 0;
   m_sibling_idx = 0;
-  m_empty_children = false;
   const uint64_t abbr_idx = debug_info_data.GetULEB128(offset_ptr);
-  assert(abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
+  lldbassert(abbr_idx <= UINT16_MAX);
   m_abbr_idx = abbr_idx;
 
   // assert (fixed_form_sizes);  // For best performance this should be
@@ -220,7 +219,7 @@ bool DWARFDebugInfoEntry::Extract(Symbol
 m_offset = offset;
 
 const uint64_t abbr_idx = debug_info_data.GetULEB128(&offset);
-assert(abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
+lldbassert(abbr_idx <= UINT16_MAX);
 m_abbr_idx = abbr_idx;
 if (abbr_idx) {
   const DWARFAbbreviationDeclaration *abbrevDecl =
@@ -1836,7 +1835,6 @@ void DWARFDebugInfoEntry::DumpDIECollect
 bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
   return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
  m_sibling_idx == rhs.m_sibling_idx &&
- m_empty_children == rhs.m_empty_children &&
  m_abbr_idx == rhs.m_abbr_idx && m_has_children == rhs.m_has_children 
&&
  m_tag == rhs.m_tag;
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=344644&r1=344643&r2=344644&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue Oct 16 
13:49:15 2018
@@ -43,7 +43,6 @@ typedef UInt32ToDIEMMap::const_iterator
 class DWARFDeclContext;
 
 #define DIE_SIBLING_IDX_BITSIZE 31
-#define DIE_ABBR_IDX_BITSIZE 15
 
 class DWARFDebugInfoEntry {
 public:
@@ -57,8 +56,7 @@ public:
 
   DWARFDebugInfoEntry()
   : m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0),
-m_empty_children(false), m_abbr_idx(0), m_has_children(false),
-m_tag(0) {}
+m_has_children(false), m_abbr_idx(0), m_tag(0) {}
 
   explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; }
   bool operator==(const DWARFDebugInfoEntry &rhs) const;
@@ -227,10 +225,10 @@ public:
   // we don't need to store our child pointer, if we have a child it will
   // be the next entry in the list...
   DWARFDebugInfoEntry *GetFirstChild() {
-return (HasChildren() && !m_empty_children) ? this + 1 : NULL;
+return HasChildren() ? this + 1 : NULL;
   }
   const DWARFDebugInfoEntry *GetFirstChild() const {
-return (HasChildren() && !m_empty_children) ? this + 1 : NULL;
+return HasChildren() ? this + 1 : NULL;
   }
 
   void GetDeclContextDIEs(DWARFUnit *cu,
@@ -271,10 +269,6 @@ public:
 
   void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
 
-  bool GetEmptyChildren() const { return m_empty_children; }
-
-  void SetEmptyChildren(bool b) { m_empty_children = b; }
-
   static void
   DumpDIECollection(lldb_private::Stream &strm,
 DWARFDebugInfoEntry::collection &die_collection);
@@ -285,13 +279,13 @@ protected:
   uint32_t m_parent_idx; // How many to subtract from "this" 

[Lldb-commits] [lldb] r346089 - Fix duplicate testcase filename

2018-11-03 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sat Nov  3 23:13:09 2018
New Revision: 346089

URL: http://llvm.org/viewvc/llvm-project?rev=346089&view=rev
Log:
Fix duplicate testcase filename

dotest.py started reporting:
Exception: Found multiple tests with the name TestSampleTest.py
After the commit of:
https://reviews.llvm.org/D54056

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py
  - copied unchanged from r346088, 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py
Removed:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py?rev=346088&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py
 (removed)
@@ -1,94 +0,0 @@
-"""
-Test that --allow-jit=false does disallow JITting:
-"""
-
-from __future__ import print_function
-
-
-import os
-import time
-import re
-import lldb
-import lldbsuite.test.lldbutil as lldbutil
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test.decorators import *
-
-class TestAllowJIT(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-# If your test case doesn't stress debug info, the
-# set this to true.  That way it won't be run once for
-# each debug info format.
-NO_DEBUG_INFO_TESTCASE = True
-
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
-def test_allow_jit_expr_command(self):
-"""Test the --allow-jit command line flag"""
-self.build()
-self.main_source_file = lldb.SBFileSpec("main.c")
-self.expr_cmd_test()
-
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
-def test_allow_jit_options(self):
-"""Test the SetAllowJIT SBExpressionOption setting"""
-self.build()
-self.main_source_file = lldb.SBFileSpec("main.c")
-self.expr_options_test()
-
-
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-
-def expr_cmd_test(self):
-(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
-   "Set a breakpoint here", 
self.main_source_file)
-
-frame = thread.GetFrameAtIndex(0)
-
-# First make sure we can call the function with 
-interp = self.dbg.GetCommandInterpreter()
-self.expect("expr --allow-jit 1 -- call_me(10)",
-substrs = ["(int) $", "= 18"])
-# Now make sure it fails with the "can't IR interpret message" if 
allow-jit is false:
-self.expect("expr --allow-jit 0 -- call_me(10)",
-error=True,
-substrs = ["Can't run the expression locally"])
-
-def expr_options_test(self):
-(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
-   "Set a breakpoint here", 
self.main_source_file)
-
-frame = thread.GetFrameAtIndex(0)
-
-# First make sure we can call the function with the default option 
set. 
-options = lldb.SBExpressionOptions()
-# Check that the default is to allow JIT:
-self.assertEqual(options.GetAllowJIT(), True, "Default is true")
-
-# Now use the options:
-result = frame.EvaluateExpression("call_me(10)", options)
-self.assertTrue(result.GetError().Success(), "expression succeeded")
-self.assertEqual(result.GetValueAsSigned(), 18, "got the right value.")
-
-# Now disallow JIT and make sure it fails:
-options.SetAllowJIT(False)
-# Check that we got the right value:
-self.assertEqual(options.GetAllowJIT(), False, "Got False after 
setting to False")
-
-# Again use it and ensure we fail:
-result = frame.EvaluateExpression("call_me(10)", options)
-self.assertTrue(result.GetError().Fail(), "expression failed with no 
JIT")
-self.assertTrue("Can't run the expression locally" in 
result.GetError().GetCString(), "Got right error")
-
-# Finally set the allow JIT value back to true and make sure that 
works:
-options.SetAllowJIT(True)
-self.assertEqual(options.GetAllowJIT(), True, "Set back to True 
correctly")
-
-# And again, make sure this works:
-result = frame.EvaluateExpression("call_me(10)", options)
-self.assertTrue(result.GetError().Success(), "expression succeeded")
-self.assertEqual(result.GetValueAsSigned(), 18, "got 

[Lldb-commits] [lldb] r349607 - refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Dec 19 00:57:10 2018
New Revision: 349607

URL: http://llvm.org/viewvc/llvm-project?rev=349607&view=rev
Log:
refactor testsuite spawnLldbMi args->exe+args

Currently spawnLldbMi accepts both lldb-mi options and executable to debug as
a single parameter. Split them.

As in D55859 we will need to execute one lldb-mi command before loading the
exe. Therefore we can no longer use the exe as lldb-mi command-line parameter
as then there is no way to execute a command before loading exe specified as
lldb-mi command-line parameter.

LocateExecutableSymbolFileDsym should be static, that is also a little
refactorization.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
lldb/trunk/source/Host/common/Symbols.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=349607&r1=349606&r2=349607&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
Wed Dec 19 00:57:10 2018
@@ -40,7 +40,7 @@ class MiTestCaseBase(Base):
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, args=None):
+def spawnLldbMi(self, exe=None, args=None):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@ class MiTestCaseBase(Base):
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if exe:
+self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
+# Testcases expect to be able to match output of this command,
+# see test_lldbmi_specialchars.
 
 def runCmd(self, cmd):
 self.child.sendline(cmd)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=349607&r1=349606&r2=349607&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 Wed Dec 19 00:57:10 2018
@@ -22,7 +22,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 def test_lldbmi_executable_option_file(self):
 """Test that 'lldb-mi --interpreter %s' loads executable file."""
 
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -52,7 +52,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 # Prepare path to executable
 path = "unknown_file"
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when unknown file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % path)
@@ -71,7 +71,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 """Test that 'lldb-mi --interpreter %s' loads executable which is 
specified via absolute path."""
 
 # Prepare path to executable
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified using
 # absolute path
@@ -95,7 +95,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 
 # Prepare path to executable
 path = os.path.relpath(self.myexe, self.getBuildDir())
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable is loaded when file was specified using
 # relative path
@@ -119,7 +119,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 # Prepare path to executable
 path = "unknown_dir" + self.myexe
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when file was specified using
 # unknown path
@@ -259,7 +259,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 """Test that 'lldb-mi --log' creates a log file in the current 
directory."""
 

[Lldb-commits] [lldb] r350368 - symbols.enable-external-lookup=false on all hosts (not just OSX)

2019-01-03 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu Jan  3 15:11:06 2019
New Revision: 350368

URL: http://llvm.org/viewvc/llvm-project?rev=350368&view=rev
Log:
symbols.enable-external-lookup=false on all hosts (not just OSX)

There is already in use:
lit/lit-lldb-init:
settings set symbols.enable-external-lookup false
packages/Python/lldbsuite/test/lldbtest.py:
self.runCmd('settings set symbols.enable-external-lookup false')

But those are not in effect during MI part of the testsuite. Another problem is
that symbols.enable-external-lookup (read by GetEnableExternalLookup) has been
currently read only by LocateMacOSXFilesUsingDebugSymbols and therefore it had
no effect on Linux.

On Red Hat platforms (Fedoras, RHEL-7) there is DWZ in use and so
MiSyntaxTestCase-test_lldbmi_output_grammar FAILs due to:
AssertionError: error: inconsistent pattern ''^.+?\n'' for state 0x5f
(matched string: warning: (x86_64) /lib64/libstdc++.so.6 unsupported
DW_FORM values: 0x1f20 0x1f21
It is the only testcase with this error. It happens due to:
(lldb) target create "/lib64/libstdc++.so.6"
Current executable set to '/lib64/libstdc++.so.6' (x86_64).
(lldb) b main
warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM values: 
0x1f20 0x1f21
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
which happens only with gcc-base-debuginfo rpm installed (similarly for other 
packages).

It should also speed up the testsuite as it no longer needs to read
/usr/lib/debug symbols which have no effect (and should not have any effect) on
the testsuite results.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Target/Target.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=350368&r1=350367&r2=350368&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
Thu Jan  3 15:11:06 2019
@@ -40,7 +40,7 @@ class MiTestCaseBase(Base):
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, exe=None, args=None):
+def spawnLldbMi(self, exe=None, args=None, preconfig=True):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@ class MiTestCaseBase(Base):
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if preconfig:
+self.runCmd("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
+self.expect(self.child_prompt, exactly=True)
 if exe:
 self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
 # Testcases expect to be able to match output of this command,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=350368&r1=350367&r2=350368&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 Thu Jan  3 15:11:06 2019
@@ -237,7 +237,11 @@ class MiStartupOptionsTestCase(lldbmi_te
 
 # Prepared source file
 sourceFile = self.copyScript("start_script_error")
-self.spawnLldbMi(args="--source %s" % sourceFile)
+self.spawnLldbMi(args="--source %s" % sourceFile, preconfig=False)
+
+# After 'settings set symbols.enable-external-lookup false'
+self.expect("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
 
 # After '-file-exec-and-symbols a.out'
 self.expect("-file-exec-and-symbols %s" % self.myexe)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages

[Lldb-commits] [lldb] r350479 - Fix symbols.enable-external-lookup description wording

2019-01-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sat Jan  5 13:39:03 2019
New Revision: 350479

URL: http://llvm.org/viewvc/llvm-project?rev=350479&view=rev
Log:
Fix symbols.enable-external-lookup description wording

D55859 changed "external tools or libraries" to "external sources" according to
Pavel Labath.  Now it is changed sort of back to "external tools and
repositories" according to Adrian Prantl.
https://reviews.llvm.org/D55859#1345881

Modified:
lldb/trunk/source/Core/ModuleList.cpp

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=350479&r1=350478&r2=350479&view=diff
==
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Sat Jan  5 13:39:03 2019
@@ -69,10 +69,10 @@ namespace {
 static constexpr PropertyDefinition g_properties[] = {
 {"enable-external-lookup", OptionValue::eTypeBoolean, true, true, nullptr,
  {},
- "Control the use of external sources to locate symbol files. "
- "Directories listed in target.debug-file-search-paths and directory of "
- "the executable are always checked first for separate debug info files. "
- "Then depending on this setting: "
+ "Control the use of external tools and repositories to locate symbol "
+ "files. Directories listed in target.debug-file-search-paths and "
+ "directory of the executable are always checked first for separate debug "
+ "info files. Then depending on this setting: "
  "On macOS, Spotlight would be also used to locate a matching .dSYM "
  "bundle based on the UUID of the executable. "
  "On NetBSD, directory /usr/libdata/debug would be also searched. "


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r332200 - Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"

2018-05-13 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun May 13 11:38:28 2018
New Revision: 332200

URL: http://llvm.org/viewvc/llvm-project?rev=332200&view=rev
Log:
Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"

Pavel Labath found this patch is incomplete and racy.  I think there needs to
be some more mutexes even before considering DW_TAG_partial_unit.

This reverts commit 331229 which was: https://reviews.llvm.org/D40470

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=332200&r1=332199&r2=332200&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Sun May 13 
11:38:28 2018
@@ -41,20 +41,9 @@ DWARFUnit::~DWARFUnit() {}
 // Parses a compile unit and indexes its DIEs if it hasn't already been done.
 //--
 size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
-  size_t initial_die_array_size;
-  auto already_parsed = [cu_die_only, &initial_die_array_size, this]() -> bool 
{
-initial_die_array_size = m_die_array.size();
-return (cu_die_only && initial_die_array_size > 0)
-|| initial_die_array_size > 1;
-  };
-  {
-llvm::sys::ScopedReader lock(m_extractdies_mutex);
-if (already_parsed())
-  return 0;
-  }
-  llvm::sys::ScopedWriter lock(m_extractdies_mutex);
-  if (already_parsed())
-return 0;
+  const size_t initial_die_array_size = m_die_array.size();
+  if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 
1)
+return 0; // Already parsed
 
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(
@@ -302,8 +291,6 @@ void DWARFUnit::SetAddrBase(dw_addr_t ad
 
 void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
   if (m_die_array.size() > 1) {
-llvm::sys::ScopedWriter lock(m_extractdies_mutex);
-
 // std::vectors never get any smaller when resized to a smaller size, or
 // when clear() or erase() are called, the size will report that it is
 // smaller, but the memory allocated remains intact (call capacity() to see

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=332200&r1=332199&r2=332200&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Sun May 13 11:38:28 
2018
@@ -13,7 +13,6 @@
 #include "DWARFDIE.h"
 #include "DWARFDebugInfoEntry.h"
 #include "lldb/lldb-enumerations.h"
-#include "llvm/Support/RWMutex.h"
 
 class DWARFUnit;
 class DWARFCompileUnit;
@@ -190,7 +189,6 @@ protected:
   // If this is a dwo compile unit this is the offset of the base compile unit
   // in the main object file
   dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET;
-  llvm::sys::RWMutex m_extractdies_mutex;
 
   static void
   IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r332201 - Use const_iterator in DWARFUnit

2018-05-13 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun May 13 12:04:17 2018
New Revision: 332201

URL: http://llvm.org/viewvc/llvm-project?rev=332201&view=rev
Log:
Use const_iterator in DWARFUnit

Function DWARFUnit::GetDIE is using m_die_array only for reading so it can use
DWARFDebugInfoEntry::const_iterator.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=332201&r1=332200&r2=332201&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Sun May 13 
12:04:17 2018
@@ -450,9 +450,9 @@ DWARFUnit::GetDIE(dw_offset_t die_offset
 
 if (ContainsDIEOffset(die_offset)) {
   ExtractDIEsIfNeeded(false);
-  DWARFDebugInfoEntry::iterator end = m_die_array.end();
-  DWARFDebugInfoEntry::iterator pos =
-  lower_bound(m_die_array.begin(), end, die_offset, CompareDIEOffset);
+  DWARFDebugInfoEntry::const_iterator end = m_die_array.cend();
+  DWARFDebugInfoEntry::const_iterator pos =
+  lower_bound(m_die_array.cbegin(), end, die_offset, CompareDIEOffset);
   if (pos != end) {
 if (die_offset == (*pos).GetOffset())
   return DWARFDIE(this, &(*pos));


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333222 - DWARFDIE split out to DWARFBaseDIE

2018-05-24 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu May 24 13:44:48 2018
New Revision: 333222

URL: http://llvm.org/viewvc/llvm-project?rev=333222&view=rev
Log:
DWARFDIE split out to DWARFBaseDIE

This new DWARFBaseDIE is going to be used for DWARFUnit::GetUnitDIEOnly() as
other DIEs are unavailable that time so the caller should not have methods
available to access them.

This patch is only a mechanical split without any use of it.

Differential revision: https://reviews.llvm.org/D47275

Added:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=333222&r1=333221&r2=333222&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Thu May 24 
13:44:48 2018
@@ -7,6 +7,7 @@ add_lldb_library(lldbPluginSymbolFileDWA
   DWARFASTParserJava.cpp
   DWARFASTParserOCaml.cpp
   DWARFAttribute.cpp
+  DWARFBaseDIE.cpp
   DWARFCompileUnit.cpp
   DWARFDataExtractor.cpp
   DWARFDebugAbbrev.cpp

Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp?rev=333222&view=auto
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (added)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Thu May 24 
13:44:48 2018
@@ -0,0 +1,193 @@
+//===-- DWARFBaseDIE.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "DWARFBaseDIE.h"
+
+#include "DWARFUnit.h"
+#include "DWARFDebugInfoEntry.h"
+#include "SymbolFileDWARF.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Symbol/ObjectFile.h"
+
+using namespace lldb_private;
+
+DIERef DWARFBaseDIE::GetDIERef() const {
+  if (!IsValid())
+return DIERef();
+
+  dw_offset_t cu_offset = m_cu->GetOffset();
+  if (m_cu->GetBaseObjOffset() != DW_INVALID_OFFSET)
+cu_offset = m_cu->GetBaseObjOffset();
+  return DIERef(cu_offset, m_die->GetOffset());
+}
+
+dw_tag_t DWARFBaseDIE::Tag() const {
+  if (m_die)
+return m_die->Tag();
+  else
+return 0;
+}
+
+const char *DWARFBaseDIE::GetTagAsCString() const {
+  return lldb_private::DW_TAG_value_to_name(Tag());
+}
+
+const char *DWARFBaseDIE::GetAttributeValueAsString(const dw_attr_t attr,
+const char *fail_value) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsString(GetDWARF(), GetCU(), attr,
+fail_value);
+  else
+return fail_value;
+}
+
+uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr,
+   uint64_t fail_value) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsUnsigned(GetDWARF(), GetCU(), attr,
+  fail_value);
+  else
+return fail_value;
+}
+
+int64_t DWARFBaseDIE::GetAttributeValueAsSigned(const dw_attr_t attr,
+int64_t fail_value) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsSigned(GetDWARF(), GetCU(), attr,
+fail_value);
+  else
+return fail_value;
+}
+
+uint64_t DWARFBaseDIE::GetAttributeValueAsReference(const dw_attr_t attr,
+uint64_t fail_value) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsReference(GetDWARF(), GetCU(), attr,
+   fail_value);
+  else
+return fail_value;
+}
+
+uint64_t DWARFBaseDIE::GetAttributeValueAsAddress(const dw_attr_t attr,
+  uint64_t fail_value) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsAddress(GetDWARF(), GetCU(), attr,
+ fail_value);
+  else
+return fail_value;
+}
+
+lldb::user_id_t DWARFBaseDIE::GetID() const {
+  return GetDIERef().GetUID(GetDWARF());
+}
+
+const char *DWARFBaseDIE::GetName() const {
+  if (IsValid())
+return m_die->GetName(GetDWARF(), m_cu);
+  else
+return nullptr;
+}
+
+lldb::LanguageType DWARFBaseDIE::GetLanguage() const {
+  if (IsValid())
+   

[Lldb-commits] [lldb] r333224 - Use DWARFBaseDIE as a compile-time protection

2018-05-24 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu May 24 13:51:13 2018
New Revision: 333224

URL: http://llvm.org/viewvc/llvm-project?rev=333224&view=rev
Log:
Use DWARFBaseDIE as a compile-time protection

As suggested by Pavel Labath in D46810 DWARFUnit::GetUnitDIEOnly() returning
a pointer to m_first_die should not permit using methods like GetFirstChild().

Differential revision: https://reviews.llvm.org/D47276

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=333224&r1=333223&r2=333224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu May 
24 13:51:13 2018
@@ -638,7 +638,7 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
 
 void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data,
DWARFUnit *cu, Stream &s) const {
-  const DWARFDIE cu_die = cu->GetUnitDIEOnly();
+  const DWARFBaseDIE cu_die = cu->GetUnitDIEOnly();
   const char *cu_name = NULL;
   if (cu_die)
 cu_name = cu_die.GetName();
@@ -912,7 +912,7 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr
   if (!dwo_cu)
 return 0;
 
-  DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
+  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
   if (!dwo_cu_die.IsValid())
 return 0;
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333224&r1=333223&r2=333224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Thu May 24 
13:51:13 2018
@@ -207,7 +207,7 @@ void DWARFUnit::AddUnitDIE(DWARFDebugInf
   if (!dwo_cu)
 return; // Can't fetch the compile unit from the dwo file.
 
-  DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
+  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
   if (!dwo_cu_die.IsValid())
 return; // Can't fetch the compile unit DIE from the dwo file.
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=333224&r1=333223&r2=333224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Thu May 24 13:51:13 
2018
@@ -113,7 +113,7 @@ public:
 
   void SetBaseAddress(dw_addr_t base_addr);
 
-  DWARFDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); }
+  DWARFBaseDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); }
 
   DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=333224&r1=333223&r2=333224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu May 24 
13:51:13 2018
@@ -748,7 +748,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC
   } else {
 ModuleSP module_sp(m_obj_file->GetModule());
 if (module_sp) {
-  const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly();
+  const DWARFDIE cu_die = dwarf_cu->DIE();
   if (cu_die) {
 FileSpec cu_file_spec{cu_die.GetName(), false};
 if (cu_file_spec) {
@@ -883,7 +883,7 @@ bool SymbolFileDWARF::ParseCompileUnitSu
   assert(sc.comp_unit);
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit);
   if (dwarf_cu) {
-const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly();
+const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly();
 
 if (cu_die) {
   FileSpec cu_comp_dir = resolveCompDir(
@@ -922,7 +922,7 @@ bool SymbolFileDWARF::ParseImportedModul
   UpdateExternalModuleListIfNeeded();
 
   if (sc.comp_unit) {
-const DWARFDIE die = dwarf_cu->GetUnitDIEOnly();
+const DWARFDIE die = dwarf_cu->DIE();
 
 if (die) {
   for (DWARFDIE child_die = die.GetFirstChild(); child_die;
@@ -997,7 +997,7 @@ bool SymbolFileDWARF::ParseCompileUnitLi
 
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit);
   if (dwarf_cu) {

[Lldb-commits] [lldb] r333287 - Remove DWARFUnit::ClearDIEs parameter keep_compile_unit_die

2018-05-25 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Fri May 25 09:11:45 2018
New Revision: 333287

URL: http://llvm.org/viewvc/llvm-project?rev=333287&view=rev
Log:
Remove DWARFUnit::ClearDIEs parameter keep_compile_unit_die

It has been now always passed as true and during planned D46810 it would no
longer make sense.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333287&r1=333286&r2=333287&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Fri May 25 
09:11:45 2018
@@ -288,7 +288,7 @@ void DWARFUnit::SetAddrBase(dw_addr_t ad
   m_base_obj_offset = base_obj_offset;
 }
 
-void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
+void DWARFUnit::ClearDIEs() {
   if (m_die_array.size() > 1) {
 // std::vectors never get any smaller when resized to a smaller size, or
 // when clear() or erase() are called, the size will report that it is
@@ -300,12 +300,11 @@ void DWARFUnit::ClearDIEs(bool keep_comp
 // Save at least the compile unit DIE
 DWARFDebugInfoEntry::collection tmp_array;
 m_die_array.swap(tmp_array);
-if (keep_compile_unit_die)
-  m_die_array.push_back(tmp_array.front());
+m_die_array.push_back(tmp_array.front());
   }
 
   if (m_dwo_symbol_file)
-m_dwo_symbol_file->GetCompileUnit()->ClearDIEs(keep_compile_unit_die);
+m_dwo_symbol_file->GetCompileUnit()->ClearDIEs();
 }
 
 void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf,
@@ -403,7 +402,7 @@ void DWARFUnit::BuildAddressRangeTable(S
   // Keep memory down by clearing DIEs if this generate function caused them to
   // be parsed
   if (clear_dies)
-ClearDIEs(true);
+ClearDIEs();
 }
 
 lldb::ByteOrder DWARFUnit::GetByteOrder() const {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=333287&r1=333286&r2=333287&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Fri May 25 09:11:45 
2018
@@ -99,7 +99,7 @@ public:
   dw_addr_t GetRangesBase() const { return m_ranges_base; }
   void SetAddrBase(dw_addr_t addr_base, dw_addr_t ranges_base,
dw_offset_t base_obj_offset);
-  void ClearDIEs(bool keep_compile_unit_die);
+  void ClearDIEs();
   void BuildAddressRangeTable(SymbolFileDWARF *dwarf,
   DWARFDebugAranges *debug_aranges);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp?rev=333287&r1=333286&r2=333287&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Fri May 25 
09:11:45 2018
@@ -96,7 +96,7 @@ void ManualDWARFIndex::Index() {
   //--
   for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
 if (clear_cu_dies[cu_idx])
-  debug_info.GetCompileUnitAtIndex(cu_idx)->ClearDIEs(true);
+  debug_info.GetCompileUnitAtIndex(cu_idx)->ClearDIEs();
   }
 }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333437 - Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 10:17:46 2018
New Revision: 333437

URL: http://llvm.org/viewvc/llvm-project?rev=333437&view=rev
Log:
Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

GetUnitDIEPtrOnly() needs to return pointer to the first DIE.
But the first element of m_die_array after ExtractDIEsIfNeeded(true)
may move in memory after later ExtractDIEsIfNeeded(false).

DWARFDebugInfoEntry::collection m_die_array is std::vector,
its data may move during its expansion.

Differential revision: https://reviews.llvm.org/D46810

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue May 
29 10:17:46 2018
@@ -1825,3 +1825,15 @@ void DWARFDebugInfoEntry::DumpDIECollect
 die_ref.HasChildren() ? " *" : "");
   }
 }
+
+bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
+  return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
+ m_sibling_idx == rhs.m_sibling_idx &&
+ m_empty_children == rhs.m_empty_children &&
+ m_abbr_idx == rhs.m_abbr_idx && m_has_children == rhs.m_has_children 
&&
+ m_tag == rhs.m_tag;
+}
+
+bool DWARFDebugInfoEntry::operator!=(const DWARFDebugInfoEntry &rhs) const {
+  return !(*this == rhs);
+}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue May 29 
10:17:46 2018
@@ -60,6 +60,10 @@ public:
 m_empty_children(false), m_abbr_idx(0), m_has_children(false),
 m_tag(0) {}
 
+  explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; }
+  bool operator==(const DWARFDebugInfoEntry &rhs) const;
+  bool operator!=(const DWARFDebugInfoEntry &rhs) const;
+
   void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
   const DWARFUnit *cu,
   DWARFDebugAranges *debug_aranges) const;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333437&r1=333436&r2=333437&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
10:17:46 2018
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
 
@@ -35,19 +36,45 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF *dw
 DWARFUnit::~DWARFUnit() {}
 
 //--
-// ParseCompileUnitDIEsIfNeeded
-//
+// Parses first DIE of a compile unit.
+//--
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  if (m_first_die)
+return; // Already parsed
+
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(
+  func_cat, "%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", m_offset);
+
+  // Set the offset to that of the first DIE and calculate the start of the
+  // next compilation unit header.
+  lldb::offset_t offset = GetFirstDIEOffset();
+
+  // We are in our compile unit, parse starting at the offset we were told to
+  // parse
+  const DWARFDataExtractor &data = GetData();
+  DWARFFormValue::FixedFormSizes fixed_form_sizes =
+  DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(),
+  IsDWARF64());
+  if (offset < GetNextCompileUnitOffset() &&
+  m_first_die.FastExtract(data, this, fixed_form_sizes, &offset)) {
+AddUnitDIE(m_first_die);
+return;
+  }
+
+  ExtractDIEsEndCheck(offset);
+}
+
+//--
 // Parses a c

[Lldb-commits] [lldb] r333449 - Fix compiler unused variable warning in DWARFUnit

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 11:53:25 2018
New Revision: 333449

URL: http://llvm.org/viewvc/llvm-project?rev=333449&view=rev
Log:
Fix compiler unused variable warning in DWARFUnit

Alex Langford has reported it from: https://reviews.llvm.org/D46810

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333449&r1=333448&r2=333449&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
11:53:25 2018
@@ -205,8 +205,6 @@ bool DWARFUnit::ExtractDIEsIfNeeded() {
 // Final checks for both ExtractUnitDIEIfNeeded() and ExtractDIEsIfNeeded().
 //--
 void DWARFUnit::ExtractDIEsEndCheck(lldb::offset_t offset) const {
-  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
-
   // Give a little bit of info if we encounter corrupt DWARF (our offset should
   // always terminate at or before the start of the next compilation unit
   // header).


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333452 - Remove unused DWARFUnit::HasDIEsParsed()

2018-05-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue May 29 12:14:46 2018
New Revision: 333452

URL: http://llvm.org/viewvc/llvm-project?rev=333452&view=rev
Log:
Remove unused DWARFUnit::HasDIEsParsed()

It was not implemented correctly after https://reviews.llvm.org/D46810 but then
it has not been used anywhere anyway.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333452&r1=333451&r2=333452&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 29 
12:14:46 2018
@@ -449,8 +449,6 @@ DWARFFormValue::FixedFormSizes DWARFUnit
 
 void DWARFUnit::SetBaseAddress(dw_addr_t base_addr) { m_base_addr = base_addr; 
}
 
-bool DWARFUnit::HasDIEsParsed() const { return m_die_array.size() > 1; }
-
 //--
 // Compare function DWARFDebugAranges::Range structures
 //--

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=333452&r1=333451&r2=333452&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Tue May 29 12:14:46 
2018
@@ -118,8 +118,6 @@ public:
 
   DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); }
 
-  bool HasDIEsParsed() const;
-
   DWARFDIE GetDIE(dw_offset_t die_offset);
 
   static uint8_t GetAddressByteSize(const DWARFUnit *cu);


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333517 - Fix return value of DWARFUnit::ExtractDIEsIfNeeded()

2018-05-30 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed May 30 01:54:46 2018
New Revision: 333517

URL: http://llvm.org/viewvc/llvm-project?rev=333517&view=rev
Log:
Fix return value of DWARFUnit::ExtractDIEsIfNeeded()

This is a leftover regression from: https://reviews.llvm.org/D46810

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333517&r1=333516&r2=333517&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Wed May 30 
01:54:46 2018
@@ -192,13 +192,12 @@ bool DWARFUnit::ExtractDIEsIfNeeded() {
 
   ExtractDIEsEndCheck(offset);
 
-  if (!m_dwo_symbol_file)
-return m_die_array.size();
+  if (m_dwo_symbol_file) {
+DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
+dwo_cu->ExtractDIEsIfNeeded();
+  }
 
-  DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
-  size_t dwo_die_count = dwo_cu->ExtractDIEsIfNeeded();
-  return m_die_array.size() + dwo_die_count -
- 1; // We have 2 CU die, but we want to count it only as one
+  return true;
 }
 
 //--


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333636 - Simplify DWARFUnit::m_die_array swap() to use shrink_to_fit()

2018-05-31 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu May 31 01:55:40 2018
New Revision: 333636

URL: http://llvm.org/viewvc/llvm-project?rev=333636&view=rev
Log:
Simplify DWARFUnit::m_die_array swap() to use shrink_to_fit()

rL145086 introduced m_die_array.shrink_to_fit() implemented by
exact_size_die_array.swap, it was before LLVM became written in C++11.

Differential revision: https://reviews.llvm.org/D47492

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333636&r1=333635&r2=333636&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Thu May 31 
01:55:40 2018
@@ -180,15 +180,7 @@ bool DWARFUnit::ExtractDIEsIfNeeded() {
 m_first_die = m_die_array.front();
   }
 
-  // Since std::vector objects will double their size, we really need to make a
-  // new array with the perfect size so we don't end up wasting space. So here
-  // we copy and swap to make sure we don't have any extra memory taken up.
-
-  if (m_die_array.size() < m_die_array.capacity()) {
-DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(),
- m_die_array.end());
-exact_size_die_array.swap(m_die_array);
-  }
+  m_die_array.shrink_to_fit();
 
   ExtractDIEsEndCheck(offset);
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r333987 - Protect DWARFCompileUnit::m_die_array by new mutexes

2018-06-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Jun  5 01:52:18 2018
New Revision: 333987

URL: http://llvm.org/viewvc/llvm-project?rev=333987&view=rev
Log:
Protect DWARFCompileUnit::m_die_array by new mutexes

If BuildAddressRangeTable called ExtractDIEsIfNeeded(false), then another
thread started processing data from m_die_array and then the first thread
called final ClearDIEs() the second thread would crash.

It is also required without multithreaded debugger using DW_TAG_partial_unit
for DWZ.

Differential revision: https://reviews.llvm.org/D40470

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333987&r1=333986&r2=333987&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue Jun  5 
01:52:18 2018
@@ -31,7 +31,8 @@ using namespace std;
 
 extern int g_verbose;
 
-DWARFUnit::DWARFUnit(SymbolFileDWARF *dwarf) : m_dwarf(dwarf) {}
+DWARFUnit::DWARFUnit(SymbolFileDWARF *dwarf)
+: m_dwarf(dwarf), m_cancel_scopes(false) {}
 
 DWARFUnit::~DWARFUnit() {}
 
@@ -39,6 +40,12 @@ DWARFUnit::~DWARFUnit() {}
 // Parses first DIE of a compile unit.
 //--
 void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  {
+llvm::sys::ScopedReader lock(m_first_die_mutex);
+if (m_first_die)
+  return; // Already parsed
+  }
+  llvm::sys::ScopedWriter lock(m_first_die_mutex);
   if (m_first_die)
 return; // Already parsed
 
@@ -67,10 +74,88 @@ void DWARFUnit::ExtractUnitDIEIfNeeded()
 
 //--
 // Parses a compile unit and indexes its DIEs if it hasn't already been done.
+// It will leave this compile unit extracted forever.
 //--
-bool DWARFUnit::ExtractDIEsIfNeeded() {
+void DWARFUnit::ExtractDIEsIfNeeded() {
+  m_cancel_scopes = true;
+
+  {
+llvm::sys::ScopedReader lock(m_die_array_mutex);
+if (!m_die_array.empty())
+  return; // Already parsed
+  }
+  llvm::sys::ScopedWriter lock(m_die_array_mutex);
   if (!m_die_array.empty())
-return 0; // Already parsed
+return; // Already parsed
+
+  ExtractDIEsRWLocked();
+}
+
+//--
+// Parses a compile unit and indexes its DIEs if it hasn't already been done.
+// It will clear this compile unit after returned instance gets out of scope,
+// no other ScopedExtractDIEs instance is running for this compile unit
+// and no ExtractDIEsIfNeeded() has been executed during this ScopedExtractDIEs
+// lifetime.
+//--
+DWARFUnit::ScopedExtractDIEs DWARFUnit::ExtractDIEsScoped() {
+  ScopedExtractDIEs scoped(this);
+
+  {
+llvm::sys::ScopedReader lock(m_die_array_mutex);
+if (!m_die_array.empty())
+  return std::move(scoped); // Already parsed
+  }
+  llvm::sys::ScopedWriter lock(m_die_array_mutex);
+  if (!m_die_array.empty())
+return std::move(scoped); // Already parsed
+
+  // Otherwise m_die_array would be already populated.
+  lldbassert(!m_cancel_scopes);
+
+  ExtractDIEsRWLocked();
+  scoped.m_clear_dies = true;
+  return scoped;
+}
+
+DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(DWARFUnit *cu) : m_cu(cu) {
+  lldbassert(m_cu);
+  m_cu->m_die_array_scoped_mutex.lock_shared();
+}
+
+DWARFUnit::ScopedExtractDIEs::~ScopedExtractDIEs() {
+  if (!m_cu)
+return;
+  m_cu->m_die_array_scoped_mutex.unlock_shared();
+  if (!m_clear_dies || m_cu->m_cancel_scopes)
+return;
+  // Be sure no other ScopedExtractDIEs is running anymore.
+  llvm::sys::ScopedWriter lock_scoped(m_cu->m_die_array_scoped_mutex);
+  llvm::sys::ScopedWriter lock(m_cu->m_die_array_mutex);
+  if (m_cu->m_cancel_scopes)
+return;
+  m_cu->ClearDIEsRWLocked();
+}
+
+DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(ScopedExtractDIEs &&rhs)
+: m_cu(rhs.m_cu), m_clear_dies(rhs.m_clear_dies) {
+  rhs.m_cu = nullptr;
+}
+
+DWARFUnit::ScopedExtractDIEs &DWARFUnit::ScopedExtractDIEs::operator=(
+DWARFUnit::ScopedExtractDIEs &&rhs) {
+  m_cu = rhs.m_cu;
+  rhs.m_cu = nullptr;
+  m_clear_dies = rhs.m_clear_dies;
+  return *this;
+}
+
+//--
+// Parses a compile unit and indexes its DIEs, m_die_array_mutex must be
+// held R/W and m_die_array must be empty.
+//--
+void DWARFUnit::ExtractDIEsRWLocked() {
+  llvm::sys::ScopedWriter first_die_lock(m_fi

[Lldb-commits] [lldb] r335431 - Make testcase classnames unique

2018-06-24 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Jun 24 03:36:44 2018
New Revision: 335431

URL: http://llvm.org/viewvc/llvm-project?rev=335431&view=rev
Log:
Make testcase classnames unique

Filenames with test results contain only the class name which makes it more
difficult to find it if the same class name is present in multiple *.py files.

packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
-class ReturnValueTestCase(TestBase):
+class StepAvoidsNoDebugTestCase(TestBase):
as ReturnValueTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py

packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
-class CreateDuringStepTestCase(TestBase):
+class CrashDuringStepTestCase(TestBase):
as CreateDuringStepTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py

packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
-class TestCStepping(TestBase):
+class StepUntilTestCase(TestBase):
as TestCStepping is already present in:
packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py?rev=335431&r1=335430&r2=335431&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
 Sun Jun 24 03:36:44 2018
@@ -15,7 +15,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class ReturnValueTestCase(TestBase):
+class StepAvoidsNoDebugTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py?rev=335431&r1=335430&r2=335431&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
 Sun Jun 24 03:36:44 2018
@@ -12,7 +12,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class CreateDuringStepTestCase(TestBase):
+class CrashDuringStepTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py?rev=335431&r1=335430&r2=335431&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
 Sun Jun 24 03:36:44 2018
@@ -11,7 +11,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class TestCStepping(TestBase):
+class StepUntilTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r335431 - Make testcase classnames unique

2018-06-25 Thread Jan Kratochvil via lldb-commits
On Mon, 25 Jun 2018 10:52:57 +0200, Pavel Labath wrote:
> BTW, the format of the test trace file names is configurable with a
> command line option (--session-file-format). Since we already have
> code which enforces that every test file name is unique, we might want
> to swap the default format to use the file name instead of the class
> name.

I have tried to change it but my patch has no effect, thanks for the advice
but I have now a bigger fish to fry.


Thanks,
Jan
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 463c147ff..3dcce5e86 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -41,7 +41,7 @@ set(LLDB_TEST_COMMON_ARGS
   ${CMAKE_BINARY_DIR}/lldb-test-traces
   --build-dir
   ${CMAKE_BINARY_DIR}/lldb-test-build.noindex
-  -S nm
+  -S fm
   -u CXXFLAGS
   -u CFLAGS
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r338224 - Remove friend class declarations from DWARFUnit and DWARFCompileUnit

2018-07-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Jul 29 12:32:36 2018
New Revision: 338224

URL: http://llvm.org/viewvc/llvm-project?rev=338224&view=rev
Log:
Remove friend class declarations from DWARFUnit and DWARFCompileUnit

They are no longer needed since D45170.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=338224&r1=338223&r2=338224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Sun Jul 29 
12:32:36 2018
@@ -13,8 +13,6 @@
 #include "DWARFUnit.h"
 
 class DWARFCompileUnit : public DWARFUnit {
-  friend class DWARFUnit;
-
 public:
   static DWARFUnitSP Extract(SymbolFileDWARF *dwarf2Data,
  const lldb_private::DWARFDataExtractor 
&debug_info,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=338224&r1=338223&r2=338224&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Sun Jul 29 12:32:36 
2018
@@ -33,8 +33,6 @@ enum DWARFProducer {
 };
 
 class DWARFUnit {
-  friend class DWARFCompileUnit;
-
   using die_iterator_range =
   llvm::iterator_range;
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] Linux fatal regression [Re: [lldb] r341487 - Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode]

2018-09-08 Thread Jan Kratochvil via lldb-commits
Hi Pavel,

OK to revert it? It completely broke testsuite on Linux.


Jan Kratochvil


On Wed, 05 Sep 2018 20:08:56 +0200, Pavel Labath via lldb-commits wrote:
> Author: labath
> Date: Wed Sep  5 11:08:56 2018
> New Revision: 341487
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=341487&view=rev
> Log:
> Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode

dddb70b0fa11f4c21cd2498b4c05d53fefb3d460 is the first bad commit
commit dddb70b0fa11f4c21cd2498b4c05d53fefb3d460
Author: Pavel Labath 
Date:   Wed Sep 5 18:08:56 2018 +
Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode

--
$ echo 'int main(){return 0;}'|clang -g -x c -;./bin/lldb ./a.out -o 'b main' 
-o r -o q
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 13 at :1:12, address = 
0x004004ad
(lldb) r
Process 2244270 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSEGV: address access 
protected (fault address: 0x77dd6000)
frame #0: 0x77de5ae0 ld-2.27.so`__GI__dl_debug_state at 
dl-debug.c:74
   71   void
   72   _dl_debug_state (void)
   73   {
-> 74   }
   75   rtld_hidden_def (_dl_debug_state)

Process 2244270 launched: 
'/home/jkratoch/redhat/llvm-git-build-release-clang/a.out' (x86_64)
(lldb) q
--
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Linux fatal regression [Re: [lldb] r341487 - Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode]

2018-09-08 Thread Jan Kratochvil via lldb-commits
On Sat, 08 Sep 2018 10:25:11 +0200, Jan Kratochvil wrote:
> OK to revert it? It completely broke testsuite on Linux.

BTW it regressed when LLDB is built by clang-6.0.1-1.fc28.x86_64.
When I build LLDB by gcc-8.1.1-5.fc28.x86_64 it still works.


Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r318626 - Add comments to DWARFCompileUnit length fields/methods

2017-11-19 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Nov 19 06:35:07 2017
New Revision: 318626

URL: http://llvm.org/viewvc/llvm-project?rev=318626&view=rev
Log:
Add comments to DWARFCompileUnit length fields/methods

Differential revision: https://reviews.llvm.org/D40211

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=318626&r1=318625&r2=318626&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Sun Nov 19 
06:35:07 2017
@@ -41,26 +41,24 @@ public:
   void Clear();
   bool Verify(lldb_private::Stream *s) const;
   void Dump(lldb_private::Stream *s) const;
+  // Offset of the initial length field.
   dw_offset_t GetOffset() const { return m_offset; }
   lldb::user_id_t GetID() const;
-  uint32_t Size() const {
-return m_is_dwarf64 ? 23
-: 11; /* Size in bytes of the compile unit header */
-  }
+  // Size in bytes of the initial length + compile unit header.
+  uint32_t Size() const { return m_is_dwarf64 ? 23 : 11; }
   bool ContainsDIEOffset(dw_offset_t die_offset) const {
 return die_offset >= GetFirstDIEOffset() &&
die_offset < GetNextCompileUnitOffset();
   }
   dw_offset_t GetFirstDIEOffset() const { return m_offset + Size(); }
   dw_offset_t GetNextCompileUnitOffset() const {
-return m_offset + m_length + (m_is_dwarf64 ? 12 : 4);
+return m_offset + (m_is_dwarf64 ? 12 : 4) + m_length;
   }
+  // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const {
-return m_length + (m_is_dwarf64 ? 12 : 4) - Size(); /* Size in bytes of the
-   .debug_info data
-   associated with this
-   compile unit. */
+return (m_is_dwarf64 ? 12 : 4) + m_length - Size();
   }
+  // Size of the CU data incl. header but without initial length.
   uint32_t GetLength() const { return m_length; }
   uint16_t GetVersion() const { return m_version; }
   const DWARFAbbreviationDeclarationSet *GetAbbreviations() const {
@@ -175,6 +173,7 @@ protected:
 // DW_TAG_subprogram
 // DIEs
   dw_addr_t m_base_addr;
+  // Offset of the initial length field.
   dw_offset_t m_offset;
   dw_offset_t m_length;
   uint16_t m_version;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r318631 - Remove 2 unused methods DWARFDebugInfo::Find and their FindCallbackString

2017-11-19 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Nov 19 11:04:24 2017
New Revision: 318631

URL: http://llvm.org/viewvc/llvm-project?rev=318631&view=rev
Log:
Remove 2 unused methods DWARFDebugInfo::Find and their FindCallbackString

Differential revision: https://reviews.llvm.org/D40216

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=318631&r1=318630&r2=318631&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Sun Nov 19 
11:04:24 2017
@@ -507,80 +507,3 @@ void DWARFDebugInfo::Dump(Stream *s, con
   die.Dump(s, recurse_depth);
   }
 }
-
-//--
-// FindCallbackString
-//
-// A callback function for the static DWARFDebugInfo::Parse() function
-// that gets called each time a compile unit header or debug information
-// entry is successfully parsed.
-//
-// This function will find the die_offset of any items whose DW_AT_name
-// matches the given string
-//--
-typedef struct FindCallbackStringInfoTag {
-  const char *name;
-  bool ignore_case;
-  RegularExpression *regex;
-  vector &die_offsets;
-} FindCallbackStringInfo;
-
-static dw_offset_t
-FindCallbackString(SymbolFileDWARF *dwarf2Data, DWARFCompileUnit *cu,
-   DWARFDebugInfoEntry *die, const dw_offset_t next_offset,
-   const uint32_t curr_depth, void *userData) {
-  FindCallbackStringInfo *info = (FindCallbackStringInfo *)userData;
-
-  if (!die)
-return next_offset;
-
-  const char *die_name = die->GetName(dwarf2Data, cu);
-  if (!die_name)
-return next_offset;
-
-  if (info->regex) {
-if (info->regex->Execute(llvm::StringRef(die_name)))
-  info->die_offsets.push_back(die->GetOffset());
-  } else {
-if ((info->ignore_case ? strcasecmp(die_name, info->name)
-   : strcmp(die_name, info->name)) == 0)
-  info->die_offsets.push_back(die->GetOffset());
-  }
-
-  // Just return the current offset to parse the next CU or DIE entry
-  return next_offset;
-}
-
-//--
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the entire name
-// and case sensitive searches are an option.
-//--
-bool DWARFDebugInfo::Find(const char *name, bool ignore_case,
-  vector &die_offsets) const {
-  die_offsets.clear();
-  if (name && name[0]) {
-FindCallbackStringInfo info = {name, ignore_case, NULL, die_offsets};
-DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
-  }
-  return !die_offsets.empty();
-}
-
-//--
-// Find
-//
-// Finds all DIE that have a specific DW_AT_name attribute by manually
-// searching through the debug information (not using the
-// .debug_pubnames section). The string must match the supplied regular
-// expression.
-//--
-bool DWARFDebugInfo::Find(RegularExpression &re,
-  vector &die_offsets) const {
-  die_offsets.clear();
-  FindCallbackStringInfo info = {NULL, false, &re, die_offsets};
-  DWARFDebugInfo::Parse(m_dwarf2Data, FindCallbackString, &info);
-  return !die_offsets.empty();
-}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=318631&r1=318630&r2=318631&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Sun Nov 19 
11:04:24 2017
@@ -50,10 +50,6 @@ public:
   static void Verify(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data);
   static void Dump(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data,
const uint32_t die_offset, const uint32_t recurse_depth);
-  bool Find(const char *name, bool ignore_case,
-std::vector &die_offsets) const;
-  bool Find(lldb_private::RegularExpression &re,
-std::vector &die_offsets) const;
 
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping


___
lldb-commits mailing list
lldb-commits@li

[Lldb-commits] [lldb] r318981 - Due to changes for DWZ I would need to update those such as renaming it to

2017-11-25 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sat Nov 25 09:16:56 2017
New Revision: 318981

URL: http://llvm.org/viewvc/llvm-project?rev=318981&view=rev
Log:
Due to changes for DWZ I would need to update those such as renaming it to
SetFileOffset.

Differential revision: https://reviews.llvm.org/D40458

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=318981&r1=318980&r2=318981&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Sat Nov 
25 09:16:56 2017
@@ -1314,19 +1314,6 @@ bool DWARFDebugInfoEntry::AppendTypeName
   return false;
 }
 
-bool DWARFDebugInfoEntry::Contains(const DWARFDebugInfoEntry *die) const {
-  if (die) {
-const dw_offset_t die_offset = die->GetOffset();
-if (die_offset > GetOffset()) {
-  const DWARFDebugInfoEntry *sibling = GetSibling();
-  assert(sibling); // TODO: take this out
-  if (sibling)
-return die_offset < sibling->GetOffset();
-}
-  }
-  return false;
-}
-
 //--
 // BuildAddressRangeTable
 //--

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=318981&r1=318980&r2=318981&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Sat Nov 25 
09:16:56 2017
@@ -60,18 +60,6 @@ public:
 m_empty_children(false), m_abbr_idx(0), m_has_children(false),
 m_tag(0) {}
 
-  void Clear() {
-m_offset = DW_INVALID_OFFSET;
-m_parent_idx = 0;
-m_sibling_idx = 0;
-m_empty_children = false;
-m_abbr_idx = 0;
-m_has_children = false;
-m_tag = 0;
-  }
-
-  bool Contains(const DWARFDebugInfoEntry *die) const;
-
   void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
   const DWARFCompileUnit *cu,
   DWARFDebugAranges *debug_aranges) const;
@@ -211,8 +199,6 @@ public:
 
   dw_offset_t GetOffset() const { return m_offset; }
 
-  void SetOffset(dw_offset_t offset) { m_offset = offset; }
-
   bool HasChildren() const { return m_has_children; }
 
   void SetHasChildren(bool b) { m_has_children = b; }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r319359 - refactor: Unify+simplify DWARFCompileUnit ctor+Clear() into in-class initializers + Extract()

2017-11-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Nov 29 13:13:11 2017
New Revision: 319359

URL: http://llvm.org/viewvc/llvm-project?rev=319359&view=rev
Log:
refactor: Unify+simplify DWARFCompileUnit ctor+Clear() into in-class 
initializers + Extract()

It has no functionality effect.

I was concerned about the worse performance of DWARFDebugInfo::Parse this way
of allocating+destroying a CU for each iteration but I see it is now used only
by DWARFDebugInfo::Dump so that is no longer a problem.

Differential revision: https://reviews.llvm.org/D40212

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=319359&r1=319358&r2=319359&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Nov 29 
13:13:11 2017
@@ -39,68 +39,48 @@ using namespace std;
 extern int g_verbose;
 
 DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
-: m_dwarf2Data(dwarf2Data), m_abbrevs(NULL), m_user_data(NULL),
-  m_die_array(), m_func_aranges_ap(), m_base_addr(0),
-  m_offset(DW_INVALID_OFFSET), m_length(0), m_version(0),
-  m_addr_size(DWARFCompileUnit::GetDefaultAddressSize()),
-  m_producer(eProducerInvalid), m_producer_version_major(0),
-  m_producer_version_minor(0), m_producer_version_update(0),
-  m_language_type(eLanguageTypeUnknown), m_is_dwarf64(false),
-  m_is_optimized(eLazyBoolCalculate), m_addr_base(0),
-  m_ranges_base(0), m_base_obj_offset(DW_INVALID_OFFSET) {}
+: m_dwarf2Data(dwarf2Data) {}
 
 DWARFCompileUnit::~DWARFCompileUnit() {}
 
-void DWARFCompileUnit::Clear() {
-  m_offset = DW_INVALID_OFFSET;
-  m_length = 0;
-  m_version = 0;
-  m_abbrevs = NULL;
-  m_addr_size = DWARFCompileUnit::GetDefaultAddressSize();
-  m_base_addr = 0;
-  m_die_array.clear();
-  m_func_aranges_ap.reset();
-  m_user_data = NULL;
-  m_producer = eProducerInvalid;
-  m_language_type = eLanguageTypeUnknown;
-  m_is_dwarf64 = false;
-  m_is_optimized = eLazyBoolCalculate;
-  m_addr_base = 0;
-  m_base_obj_offset = DW_INVALID_OFFSET;
-}
+DWARFCompileUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
+lldb::offset_t *offset_ptr) {
+  DWARFCompileUnitSP cu_sp(new DWARFCompileUnit(dwarf2Data));
+  // Out of memory?
+  if (cu_sp.get() == NULL)
+return nullptr;
 
-bool DWARFCompileUnit::Extract(const DWARFDataExtractor &debug_info,
-   lldb::offset_t *offset_ptr) {
-  Clear();
+  const DWARFDataExtractor &debug_info = dwarf2Data->get_debug_info_data();
 
-  m_offset = *offset_ptr;
+  cu_sp->m_offset = *offset_ptr;
 
   if (debug_info.ValidOffset(*offset_ptr)) {
 dw_offset_t abbr_offset;
-const DWARFDebugAbbrev *abbr = m_dwarf2Data->DebugAbbrev();
-m_length = debug_info.GetDWARFInitialLength(offset_ptr);
-m_is_dwarf64 = debug_info.IsDWARF64();
-m_version = debug_info.GetU16(offset_ptr);
+const DWARFDebugAbbrev *abbr = dwarf2Data->DebugAbbrev();
+cu_sp->m_length = debug_info.GetDWARFInitialLength(offset_ptr);
+cu_sp->m_is_dwarf64 = debug_info.IsDWARF64();
+cu_sp->m_version = debug_info.GetU16(offset_ptr);
 abbr_offset = debug_info.GetDWARFOffset(offset_ptr);
-m_addr_size = debug_info.GetU8(offset_ptr);
+cu_sp->m_addr_size = debug_info.GetU8(offset_ptr);
 
-bool length_OK = debug_info.ValidOffset(GetNextCompileUnitOffset() - 1);
-bool version_OK = SymbolFileDWARF::SupportedVersion(m_version);
+bool length_OK =
+debug_info.ValidOffset(cu_sp->GetNextCompileUnitOffset() - 1);
+bool version_OK = SymbolFileDWARF::SupportedVersion(cu_sp->m_version);
 bool abbr_offset_OK =
-m_dwarf2Data->get_debug_abbrev_data().ValidOffset(abbr_offset);
-bool addr_size_OK = ((m_addr_size == 4) || (m_addr_size == 8));
+dwarf2Data->get_debug_abbrev_data().ValidOffset(abbr_offset);
+bool addr_size_OK = (cu_sp->m_addr_size == 4) || (cu_sp->m_addr_size == 8);
 
 if (length_OK && version_OK && addr_size_OK && abbr_offset_OK &&
 abbr != NULL) {
-  m_abbrevs = abbr->GetAbbreviationDeclarationSet(abbr_offset);
-  return true;
+  cu_sp->m_abbrevs = abbr->GetAbbreviationDeclarationSet(abbr_offset);
+  return cu_sp;
 }
 
 // reset the offset to where we tried to parse from if anything went wrong
-*offset_ptr = m_offset;
+*offset_ptr = cu_sp->m_offset;
   }
 
-  return false;
+  return nullptr;
 }
 
 void DWARFCompileUnit::ClearDIEs(bool keep_compile_unit_die) {

Modified: lldb/tru

[Lldb-commits] [lldb] r319402 - refactor: Simplify loop with DWARFCompileUnit::Extract

2017-11-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Nov 29 21:49:02 2017
New Revision: 319402

URL: http://llvm.org/viewvc/llvm-project?rev=319402&view=rev
Log:
refactor: Simplify loop with DWARFCompileUnit::Extract

Forgotten small simplification in D40212.

Differential revision: https://reviews.llvm.org/D40635

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=319402&r1=319401&r2=319402&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Wed Nov 29 
21:49:02 2017
@@ -97,12 +97,8 @@ void DWARFDebugInfo::ParseCompileUnitHea
   if (m_compile_units.empty()) {
 if (m_dwarf2Data != NULL) {
   lldb::offset_t offset = 0;
-  for (;;) {
-DWARFCompileUnitSP cu_sp =
-DWARFCompileUnit::Extract(m_dwarf2Data, &offset);
-if (cu_sp.get() == NULL)
-  break;
-
+  DWARFCompileUnitSP cu_sp;
+  while ((cu_sp = DWARFCompileUnit::Extract(m_dwarf2Data, &offset))) {
 m_compile_units.push_back(cu_sp);
 
 offset = cu_sp->GetNextCompileUnitOffset();


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D40475: DWZ 12/12: DWZ test mode

2017-12-01 Thread Jan Kratochvil via lldb-commits
On Fri, 01 Dec 2017 13:02:42 +0100, Pavel Labath wrote:
> > I expect because LLDB does not have any Linux DWARF index support, it has
> > only some Apple OSX index support. GDB's `.debug_index` is not usable for
> > LLDB as it does not contain DIE offsets. I would like to implement DWARF-5
> > `.debug_names` for it later.
> 
> Well... missing dwarf index can make things slower, as we will have to
> index things ourselves, but it should not make us hang. (That's not
> say .debug_index support would not be a great feature to have).

FYI the GDB one is `.gdb_index`, I made a typo. But it is not usable for LLDB
as LLDB needs also DIE offsets; GDB expands whole CUs.

DWARF-5 '.debug_names' producer could be even ported from GDB to LLDB
[PATCH v3 0/5] DWARF-5: .debug_names index
https://sourceware.org/ml/gdb-patches/2017-06/msg00541.html
although the consumer is too GDB-specific, LLDB would need its own one.

Although then it would be better==faster to produce per-CU index already by
compiler and a linker could just merge them.  In Fedora people use gold now
for C++ as GNU ld is unusable from performance point of view.  gold can also
generate .gdb_index on its own but it has to index all the CUs as there is no
per-CU index provided by GCC (or clang?).

0m 5.389s -fuse-ld=gold -Wl,--gdb-index,--build-id
0m 3.564s -fuse-ld=gold -Wl,--build-id
   1.825s = --gdb-index part of gold
0m19.401s (GNU ld)  -Wl,--build-id
0m 4.364s gdb-add-index
  23.765s = GNU ld + gdb-add-index

But then I see lld already supports even -gdb-index.  Any updates about LLVM
DWARF index plan is welcome.


Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r319580 - Prevent vain lldb::user_id_t 0xffffffff lookups

2017-12-01 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Fri Dec  1 12:14:09 2017
New Revision: 319580

URL: http://llvm.org/viewvc/llvm-project?rev=319580&view=rev
Log:
Prevent vain lldb::user_id_t 0x lookups

I have found LLDB commonly looks up lldb::user_id_t 0x failing to find
its DIE. One would rather expect LLDB_INVALID_UID == 0x in such
case.

DWARFASTParserClang.cpp:495
492 type_sp.reset(
493 new Type(die.GetID(), dwarf, type_name_const_str, 
byte_size, NULL,
494  DIERef(encoding_uid).GetUID(dwarf), 
encoding_data_type,
495  &decl, clang_type, resolve_state));
encoding_uid = (DWARFFormValue) {m_cu = 0x0, m_form = 0, m_value = {value = 
{uval = 0, sval = 0, cstr = 0x0}, data = 0x0}}
-> DIERef::DIERef(const DWARFFormValue &form_value = {m_cu = 0x0, m_form = 0, 
m_value = {value = {uval = 0, sval = 0, cstr = 0x0}, data = 0x0}})
-> (DIERef) {cu_offset = 0x, die_offset = 0x}
-> lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf = 0x61d0b480) const
-> Type::Type(lldb::user_id_t encoding_uid = 0x)
But 0x !=
#define LLDB_INVALID_UID UINT64_MAX

Differential revision: https://reviews.llvm.org/D37492

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp?rev=319580&r1=319579&r2=319580&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp Fri Dec  1 12:14:09 
2017
@@ -65,7 +65,7 @@ lldb::user_id_t DIERef::GetUID(SymbolFil
   //
   // SymbolFileDWARFDwo sets the ID to the compile unit offset.
   //--
-  if (dwarf)
+  if (dwarf && die_offset != DW_INVALID_OFFSET)
 return dwarf->GetID() | die_offset;
   else
 return LLDB_INVALID_UID;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r323069 - Clean up #include "DWARFCompileUnit.h"

2018-01-21 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Jan 21 10:03:17 2018
New Revision: 323069

URL: http://llvm.org/viewvc/llvm-project?rev=323069&view=rev
Log:
Clean up #include "DWARFCompileUnit.h"

Clean up needless+missing #include "DWARFCompileUnit.h" for split of
DWARFCompileUnit to DWARFUnit as discussed in D40466.

Differential revision: https://reviews.llvm.org/D42355

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=323069&r1=323068&r2=323069&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Sun Jan 21 
10:03:17 2018
@@ -10,7 +10,6 @@
 #include "DWARFASTParserGo.h"
 
 #include "DWARFASTParserGo.h"
-#include "DWARFCompileUnit.h"
 #include "DWARFDIE.h"
 #include "DWARFDIECollection.h"
 #include "DWARFDebugInfo.h"

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h?rev=323069&r1=323068&r2=323069&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h Sun Jan 21 
10:03:17 2018
@@ -4,7 +4,6 @@
 #define SymbolFileDWARF_DWARFASTParserOCaml_h_
 
 #include "DWARFASTParser.h"
-#include "DWARFCompileUnit.h"
 #include "DWARFDIE.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDefines.h"

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=323069&r1=323068&r2=323069&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Sun Jan 21 
10:03:17 2018
@@ -13,6 +13,7 @@
 #include 
 #include 
 
+#include "DWARFCompileUnit.h"
 #include "DWARFDIE.h"
 #include "SymbolFileDWARF.h"
 #include "lldb/Core/STLUtils.h"

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp?rev=323069&r1=323068&r2=323069&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp Sun Jan 21 
10:03:17 2018
@@ -14,7 +14,6 @@
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StreamString.h"
 
-#include "DWARFCompileUnit.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDebugInfoEntry.h"
 #include "SymbolFileDWARF.h"


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r323586 - Remove unused class declarations

2018-01-27 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sat Jan 27 06:35:33 2018
New Revision: 323586

URL: http://llvm.org/viewvc/llvm-project?rev=323586&view=rev
Log:
Remove unused class declarations

Simplification by removing excessive DWARFCompileUnit references for D40466 .

Differential revision: https://reviews.llvm.org/D42613

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h

Modified: 
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h?rev=323586&r1=323585&r2=323586&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h 
Sat Jan 27 06:35:33 2018
@@ -13,8 +13,6 @@
 #include "DWARFAttribute.h"
 #include "SymbolFileDWARF.h"
 
-class DWARFCompileUnit;
-
 class DWARFAbbreviationDeclaration {
 public:
   enum { InvalidCode = 0 };

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=323586&r1=323585&r2=323586&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Sat Jan 27 
06:35:33 2018
@@ -21,10 +21,6 @@
 #include "DWARFFormValue.h"
 #include "NameToDIE.h"
 
-class SymbolFileDWARF;
-class DWARFCompileUnit;
-class DWARFDebugInfoEntry;
-
 class DWARFMappedHash {
 public:
   enum AtomType : uint16_t {


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r324222 - Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

2018-02-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Feb  5 02:46:56 2018
New Revision: 324222

URL: http://llvm.org/viewvc/llvm-project?rev=324222&view=rev
Log:
Fix upper->lower case for /usr/lib/debug/.build-id/**.debug

I have found the lookup by build-id
(when lookup by /usr/lib/debug/path/name/exec.debug failed) does not work as
LLDB tries the build-id hex string in uppercase but Fedora uses lowercase.

xubuntu-16.10 also uses lowercase during my test:
/usr/lib/debug/.build-id/6c/61f3566329f43d03f812ae7057e9e7391b5ff6.debug

Differential revision: https://reviews.llvm.org/D42852

Added:
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile

lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
Modified:
lldb/trunk/source/Host/common/Symbols.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile?rev=324222&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile Mon 
Feb  5 02:46:56 2018
@@ -0,0 +1,20 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+LD_EXTRAS += -Wl,--build-id=sha1
+
+all: stripped.out
+
+.PHONY: .build-id
+stripped.out .build-id: a.out
+   $(OBJCOPY) -j .note.gnu.build-id -O binary $< tmp
+   rm -rf .build-id
+   fn=`od -An -tx1 http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py?rev=324222&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py
 Mon Feb  5 02:46:56 2018
@@ -0,0 +1,21 @@
+""" Testing separate debug info loading by its .build-id. """
+import os
+import time
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestTargetSymbolsBuildidCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test  # Prevent the genaration of the dwarf version of this 
test
+@skipUnlessPlatform(['linux'])
+def test_target_symbols_buildid_case(self):
+self.build(clean=True)
+exe = self.getBuildArtifact("stripped.out")
+
+lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)

Added: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c?rev=324222&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c Mon Feb  
5 02:46:56 2018
@@ -0,0 +1,3 @@
+int main() {
+  return 0;
+}

Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=324222&r1=324221&r2=324222&view=diff
==
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Mon Feb  5 02:46:56 2018
@@ -245,6 +245,8 @@ FileSpec Symbols::LocateExecutableSymbol
   // Some debug files are stored in the .build-id directory like this:
   //   
/usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
   uuid_str = module_uuid.GetAsString("");
+  std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
+  ::tolower);
   uuid_str.insert(2, 1, '/');
   uuid_str = uuid_str + ".debug";
 }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r324224 - Resolve binary symlinks before finding its separate .debug file

2018-02-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Feb  5 02:50:38 2018
New Revision: 324224

URL: http://llvm.org/viewvc/llvm-project?rev=324224&view=rev
Log:
Resolve binary symlinks before finding its separate .debug file

I have found LLDB cannot find separate debug info of Fedora /usr/bin/gdb.
It is because:

lrwxrwxrwx 1 root root   14 Jan 25 20:41 /usr/bin/gdb -> ../libexec/gdb*
-rwxr-xr-x 1 root root 10180296 Jan 25 20:41 /usr/libexec/gdb*
ls: cannot access '/usr/lib/debug/usr/bin/gdb-8.0.1-35.fc27.x86_64.debug': No 
such file or directory
-r--r--r-- 1 root root 29200464 Jan 25 20:41 
/usr/lib/debug/usr/libexec/gdb-8.0.1-35.fc27.x86_64.debug

FYI that -8.0.1-35.fc27.x86_64.debug may look confusing, it was always just
.debug before.
Why is /usr/bin/gdb a symlink is offtopic for this bugreport, Fedora has it so
for some reasons.

It is always safest to look at the .debug file only after resolving all
symlinks on the binary file.

Differential revision: https://reviews.llvm.org/D42853

Added:
lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/
lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile

lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py
lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c
Modified:
lldb/trunk/source/Host/common/Symbols.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile?rev=324224&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile 
Mon Feb  5 02:50:38 2018
@@ -0,0 +1,20 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+
+all: dirsymlink
+
+dirreal: a.out
+   $(RM) -r $@
+   mkdir $@
+   $(OBJCOPY) --only-keep-debug $< $@/stripped.debug
+   $(OBJCOPY) --strip-all --add-gnu-debuglink=$@/stripped.debug $< 
$@/stripped.out
+
+dirsymlink: dirreal
+   $(RM) -r $@
+   mkdir $@
+   ln -s ../$http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py?rev=324224&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/TestTargetSymbolsSepDebugSymlink.py
 Mon Feb  5 02:50:38 2018
@@ -0,0 +1,22 @@
+""" Testing separate debug info loading for base binary with a symlink. """
+import os
+import time
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestTargetSymbolsSepDebugSymlink(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test  # Prevent the genaration of the dwarf version of this 
test
+@skipUnlessPlatform(['linux'])
+@skipIf(hostoslist=["windows"])
+def test_target_symbols_sepdebug_symlink_case(self):
+self.build(clean=True)
+exe = self.getBuildArtifact("dirsymlink/stripped.symlink")
+
+lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe)

Added: lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c?rev=324224&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/sepdebugsymlink/main.c Mon 
Feb  5 02:50:38 2018
@@ -0,0 +1,3 @@
+int main() {
+  return 0;
+}

Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=324224&r1=324223&r2=324224&view=diff
==
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Mon Feb  5 02:50:38 2018
@@ -9,6 +9,7 @@
 
 #include "lldb/Host/Symbols.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ArchSpec.h"
@@ -221,7 +222,11 @@ FileSpec Symbols::LocateExecutableSymbol
 Target::GetDefaultDebugFileSearchPaths());
 
 // Add module directory.
-const ConstString &file_dir = module_spec.GetFileSpec().GetDirectory();
+FileSpec module_file_spec = module_spec.GetFileSpec();
+// We keep the unresolved pathname if it fails.
+FileSystem::ResolveSymbolicLink(module_file_spec, module_file_spec)

[Lldb-commits] [lldb] r324275 - refactor: DWARFCompileUnit::Producer -> DWARFProducer

2018-02-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Feb  5 13:50:01 2018
New Revision: 324275

URL: http://llvm.org/viewvc/llvm-project?rev=324275&view=rev
Log:
refactor: DWARFCompileUnit::Producer -> DWARFProducer

Differential revision: https://reviews.llvm.org/D42891

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=324275&r1=324274&r2=324275&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Mon Feb  
5 13:50:01 2018
@@ -10,7 +10,6 @@
 #include 
 
 #include "DWARFASTParserClang.h"
-#include "DWARFCompileUnit.h"
 #include "DWARFDIE.h"
 #include "DWARFDIECollection.h"
 #include "DWARFDebugInfo.h"
@@ -1767,8 +1766,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 array_element_type.GetCompleteType() == false) {
   ModuleSP module_sp = die.GetModule();
   if (module_sp) {
-if (die.GetCU()->GetProducer() ==
-DWARFCompileUnit::eProducerClang)
+if (die.GetCU()->GetProducer() == eProducerClang)
   module_sp->ReportError(
   "DWARF DW_TAG_array_type DIE at 0x%8.8x has a "
   "class/union/struct element type DIE 0x%8.8x that is a "
@@ -2367,8 +2365,7 @@ bool DWARFASTParserClang::CompleteTypeFr
 "does not have a complete definition.",
 die.GetName(),
 
base_class_type.GetTypeName().GetCString());
-if (die.GetCU()->GetProducer() ==
-DWARFCompileUnit::eProducerClang)
+if (die.GetCU()->GetProducer() == eProducerClang)
   module->ReportError(":: Try compiling the source file with "
   "-fstandalone-debug.");
 
@@ -3205,8 +3202,7 @@ bool DWARFASTParserClang::ParseChildMemb
 
   if (ClangASTContext::IsCXXClassType(member_clang_type) &&
   member_clang_type.GetCompleteType() == false) {
-if (die.GetCU()->GetProducer() ==
-DWARFCompileUnit::eProducerClang)
+if (die.GetCU()->GetProducer() == eProducerClang)
   module_sp->ReportError(
   "DWARF DIE at 0x%8.8x (class %s) has a member variable "
   "0x%8.8x (%s) whose type is a forward declaration, not a 
"

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=324275&r1=324274&r2=324275&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Mon Feb  5 
13:50:01 2018
@@ -1012,7 +1012,7 @@ void DWARFCompileUnit::ParseProducerInfo
 m_producer = eProcucerOther;
 }
 
-DWARFCompileUnit::Producer DWARFCompileUnit::GetProducer() {
+DWARFProducer DWARFCompileUnit::GetProducer() {
   if (m_producer == eProducerInvalid)
 ParseProducerInfo();
   return m_producer;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=324275&r1=324274&r2=324275&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Mon Feb  5 
13:50:01 2018
@@ -20,16 +20,16 @@ class SymbolFileDWARFDwo;
 
 typedef std::shared_ptr DWARFCompileUnitSP;
 
+enum DWARFProducer {
+  eProducerInvalid = 0,
+  eProducerClang,
+  eProducerGCC,
+  eProducerLLVMGCC,
+  eProcucerOther
+};
+
 class DWARFCompileUnit {
 public:
-  enum Producer {
-eProducerInvalid = 0,
-eProducerClang,
-eProducerGCC,
-eProducerLLVMGCC,
-eProcucerOther
-  };
-
   static DWARFCompileUnitSP Extract(SymbolFileDWARF *dwarf2Data,
   lldb::offset_t *offset_ptr);
   ~DWARFCompileUnit();
@@ -137,7 +137,7 @@ public:
 
   SymbolFileDWARF *GetSymbolFileDWARF() const { return m_dwarf2Data; }
 
-  Producer GetProducer();
+  DWARFProducer GetProducer();
 
   uint32_t GetProducerVersionMajor();
 
@@ -178,7 +178,7 @@ protected:
   dw_offset_t m_length;
   uint16_t m_version;
   uint8_t m_addr_size;
-  Producer m_producer = eProducerIn

[Lldb-commits] [lldb] r327809 - DWARFUnit split out of DWARFCompileUnit

2018-03-18 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Mar 18 13:09:02 2018
New Revision: 327809

URL: http://llvm.org/viewvc/llvm-project?rev=327809&view=rev
Log:
DWARFUnit split out of DWARFCompileUnit

DW_TAG_partial_unit for DWZ can be then presented by DWARFPartialUnit also
inherited from DWARFUnit.

Differential revision: https://reviews.llvm.org/D40466

Added:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=327809&r1=327808&r2=327809&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Sun Mar 18 
13:09:02 2018
@@ -23,6 +23,7 @@ add_lldb_library(lldbPluginSymbolFileDWA
   DWARFDIE.cpp
   DWARFDIECollection.cpp
   DWARFFormValue.cpp
+  DWARFUnit.cpp
   HashedNameToDIE.cpp
   LogChannelDWARF.cpp
   NameToDIE.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=327809&r1=327808&r2=327809&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Sun Mar 18 
13:09:02 2018
@@ -9,7 +9,6 @@
 
 #include "DWARFCompileUnit.h"
 
-#include "Plugins/Language/ObjC/ObjCLanguage.h"
 #include "lldb/Core/DumpDataExtractor.h"
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/Module.h"
@@ -41,8 +40,6 @@ extern int g_verbose;
 DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
 : m_dwarf2Data(dwarf2Data) {}
 
-DWARFCompileUnit::~DWARFCompileUnit() {}
-
 DWARFCompileUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
 lldb::offset_t *offset_ptr) {
   DWARFCompileUnitSP cu_sp(new DWARFCompileUnit(dwarf2Data));
@@ -344,28 +341,6 @@ void DWARFCompileUnit::Dump(Stream *s) c
 GetNextCompileUnitOffset());
 }
 
-static uint8_t g_default_addr_size = 4;
-
-uint8_t DWARFCompileUnit::GetAddressByteSize(const DWARFCompileUnit *cu) {
-  if (cu)
-return cu->GetAddressByteSize();
-  return DWARFCompileUnit::GetDefaultAddressSize();
-}
-
-bool DWARFCompileUnit::IsDWARF64(const DWARFCompileUnit *cu) {
-  if (cu)
-return cu->IsDWARF64();
-  return false;
-}
-
-uint8_t DWARFCompileUnit::GetDefaultAddressSize() {
-  return g_default_addr_size;
-}
-
-void DWARFCompileUnit::SetDefaultAddressSize(uint8_t addr_size) {
-  g_default_addr_size = addr_size;
-}
-
 lldb::user_id_t DWARFCompileUnit::GetID() const {
   dw_offset_t local_id =
   m_base_obj_offset != DW_INVALID_OFFSET ? m_base_obj_offset : m_offset;
@@ -516,47 +491,6 @@ DWARFCompileUnit::LookupAddress(const dw
   return DWARFDIE();
 }
 
-//--
-// Compare function DWARFDebugAranges::Range structures
-//--
-static bool CompareDIEOffset(const DWARFDebugInfoEntry &die,
- const dw_offset_t die_offset) {
-  return die.GetOffset() < die_offset;
-}
-
-//--
-// GetDIE()
-//
-// Get the DIE (Debug Information Entry) with the specified offset by
-// first checking if the DIE is contained within this compile unit and
-// grabbing the DIE from this compile unit. Otherwise we grab the DIE
-// from the DWARF file.
-//--
-DWARFDIE
-DWARFCompileUnit::GetDIE(dw_offset_t die_offset) {
-  if (die_offset != DW_INVALID_OFFSET) {
-if (m_dwo_symbol_file)
-  return m_dwo_symbol_file->GetCompileUnit()->GetDIE(die_offset);
-
-if (ContainsDIEOffset(die_offset)) {
-  ExtractDIEsIfNeeded(false);
-  DWARFDebugInfoEntry::iterator end = m_die_array.end();
-  DWARFDebugInfoEntry::iterator pos =
-  lower_bound(m_die_array.begin(), end, die_offset, CompareDIEOffset);
-  if (pos != end) {
-if (die_offset == (*pos).GetOffset())
-  return DWARFDIE(this, &(*pos));
-  }
-} else {
-  // Don't specify the compile unit offset as we don't know it because the
-  // DIE belongs to
-  // a different compile unit in the same symbol file.
-  return m_dwarf2Data->DebugInfo()->GetDIEForDIEOffset(die_offset);
-}
-  }
-  return DWARFDIE(); // Not found
-}
-
 size_t DWARFCompileUnit::AppendDIEsWithTag(const dw_tag_t t

[Lldb-commits] [lldb] r327810 - Move the codebase to use: DWARFCompileUnit -> DWARFUnit

2018-03-18 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Mar 18 13:11:02 2018
New Revision: 327810

URL: http://llvm.org/viewvc/llvm-project?rev=327810&view=rev
Log:
Move the codebase to use: DWARFCompileUnit -> DWARFUnit

Now the codebase can use the DWARFUnit superclass. It will make it later
seamlessly work also with DWARFPartialUnit for DWZ.

This patch is only a search-and-replace easily undone, nothing interesting
in it.

Differential revision: https://reviews.llvm.org/D42892

Modified:
lldb/trunk/include/lldb/Expression/DWARFExpression.h
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h

Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=327810&r1=327809&r2=327810&view=diff
==
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Sun Mar 18 13:11:02 
2018
@@ -18,7 +18,7 @@
 #include "lldb/lldb-private.h"
 #include 
 
-class DWARFCompileUnit;
+class DWARFUnit;
 
 namespace lldb_private {
 
@@ -46,7 +46,7 @@ public:
   //--
   /// Constructor
   //--
-  explicit DWARFExpression(DWARFCompileUnit *dwarf_cu);
+  explicit DWARFExpression(DWARFUnit *dwarf_cu);
 
   //--
   /// Constructor
@@ -62,7 +62,7 @@ public:
   /// The byte length of the location expression.
   //--
   DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
-  DWARFCompileUnit *dwarf_cu, lldb::offset_t data_offset,
+  DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
   lldb::offset_t data_length);
 
   //--
@@ -332,7 +332,7 @@ public:
   //--
   static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
-   DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
+   DWARFUnit *dwarf_cu, const lldb::offset_t offset,
const lldb::offset_t length,
const lldb::RegisterKind reg_set,
const Value *initial_value_ptr,
@@ -348,7 +348,7 @@ public:
   lldb::addr_t loclist_base_load_addr,
   lldb::addr_t address, ABI *abi);
 
-  static size_t LocationListSize(const DWARFCompileUnit *dwarf_cu,
+  static size_t LocationListSize(const DWARFUnit *dwarf_cu,
  const DataExtractor &debug_loc_data,
  lldb::offset_t offset);
 
@@ -356,7 +356,7 @@ public:
int address_size, int dwarf_ref_size,
bool location_expression);
 
-  static void PrintDWARFLocationList(Stream &s, const DWARFCompileUnit *cu,
+  static void PrintDWARFLocationList(Stream &s, const DWARFUnit *cu,
   

[Lldb-commits] [lldb] r329423 - Revert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit"

2018-04-06 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Fri Apr  6 10:11:13 2018
New Revision: 329423

URL: http://llvm.org/viewvc/llvm-project?rev=329423&view=rev
Log:
Revert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding 
DWARFTypeUnit"

The reverted commit changed DWARFUnit from https://reviews.llvm.org/D40466 and
https://reviews.llvm.org/D42892 that was prepared for DWARFPartialUnit and
made from it a superclass for DWARFTypeUnit.  DWARFUnit's intention was:
DWARFUnit->DWARFSomeNameUnit->DWARFCompileUnit
DWARFUnit->DWARFSomeNameUnit->DWARFTypeUnit
DWARFUnit->DWARFPartialUnit

Discussed at: https://reviews.llvm.org/D45170

This reverts commit r329305.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=329423&r1=329422&r2=329423&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Apr  6 
10:11:13 2018
@@ -9,15 +9,36 @@
 
 #include "DWARFCompileUnit.h"
 
+#include "lldb/Core/DumpDataExtractor.h"
+#include "lldb/Core/Mangled.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Host/StringConvert.h"
+#include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Symbol/LineTable.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
+
+#include "DWARFDIECollection.h"
+#include "DWARFDebugAbbrev.h"
+#include "DWARFDebugAranges.h"
+#include "DWARFDebugInfo.h"
+#include "DWARFFormValue.h"
+#include "LogChannelDWARF.h"
+#include "NameToDIE.h"
 #include "SymbolFileDWARF.h"
+#include "SymbolFileDWARFDebugMap.h"
+#include "SymbolFileDWARFDwo.h"
 
 using namespace lldb;
 using namespace lldb_private;
+using namespace std;
 
 extern int g_verbose;
 
 DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
-: DWARFUnit(dwarf2Data) {}
+: m_dwarf2Data(dwarf2Data) {}
 
 DWARFUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
 lldb::offset_t *offset_ptr) {
@@ -60,6 +81,259 @@ DWARFUnitSP DWARFCompileUnit::Extract(Sy
   return nullptr;
 }
 
+void DWARFCompileUnit::ClearDIEs(bool keep_compile_unit_die) {
+  if (m_die_array.size() > 1) {
+// std::vectors never get any smaller when resized to a smaller size,
+// or when clear() or erase() are called, the size will report that it
+// is smaller, but the memory allocated remains intact (call capacity()
+// to see this). So we need to create a temporary vector and swap the
+// contents which will cause just the internal pointers to be swapped
+// so that when "tmp_array" goes out of scope, it will destroy the
+// contents.
+
+// Save at least the compile unit DIE
+DWARFDebugInfoEntry::collection tmp_array;
+m_die_array.swap(tmp_array);
+if (keep_compile_unit_die)
+  m_die_array.push_back(tmp_array.front());
+  }
+
+  if (m_dwo_symbol_file)
+m_dwo_symbol_file->GetCompileUnit()->ClearDIEs(keep_compile_unit_die);
+}
+
+//--
+// ParseCompileUnitDIEsIfNeeded
+//
+// Parses a compile unit and indexes its DIEs if it hasn't already been
+// done.
+//--
+size_t DWARFCompileUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
+  const size_t initial_die_array_size = m_die_array.size();
+  if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 
1)
+return 0; // Already parsed
+
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(
+  func_cat,
+  "%8.8x: DWARFCompileUnit::ExtractDIEsIfNeeded( cu_die_only = %i )",
+  m_offset, cu_die_only);
+
+  // Set the offset to that of the first DIE and calculate the start of the
+  // next compilation unit header.
+  lldb::offset_t offset = GetFirstDIEOffset();
+  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
+
+  DWARFDebugInfoEntry die;
+  // Keep a flat array of the DIE for binary lookup by DIE offset
+  if (!cu_die_only) {
+Log *log(
+LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | 
DWARF_LOG_LOOKUPS));
+if (log) {
+  m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
+  

Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-06 Thread Jan Kratochvil via lldb-commits
On Fri, 06 Apr 2018 18:58:27 +0200, Davide Italiano wrote:
> Yes, I definitely agree. It's clear this needs more discussion, so I
> don't think it's reasonable if we revert this for now and
> reconsider.

I have reverted this https://reviews.llvm.org/D45170 by:
https://reviews.llvm.org/rL329423


> I'll also take a look at the interfaces in LLVM to get a better sense
> of what should be done. If nobody does this, I'll probably get to the
> revert by the end of the day.

I admit my DWARFUnit was in part alignment with LLVM's DWARFUnit (so that
there is one abstract superclass) but at the same time even more
differentiating it (as LLVM has no DWARFPartialUnit and DWARFTypeUnit will
need another intermediate superclass which I call DWARFSomeNameUnit in that
commit text above).

I was sure glad with my DWARFUnit https://reviews.llvm.org/D40466 approval to
be able to commit my DWZ support on top of it making LLDB usable on Red Hat
systems. But I understand LLDB code unification with LLVM is more important.
The DWZ patchset now waits on https://reviews.llvm.org/D40467 approval.
Greg did not like it much so I am now working on new DWARFOneFileOffset being
type-incompatible to dw_offset_t so that both types can be used safely without
accidentally interchanging each other; instead of my current relying on unsafe
type-compatible "dw_offset_t offset" vs. "dw_offset_t file_offset" parameters
naming.

Maybe LLDB should really reuse LLVM DWARFUnit first and I will implement DWZ
already on top of LLVM's DWARFUnit? I have no idea myself now how complex task
is the reuse of LLVM DWARFUnit. For the LLVM DWARFUnit reusal this Greg's
commit would be sure fine; just completely unrelated to why+how I made this
DWARFUnit split myself.


Thanks,
Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-06 Thread Jan Kratochvil via lldb-commits
On Fri, 06 Apr 2018 22:52:05 +0200, Greg Clayton wrote:
> Switching over to the LLVM parser will require some detailed work and will
> take some time.

So should I continue pushing the DWZ patchset even before the reuse of LLVM
DWARFUnit happens?


> That being said, I am confused as to why this was reverted. The code I added
> mirrors the LLVM code a bit better, and yes it will require some reworking
> of your patches.

Planned DWARFPartialUnit needs the inheritance as it was.  As you have moved
most of the data fields back to DWARFUnit I will need to create some new
superclass DWARFSomeNameUnit and move back the data fields from DWARFUnit to
DWARFSomeNameUnit to get:
DWARFUnit->DWARFSomeNameUnit->DWARFCompileUnit
DWARFUnit->DWARFSomeNameUnit->DWARFTypeUnit
DWARFUnit->DWARFPartialUnit

If you expected my DWARFUnit will serve as a superclass for
DWARFCompileUnit+DWARFTypeUnit then you should not have approved it the way I
wrote it as my goal was DWARFPartialUnit which has very different inheritance
requirements than DWARFTypeUnit.


> The DWARFUnit having an accessor to give out
> a DWARFCompileUnit was really confusing and not the right layering.

This is how DWARFPartialUnit works, it is only a DWARFCompileUnit remapped to
new offset.  I do not see how to implement it transparently without the
accessor (and without needlessly copying all the data fields many times into
each DWARFPartialUnit instance).


> So I fixed the layering. I need to submit .debug_types patches and that
> patch was needed for this and now I am back to square one.

I will sure deal with your reverting of my revert.  I just do not like the
words "fixes the layering" as it rather "changes the layering" for different
purposes than my DWARFUnit was implemented for.


Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-07 Thread Jan Kratochvil via lldb-commits
On Sat, 07 Apr 2018 00:52:26 +0200, Greg Clayton wrote:
> Take look at how LLVM does it. I believe my changes mirror that approach.

LLVM does not support partial units so there is nothing to look at there.


> DWARFUnit should be the base class for anything that needs to hand out DIEs.

That's OK for partial units.


> Any specializations should be inheriting from DWARFUnit, like both
> DWARFCompileUnit and DWARFTypeUnit.

I see now the source of misunderstanding:

DWARFCompileUnit = DW_TAG_compile_unit
DWARFTypeUnit = DW_TAG_type_unit
DWARFPartialUnit != DW_TAG_partial_unit

BTW DW_TAG_imported_unit is importing (="caller") tag, not a unit (="callee").

DW_TAG_partial_unit gets read in (by
DWARFDebugInfo::ParseCompileUnitHeadersIfNeeded) as DWARFCompileUnit because
there is no quick enough way to find the difference.  It would require reading
the first DIE tag which means to read and decode .debug_abbrev for each unit
being scanned.

DWARFPartialUnit is used only as a remapping of DWARFCompileUnit to a new
offset without any new data (there is stored only a new remapped offset whose
value is only made up internally in LLDB) at the moment someone uses
DW_TAG_imported_unit for it - at that moment we easily know that unit has to
be DW_TAG_partial_unit.

Therefore DWARFCompileUnit and DWARFTypeUnit both contain some their own data.
But DWARFPartialUnit is just a remapping of DWARFCompileUnit (containing
DW_TAG_partial_unit) to a new offset without any new data. Particularly
m_die_array is not in DWARFPartialUnit.

DWARFTypeUnit can be recognized easily as it is either in .debug_types
(<=DWARF-4) or the unit header contains DW_UT_type (>=DWARF-5).
DWARFPartialUnit (for DW_TAG_partial_unit) cannot be recognized easily first.
Besides that one would need then some DWARFRemappedPartialUnit for what I use
DWARFPartialUnit now.

I have implemented it according to your advice from this mail - at least
according to how I understood it:
[lldb-dev] RFC for DWZ = DW_TAG_imported_unit + DWARF-5 supplementary 
files
https://lists.llvm.org/pipermail/lldb-dev/2017-August/012664.html

It does not try to share anything at AST level, it only shares DWARF data (and
thus DWARFCompileUnit). Given that DWZ finds arbitrary unique DWARF subtrees
I find more logical to decode it at DWARF (and not at AST) level.

You wrote:
# The drawback is this won't allow sharing /tmp/shared1 or /tmp/shared2
# between two different top level DWARF files, but it does allow one
# clang::ASTContext to be used between all of them.

In my implementation /tmp/shared1
(/usr/lib/debug/.dwz/coreutils-8.27-20.fc27.x86_64) is shared between multiple
*.so files (which use DW_TAG_imported_unit) at DWARF level, also
clang::ASTContext is shared.


# SymbolFileDWARFDebugMap makes it lldb::user_id_t contain the CU index in the
# top 32 bits, and the DIE offset within that .o file's DWARF in the bottom 32
# bits. You could do something similar in your case where the top 32 bits is
# the index of the DWARF file in the "dwarf[]" array that would be maintained
# in a new SymbolFileDWARFDWZ subclass.

DW_TAG_imported_unit+DW_TAG_partial_unit can be also used for optimization of
a single file (without /usr/lib/debug/.dwz/* file which is used exclusively
for DW_TAG_partial_unit entries). Additionally the tags can be also used for
recursive inclusion. I haven't found how to use the top 32 bits for that.
I just reserve new remapped offset space for each DW_TAG_imported_unit (in the
bottom 32 bits).

I tried first to implement dw_offset_t caller (=unit with
DW_TAG_imported_unit) to be tracked along any dw_offset_t DIE offset but that
would require huge changes of the DWARF parsing code everywhere.  Also it
cannot work well given the inclusion is recursive (so we would need
std::vector of the callers stack).



> I have no idea what are in your other patches

OK, so there was a gross misunderstanding and my DWARFUnit implemented
something very different from what you expected+approved. I am sure fine with
that but I needed to understand first why you did that big screw up of my
carefully coded patch.


> > This is how DWARFPartialUnit works, it is only a DWARFCompileUnit remapped 
> > to
> > new offset.  I do not see how to implement it transparently without the
> > accessor (and without needlessly copying all the data fields many times into
> > each DWARFPartialUnit instance).
> 
> What extra functions are needed for a partial unit that can't be done in
> a DWARFCompileUnit? Seems like they both contain things, but the partial
> unit can be referenced from compile units. 

DWARFPartialUnit is only a remapping, not really a representation of DWARF
file data.  So DWARFPartialUnit cannot contain its own m_die_array, m_version
and other data members you have moved back to DWARFUnit.


> As we are saying, we are trying to make the layering more like LLVM's
> layering, so that is what I meant by "fix the layering". I believe we should
> strive f

Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-09 Thread Jan Kratochvil via lldb-commits
On Mon, 09 Apr 2018 11:52:28 +0200, Pavel Labath wrote:
> I'm hoping that I can stay clear of
> the ongoing work on dwz&type units, as all of this happens in
> SymbolFileDWARF, which you don't seem to touch that much.

With excluded mass renaming ( https://reviews.llvm.org/D40467 )
and testcases (https://reviews.llvm.org/D40475 https://reviews.llvm.org/D43512 )
DWZ is not just in SymbolFileDWARF.  But I can keep rebasing it.


Jan


D40468..D40474
 include/lldb/Utility/ConstString.h |  12 ++
 include/lldb/Utility/FileSpec.h|   8 +
 source/Plugins/SymbolFile/DWARF/CMakeLists.txt |   2 +
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp   |  19 ++-
 .../Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp  |   3 +-
 .../SymbolFile/DWARF/DWARFASTParserJava.cpp|   3 +-
 .../SymbolFile/DWARF/DWARFASTParserOCaml.cpp   |   3 +-
 .../Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp  | 130 +++-
 source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h |  21 ++-
 .../Plugins/SymbolFile/DWARF/DWARFCompileUnitDWZ.h |  40 +
 source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp   |  16 +-
 source/Plugins/SymbolFile/DWARF/DWARFDIE.h |   3 +
 source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp |  91 +--
 source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h   |  16 ++
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp   |  31 +++-
 .../Plugins/SymbolFile/DWARF/DWARFFileOffset.cpp   |  15 ++
 source/Plugins/SymbolFile/DWARF/DWARFFileOffset.h  |  51 +++
 source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp |  53 ++-
 source/Plugins/SymbolFile/DWARF/DWARFFormValue.h   |   3 +-
 .../Plugins/SymbolFile/DWARF/DWARFPartialUnit.cpp  |  16 ++
 source/Plugins/SymbolFile/DWARF/DWARFPartialUnit.h |  38 +
 source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp  |  82 +-
 source/Plugins/SymbolFile/DWARF/DWARFUnit.h|   9 +-
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   | 170 -
 source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h  |  47 ++
 .../SymbolFile/DWARF/UniqueDWARFASTType.cpp|   1 +
 26 files changed, 819 insertions(+), 64 deletions(-)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-10 Thread Jan Kratochvil via lldb-commits
On Tue, 10 Apr 2018 17:46:55 +0200, Greg Clayton wrote:
> > On Apr 7, 2018, at 2:04 AM, Jan Kratochvil  
> > wrote:
> > DW_TAG_partial_unit gets read in (by
> > DWARFDebugInfo::ParseCompileUnitHeadersIfNeeded) as DWARFCompileUnit because
> > there is no quick enough way to find the difference.  It would require 
> > reading
> > the first DIE tag which means to read and decode .debug_abbrev for each unit
> > being scanned.
> 
> If there is no structural difference other than the first DW_TAG, is there
> a reason you would need to know the difference?

Not really, it also currently does work with DWARFCompileUnit.
Just one could assert that nobody tries to use DIEs directly from that
DWARFCompileUnit without their remapping to DWARFPartialUnit.


> It would be fine to just add extra methods on DWARFCompileUnit that do
> partial unit kind of things if it is a partial unit?

There are not really any extra methods.


> > DWARFPartialUnit is used only as a remapping of DWARFCompileUnit to a new
> > offset without any new data (there is stored only a new remapped offset 
> > whose
> > value is only made up internally in LLDB) at the moment someone uses
> > DW_TAG_imported_unit for it - at that moment we easily know that unit has to
> > be DW_TAG_partial_unit.
> 
> It is remapped to a new offset just to keep LLDB's lldb::user_id_t stuff
> happy?

Yes.

> A partial unit can refer to an external file on disk. The remapping is
> solely making a unique offset by adding an offset to the offset of the
> external file?

Not only that. Even when DWZ does not use any external file then one
DW_TAG_partial_unit is included into many DW_TAG_compile_unit and so DIEs from
that DW_TAG_partial_unit would no longer have unique lldb::user_id_t.
(Although maybe that can be solved by that AST import which I haven't tried.)


> > Therefore DWARFCompileUnit and DWARFTypeUnit both contain some their own 
> > data.
> > But DWARFPartialUnit is just a remapping of DWARFCompileUnit (containing
> > DW_TAG_partial_unit) to a new offset without any new data. Particularly
> > m_die_array is not in DWARFPartialUnit.
> 
> In reading the DWZ it sounded like you can only have 1 external debug info
> file and that external debug info file can't itself refer to another?

Right.

> Is this what the DWARFPartialUnit would be for and this is the only
> remapping that needs to happen?

One also needs to remap all the uses of DW_TAG_partial_unit, which is even
used recursively (one DW_TAG_partial_unit uses DW_TAG_imported_unit for
another DW_TAG_partial_unit etc.) otherwise there happen ambiguous
lldb::user_id_t again.


> > (1) Your DWARFTypeUnit patch - it makes it more aligned to LLVM DWARFUnits.
> > (2) My DWZ patch - it is a new feature with no counterpart in LLVM 
> > DWARFUnits.
> > (3) Replacement of LLDB DWARFUnits with LLVM DWARFUnits.
...
> We need to solve (1) first so we can move onto (2). (3) can wait IMHO, but
> if someone really wants to tackle that it is fine.

Great, thanks. So I would like to somehow adjust (1) so that (2) can be built
on top of it (and not having undo it or create similar parallel
functionality).


> I think I need to see any example of this DWZ so I can intelligently comment
> on thing. The brief description of DWZ at
> http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open
>  doesn't
> help me see how this is actually laid out on disk and who refers to who and
> how things are laid out in the DWARF itself.

You said in another mail you already have DWZ sample.  That dwarfstd reference
above I have commented at:
https://reviews.llvm.org/D32167#1063666


Thanks,
Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-10 Thread Jan Kratochvil via lldb-commits
On Wed, 11 Apr 2018 00:22:45 +0200, Greg Clayton wrote:
> > On Apr 10, 2018, at 2:38 PM, Jan Kratochvil  
> > wrote:
> > Not only that. Even when DWZ does not use any external file then one
> > DW_TAG_partial_unit is included into many DW_TAG_compile_unit and so DIEs 
> > from
> > that DW_TAG_partial_unit would no longer have unique lldb::user_id_t.
> > (Although maybe that can be solved by that AST import which I haven't 
> > tried.)
> 
> Why would we need to inline anything if the partial unit is along side the
> same compile units? Why wouldn't you just use DW_FORM_ref_addr to refer
> directly to any DIEs in a partial unit from a compile unit?

DWZ also uses DW_FORM_ref_addr for exactly that.


> I must be missing something.

DWZ tries to keep the same structure of the DWARF files. If there is some
top-level (under DW_TAG_compile_unit) declaration then it is kept there - by
using DW_TAG_imported_unit.


> I have the multiple files that refer to an external file with one or more
> DW_TAG_partial_unit tags (or is there only ever just one
> DW_TAG_partial_unit?).

There are always many DW_TAG_partial_unit in both the DWZ-common symbol file
and in the main symbol file. Only main symbol file contains many
DW_TAG_compile_unit.


> But I would like to see this inlined DW_TAG_partial_unit along side DWARF.

You mean the real DWZ files? Here is some DWZ-compressed file:
https://people.redhat.com/jkratoch/rustgdbbug.tar.xz
main symbol file: rustgdbbug/a/b/rustdoc-1.24.0-2.fc27.x86_64.debug
DWZ-common symbol file: rustgdbbug/.dwz/rust-1.24.0-2.fc27.x86_64
At least recent binutils readelf -wi decodes it correctly.


> Why would and compile unit just not refer directly to the DIEs? They
> shouldn't have to import anything?

One cannot create new DIE under DW_TAG_compile_unit using just
DW_FORM_ref_addr. That is what DW_TAG_imported_unit is good for.


You are sort of right that one could move all declarations to a single
DW_TAG_partial_unit and use one DW_TAG_imported_unit for that in each
DW_TAG_compile_unit and it is done. But:
(1) GDB would run out of memory when expanding any single CU.
(2) Primitive types (and struct types in plain C) may differ between CUs.
(3) It would make a subtle change of the DWARF structure causing various
incompatibilities or even bugs in various tools (primarily GDB).


> > One also needs to remap all the uses of DW_TAG_partial_unit, which is even
> > used recursively (one DW_TAG_partial_unit uses DW_TAG_imported_unit for
> > another DW_TAG_partial_unit etc.) otherwise there happen ambiguous
> > lldb::user_id_t again.
> 
> If this is all in the same file, then the offsets are all in the
> .debug_info? What am I missing?

LLVM was asserting when I reported the same lldb::user_id_t referenced by
multiple CUs. From our discussion it looks to me that maybe I just did not
have the DWZ common symbol file with proper offset. Otherwise maybe I can
report the same lldb::user_id_t if multiple CUs reference the same DIE from
DW_TAG_partial_unit? As LLVM considers all CUs in a file as the same context.
I will try that again.


Thanks,
Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-10 Thread Jan Kratochvil via lldb-commits
On Wed, 11 Apr 2018 00:53:20 +0200, Jan Kratochvil wrote:
> On Wed, 11 Apr 2018 00:22:45 +0200, Greg Clayton wrote:
> > If this is all in the same file, then the offsets are all in the
> > .debug_info? What am I missing?
> 
> LLVM was asserting when I reported the same lldb::user_id_t referenced by
> multiple CUs. From our discussion it looks to me that maybe I just did not
> have the DWZ common symbol file with proper offset. Otherwise maybe I can
> report the same lldb::user_id_t if multiple CUs reference the same DIE from
> DW_TAG_partial_unit? As LLVM considers all CUs in a file as the same context.
> I will try that again.

In such case if you are sure no real DIEs remapping (to make each inclusion of
DW_TAG_partial_unit unique) is needed then no remapping DWARFPartialUnit is
needed and your removal of my DWARFUnit abstraction by Data() (which
I incorrectly reverted) is also OK.

(Although I will believe it only after I code it; this is what I coded first
but I could have some other bugs there that time.)


Thanks,
Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-11 Thread Jan Kratochvil via lldb-commits
On Wed, 11 Apr 2018 01:24:53 +0200, Jan Kratochvil wrote:
> On Wed, 11 Apr 2018 00:53:20 +0200, Jan Kratochvil wrote:
> > On Wed, 11 Apr 2018 00:22:45 +0200, Greg Clayton wrote:
> > > If this is all in the same file, then the offsets are all in the
> > > .debug_info? What am I missing?
> > 
> > LLVM was asserting when I reported the same lldb::user_id_t referenced by
> > multiple CUs. From our discussion it looks to me that maybe I just did not
> > have the DWZ common symbol file with proper offset. Otherwise maybe I can
> > report the same lldb::user_id_t if multiple CUs reference the same DIE from
> > DW_TAG_partial_unit? As LLVM considers all CUs in a file as the same 
> > context.
> > I will try that again.
> 
> In such case if you are sure no real DIEs remapping (to make each inclusion of
> DW_TAG_partial_unit unique) is needed then no remapping DWARFPartialUnit is
> needed and your removal of my DWARFUnit abstraction by Data() (which
> I incorrectly reverted) is also OK.
> 
> (Although I will believe it only after I code it; this is what I coded first
> but I could have some other bugs there that time.)

I have found that the assertions happened at least due to
SymbolFileDWARF::GetTypeForDIE() which finds a function for the DIE from
DW_AT_partial_unit which is then missing or different than the expected one.
It then asserts somewhere in clang that the context is unexpected.

The problem with non-unique DW_AT_partial_unit DIEs is that
DWARFDebugInfoEntry::GetParent() cannot work for them but LLDB does depend on
that method.

If you think it is workaroundable I can get deeper into it but this is why I
decided each effective (=imported) DIE should have its unique lldb::user_id_t.


Thanks,
Jan


I had in my old notes some such dump:

#0  DWARFCompileUnit::GetDIE (this=0x61124f80, die_offset=139)
at tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:571
#1  0x7fffe2faea83 in DWARFDebugInfo::GetDIE (this=0x60713ff0, 
die_ref=...)
at tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp:274
#2  0x7fffe300a89c in SymbolFileDWARF::GetDIE (this=0x61d08c80, 
die_ref=...)
at tools/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1573
#3  0x7fffe301d581 in 
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (this=0x61d08c80, 
dwarf_decl_ctx=...)
at tools/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3458
#4  0x7fffe2ef936f in DWARFASTParserClang::ParseTypeFromDWARF 
(this=0x61004d40, sc=..., die=..., log=0x0, type_is_new_ptr=0x0)
at tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:727
#5  0x7fffe301e243 in SymbolFileDWARF::ParseType (this=0x61d08c80, 
sc=..., die=..., type_is_new_ptr=0x0)
at tools/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3563
#6  0x7fffe301b054 in SymbolFileDWARF::GetTypeForDIE (this=0x61d08c80, 
die=..., resolve_function_context=false)
at tools/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3106
#7  0x7fffe3009bfd in SymbolFileDWARF::ResolveType (this=0x61d08c80, 
die=..., assert_not_being_parsed=true,
resolve_function_context=false)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r330084 - Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit".

2018-04-14 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sat Apr 14 04:12:52 2018
New Revision: 330084

URL: http://llvm.org/viewvc/llvm-project?rev=330084&view=rev
Log:
Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding 
DWARFTypeUnit".

This patch by Greg Clayton drops the virtualization for DWARFPartialUnit.
The virtualization of DWARFUnit now matches more its LLVM counterpart.
DWZ patchset is going to be implementable without DWARFPartialUnit remapping.
https://reviews.llvm.org/D40474

This reverts commit 329423.
This reapplies commit r329305.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=330084&r1=330083&r2=330084&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Sat Apr 14 
04:12:52 2018
@@ -9,36 +9,15 @@
 
 #include "DWARFCompileUnit.h"
 
-#include "lldb/Core/DumpDataExtractor.h"
-#include "lldb/Core/Mangled.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Host/StringConvert.h"
-#include "lldb/Symbol/CompileUnit.h"
-#include "lldb/Symbol/LineTable.h"
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Utility/Stream.h"
-#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/Timer.h"
-
-#include "DWARFDIECollection.h"
-#include "DWARFDebugAbbrev.h"
-#include "DWARFDebugAranges.h"
-#include "DWARFDebugInfo.h"
-#include "DWARFFormValue.h"
-#include "LogChannelDWARF.h"
-#include "NameToDIE.h"
 #include "SymbolFileDWARF.h"
-#include "SymbolFileDWARFDebugMap.h"
-#include "SymbolFileDWARFDwo.h"
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 extern int g_verbose;
 
 DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
-: m_dwarf2Data(dwarf2Data) {}
+: DWARFUnit(dwarf2Data) {}
 
 DWARFUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
 lldb::offset_t *offset_ptr) {
@@ -81,259 +60,6 @@ DWARFUnitSP DWARFCompileUnit::Extract(Sy
   return nullptr;
 }
 
-void DWARFCompileUnit::ClearDIEs(bool keep_compile_unit_die) {
-  if (m_die_array.size() > 1) {
-// std::vectors never get any smaller when resized to a smaller size,
-// or when clear() or erase() are called, the size will report that it
-// is smaller, but the memory allocated remains intact (call capacity()
-// to see this). So we need to create a temporary vector and swap the
-// contents which will cause just the internal pointers to be swapped
-// so that when "tmp_array" goes out of scope, it will destroy the
-// contents.
-
-// Save at least the compile unit DIE
-DWARFDebugInfoEntry::collection tmp_array;
-m_die_array.swap(tmp_array);
-if (keep_compile_unit_die)
-  m_die_array.push_back(tmp_array.front());
-  }
-
-  if (m_dwo_symbol_file)
-m_dwo_symbol_file->GetCompileUnit()->ClearDIEs(keep_compile_unit_die);
-}
-
-//--
-// ParseCompileUnitDIEsIfNeeded
-//
-// Parses a compile unit and indexes its DIEs if it hasn't already been
-// done.
-//--
-size_t DWARFCompileUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
-  const size_t initial_die_array_size = m_die_array.size();
-  if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 
1)
-return 0; // Already parsed
-
-  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
-  Timer scoped_timer(
-  func_cat,
-  "%8.8x: DWARFCompileUnit::ExtractDIEsIfNeeded( cu_die_only = %i )",
-  m_offset, cu_die_only);
-
-  // Set the offset to that of the first DIE and calculate the start of the
-  // next compilation unit header.
-  lldb::offset_t offset = GetFirstDIEOffset();
-  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
-
-  DWARFDebugInfoEntry die;
-  // Keep a flat array of the DIE for binary lookup by DIE offset
-  if (!cu_die_only) {
-Log *log(
-LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | 
DWARF_LOG_LOOKUPS));
-if (log) {
-  m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
-  log, "DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at "
-   ".debug_info[0x%8.8x]",
-  Ge

Re: [Lldb-commits] [PATCH] D45170: Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

2018-04-14 Thread Jan Kratochvil via lldb-commits
On Wed, 11 Apr 2018 13:46:29 +0200, Jan Kratochvil wrote:
> If you think it is workaroundable I can get deeper into it but this is why I
> decided each effective (=imported) DIE should have its unique lldb::user_id_t.

I have tested some proof of concept on top of my DWZ patchset and it passes
the testsuite even without the DWARFPartialUnit remapping:
https://people.redhat.com/jkratoch/noremap.patch

The non-remapping DWZ patchset still needs some work but I thus do not see
reverting the virtualization for DWARFPartialUnit as its blocker anymore.

Sorry for delaying your work, I have reapplied your patch in its original form
as r330084 = GIT 95be40c27d01549e435cd34cdefc9b8c726a9e36.


Jan
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r331148 - Support reading section ".gnu_debugaltlink"

2018-04-29 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Apr 29 12:47:48 2018
New Revision: 331148

URL: http://llvm.org/viewvc/llvm-project?rev=331148&view=rev
Log:
Support reading section ".gnu_debugaltlink"

Differential revision: https://reviews.llvm.org/D40468

Added:
lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml
Modified:
lldb/trunk/include/lldb/Core/Section.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/lit/Modules/build-id-case.yaml
lldb/trunk/lit/Modules/compressed-sections.yaml
lldb/trunk/source/Core/Section.cpp
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/Section.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Section.h?rev=331148&r1=331147&r2=331148&view=diff
==
--- lldb/trunk/include/lldb/Core/Section.h (original)
+++ lldb/trunk/include/lldb/Core/Section.h Sun Apr 29 12:47:48 2018
@@ -182,6 +182,8 @@ public:
 
   lldb::SectionType GetType() const { return m_type; }
 
+  const char *GetTypeAsCString() const;
+
   lldb::SectionSP GetParent() const { return m_parent_wp.lock(); }
 
   bool IsThreadSpecific() const { return m_thread_specific; }

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=331148&r1=331147&r2=331148&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Sun Apr 29 12:47:48 2018
@@ -656,6 +656,7 @@ enum SectionType {
   eSectionTypeGoSymtab,
   eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
// address
+  eSectionTypeDWARFGNUDebugAltLink,
   eSectionTypeOther
 };
 

Modified: lldb/trunk/lit/Modules/build-id-case.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/build-id-case.yaml?rev=331148&r1=331147&r2=331148&view=diff
==
--- lldb/trunk/lit/Modules/build-id-case.yaml (original)
+++ lldb/trunk/lit/Modules/build-id-case.yaml Sun Apr 29 12:47:48 2018
@@ -5,6 +5,7 @@
 # RUN: lldb-test module-sections %t/stripped.out | FileCheck %s
 
 # CHECK: Name: .debug_frame
+# CHECK-NEXT: Type: dwarf-frame
 # CHECK-NEXT: VM size: 0
 # CHECK-NEXT: File size: 8
 

Modified: lldb/trunk/lit/Modules/compressed-sections.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/compressed-sections.yaml?rev=331148&r1=331147&r2=331148&view=diff
==
--- lldb/trunk/lit/Modules/compressed-sections.yaml (original)
+++ lldb/trunk/lit/Modules/compressed-sections.yaml Sun Apr 29 12:47:48 2018
@@ -18,12 +18,14 @@ Sections:
 Content: deadbeefbaadf00d
 
 # CHECK: Name: .hello_elf
+# CHECK-NEXT: Type: regular
 # CHECK-NEXT: VM size: 0
 # CHECK-NEXT: File size: 28
 # CHECK-NEXT: Data:
 # CHECK-NEXT: 20304050 60708090
 
 # CHECK: Name: .bogus
+# CHECK-NEXT: Type: regular
 # CHECK-NEXT: VM size: 0
 # CHECK-NEXT: File size: 8
 # CHECK-NEXT: Data:

Added: lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml?rev=331148&view=auto
==
--- lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml (added)
+++ lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml Sun Apr 29 12:47:48 2018
@@ -0,0 +1,25 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test module-sections %t | FileCheck %s
+
+# CHECK: Name: .gnu_debugaltlink
+# CHECK-NEXT: Type: dwarf-gnu-debugaltlink
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 8
+
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_DYN
+  Machine: EM_X86_64
+  Entry:   0x07A0
+Sections:
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: DEADBEEFBAADF00D
+  - Name:.gnu_debugaltlink
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: DEADBEEFBAADF00D
+...

Modified: lldb/trunk/source/Core/Section.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=331148&r1=331147&r2=331148&view=diff

[Lldb-commits] [lldb] r331194 - Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matched

2018-04-30 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Apr 30 09:04:32 2018
New Revision: 331194

URL: http://llvm.org/viewvc/llvm-project?rev=331194&view=rev
Log:
Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matched

Code commonly checks if the parent DIE is DW_TAG_compile_unit.
But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ
as DWZ is using DW_TAG_imported_unit only at the top unit level.

Differential revision: https://reviews.llvm.org/D40469

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=331194&r1=331193&r2=331194&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Mon Apr 
30 09:04:32 2018
@@ -1925,7 +1925,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 dw_tag_t sc_parent_tag = sc_parent_die.Tag();
 
 SymbolContextScope *symbol_context_scope = NULL;
-if (sc_parent_tag == DW_TAG_compile_unit) {
+if (sc_parent_tag == DW_TAG_compile_unit ||
+sc_parent_tag == DW_TAG_partial_unit) {
   symbol_context_scope = sc.comp_unit;
 } else if (sc.function != NULL && sc_parent_die) {
   symbol_context_scope =
@@ -2745,7 +2746,8 @@ Function *DWARFASTParserClang::ParseFunc
   Mangled func_name;
   if (mangled)
 func_name.SetValue(ConstString(mangled), true);
-  else if (die.GetParent().Tag() == DW_TAG_compile_unit &&
+  else if ((die.GetParent().Tag() == DW_TAG_compile_unit ||
+die.GetParent().Tag() == DW_TAG_partial_unit) &&
Language::LanguageIsCPlusPlus(die.GetLanguage()) && name &&
strcmp(name, "main") != 0) {
 // If the mangled name is not present in the DWARF, generate the
@@ -3838,6 +3840,7 @@ DWARFASTParserClang::GetClangDeclContext
 bool try_parsing_type = true;
 switch (die.Tag()) {
 case DW_TAG_compile_unit:
+case DW_TAG_partial_unit:
   decl_ctx = m_ast.GetTranslationUnitDecl();
   try_parsing_type = false;
   break;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=331194&r1=331193&r2=331194&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Mon Apr 30 
09:04:32 2018
@@ -431,7 +431,8 @@ TypeSP DWARFASTParserGo::ParseTypeFromDW
 dw_tag_t sc_parent_tag = sc_parent_die.Tag();
 
 SymbolContextScope *symbol_context_scope = NULL;
-if (sc_parent_tag == DW_TAG_compile_unit) {
+if (sc_parent_tag == DW_TAG_compile_unit ||
+sc_parent_tag == DW_TAG_partial_unit) {
   symbol_context_scope = sc.comp_unit;
 } else if (sc.function != NULL && sc_parent_die) {
   symbol_context_scope =

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp?rev=331194&r1=331193&r2=331194&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp Mon Apr 
30 09:04:32 2018
@@ -324,7 +324,8 @@ lldb::TypeSP DWARFASTParserJava::ParseTy
   dw_tag_t sc_parent_tag = sc_parent_die.Tag();
 
   SymbolContextScope *symbol_context_scope = nullptr;
-  if (sc_parent_tag == DW_TAG_compile_unit) {
+  if (sc_parent_tag == DW_TAG_compile_unit ||
+  sc_parent_tag == DW_TAG_partial_unit) {
 symbol_context_scope = sc.comp_unit;
   } else if (sc.function != nullptr && sc_parent_die) {
 symbol_context_scope =

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp?rev=331194&r1=331193&r2=331194&view=diff

[Lldb-commits] [lldb] r331229 - Protect DWARFCompileUnit::m_die_array by a new mutex

2018-04-30 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Apr 30 14:37:30 2018
New Revision: 331229

URL: http://llvm.org/viewvc/llvm-project?rev=331229&view=rev
Log:
Protect DWARFCompileUnit::m_die_array by a new mutex

Multiple DW_TAG_compile_unit being indexed in a multithreaded way can request
reading of the same DW_TAG_partial_unit.

Unfortunately one cannot detect DWZ file ahead of time to disable such locking
overhead as DWARFCompileUnit::Extract does not read the first DIE which is the
only place one could find early enough if the DWARF file is using any
DW_TAG_partial_unit.

Differential revision: https://reviews.llvm.org/D40470

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=331229&r1=331228&r2=331229&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Mon Apr 30 
14:37:30 2018
@@ -41,9 +41,20 @@ DWARFUnit::~DWARFUnit() {}
 // Parses a compile unit and indexes its DIEs if it hasn't already been done.
 //--
 size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
-  const size_t initial_die_array_size = m_die_array.size();
-  if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 
1)
-return 0; // Already parsed
+  size_t initial_die_array_size;
+  auto already_parsed = [cu_die_only, &initial_die_array_size, this]() -> bool 
{
+initial_die_array_size = m_die_array.size();
+return (cu_die_only && initial_die_array_size > 0)
+|| initial_die_array_size > 1;
+  };
+  {
+llvm::sys::ScopedReader lock(m_extractdies_mutex);
+if (already_parsed())
+  return 0;
+  }
+  llvm::sys::ScopedWriter lock(m_extractdies_mutex);
+  if (already_parsed())
+return 0;
 
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(
@@ -304,6 +315,8 @@ void DWARFUnit::SetAddrBase(dw_addr_t ad
 
 void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
   if (m_die_array.size() > 1) {
+llvm::sys::ScopedWriter lock(m_extractdies_mutex);
+
 // std::vectors never get any smaller when resized to a smaller size, or
 // when clear() or erase() are called, the size will report that it is
 // smaller, but the memory allocated remains intact (call capacity() to see

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=331229&r1=331228&r2=331229&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Mon Apr 30 14:37:30 
2018
@@ -13,6 +13,7 @@
 #include "DWARFDIE.h"
 #include "DWARFDebugInfoEntry.h"
 #include "lldb/lldb-enumerations.h"
+#include "llvm/Support/RWMutex.h"
 
 class DWARFUnit;
 class DWARFCompileUnit;
@@ -160,6 +161,7 @@ protected:
   // If this is a dwo compile unit this is the offset of the base compile unit
   // in the main object file
   dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET;
+  llvm::sys::RWMutex m_extractdies_mutex;
 
   static void
   IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r309581 - Fix LLDB crash accessing unknown DW_FORM_* attributes

2017-08-09 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Jul 31 10:02:52 2017
New Revision: 309581

URL: http://llvm.org/viewvc/llvm-project?rev=309581&view=rev
Log:
Fix LLDB crash accessing unknown DW_FORM_* attributes

Current LLDB (that is without DWZ support) crashes accessing Fedora debug info:
READ of size 8 at 0x6020ffc8 thread T0
#0 in DWARFDebugInfoEntry::BuildAddressRangeTable(SymbolFileDWARF*, 
DWARFCompileUnit const*, DWARFDebugAranges*) const 
tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1336

Greg Clayton: We will need a warning to be emitted in
SymbolFileDWARF::CalculateAbilities() stating we won't parse the DWARF due to
"unsupported DW_FORM value of 0x1f20".

Patch has been mostly written by Greg Clayton.

Differential revision: https://reviews.llvm.org/D35622

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=309581&r1=309580&r2=309581&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Mon Jul 31 
10:02:52 2017
@@ -98,6 +98,21 @@ dw_uleb128_t DWARFAbbreviationDeclaratio
 }
 
 //--
+// DWARFAbbreviationDeclarationSet::GetUnsupportedForms()
+//--
+void DWARFAbbreviationDeclarationSet::GetUnsupportedForms(
+std::set &invalid_forms) const {
+  for (const auto &abbr_decl : m_decls) {
+const size_t num_attrs = abbr_decl.NumAttributes();
+for (size_t i=0; isecond);
   return NULL;
 }
+
+//--
+// DWARFDebugAbbrev::GetUnsupportedForms()
+//--
+void DWARFDebugAbbrev::GetUnsupportedForms(
+std::set &invalid_forms) const {
+  for (const auto &pair : m_abbrevCollMap)
+pair.second.GetUnsupportedForms(invalid_forms);
+}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h?rev=309581&r1=309580&r2=309581&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h Mon Jul 31 
10:02:52 2017
@@ -41,6 +41,7 @@ public:
   // void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
   dw_uleb128_t
   AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl);
+  void GetUnsupportedForms(std::set &invalid_forms) const;
 
   const DWARFAbbreviationDeclaration *
   GetAbbreviationDeclaration(dw_uleb128_t abbrCode) const;
@@ -65,6 +66,7 @@ public:
   GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const;
   void Dump(lldb_private::Stream *s) const;
   void Parse(const lldb_private::DWARFDataExtractor &data);
+  void GetUnsupportedForms(std::set &invalid_forms) const;
 
 protected:
   DWARFAbbreviationDeclarationCollMap m_abbrevCollMap;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=309581&r1=309580&r2=309581&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Mon Jul 31 
10:02:52 2017
@@ -725,3 +725,39 @@ int DWARFFormValue::Compare(const DWARFF
   }
   return -1;
 }
+
+bool DWARFFormValue::FormIsSupported(dw_form_t form) {
+  switch (form) {
+case DW_FORM_addr:
+case DW_FORM_block2:
+case DW_FORM_block4:
+case DW_FORM_data2:
+case DW_FORM_data4:
+case DW_FORM_data8:
+case DW_FORM_string:
+case DW_FORM_block:
+case DW_FORM_block1:
+case DW_FORM_data1:
+case DW_FORM_flag:
+case DW_FORM_sdata:
+case DW_FORM_strp:
+case DW_FORM_udata:
+case DW_FORM_ref_addr:
+case DW_FORM_ref1:
+case DW_FORM_ref2:
+case DW_FORM_ref4:
+case DW_FORM_ref8:
+case DW_FORM_ref_udata:
+case DW_FORM_indirect:
+case DW_FORM_sec_offset:
+case DW_FORM_exprloc:
+case DW_FORM_flag_present:
+case DW_FORM_ref_sig8:
+case DW_FORM_GNU_str_index:
+case DW_FORM_GNU_addr_index:
+  retu

[Lldb-commits] [lldb] r312562 - Fix DW_FORM_strp parsing

2017-09-05 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Sep  5 12:01:01 2017
New Revision: 312562

URL: http://llvm.org/viewvc/llvm-project?rev=312562&view=rev
Log:
Fix DW_FORM_strp parsing

Differential revision: https://reviews.llvm.org/D37441

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=312562&r1=312561&r2=312562&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Sep  
5 12:01:01 2017
@@ -161,9 +161,9 @@ bool DWARFDebugInfoEntry::FastExtract(
   case DW_FORM_strp:
   case DW_FORM_sec_offset:
 if (cu->IsDWARF64())
-  debug_info_data.GetU64(offset_ptr);
+  debug_info_data.GetU64(&offset);
 else
-  debug_info_data.GetU32(offset_ptr);
+  debug_info_data.GetU32(&offset);
 break;
 
   default:
@@ -325,9 +325,9 @@ bool DWARFDebugInfoEntry::Extract(Symbol
   case DW_FORM_strp:
   case DW_FORM_sec_offset:
 if (cu->IsDWARF64())
-  debug_info_data.GetU64(offset_ptr);
+  debug_info_data.GetU64(&offset);
 else
-  debug_info_data.GetU32(offset_ptr);
+  debug_info_data.GetU32(&offset);
 break;
 
   default:


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r353280 - Fix strlen() of unbound array undefined behavior

2019-02-06 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Feb  6 00:44:13 2019
New Revision: 353280

URL: http://llvm.org/viewvc/llvm-project?rev=353280&view=rev
Log:
Fix strlen() of unbound array undefined behavior

LLDB testsuite fails when built by GCC8 on:
  LLDB :: SymbolFile/DWARF/find-basic-namespace.cpp

This is because this code in LLDB codebase has undefined behavior:

  #include 
  #include 
  // lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:1731
  static struct section_64 {
char sectname[16];
char segname[16];
  } sect64 = { 
{'_','_','a','p','p','l','e','_','n','a','m','e','s','p','a','c'}, "__DWARF" };
  int main() {
return std::min(strlen(sect64.sectname), sizeof(sect64.sectname));
  }

It has been discussed as a (false) bugreport to GCC:
  wrong-code: LLDB testcase fails: SymbolFile/DWARF/find-basic-namespace.cpp
  https://bugzilla.redhat.com/show_bug.cgi?id=1672436

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

Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Utility/ConstString.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=353280&r1=353279&r2=353280&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Feb  6 
00:44:13 2019
@@ -1609,8 +1609,7 @@ void ObjectFileMachO::ProcessSegmentComm
   bool add_section = true;
   bool add_to_unified = true;
   ConstString const_segname(
-  load_cmd.segname,
-  std::min(strlen(load_cmd.segname), sizeof(load_cmd.segname)));
+  load_cmd.segname, strnlen(load_cmd.segname, sizeof(load_cmd.segname)));
 
   SectionSP unified_section_sp(
   context.UnifiedList.FindSectionByName(const_segname));
@@ -1729,8 +1728,7 @@ void ObjectFileMachO::ProcessSegmentComm
 
 if (add_section) {
   ConstString section_name(
-  sect64.sectname,
-  std::min(strlen(sect64.sectname), sizeof(sect64.sectname)));
+  sect64.sectname, strnlen(sect64.sectname, sizeof(sect64.sectname)));
   if (!const_segname) {
 // We have a segment with no name so we need to conjure up segments
 // that correspond to the section's segname if there isn't already such

Modified: lldb/trunk/source/Utility/ConstString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ConstString.cpp?rev=353280&r1=353279&r2=353280&view=diff
==
--- lldb/trunk/source/Utility/ConstString.cpp (original)
+++ lldb/trunk/source/Utility/ConstString.cpp Wed Feb  6 00:44:13 2019
@@ -143,7 +143,7 @@ public:
   const char *GetConstTrimmedCStringWithLength(const char *cstr,
size_t cstr_len) {
 if (cstr != nullptr) {
-  const size_t trimmed_len = std::min(strlen(cstr), cstr_len);
+  const size_t trimmed_len = strnlen(cstr, cstr_len);
   return GetConstCStringWithLength(cstr, trimmed_len);
 }
 return nullptr;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r354225 - Remove unused extern declaration as removed by D32167

2019-02-17 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Feb 17 09:12:37 2019
New Revision: 354225

URL: http://llvm.org/viewvc/llvm-project?rev=354225&view=rev
Log:
Remove unused extern declaration as removed by D32167

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=354225&r1=354224&r2=354225&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Sun Feb 17 
09:12:37 2019
@@ -14,8 +14,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-extern int g_verbose;
-
 DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
 : DWARFUnit(dwarf2Data) {}
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r354425 - [TestModuleCXX] Use UNSUPPORTED instead of REQUIRES

2019-02-20 Thread Jan Kratochvil via lldb-commits
On Wed, 20 Feb 2019 02:49:16 +0100, Jonas Devlieghere via lldb-commits wrote:
> Author: jdevlieghere
> Date: Tue Feb 19 17:49:16 2019
> New Revision: 354425
...
> --- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
> +++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Tue Feb 19 17:49:16 
> 2019
> @@ -1,4 +1,4 @@
> -# REQUIRES: nowindows
> +# UNSUPPORTED: system-windows

It has started failing on Linux (Fedora 29 x86_64).  Is it expected?
I haven't tried to debug it yet.


Jan


--
[bash]jkrat...@host1.jankratochvil.net:/home/jkratoch/redhat/llvm-monorepo-clang#
 ./bin/llvm-lit -sv tools/lldb/lit --filter TestModuleCXX;echo $?
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using clang: /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using ld.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld.lld
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using lld-link: /home/jkratoch/redhat/llvm-monorepo-clang/bin/lld-link
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using ld64.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld64.lld
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using wasm-ld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/wasm-ld
FAIL: LLDB :: Reproducer/Modules/TestModuleCXX.test (1 of 1)
 TEST 'LLDB :: Reproducer/Modules/TestModuleCXX.test' 
FAILED 
Script:
--
: 'RUN: at line 4';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 5';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
: 'RUN: at line 6';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
: 'RUN: at line 9';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 10';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
: 'RUN: at line 11';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
: 'RUN: at line 12';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/main.cpp 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 13';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Foo.h 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 14';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Bar.h 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 15';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/module.modulemap
 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 18';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang 
-pthread 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/main.cpp
 -g -fmodules -fcxx-modules 
-fmodules-cache-path=/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
 -o 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
: 'RUN: at line 21';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/lldb 
--no-lldbinit -S /home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init -x 
-b -o 'settings set symbols.clang-modules-cache-path 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache'
 -s 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/ModuleCXX.in
 --capture 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro
 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
 | /home/jkratoch/redhat/llvm-monorepo-clang/bin/FileCheck 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/TestModuleCXX.test
 --check-prefix CAPTURE
: 'RUN: at line 24';   cat 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro/files.yaml
 | /home/jkratoch/redhat/llvm-monorepo-clang/bin/Fil

[Lldb-commits] [lldb] r354556 - testsuite: Fix TestCompDirSymLink and TestSourceManager on Linux with symlinked build dir

2019-02-21 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu Feb 21 01:05:27 2019
New Revision: 354556

URL: http://llvm.org/viewvc/llvm-project?rev=354556&view=rev
Log:
testsuite: Fix TestCompDirSymLink and TestSourceManager on Linux with symlinked 
build dir

Getting failure when building in a directory which is symlinked elsewhere:

Failing Tests (1):
lldb-Suite :: 
functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
lldb-Suite :: source-manager/TestSourceManager.py

For TestCompDirSymLink:
--
runCmd: file 
.../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink
output: Current executable set to 
'.../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink'
 (x86_64).
runCmd: settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths 
/proc/self/cwd
output: None
runCmd: breakpoint set -f 
".../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/relative.cpp"
 -l 11
output: Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.

It is because /proc/self/cwd (used above for 
plugin.symbol-file.dwarf.comp-dir-symlink-paths) points to an already resolved 
directory:

(cd /tmp;mkdir real;ln -s real symlink;cd symlink;ls -l /proc/self/cwd)
lrwxrwxrwx 1 jkratoch jkratoch 0 Feb 20 19:55 /proc/self/cwd -> /tmp/real/
--

For TestSourceManager the resolving is done by 'make -C' as found by Pavel 
Labath.

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py

lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py?rev=354556&r1=354555&r2=354556&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
 Thu Feb 21 01:05:27 2019
@@ -48,6 +48,8 @@ class CompDirSymLinkTestCase(TestBase):
 "settings set %s %s" %
 (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
 src_path = self.getBuildArtifact(_SRC_FILE)
+# /proc/self/cwd points to a realpath form of current directory.
+src_path = os.path.realpath(src_path)
 lldbutil.run_break_set_by_file_and_line(self, src_path, self.line)
 
 @skipIf(hostoslist=["windows"])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py?rev=354556&r1=354555&r2=354556&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py 
Thu Feb 21 01:05:27 2019
@@ -158,12 +158,15 @@ class SourceManagerTestCase(TestBase):
 error=True,
 substrs=['''error: the replacement path doesn't exist: 
"/q/r/s/t/u"'''])
 
+# 'make -C' has resolved current directory to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 # Set target.source-map settings.
 self.runCmd("settings set target.source-map %s %s" %
-(self.getBuildDir(), hidden))
+(builddir_real, hidden_real))
 # And verify that the settings work.
 self.expect("settings show target.source-map",
-substrs=[self.getBuildDir(), hidden])
+substrs=[builddir_real, hidden_real])
 
 # Display main() and verify that the source mapping has been kicked in.
 self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
@@ -238,11 +241,14 @@ class SourceManagerTestCase(TestBase):
 self.build()
 hidden = self.getBuildArtifact("hidden")
 lldbutil.mkdir_p(hidden)
+# 'make -C' has resolved current directory to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 self.runCmd("settings set target.source-map %

[Lldb-commits] [lldb] r355554 - Sanity check --max-gdbserver-port

2019-03-06 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Mar  6 13:52:19 2019
New Revision: 34

URL: http://llvm.org/viewvc/llvm-project?rev=34&view=rev
Log:
Sanity check --max-gdbserver-port

In mail
[lldb-dev] Remote debugging a docker process
https://lists.llvm.org/pipermail/lldb-dev/2019-March/014795.html
user was confused by --min-gdbserver-port and --max-gdbserver-port options
being ignored. I think there is even a bug that --max-gdbserver-port is upper
exclusive limit (and not upper inclusive limit appropriate for max).

At least this patch should catch such mistake by an error message. The question
is whether --max-gdbserver-port should not be changed to really be max and not
max+1 but that would break backward compatibility.

Now the mail example does produce:
error: --min-gdbserver-port (5001) is not lower than 
--max-gdbserver-port (5001)

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

Added:
lldb/trunk/lit/tools/lldb-server/
lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test
Modified:
lldb/trunk/lit/helper/toolchain.py
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/lit/helper/toolchain.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/toolchain.py?rev=34&r1=33&r2=34&view=diff
==
--- lldb/trunk/lit/helper/toolchain.py (original)
+++ lldb/trunk/lit/helper/toolchain.py Wed Mar  6 13:52:19 2019
@@ -45,6 +45,10 @@ def use_lldb_substitutions(config):
   command=FindTool(dsname),
   extra_args=dsargs,
   unresolved='ignore'),
+ToolSubst('%platformserver',
+  command=FindTool('lldb-server'),
+  extra_args=['platform'],
+  unresolved='ignore'),
 'lldb-test',
 'lldb-instr',
 ToolSubst('%build',

Added: lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test?rev=34&view=auto
==
--- lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test (added)
+++ lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test Wed Mar  6 13:52:19 
2019
@@ -0,0 +1,2 @@
+# RUN: %platformserver p --server --listen :1234 --min-gdbserver-port 1234 
--max-gdbserver-port 1234 2>&1 | FileCheck %s
+# CHECK: error: --min-gdbserver-port (1234) is not lower than 
--max-gdbserver-port (1234)

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=34&r1=33&r2=34&view=diff
==
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Wed Mar  6 13:52:19 2019
@@ -241,11 +241,11 @@ int main_platform(int argc, char *argv[]
 return -1;
 
   // Make a port map for a port range that was specified.
-  if (min_gdbserver_port < max_gdbserver_port) {
+  if (min_gdbserver_port && min_gdbserver_port < max_gdbserver_port) {
 for (uint16_t port = min_gdbserver_port; port < max_gdbserver_port; ++port)
   gdbserver_portmap[port] = LLDB_INVALID_PROCESS_ID;
-  } else if (min_gdbserver_port != max_gdbserver_port) {
-fprintf(stderr, "error: --min-gdbserver-port (%u) is greater than "
+  } else if (min_gdbserver_port || max_gdbserver_port) {
+fprintf(stderr, "error: --min-gdbserver-port (%u) is not lower than "
 "--max-gdbserver-port (%u)\n",
 min_gdbserver_port, max_gdbserver_port);
 option_error = 3;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r355579 - Skip TestGdbserverPort.test on Windows

2019-03-06 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Mar  6 19:41:00 2019
New Revision: 355579

URL: http://llvm.org/viewvc/llvm-project?rev=355579&view=rev
Log:
Skip TestGdbserverPort.test on Windows

lldb/cmake/modules/LLDBConfig.cmake does not build lldb-server on Windows:
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
set(LLDB_CAN_USE_LLDB_SERVER 1)

Also do not append 'platform' parameter twice - although that was quietly
ignored.

Modified:
lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test

Modified: lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test?rev=355579&r1=355578&r2=355579&view=diff
==
--- lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test (original)
+++ lldb/trunk/lit/tools/lldb-server/TestGdbserverPort.test Wed Mar  6 19:41:00 
2019
@@ -1,2 +1,4 @@
-# RUN: %platformserver p --server --listen :1234 --min-gdbserver-port 1234 
--max-gdbserver-port 1234 2>&1 | FileCheck %s
+# Windows does not build lldb-server.
+# UNSUPPORTED: system-windows
+# RUN: %platformserver --server --listen :1234 --min-gdbserver-port 1234 
--max-gdbserver-port 1234 2>&1 | FileCheck %s
 # CHECK: error: --min-gdbserver-port (1234) is not lower than 
--max-gdbserver-port (1234)


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r355611 - Fix TestDataFormatter.test uninitialized variable

2019-03-07 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu Mar  7 09:35:47 2019
New Revision: 355611

URL: http://llvm.org/viewvc/llvm-project?rev=355611&view=rev
Log:
Fix TestDataFormatter.test uninitialized variable

After D55626 I see a failure in my Fedora buildbot.

There is uninitialized variable as the Foo constructor has not been run and foo
is an autovariable.

(lldb) breakpoint set -f foo.cpp -l 11
Breakpoint 1: where = TestDataFormatter.test.tmp.out`main + 30 at foo.cpp:11:7, 
address = 0x0040112e
(lldb) run
Process 801065 stopped
* thread #1, name = 'TestDataFormatt', stop reason = breakpoint 1.1
frame #0: 0x0040112e TestDataFormatter.test.tmp.out`main(argc=1, 
argv=0x7fffcc48) at foo.cpp:11:7
   8};
   9
   10   int main(int argc, char **argv) {
-> 11 Foo foo(1, 2.22);
   12 return 0;
   13   }

Process 801065 launched: 
'.../tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out'
 (x86_64)
(lldb) frame var
(int) argc = 1
(char **) argv = 0x7fffcc48
(Foo) foo = (m_i = 4198432, m_d = 0)

While the testcase expects m_i will be 0.

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

Modified:
lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp
lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test

Modified: lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in?rev=355611&r1=355610&r2=355611&view=diff
==
--- lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in Thu Mar  
7 09:35:47 2019
@@ -1,7 +1,7 @@
 breakpoint set -f foo.cpp -l 11
 run
-frame var
+frame var foo
 next
-frame var
+frame var foo
 cont
 reproducer generate

Modified: lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp?rev=355611&r1=355610&r2=355611&view=diff
==
--- lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp Thu Mar  7 
09:35:47 2019
@@ -8,6 +8,6 @@ private:
 };
 
 int main(int argc, char **argv) {
-  Foo foo(1, 2.22);
+  static Foo foo(1, 2.22);
   return 0;
 }

Modified: lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test?rev=355611&r1=355610&r2=355611&view=diff
==
--- lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test Thu Mar  7 
09:35:47 2019
@@ -3,7 +3,7 @@
 # This tests that data formatters continue to work when replaying a reproducer.
 
 # RUN: rm -rf %t.repro
-# RUN: %clang %S/Inputs/foo.cpp -g -o %t.out
+# RUN: %clangxx %S/Inputs/foo.cpp -g -o %t.out
 
 # RUN: %lldb -x -b -s %S/Inputs/DataFormatter.in --capture %t.repro %t.out | 
FileCheck %s
 # RUN: %lldb --replay %t.repro | FileCheck %s


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r357678 - Add dropped ManualDWARFIndex assert()

2019-04-04 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu Apr  4 02:24:02 2019
New Revision: 357678

URL: http://llvm.org/viewvc/llvm-project?rev=357678&view=rev
Log:
Add dropped ManualDWARFIndex assert()

D47253 dropped this assertion.

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp?rev=357678&r1=357677&r2=357678&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Thu Apr  4 
02:24:02 2019
@@ -92,6 +92,9 @@ void ManualDWARFIndex::Index() {
 }
 
 void ManualDWARFIndex::IndexUnit(DWARFUnit &unit, IndexSet &set) {
+  assert(!unit.GetSymbolFileDWARF()->GetBaseCompileUnit() &&
+  "DWARFUnit associated with .dwo or .dwp should not be indexed directly");
+
   Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS);
 
   if (log) {


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ff94f60 - [lldb] [testsuite] Fix false failures on "\n" regex match

2021-09-12 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-09-13T07:35:12+02:00
New Revision: ff94f6024082ecd6b8a236b0953d3ce2d240cc64

URL: 
https://github.com/llvm/llvm-project/commit/ff94f6024082ecd6b8a236b0953d3ce2d240cc64
DIFF: 
https://github.com/llvm/llvm-project/commit/ff94f6024082ecd6b8a236b0953d3ce2d240cc64.diff

LOG: [lldb] [testsuite] Fix false failures on "\n" regex match

Regex is matching a binary so it needs `re.DOTALL`.
vFile:fstat packet data ATTACHMENT is not hex-encoded but it is only
escaped.

It is difficult to reproduce, it came from buildbot:
  https://lab.llvm.org/staging/#/builders/16/builds/10597

 TEST 'lldb-api :: 
tools/lldb-server/TestGdbRemotePlatformFile.py' FAILED 
FAIL: test_platform_file_fstat_llgs 
(TestGdbRemotePlatformFile.TestGdbRemotePlatformFile)
--
Traceback (most recent call last):
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", 
line 52, in test_method
return attrvalue(self)
  File "lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py", line 
259, in test_platform_file_fstat
context = self.expect_gdbremote_sequence()
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", 
line 621, in expect_gdbremote_sequence
return expect_lldb_gdbserver_replay(
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", 
line 198, in expect_lldb_gdbserver_replay
context = sequence_entry.assert_match(
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", 
line 479, in assert_match
return self._assert_regex_match(asserter, actual_packet, context)
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", 
line 446, in _assert_regex_match
asserter.fail(
AssertionError: regex '^\$F([0-9a-fA-F]+);(.*)#[0-9a-fA-F]{2}$' failed to match 
against content '$F40;^@^@^@ ^@
^C<8d>^@^@<81><80>^@^@^@^A^@^@^CX^@^@^CX^@^@^@^@^@^@^@^@^@^@^@^W^@^@^@^@^@^@^P^@^@^@^@^@^@^@^@
a=XXa=XXa=XX#6b'

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
index 4323e97126d01..12dafd15283bc 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
@@ -759,7 +759,7 @@ def add_log_lines(self, log_lines, remote_input_is_read):
 
 # Compile the regex.
 if regex and (isinstance(regex, str)):
-regex = re.compile(regex)
+regex = re.compile(regex, re.DOTALL)
 
 if _is_packet_lldb_gdbserver_input(
 direction, remote_input_is_read):



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e93bade - [nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die

2021-09-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-09-17T21:51:36+02:00
New Revision: e93baded39578d62139656833c9b926d5cf78ba5

URL: 
https://github.com/llvm/llvm-project/commit/e93baded39578d62139656833c9b926d5cf78ba5
DIFF: 
https://github.com/llvm/llvm-project/commit/e93baded39578d62139656833c9b926d5cf78ba5.diff

LOG: [nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die

In whole GIT history this map has been always only written but never read.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 0bab2b3ae7512..115047c97ca3f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3137,7 +3137,6 @@ clang::Decl 
*DWARFASTParserClang::GetClangDeclForDIE(const DWARFDIE &die) {
   if (DWARFDIE spec_die = die.GetReferencedDIE(DW_AT_specification)) {
 clang::Decl *decl = GetClangDeclForDIE(spec_die);
 m_die_to_decl[die.GetDIE()] = decl;
-m_decl_to_die[decl].insert(die.GetDIE());
 return decl;
   }
 
@@ -3145,7 +3144,6 @@ clang::Decl 
*DWARFASTParserClang::GetClangDeclForDIE(const DWARFDIE &die) {
   die.GetReferencedDIE(DW_AT_abstract_origin)) {
 clang::Decl *decl = GetClangDeclForDIE(abstract_origin_die);
 m_die_to_decl[die.GetDIE()] = decl;
-m_decl_to_die[decl].insert(die.GetDIE());
 return decl;
   }
 
@@ -3210,7 +3208,6 @@ clang::Decl 
*DWARFASTParserClang::GetClangDeclForDIE(const DWARFDIE &die) {
   }
 
   m_die_to_decl[die.GetDIE()] = decl;
-  m_decl_to_die[decl].insert(die.GetDIE());
 
   return decl;
 }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 9bf6240b75544..332056ddcce1a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -73,7 +73,6 @@ class DWARFASTParserClang : public DWARFASTParser {
   class DelayedAddObjCClassProperty;
   typedef std::vector DelayedPropertyList;
 
-  typedef llvm::SmallPtrSet DIEPointerSet;
   typedef llvm::DenseMap
   DIEToDeclContextMap;
   typedef std::multimap
@@ -83,11 +82,9 @@ class DWARFASTParserClang : public DWARFASTParser {
   DIEToModuleMap;
   typedef llvm::DenseMap
   DIEToDeclMap;
-  typedef llvm::DenseMap DeclToDIEMap;
 
   lldb_private::TypeSystemClang &m_ast;
   DIEToDeclMap m_die_to_decl;
-  DeclToDIEMap m_decl_to_die;
   DIEToDeclContextMap m_die_to_decl_ctx;
   DeclContextToDIEMap m_decl_ctx_to_die;
   DIEToModuleMap m_die_to_module;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] fffb975 - [lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite TestDataFormatterStdUniquePtr.py

2021-06-15 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-06-15T11:19:20+02:00
New Revision: fffb975095119adb5f91be4e3c83ac0cb4b1602c

URL: 
https://github.com/llvm/llvm-project/commit/fffb975095119adb5f91be4e3c83ac0cb4b1602c
DIFF: 
https://github.com/llvm/llvm-project/commit/fffb975095119adb5f91be4e3c83ac0cb4b1602c.diff

LOG: [lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite 
TestDataFormatterStdUniquePtr.py

libstdc++ since version 11 has a conditional compilation based on
[[no_unique_address]] availability whether one element is either
inherited or put there as a field with [[no_unique_address]].

The code comment is by teemperor.

Reviewed By: teemperor

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

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
index 0b34b4e2fc899..79e864a2cbd5e 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -99,9 +99,17 @@ bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
   if (ptr_obj)
 m_ptr_obj = ptr_obj->Clone(ConstString("pointer")).get();
 
-  ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
-  if (del_obj)
-m_del_obj = del_obj->Clone(ConstString("deleter")).get();
+  // Add a 'deleter' child if there was a non-empty deleter type specified.
+  //
+  // The object might have size=1 in the TypeSystem but occupies no dedicated
+  // storage due to no_unique_address, so infer the actual size from the total
+  // size of the unique_ptr class. If sizeof(unique_ptr) == sizeof(void*) then
+  // the deleter is empty and should be hidden.
+  if (tuple_sp->GetByteSize() > ptr_obj->GetByteSize()) {
+ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
+if (del_obj)
+  m_del_obj = del_obj->Clone(ConstString("deleter")).get();
+  }
 
   if (m_ptr_obj) {
 Status error;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e825c24 - [lldb] Fix Recognizer/assert.test with glibc-2.33.9000-31.fc35.x86_64

2021-07-01 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-07-01T09:16:07+02:00
New Revision: e825c244b6063344ae726600d6a1225a05788dfa

URL: 
https://github.com/llvm/llvm-project/commit/e825c244b6063344ae726600d6a1225a05788dfa
DIFF: 
https://github.com/llvm/llvm-project/commit/e825c244b6063344ae726600d6a1225a05788dfa.diff

LOG: [lldb] Fix Recognizer/assert.test with glibc-2.33.9000-31.fc35.x86_64

While on regular Linux system (Fedora 34 GA, not updated):

* thread #1, name = '1', stop reason = hit program assert
frame #0: 0x77e242a2 libc.so.6`raise + 322
frame #1: 0x77e0d8a4 libc.so.6`abort + 278
frame #2: 0x77e0d789 libc.so.6`__assert_fail_base.cold + 15
frame #3: 0x77e1ca16 libc.so.6`__assert_fail + 70
  * frame #4: 0x004011bd 1`main at assert.c:7:3

On Fedora 35 pre-release one gets:

* thread #1, name = '1', stop reason = signal SIGABRT
  * frame #0: 0x77e48ee3 libc.so.6`pthread_kill@GLIBC_2.2.5 + 67
frame #1: 0x77dfb986 libc.so.6`raise + 22
frame #2: 0x77de5806 libc.so.6`abort + 230
frame #3: 0x77de571b libc.so.6`__assert_fail_base.cold + 15
frame #4: 0x77df4646 libc.so.6`__assert_fail + 70
frame #5: 0x004011bd 1`main at assert.c:7:3

I did not write a testcase as one needs the specific glibc. An
artificial test would just copy the changed source.

Reviewed By: mib

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

Added: 


Modified: 
lldb/source/Target/AssertFrameRecognizer.cpp

Removed: 




diff  --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb/source/Target/AssertFrameRecognizer.cpp
index cb671040d14fa..a2315b6d63c69 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -22,6 +22,10 @@ namespace lldb_private {
 struct SymbolLocation {
   FileSpec module_spec;
   std::vector symbols;
+
+  // The symbols are regular expressions. In such case all symbols are matched
+  // with their trailing @VER symbol version stripped.
+  bool symbols_are_regex = false;
 };
 
 /// Fetches the abort frame location depending on the current platform.
@@ -45,6 +49,8 @@ bool GetAbortLocation(llvm::Triple::OSType os, SymbolLocation 
&location) {
 location.symbols.push_back(ConstString("raise"));
 location.symbols.push_back(ConstString("__GI_raise"));
 location.symbols.push_back(ConstString("gsignal"));
+location.symbols.push_back(ConstString("pthread_kill"));
+location.symbols_are_regex = true;
 break;
   default:
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
@@ -93,9 +99,33 @@ void RegisterAssertFrameRecognizer(Process *process) {
   if (!GetAbortLocation(os, location))
 return;
 
+  if (!location.symbols_are_regex) {
+target.GetFrameRecognizerManager().AddRecognizer(
+std::make_shared(),
+location.module_spec.GetFilename(), location.symbols,
+/*first_instruction_only*/ false);
+return;
+  }
+  std::string module_re = "^";
+  for (char c : location.module_spec.GetFilename().GetStringRef()) {
+if (c == '.')
+  module_re += '\\';
+module_re += c;
+  }
+  module_re += '$';
+  std::string symbol_re = "^(";
+  for (auto it = location.symbols.cbegin(); it != location.symbols.cend();
+   ++it) {
+if (it != location.symbols.cbegin())
+  symbol_re += '|';
+symbol_re += it->GetStringRef();
+  }
+  // Strip the trailing @VER symbol version.
+  symbol_re += ")(@.*)?$";
   target.GetFrameRecognizerManager().AddRecognizer(
-  StackFrameRecognizerSP(new AssertFrameRecognizer()),
-  location.module_spec.GetFilename(), location.symbols,
+  std::make_shared(),
+  std::make_shared(std::move(module_re)),
+  std::make_shared(std::move(symbol_re)),
   /*first_instruction_only*/ false);
 }
 
@@ -112,7 +142,7 @@ AssertFrameRecognizer::RecognizeFrame(lldb::StackFrameSP 
frame_sp) {
   if (!GetAssertLocation(os, location))
 return RecognizedStackFrameSP();
 
-  const uint32_t frames_to_fetch = 5;
+  const uint32_t frames_to_fetch = 6;
   const uint32_t last_frame_index = frames_to_fetch - 1;
   StackFrameSP prev_frame_sp = nullptr;
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 7274848 - [lldb] Fix editline unicode on Linux

2021-07-13 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-07-13T12:37:53+02:00
New Revision: 72748488addd651beb7b60da462c721f3e175357

URL: 
https://github.com/llvm/llvm-project/commit/72748488addd651beb7b60da462c721f3e175357
DIFF: 
https://github.com/llvm/llvm-project/commit/72748488addd651beb7b60da462c721f3e175357.diff

LOG: [lldb] Fix editline unicode on Linux

Based on:
  [lldb-dev] proposed change to remove conditional WCHAR support in libedit 
wrapper
  https://lists.llvm.org/pipermail/lldb-dev/2021-July/016961.html

There is already setlocale in lldb/source/Core/IOHandlerCursesGUI.cpp
but that does not apply for Editline GUI editing.

Unaware how to make automated test for this, it requires pty.

Reviewed By: teemperor

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

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index d37271bd1e53a..fb18e7d90eaa8 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -67,7 +67,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -2627,8 +2626,6 @@ class Application {
   }
 
   void Initialize() {
-::setlocale(LC_ALL, "");
-::setlocale(LC_CTYPE, "");
 m_screen = ::newterm(nullptr, m_out, m_in);
 ::start_color();
 ::curs_set(0);

diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index b8c5aec5fd80b..a6a4a2a1b80b8 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -867,6 +868,10 @@ static llvm::Optional 
InitializeReproducer(llvm::StringRef argv0,
 }
 
 int main(int argc, char const *argv[]) {
+  // Editline uses for example iswprint which is dependent on LC_CTYPE.
+  std::setlocale(LC_ALL, "");
+  std::setlocale(LC_CTYPE, "");
+
   // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
   // destruction.
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 278df28 - [nfc] [lldb] Rename GetRnglist() to GetRnglistTable()

2021-07-21 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-07-21T10:45:37+02:00
New Revision: 278df28557f138481ac852d2d064d4c27626048a

URL: 
https://github.com/llvm/llvm-project/commit/278df28557f138481ac852d2d064d4c27626048a
DIFF: 
https://github.com/llvm/llvm-project/commit/278df28557f138481ac852d2d064d4c27626048a.diff

LOG: [nfc] [lldb] Rename GetRnglist() to GetRnglistTable()

My D99653 implemented a getter GetRnglist() for m_rnglist_table.

That was confusing as the getter returns DWARFDebugRnglistTable which
contains DWARFDebugRnglist as its elements.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 62c61ed657f0b..824e43872269b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -490,7 +490,8 @@ void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
   m_ranges_base = ranges_base;
 }
 
-const llvm::Optional &DWARFUnit::GetRnglist() {
+const llvm::Optional &
+DWARFUnit::GetRnglistTable() {
   if (GetVersion() >= 5 && !m_rnglist_table_done) {
 m_rnglist_table_done = true;
 if (auto table_or_error =
@@ -508,7 +509,7 @@ const llvm::Optional 
&DWARFUnit::GetRnglist() {
 
 // This function is called only for DW_FORM_rnglistx.
 llvm::Expected DWARFUnit::GetRnglistOffset(uint32_t Index) {
-  if (!GetRnglist())
+  if (!GetRnglistTable())
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
   if (!m_ranges_base)
@@ -516,14 +517,14 @@ llvm::Expected 
DWARFUnit::GetRnglistOffset(uint32_t Index) {
"DW_FORM_rnglistx cannot be used without "
"DW_AT_rnglists_base for CU at 0x%8.8x",
GetOffset());
-  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+  if (llvm::Optional off = GetRnglistTable()->getOffsetEntry(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
 return *off + m_ranges_base;
   return llvm::createStringError(
   errc::invalid_argument,
   "invalid range list table index %u; OffsetEntryCount is %u, "
   "DW_AT_rnglists_base is %" PRIu64,
-  Index, GetRnglist()->getOffsetEntryCount(), m_ranges_base);
+  Index, GetRnglistTable()->getOffsetEntryCount(), m_ranges_base);
 }
 
 void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) {
@@ -967,11 +968,11 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
 return ranges;
   }
 
-  if (!GetRnglist())
+  if (!GetRnglistTable())
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  auto range_list_or_error = GetRnglist()->findList(
+  auto range_list_or_error = GetRnglistTable()->findList(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
   if (!range_list_or_error)
 return range_list_or_error.takeError();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index f6b1fdbde0710..da79a6aaf64e5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -283,7 +283,7 @@ class DWARFUnit : public lldb_private::UserID {
 return &m_die_array[0];
   }
 
-  const llvm::Optional &GetRnglist();
+  const llvm::Optional &GetRnglistTable();
 
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2e9853e - [DWARF5] Only fallback to manual index if no entry was found

2021-07-29 Thread Jan Kratochvil via lldb-commits

Author: Kim-Anh Tran
Date: 2021-07-29T16:16:42+02:00
New Revision: 2e9853e0e9ff263a948ebef70221fd0cec9c4830

URL: 
https://github.com/llvm/llvm-project/commit/2e9853e0e9ff263a948ebef70221fd0cec9c4830
DIFF: 
https://github.com/llvm/llvm-project/commit/2e9853e0e9ff263a948ebef70221fd0cec9c4830.diff

LOG: [DWARF5] Only fallback to manual index if no entry was found

If we succeed at gathering global variables for a compile
unit, there is no need to fallback to generating a manual index.

Reviewed By: jankratochvil

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index cb3e662a6cdfe..5dfa5a176d384 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -125,6 +125,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 void DebugNamesDWARFIndex::GetGlobalVariables(
 const DWARFUnit &cu, llvm::function_ref callback) {
   uint64_t cu_offset = cu.GetOffset();
+  bool found_entry_for_cu = false;
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
 for (DebugNames::NameTableEntry nte: ni) {
   uint64_t entry_offset = nte.getEntryOffset();
@@ -135,6 +136,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 if (entry_or->getCUOffset() != cu_offset)
   continue;
 
+found_entry_for_cu = true;
 if (!ProcessEntry(*entry_or, callback,
   llvm::StringRef(nte.getString(
   return;
@@ -142,8 +144,10 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
   MaybeLogLookupError(entry_or.takeError(), ni, nte.getString());
 }
   }
-
-  m_fallback.GetGlobalVariables(cu, callback);
+  // If no name index for that particular CU was found, fallback to
+  // creating the manual index.
+  if (!found_entry_for_cu)
+m_fallback.GetGlobalVariables(cu, callback);
 }
 
 void DebugNamesDWARFIndex::GetCompleteObjCClass(



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e7b8ba1 - [lldb] [DWARF-5] Be lazier about loading .dwo files

2021-07-30 Thread Jan Kratochvil via lldb-commits

Author: Eric Leese
Date: 2021-07-30T13:34:51+02:00
New Revision: e7b8ba103a8411fb25237727c3822d4c431e4814

URL: 
https://github.com/llvm/llvm-project/commit/e7b8ba103a8411fb25237727c3822d4c431e4814
DIFF: 
https://github.com/llvm/llvm-project/commit/e7b8ba103a8411fb25237727c3822d4c431e4814.diff

LOG: [lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
lldb/test/Shell/SymbolFile/DWARF/split-optimized.c

Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Symbol/CompileUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
lldb/test/Shell/SymbolFile/DWARF/x86/dwp.s

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index 2e52bca7097c7..c9a8a19f09624 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -442,6 +442,7 @@ class CompileUnit : public 
std::enable_shared_from_this,
 
   CompileUnit(const CompileUnit &) = delete;
   const CompileUnit &operator=(const CompileUnit &) = delete;
+  const char *GetCachedLanguage() const;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 824e43872269b..067561be0cf05 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -35,12 +35,12 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, 
lldb::user_id_t uid,
  DIERef::Section section, bool is_dwo)
 : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs),
   m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo),
-  m_dwo_id(header.GetDWOId()) {}
+  m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.GetDWOId()) {}
 
 DWARFUnit::~DWARFUnit() = default;
 
-// Parses first DIE of a compile unit.
-void DWARFUnit::ExtractUnitDIEIfNeeded() {
+// Parses first DIE of a compile unit, excluding DWO.
+void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
   {
 llvm::sys::ScopedReader lock(m_first_die_mutex);
 if (m_first_die)
@@ -50,7 +50,8 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   if (m_first_die)
 return; // Already parsed
 
-  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", 
GetOffset());
+  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIENoDwoIfNeeded()",
+ GetOffset());
 
   // Set the offset to that of the first DIE and calculate the start of the
   // next compilation unit header.
@@ -66,6 +67,58 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   }
 }
 
+// Parses first DIE of a compile unit including DWO.
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  ExtractUnitDIENoDwoIfNeeded();
+
+  if (m_has_parsed_non_skeleton_unit)
+return;
+
+  m_has_parsed_non_skeleton_unit = true;
+
+  std::shared_ptr dwo_symbol_file =
+  m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die);
+  if (!dwo_symbol_file)
+return;
+
+  DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(m_dwo_id);
+
+  if (!dwo_cu)
+return; // Can't fetch the compile unit from the dwo file.
+  dwo_cu->SetUserData(this);
+
+  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
+  if (!dwo_cu_die.IsValid())
+return; // Can't fetch the compile unit DIE from the dwo file.
+
+  // Here for DWO CU we want to use the address base set in the skeleton unit
+  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
+  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
+  // attributes which were applicable to the DWO units. The corresponding
+  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the
+  // main unit in contrast.
+  if (m_addr_base)
+dwo_cu->SetAddrBase(*m_addr_base);
+  else if (m_gnu_addr_base)
+dwo_cu->SetAddrBase(*m_gnu_addr_base);
+
+  if (GetVersion() <= 4 && m_gnu_ranges_base)
+dwo_cu->SetRangesBase(*m_gnu_ranges_base);
+  else if (dwo_symbol_file->GetDWARFContext()
+   .getOrLoadRngListsData()
+   .GetByteSize() > 0)
+dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
+
+  if (GetVersion() >= 5 &&
+  dwo_symbol_file->GetDWARFContext().getOrLoadLocListsData().GetByteSize() 
>
+  

[Lldb-commits] [lldb] d0e6d94 - Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"

2021-07-30 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-07-30T14:54:27+02:00
New Revision: d0e6d946b6db87a6310c43aac1788345c8990182

URL: 
https://github.com/llvm/llvm-project/commit/d0e6d946b6db87a6310c43aac1788345c8990182
DIFF: 
https://github.com/llvm/llvm-project/commit/d0e6d946b6db87a6310c43aac1788345c8990182.diff

LOG: Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"

This reverts commit e7b8ba103a8411fb25237727c3822d4c431e4814.

It broke 32-bit ARM - lldb-arm-ubuntu, reported by omjavaid:
  https://lab.llvm.org/buildbot/#/builders/17/builds/9595

Added: 


Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Symbol/CompileUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
lldb/test/Shell/SymbolFile/DWARF/x86/dwp.s

Removed: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
lldb/test/Shell/SymbolFile/DWARF/split-optimized.c



diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index c9a8a19f09624..2e52bca7097c7 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -442,7 +442,6 @@ class CompileUnit : public 
std::enable_shared_from_this,
 
   CompileUnit(const CompileUnit &) = delete;
   const CompileUnit &operator=(const CompileUnit &) = delete;
-  const char *GetCachedLanguage() const;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 067561be0cf05..824e43872269b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -35,12 +35,12 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, 
lldb::user_id_t uid,
  DIERef::Section section, bool is_dwo)
 : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs),
   m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo),
-  m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.GetDWOId()) {}
+  m_dwo_id(header.GetDWOId()) {}
 
 DWARFUnit::~DWARFUnit() = default;
 
-// Parses first DIE of a compile unit, excluding DWO.
-void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
+// Parses first DIE of a compile unit.
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
   {
 llvm::sys::ScopedReader lock(m_first_die_mutex);
 if (m_first_die)
@@ -50,8 +50,7 @@ void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
   if (m_first_die)
 return; // Already parsed
 
-  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIENoDwoIfNeeded()",
- GetOffset());
+  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", 
GetOffset());
 
   // Set the offset to that of the first DIE and calculate the start of the
   // next compilation unit header.
@@ -67,58 +66,6 @@ void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
   }
 }
 
-// Parses first DIE of a compile unit including DWO.
-void DWARFUnit::ExtractUnitDIEIfNeeded() {
-  ExtractUnitDIENoDwoIfNeeded();
-
-  if (m_has_parsed_non_skeleton_unit)
-return;
-
-  m_has_parsed_non_skeleton_unit = true;
-
-  std::shared_ptr dwo_symbol_file =
-  m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die);
-  if (!dwo_symbol_file)
-return;
-
-  DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(m_dwo_id);
-
-  if (!dwo_cu)
-return; // Can't fetch the compile unit from the dwo file.
-  dwo_cu->SetUserData(this);
-
-  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
-  if (!dwo_cu_die.IsValid())
-return; // Can't fetch the compile unit DIE from the dwo file.
-
-  // Here for DWO CU we want to use the address base set in the skeleton unit
-  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
-  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
-  // attributes which were applicable to the DWO units. The corresponding
-  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the
-  // main unit in contrast.
-  if (m_addr_base)
-dwo_cu->SetAddrBase(*m_addr_base);
-  else if (m_gnu_addr_base)
-dwo_cu->SetAddrBase(*m_gnu_addr_base);
-
-  if (GetVersion() <= 4 && m_gnu_ranges_base)
-dwo_cu->SetRangesBase(*m_gnu_ranges_base);
-  else if (dwo_symbol_file->GetDWARFContext()
-   .getOrLoadRngListsData()
-   .GetByteSize() > 0)
-dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
-
-  if (GetVersion() >= 5 &&
-  dwo_symbol_file->GetDWARFContext().getOrLoadLocListsData().GetByteSize() 
>
-  0)
-
dwo_cu->SetLoclistsBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
-
-  dwo_cu->SetBaseAddress(GetBaseAddress());
-

[Lldb-commits] [lldb] 8dfd6ca - [lldb] [DWARF-5] Be lazier about loading .dwo files

2021-07-30 Thread Jan Kratochvil via lldb-commits

Author: Eric Leese
Date: 2021-07-30T23:17:06+02:00
New Revision: 8dfd6cae9bd62ae5ef056b994ece2e98f1558830

URL: 
https://github.com/llvm/llvm-project/commit/8dfd6cae9bd62ae5ef056b994ece2e98f1558830
DIFF: 
https://github.com/llvm/llvm-project/commit/8dfd6cae9bd62ae5ef056b994ece2e98f1558830.diff

LOG: [lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
lldb/test/Shell/SymbolFile/DWARF/split-optimized.c

Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Symbol/CompileUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
lldb/test/Shell/SymbolFile/DWARF/x86/dwp.s

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index 2e52bca7097c..c9a8a19f0962 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -442,6 +442,7 @@ class CompileUnit : public 
std::enable_shared_from_this,
 
   CompileUnit(const CompileUnit &) = delete;
   const CompileUnit &operator=(const CompileUnit &) = delete;
+  const char *GetCachedLanguage() const;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 824e43872269..067561be0cf0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -35,12 +35,12 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, 
lldb::user_id_t uid,
  DIERef::Section section, bool is_dwo)
 : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs),
   m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo),
-  m_dwo_id(header.GetDWOId()) {}
+  m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.GetDWOId()) {}
 
 DWARFUnit::~DWARFUnit() = default;
 
-// Parses first DIE of a compile unit.
-void DWARFUnit::ExtractUnitDIEIfNeeded() {
+// Parses first DIE of a compile unit, excluding DWO.
+void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
   {
 llvm::sys::ScopedReader lock(m_first_die_mutex);
 if (m_first_die)
@@ -50,7 +50,8 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   if (m_first_die)
 return; // Already parsed
 
-  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", 
GetOffset());
+  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIENoDwoIfNeeded()",
+ GetOffset());
 
   // Set the offset to that of the first DIE and calculate the start of the
   // next compilation unit header.
@@ -66,6 +67,58 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   }
 }
 
+// Parses first DIE of a compile unit including DWO.
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  ExtractUnitDIENoDwoIfNeeded();
+
+  if (m_has_parsed_non_skeleton_unit)
+return;
+
+  m_has_parsed_non_skeleton_unit = true;
+
+  std::shared_ptr dwo_symbol_file =
+  m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die);
+  if (!dwo_symbol_file)
+return;
+
+  DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(m_dwo_id);
+
+  if (!dwo_cu)
+return; // Can't fetch the compile unit from the dwo file.
+  dwo_cu->SetUserData(this);
+
+  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
+  if (!dwo_cu_die.IsValid())
+return; // Can't fetch the compile unit DIE from the dwo file.
+
+  // Here for DWO CU we want to use the address base set in the skeleton unit
+  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
+  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
+  // attributes which were applicable to the DWO units. The corresponding
+  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the
+  // main unit in contrast.
+  if (m_addr_base)
+dwo_cu->SetAddrBase(*m_addr_base);
+  else if (m_gnu_addr_base)
+dwo_cu->SetAddrBase(*m_gnu_addr_base);
+
+  if (GetVersion() <= 4 && m_gnu_ranges_base)
+dwo_cu->SetRangesBase(*m_gnu_ranges_base);
+  else if (dwo_symbol_file->GetDWARFContext()
+   .getOrLoadRngListsData()
+   .GetByteSize() > 0)
+dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
+
+  if (GetVersion() >= 5 &&
+  dwo_symbol_file->GetDWARFContext().getOrLoadLocListsData().GetByteSize() 
>
+  

[Lldb-commits] [lldb] fb09f36 - [lldb] [DWARF-5] Be lazier about loading .dwo files

2021-07-31 Thread Jan Kratochvil via lldb-commits

Author: Eric Leese
Date: 2021-07-31T10:45:31+02:00
New Revision: fb09f365ae28920666ddfd466fb09b44b9cb7be1

URL: 
https://github.com/llvm/llvm-project/commit/fb09f365ae28920666ddfd466fb09b44b9cb7be1
DIFF: 
https://github.com/llvm/llvm-project/commit/fb09f365ae28920666ddfd466fb09b44b9cb7be1.diff

LOG: [lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Testcases now require Linux as it is needed for -gsplit-dwarf.

Review By: jankratochvil, dblaikie

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
lldb/test/Shell/SymbolFile/DWARF/split-optimized.c

Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Symbol/CompileUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
lldb/test/Shell/SymbolFile/DWARF/x86/dwp.s

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index 2e52bca7097c7..c9a8a19f09624 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -442,6 +442,7 @@ class CompileUnit : public 
std::enable_shared_from_this,
 
   CompileUnit(const CompileUnit &) = delete;
   const CompileUnit &operator=(const CompileUnit &) = delete;
+  const char *GetCachedLanguage() const;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 824e43872269b..067561be0cf05 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -35,12 +35,12 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, 
lldb::user_id_t uid,
  DIERef::Section section, bool is_dwo)
 : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs),
   m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo),
-  m_dwo_id(header.GetDWOId()) {}
+  m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.GetDWOId()) {}
 
 DWARFUnit::~DWARFUnit() = default;
 
-// Parses first DIE of a compile unit.
-void DWARFUnit::ExtractUnitDIEIfNeeded() {
+// Parses first DIE of a compile unit, excluding DWO.
+void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {
   {
 llvm::sys::ScopedReader lock(m_first_die_mutex);
 if (m_first_die)
@@ -50,7 +50,8 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   if (m_first_die)
 return; // Already parsed
 
-  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIEIfNeeded()", 
GetOffset());
+  LLDB_SCOPED_TIMERF("%8.8x: DWARFUnit::ExtractUnitDIENoDwoIfNeeded()",
+ GetOffset());
 
   // Set the offset to that of the first DIE and calculate the start of the
   // next compilation unit header.
@@ -66,6 +67,58 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
   }
 }
 
+// Parses first DIE of a compile unit including DWO.
+void DWARFUnit::ExtractUnitDIEIfNeeded() {
+  ExtractUnitDIENoDwoIfNeeded();
+
+  if (m_has_parsed_non_skeleton_unit)
+return;
+
+  m_has_parsed_non_skeleton_unit = true;
+
+  std::shared_ptr dwo_symbol_file =
+  m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die);
+  if (!dwo_symbol_file)
+return;
+
+  DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(m_dwo_id);
+
+  if (!dwo_cu)
+return; // Can't fetch the compile unit from the dwo file.
+  dwo_cu->SetUserData(this);
+
+  DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
+  if (!dwo_cu_die.IsValid())
+return; // Can't fetch the compile unit DIE from the dwo file.
+
+  // Here for DWO CU we want to use the address base set in the skeleton unit
+  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
+  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
+  // attributes which were applicable to the DWO units. The corresponding
+  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the
+  // main unit in contrast.
+  if (m_addr_base)
+dwo_cu->SetAddrBase(*m_addr_base);
+  else if (m_gnu_addr_base)
+dwo_cu->SetAddrBase(*m_gnu_addr_base);
+
+  if (GetVersion() <= 4 && m_gnu_ranges_base)
+dwo_cu->SetRangesBase(*m_gnu_ranges_base);
+  else if (dwo_symbol_file->GetDWARFContext()
+   .getOrLoadRngListsData()
+   .GetByteSize() > 0)
+dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
+
+  if (GetVersion() >= 5 &&
+  dwo_symbol_file

[Lldb-commits] [lldb] 6ef6616 - [nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset

2021-07-31 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-08-01T00:38:01+02:00
New Revision: 6ef6616e07f5be69557e744fc28459d6051cfa9c

URL: 
https://github.com/llvm/llvm-project/commit/6ef6616e07f5be69557e744fc28459d6051cfa9c
DIFF: 
https://github.com/llvm/llvm-project/commit/6ef6616e07f5be69557e744fc28459d6051cfa9c.diff

LOG: [nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset

Its last use was removed by D63428.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index e43afa104413e..b72c7406ece13 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -174,15 +174,6 @@ bool DWARFDebugInfo::ContainsTypeUnits() {
   return !m_type_hash_to_unit_index.empty();
 }
 
-DWARFDIE
-DWARFDebugInfo::GetDIEForDIEOffset(DIERef::Section section,
-   dw_offset_t die_offset) {
-  DWARFUnit *cu = GetUnitContainingDIEOffset(section, die_offset);
-  if (cu)
-return cu->GetDIE(die_offset);
-  return DWARFDIE();
-}
-
 // GetDIE()
 //
 // Get the DIE (Debug Information Entry) with the specified offset.

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 46c04d749c465..c990ac9fbe583 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -43,8 +43,6 @@ class DWARFDebugInfo {
   DWARFUnit *GetUnit(const DIERef &die_ref);
   DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
   bool ContainsTypeUnits();
-  DWARFDIE GetDIEForDIEOffset(DIERef::Section section,
-  dw_offset_t die_offset);
   DWARFDIE GetDIE(const DIERef &die_ref);
 
   enum {



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ea97066 - [test] [lldb] Use filename instead of index in test

2021-08-02 Thread Jan Kratochvil via lldb-commits

Author: Eric Leese
Date: 2021-08-02T21:12:57+02:00
New Revision: ea9706626ce3f83b8433849049cc3c64b6b7297c

URL: 
https://github.com/llvm/llvm-project/commit/ea9706626ce3f83b8433849049cc3c64b6b7297c
DIFF: 
https://github.com/llvm/llvm-project/commit/ea9706626ce3f83b8433849049cc3c64b6b7297c.diff

LOG: [test] [lldb] Use filename instead of index in test

In some environments this test could fail if start.S has its own DWARF
CompileUnit or similar are included before the DWARF CompileUnit for the
file.

This change makes the test independent of the index of the compile unit,
instead checking the filename.

Reviewed By: herhut, jankratochvil

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

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c 
b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
index b473f0df78dc7..7e5a44035df71 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwarf5-lazy-dwo.c
@@ -22,8 +22,8 @@
 // CHECK-NOT: 2.dwo,
 // CHECK: (lldb) image lookup
 // CHECK-NOT: 2.dwo,
-// CHECK: CompileUnit: id = {0x}, file =
-// CHECK-SAME: language = "c99"
+// CHECK: CompileUnit: id =
+// CHECK-SAME: /dwarf5-lazy-dwo.c", language = "c99"
 // CHECK-NOT: 2.dwo,
 
 #ifdef ONE



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 437e37d - [nfc] [lldb] Support moving support files instead of copy

2021-08-02 Thread Jan Kratochvil via lldb-commits

Author: Eric Leese
Date: 2021-08-02T21:43:34+02:00
New Revision: 437e37dd553917ef890821d5045f898f065e4d47

URL: 
https://github.com/llvm/llvm-project/commit/437e37dd553917ef890821d5045f898f065e4d47
DIFF: 
https://github.com/llvm/llvm-project/commit/437e37dd553917ef890821d5045f898f065e4d47.diff

LOG: [nfc] [lldb] Support moving support files instead of copy

Split from D100299.

Reviewed By: jankratochvil

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

Added: 


Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/Symbol/CompileUnit.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index c9a8a19f09624..34e34e5514df3 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -332,6 +332,7 @@ class CompileUnit : public 
std::enable_shared_from_this,
   void SetLineTable(LineTable *line_table);
 
   void SetSupportFiles(const FileSpecList &support_files);
+  void SetSupportFiles(FileSpecList &&support_files);
 
   void SetDebugMacros(const DebugMacrosSP &debug_macros);
 

diff  --git a/lldb/source/Symbol/CompileUnit.cpp 
b/lldb/source/Symbol/CompileUnit.cpp
index 1b258516fac86..6c4a36d451959 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -181,6 +181,10 @@ void CompileUnit::SetSupportFiles(const FileSpecList 
&support_files) {
   m_support_files = support_files;
 }
 
+void CompileUnit::SetSupportFiles(FileSpecList &&support_files) {
+  m_support_files = std::move(support_files);
+}
+
 DebugMacros *CompileUnit::GetDebugMacros() {
   if (m_debug_macros_sp.get() == nullptr) {
 if (m_flags.IsClear(flagsParsedDebugMacros)) {



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 14f4430 - [nfc] [lldb] Prevent needless copies of DataExtractor

2021-08-04 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-08-04T20:35:53+02:00
New Revision: 14f443030c1acc4346589aee3c1c532dc00eae3a

URL: 
https://github.com/llvm/llvm-project/commit/14f443030c1acc4346589aee3c1c532dc00eae3a
DIFF: 
https://github.com/llvm/llvm-project/commit/14f443030c1acc4346589aee3c1c532dc00eae3a.diff

LOG: [nfc] [lldb] Prevent needless copies of DataExtractor

lldb_private::DataExtractor contains DataBufferSP m_data_sp which is
relatively expensive to copy (due to multi-threading locking).

llvm::DataExtractor does not have this problem as it uses StringRef
instead.

The copy constructor is explicit as otherwise it is easy to make
unintended modification of a local copy instead of a caller's instance
(D107470 but that is llvm::DataExtractor).

Reviewed By: clayborg

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

Added: 


Modified: 
lldb/include/lldb/DataFormatters/StringPrinter.h
lldb/include/lldb/Utility/DataExtractor.h
lldb/source/DataFormatters/StringPrinter.cpp
lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
lldb/unittests/DataFormatter/StringPrinterTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/StringPrinter.h 
b/lldb/include/lldb/DataFormatters/StringPrinter.h
index 4a6e2e9051bff..cb6cba1e254f2 100644
--- a/lldb/include/lldb/DataFormatters/StringPrinter.h
+++ b/lldb/include/lldb/DataFormatters/StringPrinter.h
@@ -133,9 +133,9 @@ class StringPrinter {
 ReadBufferAndDumpToStreamOptions(
 const ReadStringAndDumpToStreamOptions &options);
 
-void SetData(DataExtractor d) { m_data = d; }
+void SetData(DataExtractor &&d) { m_data = std::move(d); }
 
-lldb_private::DataExtractor GetData() const { return m_data; }
+const lldb_private::DataExtractor &GetData() const { return m_data; }
 
 void SetIsTruncated(bool t) { m_is_truncated = t; }
 

diff  --git a/lldb/include/lldb/Utility/DataExtractor.h 
b/lldb/include/lldb/Utility/DataExtractor.h
index 0923e5280cba9..dbf0bce8c8d0d 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -134,7 +134,12 @@ class DataExtractor {
   DataExtractor(const DataExtractor &data, lldb::offset_t offset,
 lldb::offset_t length, uint32_t target_byte_size = 1);
 
-  DataExtractor(const DataExtractor &rhs);
+  /// Copy constructor.
+  ///
+  /// The copy constructor is explicit as otherwise it is easy to make
+  /// unintended modification of a local copy instead of a caller's instance.
+  /// Also a needless copy of the \a m_data_sp shared pointer is/ expensive.
+  explicit DataExtractor(const DataExtractor &rhs);
 
   /// Assignment operator.
   ///
@@ -149,6 +154,12 @@ class DataExtractor {
   /// A const reference to this object.
   const DataExtractor &operator=(const DataExtractor &rhs);
 
+  /// Move constructor and move assignment operators to complete the rule of 5.
+  ///
+  /// They would get deleted as we already defined those of rule of 3.
+  DataExtractor(DataExtractor &&rhs) = default;
+  DataExtractor &operator=(DataExtractor &&rhs) = default;
+
   /// Destructor
   ///
   /// If this object contains a valid shared data reference, the reference
@@ -1005,7 +1016,8 @@ class DataExtractor {
   uint32_t m_addr_size; ///< The address size to use when extracting addresses.
   /// The shared pointer to data that can be shared among multiple instances
   lldb::DataBufferSP m_data_sp;
-  const uint32_t m_target_byte_size = 1;
+  /// Making it const would require implementation of move assignment operator.
+  uint32_t m_target_byte_size = 1;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/DataFormatters/StringPrinter.cpp 
b/lldb/source/DataFormatters/StringPrinter.cpp
index 0c6438f7dd868..6def893ae5ca0 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -475,11 +475,9 @@ static bool ReadEncodedBufferAndDumpToStream(
 return true;
   }
 
-  DataExtractor data(buffer_sp, process_sp->GetByteOrder(),
- process_sp->GetAddressByteSize());
-
   StringPrinter::ReadBufferAndDumpToStreamOptions dump_options(options);
-  dump_options.SetData(data);
+  dump_options.SetData(DataExtractor(buffer_sp, process_sp->GetByteOrder(),
+ process_sp->GetAddressByteSize()));
   dump_options.SetSourceSize(sourceSize);
   dump_options.SetIsTruncated(is_truncated);
   dump_options.SetNeedsZeroTermination(needs_zero_terminator);

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
index 41bbd2b01a1e7..45c0cd213e0e

[Lldb-commits] [lldb] f3932b9 - [nfc] [lldb] Assertions for D106270 - [DWARF5] Fix offset check when using .debug_names

2021-08-10 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-08-10T20:43:24+02:00
New Revision: f3932b9a0b0b7787ccd3572bad134acc4146acaa

URL: 
https://github.com/llvm/llvm-project/commit/f3932b9a0b0b7787ccd3572bad134acc4146acaa
DIFF: 
https://github.com/llvm/llvm-project/commit/f3932b9a0b0b7787ccd3572bad134acc4146acaa.diff

LOG: [nfc] [lldb] Assertions for D106270 - [DWARF5] Fix offset check when using 
.debug_names

Skeleton vs. DWO units mismatch has been fixed in D106270. As they both
have type DWARFUnit it is a bit difficult to debug. So it is better to
make it safe against future changes.

Reviewed By: kimanh, clayborg

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/find-variable-file-3.cpp

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h
lldb/test/Shell/SymbolFile/DWARF/x86/find-variable-file.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index c786451a03df2..4e09b523b7781 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -79,6 +79,7 @@ void AppleDWARFIndex::GetGlobalVariables(
   if (!m_apple_names_up)
 return;
 
+  lldbassert(!cu.GetSymbolFileDWARF().GetDwoNum());
   const DWARFUnit &non_skeleton_cu = cu.GetNonSkeletonUnit();
   DWARFMappedHash::DIEInfoArray hash_data;
   m_apple_names_up->AppendAllDIEsInRange(non_skeleton_cu.GetOffset(),

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
index 6f2698cc6e6fb..fac6c46b4ccff 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
@@ -34,6 +34,7 @@ class DWARFIndex {
   virtual void
   GetGlobalVariables(const RegularExpression ®ex,
  llvm::function_ref callback) = 0;
+  /// \a cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
   virtual void
   GetGlobalVariables(DWARFUnit &cu,
  llvm::function_ref callback) = 0;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 2b2c13abb250b..4a148e7744bb1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -124,6 +124,7 @@ void DebugNamesDWARFIndex::GetGlobalVariables(
 
 void DebugNamesDWARFIndex::GetGlobalVariables(
 DWARFUnit &cu, llvm::function_ref callback) {
+  lldbassert(!cu.GetSymbolFileDWARF().GetDwoNum());
   uint64_t cu_offset = cu.GetOffset();
   bool found_entry_for_cu = false;
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 242daa9293914..4d36ef9b34bc4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -359,9 +359,9 @@ void ManualDWARFIndex::GetGlobalVariables(
 
 void ManualDWARFIndex::GetGlobalVariables(
 DWARFUnit &unit, llvm::function_ref callback) {
+  lldbassert(!unit.GetSymbolFileDWARF().GetDwoNum());
   Index();
-  m_set.globals.FindAllEntriesForUnit(unit.GetNonSkeletonUnit(),
-  DIERefCallback(callback));
+  m_set.globals.FindAllEntriesForUnit(unit, DIERefCallback(callback));
 }
 
 void ManualDWARFIndex::GetObjCMethods(

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
index 42e96af84a969..493d1b4a27023 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -45,15 +45,16 @@ bool NameToDIE::Find(const RegularExpression ®ex,
 }
 
 void NameToDIE::FindAllEntriesForUnit(
-const DWARFUnit &unit,
-llvm::function_ref callback) const {
+DWARFUnit &s_unit, llvm::function_ref callback) const {
+  lldbassert(!s_unit.GetSymbolFileDWARF().GetDwoNum());
+  const DWARFUnit &ns_unit = s_unit.GetNonSkeletonUnit();
   const uint32_t size = m_map.GetSize();
   for (uint32_t i = 0; i < size; ++i) {
 const DIERef &die_ref = m_map.GetValueAtIndexUnchecked(i);
-if (unit.GetSymbolFileDWARF().GetDwoNum() == die_ref.dwo_num() &&
-unit.GetDebugSection() == die_ref.section() &&
-unit.GetOffset() <= die_ref.die_offset() &&
-die_ref.die_offset() < unit.GetNextUnitOff

[Lldb-commits] [lldb] e21a21a - [lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-08-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-08-17T22:19:16+02:00
New Revision: e21a21a977b492cc7172779d080db146e3c39e06

URL: 
https://github.com/llvm/llvm-project/commit/e21a21a977b492cc7172779d080db146e3c39e06
DIFF: 
https://github.com/llvm/llvm-project/commit/e21a21a977b492cc7172779d080db146e3c39e06.diff

LOG: [lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using 
DW_AT_rnglists_base (used by GCC)

Fix D98289 so that it works even for 2nd..nth compilation unit
(.debug_rnglists).

Reviewed By: dblaikie, ikudrin

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index a498117c264b..9a56e1e6aa2c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -437,15 +437,20 @@ ParseListTableHeader(const llvm::DWARFDataExtractor 
&data, uint64_t offset,
   // We are expected to be called with Offset 0 or pointing just past the table
   // header. Correct Offset in the latter case so that it points to the start
   // of the header.
-  if (offset > 0) {
-uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
-if (offset < HeaderSize)
-  return llvm::createStringError(errc::invalid_argument,
- "did not detect a valid"
- " list table with base = 0x%" PRIx64 "\n",
- offset);
-offset -= HeaderSize;
+  if (offset == 0) {
+// This means DW_AT_rnglists_base is missing and therefore DW_FORM_rnglistx
+// cannot be handled. Returning a default-constructed ListTableType allows
+// DW_FORM_sec_offset to be supported.
+return ListTableType();
   }
+
+  uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
+  if (offset < HeaderSize)
+return llvm::createStringError(errc::invalid_argument,
+   "did not detect a valid"
+   " list table with base = 0x%" PRIx64 "\n",
+   offset);
+  offset -= HeaderSize;
   ListTableType Table;
   if (llvm::Error E = Table.extractHeaderAndOffsets(data, &offset))
 return std::move(E);
@@ -996,8 +1001,12 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  auto range_list_or_error = GetRnglistTable()->findList(
-  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
+  llvm::DWARFDataExtractor data =
+  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM();
+
+  // As DW_AT_rnglists_base may be missing we need to call setAddressSize.
+  data.setAddressSize(m_header.GetAddressByteSize());
+  auto range_list_or_error = GetRnglistTable()->findList(data, offset);
   if (!range_list_or_error)
 return range_list_or_error.takeError();
 

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s 
b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
index da1fff61dc02..5c1f6c46f739 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -29,7 +29,7 @@
 # RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has 
DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed 
(invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base 
is 12), please file a bug and attach the file at the start of this error message
+# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has 
DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed 
(invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base 
is 24), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
@@ -97,7 +97,7 @@ lookup_rnglists:
 .long   .Lrnglists_end-rnglists # DW_AT_high_pc
 .long   .Laddr_table_base0  # DW_AT_addr_base
 .ifdef RNGLISTBASE
-.long   .Ldebug_ranges0 # DW_AT_rnglists_base
+.long   .Ldebug_ranges1 # DW_AT_rnglists_base
 .endif
 .byte   2   # Abbrev [2] 0x2b:0x37 
DW_TAG_subprogram
 .quad   rnglists# DW_AT_low_pc
@@ -105,7 +105,7 @@ lookup_rnglists:
 .asciz  "rnglists"  # DW_AT_name
 .byte   5   # Abbrev [5] 0x52:0xf 
DW_TAG_lexical_bl

[Lldb-commits] [lldb] cf1046c - [lldb] Fix+re-enable Assert StackFrame Recognizer on Linux

2020-02-07 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-07T22:24:56+01:00
New Revision: cf1046c716b33ed449aa8fc26376864917c63c25

URL: 
https://github.com/llvm/llvm-project/commit/cf1046c716b33ed449aa8fc26376864917c63c25
DIFF: 
https://github.com/llvm/llvm-project/commit/cf1046c716b33ed449aa8fc26376864917c63c25.diff

LOG: [lldb] Fix+re-enable Assert StackFrame Recognizer on Linux

D73303 was failing on Fedora Linux and so it was disabled by Skip the
AssertFrameRecognizer test for Linux.

On Fedora 30 x86_64 I have:
$ readelf -Ws /lib64/libc.so.6 |grep '^Symbol\|.*assert_fail'
Symbol table '.dynsym' contains 2362 entries:
   630: 0003052070 FUNCGLOBAL DEFAULT   14 
__assert_fail@@GLIBC_2.2.5
Symbol table '.symtab' contains 22711 entries:
   922: 0002275a15 FUNCLOCAL  DEFAULT   14 
__assert_fail_base.cold
 18044: 0003052070 FUNCLOCAL  DEFAULT   14 
__GI___assert_fail
 20081: 000303a0   370 FUNCLOCAL  DEFAULT   14 
__assert_fail_base
 21766: 0003052070 FUNCGLOBAL DEFAULT   14 __assert_fail

The patch should never expect __GI___assert_fail:

.symtab can be present or not but that should not change that
__assert_fail always wins - it is always present from .dynsym and it can
never be overriden by __GI___assert_fail as __GI___assert_fail has only
local binding. Global binding is preferred since D63540.

External debug info symbols do not matter since D55859 (and DWARF should
never be embedded in system libc.so.6).

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

Added: 


Modified: 
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/test/Shell/Recognizer/assert.test

Removed: 




diff  --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb/source/Target/AssertFrameRecognizer.cpp
index 89ed3ce022d9..e778ab6e0592 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -16,26 +16,6 @@ using namespace lldb;
 using namespace lldb_private;
 
 namespace lldb_private {
-/// Checkes if the module containing a symbol has debug info.
-///
-/// \param[in] target
-///The target containing the module.
-/// \param[in] module_spec
-///The module spec that should contain the symbol.
-/// \param[in] symbol_name
-///The symbol's name that should be contained in the debug info.
-/// \return
-///If  \b true the symbol was found, \b false otherwise.
-bool ModuleHasDebugInfo(Target &target, FileSpec &module_spec,
-StringRef symbol_name) {
-  ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
-
-  if (!module_sp)
-return false;
-
-  return module_sp->FindFirstSymbolWithNameAndType(ConstString(symbol_name));
-}
-
 /// Fetches the abort frame location depending on the current platform.
 ///
 /// \param[in] process_sp
@@ -60,9 +40,7 @@ GetAbortLocation(Process *process) {
 break;
   case llvm::Triple::Linux:
 module_spec = FileSpec("libc.so.6");
-symbol_name = "__GI_raise";
-if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
-  symbol_name = "raise";
+symbol_name = "raise";
 break;
   default:
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
@@ -98,9 +76,7 @@ GetAssertLocation(Process *process) {
 break;
   case llvm::Triple::Linux:
 module_spec = FileSpec("libc.so.6");
-symbol_name = "__GI___assert_fail";
-if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
-  symbol_name = "__assert_fail";
+symbol_name = "__assert_fail";
 break;
   default:
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));

diff  --git a/lldb/test/Shell/Recognizer/assert.test 
b/lldb/test/Shell/Recognizer/assert.test
index 6bcc009f333e..9b4aa21611e0 100644
--- a/lldb/test/Shell/Recognizer/assert.test
+++ b/lldb/test/Shell/Recognizer/assert.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: system-windows, system-linux
+# UNSUPPORTED: system-windows
 # RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 run



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 6ef4786 - Revert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"

2020-02-07 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-08T05:08:48+01:00
New Revision: 6ef4786dbcd47cfe346ee8679ba0b4d320da797d

URL: 
https://github.com/llvm/llvm-project/commit/6ef4786dbcd47cfe346ee8679ba0b4d320da797d
DIFF: 
https://github.com/llvm/llvm-project/commit/6ef4786dbcd47cfe346ee8679ba0b4d320da797d.diff

LOG: Revert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"

This reverts commit cf1046c716b33ed449aa8fc26376864917c63c25.
Reverted: https://reviews.llvm.org/D74252

It fixed testsuite but broke real world functionality where is not used:
settings set symbols.enable-external-lookup false

Added: 


Modified: 
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/test/Shell/Recognizer/assert.test

Removed: 




diff  --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb/source/Target/AssertFrameRecognizer.cpp
index e778ab6e0592..89ed3ce022d9 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -16,6 +16,26 @@ using namespace lldb;
 using namespace lldb_private;
 
 namespace lldb_private {
+/// Checkes if the module containing a symbol has debug info.
+///
+/// \param[in] target
+///The target containing the module.
+/// \param[in] module_spec
+///The module spec that should contain the symbol.
+/// \param[in] symbol_name
+///The symbol's name that should be contained in the debug info.
+/// \return
+///If  \b true the symbol was found, \b false otherwise.
+bool ModuleHasDebugInfo(Target &target, FileSpec &module_spec,
+StringRef symbol_name) {
+  ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
+
+  if (!module_sp)
+return false;
+
+  return module_sp->FindFirstSymbolWithNameAndType(ConstString(symbol_name));
+}
+
 /// Fetches the abort frame location depending on the current platform.
 ///
 /// \param[in] process_sp
@@ -40,7 +60,9 @@ GetAbortLocation(Process *process) {
 break;
   case llvm::Triple::Linux:
 module_spec = FileSpec("libc.so.6");
-symbol_name = "raise";
+symbol_name = "__GI_raise";
+if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
+  symbol_name = "raise";
 break;
   default:
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
@@ -76,7 +98,9 @@ GetAssertLocation(Process *process) {
 break;
   case llvm::Triple::Linux:
 module_spec = FileSpec("libc.so.6");
-symbol_name = "__assert_fail";
+symbol_name = "__GI___assert_fail";
+if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
+  symbol_name = "__assert_fail";
 break;
   default:
 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));

diff  --git a/lldb/test/Shell/Recognizer/assert.test 
b/lldb/test/Shell/Recognizer/assert.test
index 9b4aa21611e0..6bcc009f333e 100644
--- a/lldb/test/Shell/Recognizer/assert.test
+++ b/lldb/test/Shell/Recognizer/assert.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, system-linux
 # RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 run



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 420a518 - [lldb] [testsuite] TestGdbRemoteLibrariesSvr4Support: Fix symlinked builddir

2020-02-09 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-09T14:49:38+01:00
New Revision: 420a51806850a20ebf4144699457de84513f6abc

URL: 
https://github.com/llvm/llvm-project/commit/420a51806850a20ebf4144699457de84513f6abc
DIFF: 
https://github.com/llvm/llvm-project/commit/420a51806850a20ebf4144699457de84513f6abc.diff

LOG: [lldb] [testsuite] TestGdbRemoteLibrariesSvr4Support: Fix symlinked 
builddir

When I have symlinked builddir on Fedora 31 x86_64 I get:

FAIL: test_libraries_svr4_libs_present 
(TestGdbRemoteLibrariesSvr4Support.TestGdbRemoteLibrariesSvr4Support)
--
...
  File 
"lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py",
 line 106, in
libraries_svr4_libs_present
self.assertIn(self.getBuildDir() + "/" + lib, libraries_svr4_names)
AssertionError:

'/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so'
 not found in 
['/home/jkratoch/redhat/llvm-monorepo/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/linux-vdso.so.1',
 
'/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so',
 
'/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_b".so',
 '/usr/lib64/libdl-2.30.so', '/usr/lib64/libstdc++.so.6.0.27', 
'/usr/lib64/libm-2.30.so', '/usr/lib64/libgcc_s-9-20190827.so.1', 
'/usr/lib64/libc-2.30.so', '/usr/lib64/ld-2.30.so']

Config=x86_64-/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/bin/clang-11
--

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
index 2081d9f34c59..2d9f40500dc8 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -103,7 +103,7 @@ def libraries_svr4_libs_present(self):
 name = child.attrib.get("name")
 libraries_svr4_names.append(os.path.realpath(name))
 for lib in self.get_expected_libs():
-self.assertIn(self.getBuildDir() + "/" + lib, libraries_svr4_names)
+self.assertIn(os.path.realpath(self.getBuildDir() + "/" + lib), 
libraries_svr4_names)
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 8b37e1e - [lldb] [doc] Testing: Fix typos

2020-02-09 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-09T15:11:38+01:00
New Revision: 8b37e1e5ac090a498eb4940be3264e9d5ba8c97c

URL: 
https://github.com/llvm/llvm-project/commit/8b37e1e5ac090a498eb4940be3264e9d5ba8c97c
DIFF: 
https://github.com/llvm/llvm-project/commit/8b37e1e5ac090a498eb4940be3264e9d5ba8c97c.diff

LOG: [lldb] [doc] Testing: Fix typos

Added: 


Modified: 
lldb/docs/resources/test.rst

Removed: 




diff  --git a/lldb/docs/resources/test.rst b/lldb/docs/resources/test.rst
index 9966ad12eac2..63faf83ed597 100644
--- a/lldb/docs/resources/test.rst
+++ b/lldb/docs/resources/test.rst
@@ -9,7 +9,7 @@ The LLDB test suite consists of three 
diff erent kinds of test:
   located under ``lldb/packages/Python/lldbsuite`` and are written in Python
   using ``dotest`` (LLDB's custom testing framework on top of unittest2).
 * Integration tests that test the debugger through the command line. These are
-  locarted under `lldb/tests/Shell` and are written in a shell-style format
+  located under `lldb/test/Shell` and are written in a shell-style format
   using FileCheck to verify its output.
 
 All three test suites use the `LLVM Integrated Tester
@@ -82,7 +82,7 @@ run as part of a test suite.
 
 ::
 
-   > ./bin/llvm-lit -sv lldb/test --filter 
+   > ./bin/llvm-lit -sv tools/lldb/test --filter 
 
 
 Because lit automatically scans a directory for tests, it's also possible to



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 74857b4 - [lldb] [doc] Status: Debugserver (remote debugging) is OK now

2020-02-09 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-09T15:22:36+01:00
New Revision: 74857b4260ec9db8d688c2d377a5f370efc150b4

URL: 
https://github.com/llvm/llvm-project/commit/74857b4260ec9db8d688c2d377a5f370efc150b4
DIFF: 
https://github.com/llvm/llvm-project/commit/74857b4260ec9db8d688c2d377a5f370efc150b4.diff

LOG: [lldb] [doc] Status: Debugserver (remote debugging) is OK now

Added: 


Modified: 
lldb/docs/status/status.rst

Removed: 




diff  --git a/lldb/docs/status/status.rst b/lldb/docs/status/status.rst
index 9b4bd58bb617..e793e5e7bc2c 100644
--- a/lldb/docs/status/status.rst
+++ b/lldb/docs/status/status.rst
@@ -53,7 +53,7 @@ Features Matrix
 
+++-++--+
 | Core file debugging| OK (ELF)   | OK (ELF)| OK 
(MachO) | OK (Minidump)|
 
+++-++--+
-| Debugserver (remote debugging) | Not ported | Not ported  | OK   
  | Not ported   |
+| Debugserver (remote debugging) | Not ported | OK (lldb-server)| OK   
  | Not ported   |
 
+++-++--+
 | Disassembly| OK | OK  | OK   
  | OK   |
 
+++-++--+



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9d223a0 - [lldb] [doc] Status: Linux: Update the paragraph

2020-02-09 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-09T18:13:04+01:00
New Revision: 9d223a0106d0bde18aa6e353ec338206b235e3f2

URL: 
https://github.com/llvm/llvm-project/commit/9d223a0106d0bde18aa6e353ec338206b235e3f2
DIFF: 
https://github.com/llvm/llvm-project/commit/9d223a0106d0bde18aa6e353ec338206b235e3f2.diff

LOG: [lldb] [doc] Status: Linux: Update the paragraph

Added: 


Modified: 
lldb/docs/status/status.rst

Removed: 




diff  --git a/lldb/docs/status/status.rst b/lldb/docs/status/status.rst
index 180d7ed5e4bc..8a922d086764 100644
--- a/lldb/docs/status/status.rst
+++ b/lldb/docs/status/status.rst
@@ -10,11 +10,9 @@ For more details, see the Features by OS section below.
 Linux
 -
 
-LLDB is improving on Linux. While the debugserver has not been ported (to
-enable remote debugging) Linux is nearing feature completeness with Darwin to
-debug x86_64 programs, and is partially working with i386 programs. ARM
-architectures on Linux are untested. For more details, see the Features by OS
-section below.
+LLDB is improving on Linux. Linux is nearing feature completeness with Darwin
+to debug x86_64, i386, ARM, AArch64, IBM POWER (ppc64), IBM Z (s390x), and
+MIPS64 programs. For more details, see the Features by OS section below.
 
 macOS
 -



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] d2e0fee - [lldb] [doc] Change sample commands prefix from > to $

2020-02-10 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-10T09:50:37+01:00
New Revision: d2e0fee77bc82a54bcc11ce778ce12f068f9e326

URL: 
https://github.com/llvm/llvm-project/commit/d2e0fee77bc82a54bcc11ce778ce12f068f9e326
DIFF: 
https://github.com/llvm/llvm-project/commit/d2e0fee77bc82a54bcc11ce778ce12f068f9e326.diff

LOG: [lldb] [doc] Change sample commands prefix from > to $

Remove all beginning > from the sample commands as my accidental
copy-paste (multiple times...) will discard ./bin/llvm-lit which is
difficult to rebuild (I have to rm -rf and cmake it all again).

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

Added: 


Modified: 
lldb/docs/resources/test.rst

Removed: 




diff  --git a/lldb/docs/resources/test.rst b/lldb/docs/resources/test.rst
index 63faf83ed597..26b6a73ec5d4 100644
--- a/lldb/docs/resources/test.rst
+++ b/lldb/docs/resources/test.rst
@@ -51,8 +51,8 @@ built with a custom version of clang, do:
 
 ::
 
-   > cmake -DLLDB_TEST_USER_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
-   > ninja check-lldb
+   $ cmake -DLLDB_TEST_USER_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
+   $ ninja check-lldb
 
 Note that multiple ``-A`` and ``-C`` flags can be specified to
 ``LLDB_TEST_USER_ARGS``.
@@ -82,7 +82,7 @@ run as part of a test suite.
 
 ::
 
-   > ./bin/llvm-lit -sv tools/lldb/test --filter 
+   $ ./bin/llvm-lit -sv tools/lldb/test --filter 
 
 
 Because lit automatically scans a directory for tests, it's also possible to
@@ -90,7 +90,7 @@ pass a subdirectory to run a specific subset of the tests.
 
 ::
 
-   > ./bin/llvm-lit -sv 
tools/lldb/test/Shell/Commands/CommandScriptImmediateOutput
+   $ ./bin/llvm-lit -sv 
tools/lldb/test/Shell/Commands/CommandScriptImmediateOutput
 
 
 For the SB API tests it is possible to forward arguments to ``dotest.py`` by
@@ -98,7 +98,7 @@ passing ``--param`` to lit and setting a value for 
``dotest-args``.
 
 ::
 
-   > ./bin/llvm-lit -sv tools/lldb/test --param dotest-args='-C gcc'
+   $ ./bin/llvm-lit -sv tools/lldb/test --param dotest-args='-C gcc'
 
 
 Below is an overview of running individual test in the unit and API test suites
@@ -119,12 +119,12 @@ For example, to run the test cases defined in 
TestInferiorCrashing.py, run:
 
 ::
 
-   > ./bin/lldb-dotest -p TestInferiorCrashing.py
+   $ ./bin/lldb-dotest -p TestInferiorCrashing.py
 
 ::
 
-   > cd $lldb/test
-   > python dotest.py --executable  -p TestInferiorCrashing.py 
../packages/Python/lldbsuite/test
+   $ cd $lldb/test
+   $ python dotest.py --executable  -p TestInferiorCrashing.py 
../packages/Python/lldbsuite/test
 
 If the test is not specified by name (e.g. if you leave the ``-p`` argument
 off),  all tests in that directory will be executed:
@@ -132,17 +132,17 @@ off),  all tests in that directory will be executed:
 
 ::
 
-   > ./bin/lldb-dotest functionalities/data-formatter
+   $ ./bin/lldb-dotest functionalities/data-formatter
 
 ::
 
-   > python dotest.py --executable  
functionalities/data-formatter
+   $ python dotest.py --executable  
functionalities/data-formatter
 
 Many more options that are available. To see a list of all of them, run:
 
 ::
 
-   > python dotest.py -h
+   $ python dotest.py -h
 
 
 Running a Specific Test or Set of Tests: Unit Tests
@@ -154,14 +154,14 @@ To run them, just run the test binary, for example, to 
run all the Host tests:
 
 ::
 
-   > ./tools/lldb/unittests/Host/HostTests
+   $ ./tools/lldb/unittests/Host/HostTests
 
 
 To run a specific test, pass a filter, for example:
 
 ::
 
-   > ./tools/lldb/unittests/Host/HostTests 
--gtest_filter=SocketTest.DomainListenConnectAccept
+   $ ./tools/lldb/unittests/Host/HostTests 
--gtest_filter=SocketTest.DomainListenConnectAccept
 
 
 Running the Test Suite Remotely



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1a39f1b - [lldb] Fix+re-enable Assert StackFrame Recognizer on Linux

2020-02-10 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-10T10:29:32+01:00
New Revision: 1a39f1b966a8d8f15ed0d5a832d5097cccefe93b

URL: 
https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b
DIFF: 
https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b.diff

LOG: [lldb] Fix+re-enable Assert StackFrame Recognizer on Linux

D73303 was failing on Fedora Linux and so it was disabled by Skip the
AssertFrameRecognizer test for Linux.

I find no easy way how to find out if it gets recognized as
`__assert_fail` or `__GI___assert_fail` as during `Process` ctor
libc.so.6 is not yet loaded by the debuggee.

DWARF symbol `__GI___assert_fail` overrides the ELF symbol `__assert_fail`.
While external debug info (=DWARF) gets disabled for testsuite (D55859)
that sure does not apply for real world usage.

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

Added: 


Modified: 
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/source/Commands/CommandObjectFrame.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/source/Target/StackFrameRecognizer.cpp
lldb/test/Shell/Recognizer/assert.test
lldb/unittests/Target/StackFrameRecognizerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/StackFrameRecognizer.h 
b/lldb/include/lldb/Target/StackFrameRecognizer.h
index b509e0760b31..92cfca4227cf 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -101,8 +101,8 @@ class ScriptedStackFrameRecognizer : public 
StackFrameRecognizer {
 class StackFrameRecognizerManager {
 public:
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
-ConstString module,
-ConstString symbol,
+ConstString module, ConstString symbol,
+ConstString alternate_symbol,
 bool first_instruction_only = true);
 
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
@@ -113,7 +113,8 @@ class StackFrameRecognizerManager {
   static void ForEach(
   std::function const &callback);
+ std::string alternate_symbol, bool regexp)> const
+  &callback);
 
   static bool RemoveRecognizerWithID(uint32_t recognizer_id);
 

diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp 
b/lldb/source/Commands/CommandObjectFrame.cpp
index d86b50bd7aad..5af9e2e314be 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -881,7 +881,7 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args 
&command,
   } else {
 auto module = ConstString(m_options.m_module);
 auto func = ConstString(m_options.m_function);
-StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func);
+StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func, 
{});
   }
 #endif
 
@@ -960,12 +960,13 @@ class CommandObjectFrameRecognizerList : public 
CommandObjectParsed {
 StackFrameRecognizerManager::ForEach(
 [&result, &any_printed](uint32_t recognizer_id, std::string name,
 std::string function, std::string symbol,
-bool regexp) {
+std::string alternate_symbol, bool regexp) {
   if (name == "")
 name = "(internal)";
   result.GetOutputStream().Printf(
-  "%d: %s, module %s, function %s%s\n", recognizer_id, 
name.c_str(),
-  function.c_str(), symbol.c_str(), regexp ? " (regexp)" : "");
+  "%d: %s, module %s, function %s{%s}%s\n", recognizer_id,
+  name.c_str(), function.c_str(), symbol.c_str(),
+  alternate_symbol.c_str(), regexp ? " (regexp)" : "");
   any_printed = true;
 });
 

diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 6acc23176248..62d16296bd66 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2691,6 +2691,7 @@ static void RegisterObjCExceptionRecognizer() {
 std::tie(module, function) = AppleObjCRuntime::GetExceptionThrowLocation();
 StackFrameRecognizerManager::AddRecognizer(
 StackFrameRecognizerSP(new ObjCExceptionThrowFrameRecognizer()),
-module.GetFilename(), function, /*first_instruction_only*/ true);
+module.GetFilename(), function, /*alternate_symbol*/ {},
+/*first_instruction_only*/ true);
   });
 }

diff  --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb

[Lldb-commits] [lldb] 98c940b - [NFC] [lldb] Remove unused declaration

2020-02-11 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-11T14:59:52+01:00
New Revision: 98c940bf515831420b8b53489dd4f9a4fc8a40ad

URL: 
https://github.com/llvm/llvm-project/commit/98c940bf515831420b8b53489dd4f9a4fc8a40ad
DIFF: 
https://github.com/llvm/llvm-project/commit/98c940bf515831420b8b53489dd4f9a4fc8a40ad.diff

LOG: [NFC] [lldb] Remove unused declaration

ObjectFileELF::GetSectionIndexByType declaration without definition was
added by commit 17220c188635721e948cf02d2b6ad36b267ea393.

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index 3b273896cb59..d3f620385d97 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -328,9 +328,6 @@ class ObjectFileELF : public lldb_private::ObjectFile {
   /// section index 0 is never valid).
   lldb::user_id_t GetSectionIndexByName(const char *name);
 
-  // Returns the ID of the first section that has the given type.
-  lldb::user_id_t GetSectionIndexByType(unsigned type);
-
   /// Returns the section header with the given id or NULL.
   const ELFSectionHeaderInfo *GetSectionHeaderByIndex(lldb::user_id_t id);
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 516ba15 - [lldb] [nfc] Simplify user_id_t -> size_t

2020-02-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-17T10:24:19+01:00
New Revision: 516ba158b6890bbcca71527ae0719de151b9de5f

URL: 
https://github.com/llvm/llvm-project/commit/516ba158b6890bbcca71527ae0719de151b9de5f
DIFF: 
https://github.com/llvm/llvm-project/commit/516ba158b6890bbcca71527ae0719de151b9de5f.diff

LOG: [lldb] [nfc] Simplify user_id_t -> size_t

As discussed in https://reviews.llvm.org/D73206#1871895> simplifying
usage of `user_id_t`.

There is even written:
  // The compile unit ID is the index of the DWARF unit.
  DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID());

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 4cb27e971775..8ca1a8fc311c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -109,7 +109,7 @@ size_t DWARFDebugInfo::GetNumUnits() {
   return m_units.size();
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) {
+DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(size_t idx) {
   DWARFUnit *cu = nullptr;
   if (idx < GetNumUnits())
 cu = m_units[idx].get();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 056cf33a202f..db6a0f80ff45 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -35,7 +35,7 @@ class DWARFDebugInfo {
   lldb_private::DWARFContext &context);
 
   size_t GetNumUnits();
-  DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx);
+  DWARFUnit *GetUnitAtIndex(size_t idx);
   DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset,
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2178088 - Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-17T16:35:42+01:00
New Revision: 21780888791837b575d227a9a69c1afee9e4c29d

URL: 
https://github.com/llvm/llvm-project/commit/21780888791837b575d227a9a69c1afee9e4c29d
DIFF: 
https://github.com/llvm/llvm-project/commit/21780888791837b575d227a9a69c1afee9e4c29d.diff

LOG: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

As discussed in https://reviews.llvm.org/D73206#1871895 there is both
`DIERef` and `user_id_t` and sometimes (for DWZ) we need to encode Main
CU into them and sometimes we cannot as it is unavailable at that point
and at the same time not even needed.

I have also noticed `DIERef` and `user_id_t` in fact contain the same
information which can be seen in SymbolFileDWARF::GetUID.

SB* API/ABI is already using `user_id_t` and it needs to encode Main CU
for DWZ. Therefore what about making `DIERef` the identifier not
containing Main CU and `user_id_t` the identifier containing Main CU?

It is sort of a revert of D63322.

I find this patch as a NFC cleanup to the codebase - to satisfy a new
premise `user_id_t` is used as little as possible and thus only for
external interfaces which must not deal with MainCU in any way.

Its larger goal is to satisfy a plan to implement DWZ support.

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index 5546bb7e8b86..7d78ea18587f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -44,6 +44,16 @@ class DIERef {
 
   dw_offset_t die_offset() const { return m_die_offset; }
 
+  bool operator<(DIERef other) const {
+if (m_dwo_num_valid != other.m_dwo_num_valid)
+  return m_dwo_num_valid < other.m_dwo_num_valid;
+if (m_dwo_num_valid && (m_dwo_num != other.m_dwo_num))
+  return m_dwo_num < other.m_dwo_num;
+if (m_section != other.m_section)
+  return m_section < other.m_section;
+return m_die_offset < other.m_die_offset;
+  }
+
 private:
   uint32_t m_dwo_num : 30;
   uint32_t m_dwo_num_valid : 1;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b7e91c0eedb0..954f1110ba1e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2381,9 +2381,9 @@ void SymbolFileDWARF::GetMangledNamesForFunction(
   dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
   }
 
-  for (lldb::user_id_t uid :
+  for (DIERef die_ref :
m_function_scope_qualified_name_map.lookup(scope_qualified_name)) {
-DWARFDIE die = GetDIE(uid);
+DWARFDIE die = GetDIE(die_ref);
 mangled_names.push_back(ConstString(die.GetMangledName()));
   }
 }
@@ -3031,7 +3031,7 @@ TypeSP SymbolFileDWARF::ParseType(const SymbolContext 
&sc, const DWARFDIE &die,
.AsCString(""));
   if (scope_qualified_name.size()) {
 m_function_scope_qualified_name_map[scope_qualified_name].insert(
-die.GetID());
+*die.GetDIERef());
   }
 }
   }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index c592561b4880..4d6132099801 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -500,7 +500,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
   bool m_fetched_external_modules : 1;
   lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
 
-  typedef std::set DIERefSet;
+  typedef std::set DIERefSet;
   typedef llvm::StringMap NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] aa3e99d - [lldb] [nfc] Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

2020-02-18 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-18T18:09:39+01:00
New Revision: aa3e99dc859febba398925afeefb118403e15ab9

URL: 
https://github.com/llvm/llvm-project/commit/aa3e99dc859febba398925afeefb118403e15ab9
DIFF: 
https://github.com/llvm/llvm-project/commit/aa3e99dc859febba398925afeefb118403e15ab9.diff

LOG: [lldb] [nfc] Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

Reasons are the same as for D74637.

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 02f481684cd7..0ea3adceaecc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1720,9 +1720,9 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   // binaries.
   dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
   clang_type.GetOpaqueQualType();
-  dwarf->GetForwardDeclClangTypeToDie()
-  [ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] =
-  die.GetID();
+  dwarf->GetForwardDeclClangTypeToDie().try_emplace(
+  ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType(),
+  *die.GetDIERef());
   m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
 }
   }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index d8165d718499..04be8f5e7349 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -322,8 +322,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
   typedef llvm::DenseMap
   DIEToClangType;
-  typedef llvm::DenseMap
-  ClangTypeToDIE;
+  typedef llvm::DenseMap ClangTypeToDIE;
 
   DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 3481062 - [lldb] [testsuite] Enable forgotten -gsplit-dwarf for 2 testfiles

2020-03-18 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-03-18T15:49:24+01:00
New Revision: 3481062bc688e21eac175aae0142adcaae361c1c

URL: 
https://github.com/llvm/llvm-project/commit/3481062bc688e21eac175aae0142adcaae361c1c
DIFF: 
https://github.com/llvm/llvm-project/commit/3481062bc688e21eac175aae0142adcaae361c1c.diff

LOG: [lldb] [testsuite] Enable forgotten -gsplit-dwarf for 2 testfiles

D63643 added these testfiles but some of the %t4dwo and %t5dwo builds
are the same as corresponding %t4 and %t5 builds. Fortunately the
testcases do PASS.

After just adding -gsplit-dwarf these both skeleton files:
  tools/lldb/test/SymbolFile/DWARF/Output/debug-types-expressions.test.tmp4dwo
  tools/lldb/test/SymbolFile/DWARF/Output/debug-types-expressions.test.tmp5dwo

were referencing to this one non-skeleton file:
  tools/lldb/test/SymbolFile/DWARF/debug-types-expressions.dwo

Surprisingly it does not affect the other test debug-types-basic.test
probably because it compiles to .o and then links it. While
debug-types-expressions.test compiles directly to an executable.

So fixed that while keeping the direct executable compilation.

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

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/debug-types-basic.test
lldb/test/Shell/SymbolFile/DWARF/debug-types-expressions.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/debug-types-basic.test 
b/lldb/test/Shell/SymbolFile/DWARF/debug-types-basic.test
index 24a6a651d5f9..947b43ba6b2f 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-types-basic.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-types-basic.test
@@ -20,7 +20,7 @@
 
 # And type units+dwo+dwarf5.
 # RUN: %clangxx -target x86_64-pc-linux %S/Inputs/debug-types-basic.cpp \
-# RUN:   -g -gdwarf-5 -fdebug-types-section -c -o %t5dwo.o
+# RUN:   -g -gdwarf-5 -fdebug-types-section -gsplit-dwarf -c -o %t5dwo.o
 # RUN: ld.lld %t5dwo.o -o %t5dwo
 # RUN: %lldb %t5dwo -s %s -o exit | FileCheck %s
 

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/debug-types-expressions.test 
b/lldb/test/Shell/SymbolFile/DWARF/debug-types-expressions.test
index 5964eea40adf..0442cd8faa3b 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-types-expressions.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-types-expressions.test
@@ -12,12 +12,16 @@
 
 # Test type units in dwo files.
 # RUN: %clangxx_host %S/Inputs/debug-types-expressions.cpp \
-# RUN:   -g -gdwarf-4 -fdebug-types-section -o %t4dwo
+# RUN:   -g -gdwarf-4 -fdebug-types-section -gsplit-dwarf -o %t4dwo \
+# RUN:   -Xclang -split-dwarf-output -Xclang %t4dwo.dwo \
+# RUN:   -Xclang -split-dwarf-file   -Xclang %t4dwo.dwo
 # RUN: %lldb %t4dwo -s %s -o exit | FileCheck %s
 
 # And type units+dwo+dwarf5.
 # RUN: %clangxx_host %S/Inputs/debug-types-expressions.cpp \
-# RUN:   -g -gdwarf-5 -fdebug-types-section -o %t5dwo
+# RUN:   -g -gdwarf-5 -fdebug-types-section -gsplit-dwarf -o %t5dwo \
+# RUN:   -Xclang -split-dwarf-output -Xclang %t5dwo.dwo \
+# RUN:   -Xclang -split-dwarf-file   -Xclang %t5dwo.dwo
 # RUN: %lldb %t5dwo -s %s -o exit | FileCheck %s
 
 breakpoint set -n foo



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 8023752 - [nfc] [lldb] Unindent code - obvious part

2020-04-03 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-04-03T21:58:11+02:00
New Revision: 80237523193d1311e8744b84faa077a1295d80da

URL: 
https://github.com/llvm/llvm-project/commit/80237523193d1311e8744b84faa077a1295d80da
DIFF: 
https://github.com/llvm/llvm-project/commit/80237523193d1311e8744b84faa077a1295d80da.diff

LOG: [nfc] [lldb] Unindent code - obvious part

It is an obvious part of D77326.

It removes some needless deep indentation and some redundant statements.
It prepares the code for a more clean next patch - DWARF index callbacks
in D77327.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index 50b3a2cba61f..027eb08e5621 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -53,8 +53,9 @@ std::unique_ptr AppleDWARFIndex::Create(
 }
 
 void AppleDWARFIndex::GetGlobalVariables(ConstString basename, DIEArray 
&offsets) {
-  if (m_apple_names_up)
-m_apple_names_up->FindByName(basename.GetStringRef(), offsets);
+  if (!m_apple_names_up)
+return;
+  m_apple_names_up->FindByName(basename.GetStringRef(), offsets);
 }
 
 void AppleDWARFIndex::GetGlobalVariables(const RegularExpression ®ex,
@@ -80,22 +81,24 @@ void AppleDWARFIndex::GetGlobalVariables(const DWARFUnit 
&cu,
 
 void AppleDWARFIndex::GetObjCMethods(ConstString class_name,
  DIEArray &offsets) {
-  if (m_apple_objc_up)
-m_apple_objc_up->FindByName(class_name.GetStringRef(), offsets);
+  if (!m_apple_objc_up)
+return;
+  m_apple_objc_up->FindByName(class_name.GetStringRef(), offsets);
 }
 
 void AppleDWARFIndex::GetCompleteObjCClass(ConstString class_name,
bool must_be_implementation,
DIEArray &offsets) {
-  if (m_apple_types_up) {
-m_apple_types_up->FindCompleteObjCClassByName(
-class_name.GetStringRef(), offsets, must_be_implementation);
-  }
+  if (!m_apple_types_up)
+return;
+  m_apple_types_up->FindCompleteObjCClassByName(
+  class_name.GetStringRef(), offsets, must_be_implementation);
 }
 
 void AppleDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
-  if (m_apple_types_up)
-m_apple_types_up->FindByName(name.GetStringRef(), offsets);
+  if (!m_apple_types_up)
+return;
+  m_apple_types_up->FindByName(name.GetStringRef(), offsets);
 }
 
 void AppleDWARFIndex::GetTypes(const DWARFDeclContext &context,
@@ -149,8 +152,9 @@ void AppleDWARFIndex::GetTypes(const DWARFDeclContext 
&context,
 }
 
 void AppleDWARFIndex::GetNamespaces(ConstString name, DIEArray &offsets) {
-  if (m_apple_namespaces_up)
-m_apple_namespaces_up->FindByName(name.GetStringRef(), offsets);
+  if (!m_apple_namespaces_up)
+return;
+  m_apple_namespaces_up->FindByName(name.GetStringRef(), offsets);
 }
 
 void AppleDWARFIndex::GetFunctions(ConstString name, SymbolFileDWARF &dwarf,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 5a2fa70138dd..d3a4b92b7e3e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -165,9 +165,8 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString 
class_name,
   // If we find the complete version we're done.
   offsets.push_back(*ref);
   return;
-} else {
-  incomplete_types.push_back(*ref);
 }
+incomplete_types.push_back(*ref);
   }
 
   offsets.insert(offsets.end(), incomplete_types.begin(),

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index aa01668ba05c..5f01b8176b98 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -21,19 +21,19 @@ void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray 
&die_info_array,
   DIEArray &die_offsets) {
   if (tag == 0) {
 ExtractDIEArray(die_info_array, die_offsets);
-  } else {
-const size_t count = die_info_array.size();
-for (size_t i = 0; i < count; ++i) {
-  const dw_tag_t die_tag = die_info_array[i].tag;
-  bool tag_matches = die_tag == 0 || tag == die_tag;
-  if (!tag_matches) {
-if (die_tag == DW_TAG_class_type || die_tag == DW_TAG_structure_type)
-  tag_matches =
-  tag =

[Lldb-commits] [lldb] fcab66d - [lldb] Findtypes -gmodules fix for too many matches

2020-04-03 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-04-04T00:15:06+02:00
New Revision: fcab66d5fe53fc3c318b0d0c4ef1bb4a43a7744f

URL: 
https://github.com/llvm/llvm-project/commit/fcab66d5fe53fc3c318b0d0c4ef1bb4a43a7744f
DIFF: 
https://github.com/llvm/llvm-project/commit/fcab66d5fe53fc3c318b0d0c4ef1bb4a43a7744f.diff

LOG: [lldb] Findtypes -gmodules fix for too many matches

Apparently the intention was to copy the condition above:
  if (types.GetSize() >= max_matches)
break;

So that if the iteration stopped because of too many matches we do not
add even more matches in this 'Clang modules' block downward.

It was implemented by:
  SymbolFileDWARF: Unconditionally scan through clang modules. NFCish
  fe9eaadd68307347d97698fd0a1646827eafd290

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 1113ed1195a3..ab271d2364bd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2407,7 +2407,7 @@ void SymbolFileDWARF::FindTypes(
   // Next search through the reachable Clang modules. This only applies for
   // DWARF objects compiled with -gmodules that haven't been processed by
   // dsymutil.
-  if (num_die_matches < max_matches) {
+  if (types.GetSize() < max_matches) {
 UpdateExternalModuleListIfNeeded();
 
 for (const auto &pair : m_external_type_modules)



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] b6cd964 - Fix typo in xfail decorator for lldb thread plan list tests

2020-04-06 Thread Jan Kratochvil via lldb-commits
Hi,

I get XPASSes now on Fedora 31 x86_64:

http://lab.llvm.org:8014/builders/lldb-x86_64-fedora/builds/7169
http://lab.llvm.org:8014/builders/lldb-x86_64-fedora?numbuilds=1000

So maybe to remove the expected failure?


Jan



On Sun, 05 Apr 2020 17:18:54 +0200, Muhammad Omair Javaid via lldb-commits 
wrote:
> 
> Author: Muhammad Omair Javaid
> Date: 2020-04-05T20:16:46+05:00
> New Revision: b6cd964ac7cb9b55dfcdbe43c5502c2c0f6cbebc
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/b6cd964ac7cb9b55dfcdbe43c5502c2c0f6cbebc
> DIFF: 
> https://github.com/llvm/llvm-project/commit/b6cd964ac7cb9b55dfcdbe43c5502c2c0f6cbebc.diff
> 
> LOG: Fix typo in xfail decorator for lldb thread plan list tests
> 
> Added: 
> 
> 
> Modified: 
> lldb/test/API/functionalities/thread_plan/TestThreadPlanCommands.py
> 
> Removed: 
> 
> 
> 
> 
> diff  --git 
> a/lldb/test/API/functionalities/thread_plan/TestThreadPlanCommands.py 
> b/lldb/test/API/functionalities/thread_plan/TestThreadPlanCommands.py
> index b4ae9107aceb..5214a3f6b0fe 100644
> --- a/lldb/test/API/functionalities/thread_plan/TestThreadPlanCommands.py
> +++ b/lldb/test/API/functionalities/thread_plan/TestThreadPlanCommands.py
> @@ -17,7 +17,7 @@ class TestThreadPlanCommands(TestBase):
>  NO_DEBUG_INFO_TESTCASE = True
>  
>  @skipIfWindows
> -@expectedFailureAll(oslist=["Linux"])
> +@expectedFailureAll(oslist=["linux"])
>  def test_thread_plan_actions(self):
>  self.build()
>  self.main_source_file = lldb.SBFileSpec("main.c")
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 8fbac4e - [nfc] [lldb] Unindent code

2020-04-09 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-04-09T20:43:00+02:00
New Revision: 8fbac4e1a2f2506671ca06226e4513a5965bdbf5

URL: 
https://github.com/llvm/llvm-project/commit/8fbac4e1a2f2506671ca06226e4513a5965bdbf5
DIFF: 
https://github.com/llvm/llvm-project/commit/8fbac4e1a2f2506671ca06226e4513a5965bdbf5.diff

LOG: [nfc] [lldb] Unindent code

It removes some needless deep indentation and some redundant statements.
It prepares the code for a more clean next patch - DWARF index callbacks
D77327.

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 62aba37c6fe7..56f2f07674cc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2016,17 +2016,14 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 DIEArray method_die_offsets;
 dwarf->GetObjCMethodDIEOffsets(class_name, method_die_offsets);
 
-if (!method_die_offsets.empty()) {
+const size_t num_matches = method_die_offsets.size();
+for (size_t i = 0; i < num_matches; ++i) {
+  const DIERef &die_ref = method_die_offsets[i];
   DWARFDebugInfo &debug_info = dwarf->DebugInfo();
+  DWARFDIE method_die = debug_info.GetDIE(die_ref);
 
-  const size_t num_matches = method_die_offsets.size();
-  for (size_t i = 0; i < num_matches; ++i) {
-const DIERef &die_ref = method_die_offsets[i];
-DWARFDIE method_die = debug_info.GetDIE(die_ref);
-
-if (method_die)
-  method_die.ResolveType();
-  }
+  if (method_die)
+method_die.ResolveType();
 }
 
 for (DelayedPropertyList::iterator pi = delayed_properties.begin(),

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
index aa66c920994b..9072b2dc0115 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -48,6 +48,7 @@ class DWARFDeclContext {
   }
 
   bool operator==(const DWARFDeclContext &rhs) const;
+  bool operator!=(const DWARFDeclContext &rhs) const { return !(*this == rhs); 
}
 
   uint32_t GetSize() const { return m_entries.size(); }
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index 5f01b8176b98..c82a8682ca49 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -67,8 +67,8 @@ void DWARFMappedHash::ExtractClassOrStructDIEArray(
   const size_t count = die_info_array.size();
   for (size_t i = 0; i < count; ++i) {
 const dw_tag_t die_tag = die_info_array[i].tag;
-if (die_tag != 0 && die_tag != DW_TAG_class_type &&
-die_tag != DW_TAG_structure_type)
+if (!(die_tag == 0 || die_tag == DW_TAG_class_type ||
+  die_tag == DW_TAG_structure_type))
   continue;
 if (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) {
   if (return_implementation_only_if_available) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5c14d3b52ac5..fb449edb90ca 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2051,64 +2051,53 @@ void SymbolFileDWARF::FindGlobalVariables(
   DIEArray die_offsets;
   m_index->GetGlobalVariables(ConstString(basename), die_offsets);
   const size_t num_die_matches = die_offsets.size();
-  if (num_die_matches) {
-SymbolContext sc;
-sc.module_sp = m_objfile_sp->GetModule();
-assert(sc.module_sp);
 
-// Loop invariant: Variables up to this index have been checked for context
-// matches.
-uint32_t pruned_idx = original_size;
+  SymbolContext sc;
+  sc.module_sp = m_objfile_sp->GetModule();
+  assert(sc.module_sp);
 
-bool done = false;
-for (size_t i = 0; i < num_die_matches && !done; ++i) {
-  const DIERef &die_ref = die_offsets[i];
-  DWARFDIE die = GetDIE(die_ref);
+  // Loop invariant: Variables up to this index have been checked for context
+  // matches.
+  uint32_t pruned_idx = original_size;
 
-  if (die) {
-switch (die.Tag()) {
-default:
-case DW_TAG_subprogram:
-case DW_TAG_inlined_subroutine:
-case DW_TAG_try_

[Lldb-commits] [lldb] 0833128 - [lldb/Commands] Fix help text typo for 'breakpoint set' -a|--address.

2021-02-19 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-02-19T14:33:42+01:00
New Revision: 08331281af7bebf76d541cfb33d01dca22ed4d79

URL: 
https://github.com/llvm/llvm-project/commit/08331281af7bebf76d541cfb33d01dca22ed4d79
DIFF: 
https://github.com/llvm/llvm-project/commit/08331281af7bebf76d541cfb33d01dca22ed4d79.diff

LOG: [lldb/Commands] Fix help text typo for 'breakpoint set' -a|--address.

Added: 


Modified: 
lldb/source/Commands/Options.td

Removed: 




diff  --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index d3329078893a..5dc451b8df6c 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -125,7 +125,7 @@ let Command = "breakpoint set" in {
   def breakpoint_set_address : Option<"address", "a">, Group<2>,
 Arg<"AddressOrExpression">, Required,
 Desc<"Set the breakpoint at the specified address.  If the address maps "
-"uniquely toa particular binary, then the address will be converted to "
+"uniquely to a particular binary, then the address will be converted to "
 "a \"file\"address, so that the breakpoint will track that binary+offset "
 "no matter where the binary eventually loads.  Alternately, if you also "
 "specify the module - with the -s option - then the address will be "



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 011e7bc - Revert "[lldb] Fix handling of `DW_AT_decl_file` according to D91014"

2021-03-01 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-03-01T20:45:30+01:00
New Revision: 011e7bcaa3194ed4ca3fec48263f5ef69fc1813c

URL: 
https://github.com/llvm/llvm-project/commit/011e7bcaa3194ed4ca3fec48263f5ef69fc1813c
DIFF: 
https://github.com/llvm/llvm-project/commit/011e7bcaa3194ed4ca3fec48263f5ef69fc1813c.diff

LOG: Revert "[lldb] Fix handling of `DW_AT_decl_file` according to D91014"

This reverts commit 7ec7876feda412b6edad0d83565395ef2fd5a004.

Non-x86_64 non-Linux bots broke by the testcase.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 

lldb/test/Shell/SymbolFile/DWARF/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s

lldb/test/Shell/SymbolFile/DWARF/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s



diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index af01a8f53518..188a667ca564 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2201,8 +2201,7 @@ size_t DWARFASTParserClang::ParseChildEnumerators(
 case DW_AT_description:
 default:
 case DW_AT_decl_file:
-  decl.SetFile(attributes.CompileUnitAtIndex(i)->GetFile(
-  form_value.Unsigned()));
+  decl.SetFile(die.GetCU()->GetFile(form_value.Unsigned()));
   break;
 case DW_AT_decl_line:
   decl.SetLine(form_value.Unsigned());

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 587550961ec9..7d273cb7df1b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3126,8 +3126,8 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
   continue;
 switch (attr) {
 case DW_AT_decl_file:
-  decl.SetFile(
-  attributes.CompileUnitAtIndex(i)->GetFile(form_value.Unsigned()));
+  decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(
+  form_value.Unsigned()));
   break;
 case DW_AT_decl_line:
   decl.SetLine(form_value.Unsigned());

diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
 
b/lldb/test/Shell/SymbolFile/DWARF/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
deleted file mode 100644
index c0998a1711aa..
--- 
a/lldb/test/Shell/SymbolFile/DWARF/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
+++ /dev/null
@@ -1,170 +0,0 @@
-# Check that DW_AT_decl_file of DW_AT_variable which is inherited by
-# DW_AT_abstract_origin from a 
diff erent DW_TAG_compile_unit is using the
-# DW_TAG_compile_unit->DW_AT_stmt_list where the DW_AT_decl_file is located 
(and
-# not where the DW_AT_abstract_origin is located).
-# DW_TAG_variable in CU 1 is using DW_AT_decl_file 3.
-# CU 1 has files: 
-# file_names[  1]: name: "inlinevarother.h"
-# file_names[  2]: name: "inlinevar1.c"
-# file_names[  3]: name: "inlinevar.h"
-# CU 2 has files: 
-# file_names[  1]: name: "inlinevar2.c"
-# file_names[  2]: name: "inlinevar.h"
-
-# REQUIRES: x86
-
-// RUN: %clang -o %t --target=x86_64-pc-linux %s \
-// RUN:   
%S/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s
-
-# RUN: %lldb %t \
-# RUN:   -o 'b other' -o r -o disas -o 'frame variable --show-declaration' \
-# RUN:   -o exit | FileCheck %s
-
-# CHECK: inlinevar.h:2: (int) var = {{.*}}
-# Unfixed LLDB did show only: (int) var = {{.*}}
-
-   .text
-   .file   "inlinevar1.c"
-   .file   1 "" "./inlinevarother.h"
-   .globl  main# -- Begin function main
-   .type   main,@function
-main:   # @main
-.Lfunc_begin1:
-   .file   2 "" "inlinevar1.c"
-   .loc2 4 0   # inlinevar1.c:4:0
-.Ltmp2:
-   .file   3 "" "./inlinevar.h"
-   .loc3 2 16 prologue_end # ./inlinevar.h:2:16
-   movl$42, %eax 
-   pushq   %rax
-   .loc3 3 10  # ./inlinevar.h:3:10
-.Ltmp3:
-   .loc2 5 20  # inlinevar1.c:5:20
-   callq   other
-   popq%rcx
-   .loc2 5 19  # inlinevar1.c:5:19
-   addl%ecx, %eax
-   .loc2 5 3   # inlinevar1.c:5:3
-   retq
-.Ltmp4:
-.Lfunc_end1:
-   .size   main, .Lfunc_end1-main
-# -- End function
-   .section.debug_abbrev,"",@progbits
-   .byte   1   # Abbreviation Code
-   .byte 

[Lldb-commits] [lldb] 4096ae0 - [lldb] Support DWARF-5 DW_FORM_line_strp (used by GCC)

2021-03-02 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-03-02T15:17:23+01:00
New Revision: 4096ae06f47af9db2c2550a2c34979edfbd91b8d

URL: 
https://github.com/llvm/llvm-project/commit/4096ae06f47af9db2c2550a2c34979edfbd91b8d
DIFF: 
https://github.com/llvm/llvm-project/commit/4096ae06f47af9db2c2550a2c34979edfbd91b8d.diff

LOG: [lldb] Support DWARF-5 DW_FORM_line_strp (used by GCC)

LLDB has been failing on binaries produced by new GCC 11.0 with -gdwarf-5.

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/dwarf5-line-strp.s

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 421298802645..bce25297c4c7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -173,6 +173,7 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor 
&data,
 break;
 
   case DW_FORM_strp:
+  case DW_FORM_line_strp:
   case DW_FORM_sec_offset:
 data.GetU32(&offset);
 break;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 305f1cbd2826..ec78c5bbc9f4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -150,40 +150,40 @@ struct FormSize {
   uint8_t valid:1, size:7;
 };
 static FormSize g_form_sizes[] = {
-  {0,0}, // 0x00 unused
-  {0,0}, // 0x01 DW_FORM_addr
-  {0,0}, // 0x02 unused
-  {0,0}, // 0x03 DW_FORM_block2
-  {0,0}, // 0x04 DW_FORM_block4
-  {1,2}, // 0x05 DW_FORM_data2
-  {1,4}, // 0x06 DW_FORM_data4
-  {1,8}, // 0x07 DW_FORM_data8
-  {0,0}, // 0x08 DW_FORM_string
-  {0,0}, // 0x09 DW_FORM_block
-  {0,0}, // 0x0a DW_FORM_block1
-  {1,1}, // 0x0b DW_FORM_data1
-  {1,1}, // 0x0c DW_FORM_flag
-  {0,0}, // 0x0d DW_FORM_sdata
-  {1,4}, // 0x0e DW_FORM_strp
-  {0,0}, // 0x0f DW_FORM_udata
-  {0,0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes 
for
- // DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
-  {1,1}, // 0x11 DW_FORM_ref1
-  {1,2}, // 0x12 DW_FORM_ref2
-  {1,4}, // 0x13 DW_FORM_ref4
-  {1,8}, // 0x14 DW_FORM_ref8
-  {0,0}, // 0x15 DW_FORM_ref_udata
-  {0,0}, // 0x16 DW_FORM_indirect
-  {1,4}, // 0x17 DW_FORM_sec_offset
-  {0,0}, // 0x18 DW_FORM_exprloc
-  {1,0}, // 0x19 DW_FORM_flag_present
-  {0,0}, // 0x1a
-  {0,0}, // 0x1b
-  {0,0}, // 0x1c
-  {0,0}, // 0x1d
-  {0,0}, // 0x1e
-  {0,0}, // 0x1f
-  {1,8}, // 0x20 DW_FORM_ref_sig8
+{0, 0}, // 0x00 unused
+{0, 0}, // 0x01 DW_FORM_addr
+{0, 0}, // 0x02 unused
+{0, 0}, // 0x03 DW_FORM_block2
+{0, 0}, // 0x04 DW_FORM_block4
+{1, 2}, // 0x05 DW_FORM_data2
+{1, 4}, // 0x06 DW_FORM_data4
+{1, 8}, // 0x07 DW_FORM_data8
+{0, 0}, // 0x08 DW_FORM_string
+{0, 0}, // 0x09 DW_FORM_block
+{0, 0}, // 0x0a DW_FORM_block1
+{1, 1}, // 0x0b DW_FORM_data1
+{1, 1}, // 0x0c DW_FORM_flag
+{0, 0}, // 0x0d DW_FORM_sdata
+{1, 4}, // 0x0e DW_FORM_strp
+{0, 0}, // 0x0f DW_FORM_udata
+{0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes
+// for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
+{1, 1},  // 0x11 DW_FORM_ref1
+{1, 2},  // 0x12 DW_FORM_ref2
+{1, 4},  // 0x13 DW_FORM_ref4
+{1, 8},  // 0x14 DW_FORM_ref8
+{0, 0},  // 0x15 DW_FORM_ref_udata
+{0, 0},  // 0x16 DW_FORM_indirect
+{1, 4},  // 0x17 DW_FORM_sec_offset
+{0, 0},  // 0x18 DW_FORM_exprloc
+{1, 0},  // 0x19 DW_FORM_flag_present
+{0, 0},  // 0x1a DW_FORM_strx (ULEB128)
+{0, 0},  // 0x1b DW_FORM_addrx (ULEB128)
+{1, 4},  // 0x1c DW_FORM_ref_sup4
+{0, 0},  // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for 
DWARF64)
+{1, 16}, // 0x1e DW_FORM_data16
+{1, 4},  // 0x1f DW_FORM_line_strp
+{1, 8},  // 0x20 DW_FORM_ref_sig8
 };
 
 llvm::Optional
@@ -286,6 +286,7 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
 // 32 bit for DWARF 32, 64 for DWARF 64
 case DW_FORM_sec_offset:
 case DW_FORM_strp:
+case DW_FORM_line_strp:
   *offset_ptr += 4;
   return true;
 
@@ -398,7 +399,8 @@ void DWARFFormValue::Dump(Stream &s) const {
   case DW_FORM_udata:
 s.PutULEB128(uvalue);
 break;
-  case DW_FORM_strp: {
+  case DW_FORM_strp:
+  case DW_FORM_line_strp: {
 const char *dbg_str = AsCString();
 if (dbg_str) {
   s.QuotedCString(dbg_str);
@@ -606,6 +608,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
 case DW_FORM_flag:
 case DW_FORM_sdata:
 case DW_FORM_strp:
+case DW_FORM_line_strp:
 case DW_FORM_strx:

[Lldb-commits] [lldb] 61c2932 - [lldb] DWARFDebugInfoEntry::Extract(): Print an error for unsupported DW_FORM_*

2021-03-02 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-03-02T16:39:04+01:00
New Revision: 61c29321b3dffa3ae45483dd7678faedaef535a7

URL: 
https://github.com/llvm/llvm-project/commit/61c29321b3dffa3ae45483dd7678faedaef535a7
DIFF: 
https://github.com/llvm/llvm-project/commit/61c29321b3dffa3ae45483dd7678faedaef535a7.diff

LOG: [lldb] DWARFDebugInfoEntry::Extract(): Print an error for unsupported 
DW_FORM_*

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index bce25297c4c7..7227ded823a2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -183,6 +183,10 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor 
&data,
 break;
 
   default:
+cu->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
+"{0x%8.8x}: Unsupported DW_FORM_0x%x, please file a bug and "
+"attach the file at the start of this error message",
+m_offset, (unsigned)form);
 *offset_ptr = m_offset;
 return false;
   }



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


  1   2   >