Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Paul Herman via lldb-commits
paulherman added a comment.

The test was supposed to be marked as an XFAIL. I'm currently writing a fix for 
this that reports ambiguity in a context and deals with imported decls.


http://reviews.llvm.org/D12658



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


Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Jason Molenda via lldb-commits
jasonmolenda added a subscriber: jasonmolenda.
jasonmolenda added a comment.

Maybe I'm an outlier here -- but I don't think we should show assembly code, 
unless specifically requested by the user, when we can't find a source file 
(but we have source-level debug information).

lldb used to behave the other way - when a source file could not be found, we 
would show assembly before the prompt.  There were many complaints from users 
about this behavior; users who are thinking at a source level and using source 
commands like "step" and "next", did not want to see assembly, it was 
meaningless to them.  If they stepi into an assembly routine or put a 
breakpoint on it - where we have no debug information, then presenting the 
assembly makes sense.

IIRC, gdb behaves the same way that lldb does today.  e.g.

clang -g a.c
rm a.c
lldb a.out
(lldb) br s -n main
(lldb) r

- thread #1: tid = 0x5e8d52, 0x00010ed7 a.out`main(argc=1, 
argv=0x7fff5fbff958) + 39 at a.c:10, queue = 'com.apple.main-thread', stop 
reason = breakpoint 1.1 frame #0: 0x00010ed7 a.out`main(argc=1, 
argv=0x7fff5fbff958) + 39 at a.c:10

(lldb) n
Process 38732 stopped

- thread #1: tid = 0x5e8d52, 0x00010eea a.out`main(argc=1, 
argv=0x7fff5fbff958) + 58 at a.c:11, queue = 'com.apple.main-thread', stop 
reason = step over frame #0: 0x00010eea a.out`main(argc=1, 
argv=0x7fff5fbff958) + 58 at a.c:11

(lldb)

I feel pretty strongly that this behavior should not be changed.  Seeing mixed 
source and assembly is meaningful to me and I may personally like to see that 
-- but the vast majority of our users do not interact with their programs at 
that level.


Repository:
  rL LLVM

http://reviews.llvm.org/D12877



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


Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 34850.
paulherman added a comment.

Search variables based on clang::DeclContext and clang::Decl tree

Rebased the patch.


http://reviews.llvm.org/D12658

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDecl.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Symbol/Variable.h
  include/lldb/lldb-forward.h
  source/Expression/ClangASTSource.cpp
  source/Expression/ClangExpressionDeclMap.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/CMakeLists.txt
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDecl.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/Variable.cpp
  test/lang/cpp/nsimport/TestCppNsImport.py
  test/lang/cpp/nsimport/main.cpp

Index: test/lang/cpp/nsimport/main.cpp
===
--- test/lang/cpp/nsimport/main.cpp
+++ test/lang/cpp/nsimport/main.cpp
@@ -16,13 +16,57 @@
 }
 }
 
-using namespace N;
-using namespace Nested;
+namespace Global
+{
+int global;
+}
+
+namespace Fun
+{
+int fun_var;
+int fun()
+{
+fun_var = 5;
+return 0; // break 1
+}
+}
+
+namespace Single
+{
+int single = 3;
+}
+
+namespace NotImportedBefore
+{
+int not_imported = 45;
+}
+
+using namespace Global;
+
+int not_imported = 35;
+int fun_var = 9;
+
+namespace NotImportedAfter
+{
+int not_imported = 55;
+}
+
+namespace Imported
+{
+int imported = 99;
+}
+
+int imported = 89;
 
 int main()
 {
+using namespace N;
+using namespace Nested;
+using namespace Imported;
+using Single::single;
 n = 1;
 anon = 2;
 nested = 3;
-return 0; // break 0
+global = 4;
+return Fun::fun(); // break 0
 }
Index: test/lang/cpp/nsimport/TestCppNsImport.py
===
--- test/lang/cpp/nsimport/TestCppNsImport.py
+++ test/lang/cpp/nsimport/TestCppNsImport.py
@@ -16,6 +16,8 @@
 self.buildDsym()
 self.check()
 
+# This test is expected to fail because DW_TAG_imported_declaration and DW_TAG_imported_module are not parsed in SymbolFileDWARF
+@expectedFailureAll
 @dwarf_test
 def test_with_dwarf_and_run_command(self):
 """Tests imported namespaces in C++."""
@@ -45,6 +47,8 @@
 # Break on main function
 break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
 self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
+break_1 = target.BreakpointCreateBySourceRegex("// break 1", src_file_spec)
+self.assertTrue(break_1.IsValid() and break_1.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
 args = None
@@ -72,6 +76,35 @@
 test_result = frame.EvaluateExpression("anon")
 self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
 
+test_result = frame.EvaluateExpression("global")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 4, "global = 4")
+
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 9, "fun_var = 9")
+
+test_result = frame.EvaluateExpression("not_imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 35, "not_imported = 35")
+
+test_result = frame.EvaluateExpression("imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 99, "imported = 99")
+
+test_result = frame.EvaluateExpression("single")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "single = 3")
+
+# Continue to second breakpoint
+process.Continue()
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+
+# Get current fream of the thread at the breakpoint
+frame = thread.GetSelectedFrame()
+
+# Test function inside namespace
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 5, "fun_var = 5")
+
 
 if __name__ == '__main__':
 import atexit
Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -15,9 

Re: [Lldb-commits] [PATCH] D12876: [MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo

2015-09-15 Thread Jaydeep Patil via lldb-commits
jaydeep closed this revision.
jaydeep added a comment.

Closed by commit http://reviews.llvm.org/rL247773


Repository:
  rL LLVM

http://reviews.llvm.org/D12876



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


Re: [Lldb-commits] [PATCH] D12079: [MIPS] microMIPS breakpoints, disassembly and compressed addresses

2015-09-15 Thread Jaydeep Patil via lldb-commits
jaydeep updated this revision to Diff 34873.
jaydeep added a comment.

Addressed review comments


Repository:
  rL LLVM

http://reviews.llvm.org/D12079

Files:
  source/Core/Address.cpp
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Target/RegisterContext.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2092,6 +2092,27 @@
 addr_t code_addr = load_addr;
 switch (m_arch.GetMachine())
 {
+case llvm::Triple::mips:
+case llvm::Triple::mipsel:
+case llvm::Triple::mips64:
+case llvm::Triple::mips64el:
+switch (addr_class)
+{
+case eAddressClassData:
+case eAddressClassDebug:
+return LLDB_INVALID_ADDRESS;
+
+case eAddressClassUnknown:
+case eAddressClassInvalid:
+case eAddressClassCode:
+case eAddressClassCodeAlternateISA:
+case eAddressClassRuntime:
+if ((code_addr & 2ull) || (addr_class == eAddressClassCodeAlternateISA))
+code_addr |= 1ull;
+break;
+}
+break;
+
 case llvm::Triple::arm:
 case llvm::Triple::thumb:
 switch (addr_class)
@@ -2137,6 +2158,10 @@
 addr_t opcode_addr = load_addr;
 switch (m_arch.GetMachine())
 {
+case llvm::Triple::mips:
+case llvm::Triple::mipsel:
+case llvm::Triple::mips64:
+case llvm::Triple::mips64el:
 case llvm::Triple::arm:
 case llvm::Triple::thumb:
 switch (addr_class)
Index: source/Target/RegisterContext.cpp
===
--- source/Target/RegisterContext.cpp
+++ source/Target/RegisterContext.cpp
@@ -20,6 +20,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -103,7 +104,20 @@
 RegisterContext::GetPC(uint64_t fail_value)
 {
 uint32_t reg = ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
-return ReadRegisterAsUnsigned (reg, fail_value);
+uint64_t pc = ReadRegisterAsUnsigned (reg, fail_value);
+
+if (pc != fail_value)
+{
+TargetSP target_sp = m_thread.CalculateTarget();
+if (target_sp)
+{
+Target *target = target_sp.get();
+if (target)
+pc = target->GetOpcodeLoadAddress (pc, eAddressClassCode);
+}
+}
+
+return pc;
 }
 
 bool
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1128,6 +1128,7 @@
 {
 LineTable* line_table;
 std::unique_ptr sequence_ap;
+lldb::addr_t addr_mask;
 };
 
 //--
@@ -1157,7 +1158,7 @@
 assert(info->sequence_ap.get());
 }
 line_table->AppendLineEntryToSequence (info->sequence_ap.get(),
-   state.address,
+   state.address & info->addr_mask,
state.line,
state.column,
state.file,
@@ -1197,6 +1198,28 @@
 {
 ParseDWARFLineTableCallbackInfo info;
 info.line_table = line_table_ap.get();
+
+/*
+ * MIPS:
+ * The SymbolContext may not have a valid target, thus we may not be able
+ * to call Address::GetOpcodeLoadAddress() which would clear the bit #0
+ * for MIPS. Use ArchSpec to clear the bit #0.
+*/
+ArchSpec arch;
+GetObjectFile()->GetArchitecture(arch);
+switch (arch.GetMachine())
+{
+case llvm::Triple::mips:
+case llvm::Triple::mipsel:
+case llvm::Triple::mips64:
+case llvm::Triple::mips64el:
+info.addr_mask = ~((lldb::addr_t)1);
+break;
+default:
+info.addr_mask = ~((lldb::addr_t)0);
+break;
+}
+
 lldb::offset_t offset = cu_line_offset;
 DWARFDebugLine::ParseStatementTable(get_debug_line_data(), , ParseDWARFLineTableCallback, );
 if (m_debug_map_symfile)
Index: 

[Lldb-commits] [lldb] r247751 - A partner to the cleanup in r247741, change the variables names in

2015-09-15 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Sep 15 18:49:57 2015
New Revision: 247751

URL: http://llvm.org/viewvc/llvm-project?rev=247751=rev
Log:
A partner to the cleanup in r247741, change the variables names in
debugserver to match.  "gcc" is now "ehframe" and "gdb" is now
"debugserver".  Because this is debugserver, what we call the Process
Plugin register numbers up in lldb are the debugserver register
numbers down here - they are the register numbers that debugserver
will use to refer to these registers over the gdb-remote protocol.

debugserver was already reporting the registers with the key
"ehframe"; this change is just cleaning up the internal variable
names to match.


Added:
lldb/trunk/tools/debugserver/source/ARM_ehframe_Registers.h
  - copied, changed from r247737, 
lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h
Removed:
lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h
Modified:
lldb/trunk/tools/debugserver/source/DNBDefs.h
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Removed: lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h?rev=247750=auto
==
--- lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h (original)
+++ lldb/trunk/tools/debugserver/source/ARM_GCC_Registers.h (removed)
@@ -1,146 +0,0 @@
-//===-- ARM_GCC_Registers.h -*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef utility_ARM_GCC_Registers_h_
-#define utility_ARM_GCC_Registers_h_
-
-enum
-{
-gcc_r0 = 0,
-gcc_r1,
-gcc_r2,
-gcc_r3,
-gcc_r4,
-gcc_r5,
-gcc_r6,
-gcc_r7,
-gcc_r8,
-gcc_r9,
-gcc_r10,
-gcc_r11,
-gcc_r12,
-gcc_sp,
-gcc_lr,
-gcc_pc,
-gcc_cpsr
-};
-
-enum
-{
-//  NameNr   Rel OffsetSize  TypeRaw value
-gdb_arm_r0  =   0, //  0  0   4 int32_t
-gdb_arm_r1  =   1, //  1  4   4 int32_t
-gdb_arm_r2  =   2, //  2  8   4 int32_t
-gdb_arm_r3  =   3, //  3 12   4 int32_t
-gdb_arm_r4  =   4, //  4 16   4 int32_t
-gdb_arm_r5  =   5, //  5 20   4 int32_t
-gdb_arm_r6  =   6, //  6 24   4 int32_t
-gdb_arm_r7  =   7, //  7 28   4 int32_t
-gdb_arm_r8  =   8, //  8 32   4 int32_t
-gdb_arm_r9  =   9, //  9 36   4 int32_t
-gdb_arm_r10 =  10, // 10 40   4 int32_t
-gdb_arm_r11 =  11, // 11 44   4 int32_t
-gdb_arm_r12 =  12, // 12 48   4 int32_t
-gdb_arm_sp  =  13, // 13 52   4 int32_t
-gdb_arm_lr  =  14, // 14 56   4 int32_t
-gdb_arm_pc  =  15, // 15 60   4 int32_t
-gdb_arm_f0  =  16, // 16 64  12 _arm_ext_littlebyte_bigword
-gdb_arm_f1  =  17, // 17 76  12 _arm_ext_littlebyte_bigword
-gdb_arm_f2  =  18, // 18 88  12 _arm_ext_littlebyte_bigword
-gdb_arm_f3  =  19, // 19100  12 _arm_ext_littlebyte_bigword
-gdb_arm_f4  =  20, // 20112  12 _arm_ext_littlebyte_bigword
-gdb_arm_f5  =  21, // 21124  12 _arm_ext_littlebyte_bigword
-gdb_arm_f6  =  22, // 22136  12 _arm_ext_littlebyte_bigword
-gdb_arm_f7  =  23, // 23148  12 _arm_ext_littlebyte_bigword
-gdb_arm_f8  =  24, // 24160  12 _arm_ext_littlebyte_bigword
-gdb_arm_cpsr=  25, // 25172   4 int32_t
-gdb_arm_s0  =  26, // 26176   4 _ieee_single_little
-gdb_arm_s1  =  27, // 27180   4 _ieee_single_little
-gdb_arm_s2  =  28, // 28184   4 _ieee_single_little
-gdb_arm_s3  =  29, // 29188   4 _ieee_single_little
-gdb_arm_s4  =  30, // 30192   4 _ieee_single_little
-gdb_arm_s5  =  31, // 31196   4 _ieee_single_little
-gdb_arm_s6  =  32, // 32200   4 _ieee_single_little
-gdb_arm_s7  =  33, // 33204   4 _ieee_single_little
-gdb_arm_s8  =  34, // 34208   4 _ieee_single_little
-gdb_arm_s9  =  35, // 35212   4 _ieee_single_little
-

[Lldb-commits] [lldb] r247756 - Fix Xcode project by adding CompilerDecl.cpp and .h.

2015-09-15 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Sep 15 19:03:14 2015
New Revision: 247756

URL: http://llvm.org/viewvc/llvm-project?rev=247756=rev
Log:
Fix Xcode project by adding CompilerDecl.cpp and .h.


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=247756=247755=247756=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Sep 15 19:03:14 2015
@@ -162,6 +162,7 @@
264A58EE1A7DBCAD00A6B1B0 /* OptionValueFormatEntity.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 264A58ED1A7DBCAD00A6B1B0 /* 
OptionValueFormatEntity.cpp */; };
264A97BF133918BC0017F0BE /* PlatformRemoteGDBServer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 264A97BD133918BC0017F0BE /* 
PlatformRemoteGDBServer.cpp */; };
264D8D5013661BD7003A368F /* UnwindAssembly.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 264D8D4F13661BD7003A368F /* UnwindAssembly.cpp 
*/; };
+   265192C61BA8E905002F08F6 /* CompilerDecl.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 265192C51BA8E905002F08F6 /* CompilerDecl.cpp */; 
settings = {ASSET_TAGS = (); }; };
265205A813D3E3F700132FE2 /* RegisterContextKDP_arm.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 265205A213D3E3F700132FE2 /* 
RegisterContextKDP_arm.cpp */; };
265205AA13D3E3F700132FE2 /* RegisterContextKDP_i386.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 265205A413D3E3F700132FE2 /* 
RegisterContextKDP_i386.cpp */; };
265205AC13D3E3F700132FE2 /* RegisterContextKDP_x86_64.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 265205A613D3E3F700132FE2 /* 
RegisterContextKDP_x86_64.cpp */; };
@@ -1457,6 +1458,8 @@
264AD83911095BBD00E0B039 /* CommandObjectLog.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CommandObjectLog.h; path = source/Commands/CommandObjectLog.h; sourceTree = 
""; };
264D8D4E13661BCC003A368F /* UnwindAssembly.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UnwindAssembly.h; 
path = include/lldb/Target/UnwindAssembly.h; sourceTree = ""; };
264D8D4F13661BD7003A368F /* UnwindAssembly.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = UnwindAssembly.cpp; path = source/Target/UnwindAssembly.cpp; sourceTree 
= ""; };
+   265192C41BA8E8F8002F08F6 /* CompilerDecl.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CompilerDecl.h; 
path = include/lldb/Symbol/CompilerDecl.h; sourceTree = ""; };
+   265192C51BA8E905002F08F6 /* CompilerDecl.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = CompilerDecl.cpp; path = source/Symbol/CompilerDecl.cpp; sourceTree = 
""; };
265205A213D3E3F700132FE2 /* RegisterContextKDP_arm.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RegisterContextKDP_arm.cpp; sourceTree = ""; 
};
265205A313D3E3F700132FE2 /* RegisterContextKDP_arm.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path 
= RegisterContextKDP_arm.h; sourceTree = ""; };
265205A413D3E3F700132FE2 /* RegisterContextKDP_i386.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RegisterContextKDP_i386.cpp; sourceTree = ""; 
};
@@ -4209,6 +4212,8 @@
26BC7F1410F1B8EC00F91463 /* ClangASTContext.cpp 
*/,
49D8FB3713B5594900411094 /* ClangASTImporter.h 
*/,
49D8FB3513B558DE00411094 /* 
ClangASTImporter.cpp */,
+   265192C41BA8E8F8002F08F6 /* CompilerDecl.h */,
+   265192C51BA8E905002F08F6 /* CompilerDecl.cpp */,
2657AFB51B8690EC00958979 /* 
CompilerDeclContext.h */,
2657AFB61B86910100958979 /* 
CompilerDeclContext.cpp */,
49E45FA911F660DC008F7B28 /* CompilerType.h */,
@@ -6435,6 +6440,7 @@
268900D013353E6F00698AC0 /* Block.cpp in 
Sources */,
268900D113353E6F00698AC0 /* ClangASTContext.cpp 
in Sources */,
2613F6C81B17B82F00D4DB85 /* CxaDemangle.cpp in 
Sources */,
+   265192C61BA8E905002F08F6 /* CompilerDecl.cpp in 
Sources */,
268900D213353E6F00698AC0 /* CompilerType.cpp in 
Sources */,
945261C11B9A11FC00BF138D /* 
LibCxxInitializerList.cpp in 

[Lldb-commits] [lldb] r247773 - [LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo

2015-09-15 Thread Jaydeep Patil via lldb-commits
Author: jaydeep
Date: Tue Sep 15 23:04:01 2015
New Revision: 247773

URL: http://llvm.org/viewvc/llvm-project?rev=247773=rev
Log:
[LLDB][MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo
SUMMARY:
Refer to http://lists.llvm.org/pipermail/lldb-dev/2015-August/008024.html 
for discussion
on this topic. Bare-iron target like YAMON gdb-stub does not support 
qProcessInfo, qC,
qfThreadInfo, Hg and Hc packets. Reply from ? packet is as simple as S05. 
There is no 
packet which gives us process or threads information. In such cases, assume 
pid=tid=1.

Reviewers: clayborg
Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits
Differential Revision: http://reviews.llvm.org/D12876

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=247773=247772=247773=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Sep 15 23:04:01 2015
@@ -3396,6 +3396,17 @@ GDBRemoteCommunicationClient::SetCurrent
 m_curr_tid = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for Hg packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no 
packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid = 1;
+return true;
+}
 }
 return false;
 }
@@ -3422,6 +3433,17 @@ GDBRemoteCommunicationClient::SetCurrent
 m_curr_tid_run = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for Hc packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no 
packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid_run = 1;
+return true;
+}
 }
 return false;
 }
@@ -3547,6 +3569,17 @@ GDBRemoteCommunicationClient::GetCurrent
 } while (ch == ',');// Make sure we got a comma 
separator
 }
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for
+ * qProcessInfo, qC and qfThreadInfo packets. The reply from '?' 
packet could
+ * be as simple as 'S05'. There is no packet which can give us pid 
and/or tid.
+ * Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && thread_ids.size() == 0 && 
IsConnected())
+{
+thread_ids.push_back (1);
+}
 }
 else
 {


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


Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.

Ok, so Jim and I agreed verbally on the solution. If we have source, but we 
don't have the source file itself, then we should print the line table entry 
out. This can be done with:

  if (num_lines == 0)
  {
  const bool show_fullpaths = true;
  m_sc.line_entry.DumpStopContext(, show_fullpaths) const
  have_source = false;
  }

So the output will now be

/tmp/main.cpp:123
0x1000:add r1, r2, r3
...

No need for a warning, just print the line entry.


Repository:
  rL LLVM

http://reviews.llvm.org/D12877



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


[Lldb-commits] [lldb] r247746 - Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Paul Herman via lldb-commits
Author: paulherman
Date: Tue Sep 15 18:44:17 2015
New Revision: 247746

URL: http://llvm.org/viewvc/llvm-project?rev=247746=rev
Log:
Search variables based on clang::DeclContext and clang::Decl tree

Summary: SymbolFileDWARF now creates VarDecl and BlockDecl and adds them to the 
Decl tree. Then, in ClangExpressionDeclMap it uses the Decl tree to search for 
a variable. This fixes lots of variable scoping problems.

Reviewers: sivachandra, chaoren, spyffe, clayborg

Subscribers: tberghammer, jingham, lldb-commits

Differential Revision: http://reviews.llvm.org/D12658

Added:
lldb/trunk/include/lldb/Symbol/CompilerDecl.h
lldb/trunk/source/Symbol/CompilerDecl.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Symbol/Variable.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/CMakeLists.txt
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py
lldb/trunk/test/lang/cpp/nsimport/main.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=247746=247745=247746=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Sep 15 18:44:17 2015
@@ -507,8 +507,23 @@ public:
  llvm::DenseMap _offsets);
 
 //--
+// CompilerDecl override functions
+//--
+lldb::VariableSP
+DeclGetVariable (void *opaque_decl) override;
+
+void
+DeclLinkToObject (void *opaque_decl, std::shared_ptr object) 
override;
+
+ConstString
+DeclGetName (void *opaque_decl) override;
+
+//--
 // CompilerDeclContext override functions
 //--
+
+std::vector
+DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
 
 bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;
@@ -1070,6 +1085,17 @@ public:
 int tag_decl_kind,
 const ClangASTContext::TemplateParameterInfos 
_param_infos);
 
+clang::BlockDecl *
+CreateBlockDeclaration (clang::DeclContext *ctx);
+
+clang::UsingDirectiveDecl *
+CreateUsingDirectiveDeclaration (clang::DeclContext *decl_ctx, 
clang::NamespaceDecl *ns_decl);
+
+clang::UsingDecl *
+CreateUsingDeclaration (clang::DeclContext *current_decl_ctx, 
clang::NamedDecl *target);
+
+clang::VarDecl *
+CreateVariableDeclaration (clang::DeclContext *decl_context, const char 
*name, clang::QualType type);
 protected:
 static clang::QualType
 GetQualType (void *type)
@@ -1110,6 +1136,7 @@ protected:
 uint32_tm_pointer_byte_size;
 boolm_ast_owned;
 boolm_can_evaluate_expressions;
+std::map> m_decl_objects;
 
 private:
 //--

Added: lldb/trunk/include/lldb/Symbol/CompilerDecl.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDecl.h?rev=247746=auto
==
--- lldb/trunk/include/lldb/Symbol/CompilerDecl.h (added)
+++ lldb/trunk/include/lldb/Symbol/CompilerDecl.h Tue Sep 15 18:44:17 2015
@@ -0,0 +1,116 @@
+//===-- CompilerDecl.h --*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_CompilerDecl_h_

Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Maybe we can enable mixed mode display where it intersperses the source file 
and line in the disassembly when/if there is source info, but no source file?


Repository:
  rL LLVM

http://reviews.llvm.org/D12877



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


Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg added a subscriber: clayborg.
clayborg added a comment.

I am seeing line 89 fail on MacOSX from your new TestCppNsImport.py:

  test_result = frame.EvaluateExpression("imported")
  self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 
99, "imported = 99")

Ours is picking up the global "imported" and it is getting 89. Can you send me 
the log file from the following commands?:

cd lldb/test/lang/cpp/nsimport
make

Now find the LLDB that you built and use it to debug:

.././lldb a.out
(lldb) b /break 0/
(lldb) r
(lldb) log enable -f /tmp/expr-log.txt lldb expr
(lldb) p imported
(lldb) log disable lldb expr

Then send me the "expr-log.txt".

On MacOSX, we find the global "imported" in the translation unit:

ClangExpressionDeclMap::FindExternalVisibleDecls[9] for 'imported' in a 
'TranslationUnit'

  CEDM::FEVD[9] Searching the root namespace
  CEDM::FEVD[9] Found variable imported, returned static int  
(original int)

I am wondering if this works for you because your debug info isn't correctly 
describing the "imported" global variable. Maybe the one in the translation 
unit got stripped since it wasn't used? You might need to use it with something 
like:

  ::imported = 123;

If you can send me the expression log and possibly your ELF a.out file, I might 
be able to figure out what is going on.

Greg


http://reviews.llvm.org/D12658



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


Re: [Lldb-commits] [PATCH] D12791: Complete register kind naming cleanups in lldb -- required touching all register table definitions

2015-09-15 Thread Jason Molenda via lldb-commits
jasonmolenda added a comment.

Ah, those failures were due to

Index: gdbremote_testcase.py


- gdbremote_testcase.py (revision 247726)

+++ gdbremote_testcase.py   (working copy)
@@ -548,7 +548,7 @@

  "encoding",
  "format",
  "set",

- "gcc",

+"ehframe",

  "dwarf",
  "generic",
  "container-regs",

I'll update the patch and commit.


http://reviews.llvm.org/D12791



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


Re: [Lldb-commits] [PATCH] D12890: Add plugin.jit-loader.gdb.enable-jit-breakpoint property to make JIT loader breakpoint optional.

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.



Comment at: source/Core/PluginManager.cpp:2628
@@ -2627,3 +2627,3 @@
 static lldb::OptionValuePropertiesSP
 GetDebuggerPropertyForPluginsOldStyle (Debugger ,
const ConstString _type_name,

ovyalov wrote:
> Do we still need this function? It's used only by platform plugin and there 
> is no platform plugin properties right now in use - we may want to migrate 
> from old style properties.
I believe we do for other branches that we merge into... Leave it for now.


http://reviews.llvm.org/D12890



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


[Lldb-commits] [lldb] r247760 - Fix double include in CompilerDeclContext.h

2015-09-15 Thread Paul Herman via lldb-commits
Author: paulherman
Date: Tue Sep 15 19:29:10 2015
New Revision: 247760

URL: http://llvm.org/viewvc/llvm-project?rev=247760=rev
Log:
Fix double include in CompilerDeclContext.h

Modified:
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=247760=247759=247760=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Tue Sep 15 19:29:10 
2015
@@ -14,7 +14,6 @@
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
-#include 
 
 namespace lldb_private {
 


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


[Lldb-commits] [lldb] r247764 - Fix MacOSX since "imported" and "Imported::imported" are ambiguous. Test that we can read the global when specified with the global namespace and test that we can read

2015-09-15 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Sep 15 19:42:50 2015
New Revision: 247764

URL: http://llvm.org/viewvc/llvm-project?rev=247764=rev
Log:
Fix MacOSX since "imported" and "Imported::imported" are ambiguous. Test that 
we can read the global when specified with the global namespace and test that 
we can read "Imported::imported" correctly. The commented out test should be 
testing for ambiguity when just "imported" is evaluated as an expression, but 
that doesn't work yet.


Modified:
lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py

Modified: lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py?rev=247764=247763=247764=diff
==
--- lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py (original)
+++ lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py Tue Sep 15 19:42:50 
2015
@@ -85,8 +85,15 @@ class TestCppNsImport(TestBase):
 test_result = frame.EvaluateExpression("not_imported")
 self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 35, "not_imported = 35")
 
-test_result = frame.EvaluateExpression("imported")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 99, "imported = 99")
+# Disabled the "imported" test since it isn't valid. It should 
actually test for ambiguity
+#test_result = frame.EvaluateExpression("imported")
+#self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 99, "imported = 99")
+
+test_result = frame.EvaluateExpression("::imported")
+self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 89, "::imported = 89")
+
+test_result = frame.EvaluateExpression("Imported::imported")
+self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 99, "Imported::imported = 99")
 
 test_result = frame.EvaluateExpression("single")
 self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 3, "single = 3")


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


[Lldb-commits] [lldb] r247766 - Fix off-by-one size check.

2015-09-15 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Tue Sep 15 20:20:34 2015
New Revision: 247766

URL: http://llvm.org/viewvc/llvm-project?rev=247766=rev
Log:
Fix off-by-one size check.

Modified:
lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=247766=247765=247766=diff
==
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Sep 15 20:20:34 2015
@@ -655,7 +655,7 @@ IRInterpreter::Interpret (llvm::Module &
  ai != ae;
  ++ai, ++arg_index)
 {
-if (args.size() < static_cast(arg_index))
+if (args.size() <= static_cast(arg_index))
 {
 error.SetErrorString ("Not enough arguments passed in to 
function");
 return false;


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


Re: [Lldb-commits] [PATCH] D12873: Return false, not 0, for bools.

2015-09-15 Thread Bruce Mitchener via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247755: Return false, not 0, for bools. (authored by brucem).

Changed prior to commit:
  http://reviews.llvm.org/D12873?vs=34777=34856#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12873

Files:
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Symbol/CompilerType.cpp

Index: lldb/trunk/source/Symbol/CompilerType.cpp
===
--- lldb/trunk/source/Symbol/CompilerType.cpp
+++ lldb/trunk/source/Symbol/CompilerType.cpp
@@ -78,7 +78,7 @@
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -2531,7 +2531,7 @@
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool


Index: lldb/trunk/source/Symbol/CompilerType.cpp
===
--- lldb/trunk/source/Symbol/CompilerType.cpp
+++ lldb/trunk/source/Symbol/CompilerType.cpp
@@ -78,7 +78,7 @@
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -2531,7 +2531,7 @@
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r247755 - Return false, not 0, for bools.

2015-09-15 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Tue Sep 15 19:00:16 2015
New Revision: 247755

URL: http://llvm.org/viewvc/llvm-project?rev=247755=rev
Log:
Return false, not 0, for bools.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12873

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerType.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=247755=247754=247755=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Sep 15 19:00:16 2015
@@ -2531,7 +2531,7 @@ ClangASTContext::IsArrayType (void* type
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=247755=247754=247755=diff
==
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Tue Sep 15 19:00:16 2015
@@ -78,7 +78,7 @@ CompilerType::IsArrayType (CompilerType
 *size = 0;
 if (is_incomplete)
 *is_incomplete = false;
-return 0;
+return false;
 }
 
 bool


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


[Lldb-commits] [lldb] r247754 - Fix the MacOSX build.

2015-09-15 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Sep 15 18:59:41 2015
New Revision: 247754

URL: http://llvm.org/viewvc/llvm-project?rev=247754=rev
Log:
Fix the MacOSX build.


Modified:
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=247754=247753=247754=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Tue Sep 15 18:59:41 
2015
@@ -10,6 +10,8 @@
 #ifndef liblldb_CompilerDeclContext_h_
 #define liblldb_CompilerDeclContext_h_
 
+#include 
+
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
 


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


Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as my inlined comment doesn't point out an error, then this 
is good to go! Good stuff.



Comment at: source/Symbol/Variable.cpp:250-258
@@ -233,1 +249,11 @@
+
+CompilerDecl
+Variable::GetDecl ()
+{
+Type *type = GetType();
+CompilerDecl decl = type->GetSymbolFile()->GetDeclForUID(GetID());
+if (decl)
+decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), 
shared_from_this());
+return decl;
+}
 

As long as calling DeclLinkToObject(...) more than once with the same args is 
ok, then this will be fine.


http://reviews.llvm.org/D12658



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


Re: [Lldb-commits] [PATCH] D12757: Fix prologue end handling when code compiled by gcc

2015-09-15 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

In http://reviews.llvm.org/D12757#246497, @clayborg wrote:

> Maybe we can try still removing duplicates, but remembering the first index 
> where we had a duplicate line entry. If we don't get a prologue end, then we 
> got back to the index we remembered for the first duplicate and if it is 
> valid, modify that entry to say "prologue_end = true"?


Remembering to the first duplicate entry isn't really possible because a line 
table covers several functions and we need the prologe_end marker for each 
functions. If we want to go in this direction then we have to couple the line 
table with the function ranges (including the function ranges for inline 
functions) what I am pretty sure we want to avoid. It would cause significant 
performance hit because it would require a full dwarf parsing.

> One other questions for clarification: Is GCC emitting prologue_end, but only 
> emitting it on the first line entry? And then we overrwrite it with the 
> second and remove the prologue_end, or does GCC just plain not emit 
> prologue_end? If so, what happens when we have a line table that doesn't have 
> two entries for the prologue with the same address? Do we just not have a 
> prologue_end in a sequence in that case?


I never seen GCC emitting prologue_end marker in any architecture I tested and 
based on some online threads I am pretty sure it is the case for all 
architecture. It emits 1 line entry for the first address of the function and 
then an other line entry for the first non prologue instruction of the function.


http://reviews.llvm.org/D12757



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


[Lldb-commits] [lldb] r247727 - Teach the ObjC data formatters to use the correct language when printing strings

2015-09-15 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Sep 15 17:11:20 2015
New Revision: 247727

URL: http://llvm.org/viewvc/llvm-project?rev=247727=rev
Log:
Teach the ObjC data formatters to use the correct language when printing strings


Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=247727=247726=247727=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Sep 15 17:11:20 2015
@@ -876,6 +876,7 @@ lldb_private::formatters::NSStringSummar
 options.SetNeedsZeroTermination(false);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
 options.SetBinaryZeroIsTerminator(false);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream(options);
 }
 else
@@ -889,6 +890,7 @@ lldb_private::formatters::NSStringSummar
 options.SetNeedsZeroTermination(false);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
 options.SetBinaryZeroIsTerminator(false);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream(options);
 }
 }
@@ -904,6 +906,7 @@ lldb_private::formatters::NSStringSummar
 options.SetQuote('"');
 options.SetSourceSize(explicit_length);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream
 (options);
 }
 else if (is_unicode)
@@ -935,6 +938,7 @@ lldb_private::formatters::NSStringSummar
 options.SetNeedsZeroTermination(has_explicit_length == false);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
 options.SetBinaryZeroIsTerminator(has_explicit_length == false);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream
 (options);
 }
 else if (is_path_store)
@@ -953,6 +957,7 @@ lldb_private::formatters::NSStringSummar
 options.SetNeedsZeroTermination(has_explicit_length == false);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
 options.SetBinaryZeroIsTerminator(has_explicit_length == false);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream
 (options);
 }
 else if (is_inline)
@@ -979,6 +984,7 @@ lldb_private::formatters::NSStringSummar
 options.SetNeedsZeroTermination(!has_explicit_length);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
 options.SetBinaryZeroIsTerminator(!has_explicit_length);
+options.SetLanguage(summary_options.GetLanguage());
 if (has_explicit_length)
 return 
StringPrinter::ReadStringAndDumpToStream(options);
 else
@@ -999,6 +1005,7 @@ lldb_private::formatters::NSStringSummar
 options.SetStream();
 options.SetSourceSize(explicit_length);
 options.SetIgnoreMaxLength(summary_options.GetCapping() == 
TypeSummaryCapping::eTypeSummaryUncapped);
+options.SetLanguage(summary_options.GetLanguage());
 return 
StringPrinter::ReadStringAndDumpToStream(options);
 }
 }


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


[Lldb-commits] [PATCH] D12876: [MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo

2015-09-15 Thread Jaydeep Patil via lldb-commits
jaydeep created this revision.
jaydeep added a reviewer: clayborg.
jaydeep added subscribers: lldb-commits, bhushan, sagar, mohit.bhakkad, 
nitesh.jain.
jaydeep set the repository for this revision to rL LLVM.

Refer to  for 
discussion on this topic.

Bare-iron target like YAMON gdb-stub does not support qProcessInfo, qC, 
qfThreadInfo, Hg and Hc packets. Reply from ‘?’ packet is as simple as ‘S05’. 
There is no packet which gives us process or threads information. In such 
cases, assume pid=tid=1.



Repository:
  rL LLVM

http://reviews.llvm.org/D12876

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3396,6 +3396,17 @@
 m_curr_tid = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for Hg packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no 
packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid = 1;
+return true;
+}
 }
 return false;
 }
@@ -3422,6 +3433,17 @@
 m_curr_tid_run = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for Hc packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no 
packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid_run = 1;
+return true;
+}
 }
 return false;
 }
@@ -3547,6 +3569,17 @@
 } while (ch == ',');// Make sure we got a comma 
separator
 }
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have 
support for
+ * qProcessInfo, qC and qfThreadInfo packets. The reply from '?' 
packet could
+ * be as simple as 'S05'. There is no packet which can give us pid 
and/or tid.
+ * Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && thread_ids.size() == 0 && 
IsConnected())
+{
+thread_ids.push_back (1);
+}
 }
 else
 {


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3396,6 +3396,17 @@
 m_curr_tid = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have support for Hg packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid = 1;
+return true;
+}
 }
 return false;
 }
@@ -3422,6 +3433,17 @@
 m_curr_tid_run = tid;
 return true;
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have support for Hc packet.
+ * The reply from '?' packet could be as simple as 'S05'. There is no packet which can
+ * give us pid and/or tid. Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && IsConnected())
+{
+m_curr_tid_run = 1;
+return true;
+}
 }
 return false;
 }
@@ -3547,6 +3569,17 @@
 } while (ch == ',');// Make sure we got a comma separator
 }
 }
+
+/*
+ * Connected bare-iron target (like YAMON gdb-stub) may not have support for
+ * qProcessInfo, qC and qfThreadInfo packets. The reply from '?' packet could
+ * be as simple as 'S05'. There is no packet which can give us pid and/or tid.
+ * Assume pid=tid=1 in such cases.
+*/
+if (!response.IsNormalResponse() && thread_ids.size() == 0 && IsConnected())
+{
+thread_ids.push_back (1);
+}
 }
 else
 {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12794: [MIPS] Add support for DT_MIPS_RLD_MAP_REL

2015-09-15 Thread Bhushan Attarde via lldb-commits
bhushan closed this revision.
bhushan added a comment.

Closed by commit http://reviews.llvm.org/rL247666


Repository:
  rL LLVM

http://reviews.llvm.org/D12794



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


Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 34808.
paulherman added a comment.

Search variables based on clang::DeclContext and clang::Decl tree


http://reviews.llvm.org/D12658

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDecl.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Symbol/Variable.h
  include/lldb/lldb-forward.h
  source/Expression/ClangASTSource.cpp
  source/Expression/ClangExpressionDeclMap.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/CMakeLists.txt
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDecl.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/Variable.cpp
  test/lang/cpp/nsimport/TestCppNsImport.py
  test/lang/cpp/nsimport/main.cpp

Index: test/lang/cpp/nsimport/main.cpp
===
--- test/lang/cpp/nsimport/main.cpp
+++ test/lang/cpp/nsimport/main.cpp
@@ -16,13 +16,57 @@
 }
 }
 
-using namespace N;
-using namespace Nested;
+namespace Global
+{
+int global;
+}
+
+namespace Fun
+{
+int fun_var;
+int fun()
+{
+fun_var = 5;
+return 0; // break 1
+}
+}
+
+namespace Single
+{
+int single = 3;
+}
+
+namespace NotImportedBefore
+{
+int not_imported = 45;
+}
+
+using namespace Global;
+
+int not_imported = 35;
+int fun_var = 9;
+
+namespace NotImportedAfter
+{
+int not_imported = 55;
+}
+
+namespace Imported
+{
+int imported = 99;
+}
+
+int imported = 89;
 
 int main()
 {
+using namespace N;
+using namespace Nested;
+using namespace Imported;
+using Single::single;
 n = 1;
 anon = 2;
 nested = 3;
-return 0; // break 0
+global = 4;
+return Fun::fun(); // break 0
 }
Index: test/lang/cpp/nsimport/TestCppNsImport.py
===
--- test/lang/cpp/nsimport/TestCppNsImport.py
+++ test/lang/cpp/nsimport/TestCppNsImport.py
@@ -16,6 +16,8 @@
 self.buildDsym()
 self.check()
 
+# This test is expected to fail because DW_TAG_imported_declaration and DW_TAG_imported_module are not parsed in SymbolFileDWARF
+@expectedFailureAll
 @dwarf_test
 def test_with_dwarf_and_run_command(self):
 """Tests imported namespaces in C++."""
