Re: [Lldb-commits] [PATCH] D12356: [MIPS64] Emulate MSA branch instructions

2015-08-27 Thread Sagar Thakur via lldb-commits
sagar updated this revision to Diff 33323.
sagar added a comment.

Addressed review comments


Repository:
  rL LLVM

http://reviews.llvm.org/D12356

Files:
  source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h

Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
===
--- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
+++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
@@ -302,6 +302,42 @@
 Emulate_BC1ANY4T  (llvm::MCInst& insn);
 
 bool
+Emulate_BNZB  (llvm::MCInst& insn);
+
+bool
+Emulate_BNZH  (llvm::MCInst& insn);
+
+bool
+Emulate_BNZW  (llvm::MCInst& insn);
+
+bool
+Emulate_BNZD  (llvm::MCInst& insn);
+
+bool
+Emulate_BZB  (llvm::MCInst& insn);
+
+bool
+Emulate_BZH  (llvm::MCInst& insn);
+
+bool
+Emulate_BZW  (llvm::MCInst& insn);
+
+bool
+Emulate_BZD  (llvm::MCInst& insn);
+
+bool
+Emulate_MSA_Branch_DF (llvm::MCInst& insn, int element_byte_size, bool bnz);
+
+bool
+Emulate_BNZV  (llvm::MCInst& insn);
+
+bool
+Emulate_BZV  (llvm::MCInst& insn);
+
+bool
+Emulate_MSA_Branch_V (llvm::MCInst& insn, bool bnz);
+
+bool
 nonvolatile_reg_p (uint64_t regnum);
 
 const char *
Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
===
--- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
+++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
@@ -256,6 +256,41 @@
 case gcc_dwarf_f29_mips64: return "f29";
 case gcc_dwarf_f30_mips64: return "f30";
 case gcc_dwarf_f31_mips64: return "f31";
+case gcc_dwarf_w0_mips64:  return "w0";
+case gcc_dwarf_w1_mips64:  return "w1";
+case gcc_dwarf_w2_mips64:  return "w2";
+case gcc_dwarf_w3_mips64:  return "w3";
+case gcc_dwarf_w4_mips64:  return "w4";
+case gcc_dwarf_w5_mips64:  return "w5";
+case gcc_dwarf_w6_mips64:  return "w6";
+case gcc_dwarf_w7_mips64:  return "w7";
+case gcc_dwarf_w8_mips64:  return "w8";
+case gcc_dwarf_w9_mips64:  return "w9";
+case gcc_dwarf_w10_mips64: return "w10";
+case gcc_dwarf_w11_mips64: return "w11";
+case gcc_dwarf_w12_mips64: return "w12";
+case gcc_dwarf_w13_mips64: return "w13";
+case gcc_dwarf_w14_mips64: return "w14";
+case gcc_dwarf_w15_mips64: return "w15";
+case gcc_dwarf_w16_mips64: return "w16";
+case gcc_dwarf_w17_mips64: return "w17";
+case gcc_dwarf_w18_mips64: return "w18";
+case gcc_dwarf_w19_mips64: return "w19";
+case gcc_dwarf_w20_mips64: return "w20";
+case gcc_dwarf_w21_mips64: return "w21";
+case gcc_dwarf_w22_mips64: return "w22";
+case gcc_dwarf_w23_mips64: return "w23";
+case gcc_dwarf_w24_mips64: return "w24";
+case gcc_dwarf_w25_mips64: return "w25";
+case gcc_dwarf_w26_mips64: return "w26";
+case gcc_dwarf_w27_mips64: return "w27";
+case gcc_dwarf_w28_mips64: return "w28";
+case gcc_dwarf_w29_mips64: return "w29";
+case gcc_dwarf_w30_mips64: return "w30";
+case gcc_dwarf_w31_mips64: return "w31";
+case gcc_dwarf_mir_mips64: return "mir";
+case gcc_dwarf_mcsr_mips64: return "mcsr";
+case gcc_dwarf_config5_mips64: return "config5";
 default:
 break;
 }
@@ -336,6 +371,41 @@
 case gcc_dwarf_f31_mips64:  return "f31";
 case gcc_dwarf_fcsr_mips64: return "fcsr";
 case gcc_dwarf_fir_mips64:  return "fir";
+case gcc_dwarf_w0_mips64:   return "w0";
+case gcc_dwarf_w1_mips64:   return "w1";
+case gcc_dwarf_w2_mips64:   return "w2";
+case gcc_dwarf_w3_mips64:   return "w3";
+case gcc_dwarf_w4_mips64:   return "w4";
+case gcc_dwarf_w5_mips64:   return "w5";
+case gcc_dwarf_w6_mips64:   return "w6";
+case gcc_dwarf_w7_mips64:   return "w7";
+case gcc_dwarf_w8_mips64:   return "w8";
+case gcc_dwarf_w9_mips64:   return "w9";
+case gcc_dwarf_w10_mips64:  return "w10";
+case gcc_dwarf_w11_mips64:  return "w11";
+case gcc_dwarf_w12_mips64:  return "w12";
+case gcc_dwarf_w13_mips64:  return "w13";
+case gcc_dwarf_w14_mips64:  return "w14";
+case gcc_dwarf_w15_mips64:  return "w15";
+case gcc_dwarf_w16_mips64:  return "w16";
+case gcc_dwarf_w17_mips64:  return "w17";
+case gcc_dwarf_w18_mips64:  return "

Re: [Lldb-commits] [PATCH] D12356: [MIPS64] Emulate MSA branch instructions

2015-08-27 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

I don't know too much about mips so I haven't checked if the emulation is 
actually correct but the general concept looks good to me. I added a few 
comments inline but they are mostly suggestions what you might want to consider.



