[Lldb-commits] [PATCH] D35760: Expose active and available platform lists via SBDebugger API

2017-08-09 Thread Vadim Macagon via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310452: Expose active and available platform lists via 
SBDebugger API (authored by enlight).

Changed prior to commit:
  https://reviews.llvm.org/D35760?vs=108276&id=110336#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35760

Files:
  lldb/trunk/include/lldb/API/SBDebugger.h
  lldb/trunk/include/lldb/API/SBStructuredData.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
  
lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
  lldb/trunk/scripts/interface/SBDebugger.i
  lldb/trunk/source/API/SBDebugger.cpp

Index: lldb/trunk/include/lldb/API/SBStructuredData.h
===
--- lldb/trunk/include/lldb/API/SBStructuredData.h
+++ lldb/trunk/include/lldb/API/SBStructuredData.h
@@ -98,6 +98,7 @@
 
 protected:
   friend class SBTraceOptions;
+  friend class SBDebugger;
 
   StructuredDataImplUP m_impl_up;
 };
Index: lldb/trunk/include/lldb/API/SBDebugger.h
===
--- lldb/trunk/include/lldb/API/SBDebugger.h
+++ lldb/trunk/include/lldb/API/SBDebugger.h
@@ -132,6 +132,25 @@
 
   void SetSelectedPlatform(lldb::SBPlatform &platform);
 
+  /// Get the number of currently active platforms.
+  uint32_t GetNumPlatforms();
+
+  /// Get one of the currently active platforms.
+  lldb::SBPlatform GetPlatformAtIndex(uint32_t idx);
+
+  /// Get the number of available platforms.
+  ///
+  /// The return value should match the number of entries output by the
+  /// "platform list" command.
+  uint32_t GetNumAvailablePlatforms();
+
+  /// Get the name and description of one of the available platforms.
+  ///
+  /// @param[in] idx
+  /// Zero-based index of the platform for which info should be retrieved,
+  /// must be less than the value returned by GetNumAvailablePlatforms().
+  lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx);
+
   lldb::SBSourceManager GetSourceManager();
 
   // REMOVE: just for a quick fix, need to expose platforms through
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
@@ -0,0 +1,70 @@
+"""
+Test the lldb platform Python API.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class PlatformPythonTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_platform_list(self):
+"""Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API"""
+# Verify there's only the host platform present by default.
+self.assertEqual(self.dbg.GetNumPlatforms(), 1)
+host_platform = self.dbg.GetPlatformAtIndex(0)
+self.assertTrue(host_platform.IsValid() and
+host_platform.GetName() == 'host',
+'Only the host platform is available')
+# Select another platform and verify that the platform is added to
+# the platform list.
+platform_idx = self.dbg.GetNumAvailablePlatforms() - 1
+if platform_idx < 1:
+self.fail('No platforms other than host are available')
+platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(platform_idx)
+platform_name = platform_data.GetValueForKey('name').GetStringValue(100)
+self.assertNotEqual(platform_name, 'host')
+self.dbg.SetCurrentPlatform(platform_name)
+selected_platform = self.dbg.GetSelectedPlatform()
+self.assertTrue(selected_platform.IsValid())
+self.assertEqual(selected_platform.GetName(), platform_name)
+self.assertEqual(self.dbg.GetNumPlatforms(), 2)
+platform = self.dbg.GetPlatformAtIndex(1)
+self.assertEqual(platform.GetName(), platform_name)
+
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_available_platform_list(self):
+"""Test SBDebugger::GetNumAvailablePlatforms() and GetAvailablePlatformInfoAtIndex() API"""
+num_platforms = self.dbg.GetNumAvailablePlatforms()
+self.assertGreater(
+num_platforms, 0,
+'There should be at least one platform available')
+
+for i in range(num_platforms):
+platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(i)
+name_data = platform_data.GetValueForKey('name')
+desc_data = platform_data.GetValueForKey('description')
+self.assertTrue(
+na

[Lldb-commits] [lldb] r310452 - Expose active and available platform lists via SBDebugger API

2017-08-09 Thread Vadim Macagon via lldb-commits
Author: enlight
Date: Wed Aug  9 02:20:40 2017
New Revision: 310452

URL: http://llvm.org/viewvc/llvm-project?rev=310452&view=rev
Log:
Expose active and available platform lists via SBDebugger API

Summary:
The available platform list was previously only accessible via the
`platform list` command, this patch makes it possible to access that
list via the SBDebugger API. The active platform list has likewise
been exposed via the SBDebugger API.

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
Modified:
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/include/lldb/API/SBStructuredData.h

lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
lldb/trunk/scripts/interface/SBDebugger.i
lldb/trunk/source/API/SBDebugger.cpp

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=310452&r1=310451&r2=310452&view=diff
==
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Wed Aug  9 02:20:40 2017
@@ -132,6 +132,25 @@ public:
 
   void SetSelectedPlatform(lldb::SBPlatform &platform);
 
+  /// Get the number of currently active platforms.
+  uint32_t GetNumPlatforms();
+
+  /// Get one of the currently active platforms.
+  lldb::SBPlatform GetPlatformAtIndex(uint32_t idx);
+
+  /// Get the number of available platforms.
+  ///
+  /// The return value should match the number of entries output by the
+  /// "platform list" command.
+  uint32_t GetNumAvailablePlatforms();
+
+  /// Get the name and description of one of the available platforms.
+  ///
+  /// @param[in] idx
+  /// Zero-based index of the platform for which info should be retrieved,
+  /// must be less than the value returned by GetNumAvailablePlatforms().
+  lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx);
+
   lldb::SBSourceManager GetSourceManager();
 
   // REMOVE: just for a quick fix, need to expose platforms through

Modified: lldb/trunk/include/lldb/API/SBStructuredData.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=310452&r1=310451&r2=310452&view=diff
==
--- lldb/trunk/include/lldb/API/SBStructuredData.h (original)
+++ lldb/trunk/include/lldb/API/SBStructuredData.h Wed Aug  9 02:20:40 2017
@@ -98,6 +98,7 @@ public:
 
 protected:
   friend class SBTraceOptions;
+  friend class SBDebugger;
 
   StructuredDataImplUP m_impl_up;
 };

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py?rev=310452&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
 Wed Aug  9 02:20:40 2017
@@ -0,0 +1,70 @@
+"""
+Test the lldb platform Python API.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class PlatformPythonTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_platform_list(self):
+"""Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API"""
+# Verify there's only the host platform present by default.
+self.assertEqual(self.dbg.GetNumPlatforms(), 1)
+host_platform = self.dbg.GetPlatformAtIndex(0)
+self.assertTrue(host_platform.IsValid() and
+host_platform.GetName() == 'host',
+'Only the host platform is available')
+# Select another platform and verify that the platform is added to
+# the platform list.
+platform_idx = self.dbg.GetNumAvailablePlatforms() - 1
+if platform_idx < 1:
+self.fail('No platforms other than host are available')
+platform_data = self.dbg.GetAvailablePlatformInfoAtIndex(platform_idx)
+platform_name = 
platform_data.GetValueForKey('name').GetStringValue(100)
+self.assertNotEqual(platform_name, 'host')
+self.dbg.SetCurrentPlatform(platform_name)
+selected_platform = self.dbg.GetSelectedPlatform()
+self.assertTrue(selected_platform.IsValid())
+self.assertEqual(selected_platform.GetName(), platform_name)
+self.assertEqual(self.dbg.GetNumPlatforms(), 2)
+platform = self.dbg.G

[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] The symbol with NOTYPE doesn't contain any valid address

2017-08-09 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain updated this revision to Diff 110364.
nitesh.jain retitled this revision from "[LLD][MIPS] Fix 
Address::GetAddressClass() to return correct AddressClass based on the load 
address" to "[LLDB][MIPS] The symbol with NOTYPE doesn't contain any valid 
address".

https://reviews.llvm.org/D35784

Files:
  source/Symbol/Symbol.cpp


Index: source/Symbol/Symbol.cpp
===
--- source/Symbol/Symbol.cpp
+++ source/Symbol/Symbol.cpp
@@ -113,6 +113,8 @@
 }
 
 bool Symbol::ValueIsAddress() const {
+  if (m_type == eSymbolTypeInvalid)
+return false;
   return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
 }
 


Index: source/Symbol/Symbol.cpp
===
--- source/Symbol/Symbol.cpp
+++ source/Symbol/Symbol.cpp
@@ -113,6 +113,8 @@
 }
 
 bool Symbol::ValueIsAddress() const {
+  if (m_type == eSymbolTypeInvalid)
+return false;
   return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r310488 - Fix PlatformPythonTestCase.test_platform_list for the build bots

2017-08-09 Thread Vadim Macagon via lldb-commits
Author: enlight
Date: Wed Aug  9 08:49:15 2017
New Revision: 310488

URL: http://llvm.org/viewvc/llvm-project?rev=310488&view=rev
Log:
Fix PlatformPythonTestCase.test_platform_list for the build bots

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py?rev=310488&r1=310487&r2=310488&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
 Wed Aug  9 08:49:15 2017
@@ -21,12 +21,13 @@ class PlatformPythonTestCase(TestBase):
 @no_debug_info_test
 def test_platform_list(self):
 """Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API"""
-# Verify there's only the host platform present by default.
-self.assertEqual(self.dbg.GetNumPlatforms(), 1)
+# Verify the host platform is present by default.
+initial_num_platforms = self.dbg.GetNumPlatforms()
+self.assertGreater(initial_num_platforms, 0)
 host_platform = self.dbg.GetPlatformAtIndex(0)
 self.assertTrue(host_platform.IsValid() and
 host_platform.GetName() == 'host',
-'Only the host platform is available')
+'The host platform is present')
 # Select another platform and verify that the platform is added to
 # the platform list.
 platform_idx = self.dbg.GetNumAvailablePlatforms() - 1
@@ -39,9 +40,14 @@ class PlatformPythonTestCase(TestBase):
 selected_platform = self.dbg.GetSelectedPlatform()
 self.assertTrue(selected_platform.IsValid())
 self.assertEqual(selected_platform.GetName(), platform_name)
-self.assertEqual(self.dbg.GetNumPlatforms(), 2)
-platform = self.dbg.GetPlatformAtIndex(1)
-self.assertEqual(platform.GetName(), platform_name)
+self.assertEqual(self.dbg.GetNumPlatforms(), initial_num_platforms + 1)
+platform_found = False
+for platform_idx in range(self.dbg.GetNumPlatforms()):
+platform = self.dbg.GetPlatformAtIndex(platform_idx)
+if platform.GetName() == platform_name:
+platform_found = True
+break
+self.assertTrue(platform_found)
 
 @add_test_categories(['pyapi'])
 @no_debug_info_test


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


[Lldb-commits] [lldb] r310499 - Fix VASprintfTest.cpp for Darwin, add checks

2017-08-09 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Wed Aug  9 10:27:02 2017
New Revision: 310499

URL: http://llvm.org/viewvc/llvm-project?rev=310499&view=rev
Log:
Fix VASprintfTest.cpp for Darwin, add checks

Summary:
The EncodingError test ensures that trying to encode a multibyte wchar
with a given codepage fails. If setlocale() fails, the encoding is
performed using the current locale, which may or may not fail.

This patch asserts that both setlocale() operations are successful, as
well as falling back to a widely available unibyte encoding for
non-Windows systems.



Reviewers: zturner, labath, lhames

Reviewed By: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/unittests/Utility/VASprintfTest.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=310499&r1=310498&r2=310499&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Aug  9 10:27:02 2017
@@ -875,6 +875,7 @@
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/; };
+   9A2057031F3A605200F6C293 /* VASprintfTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp 
*/; };
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* 
EmulateInstructionARM.cpp */; };
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* 
EmulationStateARM.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -7092,6 +7093,7 @@
AFEC5FD81D94F9380076A480 /* 
Testx86AssemblyInspectionEngine.cpp in Sources */,
23CB15401D66DA9300EDDDE1 /* 
TestClangASTContext.cpp in Sources */,
23CB15411D66DA9300EDDDE1 /* 
StringExtractorTest.cpp in Sources */,
+   9A2057031F3A605200F6C293 /* VASprintfTest.cpp 
in Sources */,
23CB15421D66DA9300EDDDE1 /* TaskPoolTest.cpp in 
Sources */,
23CB15431D66DA9300EDDDE1 /* BroadcasterTest.cpp 
in Sources */,
9A3D43EE1F3237F900EB767C /* 
StreamCallbackTest.cpp in Sources */,

Modified: lldb/trunk/unittests/Utility/VASprintfTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/VASprintfTest.cpp?rev=310499&r1=310498&r2=310499&view=diff
==
--- lldb/trunk/unittests/Utility/VASprintfTest.cpp (original)
+++ lldb/trunk/unittests/Utility/VASprintfTest.cpp Wed Aug  9 10:27:02 2017
@@ -14,6 +14,12 @@
 
 #include 
 
+#if defined (_WIN32)
+#define TEST_ENCODING ".932"  // On Windows, test codepage 932
+#else
+#define TEST_ENCODING "C" // ...otherwise, any widely available uni-byte LC
+#endif
+
 using namespace lldb_private;
 using namespace llvm;
 
@@ -46,7 +52,8 @@ TEST(VASprintfTest, EncodingError) {
   // Save the current locale first.
   std::string Current(::setlocale(LC_ALL, nullptr));
 
-  setlocale(LC_ALL, ".932");
+  // Ensure tested locale is successfully set
+  ASSERT_TRUE(setlocale(LC_ALL, TEST_ENCODING));
 
   wchar_t Invalid[2];
   Invalid[0] = 0x100;
@@ -55,5 +62,6 @@ TEST(VASprintfTest, EncodingError) {
   EXPECT_FALSE(Sprintf(Buffer, "%ls", Invalid));
   EXPECT_EQ("", Buffer);
 
-  setlocale(LC_ALL, Current.c_str());
+  // Ensure we've restored the original locale once tested
+  ASSERT_TRUE(setlocale(LC_ALL, Current.c_str()));
 }


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


[Lldb-commits] [PATCH] D36496: Fix VASprintfTest.cpp for Darwin, add checks

2017-08-09 Thread Tim Hammerquist via Phabricator via lldb-commits
penryu added a comment.

Committed revision 310499.
Closing revision https://reviews.llvm.org/D36496 'Fix VASprintfTest.cpp for 
Darwin, add checks'...


https://reviews.llvm.org/D36496



___
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] [PATCH] D35223: Report inferior SIGSEGV/SIGILL/SIGBUS/SIGFPE as a signal instead of an exception on freebsd

2017-08-09 Thread Karnajit Wangkhem via Phabricator via lldb-commits
karnajitw updated this revision to Diff 110438.
karnajitw added a comment.
Herald added a subscriber: krytarowski.

Updated the diff to include the changes that were required in the test part. 
Please verify.


Repository:
  rL LLVM

https://reviews.llvm.org/D35223

Files:
  
packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
  
packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
  source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
  source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
  source/Plugins/Process/FreeBSD/POSIXStopInfo.h
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Index: source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -1204,7 +1204,9 @@
   case SIGBUS:
 lldb::addr_t fault_addr = reinterpret_cast(info->si_addr);
 const auto reason = GetCrashReason(*info);
-return ProcessMessage::Crash(tid, reason, signo, fault_addr);
+if (reason != CrashReason::eInvalidCrashReason) {
+  return ProcessMessage::Crash(tid, reason, signo, fault_addr);
+} // else; Use atleast si_signo info for other si_code
   }

   // Everything else is "normal" and does not require any special action on
Index: source/Plugins/Process/FreeBSD/POSIXStopInfo.h
===
--- source/Plugins/Process/FreeBSD/POSIXStopInfo.h
+++ source/Plugins/Process/FreeBSD/POSIXStopInfo.h
@@ -45,19 +45,6 @@
 };

 //===--===//
-/// @class POSIXCrashStopInfo
-/// @brief Represents the stop state of process that is ready to crash.
-///
-class POSIXCrashStopInfo : public POSIXStopInfo {
-public:
-  POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, CrashReason reason,
- lldb::addr_t fault_addr);
-  ~POSIXCrashStopInfo();
-
-  lldb::StopReason GetStopReason() const;
-};
-
-//===--===//
 /// @class POSIXNewThreadStopInfo
 /// @brief Represents the stop state of process when a new thread is spawned.
 ///
Index: source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
===
--- source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
+++ source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp
@@ -28,22 +28,6 @@
 bool POSIXLimboStopInfo::ShouldNotify(Event *event_ptr) { return false; }

 //===--===//
-// POSIXCrashStopInfo
-
-POSIXCrashStopInfo::POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status,
-   CrashReason reason,
-   lldb::addr_t fault_addr)
-: POSIXStopInfo(thread, status) {
-  m_description = ::GetCrashReasonString(reason, fault_addr);
-}
-
-POSIXCrashStopInfo::~POSIXCrashStopInfo() {}
-
-lldb::StopReason POSIXCrashStopInfo::GetStopReason() const {
-  return lldb::eStopReasonException;
-}
-
-//===--===//
 // POSIXNewThreadStopInfo

 POSIXNewThreadStopInfo::~POSIXNewThreadStopInfo() {}
Index: source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
===
--- source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
+++ source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
@@ -375,6 +375,7 @@
 LimboNotify(message);
 break;

+  case ProcessMessage::eCrashMessage:
   case ProcessMessage::eSignalMessage:
 SignalNotify(message);
 break;
@@ -395,10 +396,6 @@
 WatchNotify(message);
 break;

-  case ProcessMessage::eCrashMessage:
-CrashNotify(message);
-break;
-
   case ProcessMessage::eExecMessage:
 ExecNotify(message);
 break;
@@ -577,7 +574,14 @@

 void FreeBSDThread::SignalNotify(const ProcessMessage &message) {
   int signo = message.GetSignal();
-  SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
+  if (message.GetKind() == ProcessMessage::eCrashMessage) {
+std::string stop_description = GetCrashReasonString(
+message.GetCrashReason(), message.GetFaultAddress());
+SetStopInfo(StopInfo::CreateStopReasonWithSignal(
+*this, signo, stop_description.c_str()));
+  } else {
+SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
+  }
 }

 void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) {
@@ -585,21 +589,6 @@
   SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo));
 }

-void FreeBSDThread::CrashNotify(const ProcessMessage &message) {
-  // FIXME: Update stop reason as per bugzilla 14598
-  int signo = message.GetSignal();
-
-  assert(message.Ge

[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] The symbol with NOTYPE doesn't contain any valid address

2017-08-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I think a better solution is to not give the symbol's address a valid section 
in the first place. This would be done in ObjectFileELF.cpp when . It doesn't 
seem like the section is valid because $debug_ranges627 shouldn't have an 
address that matches something in .text. It just doesn't make sense.

My proposed fix would be in ObjectFileElf.cpp in ObjectFileELF::ParseSymbols(). 
The current code looks like:

  Elf64_Half section_idx = symbol.st_shndx;
  
  switch (section_idx) {
  case SHN_ABS:
symbol_type = eSymbolTypeAbsolute;
break;
  case SHN_UNDEF:
symbol_type = eSymbolTypeUndefined;
break;
  default:
symbol_section_sp = section_list->GetSectionAtIndex(section_idx);
break;
  }

It could be fixed with:

  Elf64_Half section_idx = symbol.st_shndx;
  
  switch (section_idx) {
  case SHN_ABS:
symbol_type = eSymbolTypeAbsolute;
break;
  case SHN_UNDEF:
symbol_type = eSymbolTypeUndefined;
break;
  default:
if (symbol.getType() != STT_NOTYPE)
  symbol_section_sp = section_list->GetSectionAtIndex(section_idx);
break;
  }


https://reviews.llvm.org/D35784



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


[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] The symbol with NOTYPE doesn't contain any valid address

2017-08-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

It would be a good idea to see what this $debug_ranges627 symbol actually is. 
It seems like a stray linker symbol that wasn't stripped? It would be a good 
idea to figure out what this symbol is so we can determine how to deal with it 
correctly.


https://reviews.llvm.org/D35784



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


[Lldb-commits] [PATCH] D34776: Make i386-*-freebsd expression work on JIT path

2017-08-09 Thread Ed Maste via Phabricator via lldb-commits
emaste added a comment.

I've committed this to FreeBSD's copy of lldb in r322326 
. @labath if you're happy with this patch 
I will commit to lldb for @karnajitw. I'm not sure how the patch ended up with 
a conflict, but it's just a whitespace issue.


https://reviews.llvm.org/D34776



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


[Lldb-commits] [PATCH] D35223: Report inferior SIGSEGV/SIGILL/SIGBUS/SIGFPE as a signal instead of an exception on freebsd

2017-08-09 Thread Ed Maste via Phabricator via lldb-commits
emaste accepted this revision.
emaste added a comment.
This revision is now accepted and ready to land.

Still would appreciate diffs uploaded with full context - i.e.,

  Note that you can upload patches created through various diff tools, 
including git and svn. To make reviews easier, please always include as much 
context as possible with your diff! Don’t worry, Phabricator will automatically 
send a diff with a smaller context in the review email, but having the full 
file in the web interface will help the reviewer understand your code.
  
  To get a full diff, use one of the following commands (or just use Arcanist 
to upload your patch):
  
  git show HEAD -U99 > mypatch.patch
  git format-patch -U99 @{u}
  svn diff --diff-cmd=diff -x -U99

However, patch looks good to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D35223



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


[Lldb-commits] [lldb] r310512 - Add remainder of unittests to Xcode project

2017-08-09 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Wed Aug  9 12:44:18 2017
New Revision: 310512

URL: http://llvm.org/viewvc/llvm-project?rev=310512&view=rev
Log:
Add remainder of unittests to Xcode project

Resolves a few build settings required to run DWARF tests as well.

rdar://problem/33664378

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=310512&r1=310511&r2=310512&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Aug  9 12:44:18 2017
@@ -876,6 +876,20 @@
9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/; };
9A2057031F3A605200F6C293 /* VASprintfTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp 
*/; };
+   9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A2057061F3B818600F6C293 /* 
MemoryRegionInfoTest.cpp */; };
+   9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */; };
+   9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 9A20570E1F3B821A00F6C293 /* test-dwarf.exe */; };
+   9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A20570A1F3B81F300F6C293 /* 
SymbolFileDWARFTests.cpp */; };
+   9A2057171F3B861400F6C293 /* TestDWARFCallFrameInfo.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A2057131F3B860D00F6C293 /* 
TestDWARFCallFrameInfo.cpp */; };
+   9A2057181F3B861400F6C293 /* TestType.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A2057141F3B860D00F6C293 /* TestType.cpp */; };
+   9A20571C1F3B867400F6C293 /* PlatformDarwinTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A20571A1F3B866F00F6C293 /* 
PlatformDarwinTest.cpp */; };
+   9A2057201F3B8D2500F6C293 /* UnixSignalsTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A20571E1F3B8D2100F6C293 /* UnixSignalsTest.cpp 
*/; };
+   9A2057281F3B8DDB00F6C293 /* TestELFHeader.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A2057241F3B8DD200F6C293 /* TestELFHeader.cpp 
*/; };
+   9A2057291F3B8DDB00F6C293 /* TestObjectFileELF.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A2057251F3B8DD200F6C293 /* 
TestObjectFileELF.cpp */; };
+   9A20572D1F3B8E6600F6C293 /* TestCompletion.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A20572B1F3B8E6200F6C293 /* TestCompletion.cpp 
*/; };
+   9A2057381F3B8E7E00F6C293 /* FileSystemTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A20572E1F3B8E7600F6C293 /* FileSystemTest.cpp 
*/; };
+   9A2057391F3B8E7E00F6C293 /* HostTest.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A20572F1F3B8E7600F6C293 /* HostTest.cpp */; };
+   9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A2057301F3B8E7600F6C293 /* MainLoopTest.cpp */; 
};
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* 
EmulateInstructionARM.cpp */; };
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* 
EmulationStateARM.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -897,7 +911,6 @@
9A3D43EC1F3237F900EB767C /* ListenerTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A3D43E31F3237D500EB767C /* ListenerTest.cpp */; 
};
9A3D43ED1F3237F900EB767C /* StateTest.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 9A3D43E21F3237D500EB767C /* StateTest.cpp */; };
9A3D43EE1F3237F900EB767C /* StreamCallbackTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A3D43E11F3237D500EB767C /* 
StreamCallbackTest.cpp */; };
-   9A3D43F01F32380D00EB767C /* debugserver in CopyFiles */ = {isa 
= PBXBuildFile; fileRef = 9A3D43EF1F32380D00EB767C /* debugserver */; };
9A4F35101368A51A00823F52 /* StreamAsynchronousIO.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A4F350F1368A51A00823F52 /* 
StreamAsynchronousIO.cpp */; };
9A77AD541E64E2760025CE04 /* RegisterInfoPOSI

[Lldb-commits] [PATCH] D35223: Report inferior SIGSEGV/SIGILL/SIGBUS/SIGFPE as a signal instead of an exception on freebsd

2017-08-09 Thread Karnajit Wangkhem via Phabricator via lldb-commits
karnajitw added a comment.

Thanks for the info. I will make sure of it in future.


Repository:
  rL LLVM

https://reviews.llvm.org/D35223



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