@@ -45,6 +47,8 @@
 # Break on main function
 break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
 self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
+break_1 = target.BreakpointCreateBySourceRegex("// break 1", src_file_spec)
+self.assertTrue(break_1.IsValid() and break_1.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
 args = None
@@ -72,6 +76,35 @@
 test_result = frame.EvaluateExpression("anon")
 self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
 
+test_result = frame.EvaluateExpression("global")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 4, "global = 4")
+
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 9, "fun_var = 9")
+
+test_result = frame.EvaluateExpression("not_imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 35, "not_imported = 35")
+
+test_result = frame.EvaluateExpression("imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 99, "imported = 99")
+
+test_result = frame.EvaluateExpression("single")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "single = 3")
+
+# Continue to second breakpoint
+process.Continue()
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+
+# Get current fream of the thread at the breakpoint
+frame = thread.GetSelectedFrame()
+
+# Test function inside namespace
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 5, "fun_var = 5")
+
 
 if __name__ == '__main__':
 import atexit
Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -15,9 +15,12 @@
 #include 

Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line and -symbol-list-lines when Windows filenames are used.

2015-09-15 Thread Dawn Perchik via lldb-commits
dawn updated this revision to Diff 34812.
dawn added a comment.

Oops - forgot patch to CMakeLists.txt.


Repository:
  rL LLVM

http://reviews.llvm.org/D12115

Files:
  test/tools/lldb-mi/symbol/Makefile
  test/tools/lldb-mi/symbol/TestMiSymbol.py
  test/tools/lldb-mi/symbol/main.cpp
  test/tools/lldb-mi/symbol/x.cpp
  test/tools/lldb-mi/symbol/x.h
  tools/lldb-mi/CMakeLists.txt
  tools/lldb-mi/MICmdCmdData.cpp
  tools/lldb-mi/MICmdCmdSymbol.cpp
  tools/lldb-mi/MIUtilParse.cpp
  tools/lldb-mi/MIUtilParse.h
  tools/lldb-mi/MIUtilString.cpp
  tools/lldb-mi/MIUtilString.h

Index: tools/lldb-mi/MIUtilString.h
===
--- tools/lldb-mi/MIUtilString.h
+++ tools/lldb-mi/MIUtilString.h
@@ -43,6 +43,7 @@
 /* ctor */ CMIUtilString();
 /* ctor */ CMIUtilString(const char *vpData);
 /* ctor */ CMIUtilString(const char *const *vpData);
+/* ctor */ CMIUtilString(const char *vpData, size_t nLen);
 //
 bool ExtractNumber(MIint64 ) const;
 CMIUtilString FindAndReplace(const CMIUtilString , const CMIUtilString ) const;
Index: tools/lldb-mi/MIUtilString.cpp
===
--- tools/lldb-mi/MIUtilString.cpp
+++ tools/lldb-mi/MIUtilString.cpp
@@ -55,6 +55,20 @@
 }
 
 //++ 
+// Details: CMIUtilString constructor.
+// Type:Method.
+// Args:vpData  - Pointer to UTF8 text data.
+//  nLen- Length of string.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::CMIUtilString(const char *vpData, size_t nLen)
+: std::string(vpData, nLen)
+{
+}
+
+
+//++ 
 // Details: CMIUtilString assignment operator.
 // Type:Method.
 // Args:vpRhs   - Pointer to UTF8 text data.
Index: tools/lldb-mi/MIUtilParse.h
===
--- tools/lldb-mi/MIUtilParse.h
+++ tools/lldb-mi/MIUtilParse.h
@@ -0,0 +1,93 @@
+//===-- MIUtilParse.h --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+ 
+#pragma once
+ 
+// Third party headers:
+#include "../lib/Support/regex_impl.h"
+
+// In-house headers:
+#include "MIUtilString.h"
+ 
+namespace MIUtilParse
+{
+ 
+//++ 
+// Details: MI common code utility class. Used to parse the output
+//  returned from lldb commands using regex.
+//--
+class CRegexParser
+{
+  public:
+// Helper class for keeping track of regex matches.
+class Match
+{
+friend CRegexParser;
+  public:
+/* ctor */ explicit Match(size_t nmatches)
+: m_matchStrs(nmatches), m_maxMatches(nmatches)
+{
+}
+size_t
+GetMatchCount() const
+{
+return m_matchStrs.size();
+}
+CMIUtilString
+GetMatchAtIndex(size_t i) const
+{
+if (m_matchStrs.size() > i)
+return m_matchStrs[i];
+return CMIUtilString();
+}
+  private:
+CMIUtilString::VecString_t m_matchStrs;
+const size_t m_maxMatches;
+};
+ 
+// Methods:
+// Compile the regular expression.
+/* ctor */ explicit CRegexParser(const char *regexStr);
+ 
+// Free the memory used by the regular expression.
+/* dtor */ ~CRegexParser();
+ 
+// No copies
+CRegexParser(const CRegexParser&) = delete;
+void operator=(CRegexParser&) = delete;
+ 
+// Return the match at the index.
+int
+GetMatchCount(const Match& match) const
+{
+if (m_isValid)
+return match.GetMatchCount();
+return 0;
+}
+ 
+bool
+IsValid() const
+{
+return m_isValid;
+}
+ 
+// Match the input against the regular expression.  Return an error
+// if the number of matches is less than minMatches.  If the default
+// minMatches value of 0 is passed, an error will be returned if
+// the number of matches is less than the maxMatches value used to
+// initialize Match.
+bool
+Execute(const char *input, Match& match, size_t minMatches = 0);
+ 
+  private:
+llvm_regex_t m_emma;
+const bool m_isValid;
+};
+
+}
Index: tools/lldb-mi/MIUtilParse.cpp
===
--- tools/lldb-mi/MIUtilParse.cpp
+++ tools/lldb-mi/MIUtilParse.cpp
@@ -0,0 +1,75 @@
+//===-- MIUtilParse.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University 

Re: [Lldb-commits] [PATCH] D12658: Search variables based on clang::DeclContext and clang::Decl tree

2015-09-15 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 34823.
paulherman added a comment.

Search variables based on clang::DeclContext and clang::Decl tree

This adds handling of imported declarations, but there is no call to actually 
process them as I am not sure where to do this. I believe that the right place 
is in SymbolFileDWARF::ParseVariablesForContext.


http://reviews.llvm.org/D12658

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDecl.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Symbol/Variable.h
  include/lldb/lldb-forward.h
  source/Expression/ClangASTSource.cpp
  source/Expression/ClangExpressionDeclMap.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/CMakeLists.txt
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDecl.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/Variable.cpp
  test/lang/cpp/nsimport/TestCppNsImport.py
  test/lang/cpp/nsimport/main.cpp

Index: test/lang/cpp/nsimport/main.cpp
===
--- test/lang/cpp/nsimport/main.cpp
+++ test/lang/cpp/nsimport/main.cpp
@@ -16,13 +16,57 @@
 }
 }
 
-using namespace N;
-using namespace Nested;
+namespace Global
+{
+int global;
+}
+
+namespace Fun
+{
+int fun_var;
+int fun()
+{
+fun_var = 5;
+return 0; // break 1
+}
+}
+
+namespace Single
+{
+int single = 3;
+}
+
+namespace NotImportedBefore
+{
+int not_imported = 45;
+}
+
+using namespace Global;
+
+int not_imported = 35;
+int fun_var = 9;
+
+namespace NotImportedAfter
+{
+int not_imported = 55;
+}
+
+namespace Imported
+{
+int imported = 99;
+}
+
+int imported = 89;
 
 int main()
 {
+using namespace N;
+using namespace Nested;
+using namespace Imported;
+using Single::single;
 n = 1;
 anon = 2;
 nested = 3;
-return 0; // break 0
+global = 4;
+return Fun::fun(); // break 0
 }
Index: test/lang/cpp/nsimport/TestCppNsImport.py
===
--- test/lang/cpp/nsimport/TestCppNsImport.py
+++ test/lang/cpp/nsimport/TestCppNsImport.py
@@ -16,6 +16,8 @@
 self.buildDsym()
 self.check()
 
+# This test is expected to fail because DW_TAG_imported_declaration and DW_TAG_imported_module are not parsed in SymbolFileDWARF
+@expectedFailureAll
 @dwarf_test
 def test_with_dwarf_and_run_command(self):
 """Tests imported namespaces in C++."""
@@ -45,6 +47,8 @@
 # Break on main function
 break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
 self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
+break_1 = target.BreakpointCreateBySourceRegex("// break 1", src_file_spec)
+self.assertTrue(break_1.IsValid() and break_1.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
 args = None
@@ -72,6 +76,35 @@
 test_result = frame.EvaluateExpression("anon")
 self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
 
+test_result = frame.EvaluateExpression("global")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 4, "global = 4")
+
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 9, "fun_var = 9")
+
+test_result = frame.EvaluateExpression("not_imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 35, "not_imported = 35")
+
+test_result = frame.EvaluateExpression("imported")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 99, "imported = 99")
+
+test_result = frame.EvaluateExpression("single")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "single = 3")
+
+# Continue to second breakpoint
+process.Continue()
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+
+# Get current fream of the thread at the breakpoint
+frame = thread.GetSelectedFrame()
+
+# Test function inside namespace
+test_result = frame.EvaluateExpression("fun_var")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 5, "fun_var = 5")
+
 
 if __name__ == '__main__':
 

Re: [Lldb-commits] [PATCH] D12878: [lldb-mi] Clean up CMICmdArgSet usage.

2015-09-15 Thread Bruce Mitchener via lldb-commits
brucem added a comment.

This could be cleaner still, but this is a good first pass and removes the 
worst of it.


http://reviews.llvm.org/D12878



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


Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line and -symbol-list-lines when Windows filenames are used.

2015-09-15 Thread Hafiz Abid Qadeer via lldb-commits
abidh requested changes to this revision.
abidh added a comment.
This revision now requires changes to proceed.

You forgot to add the MIUtilParse.cpp to CMakeLists.txt. Please add it and then 
it is good to go. Thanks for doing it.


Repository:
  rL LLVM

http://reviews.llvm.org/D12115



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


Re: [Lldb-commits] [PATCH] D5871: Add an OperatingSystem plugin to support goroutines

2015-09-15 Thread Tamas Berghammer via lldb-commits
tberghammer added a subscriber: tberghammer.
tberghammer requested changes to this revision.
tberghammer added a reviewer: tberghammer.
tberghammer added a comment.
This revision now requires changes to proceed.

If I understand this change correctly then OperatingSystemGo::CreateInstance 
will be called every time we launch or attach a new process. This function then 
calls OperatingSystemGo::FindGlobal what will call into 
ModuleList::FindGlobalVariables. The problem is that it will require a full 
dwarf info parsing for all module what is very slow and we would like to avoid 
it at almost all cost. The rest of the plugins mentioned by Jim (JIT, ASAN) are 
doing only a symbol name lookup based on a fixed symbol what is significantly 
faster because it requires only the parsing of the symtab. Please try to find a 
way to detect when you have to enable the go plugin based on symtab only or 
based on the ELF headers what can be parsed even faster (they contain a 
language attribute what should be sufficient (if it is filled in) on Linux/OSX, 
but I don't know about Windows).

Note: If CreateInstace isn't called at launch/attach time when we are working 
with a non-go inferior, then feel free to ignore my comment.


Repository:
  rL LLVM

http://reviews.llvm.org/D5871



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


[Lldb-commits] [lldb] r247703 - Fix build after llvm r247683 was reverted.

2015-09-15 Thread Daniel Sanders via lldb-commits
Author: dsanders
Date: Tue Sep 15 11:33:17 2015
New Revision: 247703

URL: http://llvm.org/viewvc/llvm-project?rev=247703=rev
Log:
Fix build after llvm r247683 was reverted.


Modified:
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=247703=247702=247703=diff
==
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Tue Sep 
15 11:33:17 2015
@@ -506,7 +506,7 @@ DisassemblerLLVMC::LLVMCDisassembler::LL
 asm_printer_variant = flavor;
 }
 
-
m_instr_printer_ap.reset(curr_target->createMCInstPrinter(llvm::TargetTuple{llvm::Triple{triple}},
+
m_instr_printer_ap.reset(curr_target->createMCInstPrinter(llvm::Triple{triple},
   
asm_printer_variant,
   
*m_asm_info_ap.get(),
   
*m_instr_info_ap.get(),


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


Re: [Lldb-commits] [PATCH] D12879: [lldb-mi] Simplify CMICmnLLDBDebugSessionInfo::Shutdown.

2015-09-15 Thread Hafiz Abid Qadeer via lldb-commits
abidh accepted this revision.
abidh added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D12879



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


Re: [Lldb-commits] [PATCH] D12804: Fix several issues around dwo symbol file handling

2015-09-15 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

Thank you for the clarification. I will commit in this patch without the change 
we discussed (ignoring 0 file address) and I will address that issue later.


http://reviews.llvm.org/D12804



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


Re: [Lldb-commits] [PATCH] D12879: [lldb-mi] Simplify CMICmnLLDBDebugSessionInfo::Shutdown.

2015-09-15 Thread Bruce Mitchener via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247673: [lldb-mi] Simplify 
CMICmnLLDBDebugSessionInfo::Shutdown. (authored by brucem).

Changed prior to commit:
  http://reviews.llvm.org/D12879?vs=34792=34795#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12879

Files:
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
  lldb/trunk/tools/lldb-mi/MICmnResources.cpp
  lldb/trunk/tools/lldb-mi/MICmnResources.h

Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
@@ -99,16 +99,9 @@
 if (!m_bInitialized)
 return MIstatus::success;
 
-bool bOk = MIstatus::success;
-CMIUtilString errMsg;
-
 // Tidy up
-bOk = SharedDataDestroy();
-if (!bOk)
-{
-errMsg = MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_RELEASE);
-errMsg += "\n";
-}
+SharedDataDestroy();
+
 m_vecActiveThreadId.clear();
 CMICmnLLDBDebugSessionInfoVarObj::VarObjClear();
 
@@ -125,18 +118,15 @@
 //  stopped i.e. application shutdown.
 // Type:Method.
 // Args:None.
-// Return:  MIstatus::success - Functional succeeded.
-//  MIstatus::failure - Functional failed.
+// Return:  None.
 // Throws:  None.
 //--
-bool
+void
 CMICmnLLDBDebugSessionInfo::SharedDataDestroy()
 {
 m_mapIdToSessionData.Clear();
 m_vecVarObj.clear();
 m_mapBrkPtIdToBrkPtInfo.clear();
-
-return MIstatus::success;
 }
 
 //++ 

Index: lldb/trunk/tools/lldb-mi/MICmnResources.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnResources.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnResources.cpp
@@ -141,8 +141,6 @@
  "LLDB Out-of-band. %s. Event handler tried to set new MI Driver running 
state and failed. %s"},
 {IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
  "LLDB Out-of-band. '%s'. Number of valid breakpoint exceeded %d. Cannot 
create new breakpoint with ID %d"},
-{IDS_DBGSESSION_ERR_SHARED_DATA_RELEASE,
- "LLDB debug session info. Release some or all of the data shared across 
command instances failed"},
 {IDS_DBGSESSION_ERR_SHARED_DATA_ADD, "LLDB debug session info. Failed to 
add '%s' data to the shared data command container"},
 {IDS_MI_SHTDWN_ERR_LOG, "Log. Error occurred during shutdown. %s"},
 {IDS_MI_SHUTDOWN_ERR, "Server shutdown failure. %s"},
Index: lldb/trunk/tools/lldb-mi/MICmnResources.h
===
--- lldb/trunk/tools/lldb-mi/MICmnResources.h
+++ lldb/trunk/tools/lldb-mi/MICmnResources.h
@@ -152,7 +152,6 @@
 IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE,
 IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED,
 
-IDS_DBGSESSION_ERR_SHARED_DATA_RELEASE,
 IDS_DBGSESSION_ERR_SHARED_DATA_ADD,
 
 IDS_MI_SHTDWN_ERR_LOG,
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
@@ -143,7 +143,7 @@
 // Variant type data which can be assigned and retrieved across all 
command instances
 template  bool SharedDataAdd(const CMIUtilString , const 
T );
 template  bool SharedDataRetrieve(const CMIUtilString , T 
);
-bool SharedDataDestroy();
+void SharedDataDestroy();
 
 //  Common command required functionality
 bool AccessPath(const CMIUtilString , bool );


Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
@@ -99,16 +99,9 @@
 if (!m_bInitialized)
 return MIstatus::success;
 
-bool bOk = MIstatus::success;
-CMIUtilString errMsg;
-
 // Tidy up
-bOk = SharedDataDestroy();
-if (!bOk)
-{
-errMsg = MIRSRC(IDS_DBGSESSION_ERR_SHARED_DATA_RELEASE);
-errMsg += "\n";
-}
+SharedDataDestroy();
+
 m_vecActiveThreadId.clear();
 CMICmnLLDBDebugSessionInfoVarObj::VarObjClear();
 
@@ -125,18 +118,15 @@
 //  stopped i.e. application shutdown.
 // Type:Method.
 // Args:None.
-// Return:  MIstatus::success - Functional succeeded.
-//  MIstatus::failure - Functional failed.
+// Return:  None.
 // Throws:  None.
 //--
-bool
+void
 CMICmnLLDBDebugSessionInfo::SharedDataDestroy()
 {
 m_mapIdToSessionData.Clear();
 m_vecVarObj.clear();
 m_mapBrkPtIdToBrkPtInfo.clear();
-
-return MIstatus::success;
 }
 
 //++ 

Re: [Lldb-commits] [PATCH] D12878: [lldb-mi] Clean up CMICmdArgSet usage.

2015-09-15 Thread Bruce Mitchener via lldb-commits
brucem added inline comments.


Comment at: tools/lldb-mi/MICmdArgSet.cpp:92
@@ -91,3 +91,3 @@
 // Type:Method.
 // Args:vArg- (R) A command argument object.
 // Return:  None.

ki.stfu wrote:
> brucem wrote:
> > Should this say something other than `(R)` here?
> This comment is useless, and for me it looks like an attempt to write 
> something to follow the coding style. FMPOV, we should remove all comments 
> like that, and move others to corresponding .h files.
If / when that move happens, we should also move to Doxygen syntax.


http://reviews.llvm.org/D12878



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


Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Jim Ingham via lldb-commits
jingham added a subscriber: jingham.
jingham requested changes to this revision.
jingham added a reviewer: jingham.
jingham added a comment.
This revision now requires changes to proceed.

This change means that the two cases "no debug info" and "couldn't find your 
sources" end up looking very similar.  I think it is fine to show the assembly 
but it would be better to also arrange a warning that we couldn't find this 
source file.


Repository:
  rL LLVM

http://reviews.llvm.org/D12877



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


[Lldb-commits] [lldb] r247709 - Make the source-map help grammatical.

2015-09-15 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Sep 15 13:03:00 2015
New Revision: 247709

URL: http://llvm.org/viewvc/llvm-project?rev=247709=rev
Log:
Make the source-map help grammatical.

Modified:
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=247709=247708=247709=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Sep 15 13:03:00 2015
@@ -3147,7 +3147,7 @@ g_properties[] =
 { "prefer-dynamic-value"   , OptionValue::eTypeEnum  , 
false, eDynamicDontRunTarget , NULL, g_dynamic_value_types, "Should printed 
values be shown as their dynamic value." },
 { "enable-synthetic-value" , OptionValue::eTypeBoolean   , 
false, true  , NULL, NULL, "Should synthetic values be used 
by default whenever available." },
 { "skip-prologue"  , OptionValue::eTypeBoolean   , 
false, true  , NULL, NULL, "Skip function prologues when 
setting breakpoints by name." },
-{ "source-map" , OptionValue::eTypePathMap   , 
false, 0 , NULL, NULL, "Source path remappings used to 
track the change of location between a source file when built, and "
+{ "source-map" , OptionValue::eTypePathMap   , 
false, 0 , NULL, NULL, "Source path remappings are used 
to track the change of location between a source file when built, and "
   "where it exists on the current system.  It consists of an array of 
duples, the first element of each duple is "
   "some part (starting at the root) of the path to the file when it was 
built, "
   "and the second is where the remainder of the original build hierarchy 
is rooted on the local system.  "


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


Re: [Lldb-commits] [PATCH] D5871: Add an OperatingSystem plugin to support goroutines

2015-09-15 Thread Ryan Brown via lldb-commits
ribrdb updated the summary for this revision.
ribrdb set the repository for this revision to rL LLVM.
ribrdb updated this revision to Diff 34806.
ribrdb added a comment.

I've updated this to load the plugin when modules are loaded, added a setting 
to enable/disable the goroutine plugin, and added a test.


Repository:
  rL LLVM

http://reviews.llvm.org/D5871

Files:
  include/lldb/Core/PluginManager.h
  lldb.xcodeproj/project.pbxproj
  source/Core/PluginManager.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/OperatingSystem/CMakeLists.txt
  source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
  source/Plugins/OperatingSystem/Go/OperatingSystemGo.h
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Process.cpp
  source/Target/StackFrameList.cpp
  source/Target/ThreadList.cpp
  test/lang/go/goroutines/TestGoroutines.py
  test/lang/go/goroutines/main.go

Index: test/lang/go/goroutines/main.go
===
--- /dev/null
+++ test/lang/go/goroutines/main.go
@@ -0,0 +1,89 @@
+package main
+
+import (
+	"fmt"
+	"runtime"
+)
+
+type philosopher struct {
+	i int
+	forks [2]chan bool
+	eating chan int
+	done  chan struct{}
+}
+
+func (p philosopher) run() {
+	for {
+		select {
+		case <-p.done:
+			return
+		case <-p.forks[0]:
+			p.eat()
+		}
+	}
+}
+
+func (p philosopher) eat() {
+	select {
+	case <-p.done:
+		return
+	case <-p.forks[1]:
+		p.eating <- p.i
+		p.forks[0] <- true
+		p.forks[1] <- true
+		runtime.Gosched()
+	}
+}
+
+func startPhilosophers(n int) (chan struct{}, chan int) {
+	philosophers := make([]*philosopher, n)
+	chans := make([]chan bool, n)
+	for i := range chans {
+		chans[i] = make(chan bool, 1)
+		chans[i] <- true
+	}
+	eating := make(chan int, n)
+	done := make(chan struct{})
+	for i := range philosophers {
+		var min, max int
+		if i == n - 1 {
+			min = 0
+			max = i
+		} else {
+			min = i
+			max = i + 1
+		}
+		philosophers[i] = {i: i, forks: [2]chan bool{chans[min], chans[max]}, eating: eating, done: done}
+		go philosophers[i].run()
+	}
+	return done, eating
+}
+
+func wait(c chan int) {
+	fmt.Println(<- c)
+	runtime.Gosched()
+}
+
+func main() {
+	// Restrict go to 1 real thread so we can be sure we're seeing goroutines
+	// and not threads.
+	runtime.GOMAXPROCS(1)
+	// Create a bunch of goroutines
+	done, eating := startPhilosophers(20) // stop1
+	// Now turn up the number of threads so this goroutine is likely to get
+	// scheduled on a different thread.
+	runtime.GOMAXPROCS(runtime.NumCPU()) // stop2
+	// Now let things run. Hopefully we'll bounce around
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	close(done)
+	fmt.Println("done") // stop3
+}
Index: test/lang/go/goroutines/TestGoroutines.py
===
--- /dev/null
+++ test/lang/go/goroutines/TestGoroutines.py
@@ -0,0 +1,86 @@
+"""Test the Go OS Plugin."""
+
+import os, time
+import unittest2
+import lldb
+import lldbutil
+from lldbtest import *
+
+class TestGoASTContext(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@python_api_test
+@skipUnlessGoInstalled
+def test_goroutine_plugin(self):
+"""Test goroutine as threads support."""
+self.buildGo()
+self.launchProcess()
+self.check_goroutines()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers to break inside main().
+self.main_source = "main.go"
+self.break_line1 = line_number(self.main_source, '// stop1')
+self.break_line2 = line_number(self.main_source, '// stop2')
+self.break_line3 = line_number(self.main_source, '// stop3')
+
+def launchProcess(self):
+exe = os.path.join(os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+self.bpt1 = target.BreakpointCreateByLocation(self.main_source, self.break_line1)
+self.assertTrue(self.bpt1, VALID_BREAKPOINT)
+self.bpt2 = target.BreakpointCreateByLocation(self.main_source, self.break_line2)
+self.assertTrue(self.bpt2, VALID_BREAKPOINT)
+self.bpt3 = target.BreakpointCreateByLocation(self.main_source, self.break_line3)
+self.assertTrue(self.bpt3, VALID_BREAKPOINT)
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple (None, None, self.get_process_working_directory())
+
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, self.bpt1)
+
+# Make sure we stopped at the first breakpoint.
+self.assertTrue (len(thread_list) != 

Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.

2015-09-15 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:200
@@ -198,1 +199,3 @@
 
+void
+GetMangledNamesForFunction (const std::string _qualified_name,

sivachandra wrote:
> spyffe wrote:
> > Why is this attached to the DWARF?  I would want to attach this to the 
> > ClangExpressionDeclMap because we identify these alternate names during 
> > function name lookup, and we just need to remember them when resolving the 
> > references in IR.  After that, they are no longer needed.
> My thinking was, DWARF is the only thing which knows about the correct 
> mangled name, so keep it close to the code dealing with DWARF. Your 
> suggestion also makes sense, but might (I have not yet thought enough about 
> it) require us to expose DIE info into ClangExpressionDeclMap. I will think 
> more about this approach and get back to you.
I spent some time thinking about this. ClandExpressionDeclMap doesn't really 
explicitly lookup method names. If we have an expression like "v.size()", we 
lookup what "v" is, and that conveys to Clang about the existence of a method 
"size" in its class. The requirement for alternate names kicks in (so to say) 
when we are looking for the address of the method. I am not very clear on how 
we can cleanly keep track of all the methods parsed, while looking up 
variables, in ClangExpressionDeclMap and use that knowledge while looking up 
addresses. Do you have any suggestions?

I agree that it is indeed odd to have a method GetMangledNamesForFunction in 
SymbolFile which is useful only for expression evaluation. How about having a 
temp object that ClangExpressionDeclMap registers with SymbolFile, and cleans 
it up after expression evaluation is done? SymbolFile stuffs in to the object 
all info that ClangExpressionDeclMap could potentially use while parsing the 
DIEs. ExpressionEvaluationIndex?


http://reviews.llvm.org/D12809



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


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D12831#246394, @zturner wrote:

> Sorry this took so long.  Here's my first run:


No worries.

> Traceback (most recent call last):

> 

>   File "D:/src/llvm/tools/lldb/test/dotest.py", line 1416, in 

> import dosep

>   File "D:\src\llvm\tools\lldb\test\dosep.py", line 48, in 

> import dotest_channels

>   File "D:\src\llvm\tools\lldb\test\dotest_channels.py", line 22, in

> 

> 

> 

>   class CollectingReaderChannel(asyncore.file_dispatcher):

> 

> AttributeError: 'module' object has no attribute 'file_dispatcher'


Okay.  That's the part where asyncore docs and googling/SO differ on how much 
(if any) of asyncore works on Windows.

At the moment I can nuke the CollectingReaderChannel.  I'll put up a diff.  If 
that works, great.  If not, we may still hit another part of asyncore that 
isn't supported, and that will take longer to work out a non-breaking solution. 
 Back as soon as I have a change to try...

> I haven't looked into this at all yet, but thought I would post a

>  preliminary result as soon as I had one.  Will look into it now





http://reviews.llvm.org/D12831



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


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Zachary Turner via lldb-commits
If you check the python docs, it looks like you just can't use
asyncore.file_dispatcher and asyncore.file_wrapper.  Everything else seems
ok.  Just search the page for "Availability" and the only hits you get are
on those 2 fields, which says they are UNIX specific.

On Tue, Sep 15, 2015 at 12:44 PM Todd Fiala  wrote:

> tfiala added a comment.
>
> In http://reviews.llvm.org/D12831#246394, @zturner wrote:
>
> > Sorry this took so long.  Here's my first run:
>
>
> No worries.
>
> > Traceback (most recent call last):
>
> >
>
> >   File "D:/src/llvm/tools/lldb/test/dotest.py", line 1416, in 
>
> > import dosep
>
> >   File "D:\src\llvm\tools\lldb\test\dosep.py", line 48, in 
>
> > import dotest_channels
>
> >   File "D:\src\llvm\tools\lldb\test\dotest_channels.py", line 22, in
>
> >
>
> > 
>
> >
>
> >   class CollectingReaderChannel(asyncore.file_dispatcher):
>
> >
>
> > AttributeError: 'module' object has no attribute 'file_dispatcher'
>
>
> Okay.  That's the part where asyncore docs and googling/SO differ on how
> much (if any) of asyncore works on Windows.
>
> At the moment I can nuke the CollectingReaderChannel.  I'll put up a
> diff.  If that works, great.  If not, we may still hit another part of
> asyncore that isn't supported, and that will take longer to work out a
> non-breaking solution.  Back as soon as I have a change to try...
>
> > I haven't looked into this at all yet, but thought I would post a
>
> >  preliminary result as soon as I had one.  Will look into it now
>
>
>
>
>
> http://reviews.llvm.org/D12831
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12880: Add support for the DWARFLocationList used by split-dwarf

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks good, we just need to relocate the DWARF expression printing stuff over 
into DWARFExpression as static functions.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:36-228
@@ -37,1 +35,195 @@
 
+static int
+print_dwarf_exp_op (Stream ,
+const DWARFDataExtractor& data,
+lldb::offset_t *offset_ptr,
+int address_size,
+int dwarf_ref_size)
+{
+uint8_t opcode = data.GetU8(offset_ptr);
+DRC_class opcode_class;
+uint64_t  uint;
+int64_t   sint;
+
+int size;
+
+opcode_class = DW_OP_value_to_class (opcode) & (~DRC_DWARFv3);
+
+s.Printf("%s ", DW_OP_value_to_name (opcode));
+
+/* Does this take zero parameters?  If so we can shortcut this function.  
*/
+if (opcode_class == DRC_ZEROOPERANDS)
+return 0;
+
+if (opcode_class == DRC_TWOOPERANDS && opcode == DW_OP_bregx)
+{
+uint = data.GetULEB128(offset_ptr);
+sint = data.GetSLEB128(offset_ptr);
+s.Printf("%" PRIu64 " %" PRIi64, uint, sint);
+return 0;
+}
+if (opcode_class != DRC_ONEOPERAND)
+{
+s.Printf("UNKNOWN OP %u", opcode);
+return 1;
+}
+
+switch (opcode)
+{
+case DW_OP_addr:size = address_size;break;
+case DW_OP_const1u: size = 1;   break;
+case DW_OP_const1s: size = -1;  break;
+case DW_OP_const2u: size = 2;   break;
+case DW_OP_const2s: size = -2;  break;
+case DW_OP_const4u: size = 4;   break;
+case DW_OP_const4s: size = -4;  break;
+case DW_OP_const8u: size = 8;   break;
+case DW_OP_const8s: size = -8;  break;
+case DW_OP_constu:  size = 128; break;
+case DW_OP_consts:  size = -128;break;
+case DW_OP_fbreg:   size = -128;break;
+case DW_OP_breg0:
+case DW_OP_breg1:
+case DW_OP_breg2:
+case DW_OP_breg3:
+case DW_OP_breg4:
+case DW_OP_breg5:
+case DW_OP_breg6:
+case DW_OP_breg7:
+case DW_OP_breg8:
+case DW_OP_breg9:
+case DW_OP_breg10:
+case DW_OP_breg11:
+case DW_OP_breg12:
+case DW_OP_breg13:
+case DW_OP_breg14:
+case DW_OP_breg15:
+case DW_OP_breg16:
+case DW_OP_breg17:
+case DW_OP_breg18:
+case DW_OP_breg19:
+case DW_OP_breg20:
+case DW_OP_breg21:
+case DW_OP_breg22:
+case DW_OP_breg23:
+case DW_OP_breg24:
+case DW_OP_breg25:
+case DW_OP_breg26:
+case DW_OP_breg27:
+case DW_OP_breg28:
+case DW_OP_breg29:
+case DW_OP_breg30:
+case DW_OP_breg31:
+size = -128; break;
+case DW_OP_pick:
+size = 1;   break;
+case DW_OP_deref_size:
+size = 1;   break;
+case DW_OP_xderef_size:
+size = 1;   break;
+case DW_OP_plus_uconst:
+size = 128; break;
+case DW_OP_skip:
+size = -2;  break;
+case DW_OP_bra:
+size = -2;  break;
+case DW_OP_call2:
+size = 2;   break;
+case DW_OP_call4:
+size = 4;   break;
+case DW_OP_call_ref:
+size = dwarf_ref_size;  break;
+case DW_OP_piece:
+size = 128; break;
+case DW_OP_regx:
+size = 128; break;
+case DW_OP_GNU_addr_index:
+case DW_OP_GNU_const_index:
+size = 128; break;
+default:
+s.Printf("UNKNOWN ONE-OPERAND OPCODE, #%u", opcode);
+return 1;
+}
+
+switch (size)
+{
+case -1:sint = (int8_t) data.GetU8(offset_ptr); s.Printf("%+" 
PRIi64, sint); break;
+case -2:sint = (int16_t)data.GetU16(offset_ptr);s.Printf("%+" 
PRIi64, sint); break;
+case -4:sint = (int32_t)data.GetU32(offset_ptr);s.Printf("%+" 
PRIi64, sint); break;
+case -8:sint = (int64_t)data.GetU64(offset_ptr);s.Printf("%+" 
PRIi64, sint); break;
+case -128:  sint = data.GetSLEB128(offset_ptr); s.Printf("%+" 
PRIi64, sint); break;
+case 1: uint = data.GetU8(offset_ptr);  
s.Printf("0x%2.2" PRIx64, uint); break;
+case 2: uint = data.GetU16(offset_ptr); 
s.Printf("0x%4.4" PRIx64, uint); break;
+case 4: uint = data.GetU32(offset_ptr); 
s.Printf("0x%8.8" PRIx64, uint); break;
+case 8: uint = data.GetU64(offset_ptr); 
s.Printf("0x%16.16" PRIx64, uint); break;
+case 128:   uint = data.GetULEB128(offset_ptr); s.Printf("0x%" 

Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

I would rather not see a warning. If you don't have sources I don't really want 
to see:

warning: couldn't find foo.c
0x1000: add r1, r2, r3



Repository:
  rL LLVM

http://reviews.llvm.org/D12877



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


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Zachary Turner via lldb-commits
This appears to work now.  Thansk for working on this, I'm glad to see the
test suite finally get some love.

On Tue, Sep 15, 2015 at 2:08 PM Todd Fiala  wrote:

> tfiala added a comment.
>
> @zturner, can you give this a shot?  Thanks!
>
>
> http://reviews.llvm.org/D12831
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12877: [LLDB] Switch to assembly view if source is moved

2015-09-15 Thread Jim Ingham via lldb-commits

> On Sep 15, 2015, at 2:27 PM, Greg Clayton  wrote:
> 
> clayborg accepted this revision.
> clayborg added a comment.
> 
> I would rather not see a warning. If you don't have sources I don't really 
> want to see:
> 
> warning: couldn't find foo.c
> 0x1000: add r1, r2, r3
> 
> 
> 

Why not?  That would tell you you DID have debug information for the file but 
you've moved or deleted the sources.  That seems a useful piece of information.

Jim


> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D12877
> 
> 
> 

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


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Thanks, Zachary!

I'll get this in now.


http://reviews.llvm.org/D12831



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


[Lldb-commits] [lldb] r247722 - Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Tue Sep 15 16:38:04 2015
New Revision: 247722

URL: http://llvm.org/viewvc/llvm-project?rev=247722=rev
Log:
Add JUnit/XUnit-formatted output to the lldb test run system

Also introduces the test event system into our test runner framework.
See the following for details:
http://reviews.llvm.org/D12831

Added:
lldb/trunk/test/dotest_channels.py
lldb/trunk/test/test_results.py
Modified:
lldb/trunk/test/dosep.py
lldb/trunk/test/dotest.py
lldb/trunk/test/dotest_args.py
lldb/trunk/test/settings/TestSettings.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=247722=247721=247722=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Tue Sep 15 16:38:04 2015
@@ -32,6 +32,7 @@ ulimit -c unlimited
 echo core.%p | sudo tee /proc/sys/kernel/core_pattern
 """
 
+import asyncore
 import fnmatch
 import multiprocessing
 import multiprocessing.pool
@@ -44,10 +45,9 @@ import subprocess
 import sys
 import threading
 
+import dotest_channels
 import dotest_args
 
-from optparse import OptionParser
-
 
 def get_timeout_command():
 """Search for a suitable timeout command."""
@@ -76,6 +76,9 @@ test_name_len = None
 dotest_options = None
 output_on_success = False
 
+RESULTS_FORMATTER = None
+RUNNER_PROCESS_ASYNC_MAP = None
+RESULTS_LISTENER_CHANNEL = None
 
 def setup_global_variables(lock, counter, total, name_len, options):
 global output_lock, test_counter, total_tests, test_name_len
@@ -147,12 +150,39 @@ def parse_test_results(output):
 return passes, failures, unexpected_successes
 
 
+def inferior_session_interceptor(forwarding_func, event):
+"""Intercepts session begin/end events, passing through everyting else.
+
+@param forwarding_func a callable object to pass along the event if it
+is not one that gets intercepted.
+
+@param event the test result event received.
+"""
+
+if event is not None and isinstance(event, dict):
+if "event" in event:
+if event["event"] == "session_begin":
+# Swallow it.  Could report on inferior here if we
+# cared.
+return
+elif event["event"] == "session_end":
+# Swallow it.  Could report on inferior here if we
+# cared.  More usefully, we can verify that the
+# inferior went down hard if we don't receive this.
+return
+
+# Pass it along.
+forwarding_func(event)
+
+
 def call_with_timeout(command, timeout, name, inferior_pid_events):
-"""Run command with a timeout if possible."""
-"""-s QUIT will create a coredump if they are enabled on your system"""
+"""Run command with a timeout if possible.
+-s QUIT will create a coredump if they are enabled on your system
+"""
 process = None
 if timeout_command and timeout != "0":
 command = [timeout_command, '-s', 'QUIT', timeout] + command
+
 # Specifying a value for close_fds is unsupported on Windows when using
 # subprocess.PIPE
 if os.name != "nt":
@@ -170,7 +200,14 @@ def call_with_timeout(command, timeout,
 if inferior_pid_events:
 inferior_pid_events.put_nowait(('created', inferior_pid))
 output = process.communicate()
+
+# The inferior should now be entirely wrapped up.
 exit_status = process.returncode
+if exit_status is None:
+raise Exception(
+"no exit status available after the inferior dotest.py "
+"should have completed")
+
 if inferior_pid_events:
 inferior_pid_events.put_nowait(('destroyed', inferior_pid))
 
@@ -180,6 +217,10 @@ def call_with_timeout(command, timeout,
 # only stderr does.
 report_test_pass(name, output[1])
 else:
+# TODO need to differentiate a failing test from a run that
+# was broken out of by a SIGTERM/SIGKILL, reporting those as
+# an error.  If a signal-based completion, need to call that
+# an error.
 report_test_failure(name, command, output[1])
 return name, exit_status, passes, failures, unexpected_successes
 
@@ -250,9 +291,7 @@ def process_dir_worker_multiprocessing_p
 return process_dir(*args)
 
 
-def process_dir_worker_threading(
-a_test_counter, a_total_tests, a_test_name_len,
-a_dotest_options, job_queue, result_queue, inferior_pid_events):
+def process_dir_worker_threading(job_queue, result_queue, inferior_pid_events):
 """Worker thread main loop when in threading mode.
 
 This one supports the hand-rolled pooling support.
@@ -413,6 +452,150 @@ def initialize_global_vars_threading(num
 initialize_global_vars_common(num_threads, test_work_items)
 
 
+def ctrl_c_loop(main_op_func, done_func, ctrl_c_handler):
+"""Provides a main loop that is Ctrl-C protected.
+
+The main loop calls the 

Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
tfiala closed this revision.
tfiala added a comment.

Sendingtest/dosep.py
Sendingtest/dotest.py
Sendingtest/dotest_args.py
Adding test/dotest_channels.py
Sendingtest/settings/TestSettings.py
Adding test/test_results.py
Transmitting file data ..
Committed revision 247722.


http://reviews.llvm.org/D12831



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


Re: [Lldb-commits] [PATCH] D5871: Add an OperatingSystem plugin to support goroutines

2015-09-15 Thread Ryan Brown via lldb-commits
ribrdb updated this revision to Diff 34839.
ribrdb added a comment.

Fix cmake build.


Repository:
  rL LLVM

http://reviews.llvm.org/D5871

Files:
  cmake/LLDBDependencies.cmake
  include/lldb/Core/PluginManager.h
  lib/Makefile
  lldb.xcodeproj/project.pbxproj
  source/Core/PluginManager.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/Makefile
  source/Plugins/OperatingSystem/CMakeLists.txt
  source/Plugins/OperatingSystem/Go/CMakeLists.txt
  source/Plugins/OperatingSystem/Go/Makefile
  source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
  source/Plugins/OperatingSystem/Go/OperatingSystemGo.h
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Process.cpp
  source/Target/StackFrameList.cpp
  source/Target/ThreadList.cpp
  test/lang/go/goroutines/TestGoroutines.py
  test/lang/go/goroutines/main.go

Index: test/lang/go/goroutines/main.go
===
--- /dev/null
+++ test/lang/go/goroutines/main.go
@@ -0,0 +1,89 @@
+package main
+
+import (
+	"fmt"
+	"runtime"
+)
+
+type philosopher struct {
+	i int
+	forks [2]chan bool
+	eating chan int
+	done  chan struct{}
+}
+
+func (p philosopher) run() {
+	for {
+		select {
+		case <-p.done:
+			return
+		case <-p.forks[0]:
+			p.eat()
+		}
+	}
+}
+
+func (p philosopher) eat() {
+	select {
+	case <-p.done:
+		return
+	case <-p.forks[1]:
+		p.eating <- p.i
+		p.forks[0] <- true
+		p.forks[1] <- true
+		runtime.Gosched()
+	}
+}
+
+func startPhilosophers(n int) (chan struct{}, chan int) {
+	philosophers := make([]*philosopher, n)
+	chans := make([]chan bool, n)
+	for i := range chans {
+		chans[i] = make(chan bool, 1)
+		chans[i] <- true
+	}
+	eating := make(chan int, n)
+	done := make(chan struct{})
+	for i := range philosophers {
+		var min, max int
+		if i == n - 1 {
+			min = 0
+			max = i
+		} else {
+			min = i
+			max = i + 1
+		}
+		philosophers[i] = {i: i, forks: [2]chan bool{chans[min], chans[max]}, eating: eating, done: done}
+		go philosophers[i].run()
+	}
+	return done, eating
+}
+
+func wait(c chan int) {
+	fmt.Println(<- c)
+	runtime.Gosched()
+}
+
+func main() {
+	// Restrict go to 1 real thread so we can be sure we're seeing goroutines
+	// and not threads.
+	runtime.GOMAXPROCS(1)
+	// Create a bunch of goroutines
+	done, eating := startPhilosophers(20) // stop1
+	// Now turn up the number of threads so this goroutine is likely to get
+	// scheduled on a different thread.
+	runtime.GOMAXPROCS(runtime.NumCPU()) // stop2
+	// Now let things run. Hopefully we'll bounce around
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	wait(eating)
+	close(done)
+	fmt.Println("done") // stop3
+}
Index: test/lang/go/goroutines/TestGoroutines.py
===
--- /dev/null
+++ test/lang/go/goroutines/TestGoroutines.py
@@ -0,0 +1,87 @@
+"""Test the Go OS Plugin."""
+
+import os, time
+import unittest2
+import lldb
+import lldbutil
+from lldbtest import *
+
+class TestGoASTContext(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@python_api_test
+@skipIfRemote # Not remote test suit ready
+@skipUnlessGoInstalled
+def test_goroutine_plugin(self):
+"""Test goroutine as threads support."""
+self.buildGo()
+self.launchProcess()
+self.check_goroutines()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers to break inside main().
+self.main_source = "main.go"
+self.break_line1 = line_number(self.main_source, '// stop1')
+self.break_line2 = line_number(self.main_source, '// stop2')
+self.break_line3 = line_number(self.main_source, '// stop3')
+
+def launchProcess(self):
+exe = os.path.join(os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+self.bpt1 = target.BreakpointCreateByLocation(self.main_source, self.break_line1)
+self.assertTrue(self.bpt1, VALID_BREAKPOINT)
+self.bpt2 = target.BreakpointCreateByLocation(self.main_source, self.break_line2)
+self.assertTrue(self.bpt2, VALID_BREAKPOINT)
+self.bpt3 = target.BreakpointCreateByLocation(self.main_source, self.break_line3)
+self.assertTrue(self.bpt3, VALID_BREAKPOINT)
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple (None, None, self.get_process_working_directory())
+
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, self.bpt1)
+
+# Make sure we stopped at the first breakpoint.
+self.assertTrue (len(thread_list) != 0, "No 

[Lldb-commits] [PATCH] D12888: Add first tests for mini-dump debugging.

2015-09-15 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added a reviewer: zturner.
amccarth added a subscriber: lldb-commits.

This includes a dump file captured using Visual Studio, of the enclosed sample 
program, which was also build with Visual Studio.

The tests just verify that LLDB can access some very basic information from the 
mini-dump.

http://reviews.llvm.org/D12888

Files:
  test/functionalities/minidump/TestMiniDump.py
  test/functionalities/minidump/fizzbuzz.cpp
  test/functionalities/minidump/fizzbuzz_no_heap.dmp
  test/lldbtest.py

Index: test/lldbtest.py
===
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -889,6 +889,10 @@
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfHostPlatform(["windows"])(func)
 
+def skipUnlessWindows(func):
+"""Decorate the item to skip tests that should be skipped on any non-Windows platform."""
+return skipUnlessPlatform(["windows"])(func)
+
 def skipUnlessDarwin(func):
 """Decorate the item to skip tests that should be skipped on any non Darwin platform."""
 return skipUnlessPlatform(getDarwinOSTriples())(func)
Index: test/functionalities/minidump/fizzbuzz.cpp
===
--- /dev/null
+++ test/functionalities/minidump/fizzbuzz.cpp
@@ -0,0 +1,31 @@
+// A sample program for getting minidumps on Windows.
+
+#include 
+
+bool
+fizz(int x)
+{
+return x % 3 == 0;
+}
+
+bool
+buzz(int x)
+{
+return x % 5 == 0;
+}
+
+int
+main()
+{
+int *buggy = 0;
+
+for (int i = 1; i <= 100; ++i)
+{
+if (fizz(i)) std::cout << "fizz";
+if (buzz(i)) std::cout << "buzz";
+if (!fizz(i) && !buzz(i)) std::cout << i;
+std::cout << '\n';
+}
+
+return *buggy;
+}
Index: test/functionalities/minidump/TestMiniDump.py
===
--- /dev/null
+++ test/functionalities/minidump/TestMiniDump.py
@@ -0,0 +1,47 @@
+"""
+Test basics of mini dump debugging.
+"""
+
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class MiniDumpTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessWindows  # for now mini-dump debugging is limited to Windows hosts
+def test_process_info_in_mini_dump(self):
+"""Test that lldb can read the process information from the minidump."""
+self.assertTrue(self.process, PROCESS_IS_VALID)
+self.assertEqual(self.process.GetNumThreads(), 1)
+# TODO(amccarth):  Check the process ID.
+
+@skipUnlessWindows  # for now mini-dump debugging is limited to Windows hosts
+def test_thread_info_in_mini_dump(self):
+"""Test that lldb can read the thread information from the minidump."""
+# This process crashed due to an access violation (0xc005) in its one and only thread.
+self.assertEqual(self.process.GetNumThreads(), 1)
+thread = self.process.GetThreadAtIndex(0)
+self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException)
+stop_description = thread.GetStopDescription(256);
+self.assertTrue("0xc005" in stop_description);
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# target create -c fizzbuzz_no_heap.dmp
+self.dbg.CreateTarget("")
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp")
+
+def tearDown(self):
+# Call super's tearDown().
+TestBase.tearDown(self)
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
tfiala added a comment.

> I'm glad to see the test suite finally get some love.


Me too!  It's about time :-)


http://reviews.llvm.org/D12831



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


Re: [Lldb-commits] [PATCH] D12876: [MIPS] Debug bare-iron targets lacking support for qC /qfThreadInfo

2015-09-15 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D12876



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


Re: [Lldb-commits] [PATCH] D12831: Add JUnit/XUnit-formatted output to the lldb test run system

2015-09-15 Thread Todd Fiala via lldb-commits
tfiala updated this revision to Diff 34834.
tfiala added a comment.

Strips out asyncore-based stdout/stderr dotest inferior handling.  Unnecessary 
for the final implementation that moved the socket handling into the main 
thread/main process of the parallel test runner.


http://reviews.llvm.org/D12831

Files:
  test/dosep.py
  test/dotest.py
  test/dotest_args.py
  test/dotest_channels.py
  test/settings/TestSettings.py
  test/test_results.py

Index: test/test_results.py
===
--- /dev/null
+++ test/test_results.py
@@ -0,0 +1,778 @@
+"""
+ The LLVM Compiler Infrastructure
+
+This file is distributed under the University of Illinois Open Source
+License. See LICENSE.TXT for details.
+
+Provides classes used by the test results reporting infrastructure
+within the LLDB test suite.
+"""
+
+import argparse
+import cPickle
+import inspect
+import os
+import sys
+import threading
+import time
+import xml.sax.saxutils
+
+
+class EventBuilder(object):
+"""Helper class to build test result event dictionaries."""
+@staticmethod
+def _get_test_name_info(test):
+"""Returns (test-class-name, test-method-name) from a test case instance.
+
+@param test a unittest.TestCase instance.
+
+@return tuple containing (test class name, test method name)
+"""
+test_class_components = test.id().split(".")
+test_class_name = ".".join(test_class_components[:-1])
+test_name = test_class_components[-1]
+return (test_class_name, test_name)
+
+@staticmethod
+def _event_dictionary_common(test, event_type):
+"""Returns an event dictionary setup with values for the given event type.
+
+@param test the unittest.TestCase instance
+
+@param event_type the name of the event type (string).
+
+@return event dictionary with common event fields set.
+"""
+test_class_name, test_name = EventBuilder._get_test_name_info(test)
+return {
+"event": event_type,
+"test_class": test_class_name,
+"test_name": test_name,
+"event_time": time.time()
+}
+
+@staticmethod
+def _error_tuple_class(error_tuple):
+"""Returns the unittest error tuple's error class as a string.
+
+@param error_tuple the error tuple provided by the test framework.
+
+@return the error type (typically an exception) raised by the
+test framework.
+"""
+type_var = error_tuple[0]
+module = inspect.getmodule(type_var)
+if module:
+return "{}.{}".format(module.__name__, type_var.__name__)
+else:
+return type_var.__name__
+
+@staticmethod
+def _error_tuple_message(error_tuple):
+"""Returns the unittest error tuple's error message.
+
+@param error_tuple the error tuple provided by the test framework.
+
+@return the error message provided by the test framework.
+"""
+return str(error_tuple[1])
+
+@staticmethod
+def _event_dictionary_test_result(test, status):
+"""Returns an event dictionary with common test result fields set.
+
+@param test a unittest.TestCase instance.
+
+@param status the status/result of the test
+(e.g. "success", "failure", etc.)
+
+@return the event dictionary
+"""
+event = EventBuilder._event_dictionary_common(test, "test_result")
+event["status"] = status
+return event
+
+@staticmethod
+def _event_dictionary_issue(test, status, error_tuple):
+"""Returns an event dictionary with common issue-containing test result
+fields set.
+
+@param test a unittest.TestCase instance.
+
+@param status the status/result of the test
+(e.g. "success", "failure", etc.)
+
+@param error_tuple the error tuple as reported by the test runner.
+This is of the form (type, error).
+
+@return the event dictionary
+"""
+event = EventBuilder._event_dictionary_test_result(test, status)
+event["issue_class"] = EventBuilder._error_tuple_class(error_tuple)
+event["issue_message"] = EventBuilder._error_tuple_message(error_tuple)
+return event
+
+@staticmethod
+def event_for_start(test):
+"""Returns an event dictionary for the test start event.
+
+@param test a unittest.TestCase instance.
+
+@return the event dictionary
+"""
+return EventBuilder._event_dictionary_common(test, "test_start")
+
+@staticmethod
+def event_for_success(test):
+"""Returns an event dictionary for a successful test.
+
+@param test a unittest.TestCase instance.
+
+@return the event dictionary
+"""
+return EventBuilder._event_dictionary_test_result(test, "success")
+
+@staticmethod
+def event_for_unexpected_success(test, 

Re: [Lldb-commits] [PATCH] D12804: Fix several issues around dwo symbol file handling

2015-09-15 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247671: Fix several issues arount dwo symbol file handling 
(authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D12804?vs=34550=34793#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12804

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.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

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -186,8 +186,11 @@
 
 if (m_cu)
 {
-assert ((id&0xull) == 0 || m_cu->GetOffset() == 0);
-id |= ((lldb::user_id_t)m_cu->GetOffset()) << 32;
+lldb::user_id_t cu_id = ((lldb::user_id_t)m_cu->GetID())<<32;
+assert ((id&0xull) == 0 ||
+(cu_id&0xll) == 0 ||
+(id&0xull) == (cu_id&0xll));
+id |= cu_id;
 }
 return id;
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -433,7 +433,7 @@
bool include_inlines,
lldb_private::SymbolContextList& sc_list);
 
-lldb::TypeSP
+virtual lldb::TypeSP
 FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext _decl_ctx);
 
 lldb::TypeSP
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -23,6 +23,7 @@
 m_obj_file_sp(objfile),
 m_base_dwarf_cu(dwarf_cu)
 {
+SetID(((lldb::user_id_t)dwarf_cu->GetOffset())<<32);
 }
 
 const lldb_private::DWARFDataExtractor&
@@ -63,7 +64,7 @@
 SymbolFileDWARFDwo::ParseCompileUnit(DWARFCompileUnit* dwarf_cu, uint32_t cu_idx)
 {
 assert(GetCompileUnit() == dwarf_cu && "SymbolFileDWARFDwo::ParseCompileUnit called with incompatible compile unit");
-return m_base_dwarf_cu->GetSymbolFileDWARF()->ParseCompileUnit(m_base_dwarf_cu, UINT32_MAX);
+return GetBaseSymbolFile()->ParseCompileUnit(m_base_dwarf_cu, UINT32_MAX);
 }
 
 DWARFCompileUnit*
@@ -85,23 +86,35 @@
 SymbolFileDWARF::DIEToTypePtr&
 SymbolFileDWARFDwo::GetDIEToType()
 {
-return m_base_dwarf_cu->GetSymbolFileDWARF()->GetDIEToType();
+return GetBaseSymbolFile()->GetDIEToType();
 }
 
 SymbolFileDWARF::DIEToVariableSP&
 SymbolFileDWARFDwo::GetDIEToVariable()
 {
-return m_base_dwarf_cu->GetSymbolFileDWARF()->GetDIEToVariable();
+return GetBaseSymbolFile()->GetDIEToVariable();
 }
 
 SymbolFileDWARF::DIEToClangType&
 SymbolFileDWARFDwo::GetForwardDeclDieToClangType()
 {
-return m_base_dwarf_cu->GetSymbolFileDWARF()->GetForwardDeclDieToClangType();
+return GetBaseSymbolFile()->GetForwardDeclDieToClangType();
 }
 
 SymbolFileDWARF::ClangTypeToDIE&
 SymbolFileDWARFDwo::GetForwardDeclClangTypeToDie()
 {
-return m_base_dwarf_cu->GetSymbolFileDWARF()->GetForwardDeclClangTypeToDie();
+return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie();
+}
+
+lldb::TypeSP
+SymbolFileDWARFDwo::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext _decl_ctx)
+{
+return GetBaseSymbolFile()->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
+}
+
+SymbolFileDWARF*
+SymbolFileDWARFDwo::GetBaseSymbolFile()
+{
+return m_base_dwarf_cu->GetSymbolFileDWARF();
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -51,6 +51,12 @@
 ClangTypeToDIE&
 GetForwardDeclClangTypeToDie() override;
 
+lldb::TypeSP
+FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext _decl_ctx) override;
+
+SymbolFileDWARF*
+GetBaseSymbolFile();
+
 lldb::ObjectFileSP m_obj_file_sp;
 DWARFCompileUnit* m_base_dwarf_cu;
 };
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12849: Add support for DW_OP_GNU_const_index to dwarf expression

2015-09-15 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247672: Add support for DW_OP_GNU_const_index to dwarf 
expression (authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D12849?vs=34697=34794#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12849

Files:
  lldb/trunk/include/lldb/Expression/DWARFExpression.h
  lldb/trunk/source/Expression/DWARFExpression.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
  lldb/trunk/test/lang/c/const_variables/Makefile

Index: lldb/trunk/include/lldb/Expression/DWARFExpression.h
===
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h
@@ -442,7 +442,7 @@
 DataExtractor m_data;   ///< A data extractor capable of reading opcode bytes
 DWARFCompileUnit* m_dwarf_cu;   ///< The DWARF compile unit this expression belongs to. It is used
 ///< to evaluate values indexing into the .debug_addr section (e.g.
-///< DW_OP_GNU_addr_index
+///< DW_OP_GNU_addr_index, DW_OP_GNU_const_index)
 lldb::RegisterKind m_reg_kind;  ///< One of the defines that starts with LLDB_REGKIND_
 lldb::addr_t m_loclist_slide;   ///< A value used to slide the location list offsets so that 
 ///< they are relative to the object that owns the location list
Index: lldb/trunk/test/lang/c/const_variables/Makefile
===
--- lldb/trunk/test/lang/c/const_variables/Makefile
+++ lldb/trunk/test/lang/c/const_variables/Makefile
@@ -2,6 +2,6 @@
 
 C_SOURCES := main.c functions.c
 
-CFLAGS ?= -g -O3
+CFLAGS_EXTRAS += -O3
 
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
@@ -150,6 +150,7 @@
 case DW_OP_regx:
 size = 128; break;
 case DW_OP_GNU_addr_index:
+case DW_OP_GNU_const_index:
 size = 128; break;
 default:
 s.Printf("UNKNOWN ONE-OPERAND OPCODE, #%u", opcode);
Index: lldb/trunk/source/Expression/DWARFExpression.cpp
===
--- lldb/trunk/source/Expression/DWARFExpression.cpp
+++ lldb/trunk/source/Expression/DWARFExpression.cpp
@@ -199,6 +199,7 @@
 case 0x99: return "DW_OP_call4";
 case 0x9a: return "DW_OP_call_ref";
 case 0xfb: return "DW_OP_GNU_addr_index";
+case 0xfc: return "DW_OP_GNU_const_index";
 //case DW_OP_APPLE_array_ref: return "DW_OP_APPLE_array_ref";
 //case DW_OP_APPLE_extern: return "DW_OP_APPLE_extern";
 case DW_OP_APPLE_uninit: return "DW_OP_APPLE_uninit";
@@ -637,6 +638,9 @@
 case DW_OP_GNU_addr_index:  // 0xfb
 s->Printf("DW_OP_GNU_addr_index(0x%" PRIx64 ")", m_data.GetULEB128());
 break;
+case DW_OP_GNU_const_index: // 0xfc
+s->Printf("DW_OP_GNU_const_index(0x%" PRIx64 ")", m_data.GetULEB128());
+break;
 case DW_OP_GNU_push_tls_address:
 s->PutCString("DW_OP_GNU_push_tls_address");  // 0xe0
 break;
@@ -1040,9 +1044,10 @@
 case DW_OP_regx:// 0x90 1 ULEB128 register
 case DW_OP_fbreg:   // 0x91 1 SLEB128 offset
 case DW_OP_piece:   // 0x93 1 ULEB128 size of piece addressed
-case DW_OP_GNU_addr_index: // 0xfb 1 ULEB128 index
+case DW_OP_GNU_addr_index:  // 0xfb 1 ULEB128 index
+case DW_OP_GNU_const_index: // 0xfc 1 ULEB128 index
 data.Skip_LEB128(); 
-return offset - data_offset;   
+return offset - data_offset;
 
 // All opcodes that have a 2 ULEB (signed or unsigned) arguments
 case DW_OP_bregx:   // 0x92 2 ULEB128 register followed by SLEB128 offset
@@ -3022,7 +3027,7 @@
 if (!dwarf_cu)
 {
 if (error_ptr)
-error_ptr->SetErrorString ("DW_OP_GNU_addr_index found without a compile being specified");
+error_ptr->SetErrorString ("DW_OP_GNU_addr_index found without a compile unit being specified");
 return false;
 }
 uint64_t index = opcodes.GetULEB128();
@@ -3035,6 +3040,43 @@
 }
 break;
 
+

Re: [Lldb-commits] [PATCH] D12878: [lldb-mi] Clean up CMICmdArgSet usage.

2015-09-15 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm



Comment at: tools/lldb-mi/MICmdArgSet.cpp:92
@@ -91,3 +91,3 @@
 // Type:Method.
 // Args:vArg- (R) A command argument object.
 // Return:  None.

brucem wrote:
> Should this say something other than `(R)` here?
This comment is useless, and for me it looks like an attempt to write something 
to follow the coding style. FMPOV, we should remove all comments like that, and 
move others to corresponding .h files.


http://reviews.llvm.org/D12878



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


[Lldb-commits] [lldb] r247690 - Skip TestGoASTContext on remote targets as it it not remote compatible

2015-09-15 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Tue Sep 15 09:04:52 2015
New Revision: 247690

URL: http://llvm.org/viewvc/llvm-project?rev=247690=rev
Log:
Skip TestGoASTContext on remote targets as it it not remote compatible

Modified:
lldb/trunk/test/lang/go/types/TestGoASTContext.py

Modified: lldb/trunk/test/lang/go/types/TestGoASTContext.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/go/types/TestGoASTContext.py?rev=247690=247689=247690=diff
==
--- lldb/trunk/test/lang/go/types/TestGoASTContext.py (original)
+++ lldb/trunk/test/lang/go/types/TestGoASTContext.py Tue Sep 15 09:04:52 2015
@@ -11,6 +11,7 @@ class TestGoASTContext(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @python_api_test
+@skipIfRemote # Not remote test suit ready
 @skipUnlessGoInstalled
 def test_with_dsym_and_python_api(self):
 """Test GoASTContext dwarf parsing."""


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


[Lldb-commits] [PATCH] D12880: Add support for the DWARFLocationList used by split-dwarf

2015-09-15 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.

Add support for the DWARFLocationList used by split-dwarf

Split-dwarf uses a different header format to specify the address range for the 
elements of the location lists.

http://reviews.llvm.org/D12880

Files:
  include/lldb/Expression/DWARFExpression.h
  lldb.xcodeproj/project.pbxproj
  source/Expression/DWARFExpression.cpp
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
  source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.h
  source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
  source/Plugins/SymbolFile/DWARF/DWARFLocationList.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -38,6 +38,9 @@
 DWARFCompileUnit*
 GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) override;
 
+lldb_private::DWARFExpression::LocationListFormat
+GetLocationListFormat() const override;
+
 protected:
 DIEToTypePtr&
 GetDIEToType() override;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -10,6 +10,7 @@
 #include "SymbolFileDWARFDwo.h"
 
 #include "lldb/Core/Section.h"
+#include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/ObjectFile.h"
 
 #include "DWARFCompileUnit.h"
@@ -118,3 +119,9 @@
 {
 return m_base_dwarf_cu->GetSymbolFileDWARF();
 }
+
+DWARFExpression::LocationListFormat
+SymbolFileDWARFDwo::GetLocationListFormat() const
+{
+return DWARFExpression::SplitDwarfLocationList;
+}
\ No newline at end of file
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -29,6 +29,7 @@
 #include "lldb/Core/Flags.h"
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Core/UniqueCStringMap.h"
+#include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/SymbolContext.h"
@@ -316,6 +317,9 @@
 virtual lldb::CompUnitSP
 ParseCompileUnit (DWARFCompileUnit* dwarf_cu, uint32_t cu_idx);
 
+virtual lldb_private::DWARFExpression::LocationListFormat
+GetLocationListFormat() const;
+
 protected:
 typedef llvm::DenseMap DIEToTypePtr;
 typedef llvm::DenseMap DIEToVariableSP;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -70,7 +70,6 @@
 #include "DWARFDeclContext.h"
 #include "DWARFDIECollection.h"
 #include "DWARFFormValue.h"
-#include "DWARFLocationList.h"
 #include "LogChannelDWARF.h"
 #include "SymbolFileDWARFDwo.h"
 #include "SymbolFileDWARFDebugMap.h"
@@ -3849,10 +3848,10 @@
 }
 else
 {
-const DWARFDataExtractor&debug_loc_data = get_debug_loc_data();
+const DWARFDataExtractor& debug_loc_data = get_debug_loc_data();
 const dw_offset_t debug_loc_offset = form_value.Unsigned();
 
-size_t loc_list_length = DWARFLocationList::Size(debug_loc_data, debug_loc_offset);
+size_t loc_list_length = DWARFExpression::LocationListSize(die.GetCU(), debug_loc_data, debug_loc_offset);
 if (loc_list_length > 0)
 {
 location.CopyOpcodeData(module, debug_loc_data, debug_loc_offset, loc_list_length);
@@ -4307,3 +4306,9 @@
 }
 return m_debug_map_symfile;
 }
+
+DWARFExpression::LocationListFormat
+SymbolFileDWARF::GetLocationListFormat() const
+{
+return DWARFExpression::RegularLocationList;
+}
Index: source/Plugins/SymbolFile/DWARF/DWARFLocationList.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFLocationList.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===-- DWARFLocationList.h -*- C++ -*-===//
-//