Comment at: 
source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:553-562
@@ -476,2 +552,12 @@
 { "BC1ANY4T",   &EmulateInstructionMIPS64::Emulate_BC1ANY4T,
"BC1ANY4T cc, offset"   },
+{ "BNZ_B", &EmulateInstructionMIPS64::Emulate_BNZB,"BNZ.b 
wt,s16" },
+{ "BNZ_H", &EmulateInstructionMIPS64::Emulate_BNZH,"BNZ.h 
wt,s16" },
+{ "BNZ_W", &EmulateInstructionMIPS64::Emulate_BNZW,"BNZ.w 
wt,s16" },
+{ "BNZ_D", &EmulateInstructionMIPS64::Emulate_BNZD,"BNZ.d 
wt,s16" },
+{ "BZ_B",  &EmulateInstructionMIPS64::Emulate_BZB, "BZ.b 
wt,s16"  },
+{ "BZ_H",  &EmulateInstructionMIPS64::Emulate_BZH, "BZ.h 
wt,s16"  },
+{ "BZ_W",  &EmulateInstructionMIPS64::Emulate_BZW, "BZ.w 
wt,s16"  },
+{ "BZ_D",  &EmulateInstructionMIPS64::Emulate_BZD, "BZ.d 
wt,s16"  },
+{ "BNZ_V", &EmulateInstructionMIPS64::Emulate_BNZV,"BNZ.V 
wt,s16"  },
+{ "BZ_V",  &EmulateInstructionMIPS64::Emulate_BZV, "BZ.V 
wt,s16"   },
 };

(nit): Indentation


Comment at: 
source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3138-3140
@@ +3137,5 @@
+bool success = false, branch_hit = true;
+uint32_t wt;
+int64_t offset, pc, target;
+RegisterValue reg_value;
+uint8_t * ptr = NULL;

Please initialize these variables


Comment at: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3160
@@ +3159,3 @@
+case 1:
+if((*ptr == 0 && bnz) || (*ptr != 0 && !bnz) )
+branch_hit = false;

You can possibly write it in the following way, but I am not sure which one is 
the cleaner:

```
if((*ptr == 0) == bnz)
break;
```


Comment at: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3187
@@ +3186,3 @@
+Context context;
+context.type = eContextInvalid;
+

Using eContextInvalid as context type is fine for single stepping but if you 
want these instructions to be handled correctly during emulation based stack 
unwinding then you have to use eContextAbsoluteBranchRegister or 
eContextRelativeBranchImmediate with the correct data (it is used by the branch 
following code in the unwinder)


Comment at: 
source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3211-3213
@@ +3210,5 @@
+bool success = false;
+uint32_t wt;
+int64_t offset, pc, target;
+llvm::APInt wr_val;
+llvm::APInt fail_value = llvm::APInt::getMaxValue(128);

Please initialize these variables


Comment at: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3230
@@ +3229,3 @@
+
+if((llvm::APInt::isSameValue(zero_value, wr_val) && !bnz) || 
(!llvm::APInt::isSameValue(zero_value, wr_val) && bnz))
+target = pc + offset;

You can possibly write it in the following way, but I am not sure which one is 
the cleaner:

```
if(llvm::APInt::isSameValue(zero_value, wr_val) != bnz)
...
```


Comment at: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp:3236
@@ +3235,3 @@
+Context context;
+context.type = eContextInvalid;
+

Using eContextInvalid as context type is fine for single stepping but if you 
want these instructions to be handled correctly during emulation based stack 
unwinding then you have to use eContextAbsoluteBranchRegister or 
eContextRelativeBranchImmediate with the correct data (it is used by the branch 
following code in the unwinder)


Repository:
  rL LLVM

http://reviews.llvm.org/D12356



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


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Zachary Turner via lldb-commits
This is definitely going to be a serious problem once I integrate our PDB
support for Windows

On Wed, Aug 26, 2015 at 9:09 PM Dawn Perchik via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> dawn added a subscriber: dawn.
> dawn added a comment.
>
> Hi Greg,
>
> While I really appreciate that you're making lldb less Clang specific
> (e.g. renaming ClangASTType to CompilerType), I'm concerned about this
> commit because it moves DWARF knowledge from the SymbolFileDWARF plugin
> into ClangASTContext.cpp, making it impossible to support other debug
> formats as plugins.
>
> I realize some DWARF had leaked outside of the DWARF plugin before this
> commit (like the enums for language and calling convention), but those
> could easily be converted to/from other debug formats.  This new code
> really requires that the debug info be DWARF.
>
> Am I missing something?
> Thanks in advance, -Dawn
>
>
> http://reviews.llvm.org/rL245090
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Zachary Turner via lldb-commits
zturner added a subscriber: zturner.
zturner added a comment.

This is definitely going to be a serious problem once I integrate our PDB
support for Windows


http://reviews.llvm.org/rL245090



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


[Lldb-commits] [lldb] r246172 - More cleanup to make sure no one plays with DWARFDebugInfoEntry. Clients outside of DWARFDebugInfoEntry of DWARFCompileUnit should use DWARFDIE only.

2015-08-27 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Aug 27 13:09:44 2015
New Revision: 246172

URL: http://llvm.org/viewvc/llvm-project?rev=246172&view=rev
Log:
More cleanup to make sure no one plays with DWARFDebugInfoEntry. Clients 
outside of DWARFDebugInfoEntry of DWARFCompileUnit should use DWARFDIE only.


Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=246172&r1=246171&r2=246172&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Aug 27 13:09:44 2015
@@ -35,6 +35,7 @@
 
 
 // Forward definitions for DWARF plug-in for type parsing
+class DWARFDebugInfoEntry;
 class DWARFDIE;
 class DWARFDIECollection;
 
@@ -1198,14 +1199,7 @@ protected:
 DWARFDIECollection &failures);
 
 clang::DeclContext *
-GetCachedClangDeclContextForDIE (const DWARFDebugInfoEntry *die)
-{
-DIEToDeclContextMap::iterator pos = m_die_to_decl_ctx.find(die);
-if (pos != m_die_to_decl_ctx.end())
-return pos->second;
-else
-return NULL;
-}
+GetCachedClangDeclContextForDIE (const DWARFDIE &die);
 
 void
 LinkDeclContextToDIE (clang::DeclContext *decl_ctx,

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=246172&r1=246171&r2=246172&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu Aug 27 13:09:44 2015
@@ -19,7 +19,6 @@
 #include "clang/AST/Type.h"
 
 class DWARFDIE;
-class DWARFDebugInfoEntry;
 
 namespace lldb_private {
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=246172&r1=246171&r2=246172&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Thu Aug 27 
13:09:44 2015
@@ -396,7 +396,7 @@ DWARFCompileUnit::BuildAddressRangeTable
 size_t num_debug_aranges = debug_aranges->GetNumRanges();
 
 // First get the compile unit DIE only and check if it has a DW_AT_ranges
-const DWARFDebugInfoEntry* die = GetCompileUnitDIEOnly();
+const DWARFDebugInfoEntry* die = GetCompileUnitDIEPtrOnly();
 
 const dw_offset_t cu_offset = GetOffset();
 if (die)
@@ -996,7 +996,7 @@ DWARFCompileUnit::ParseProducerInfo ()
 m_producer_version_minor = UINT32_MAX;
 m_producer_version_update = UINT32_MAX;
 
-const DWARFDebugInfoEntry *die = GetCompileUnitDIEOnly();
+const DWARFDebugInfoEntry *die = GetCompileUnitDIEPtrOnly();
 if (die)
 {
 
@@ -1087,7 +1087,7 @@ DWARFCompileUnit::GetLanguageType()
 if (m_language_type != eLanguageTypeUnknown)
 return m_language_type;
 
-const DWARFDebugInfoEntry *die = GetCompileUnitDIEOnly();
+const DWARFDebugInfoEntry *die = GetCompileUnitDIEPtrOnly();
 if (die)
 m_language_type = 
LanguageTypeFromDWARF(die->GetAttributeValueAsUnsigned(m_dwarf2Data, this, 
DW_AT_language, 0));
 return m_language_type;
@@ -1104,7 +1104,7 @@ DWARFCompileUnit::GetIsOptimized ()
 {
 if (m_is_optimized == eLazyBoolCalculate)
 {
-const DWARFDebugInfoEntry *die = GetCompileUnitDIEOnly();
+const DWARFDebugInfoEntry *die = GetCompileUnitDIEPtrOnly();
 if (die)
 {
 m_is_optimized = eLazyBoolNo;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUn

[Lldb-commits] [lldb] r246177 - Remove class Language - the only thing it was actually being used for is provided by LanguageRuntime already

2015-08-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Aug 27 13:18:49 2015
New Revision: 246177

URL: http://llvm.org/viewvc/llvm-project?rev=246177&view=rev
Log:
Remove class Language - the only thing it was actually being used for is 
provided by LanguageRuntime already


Removed:
lldb/trunk/include/lldb/Core/Language.h
lldb/trunk/source/Core/Language.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Commands/CommandObjectArgs.h
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Symbol/CompileUnit.cpp

Removed: lldb/trunk/include/lldb/Core/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Language.h?rev=246176&view=auto
==
--- lldb/trunk/include/lldb/Core/Language.h (original)
+++ lldb/trunk/include/lldb/Core/Language.h (removed)
@@ -1,117 +0,0 @@
-//===-- Language.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_Language_h_
-#define liblldb_Language_h_
-
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-//--
-/// @class Language Language.h "lldb/Core/Language.h"
-/// @brief Encapsulates the programming language for an lldb object.
-///
-/// Languages are represented by an enumeration value.
-///
-/// The enumeration values used when describing the programming language
-/// are the same values as the latest DWARF specification.
-//--
-class Language
-{
-public:
-//--
-/// Construct with optional language enumeration.
-//--
-Language(lldb::LanguageType language = lldb::eLanguageTypeUnknown);
-
-//--
-/// Destructor.
-///
-/// The destructor is virtual in case this class is subclassed.
-//--
-virtual
-~Language();
-
-//--
-/// Get the language value as a NULL termianted C string.
-///
-/// @return
-/// The C string representation of the language. The returned
-/// string does not need to be freed as it comes from constant
-/// strings. NULL can be returned when the language is set to
-/// a value that doesn't match of of the lldb::LanguageType
-/// enumerations.
-//--
-const char *
-AsCString (lldb::DescriptionLevel level = lldb::eDescriptionLevelBrief) 
const;
-
-void
-Clear();
-
-void
-GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-
-//--
-/// Dump the language value to the stream \a s.
-///
-/// @param[in] s
-/// The stream to which to dump the language description.
-//--
-void
-Dump(Stream *s) const;
-
-//--
-/// Get accessor for the language.
-///
-/// @return
-/// The enumeration value that describes the programming
-/// language that an object is associated with.
-//--
-virtual lldb::LanguageType
-GetLanguage() const;
-
-//--
-/// Set accessor for the language.
-///
-/// @param[in] language
-/// The new enumeration value that describes the programming
-/// language that an object is associated with.
-//--
-void
-SetLanguage(lldb::LanguageType language);
-
-//--
-/// Set accessor for the language.
-///
-/// @param[in] language_cstr
-/// The language name as a C string.
-//--
-bool
-SetLanguageFromCString(const char *language_cstr);
-
-
-protected:
-//--
-// Member variables
-//--
-lldb::LanguageType m_language; ///< The programming language enumeration 
value.
-

Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Greg Clayton via lldb-commits

> On Aug 26, 2015, at 9:08 PM, Dawn Perchik via lldb-commits 
>  wrote:
> 
> dawn added a subscriber: dawn.
> dawn added a comment.
> 
> Hi Greg,
> 
> While I really appreciate that you're making lldb less Clang specific (e.g. 
> renaming ClangASTType to CompilerType), I'm concerned about this commit 
> because it moves DWARF knowledge from the SymbolFileDWARF plugin into 
> ClangASTContext.cpp, making it impossible to support other debug formats as 
> plugins.

Impossible? Why is it impossible? This is the way DWARF is able to abstract AST 
specific type creation from raw DWARF info. Any other type system could create 
their own types. If you have a pascal::ASTContext that has all of its own 
types, it should be able to create types correctly in pascal::ASTContext using 
DWARF. It should also be able to do this without littering the SymbolFileDWARF 
code with:

#include "clang/..."
#include "clang/..."
#include "clang/..."
#include "clang/..."
#include "clang/..."

#include "swift/..."
#include "swift/..."
#include "swift/..."
#include "swift/..."
#include "swift/..."

#include "pascal/..."
#include "pascal/..."
#include "pascal/..."
#include "pascal/..."
#include "pascal/..."

void
SymbolFileDWARF::DoSomething()
{
if (IsClang())
{
clang::ASTContext 
}
else if (IsPascal())
{
pascal::ASTContext 
}
else if (IsSwift())
{
swift::ASTContext 
}
}

This is wrong. SymbolFileDWARF implements a way to explore raw DWARF and it 
isn't be tied to a language or AST context format. It should defer that to a 
language specific type system, or in our case a lldb_private::TypeSystem 
subclass.

ClangASTContext inherits from lldb_private::TypeSystem. The DWARF can then get 
the correct type system from the compile unit language and have the type system 
parse the types into their native AST type format. We support both clang and 
Swift internally at Apple and I can't tell you how many headaches there have 
been merging the DWARF code when this wasn't the case. The code used to look 
like the example show above. Now it looks like:

Type *
SymbolFileDWARF::ParseType(const DWARFDIE &die)
{
TypeSystem *type_system = die.GetTypeSystem();
if (type_system)
return type_system->ParseType (die);
return nullptr;
}

All clang includes are gone from the DWARF parser. Same for Swift. 

Yes there is DWARF specific type parsing going on in ClangASTContext, but now 
any type system (language like c lanaguages, swift, others) can convert DWARF 
into types for their own language.

When the PDB support is added, you will need to make a way to convert the PDB 
stuff into Clang specific types as well. All these changes do are allow the 
different languages and their different AST classes to cleanly create types 
from pure DWARF.

> 
> I realize some DWARF had leaked outside of the DWARF plugin before this 
> commit (like the enums for language and calling convention), but those could 
> easily be converted to/from other debug formats.  This new code really 
> requires that the debug info be DWARF.

I didn't want to spend the time to make an agnostic form of debug info that 
each SymbolFile would need to create in order to represent types so that 
TypeSystem subclasses could consume those to create types. Why? Performance. 
DWARF reading is already a bottleneck and adding any more conversion layers in 
between will only slow down type parsing. This new code _is_ for DWARF, so yes, 
it does require DWARF. There are 5 function added for DWARF parsing to 
lldb_private::TypeSystem:

class TypeSystem
{
virtual lldb::TypeSP
ParseTypeFromDWARF (const SymbolContext& sc,
const DWARFDIE &die,
Log *log,
bool *type_is_new_ptr);

virtual Function *
ParseFunctionFromDWARF (const SymbolContext& sc,
const DWARFDIE &die);

virtual bool
CompleteTypeFromDWARF (const DWARFDIE &die,
   lldb_private::Type *type,
   CompilerType &clang_type);

virtual CompilerDeclContext
GetDeclContextForUIDFromDWARF (const DWARFDIE &die);

virtual CompilerDeclContext
GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die);
}


These functions could be abstracted into a class like ASTParserDWARF:

class ASTParserDWARF
{
virtual lldb::TypeSP
ParseType (const SymbolContext& sc,
   const DWARFDIE &die) = 0;

virtual Function *
ParseFunction (const SymbolContext& sc,
   const DWARFDIE &die) = 0;

virtual bool
CompleteType (const DWARFDIE &die,
  lldb_private::Type *type,
  CompilerType &clang_type) = 0;

virtual CompilerDeclContext
GetDeclContextForUID (const DWARFDIE &die) = 0;

virtual CompilerDeclContext
GetDeclContextContainingUID (const DWARFDIE &die) = 0;

};

And then TypeSystem could ask for the DWARF par

Re: [Lldb-commits] [PATCH] D12304: Add scope tree for variable searching

2015-08-27 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 33345.
paulherman added a comment.

Add scope tree for variable searching


http://reviews.llvm.org/D12304

Files:
  include/lldb/Symbol/Block.h
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/Function.h
  include/lldb/Symbol/Symbol.h
  include/lldb/Symbol/SymbolContextScope.h
  include/lldb/Symbol/VariableTree.h
  include/lldb/lldb-forward.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/Block.cpp
  source/Symbol/CMakeLists.txt
  source/Symbol/CompileUnit.cpp
  source/Symbol/Function.cpp
  source/Symbol/Symbol.cpp
  source/Symbol/VariableTree.cpp
  source/Target/StackFrame.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,32 @@
 }
 }
 
-using namespace N;
-using namespace Nested;
+namespace Global
+{
+int global;
+}
+
+namespace Fun
+{
+int fun_var;
+int fun()
+{
+fun_var = 5;
+return 0; // break 1
+}
+}
+
+using namespace Global;
+
+int fun_var = 9;
 
 int main()
 {
+using namespace N;
+using namespace Nested;
 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
@@ -45,6 +45,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 +74,26 @@
 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")
+
+# 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/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -25,6 +25,7 @@
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContextScope.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Symbol/VariableTree.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -606,7 +607,6 @@
 return var_list_sp;
 }
 
-
 ValueObjectSP
 StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
DynamicValueType use_dynamic,
@@ -628,13 +628,18 @@
 bool deref = false;
 bool address_of = false;
 ValueObjectSP valobj_sp;
-const bool get_file_globals = true;
 // When looking up a variable for an expression, we need only consider the
 // variables that are in scope.
-VariableListSP var_list_sp (GetInScopeVariableList (get_file_globals));
-VariableList *variable_list = var_list_sp.get();
 
-if (variable_list)
+VariableTreeSP vars;
+if (m_sc.block)
+vars = m_sc.block->GetVariables();
+else if (m_sc.function)
+vars = m_sc.function->GetVariables();
+else if (m_sc.comp_unit)
+vars = m_sc.comp_unit->GetVariables();
+
+if (vars)
 {
 // If first character is a '*', then show pointer contents
 const char *var_expr = var_expr_cstr;
@@ -659,7 +664,7 @@
 else
 name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
 
-

Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Dawn Perchik via lldb-commits
dawn raised a concern with this commit.
dawn added a comment.

Our Delphi compiler generates an alternate debug format as well - it took me 
all of yesterday to fix merge conflicts and I've still not got things working 
properly.  Greg, can you please move the DWARF dependencies back into the 
SymbolFileDWARF plugin?  Thanks!


Users:
  dawn (Auditor)

http://reviews.llvm.org/rL245090



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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Dawn Perchik via lldb-commits
dawn added a comment.

Hi guys, I'd still really like to get this into tot.  May I commit it please?


http://reviews.llvm.org/D11102



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


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Greg Clayton via lldb-commits
> 
> Our Delphi compiler generates an alternate debug format as well - it took me 
> all of yesterday to fix merge conflicts and I've still not got things working 
> properly.  Greg, can you please move the DWARF dependencies back into the 
> SymbolFileDWARF plugin?  Thanks!

Sorry to not be clear on this: thing are correctly organized and won't be 
changing.

You will need to merge your stuff correctly into the current world.

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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Please wait for the OK from Jim and Sean.


http://reviews.llvm.org/D11102



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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Greg Clayton via lldb-commits
clayborg added a subscriber: clayborg.
clayborg accepted this revision.
clayborg added a reviewer: clayborg.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks fine as long as the test suite tests are passing.


http://reviews.llvm.org/D11102



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


Re: [Lldb-commits] [PATCH] D12304: Add scope tree for variable searching

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

This seems to be very variable specific.

I would like to see if be able to ask a lldb_private::Block or a 
lldb_private::Compile and to provide a list of CompilerDeclContext objects that 
can be then searched by the expression parser in FindExternalVisibleDecls by 
searching these decl contexts starting with the block and each block's parent 
and then checking the compile unit. Then we don't need any variable trees as we 
can currently request thing (functions, globals, and other things) that have a 
specific CompilerDeclContext as their parents.

Basically if we implement this, I would rather not see it just be for 
variables. I want functions, variables, and more to work as expected.


http://reviews.llvm.org/D12304



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


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread via lldb-commits
On Thu, Aug 27, 2015 at 12:56:57PM -0700, Greg Clayton via lldb-commits wrote:
> > 
> > Our Delphi compiler generates an alternate debug format as well - it took 
> > me all of yesterday to fix merge conflicts and I've still not got things 
> > working properly.  Greg, can you please move the DWARF dependencies back 
> > into the SymbolFileDWARF plugin?  Thanks!
> 
> Sorry to not be clear on this: thing are correctly organized and won't be 
> changing.
> 
> You will need to merge your stuff correctly into the current world.

The issue is that you have added DWARF to ClangASTContext.  How is
another debug format plugin supposed to work in ClangASTContext now?

The design had been that support for debug formats goes in plugins
inside source/Plugins/SymbolFile.  This was a clean interface that
allowed support for other debug formats to exist by installing their
plugin.  Now main lldb code is polluted with DWARF code which depends on
a plugin.

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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread via lldb-commits
On Thu, Aug 27, 2015 at 07:58:50PM +, Greg Clayton wrote:
> clayborg added a comment.
> 
> Please wait for the OK from Jim and Sean.

I've been waiting for 1.5 months already.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Zachary Turner via lldb-commits
If I'm following this discussion correctly, Greg are you saying that
ClangASTContext could be renamed to DwarfASTContext?  And that for other
types of Debug info we could have PascalASTContext and PdbASTContext?

If that's the case, then it seems there is a lot of code inside of
ClangASTContext (aka DwarfASTContext) which is not specific to DWARF, and
there's no reason that other ASTContext classes shouldn't be able to reuse
it.

On Thu, Aug 27, 2015 at 2:08 PM via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> On Thu, Aug 27, 2015 at 12:56:57PM -0700, Greg Clayton via lldb-commits
> wrote:
> > >
> > > Our Delphi compiler generates an alternate debug format as well - it
> took me all of yesterday to fix merge conflicts and I've still not got
> things working properly.  Greg, can you please move the DWARF dependencies
> back into the SymbolFileDWARF plugin?  Thanks!
> >
> > Sorry to not be clear on this: thing are correctly organized and won't
> be changing.
> >
> > You will need to merge your stuff correctly into the current world.
>
> The issue is that you have added DWARF to ClangASTContext.  How is
> another debug format plugin supposed to work in ClangASTContext now?
>
> The design had been that support for debug formats goes in plugins
> inside source/Plugins/SymbolFile.  This was a clean interface that
> allowed support for other debug formats to exist by installing their
> plugin.  Now main lldb code is polluted with DWARF code which depends on
> a plugin.
>
> Thanks,
> -Dawn
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread via lldb-commits
On Thu, Aug 27, 2015 at 09:12:06PM +, Zachary Turner wrote:
> If I'm following this discussion correctly, Greg are you saying that
> ClangASTContext could be renamed to DwarfASTContext?  And that for other
> types of Debug info we could have PascalASTContext and PdbASTContext?
> 
> If that's the case, then it seems there is a lot of code inside of
> ClangASTContext (aka DwarfASTContext) which is not specific to DWARF, and
> there's no reason that other ASTContext classes shouldn't be able to reuse
> it.

Renaming and reusing the ClangASTContext code would help but it's not
enough - the DWARF code belongs in the DWARF plugin.  Plugins should be
just that - pluggable!  :)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Zachary Turner via lldb-commits
What I'm getting at is that, assuming my understanding is correct,
something like an adapter could be created that each plugin could
implement.  Say you've got a DebugInfoAdapter interface with
DebugInfoDwarf, etc implementations.  Then ClangASTContext could just use
this.

On Thu, Aug 27, 2015 at 2:18 PM  wrote:

> On Thu, Aug 27, 2015 at 09:12:06PM +, Zachary Turner wrote:
> > If I'm following this discussion correctly, Greg are you saying that
> > ClangASTContext could be renamed to DwarfASTContext?  And that for other
> > types of Debug info we could have PascalASTContext and PdbASTContext?
> >
> > If that's the case, then it seems there is a lot of code inside of
> > ClangASTContext (aka DwarfASTContext) which is not specific to DWARF, and
> > there's no reason that other ASTContext classes shouldn't be able to
> reuse
> > it.
>
> Renaming and reusing the ClangASTContext code would help but it's not
> enough - the DWARF code belongs in the DWARF plugin.  Plugins should be
> just that - pluggable!  :)
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r246212 - Add a new type of plugin: Language plugin

2015-08-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Aug 27 16:33:50 2015
New Revision: 246212

URL: http://llvm.org/viewvc/llvm-project?rev=246212&view=rev
Log:
Add a new type of plugin: Language plugin

The Language plugin is menat to answer language-specific questions that are not 
bound to the existence of a process. Those are still the domain of the 
LanguageRuntime plugin

The Language plugin will, instead, answer questions such as providing 
language-specific data formatters or expression evaluation

At the moment, the interface is hollowed out, and empty do-nothing plugins have 
been setup for ObjC, C++ and ObjC++


Added:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Plugins/Language/
lldb/trunk/source/Plugins/Language/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
lldb/trunk/source/Plugins/Language/ObjC/
lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h
lldb/trunk/source/Plugins/Language/ObjCPlusPlus/
lldb/trunk/source/Plugins/Language/ObjCPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
lldb/trunk/source/Target/Language.cpp
Modified:
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/DataFormatters/FormatCache.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Plugins/CMakeLists.txt

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=246212&r1=246211&r2=246212&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Aug 27 16:33:50 2015
@@ -132,6 +132,23 @@ public:
 GetOperatingSystemCreateCallbackForPluginName (const ConstString &name);
 
 //--
+// Language
+//--
+static bool
+RegisterPlugin (const ConstString &name,
+const char *description,
+LanguageCreateInstance create_callback);
+
+static bool
+UnregisterPlugin (LanguageCreateInstance create_callback);
+
+static LanguageCreateInstance
+GetLanguageCreateCallbackAtIndex (uint32_t idx);
+
+static LanguageCreateInstance
+GetLanguageCreateCallbackForPluginName (const ConstString &name);
+
+//--
 // LanguageRuntime
 //--
 static bool

Modified: lldb/trunk/include/lldb/DataFormatters/FormatCache.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatCache.h?rev=246212&r1=246211&r2=246212&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormatCache.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatCache.h Thu Aug 27 16:33:50 
2015
@@ -19,7 +19,6 @@
 #include "lldb/lldb-public.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Host/Mutex.h"
-#include "lldb/DataFormatters/FormatClasses.h"
 
 namespace lldb_private {
 class FormatCache

Added: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=246212&view=auto
==
--- lldb/trunk/include/lldb/Target/Language.h (added)
+++ lldb/trunk/include/lldb/Target/Language.h Thu Aug 27 16:33:50 2015
@@ -0,0 +1,55 @@
+//===-- Language.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_Language_h_
+#define liblldb_Language_h_
+
+// C Includes
+// C++ Includes
+#include 
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class Language :
+public PluginInterface
+{
+public:
+
+~Languag

[Lldb-commits] [lldb] r246216 - Added a missing file to the CMakeLists

2015-08-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Aug 27 16:45:59 2015
New Revision: 246216

URL: http://llvm.org/viewvc/llvm-project?rev=246216&view=rev
Log:
Added a missing file to the CMakeLists

Modified:
lldb/trunk/source/Target/CMakeLists.txt

Modified: lldb/trunk/source/Target/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/CMakeLists.txt?rev=246216&r1=246215&r2=246216&view=diff
==
--- lldb/trunk/source/Target/CMakeLists.txt (original)
+++ lldb/trunk/source/Target/CMakeLists.txt Thu Aug 27 16:45:59 2015
@@ -11,6 +11,7 @@ add_lldb_library(lldbTarget
   JITLoaderList.cpp
   InstrumentationRuntime.cpp
   InstrumentationRuntimeStopInfo.cpp
+  Language.cpp
   LanguageRuntime.cpp
   Memory.cpp
   MemoryHistory.cpp


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


Re: [Lldb-commits] [PATCH] D12363: Read module list from mini dump

2015-08-27 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp:57-63
@@ +56,9 @@
+const auto length_required =
+::WideCharToMultiByte(CP_UTF8, 0, md_string->Buffer, md_string->Length,
+  nullptr, 0, nullptr, nullptr);
+result.resize(length_required);
+const auto actual_length =
+::WideCharToMultiByte(CP_UTF8, 0, md_string->Buffer, md_string->Length,
+  &result[0], static_cast(result.size()),
+  nullptr, nullptr);
+result.resize(actual_length);

Can this use the functions in llvm/Support/ConvertUTF.h?


http://reviews.llvm.org/D12363



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


[Lldb-commits] [lldb] r246220 - Fixup one of the CMakeLists

2015-08-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Aug 27 16:55:55 2015
New Revision: 246220

URL: http://llvm.org/viewvc/llvm-project?rev=246220&view=rev
Log:
Fixup one of the CMakeLists

Modified:
lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt?rev=246220&r1=246219&r2=246220&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt Thu Aug 27 16:55:55 
2015
@@ -1,5 +1,5 @@
 set(LLVM_NO_RTTI 1)
 
-add_lldb_library(lldbPluginAppleObjCLanguage
-  AppleObjCLanguage.cpp
+add_lldb_library(lldbPluginObjCLanguage
+  ObjCLanguage.cpp
 )


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


[Lldb-commits] [lldb] r246222 - Include

2015-08-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Aug 27 17:14:06 2015
New Revision: 246222

URL: http://llvm.org/viewvc/llvm-project?rev=246222&view=rev
Log:
Include 

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

Modified: lldb/trunk/source/Target/Language.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=246222&r1=246221&r2=246222&view=diff
==
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Thu Aug 27 17:14:06 2015
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 
 #include "lldb/Target/Language.h"
 


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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Dawn Perchik via lldb-commits
dawn added a comment.

In http://reviews.llvm.org/D11102#234450, @clayborg wrote:

> Please wait for the OK from Jim and Sean.


Jim/Sean, you guys OK with this?  All tests pass - we've been running with this 
patch locally since it was proposed and have had no issues with it.


http://reviews.llvm.org/D11102



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


[Lldb-commits] [PATCH] D12415: Use $ to get the path lf lldb in test runs.

2015-08-27 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: zturner, clayborg.
sas added a subscriber: lldb-commits.

Instead of hardcoding the path, we should use $ which
works better when the output path differs, e.g. when building with MSVC.

$ is expanded during the generation of the final build
files, so we can't use it in output messages/comments. This patch
modifies build messages to display the full command instead of "Testing
LLDB with ..." messages.

http://reviews.llvm.org/D12415

Files:
  test/CMakeLists.txt

Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -1,13 +1,12 @@
-function(add_python_test_target name test_script args comment)
+function(add_python_test_target name test_script args)
   set(PYTHON_TEST_COMMAND
 ${PYTHON_EXECUTABLE}
 ${test_script}
 ${args}
 )
 
   add_custom_target(${name}
 COMMAND ${PYTHON_TEST_COMMAND} ${ARG_DEFAULT_ARGS}
-COMMENT "${comment}"
 )
 endfunction()
 
@@ -35,7 +34,7 @@
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
   --executable
-  ${CMAKE_BINARY_DIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}
+  $
   -s
   ${CMAKE_BINARY_DIR}/lldb-test-traces
   -u CXXFLAGS
@@ -63,7 +62,6 @@
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
-  "Testing LLDB with args: ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
   )
 
 set(LLDB_DOSEP_ARGS -o;\"-q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}\")
@@ -73,5 +71,4 @@
 add_python_test_target(check-lldb
   ${LLDB_SOURCE_DIR}/test/dosep.py
   "${LLDB_DOSEP_ARGS}"
-  "Testing LLDB (with a separate subprocess per test)"
   )


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -1,13 +1,12 @@
-function(add_python_test_target name test_script args comment)
+function(add_python_test_target name test_script args)
   set(PYTHON_TEST_COMMAND
 ${PYTHON_EXECUTABLE}
 ${test_script}
 ${args}
 )
 
   add_custom_target(${name}
 COMMAND ${PYTHON_TEST_COMMAND} ${ARG_DEFAULT_ARGS}
-COMMENT "${comment}"
 )
 endfunction()
 
@@ -35,7 +34,7 @@
 set(LLDB_TEST_COMMON_ARGS
   --arch=${LLDB_TEST_ARCH}
   --executable
-  ${CMAKE_BINARY_DIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}
+  $
   -s
   ${CMAKE_BINARY_DIR}/lldb-test-traces
   -u CXXFLAGS
@@ -63,7 +62,6 @@
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
-  "Testing LLDB with args: ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
   )
 
 set(LLDB_DOSEP_ARGS -o;\"-q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}\")
@@ -73,5 +71,4 @@
 add_python_test_target(check-lldb
   ${LLDB_SOURCE_DIR}/test/dosep.py
   "${LLDB_DOSEP_ARGS}"
-  "Testing LLDB (with a separate subprocess per test)"
   )
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Greg Clayton via lldb-commits

> On Aug 27, 2015, at 2:12 PM, Zachary Turner  wrote:
> 
> If I'm following this discussion correctly, Greg are you saying that 
> ClangASTContext could be renamed to DwarfASTContext?  And that for other 
> types of Debug info we could have PascalASTContext and PdbASTContext?

No. ClangASTContext _is_ a type system so it inherits from TypeSystem. It also 
can parse DWARF so it could inherit from DWARFASTParser so that it would 
implement the needed functions for parsing DWARF and TypeSystem could have a 
virtual function:

class TypeSystem
{
virtual DWARFASTParser *GetDWARFASTParser()
{
return nullptr;
}
}

Then the ClangASTContext could return a valid pointer to this so it can parse 
DWARF... 

> 
> If that's the case, then it seems there is a lot of code inside of 
> ClangASTContext (aka DwarfASTContext) which is not specific to DWARF, and 
> there's no reason that other ASTContext classes shouldn't be able to reuse it.
> 
> On Thu, Aug 27, 2015 at 2:08 PM via lldb-commits 
>  wrote:
> On Thu, Aug 27, 2015 at 12:56:57PM -0700, Greg Clayton via lldb-commits wrote:
> > >
> > > Our Delphi compiler generates an alternate debug format as well - it took 
> > > me all of yesterday to fix merge conflicts and I've still not got things 
> > > working properly.  Greg, can you please move the DWARF dependencies back 
> > > into the SymbolFileDWARF plugin?  Thanks!
> >
> > Sorry to not be clear on this: thing are correctly organized and won't be 
> > changing.
> >
> > You will need to merge your stuff correctly into the current world.
> 
> The issue is that you have added DWARF to ClangASTContext.  How is
> another debug format plugin supposed to work in ClangASTContext now?
> 
> The design had been that support for debug formats goes in plugins
> inside source/Plugins/SymbolFile.  This was a clean interface that
> allowed support for other debug formats to exist by installing their
> plugin.  Now main lldb code is polluted with DWARF code which depends on
> a plugin.

I can probably clean this up by making a DWARFASTParser a plug-in type and move 
all DWARF parsing code over into it and place that inside the DWARF plug-in 
folder. I see if I can do that quick to get the code organization back to how 
we want it.

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


Re: [Lldb-commits] [PATCH] D12415: Use $ to get the path lf lldb in test runs.

2015-08-27 Thread Zachary Turner via lldb-commits
I'm not familiar with that $ expression, but if you're certain
that it's equivalent to what was there previously, this looks fine.

But why were the two "Testing LLDB..." messages removed?

On Thu, Aug 27, 2015 at 3:55 PM Stephane Sezer  wrote:

> sas created this revision.
> sas added reviewers: zturner, clayborg.
> sas added a subscriber: lldb-commits.
>
> Instead of hardcoding the path, we should use $ which
> works better when the output path differs, e.g. when building with MSVC.
>
> $ is expanded during the generation of the final build
> files, so we can't use it in output messages/comments. This patch
> modifies build messages to display the full command instead of "Testing
> LLDB with ..." messages.
>
> http://reviews.llvm.org/D12415
>
> Files:
>   test/CMakeLists.txt
>
> Index: test/CMakeLists.txt
> ===
> --- test/CMakeLists.txt
> +++ test/CMakeLists.txt
> @@ -1,13 +1,12 @@
> -function(add_python_test_target name test_script args comment)
> +function(add_python_test_target name test_script args)
>set(PYTHON_TEST_COMMAND
>  ${PYTHON_EXECUTABLE}
>  ${test_script}
>  ${args}
>  )
>
>add_custom_target(${name}
>  COMMAND ${PYTHON_TEST_COMMAND} ${ARG_DEFAULT_ARGS}
> -COMMENT "${comment}"
>  )
>  endfunction()
>
> @@ -35,7 +34,7 @@
>  set(LLDB_TEST_COMMON_ARGS
>--arch=${LLDB_TEST_ARCH}
>--executable
> -  ${CMAKE_BINARY_DIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}
> +  $
>-s
>${CMAKE_BINARY_DIR}/lldb-test-traces
>-u CXXFLAGS
> @@ -63,7 +62,6 @@
>  add_python_test_target(check-lldb-single
>${LLDB_SOURCE_DIR}/test/dotest.py
>"${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
> -  "Testing LLDB with args:
> ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
>)
>
>  set(LLDB_DOSEP_ARGS
> -o;\"-q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}\")
> @@ -73,5 +71,4 @@
>  add_python_test_target(check-lldb
>${LLDB_SOURCE_DIR}/test/dosep.py
>"${LLDB_DOSEP_ARGS}"
> -  "Testing LLDB (with a separate subprocess per test)"
>)
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread via lldb-commits
On Thu, Aug 27, 2015 at 03:57:30PM -0700, Greg Clayton wrote:
> 
> I can probably clean this up by making a DWARFASTParser a plug-in type and 
> move all DWARF parsing code over into it and place that inside the DWARF 
> plug-in folder. I see if I can do that quick to get the code organization 
> back to how we want it.

Very cool!!  This is exactly what I was hoping for.  Thank you Greg!!!
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12415: Use $ to get the path lf lldb in test runs.

2015-08-27 Thread Stephane Sezer via lldb-commits
sas added a comment.

I removed the "Testing..." messages because $ won't be 
expanded in the context of a log message. Basically, you'll end up with 
ninja/msvc/make printing "Testing LLDB with args: 
--arch=x86_64;--executable;$;-s;/..." (even though it will be 
running the right command with the actual lldb path).


http://reviews.llvm.org/D12415



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


[Lldb-commits] [PATCH] D12416: Parse dotest.py/dosep.py output, providing general stats and skip reason breakdown by counts.

2015-08-27 Thread Todd Fiala via lldb-commits
tfiala created this revision.
tfiala added a reviewer: clayborg.
tfiala added a subscriber: lldb-commits.

The new script can be run against output of dotest.py/dosep.py, with the 
primary benefit of providing a detailed breakdown of the number of test methods 
that skip for a given reason.

Output looks something like this:

Test Counts
 --
success:637
unexpected success: 14
failure:1
expected failure:   41
skipped:681

%%%
Skip Reasons
 ---
requires on of darwin, macosx, ios:  520
debugserver tests:   68
skip on linux:   42
dsym tests:  20
benchmarks tests:13
Skip this long running test: 8
requires Darwin: 2
The 'expect' program cannot be located, skip the test:   1
requires on of windows:  1
skipping because os:None compiler: None None arch: None: 1
-data-evaluate-expression doesn't work on globals:   1
MacOSX doesn't have a default thread name:   1
due to taking too long to complete.: 1
This test is only for LLDB.framework built 64-bit and !lldb.test_remote: 1
requires one of x86-64, i386, i686:  1
%%%

Use a flow like this:
```
cd {your_lldb_source}/test
python dosep.py -s --options "-q --executable /path/to/lldb -A {your_arch} -C 
{your_compiler_path}" 2>&1 | tee /tmp/test_output.log
python reports/dotest_stats.py -t /tmp/test_output.log
```

http://reviews.llvm.org/D12416

Files:
  reports/dotest_stats.py

Index: reports/dotest_stats.py
===
--- reports/dotest_stats.py
+++ reports/dotest_stats.py
@@ -0,0 +1,142 @@
+"""
+Report stats on the test output from dosep.py/dotest.py,
+breaking down reported reasons for skipped tests.
+
+Here is a flow to run this report:
+cd {your_lldb_source_dir}/test
+python dosep.py -s --options "-q --executable /path/to/lldb -A {your_arch} \
+-C {your_compiler_path} 2>&1 | tee /tmp/test_output.log
+python {path_to_this_script} -t /tmp/test_output.log
+"""
+
+import argparse
+import os.path
+import re
+
+
+def parse_options():
+parser = argparse.ArgumentParser(
+description='Collect stats on lldb test run trace output dir')
+parser.add_argument(
+'--trace-file', '-t', action='store', required=True,
+help='trace file to parse')
+parser.add_argument(
+'--verbose', '-v', action='store_true',
+help='produce verbose output during operation')
+return parser.parse_args()
+
+
+def validate_options(options):
+if not os.path.isfile(options.trace_file):
+print 'trace file "{}" does not exist'.format(options.trace_file)
+return False
+return True
+
+
+def process_skipped_test(options, line, match, skip_reasons):
+if len(match.groups()) > 0:
+key = match.group(1)
+else:
+print "*** unspecified skip reason on line:", line
+exit(1)
+key = 'unspecified'
+
+if key in skip_reasons:
+skip_reasons[key] += 1
+else:
+skip_reasons[key] = 1
+
+
+def parse_trace_output(options):
+skip_reasons = {}
+
+test_result_types = [
+{'value_key': 'test suites', 'regex': re.compile(r'^RESULT:.+$')},
+{'value_key': 'success', 'regex': re.compile(r'^PASS: LLDB.+$')},
+{'value_key': 'failure', 'regex': re.compile(r'^FAIL: LLDB.+$')},
+{'value_key': 'expected failure',
+ 'regex': re.compile(r'^XFAIL:.+$')},
+{'value_key': 'skipped',
+ 'regex': re.compile(r'^UNSUPPORTED:.+\(([^\)]+)[\)\s]*$'),
+ 'substats_func': process_skipped_test,
+ 'substats_dict_arg': skip_reasons},
+# Catch anything that didn't match the regex above but clearly
+# is unsupported.
+{'value_key': 'skipped',
+ 'regex': re.compile(r'^UNSUPPORTED:.+$'),
+ 'substats_func': process_skipped_test,
+ 'substats_dict_arg': skip_reasons},
+{'value_key': 'unexpected success',
+ 'regex': re.compile(r'^XPASS:.+$')}
+]
+
+early_termination_re = re.compile(r'^Ran \d+ test suites.*$')
+
+# Initialize count values for each type.
+counts = {}
+for tr_type in test_result_types:
+counts[tr_type['value_key']] = 0
+
+with open(options.trace_file, 'r') as trace_file:
+for line in trace_file:
+# Early termination condition - stop after test suite
+# counts are printed out so we don't double count fails
+# and other reported test entries.
+   

Re: [Lldb-commits] [PATCH] D12416: Parse dotest.py/dosep.py output, providing general stats and skip reason breakdown by counts.

2015-08-27 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Note the output is formatted for whitespace and left justified, with the 
numeric columns all lined up.  My verbatim mode above doesn't look like it did 
what I expected...


http://reviews.llvm.org/D12416



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


Re: [Lldb-commits] [PATCH] D12416: Parse dotest.py/dosep.py output, providing general stats and skip reason breakdown by counts.

2015-08-27 Thread Todd Fiala via lldb-commits
tfiala added a comment.

And, the file is actually in test/reports/, not reports/...


http://reviews.llvm.org/D12416



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


Re: [Lldb-commits] [PATCH] D12416: Parse dotest.py/dosep.py output, providing general stats and skip reason breakdown by counts.

2015-08-27 Thread Todd Fiala via lldb-commits
tfiala updated this revision to Diff 33375.

http://reviews.llvm.org/D12416

Files:
  test/reports/dotest_stats.py

Index: test/reports/dotest_stats.py
===
--- test/reports/dotest_stats.py
+++ test/reports/dotest_stats.py
@@ -0,0 +1,142 @@
+"""
+Report stats on the test output from dosep.py/dotest.py,
+breaking down reported reasons for skipped tests.
+
+Here is a flow to run this report:
+cd {your_lldb_source_dir}/test
+python dosep.py -s --options "-q --executable /path/to/lldb -A {your_arch} \
+-C {your_compiler_path} 2>&1 | tee /tmp/test_output.log
+python {path_to_this_script} -t /tmp/test_output.log
+"""
+
+import argparse
+import os.path
+import re
+
+
+def parse_options():
+parser = argparse.ArgumentParser(
+description='Collect stats on lldb test run trace output dir')
+parser.add_argument(
+'--trace-file', '-t', action='store', required=True,
+help='trace file to parse')
+parser.add_argument(
+'--verbose', '-v', action='store_true',
+help='produce verbose output during operation')
+return parser.parse_args()
+
+
+def validate_options(options):
+if not os.path.isfile(options.trace_file):
+print 'trace file "{}" does not exist'.format(options.trace_file)
+return False
+return True
+
+
+def process_skipped_test(options, line, match, skip_reasons):
+if len(match.groups()) > 0:
+key = match.group(1)
+else:
+print "*** unspecified skip reason on line:", line
+exit(1)
+key = 'unspecified'
+
+if key in skip_reasons:
+skip_reasons[key] += 1
+else:
+skip_reasons[key] = 1
+
+
+def parse_trace_output(options):
+skip_reasons = {}
+
+test_result_types = [
+{'value_key': 'test suites', 'regex': re.compile(r'^RESULT:.+$')},
+{'value_key': 'success', 'regex': re.compile(r'^PASS: LLDB.+$')},
+{'value_key': 'failure', 'regex': re.compile(r'^FAIL: LLDB.+$')},
+{'value_key': 'expected failure',
+ 'regex': re.compile(r'^XFAIL:.+$')},
+{'value_key': 'skipped',
+ 'regex': re.compile(r'^UNSUPPORTED:.+\(([^\)]+)[\)\s]*$'),
+ 'substats_func': process_skipped_test,
+ 'substats_dict_arg': skip_reasons},
+# Catch anything that didn't match the regex above but clearly
+# is unsupported.
+{'value_key': 'skipped',
+ 'regex': re.compile(r'^UNSUPPORTED:.+$'),
+ 'substats_func': process_skipped_test,
+ 'substats_dict_arg': skip_reasons},
+{'value_key': 'unexpected success',
+ 'regex': re.compile(r'^XPASS:.+$')}
+]
+
+early_termination_re = re.compile(r'^Ran \d+ test suites.*$')
+
+# Initialize count values for each type.
+counts = {}
+for tr_type in test_result_types:
+counts[tr_type['value_key']] = 0
+
+with open(options.trace_file, 'r') as trace_file:
+for line in trace_file:
+# Early termination condition - stop after test suite
+# counts are printed out so we don't double count fails
+# and other reported test entries.
+if early_termination_re.match(line):
+break
+
+for tr_type in test_result_types:
+match = tr_type['regex'].match(line)
+if match:
+counts[tr_type['value_key']] += 1
+if 'substats_func' in tr_type:
+tr_type['substats_func'](
+options, line, match, tr_type['substats_dict_arg'])
+break
+return (counts, skip_reasons)
+
+
+def print_counts(options, counts, skip_reasons):
+print 'Test Counts'
+print ' --'
+# Print entries parsed directly out of filenames.
+report_entries = [
+{'name': 'started', 'unit': 'file'},
+{'name': 'success', 'unit': 'method'},
+{'name': 'unexpected success', 'unit': 'method'},
+{'name': 'failure', 'unit': 'method'},
+{'name': 'expected failure', 'unit': 'method'},
+{'name': 'skipped', 'unit': 'method'},
+{'name': 'skipped.no-reason', 'unit': 'method'}
+]
+max_name_len = max(
+len(report_entry['name']) for report_entry in report_entries)
+format_str = '{:<' + str(max_name_len + 2) + '}{}'
+
+for report_entry in report_entries:
+if report_entry['name'] in counts:
+print format_str.format(
+report_entry['name'] + ':',
+counts[report_entry['name']])
+
+# Print computed entries.
+max_skip_reason_len = max(
+len(reason) for reason in skip_reasons.keys())
+reason_format_str = '{:<' + str(max_skip_reason_len + 2) + '}{}'
+
+print
+print 'Skip Reasons'
+print ' ---'
+for reason_key in sorted(skip_reasons, key=skip_reasons.get, reverse=True):
+print reason_format_str.format(reason_key + ':',

Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Jim Ingham via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

This seems fine.  The only things you should fix (see inline comments) are the 
name of GetDefaultExpressionLanguage and the comment on why the upgrading is 
necessary.  If you do those two things, then this can go in.  Sorry for the 
delay.



Comment at: include/lldb/Target/StackFrame.h:475-476
@@ +474,4 @@
+//--
+lldb::LanguageType
+GetDefaultExpressionLanguage ();
+

This name seems confusing.  This is just the language of the current stack 
frame.  Deciding what language to use for the expression is just one possible 
use of this information.  It might also be useful to have the frame format 
print the language of the frame you've just stopped in.  So this should have a 
more generic name.  How about "GetLanguage".


Comment at: source/Expression/ClangExpressionParser.cpp:220-228
@@ +219,11 @@
+//
+// In http://reviews.llvm.org/D11482 Jim writes "Sean doesn't have a 
DESIRE to
+// have the expression parser use ObjC++ anytime the language is a C 
family
+// language. Rather he MUST right now, because the expression parser 
uses
+// features of C++ to capture values. We could switch to using C++ in 
C/C++
+// situations, and ObjC++ in others, but there wasn't sufficient 
motivation to
+// add that. Sometime when we get some spare cycles we'll try to relax 
the need
+// for C++, and then we'll truly be able to follow the frame language. 
For now,
+// we do "Want C -> get ObjC++", "Want ObjC -> get ObjC++" etc... But 
again,
+// that is not a fundamental choice, it is an implementation necessity.
+m_compiler->getLangOpts().CPlusPlus = true;

The contents of this comment are fine, but just state the reason rather than 
describing how you found out about the reason...


http://reviews.llvm.org/D11102



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


Re: [Lldb-commits] [PATCH] D11102: Set the default language to use when evaluating to that of the frame's CU.

2015-08-27 Thread Sean Callanan via lldb-commits
spyffe added a comment.

I looked at this with Jim, and once his suggestions are applied this patch is 
fine.  Thanks for working with us on it.
I want to follow up and make non-Apple platforms not force ObjC (it doesn't 
matter for making the expression parser work).


http://reviews.llvm.org/D11102



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


Re: [Lldb-commits] [PATCH] D12363: Read module list from mini dump

2015-08-27 Thread Adrian McCarthy via lldb-commits
amccarth marked an inline comment as done.
amccarth added a comment.

New patch coming up.


http://reviews.llvm.org/D12363



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


Re: [Lldb-commits] [PATCH] D12363: Read module list from mini dump

2015-08-27 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 33379.
amccarth added a comment.

Now uses llvm/Support/ConvertUTF.h instead of WinAPI WideCharToMultiByte.


http://reviews.llvm.org/D12363

Files:
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h

Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
@@ -100,6 +100,9 @@
 void
 ReadExceptionRecord();
 
+void
+ReadModuleList();
+
 // A thin wrapper around WinAPI's MiniDumpReadDumpStream to avoid redundant
 // checks.  If there's a failure (e.g., if the requested stream doesn't exist),
 // the function returns nullptr and sets *size_out to 0.
Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
===
--- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
+++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
@@ -30,6 +30,7 @@
 #include "lldb/Target/UnixSignals.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
 #include "ExceptionRecord.h"
@@ -37,6 +38,36 @@
 
 using namespace lldb_private;
 
+namespace
+{
+
+// Getting a string out of a mini dump is a chore.  You're usually given a
+// relative virtual address (RVA), which points to a counted string that's in
+// Windows Unicode (UTF-16).  This wrapper handles all the redirection and
+// returns a UTF-8 copy of the string.
+std::string
+GetMiniDumpString(const void *base_addr, const RVA rva)
+{
+std::string result;
+if (!base_addr)
+{
+return result;
+}
+auto md_string = reinterpret_cast(static_cast(base_addr) + rva);
+auto source_start = reinterpret_cast(md_string->Buffer);
+const auto source_length = ::wcslen(md_string->Buffer);
+const auto source_end = source_start + source_length;
+result.resize(4*source_length);  // worst case length
+auto result_start = reinterpret_cast(&result[0]);
+const auto result_end = result_start + result.size();
+ConvertUTF16toUTF8(&source_start, source_end, &result_start, result_end, strictConversion);
+const auto result_size = std::distance(reinterpret_cast(&result[0]), result_start);
+result.resize(result_size);  // shrink to actual length
+return result;
+}
+
+}  // anonymous namespace
+
 // Encapsulates the private data for ProcessWinMiniDump.
 // TODO(amccarth):  Determine if we need a mutex for access.
 class ProcessWinMiniDump::Data
@@ -133,8 +164,7 @@
 }
 
 m_target.SetArchitecture(DetermineArchitecture());
-// TODO(amccarth):  Build the module list.
-
+ReadModuleList();
 ReadExceptionRecord();
 
 return error;
@@ -341,6 +371,31 @@
 }
 }
 
+void
+ProcessWinMiniDump::ReadModuleList() {
+size_t size = 0;
+auto module_list_ptr = static_cast(FindDumpStream(ModuleListStream, &size));
+if (!module_list_ptr || module_list_ptr->NumberOfModules == 0)
+{
+return;
+}
+
+for (ULONG32 i = 0; i < module_list_ptr->NumberOfModules; ++i)
+{
+const auto &module = module_list_ptr->Modules[i];
+const auto file_name = GetMiniDumpString(m_data_up->m_base_addr, module.ModuleNameRva);
+ModuleSpec module_spec = FileSpec(file_name, true);
+
+lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec);
+if (!module_sp)
+{
+continue;
+}
+bool load_addr_changed = false;
+module_sp->SetLoadAddress(GetTarget(), module.BaseOfImage, false, load_addr_changed);
+}
+}
+
 void *
 ProcessWinMiniDump::FindDumpStream(unsigned stream_number, size_t *size_out) {
 void *stream = nullptr;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [Diffusion] rL245090: Move all clang type system DWARF type parsing into ClangASTContext.cpp.

2015-08-27 Thread Greg Clayton via lldb-commits
Try this out:

% svn commit
Sendinginclude/lldb/Symbol/ClangASTContext.h
Sendinginclude/lldb/Symbol/TypeSystem.h
Sendinglldb.xcodeproj/project.pbxproj
Sendingsource/Plugins/SymbolFile/DWARF/CMakeLists.txt
Adding source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
Adding source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Adding source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDIE.h
Sendingsource/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Sendingsource/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Sendingsource/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
Sendingsource/Symbol/ClangASTContext.cpp
Transmitting file data .
Committed revision 246242.

It should address everything we talked about. Commit message for this was:


Made a new abstract class named "DWARFASTParser" which lives in 
"source/Plugins/SymbolFile/DWARF":

class DWARFASTParser
{
public:
virtual ~DWARFASTParser() {}

virtual lldb::TypeSP
ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
const DWARFDIE &die,
lldb_private::Log *log,
bool *type_is_new_ptr) = 0;


virtual lldb_private::Function *
ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
const DWARFDIE &die) = 0;

virtual bool
CompleteTypeFromDWARF (const DWARFDIE &die,
   lldb_private::Type *type,
   lldb_private::CompilerType &clang_type) = 0;

virtual lldb_private::CompilerDeclContext
GetDeclContextForUIDFromDWARF (const DWARFDIE &die) = 0;

virtual lldb_private::CompilerDeclContext
GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) = 0;

};

We have one subclass named DWARFASTParserClang that implements all of the clang 
specific AST type parsing. This keeps all DWARF parsing in the DWARF plug-in. 
Moved all of the DWARF parsing code that was in ClangASTContext over into 
DWARFASTParserClang.

lldb_private::TypeSystem classes no longer have any DWARF parsing functions in 
them, but they can hand out a DWARFASTParser:

virtual DWARFASTParser *
GetDWARFParser ()
{
return nullptr;
}

This keeps things clean and makes for easy merging when we have different AST's 
for different languages.


> On Aug 27, 2015, at 4:06 PM, d...@burble.org wrote:
> 
> On Thu, Aug 27, 2015 at 03:57:30PM -0700, Greg Clayton wrote:
>> 
>> I can probably clean this up by making a DWARFASTParser a plug-in type and 
>> move all DWARF parsing code over into it and place that inside the DWARF 
>> plug-in folder. I see if I can do that quick to get the code organization 
>> back to how we want it.
> 
> Very cool!!  This is exactly what I was hoping for.  Thank you Greg!!!

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


[Lldb-commits] [PATCH] D12420: Make ProcessGDBRemote get a //copy// of platform Unix signals.

2015-08-27 Thread Chaoren Lin via lldb-commits
chaoren created this revision.
chaoren added reviewers: clayborg, jaydeep.
chaoren added a subscriber: lldb-commits.

Update to http://reviews.llvm.org/rL243618.

http://reviews.llvm.org/D12420

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

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -850,7 +850,7 @@
 {
 PlatformSP platform_sp = GetTarget().GetPlatform();
 if (platform_sp && platform_sp->IsConnected())
-SetUnixSignals(platform_sp->GetUnixSignals());
+
SetUnixSignals(std::make_shared(platform_sp->GetUnixSignals()));
 else
 SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture()));
 }


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -850,7 +850,7 @@
 {
 PlatformSP platform_sp = GetTarget().GetPlatform();
 if (platform_sp && platform_sp->IsConnected())
-SetUnixSignals(platform_sp->GetUnixSignals());
+SetUnixSignals(std::make_shared(platform_sp->GetUnixSignals()));
 else
 SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture()));
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12363: Read module list from mini dump

2015-08-27 Thread Zachary Turner via lldb-commits
looks good

On Thu, Aug 27, 2015 at 4:43 PM Adrian McCarthy  wrote:

> amccarth updated this revision to Diff 33379.
> amccarth added a comment.
>
> Now uses llvm/Support/ConvertUTF.h instead of WinAPI WideCharToMultiByte.
>
>
> http://reviews.llvm.org/D12363
>
> Files:
>   source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
>   source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12415: Use $ to get the path lf lldb in test runs.

2015-08-27 Thread Zachary Turner via lldb-commits
I think it's still worth printing something, even if it's just "Testing
LLDB with N processes", where you fill in the value for N

On Thu, Aug 27, 2015 at 4:07 PM Stephane Sezer  wrote:

> sas added a comment.
>
> I removed the "Testing..." messages because $ won't be
> expanded in the context of a log message. Basically, you'll end up with
> ninja/msvc/make printing "Testing LLDB with args:
> --arch=x86_64;--executable;$;-s;/..." (even though it
> will be running the right command with the actual lldb path).
>
>
> http://reviews.llvm.org/D12415
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12416: Parse dotest.py/dosep.py output, providing general stats and skip reason breakdown by counts.

2015-08-27 Thread Zachary Turner via lldb-commits
Any reason dotest / dosep cannot just print the stats?

On Thu, Aug 27, 2015 at 4:17 PM Todd Fiala via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> tfiala updated this revision to Diff 33375.
>
> http://reviews.llvm.org/D12416
>
> Files:
>   test/reports/dotest_stats.py
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits