[Lldb-commits] [PATCH] D27088: [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS

2017-01-03 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain added a comment.

Instead of creating header SBDwarf.h, is it possible that python can reuse llvm 
Dwarf.h ?

Thanks


https://reviews.llvm.org/D27088



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


[Lldb-commits] [PATCH] D27088: [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS

2017-01-03 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain updated this revision to Diff 83012.
nitesh.jain added a comment.

Update diff as per suggestion.


https://reviews.llvm.org/D27088

Files:
  include/lldb/API/SBDwarf.h
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
  scripts/lldb.swig

Index: scripts/lldb.swig
===
--- scripts/lldb.swig
+++ scripts/lldb.swig
@@ -66,6 +66,7 @@
 #include "lldb/API/SBCommunication.h"
 #include "lldb/API/SBCompileUnit.h"
 #include "lldb/API/SBData.h"
+#include "lldb/API/SBDwarf.h"
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBDeclaration.h"
 #include "lldb/API/SBError.h"
@@ -133,6 +134,7 @@
 %include "lldb/lldb-enumerations.h"
 %include "lldb/lldb-forward.h"
 %include "lldb/lldb-types.h"
+%include "lldb/API/SBDwarf.h"
 
 /* Forward declaration of SB classes. */
 %include "lldb/API/SBDefines.h"
Index: packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
@@ -541,6 +541,10 @@
 self.assertIsNotNone(reg_infos)
 self.assertTrue(len(reg_infos) > 0)
 
+inferior_exe_path = os.path.abspath("a.out")
+Target = self.dbg.CreateTarget(inferior_exe_path)
+byte_order = Target.GetByteOrder()
+
 # Read value for each register.
 reg_index = 0
 for reg_info in reg_infos:
@@ -565,6 +569,9 @@
 # Verify the response length.
 p_response = context.get("p_response")
 self.assertIsNotNone(p_response)
+
+if "dynamic_size_dwarf_expr_bytes" in reg_info:
+self.updateRegInfoBitsize(reg_info, byte_order)
 self.assertEqual(len(p_response), 2 * int(reg_info["bitsize"]) / 8)
 
 # Increment loop
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1260,6 +1260,94 @@
 
 return self.lldbArchitecture
 
+def updateRegInfoBitsize(self, reg_info, byte_order):
+""" Update the regInfo bit size. """
+
+# Evaluate Dwarf Expression
+expr_result = self.evaluateDwarfExpression(reg_info["dynamic_size_dwarf_expr_bytes"],
+byte_order)
+
+if expr_result == 0:
+reg_info["bitsize"] = 32
+elif expr_result == 1:
+reg_info["bitsize"] = 64
+
+def evaluateDwarfExpression(self, dwarf_opcode, byte_order):
+"""Evaluate Dwarf Expression. """
+
+dwarf_opcode = [dwarf_opcode[i:i+2] for i in range(0,len(dwarf_opcode),2)]
+dwarf_data = []
+for index in range(len(dwarf_opcode)):
+
+if index < len(dwarf_opcode):
+val = int(dwarf_opcode[index], 16)
+else:
+break
+
+if val == lldb.DW_OP_regx:
+# Read register number 
+self.assertTrue(len(dwarf_opcode) > (index + 1))
+reg_no = int(dwarf_opcode.pop(index + 1), 16)
+
+self.reset_test_sequence()
+# Read register value
+self.test_sequence.add_log_lines(
+ ["read packet: $p{0:x}#00".format(reg_no),
+ {"direction": "send", "regex": r"^\$([0-9a-fA-F]+)#",
+ "capture": {1: "p_response"}}],True)
+
+Context = self.expect_gdbremote_sequence()
+self.assertIsNotNone(Context)
+p_response = Context.get("p_response")
+self.assertIsNotNone(p_response)
+
+if byte_order == lldb.eByteOrderLittle:
+   # In case of little endian
+   # first decode the HEX ASCII bytes and then reverse it
+   # to get actual value of SR register
+   p_response = "".join(reversed([p_response[i:i+2] for i in range(0,
+  len(p_response),2)]))
+# Push register value
+dwarf_data.append(int(p_response,16))
+
+elif val == lldb.DW_OP_lit1:
+# Push literal 1
+dwarf_data.append(1)
+   
+elif val == lldb.DW_OP_lit26:
+# Push literal 26
+dwarf_data.append(26)
+
+elif val == lldb.DW_OP_shl:
+# left shift and push the result back
+self.assertTrue(len(dwarf_data) > 1)
+shift_amount = dwarf_data.pop()
+val_to_shift = dwarf_data.pop()
+result = val_to_shift << shift_amount
+dwa

[Lldb-commits] [lldb] r290934 - [CMake] Fix install rules for tools included in the framework

2017-01-03 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Tue Jan  3 21:36:35 2017
New Revision: 290934

URL: http://llvm.org/viewvc/llvm-project?rev=290934&view=rev
Log:
[CMake] Fix install rules for tools included in the framework

The logic for install rules was wrong for tools included in the framework if 
the framework build is disabled.

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=290934&r1=290933&r2=290934&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Jan  3 21:36:35 2017
@@ -141,7 +141,7 @@ function(add_lldb_executable name)
 endif()
   endif()
 
-  if(ARG_GENERATE_INSTALL AND NOT ARG_INCLUDE_IN_FRAMEWORK)
+  if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND 
LLDB_BUILD_FRAMEWORK ))
 install(TARGETS ${name}
   COMPONENT ${name}
   RUNTIME DESTINATION bin)


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


[Lldb-commits] [lldb] r290917 - Remove SymbolFilePDBTests.cpp from the list of tests to include in the

2017-01-03 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Jan  3 18:01:25 2017
New Revision: 290917

URL: http://llvm.org/viewvc/llvm-project?rev=290917&view=rev
Log:
Remove SymbolFilePDBTests.cpp from the list of tests to include in the 
lldb-gtest binary that xcode builds for -scheme lldb-gtest; these tests
won't run on macosx systems.  Fixes testsuite failures we started
seeing after 290819.

 

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=290917&r1=290916&r2=290917&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jan  3 18:01:25 2017
@@ -115,7 +115,6 @@
23DDF226196C3EE600BB8417 /* CommandOptionValidators.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 23DDF224196C3EE600BB8417 /* 
CommandOptionValidators.cpp */; };
23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23E2E5161D903689006F38BB /* ArchSpecTest.cpp */; 
};
23E2E5271D903782006F38BB /* MinidumpParserTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 23E2E51A1D9036F2006F38BB /* 
MinidumpParserTest.cpp */; };
-   23E2E5291D9037D9006F38BB /* SymbolFilePDBTests.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 23CB15141D66CF8700EDDDE1 /* 
SymbolFilePDBTests.cpp */; };
23E2E52B1D9037E6006F38BB /* ModuleCacheTest.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23CB15011D66CD8400EDDDE1 /* ModuleCacheTest.cpp 
*/; };
23E2E5321D903832006F38BB /* BreakpointIDTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 23E2E52D1D90382B006F38BB /* 
BreakpointIDTest.cpp */; };
23E2E5441D904913006F38BB /* MinidumpParser.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 23E2E5371D9048FB006F38BB /* MinidumpParser.cpp 
*/; };
@@ -6920,7 +6919,6 @@
23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in 
Sources */,
AF248A4D1DA71C77000B814D /* 
TestArm64InstEmulation.cpp in Sources */,
23CB15371D66DA9300EDDDE1 /* PythonTestSuite.cpp 
in Sources */,
-   23E2E5291D9037D9006F38BB /* 
SymbolFilePDBTests.cpp in Sources */,
23E2E5321D903832006F38BB /* 
BreakpointIDTest.cpp in Sources */,
23CB15381D66DA9300EDDDE1 /* 
PythonExceptionStateTests.cpp in Sources */,
23CB15391D66DA9300EDDDE1 /* 
DataExtractorTest.cpp in Sources */,


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


Re: [Lldb-commits] [lldb] r290819 - [unittests] Split DWARF tests out of PDB, fix standalone build

2017-01-03 Thread Tim Hammerquist via lldb-commits
It may also be the addition of a source file not being added to the Xcode
project. This is currently handled by manual changes to the xcodeproj.

-Tim



On Tue, Jan 3, 2017 at 9:41 AM, Pavel Labath via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> I bet it's the Xcode build not replicating the
> if (LLVM_ENABLE_DIA_SDK)
>   add_subdirectory(PDB)
> endif()
> and trying to run the PDB test even though it shouldn't.
>
> (I don't really have a good idea on how to fix this.)
>
> pl
>
> On 3 January 2017 at 17:36, Zachary Turner via lldb-commits
>  wrote:
> > Hi Michal,
> > It looks like this patch may have broken this bot.
> >
> > http://lab.llvm.org:8080/green/job/lldb_build_test/23767/consoleFull#-
> 1083450927b825e790-484f-4586-af29-73c4754ff671
> >
> > What do you think?
> >
> > On Mon, Jan 2, 2017 at 10:31 AM Michal Gorny via lldb-commits
> >  wrote:
> >>
> >> Author: mgorny
> >> Date: Mon Jan  2 12:20:33 2017
> >> New Revision: 290819
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=290819&view=rev
> >> Log:
> >> [unittests] Split DWARF tests out of PDB, fix standalone build
> >>
> >> Split the PDB tests into DWARF test and actual PDB tests, the latter
> >> requiring DIA SDK. Use the new LLVMConfig.cmake LLVM_ENABLE_DIA_SDK
> >> symbol to enable the PDB tests rather than relying on
> >> llvm/Config/config.h private include file that is not available when
> >> building standalone.
> >>
> >> Differential Revision: https://reviews.llvm.org/D26249
> >>
> >> Added:
> >> lldb/trunk/unittests/SymbolFile/DWARF/
> >> lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
> >> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/
> >> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp
> >>   - copied, changed from r290688,
> >> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
> >> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe
> >>   - copied, changed from r290688,
> >> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
> >> lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
> >> Removed:
> >> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
> >> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
> >> Modified:
> >> lldb/trunk/unittests/SymbolFile/CMakeLists.txt
> >> lldb/trunk/unittests/SymbolFile/PDB/CMakeLists.txt
> >> lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> >>
> >> Modified: lldb/trunk/unittests/SymbolFile/CMakeLists.txt
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/
> SymbolFile/CMakeLists.txt?rev=290819&r1=290818&r2=290819&view=diff
> >>
> >> 
> ==
> >> --- lldb/trunk/unittests/SymbolFile/CMakeLists.txt (original)
> >> +++ lldb/trunk/unittests/SymbolFile/CMakeLists.txt Mon Jan  2 12:20:33
> >> 2017
> >> @@ -1 +1,4 @@
> >> -add_subdirectory(PDB)
> >> +add_subdirectory(DWARF)
> >> +if (LLVM_ENABLE_DIA_SDK)
> >> +  add_subdirectory(PDB)
> >> +endif()
> >>
> >> Added: lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/
> SymbolFile/DWARF/CMakeLists.txt?rev=290819&view=auto
> >>
> >> 
> ==
> >> --- lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt (added)
> >> +++ lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt Mon Jan  2
> >> 12:20:33 2017
> >> @@ -0,0 +1,8 @@
> >> +add_lldb_unittest(SymbolFileDWARFTests
> >> +  SymbolFileDWARFTests.cpp
> >> +  )
> >> +
> >> +set(test_inputs
> >> +   test-dwarf.exe)
> >> +
> >> +add_unittest_inputs(SymbolFileDWARFTests "${test_inputs}")
> >>
> >> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp
> (from
> >> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp)
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/
> SymbolFile/DWARF/Inputs/test-dwarf.cpp?p2=lldb/trunk/
> unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp&p1=lldb/
> trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp&r1=
> 290688&r2=290819&rev=290819&view=diff
> >>
> >> 
> ==
> >> (empty)
> >>
> >> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe
> (from
> >> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe)
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/
> SymbolFile/DWARF/Inputs/test-dwarf.exe?p2=lldb/trunk/
> unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe&p1=lldb/
> trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe&r1=
> 290688&r2=290819&rev=290819&view=diff
> >>
> >> 
> ==
> >> (empty)
> >>
> >> Added: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/
> Symb

Re: [Lldb-commits] [lldb] r290819 - [unittests] Split DWARF tests out of PDB, fix standalone build

2017-01-03 Thread Pavel Labath via lldb-commits
I bet it's the Xcode build not replicating the
if (LLVM_ENABLE_DIA_SDK)
  add_subdirectory(PDB)
endif()
and trying to run the PDB test even though it shouldn't.

(I don't really have a good idea on how to fix this.)

pl

On 3 January 2017 at 17:36, Zachary Turner via lldb-commits
 wrote:
> Hi Michal,
> It looks like this patch may have broken this bot.
>
> http://lab.llvm.org:8080/green/job/lldb_build_test/23767/consoleFull#-1083450927b825e790-484f-4586-af29-73c4754ff671
>
> What do you think?
>
> On Mon, Jan 2, 2017 at 10:31 AM Michal Gorny via lldb-commits
>  wrote:
>>
>> Author: mgorny
>> Date: Mon Jan  2 12:20:33 2017
>> New Revision: 290819
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=290819&view=rev
>> Log:
>> [unittests] Split DWARF tests out of PDB, fix standalone build
>>
>> Split the PDB tests into DWARF test and actual PDB tests, the latter
>> requiring DIA SDK. Use the new LLVMConfig.cmake LLVM_ENABLE_DIA_SDK
>> symbol to enable the PDB tests rather than relying on
>> llvm/Config/config.h private include file that is not available when
>> building standalone.
>>
>> Differential Revision: https://reviews.llvm.org/D26249
>>
>> Added:
>> lldb/trunk/unittests/SymbolFile/DWARF/
>> lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
>> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/
>> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp
>>   - copied, changed from r290688,
>> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
>> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe
>>   - copied, changed from r290688,
>> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
>> lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
>> Removed:
>> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
>> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
>> Modified:
>> lldb/trunk/unittests/SymbolFile/CMakeLists.txt
>> lldb/trunk/unittests/SymbolFile/PDB/CMakeLists.txt
>> lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>>
>> Modified: lldb/trunk/unittests/SymbolFile/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/CMakeLists.txt?rev=290819&r1=290818&r2=290819&view=diff
>>
>> ==
>> --- lldb/trunk/unittests/SymbolFile/CMakeLists.txt (original)
>> +++ lldb/trunk/unittests/SymbolFile/CMakeLists.txt Mon Jan  2 12:20:33
>> 2017
>> @@ -1 +1,4 @@
>> -add_subdirectory(PDB)
>> +add_subdirectory(DWARF)
>> +if (LLVM_ENABLE_DIA_SDK)
>> +  add_subdirectory(PDB)
>> +endif()
>>
>> Added: lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt?rev=290819&view=auto
>>
>> ==
>> --- lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt (added)
>> +++ lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt Mon Jan  2
>> 12:20:33 2017
>> @@ -0,0 +1,8 @@
>> +add_lldb_unittest(SymbolFileDWARFTests
>> +  SymbolFileDWARFTests.cpp
>> +  )
>> +
>> +set(test_inputs
>> +   test-dwarf.exe)
>> +
>> +add_unittest_inputs(SymbolFileDWARFTests "${test_inputs}")
>>
>> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp (from
>> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp)
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp?p2=lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp&p1=lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp&r1=290688&r2=290819&rev=290819&view=diff
>>
>> ==
>> (empty)
>>
>> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe (from
>> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe)
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe?p2=lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe&p1=lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe&r1=290688&r2=290819&rev=290819&view=diff
>>
>> ==
>> (empty)
>>
>> Added: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp?rev=290819&view=auto
>>
>> ==
>> --- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (added)
>> +++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Mon Jan
>> 2 12:20:33 2017
>> @@ -0,0 +1,83 @@
>> +//===-- PythonDataObjectsTests.cpp --*- C++
>> -*-===//
>> +//
>> +// The LLVM Compiler Infrastructure
>> +//
>> +// This file is d

Re: [Lldb-commits] [lldb] r290819 - [unittests] Split DWARF tests out of PDB, fix standalone build

2017-01-03 Thread Zachary Turner via lldb-commits
Hi Michal,
It looks like this patch may have broken this bot.

http://lab.llvm.org:8080/green/job/lldb_build_test/23767/consoleFull#-1083450927b825e790-484f-4586-af29-73c4754ff671

What do you think?

On Mon, Jan 2, 2017 at 10:31 AM Michal Gorny via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: mgorny
> Date: Mon Jan  2 12:20:33 2017
> New Revision: 290819
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290819&view=rev
> Log:
> [unittests] Split DWARF tests out of PDB, fix standalone build
>
> Split the PDB tests into DWARF test and actual PDB tests, the latter
> requiring DIA SDK. Use the new LLVMConfig.cmake LLVM_ENABLE_DIA_SDK
> symbol to enable the PDB tests rather than relying on
> llvm/Config/config.h private include file that is not available when
> building standalone.
>
> Differential Revision: https://reviews.llvm.org/D26249
>
> Added:
> lldb/trunk/unittests/SymbolFile/DWARF/
> lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/
> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp
>   - copied, changed from r290688,
> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
> lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe
>   - copied, changed from r290688,
> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
> lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
> Removed:
> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp
> lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe
> Modified:
> lldb/trunk/unittests/SymbolFile/CMakeLists.txt
> lldb/trunk/unittests/SymbolFile/PDB/CMakeLists.txt
> lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>
> Modified: lldb/trunk/unittests/SymbolFile/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/CMakeLists.txt?rev=290819&r1=290818&r2=290819&view=diff
>
> ==
> --- lldb/trunk/unittests/SymbolFile/CMakeLists.txt (original)
> +++ lldb/trunk/unittests/SymbolFile/CMakeLists.txt Mon Jan  2 12:20:33 2017
> @@ -1 +1,4 @@
> -add_subdirectory(PDB)
> +add_subdirectory(DWARF)
> +if (LLVM_ENABLE_DIA_SDK)
> +  add_subdirectory(PDB)
> +endif()
>
> Added: lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt?rev=290819&view=auto
>
> ==
> --- lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt (added)
> +++ lldb/trunk/unittests/SymbolFile/DWARF/CMakeLists.txt Mon Jan  2
> 12:20:33 2017
> @@ -0,0 +1,8 @@
> +add_lldb_unittest(SymbolFileDWARFTests
> +  SymbolFileDWARFTests.cpp
> +  )
> +
> +set(test_inputs
> +   test-dwarf.exe)
> +
> +add_unittest_inputs(SymbolFileDWARFTests "${test_inputs}")
>
> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp (from
> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp?p2=lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.cpp&p1=lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.cpp&r1=290688&r2=290819&rev=290819&view=diff
>
> ==
> (empty)
>
> Copied: lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe (from
> r290688, lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe?p2=lldb/trunk/unittests/SymbolFile/DWARF/Inputs/test-dwarf.exe&p1=lldb/trunk/unittests/SymbolFile/PDB/Inputs/test-dwarf.exe&r1=290688&r2=290819&rev=290819&view=diff
>
> ==
> (empty)
>
> Added: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp?rev=290819&view=auto
>
> ==
> --- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (added)
> +++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Mon
> Jan  2 12:20:33 2017
> @@ -0,0 +1,83 @@
> +//===-- PythonDataObjectsTests.cpp --*- C++
> -*-===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===--===//
> +
> +#include "gtest/gtest.h"
> +
> +#include "llvm/ADT/STLExtras.h"
> +#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
> +#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
> +#include "llv

[Lldb-commits] [PATCH] D28233: Improve the performance of jModulesInfo in lldb-server

2017-01-03 Thread Tamas Berghammer via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290895: Improve the performance of jModulesInfo in 
lldb-server (authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D28233?vs=82884&id=82897#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28233

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -119,7 +119,7 @@
   ArchSpec m_arch;
 
   LazyBool m_supports_mem_region;
-  std::vector m_mem_region_cache;
+  std::vector> m_mem_region_cache;
 
   lldb::tid_t m_pending_notification_tid;
 
@@ -217,6 +217,8 @@
   void ThreadWasCreated(NativeThreadLinux &thread);
 
   void SigchldHandler();
+
+  Error PopulateMemoryRegionCache();
 };
 
 } // namespace process_linux
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1689,68 +1689,14 @@
   // Assume proc maps entries are in ascending order.
   // FIXME assert if we find differently.
 
-  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  Error error;
-
   if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
 // We're done.
-error.SetErrorString("unsupported");
-return error;
+return Error("unsupported");
   }
 
-  // If our cache is empty, pull the latest.  There should always be at least
-  // one memory region
-  // if memory region handling is supported.
-  if (m_mem_region_cache.empty()) {
-error = ProcFileReader::ProcessLineByLine(
-GetID(), "maps", [&](const std::string &line) -> bool {
-  MemoryRegionInfo info;
-  const Error parse_error =
-  ParseMemoryRegionInfoFromProcMapsLine(line, info);
-  if (parse_error.Success()) {
-m_mem_region_cache.push_back(info);
-return true;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s failed to parse proc maps "
-  "line '%s': %s",
-  __FUNCTION__, line.c_str(), error.AsCString());
-return false;
-  }
-});
-
-// If we had an error, we'll mark unsupported.
-if (error.Fail()) {
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  return error;
-} else if (m_mem_region_cache.empty()) {
-  // No entries after attempting to read them.  This shouldn't happen if
-  // /proc/{pid}/maps
-  // is supported.  Assume we don't support map entries via procfs.
-  if (log)
-log->Printf("NativeProcessLinux::%s failed to find any procfs maps "
-"entries, assuming no support for memory region metadata "
-"retrieval",
-__FUNCTION__);
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  error.SetErrorString("not supported");
-  return error;
-}
-
-if (log)
-  log->Printf("NativeProcessLinux::%s read %" PRIu64
-  " memory region entries from /proc/%" PRIu64 "/maps",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()), GetID());
-
-// We support memory retrieval, remember that.
-m_supports_mem_region = LazyBool::eLazyBoolYes;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s reusing %" PRIu64
-  " cached memory region entries",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()));
+  Error error = PopulateMemoryRegionCache();
+  if (error.Fail()) {
+return error;
   }
 
   lldb::addr_t prev_base_address = 0;
@@ -1760,7 +1706,7 @@
   // There can be a ton of regions on pthreads apps with lots of threads.
   for (auto it = m_mem_region_cache.begin(); it != m_mem_region_cache.end();
++it) {
-MemoryRegionInfo &proc_entry_info = *it;
+MemoryRegionInfo &proc_entry_info = it->first;
 
 // Sanity check assumption that /proc/{pid}/maps entries are ascending.
 assert((proc_entry_info.GetRange().GetRangeBase() >= prev_base_address) &&
@@ -1803,6 +1749,67 @@
   return error;
 }
 
+Error NativeProcessLinux::PopulateMemoryRegionCache() {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+
+  // If our cache is empty, pull the latest.  There should always be at least
+  // one memory region if memory region handling is supported.
+  if (!m_mem_region_cache.empty()) {
+if (log)
+  log->Printf("NativeProcessLinux::%s reusing %" PRIu64
+  " cached memory region entries",
+

[Lldb-commits] [lldb] r290895 - Improve the performance of jModulesInfo in lldb-server

2017-01-03 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Tue Jan  3 10:29:43 2017
New Revision: 290895

URL: http://llvm.org/viewvc/llvm-project?rev=290895&view=rev
Log:
Improve the performance of jModulesInfo in lldb-server

Previously it parsed /proc//maps for every module separately
resulting in a very slow response time. This CL add some caching and
optimizes the implementation to improve the code from O(n*m) to O(n+m)
where n is the number of modules requested and m is the number of
files mapped into memory.

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

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=290895&r1=290894&r2=290895&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Jan  3 
10:29:43 2017
@@ -1689,68 +1689,14 @@ Error NativeProcessLinux::GetMemoryRegio
   // Assume proc maps entries are in ascending order.
   // FIXME assert if we find differently.
 
-  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  Error error;
-
   if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
 // We're done.
-error.SetErrorString("unsupported");
-return error;
+return Error("unsupported");
   }
 
-  // If our cache is empty, pull the latest.  There should always be at least
-  // one memory region
-  // if memory region handling is supported.
-  if (m_mem_region_cache.empty()) {
-error = ProcFileReader::ProcessLineByLine(
-GetID(), "maps", [&](const std::string &line) -> bool {
-  MemoryRegionInfo info;
-  const Error parse_error =
-  ParseMemoryRegionInfoFromProcMapsLine(line, info);
-  if (parse_error.Success()) {
-m_mem_region_cache.push_back(info);
-return true;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s failed to parse proc maps "
-  "line '%s': %s",
-  __FUNCTION__, line.c_str(), error.AsCString());
-return false;
-  }
-});
-
-// If we had an error, we'll mark unsupported.
-if (error.Fail()) {
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  return error;
-} else if (m_mem_region_cache.empty()) {
-  // No entries after attempting to read them.  This shouldn't happen if
-  // /proc/{pid}/maps
-  // is supported.  Assume we don't support map entries via procfs.
-  if (log)
-log->Printf("NativeProcessLinux::%s failed to find any procfs maps "
-"entries, assuming no support for memory region metadata "
-"retrieval",
-__FUNCTION__);
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  error.SetErrorString("not supported");
-  return error;
-}
-
-if (log)
-  log->Printf("NativeProcessLinux::%s read %" PRIu64
-  " memory region entries from /proc/%" PRIu64 "/maps",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()), GetID());
-
-// We support memory retrieval, remember that.
-m_supports_mem_region = LazyBool::eLazyBoolYes;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s reusing %" PRIu64
-  " cached memory region entries",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()));
+  Error error = PopulateMemoryRegionCache();
+  if (error.Fail()) {
+return error;
   }
 
   lldb::addr_t prev_base_address = 0;
@@ -1760,7 +1706,7 @@ Error NativeProcessLinux::GetMemoryRegio
   // There can be a ton of regions on pthreads apps with lots of threads.
   for (auto it = m_mem_region_cache.begin(); it != m_mem_region_cache.end();
++it) {
-MemoryRegionInfo &proc_entry_info = *it;
+MemoryRegionInfo &proc_entry_info = it->first;
 
 // Sanity check assumption that /proc/{pid}/maps entries are ascending.
 assert((proc_entry_info.GetRange().GetRangeBase() >= prev_base_address) &&
@@ -1803,6 +1749,67 @@ Error NativeProcessLinux::GetMemoryRegio
   return error;
 }
 
+Error NativeProcessLinux::PopulateMemoryRegionCache() {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+
+  // If our cache is empty, pull the latest.  There should always be at least
+  // one memory region if memory region handling is supported.
+  if (!m_mem_region_cache.empty()) {
+if (log)
+  log->Printf("NativeProcessLinux::%s reusing %" PRIu64
+  " cached memory region entries",
+  __FUNCTION__,
+  static_cast(m_mem_region_cache.size()));
+retu

[Lldb-commits] [PATCH] D28233: Improve the performance of jModulesInfo in lldb-server

2017-01-03 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer marked an inline comment as done.
tberghammer added a comment.

On some extremely large cases I seen the response time to fell from ~120s to 
~8s (default packet timeout is 2s).


https://reviews.llvm.org/D28233



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


[Lldb-commits] [PATCH] D28233: Improve the performance of jModulesInfo in lldb-server

2017-01-03 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks great, thanks.

Do you have any measurements on the real impact this makes on jModulesInfo 
packet?




Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:1757
+  // one memory region if memory region handling is supported.
+  if (m_mem_region_cache.empty()) {
+Error error = ProcFileReader::ProcessLineByLine(

Please put an early return here:
`if (!cache.empty() { log_if_you_want_to(); return Error(); }`


https://reviews.llvm.org/D28233



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2017-01-03 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer abandoned this revision.
tberghammer added a comment.

Based on the feedback will try to fix the Clang AS importer instead (don't have 
any ETA for it)


https://reviews.llvm.org/D27394



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


[Lldb-commits] [PATCH] D28233: Improve the performance of jModulesInfo in lldb-server

2017-01-03 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: labath.
tberghammer added a subscriber: lldb-commits.

Improve the performance of jModulesInfo in lldb-server

Previously it parsed /proc//maps for every module separately
resulting in a very slow response time. This CL add some caching and
optimizes the implementation to improve the code from O(n*m) to O(n+m)
where n is the number of modules requested and m is the number of
files mapped into memory.


https://reviews.llvm.org/D28233

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h

Index: source/Plugins/Process/Linux/NativeProcessLinux.h
===
--- source/Plugins/Process/Linux/NativeProcessLinux.h
+++ source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -119,7 +119,7 @@
   ArchSpec m_arch;
 
   LazyBool m_supports_mem_region;
-  std::vector m_mem_region_cache;
+  std::vector> m_mem_region_cache;
 
   lldb::tid_t m_pending_notification_tid;
 
@@ -217,6 +217,8 @@
   void ThreadWasCreated(NativeThreadLinux &thread);
 
   void SigchldHandler();
+
+  Error PopulateMemoryRegionCache();
 };
 
 } // namespace process_linux
Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1689,68 +1689,14 @@
   // Assume proc maps entries are in ascending order.
   // FIXME assert if we find differently.
 
-  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  Error error;
-
   if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
 // We're done.
-error.SetErrorString("unsupported");
-return error;
+return Error("unsupported");
   }
 
-  // If our cache is empty, pull the latest.  There should always be at least
-  // one memory region
-  // if memory region handling is supported.
-  if (m_mem_region_cache.empty()) {
-error = ProcFileReader::ProcessLineByLine(
-GetID(), "maps", [&](const std::string &line) -> bool {
-  MemoryRegionInfo info;
-  const Error parse_error =
-  ParseMemoryRegionInfoFromProcMapsLine(line, info);
-  if (parse_error.Success()) {
-m_mem_region_cache.push_back(info);
-return true;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s failed to parse proc maps "
-  "line '%s': %s",
-  __FUNCTION__, line.c_str(), error.AsCString());
-return false;
-  }
-});
-
-// If we had an error, we'll mark unsupported.
-if (error.Fail()) {
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  return error;
-} else if (m_mem_region_cache.empty()) {
-  // No entries after attempting to read them.  This shouldn't happen if
-  // /proc/{pid}/maps
-  // is supported.  Assume we don't support map entries via procfs.
-  if (log)
-log->Printf("NativeProcessLinux::%s failed to find any procfs maps "
-"entries, assuming no support for memory region metadata "
-"retrieval",
-__FUNCTION__);
-  m_supports_mem_region = LazyBool::eLazyBoolNo;
-  error.SetErrorString("not supported");
-  return error;
-}
-
-if (log)
-  log->Printf("NativeProcessLinux::%s read %" PRIu64
-  " memory region entries from /proc/%" PRIu64 "/maps",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()), GetID());
-
-// We support memory retrieval, remember that.
-m_supports_mem_region = LazyBool::eLazyBoolYes;
-  } else {
-if (log)
-  log->Printf("NativeProcessLinux::%s reusing %" PRIu64
-  " cached memory region entries",
-  __FUNCTION__,
-  static_cast(m_mem_region_cache.size()));
+  Error error = PopulateMemoryRegionCache();
+  if (error.Fail()) {
+return error;
   }
 
   lldb::addr_t prev_base_address = 0;
@@ -1760,7 +1706,7 @@
   // There can be a ton of regions on pthreads apps with lots of threads.
   for (auto it = m_mem_region_cache.begin(); it != m_mem_region_cache.end();
++it) {
-MemoryRegionInfo &proc_entry_info = *it;
+MemoryRegionInfo &proc_entry_info = it->first;
 
 // Sanity check assumption that /proc/{pid}/maps entries are ascending.
 assert((proc_entry_info.GetRange().GetRangeBase() >= prev_base_address) &&
@@ -1803,6 +1749,66 @@
   return error;
 }
 
+Error NativeProcessLinux::PopulateMemoryRegionCache() {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+
+  // If our cache is empty, pull the latest.  There should always be at least
+  // one memory region if memory region handling is supported.
+  if (m_mem_region_cache.empty()) {
+Error error = ProcFileReader::ProcessLineBy

[Lldb-commits] [lldb] r290890 - Fix-up TestLinuxCore for r290874

2017-01-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jan  3 07:18:12 2017
New Revision: 290890

URL: http://llvm.org/viewvc/llvm-project?rev=290890&view=rev
Log:
Fix-up TestLinuxCore for r290874

r290874 enabled the s390x test, which caused the rest of the tests to start
misbehaving. This is because this test switches the selected platform and the
change persists.

This fixes it by explicitly resetting the platform in a similar way to the gcore
tests do. Potentially we should consider re-setting the platform globally
between each test run to better protect tests from each other.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=290890&r1=290889&r2=290890&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Tue Jan  3 07:18:12 2017
@@ -26,6 +26,14 @@ class LinuxCoreTestCase(TestBase):
 _x86_64_regions = 5
 _s390x_regions = 2
 
+def setUp(self):
+super(LinuxCoreTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(LinuxCoreTestCase, self).tearDown()
+
 @skipIf(oslist=['windows'])
 @skipIf(triple='^mips')
 def test_i386(self):


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


[Lldb-commits] [lldb] r290874 - Simplify reading of Linux notes to correctly handle endianess.

2017-01-03 Thread Howard Hellyer via lldb-commits
Author: hhellyer
Date: Tue Jan  3 05:03:14 2017
New Revision: 290874

URL: http://llvm.org/viewvc/llvm-project?rev=290874&view=rev
Log:
Simplify reading of Linux notes to correctly handle endianess.

Summary:
This patch changes and simplifies the way notes are read from Linux Elf cores.
The current implementation copies the bytes from the notes directly over the 
lldb structure for 64 bit cores and reads field by field for 32 bit cores. 
Reading the bytes directly only works if the endianess of the core dump and the 
platform that lldb are running on matches. The case statements for s390x and 
x86_64 would would only work on big endian systems and little endian systems 
respectively. That meant that x86_64 generally worked but s390x didn't unless 
you were on s390x or another big endian platform.
This patch just reads field by field on all platform and updates the field by 
field version to allow for those fields which are word size instead of fixed 
size. It should also slightly simplify adding support for a new Linux platform.

This patch also re-enables the s390x test case in TestLinuxCore.py on all 
non-s390x platforms as it now passes.

Reviewers: uweigand, clayborg

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=290874&r1=290873&r2=290874&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Tue Jan  3 05:03:14 2017
@@ -38,9 +38,7 @@ class LinuxCoreTestCase(TestBase):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)
 
-# This seems to hang on non-s390x platforms for some reason.  Disabling
-# for now.
-@skipIf(archs=no_match(['s390x']))
+@skipIf(oslist=['windows'])
 @skipIf(triple='^mips')
 def test_s390x(self):
 """Test that lldb can read the process information from an s390x linux 
core file."""

Modified: lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp?rev=290874&r1=290873&r2=290874&view=diff
==
--- lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp Tue Jan  3 
05:03:14 2017
@@ -202,7 +202,6 @@ ELFLinuxPrStatus::ELFLinuxPrStatus() {
 
 Error ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) {
   Error error;
-  ByteOrder byteorder = data.GetByteOrder();
   if (GetSize(arch) > data.GetByteSize()) {
 error.SetErrorStringWithFormat(
 "NT_PRSTATUS size should be %zu, but the remaining bytes are: %" 
PRIu64,
@@ -210,50 +209,36 @@ Error ELFLinuxPrStatus::Parse(DataExtrac
 return error;
   }
 
-  switch (arch.GetCore()) {
-  case ArchSpec::eCore_s390x_generic:
-  case ArchSpec::eCore_x86_64_x86_64:
-data.ExtractBytes(0, sizeof(ELFLinuxPrStatus), byteorder, this);
-break;
-  case ArchSpec::eCore_x86_32_i386:
-  case ArchSpec::eCore_x86_32_i486: {
-// Parsing from a 32 bit ELF core file, and populating/reusing the 
structure
-// properly, because the struct is for the 64 bit version
-offset_t offset = 0;
-si_signo = data.GetU32(&offset);
-si_code = data.GetU32(&offset);
-si_errno = data.GetU32(&offset);
-
-pr_cursig = data.GetU16(&offset);
-offset += 2; // pad
-
-pr_sigpend = data.GetU32(&offset);
-pr_sighold = data.GetU32(&offset);
-
-pr_pid = data.GetU32(&offset);
-pr_ppid = data.GetU32(&offset);
-pr_pgrp = data.GetU32(&offset);
-pr_sid = data.GetU32(&offset);
-
-pr_utime.tv_sec = data.GetU32(&offset);
-pr_utime.tv_usec = data.GetU32(&offset);
-
-pr_stime.tv_sec = data.GetU32(&offset);
-pr_stime.tv_usec = data.GetU32(&offset);
+  // Read field by field to correctly account for endianess
+  // of both the core dump and the platform running lldb.
+  offset_t offset = 0;
+  si_signo = data.GetU32(&offset);
+  si_code = data.GetU32(&offset);
+  si_errno = data.GetU32(&offset);
+
+  pr_cursig = data.GetU16(&offset);
+  offset += 2; // pad
+
+  pr_sigpend = data.GetPointer(&offset);
+  pr_sighold = data.GetPointer(&offset);
+
+  pr_pid = data.GetU32(&offset);
+  pr_ppid = data.GetU32(&offset);
+  pr_pgrp = data.

[Lldb-commits] [PATCH] D24711: [lldb-mi] Fix implementation for a few mi commands

2017-01-03 Thread Hafiz Abid Qadeer via Phabricator via lldb-commits
abidh accepted this revision.
abidh added a comment.

Looks good.




Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp:22
 {
-int a  = 10;
+int a = 10;
+

This declaration looks redundant.



Comment at: tools/lldb-mi/MICmdCmdMiscellanous.cpp:515
+  return MIstatus::failure;
   }
 

aetf wrote:
> abidh wrote:
> > It is not really an OutofBand record but rather an output of the command. 
> > Why not simple add prepend an ~
> The output of the command should be a Stream record which is an OutofBand 
> record according to the spec [1]. I agree it's no more than prepending '~' 
> and quoting the string. But why not just do what the spec says? ;-)
> 
> [1] 
> https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stream-Records.html#GDB_002fMI-Stream-Records
ok.


https://reviews.llvm.org/D24711



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