Re: [Lldb-commits] [PATCH] D18858: [LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI

2016-04-13 Thread Nitesh Jain via lldb-commits
nitesh.jain added inline comments.


Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1625-1626
@@ -1624,4 +1624,4 @@
 
 if (arch_spec.GetMachine() == llvm::Triple::mips || 
arch_spec.GetMachine() == llvm::Triple::mipsel
 || arch_spec.GetMachine() == llvm::Triple::mips64 || 
arch_spec.GetMachine() == llvm::Triple::mips64el)
 {

clayborg wrote:
> Should we add a function like:
> 
> ```
> bool ArchSpec::IsMIPS() const;
> ```
> 
> Every patch I see for MIPS has these same four machine checks. If we add 
> another we will need to update all places that do this..
I agree with you. We need to add above function so it will be easy for future 
updates. I will update the diff as per suggestion


Repository:
  rL LLVM

http://reviews.llvm.org/D18858



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


Re: [Lldb-commits] [PATCH] D19092: Fix Android build after r266267

2016-04-13 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

Submitted as http://reviews.llvm.org/rL266274


http://reviews.llvm.org/D19092



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


[Lldb-commits] [lldb] r266274 - Fix Android build after r266267

2016-04-13 Thread Oleksiy Vyalov via lldb-commits
Author: ovyalov
Date: Wed Apr 13 21:02:12 2016
New Revision: 266274

URL: http://llvm.org/viewvc/llvm-project?rev=266274&view=rev
Log:
Fix Android build after r266267


Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=266274&r1=266273&r2=266274&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Wed Apr 13 21:02:12 2016
@@ -596,7 +596,7 @@ protected:
 {
 auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
 auto iterator = iterators_pair.first;
-Stream &stdout(result.GetOutputStream());
+auto &out = result.GetOutputStream();
 for(; iterator != iterators_pair.second; iterator++)
 {
 if (iterator->second)
@@ -604,15 +604,15 @@ protected:
 const char* class_name = 
iterator->second->GetClassName().AsCString("");
 if (regex_up && class_name && 
!regex_up->Execute(class_name))
 continue;
-stdout.Printf("isa = 0x%" PRIx64, iterator->first);
-stdout.Printf(" name = %s", class_name);
-stdout.Printf(" instance size = %" PRIu64, 
iterator->second->GetInstanceSize());
-stdout.Printf(" num ivars = %" PRIuPTR, 
(uintptr_t)iterator->second->GetNumIVars());
+out.Printf("isa = 0x%" PRIx64, iterator->first);
+out.Printf(" name = %s", class_name);
+out.Printf(" instance size = %" PRIu64, 
iterator->second->GetInstanceSize());
+out.Printf(" num ivars = %" PRIuPTR, 
(uintptr_t)iterator->second->GetNumIVars());
 if (auto superclass = iterator->second->GetSuperclass())
 {
-stdout.Printf(" superclass = %s", 
superclass->GetClassName().AsCString(""));
+out.Printf(" superclass = %s", 
superclass->GetClassName().AsCString(""));
 }
-stdout.Printf("\n");
+out.Printf("\n");
 if (m_options.m_verbose)
 {
 for(size_t i = 0;
@@ -620,23 +620,23 @@ protected:
 i++)
 {
 auto ivar = iterator->second->GetIVarAtIndex(i);
-stdout.Printf("  ivar name = %s type = %s size = 
%" PRIu64 " offset = %" PRId32 "\n",
+out.Printf("  ivar name = %s type = %s size = %" 
PRIu64 " offset = %" PRId32 "\n",
 
ivar.m_name.AsCString(""),
 
ivar.m_type.GetDisplayTypeName().AsCString(""),
 ivar.m_size,
 ivar.m_offset);
 }
 iterator->second->Describe(nullptr,
-   [objc_runtime, &stdout] 
(const char* name, const char* type) -> bool {
-   stdout.Printf("  
instance method name = %s type = %s\n",
- name,
- type);
+   [objc_runtime, &out] (const 
char* name, const char* type) -> bool {
+   out.Printf("  instance 
method name = %s type = %s\n",
+  name,
+  type);
return false;
},
-   [objc_runtime, &stdout] 
(const char* name, const char* type) -> bool {
-   stdout.Printf("  class 
method name = %s type = %s\n",
- name,
- type);
+   [objc_runtime, &out] (const 
char* name, const char* type) -> bool {
+   out.Printf("  cla

[Lldb-commits] [PATCH] D19092: Fix Android build after r266267

2016-04-13 Thread Oleksiy Vyalov via lldb-commits
ovyalov created this revision.
ovyalov added a reviewer: granata.enrico.
ovyalov added a subscriber: lldb-commits.
Herald added subscribers: danalbert, tberghammer.

Fix Android build after r266267

http://reviews.llvm.org/D19092

Files:
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Index: 
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -596,47 +596,47 @@
 {
 auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
 auto iterator = iterators_pair.first;
-Stream &stdout(result.GetOutputStream());
+auto &out = result.GetOutputStream();
 for(; iterator != iterators_pair.second; iterator++)
 {
 if (iterator->second)
 {
 const char* class_name = 
iterator->second->GetClassName().AsCString("");
 if (regex_up && class_name && 
!regex_up->Execute(class_name))
 continue;
-stdout.Printf("isa = 0x%" PRIx64, iterator->first);
-stdout.Printf(" name = %s", class_name);
-stdout.Printf(" instance size = %" PRIu64, 
iterator->second->GetInstanceSize());
-stdout.Printf(" num ivars = %" PRIuPTR, 
(uintptr_t)iterator->second->GetNumIVars());
+out.Printf("isa = 0x%" PRIx64, iterator->first);
+out.Printf(" name = %s", class_name);
+out.Printf(" instance size = %" PRIu64, 
iterator->second->GetInstanceSize());
+out.Printf(" num ivars = %" PRIuPTR, 
(uintptr_t)iterator->second->GetNumIVars());
 if (auto superclass = iterator->second->GetSuperclass())
 {
-stdout.Printf(" superclass = %s", 
superclass->GetClassName().AsCString(""));
+out.Printf(" superclass = %s", 
superclass->GetClassName().AsCString(""));
 }
-stdout.Printf("\n");
+out.Printf("\n");
 if (m_options.m_verbose)
 {
 for(size_t i = 0;
 i < iterator->second->GetNumIVars();
 i++)
 {
 auto ivar = iterator->second->GetIVarAtIndex(i);
-stdout.Printf("  ivar name = %s type = %s size = 
%" PRIu64 " offset = %" PRId32 "\n",
+out.Printf("  ivar name = %s type = %s size = %" 
PRIu64 " offset = %" PRId32 "\n",
 
ivar.m_name.AsCString(""),
 
ivar.m_type.GetDisplayTypeName().AsCString(""),
 ivar.m_size,
 ivar.m_offset);
 }
 iterator->second->Describe(nullptr,
-   [objc_runtime, &stdout] 
(const char* name, const char* type) -> bool {
-   stdout.Printf("  
instance method name = %s type = %s\n",
- name,
- type);
+   [objc_runtime, &out] (const 
char* name, const char* type) -> bool {
+   out.Printf("  instance 
method name = %s type = %s\n",
+  name,
+  type);
return false;
},
-   [objc_runtime, &stdout] 
(const char* name, const char* type) -> bool {
-   stdout.Printf("  class 
method name = %s type = %s\n",
- name,
- type);
+   [objc_runtime, &out] (const 
char* name, const char* type) -> bool {
+   out.Printf("  class 
method name = %s type = %s\n",
+  name,
+  type);

Re: [Lldb-commits] [lldb] r266271 - Don't use auto - (try to) appease the Android g++ bot

2016-04-13 Thread Sean Callanan via lldb-commits
Hurray for the Android g++ bot!

Sean

> On Apr 13, 2016, at 6:23 PM, Enrico Granata via lldb-commits 
>  wrote:
> 
> Author: enrico
> Date: Wed Apr 13 20:23:01 2016
> New Revision: 266271
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=266271&view=rev
> Log:
> Don't use auto - (try to) appease the Android g++ bot
> 
> Modified:
>
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=266271&r1=266270&r2=266271&view=diff
> ==
> --- 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>  (original)
> +++ 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>  Wed Apr 13 20:23:01 2016
> @@ -596,7 +596,7 @@ protected:
> {
> auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
> auto iterator = iterators_pair.first;
> -auto& stdout(result.GetOutputStream());
> +Stream &stdout(result.GetOutputStream());
> for(; iterator != iterators_pair.second; iterator++)
> {
> if (iterator->second)
> 
> 
> ___
> 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


[Lldb-commits] [lldb] r266271 - Don't use auto - (try to) appease the Android g++ bot

2016-04-13 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Apr 13 20:23:01 2016
New Revision: 266271

URL: http://llvm.org/viewvc/llvm-project?rev=266271&view=rev
Log:
Don't use auto - (try to) appease the Android g++ bot

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=266271&r1=266270&r2=266271&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Wed Apr 13 20:23:01 2016
@@ -596,7 +596,7 @@ protected:
 {
 auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
 auto iterator = iterators_pair.first;
-auto& stdout(result.GetOutputStream());
+Stream &stdout(result.GetOutputStream());
 for(; iterator != iterators_pair.second; iterator++)
 {
 if (iterator->second)


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


Re: [Lldb-commits] [lldb] r266267 - Augment the 'language objc class-table dump' command to take a "-v" option, which makes it print ivar and method information, as well as an optional regex argument

2016-04-13 Thread Enrico Granata via lldb-commits
I have just gotten a notification that this breaks the Android g++ bot: 
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/6443
 


The error seems like it’s at this line:
auto& stdout(result.GetOutputStream());

Is this a g++ limitation? It looks to me like that syntax should be supported 
in C++11. With that said, I suspect giving an explicit type to “stdout” is 
going to be good enough of a fix, so this is mostly for my own intellectual 
curiosity

> On Apr 13, 2016, at 5:43 PM, Enrico Granata via lldb-commits 
>  wrote:
> 
> Author: enrico
> Date: Wed Apr 13 19:43:20 2016
> New Revision: 266267
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=266267&view=rev
> Log:
> Augment the 'language objc class-table dump' command to take a "-v" option, 
> which makes it print ivar and method information, as well as an optional 
> regex argument which filters out all class names that don't match the regex
> 
> 
> Modified:
>
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
>
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=266267&r1=266266&r2=266267&view=diff
> ==
> --- 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
>  (original)
> +++ 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
>  Wed Apr 13 19:43:20 2016
> @@ -407,6 +407,24 @@ public:
> 
> return ret;
> }
> +
> +explicit operator bool ()
> +{
> +return m_is_valid;
> +}
> +
> +size_t
> +GetNumTypes ()
> +{
> +return m_type_vector.size();
> +}
> +
> +const char*
> +GetTypeAtIndex (size_t idx)
> +{
> +return m_type_vector[idx].c_str();
> +}
> +
> private:
> typedef std::vector  TypeVector;
> 
> 
> Modified: 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=266267&r1=266266&r2=266267&view=diff
> ==
> --- 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>  (original)
> +++ 
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>  Wed Apr 13 19:43:20 2016
> @@ -43,6 +43,7 @@
> #include "lldb/Interpreter/CommandObject.h"
> #include "lldb/Interpreter/CommandObjectMultiword.h"
> #include "lldb/Interpreter/CommandReturnObject.h"
> +#include "lldb/Interpreter/OptionValueBoolean.h"
> #include "lldb/Symbol/ClangASTContext.h"
> #include "lldb/Symbol/ObjectFile.h"
> #include "lldb/Symbol/Symbol.h"
> @@ -483,6 +484,52 @@ AppleObjCRuntimeV2::CreateInstance (Proc
> class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed
> {
> public:
> +class CommandOptions : public Options
> +{
> +public:
> +CommandOptions (CommandInterpreter &interpreter) :
> +Options(interpreter),
> +m_verbose(false,false)
> +{}
> +
> +~CommandOptions() override = default;
> +
> +Error
> +SetOptionValue(uint32_t option_idx, const char *option_arg) override
> +{
> +Error error;
> +const int short_option = m_getopt_table[option_idx].val;
> +switch (short_option)
> +{
> +case 'v':
> +m_verbose.SetCurrentValue(true);
> +m_verbose.SetOptionWasSet();
> +break;
> +
> +default:
> +error.SetErrorStringWithFormat("unrecognized short 
> option '%c'", short_option);
> +break;
> +}
> +
> +return error;
> +}
> +
> +void
> +OptionParsingStarting() override
> +{
> +m_verbose.Clear();
> +}
> +
> +const OptionDefinition*
> +GetDefinitions() override
> +{
> +return g_option_table;
> +}
> +
> +OptionValueBoolean m_verbose;
> +static OptionDefinition g_option_table[];
> +};
> +
> CommandObjectObjC_ClassTable_Dump (CommandInterpreter &interpreter) :
> CommandObjectParsed (interpreter,
>  "dump",
> @@ -490,39 +537,116 @@ public:
>  "language objc class-table dump",
>  

Re: [Lldb-commits] [PATCH] D19086: [clang-analyzer] fix warnings emitted on lldb code base

2016-04-13 Thread Jim Ingham via lldb-commits
jingham added a subscriber: jingham.
jingham requested changes to this revision.
jingham added a reviewer: jingham.
This revision now requires changes to proceed.


Comment at: source/API/SBThread.cpp:926
@@ -925,3 +925,3 @@
 Thread *thread = exe_ctx.GetThreadPtr();
-if (sb_frame.GetThread().GetThreadID() != thread->GetID())
+if (sb_frame.GetThread().GetThreadID() != thread->GetID() && log)
 {

Can you switch this around and check for log first?  We generally don't like to 
do any work that the log might do if there's no log, and also it makes it 
easier to see that this whole block is only for logging.


Comment at: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp:309-329
@@ -308,19 +308,23 @@
 {
-const RegisterInfo *r2_info = 
reg_ctx->GetRegisterInfoByName("r2", 0);
+const RegisterInfo *r2_info = nullptr;
+
+if (reg_ctx)
+  r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+
 if (num_bytes <= 8)
 {
 uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
 
-if (!reg_ctx->WriteRegisterFromUnsigned (r2_info, 
raw_value))
+if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned 
(r2_info, raw_value))
 error.SetErrorString ("failed to write register r2");
 }
 else
 {
 uint64_t raw_value = data.GetMaxU64(&offset, 8);
-if (reg_ctx->WriteRegisterFromUnsigned (r2_info, 
raw_value))
+if (reg_ctx && reg_ctx->WriteRegisterFromUnsigned 
(r2_info, raw_value))
 {
 const RegisterInfo *r3_info = 
reg_ctx->GetRegisterInfoByName("r3", 0);
 raw_value = data.GetMaxU64(&offset, num_bytes - 
offset);
 
-if (!reg_ctx->WriteRegisterFromUnsigned (r3_info, 
raw_value))
+if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned 
(r3_info, raw_value))
 error.SetErrorString ("failed to write register 
r3");

Seems to me this whole section of code doesn't do anything reasonable if 
reg_ctx is null.  It would be better to move the reg_ctx check higher up.


http://reviews.llvm.org/D19086



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


[Lldb-commits] [lldb] r266267 - Augment the 'language objc class-table dump' command to take a "-v" option, which makes it print ivar and method information, as well as an optional regex argument whic

2016-04-13 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Apr 13 19:43:20 2016
New Revision: 266267

URL: http://llvm.org/viewvc/llvm-project?rev=266267&view=rev
Log:
Augment the 'language objc class-table dump' command to take a "-v" option, 
which makes it print ivar and method information, as well as an optional regex 
argument which filters out all class names that don't match the regex


Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=266267&r1=266266&r2=266267&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
 Wed Apr 13 19:43:20 2016
@@ -407,6 +407,24 @@ public:
 
 return ret;
 }
+
+explicit operator bool ()
+{
+return m_is_valid;
+}
+
+size_t
+GetNumTypes ()
+{
+return m_type_vector.size();
+}
+
+const char*
+GetTypeAtIndex (size_t idx)
+{
+return m_type_vector[idx].c_str();
+}
+
 private:
 typedef std::vector  TypeVector;
 

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=266267&r1=266266&r2=266267&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Wed Apr 13 19:43:20 2016
@@ -43,6 +43,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
@@ -483,6 +484,52 @@ AppleObjCRuntimeV2::CreateInstance (Proc
 class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed
 {
 public:
+class CommandOptions : public Options
+{
+public:
+CommandOptions (CommandInterpreter &interpreter) :
+Options(interpreter),
+m_verbose(false,false)
+{}
+
+~CommandOptions() override = default;
+
+Error
+SetOptionValue(uint32_t option_idx, const char *option_arg) override
+{
+Error error;
+const int short_option = m_getopt_table[option_idx].val;
+switch (short_option)
+{
+case 'v':
+m_verbose.SetCurrentValue(true);
+m_verbose.SetOptionWasSet();
+break;
+
+default:
+error.SetErrorStringWithFormat("unrecognized short option 
'%c'", short_option);
+break;
+}
+
+return error;
+}
+
+void
+OptionParsingStarting() override
+{
+m_verbose.Clear();
+}
+
+const OptionDefinition*
+GetDefinitions() override
+{
+return g_option_table;
+}
+
+OptionValueBoolean m_verbose;
+static OptionDefinition g_option_table[];
+};
+
 CommandObjectObjC_ClassTable_Dump (CommandInterpreter &interpreter) :
 CommandObjectParsed (interpreter,
  "dump",
@@ -490,39 +537,116 @@ public:
  "language objc class-table dump",
  eCommandRequiresProcess   |
  eCommandProcessMustBeLaunched |
- eCommandProcessMustBePaused   )
+ eCommandProcessMustBePaused   ),
+m_options(interpreter)
 {
+CommandArgumentEntry arg;
+CommandArgumentData index_arg;
+
+// Define the first (and only) variant of this arg.
+index_arg.arg_type = eArgTypeRegularExpression;
+index_arg.arg_repetition = eArgRepeatOptional;
+
+// There is only one variant this argument could be; put it into the 
argument entry.
+arg.push_back (index_arg);
+
+// Push the data for the first argument into the m_arguments vector.
+m_arguments.push_back (arg);
 }
 
 ~CommandObjectObjC_ClassTable_Dump() override = default;
 
+Options *
+GetOptions() overr

Re: [Lldb-commits] [PATCH] D19086: [clang-analyzer] fix warnings emitted on lldb code base

2016-04-13 Thread Enrico Granata via lldb-commits
granata.enrico added a subscriber: granata.enrico.


Comment at: source/Core/FormatEntity.cpp:1016
@@ -1015,2 +1015,3 @@
 {
-success &= 
item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+if (item)
+success &= 
item->DumpPrintableRepresentation(s,val_obj_display, custom_format);

jasonmolenda wrote:
> Greg should look at this.
Personally, this LGTM (the code was originally written by me - Greg moved it 
around last though)

Greg, feel free to disagree


http://reviews.llvm.org/D19086



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


Re: [Lldb-commits] [PATCH] D19086: [clang-analyzer] fix warnings emitted on lldb code base

2016-04-13 Thread Jason Molenda via lldb-commits
jasonmolenda added a subscriber: jasonmolenda.
jasonmolenda added a comment.

These look like good changes to me, especially the SBThread fix - I'm surprised 
that hasn't caused a problem.  The DynamicLoader change should be unnecessary 
but I don't have a problem with that.  Tamas might want to speak to what he 
meant to do in DWARFASTParserJava.cpp there.  Greg Clayton should probably 
comment on the FormatEntity change.



Comment at: source/Core/FormatEntity.cpp:1016
@@ -1015,2 +1015,3 @@
 {
-success &= 
item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+if (item)
+success &= 
item->DumpPrintableRepresentation(s,val_obj_display, custom_format);

Greg should look at this.


http://reviews.llvm.org/D19086



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


[Lldb-commits] [PATCH] D19086: [clang-analyzer] fix warnings emitted on lldb code base

2016-04-13 Thread Apelete Seketeli via lldb-commits
apelete created this revision.
apelete added a subscriber: lldb-commits.

The following warnings were reported while running clang analyzer on
LLDB code base:

API: argument with 'nonnull' attribute passed null, on file:
- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp.

Dead store: dead assignement, on file:
- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp.

Logic error: branch condition evaluates to a garbage value, on file:
- source/Core/DynamicLoader.cpp

Logic error: called C++ object pointer is null, on files:
- source/API/SBThread.cpp,
- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp,
- source/DataFormatters/VectorType.cpp (22 warnings in cpp file,
  suppressed in custom assertion handler in
  include/lldb/Utility/LLDBAssert.h),
- source/Core/FormatEntity.cpp.

(please note that first revision was sent only to lldb-commits mailing
list, not reviewed yet).

Signed-off-by: Apelete Seketeli 

http://reviews.llvm.org/D19086

Files:
  include/lldb/Utility/LLDBAssert.h
  source/API/SBThread.cpp
  source/Core/DynamicLoader.cpp
  source/Core/FormatEntity.cpp
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
@@ -468,7 +468,6 @@
 DWARFFormValue encoding_uid;
 uint32_t member_byte_offset = UINT32_MAX;
 DWARFExpression member_location_expression(dwarf_cu);
-bool artificial = true;
 
 DWARFAttributes attributes;
 size_t num_attributes = die.GetAttributes(attributes);
@@ -494,7 +493,7 @@
 member_byte_offset = form_value.Unsigned();
 break;
 case DW_AT_artificial:
-artificial = form_value.Boolean();
+// TODO: Handle when needed
 break;
 case DW_AT_accessibility:
 // TODO: Handle when needed
@@ -506,7 +505,7 @@
 }
 }
 
-if (strcmp(name, ".dynamic_type") == 0)
+if (name && strcmp(name, ".dynamic_type") == 0)
 m_ast.SetDynamicTypeId(compiler_type, member_location_expression);
 else
 {
Index: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
===
--- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -306,23 +306,27 @@
 
 if (num_bytes <= 16)
 {
-const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+const RegisterInfo *r2_info = nullptr;
+
+if (reg_ctx)
+  r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+
 if (num_bytes <= 8)
 {
 uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
 
-if (!reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
+if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
 error.SetErrorString ("failed to write register r2");
 }
 else
 {
 uint64_t raw_value = data.GetMaxU64(&offset, 8);
-if (reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
+if (reg_ctx && reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
 {
 const RegisterInfo *r3_info = reg_ctx->GetRegisterInfoByName("r3", 0);
 raw_value = data.GetMaxU64(&offset, num_bytes - offset);
 
-if (!reg_ctx->WriteRegisterFromUnsigned (r3_info, raw_value))
+if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned (r3_info, raw_value))
 error.SetErrorString ("failed to write register r3");
 }
 else
Index: source/Core/FormatEntity.cpp
===
--- source/Core/FormatEntity.cpp
+++ source/Core/FormatEntity.cpp
@@ -1013,7 +1013,8 @@
 
 if (special_directions.empty())
 {
-success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+if (item)
+success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
 }
 else
 {
Index: source/Core/DynamicLoader.cpp

Re: [Lldb-commits] [PATCH] D19004: Use the section sizes to determine symbols sizes in the Symtab instead of just using the following symbol's address

2016-04-13 Thread Jason Molenda via lldb-commits
jasonmolenda closed this revision.
jasonmolenda added a comment.

Committed in r266165.


Repository:
  rL LLVM

http://reviews.llvm.org/D19004



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


[Lldb-commits] [PATCH] D19082: Store absolute path for lldb executable in dotest.py

2016-04-13 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: vharron, zturner, tfiala.
fjricci added subscribers: sas, lldb-commits.

lldb-server tests are currently being skipped on the 
check-lldb target. This is because we get the path of 
lldb-server by modifying the path to the lldb executable.
However, by this point, we've changed directories, and a 
relative path to the build/bin directory will no longer point
to the location of lldb-server.

Storing an absolute path solves this issue.

http://reviews.llvm.org/D19082

Files:
  packages/Python/lldbsuite/test/dotest.py

Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -309,7 +309,7 @@
 configuration.lldbFrameworkPath = args.framework
 
 if args.executable:
-lldbtest_config.lldbExec = args.executable
+lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.p:
 if args.p.startswith('-'):


Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -309,7 +309,7 @@
 configuration.lldbFrameworkPath = args.framework
 
 if args.executable:
-lldbtest_config.lldbExec = args.executable
+lldbtest_config.lldbExec = os.path.realpath(args.executable)
 
 if args.p:
 if args.p.startswith('-'):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18981: Fix usage of APInt.getRawData for big-endian systems

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand updated this revision to Diff 53622.
uweigand added a comment.

This adds some unit tests verifying correct operation of the GetBytes routine 
as well as the conversions (SChar, UChar, ...).  Those tests actually exposed 
more problems in the original Scalar code: the SetValueFromData routine didn't 
work correctly for 128- and 256-bit data types, and the SChar routine should 
have an explicit "signed char" return type to work correctly on platforms where 
char defaults to unsigned.

Regression testing on Intel revealed a bug in my original patch: since Scalar 
only accepts APInt initializers with a bit size that is a power of 2, we may 
need to extend some values before converting them to Scalar.  This occured for 
values representing 10-byte Intel long double data.

Tested on System z and Intel.


http://reviews.llvm.org/D18981

Files:
  include/lldb/Core/Scalar.h
  include/lldb/Symbol/Type.h
  source/Core/Scalar.cpp
  source/Expression/IRInterpreter.cpp
  source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  source/Symbol/ClangASTContext.cpp
  unittests/Core/ScalarTest.cpp

Index: unittests/Core/ScalarTest.cpp
===
--- unittests/Core/ScalarTest.cpp
+++ unittests/Core/ScalarTest.cpp
@@ -15,7 +15,10 @@
 
 #include "gtest/gtest.h"
 
+#include "lldb/Core/Error.h"
 #include "lldb/Core/Scalar.h"
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Host/Endian.h"
 
 using namespace lldb_private;
 
@@ -30,3 +33,49 @@
 ASSERT_EQ(a >> c, a_scalar >> c_scalar);
 ASSERT_EQ(b >> c, b_scalar >> c_scalar);
 }
+
+TEST(ScalarTest, GetBytes)
+{
+int a = 0x01020304;
+long long b = 0x0102030405060708LL;
+float c = 1234567.89e42;
+double d = 1234567.89e42;
+char e[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+char f[32] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+   17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 };
+Scalar a_scalar(a);
+Scalar b_scalar(b);
+Scalar c_scalar(c);
+Scalar d_scalar(d);
+Scalar e_scalar;
+Scalar f_scalar;
+DataExtractor e_data(e, sizeof(e), endian::InlHostByteOrder(), sizeof(void *));
+Error e_error = e_scalar.SetValueFromData(e_data, lldb::eEncodingUint, sizeof(e));
+DataExtractor f_data(f, sizeof(f), endian::InlHostByteOrder(), sizeof(void *));
+Error f_error = f_scalar.SetValueFromData(f_data, lldb::eEncodingUint, sizeof(f));
+ASSERT_EQ(0, memcmp(&a, a_scalar.GetBytes(), sizeof(a)));
+ASSERT_EQ(0, memcmp(&b, b_scalar.GetBytes(), sizeof(b)));
+ASSERT_EQ(0, memcmp(&c, c_scalar.GetBytes(), sizeof(c)));
+ASSERT_EQ(0, memcmp(&d, d_scalar.GetBytes(), sizeof(d)));
+ASSERT_EQ(0, e_error.Fail());
+ASSERT_EQ(0, memcmp(e, e_scalar.GetBytes(), sizeof(e)));
+ASSERT_EQ(0, f_error.Fail());
+ASSERT_EQ(0, memcmp(f, f_scalar.GetBytes(), sizeof(f)));
+}
+
+TEST(ScalarTest, CastOperations)
+{
+long long a = 0xf1f2f3f4f5f6f7f8LL;
+Scalar a_scalar(a);
+ASSERT_EQ((signed char)a, a_scalar.SChar());
+ASSERT_EQ((unsigned char)a, a_scalar.UChar());
+ASSERT_EQ((signed short)a, a_scalar.SShort());
+ASSERT_EQ((unsigned short)a, a_scalar.UShort());
+ASSERT_EQ((signed int)a, a_scalar.SInt());
+ASSERT_EQ((unsigned int)a, a_scalar.UInt());
+ASSERT_EQ((signed long)a, a_scalar.SLong());
+ASSERT_EQ((unsigned long)a, a_scalar.ULong());
+ASSERT_EQ((signed long long)a, a_scalar.SLongLong());
+ASSERT_EQ((unsigned long long)a, a_scalar.ULongLong());
+}
+
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -72,6 +72,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/Scalar.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/ThreadSafeDenseMap.h"
 #include "lldb/Core/UniqueCStringMap.h"
@@ -8609,18 +8610,10 @@
 const uint64_t byte_size = bit_size / 8;
 if (dst_size >= byte_size)
 {
-if (bit_size == sizeof(float)*8)
-{
-float float32 = ap_float.convertToFloat();
-::memcpy (dst, &float32, byte_size);
+Scalar scalar = ap_float.bitcastToAPInt().zextOrTrunc(llvm::NextPowerOf2(byte_size) * 8);
+lldb_private::Error get_data_error;
+if (scalar.GetAsMemoryData(dst, byte_size, lldb_private::endian::InlHostByteOrder(), get_data_error))
 return byte_size;
-}
-else if (bit_size >= 64)
-{
-llvm::APInt ap_int(ap_float.bitcastToAPInt());
-::memcpy (dst, ap_int.getRawData(), byte_size);
-return byte_size;
-}
 }
 }
 }
Inde

Re: [Lldb-commits] [PATCH] D18977: Add new ABI callback to provide fallback unwind register locations

2016-04-13 Thread Jason Molenda via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.

Hi Tamas & Ulrich.  I'm good with this patch, thanks for double checking that 
detail for me.


http://reviews.llvm.org/D18977



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


Re: [Lldb-commits] [PATCH] D18982: Handle bit fields on big-endian systems correctly

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand updated this revision to Diff 53605.
uweigand added a comment.

Updated interface documentation in DataExtractor.h.

Added unit test case for the DataExtractor::GetMaxU64Bitfield and 
GetMaxS64Bitfield routines.

Retested on System z and Intel.


http://reviews.llvm.org/D18982

Files:
  include/lldb/Core/DataExtractor.h
  source/Core/DataExtractor.cpp
  source/Core/ValueObject.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/DataExtractorTest.cpp

Index: unittests/Core/DataExtractorTest.cpp
===
--- unittests/Core/DataExtractorTest.cpp
+++ unittests/Core/DataExtractorTest.cpp
@@ -0,0 +1,39 @@
+//===-- DataExtractorTest.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Workaround for MSVC standard library bug, which fails to include  when
+// exceptions are disabled.
+#include 
+#endif
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/DataExtractor.h"
+
+using namespace lldb_private;
+
+TEST(DataExtractorTest, GetBitfield)
+{
+char buffer[] = { 0x01, 0x23, 0x45, 0x67 };
+DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle, sizeof(void *));
+DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
+
+lldb::offset_t offset;
+
+offset = 0;
+ASSERT_EQ(buffer[1], LE.GetMaxU64Bitfield(&offset, sizeof(buffer), 8, 8));
+offset = 0;
+ASSERT_EQ(buffer[1], BE.GetMaxU64Bitfield(&offset, sizeof(buffer), 8, 8));
+
+offset = 0;
+ASSERT_EQ(buffer[1], LE.GetMaxS64Bitfield(&offset, sizeof(buffer), 8, 8));
+offset = 0;
+ASSERT_EQ(buffer[1], BE.GetMaxS64Bitfield(&offset, sizeof(buffer), 8, 8));
+}
Index: unittests/Core/CMakeLists.txt
===
--- unittests/Core/CMakeLists.txt
+++ unittests/Core/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_lldb_unittest(LLDBCoreTests
+  DataExtractorTest.cpp
   ScalarTest.cpp
   )
Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -2146,15 +2146,19 @@
 synthetic_child_sp = GetSyntheticChild (index_const_str);
 if (!synthetic_child_sp)
 {
+uint32_t bit_field_size = to - from + 1;
+uint32_t bit_field_offset = from;
+if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
+bit_field_offset = GetByteSize() * 8 - bit_field_size - bit_field_offset;
 // We haven't made a synthetic array member for INDEX yet, so
 // lets make one and cache it for any future reference.
 ValueObjectChild *synthetic_child = new ValueObjectChild (*this,
   GetCompilerType(),
   index_const_str,
   GetByteSize(),
   0,
-  to-from+1,
-  from,
+  bit_field_size,
+  bit_field_offset,
   false,
   false,
   eAddressTypeInvalid,
Index: source/Core/DataExtractor.cpp
===
--- source/Core/DataExtractor.cpp
+++ source/Core/DataExtractor.cpp
@@ -733,8 +733,11 @@
 uint64_t uval64 = GetMaxU64 (offset_ptr, size);
 if (bitfield_bit_size > 0)
 {
-if (bitfield_bit_offset > 0)
-uval64 >>= bitfield_bit_offset;
+int32_t lsbcount = bitfield_bit_offset;
+if (m_byte_order == eByteOrderBig)
+lsbcount = size * 8 - bitfield_bit_offset - bitfield_bit_size;
+if (lsbcount > 0)
+uval64 >>= lsbcount;
 uint64_t bitfield_mask = ((1ul << bitfield_bit_size) - 1);
 if (!bitfield_mask && bitfield_bit_offset == 0 && bitfield_bit_size == 64)
 return uval64;
@@ -749,8 +752,11 @@
 int64_t sval64 = GetMaxS64 (offset_ptr, size);
 if (bitfield_bit_size > 0)
 {
-if (bitfield_bit_offset > 0)
-sval64 >>= bitfield_bit_offset;
+int32_t lsbcount = bitfield_bit_offset;
+if

[Lldb-commits] [PATCH] D19067: Make sure to use lib instead of lib64 for LLDB_LIB_DIR

2016-04-13 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: zturner, vharron, emaste.
fjricci added subscribers: sas, lldb-commits.

$(lldb -P)/../../ is assumed to be the lldb library directory
by the test suite. However, it is possible that the python
libs would be installed in build/lib64 instead of build/lib.
Since liblldb.so is always installed in lib,
make sure this is always used as LLDB_LIB_DIR.

In cases where the python libs were already in build/lib, this
patch will not affect LLDB_LIB_DIR.

http://reviews.llvm.org/D19067

Files:
  packages/Python/lldbsuite/test/dotest.py

Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -635,7 +635,7 @@
 if len(lines) >= 1 and os.path.isfile(os.path.join(lines[-1], 
init_in_python_dir)):
 lldbPythonDir = lines[-1]
 if "freebsd" in sys.platform or "linux" in sys.platform:
-os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPythonDir, 
'..', '..')
+os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPythonDir, 
'..', '..', '..', 'lib')
 
 if not lldbPythonDir:
 if platform.system() == "Darwin":


Index: packages/Python/lldbsuite/test/dotest.py
===
--- packages/Python/lldbsuite/test/dotest.py
+++ packages/Python/lldbsuite/test/dotest.py
@@ -635,7 +635,7 @@
 if len(lines) >= 1 and os.path.isfile(os.path.join(lines[-1], init_in_python_dir)):
 lldbPythonDir = lines[-1]
 if "freebsd" in sys.platform or "linux" in sys.platform:
-os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPythonDir, '..', '..')
+os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPythonDir, '..', '..', '..', 'lib')
 
 if not lldbPythonDir:
 if platform.system() == "Darwin":
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18977: Add new ABI callback to provide fallback unwind register locations

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand added a comment.

In http://reviews.llvm.org/D18977#400047, @clayborg wrote:

> Is the SystemZ ABI not in this patch? Looks good otherwise as long as Jason 
> Molenda is OK with the patch.


The SystemZ ABI is in http://reviews.llvm.org/D18978, which I just re-uploaded.


http://reviews.llvm.org/D18977



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


Re: [Lldb-commits] [PATCH] D18977: Add new ABI callback to provide fallback unwind register locations

2016-04-13 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Is the SystemZ ABI not in this patch? Looks good otherwise as long as Jason 
Molenda is OK with the patch.


http://reviews.llvm.org/D18977



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


Re: [Lldb-commits] [PATCH] D19052: Make destructor breakpoint location test more resilient

2016-04-13 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.


http://reviews.llvm.org/D19052



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


Re: [Lldb-commits] [PATCH] D19004: Use the section sizes to determine symbols sizes in the Symtab instead of just using the following symbol's address

2016-04-13 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/D19004



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


Re: [Lldb-commits] [PATCH] D18985: Fix test cases for big-endian systems

2016-04-13 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, thanks for updating the changes.


http://reviews.llvm.org/D18985



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


Re: [Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Zachary Turner via lldb-commits
Ok sounds good
On Wed, Apr 13, 2016 at 9:56 AM Pavel Labath  wrote:

> labath added a comment.
>
> In http://reviews.llvm.org/D19060#399915, @zturner wrote:
>
> > Ahh that's unfortunate. I guess the thing to do is make SetFile and
> >  SetDirectory. At least by changing the return type we can get the
> compiler
> >  to tell us everywhere this is happening. Did you run the test suite on
> >  Windows to make sure this doesnt break anything?
>
>
> Yeah, I had something like that in mind.
>
> I didn't run the windows test suite, but I'd be very surprised if it broke
> anything, since I'm basically just restoring the previous behavior (before
> I started messing with this function, we were always running the
> normalization).
>
>
> http://reviews.llvm.org/D19060
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Pavel Labath via lldb-commits
labath added a comment.

In http://reviews.llvm.org/D19060#399915, @zturner wrote:

> Ahh that's unfortunate. I guess the thing to do is make SetFile and
>  SetDirectory. At least by changing the return type we can get the compiler
>  to tell us everywhere this is happening. Did you run the test suite on
>  Windows to make sure this doesnt break anything?


Yeah, I had something like that in mind.

I didn't run the windows test suite, but I'd be very surprised if it broke 
anything, since I'm basically just restoring the previous behavior (before I 
started messing with this function, we were always running the normalization).


http://reviews.llvm.org/D19060



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


Re: [Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Zachary Turner via lldb-commits
Ahh that's unfortunate. I guess the thing to do is make SetFile and
SetDirectory. At least by changing the return type we can get the compiler
to tell us everywhere this is happening. Did you run the test suite on
Windows to make sure this doesnt break anything?
On Wed, Apr 13, 2016 at 8:36 AM Pavel Labath  wrote:

> labath added a comment.
>
> It's a bit more complicated than it seems. GetDirectory() returns a
> reference into the FileSpec, and a lot of code modifies it through it.
> Changing that would require fixups in all of the users, which I'd want to
> do separately.
>
> But I do agree that this is the best way forward.
>
>
> http://reviews.llvm.org/D19060
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Pavel Labath via lldb-commits
labath added a comment.

It's a bit more complicated than it seems. GetDirectory() returns a reference 
into the FileSpec, and a lot of code modifies it through it. Changing that 
would require fixups in all of the users, which I'd want to do separately.

But I do agree that this is the best way forward.


http://reviews.llvm.org/D19060



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


Re: [Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Zachary Turner via lldb-commits
The expected behavior imo is to normalize before returning in
GetDirectory(). Perhaps you could add a boolean with default value true?
On Wed, Apr 13, 2016 at 8:26 AM Pavel Labath  wrote:

> labath created this revision.
> labath added a reviewer: zturner.
> labath added a subscriber: lldb-commits.
>
> In D18689, I removed the call to Normalize() in FileSpec::SetFile, because
> it no longer seemed
> needed, and it resolved a quirk in the FileSpec API (spec.GetCString()
> returnes a path with
> backslashes, but spec.GetDirectory().GetCString() has forward slashes).
> This turned out to be a
> problem because we would consider paths with different separators as
> different (which led to
> unresolved breakpoints for instance).
>
> Here, I am putting back in the call to Normalize() and adding a unittest
> for FileSpec::Equal. I
> am commenting out the GetDirectory unittests until we figure out the what
> is the expected
> behaviour here.
>
> http://reviews.llvm.org/D19060
>
> Files:
>   source/Host/common/FileSpec.cpp
>   unittests/Host/FileSpecTest.cpp
>
> Index: unittests/Host/FileSpecTest.cpp
> ===
> --- unittests/Host/FileSpecTest.cpp
> +++ unittests/Host/FileSpecTest.cpp
> @@ -22,7 +22,7 @@
>
>  FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
>  EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
> -EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString());
> +// EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString()); //
> It returns "F:/"
>  EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
>
>  FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
> @@ -38,16 +38,16 @@
>  FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
>  EXPECT_STREQ("F:\\", fs_windows_root.GetCString());
>  EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
> -EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString());
> +// EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString()); //
> It returns "/"
>
>  FileSpec fs_posix_long("/foo/bar/baz", false,
> FileSpec::ePathSyntaxPosix);
>  EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString());
>  EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString());
>  EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString());
>
>  FileSpec fs_windows_long("F:\\bar\\baz", false,
> FileSpec::ePathSyntaxWindows);
>  EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
> -EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
> +// EXPECT_STREQ("F:\\bar",
> fs_windows_long.GetDirectory().GetCString()); // It returns "F:/bar"
>  EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
>
>  FileSpec fs_posix_trailing_slash("/foo/bar/", false,
> FileSpec::ePathSyntaxPosix);
> @@ -57,7 +57,7 @@
>
>  FileSpec fs_windows_trailing_slash("F:\\bar\\", false,
> FileSpec::ePathSyntaxWindows);
>  EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString());
> -EXPECT_STREQ("F:\\bar",
> fs_windows_trailing_slash.GetDirectory().GetCString());
> +// EXPECT_STREQ("F:\\bar",
> fs_windows_trailing_slash.GetDirectory().GetCString()); // It returns
> "F:/bar"
>  EXPECT_STREQ(".",
> fs_windows_trailing_slash.GetFilename().GetCString());
>  }
>
> @@ -72,7 +72,7 @@
>  FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
>  fs_windows.AppendPathComponent("baz");
>  EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString());
> -EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString());
> +// EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString());
> // It returns "F:/bar"
>  EXPECT_STREQ("baz", fs_windows.GetFilename().GetCString());
>
>  FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
> @@ -84,7 +84,7 @@
>  FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
>  fs_windows_root.AppendPathComponent("bar");
>  EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
> -EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString());
> +// EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString());
> // It returns "F:/"
>  EXPECT_STREQ("bar", fs_windows_root.GetFilename().GetCString());
>  }
>
> @@ -95,3 +95,17 @@
>  EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
>  EXPECT_STREQ("bar", fs.GetFilename().GetCString());
>  }
> +
> +TEST(FileSpecTest, Equal)
> +{
> +FileSpec backward("C:\\foo\\bar", false,
> FileSpec::ePathSyntaxWindows);
> +FileSpec forward("C:/foo/bar", false, FileSpec::ePathSyntaxWindows);
> +EXPECT_EQ(forward, backward);
> +
> +const bool full_match = true;
> +const bool remove_backup_dots = true;
> +EXPECT_TRUE(FileSpec::Equal(forward, backward, full_match,
> remove_backup_dots));
> +EXPECT_TRUE(FileSpec::Equal(forward, backward, full_match,
> !

[Lldb-commits] [PATCH] D19060: FileSpec: make matching separator-agnostic again

2016-04-13 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: zturner.
labath added a subscriber: lldb-commits.

In D18689, I removed the call to Normalize() in FileSpec::SetFile, because it 
no longer seemed
needed, and it resolved a quirk in the FileSpec API (spec.GetCString() returnes 
a path with
backslashes, but spec.GetDirectory().GetCString() has forward slashes). This 
turned out to be a
problem because we would consider paths with different separators as different 
(which led to
unresolved breakpoints for instance).

Here, I am putting back in the call to Normalize() and adding a unittest for 
FileSpec::Equal. I
am commenting out the GetDirectory unittests until we figure out the what is 
the expected
behaviour here.

http://reviews.llvm.org/D19060

Files:
  source/Host/common/FileSpec.cpp
  unittests/Host/FileSpecTest.cpp

Index: unittests/Host/FileSpecTest.cpp
===
--- unittests/Host/FileSpecTest.cpp
+++ unittests/Host/FileSpecTest.cpp
@@ -22,7 +22,7 @@
 
 FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
-EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString());
+// EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString()); // It 
returns "F:/"
 EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
 
 FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
@@ -38,16 +38,16 @@
 FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\", fs_windows_root.GetCString());
 EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
-EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString());
+// EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString()); // It 
returns "/"
 
 FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::ePathSyntaxPosix);
 EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString());
 EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString());
 EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString());
 
 FileSpec fs_windows_long("F:\\bar\\baz", false, 
FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
-EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
+// EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString()); 
// It returns "F:/bar"
 EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
 
 FileSpec fs_posix_trailing_slash("/foo/bar/", false, 
FileSpec::ePathSyntaxPosix);
@@ -57,7 +57,7 @@
 
 FileSpec fs_windows_trailing_slash("F:\\bar\\", false, 
FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString());
-EXPECT_STREQ("F:\\bar", 
fs_windows_trailing_slash.GetDirectory().GetCString());
+// EXPECT_STREQ("F:\\bar", 
fs_windows_trailing_slash.GetDirectory().GetCString()); // It returns "F:/bar"
 EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString());
 }
 
@@ -72,7 +72,7 @@
 FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
 fs_windows.AppendPathComponent("baz");
 EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString());
-EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString());
+// EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString()); // It 
returns "F:/bar"
 EXPECT_STREQ("baz", fs_windows.GetFilename().GetCString());
 
 FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
@@ -84,7 +84,7 @@
 FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
 fs_windows_root.AppendPathComponent("bar");
 EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
-EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString());
+// EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString()); // 
It returns "F:/"
 EXPECT_STREQ("bar", fs_windows_root.GetFilename().GetCString());
 }
 
@@ -95,3 +95,17 @@
 EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
 EXPECT_STREQ("bar", fs.GetFilename().GetCString());
 }
+
+TEST(FileSpecTest, Equal)
+{
+FileSpec backward("C:\\foo\\bar", false, FileSpec::ePathSyntaxWindows);
+FileSpec forward("C:/foo/bar", false, FileSpec::ePathSyntaxWindows);
+EXPECT_EQ(forward, backward);
+
+const bool full_match = true;
+const bool remove_backup_dots = true;
+EXPECT_TRUE(FileSpec::Equal(forward, backward, full_match, 
remove_backup_dots));
+EXPECT_TRUE(FileSpec::Equal(forward, backward, full_match, 
!remove_backup_dots));
+EXPECT_TRUE(FileSpec::Equal(forward, backward, !full_match, 
remove_backup_dots));
+EXPECT_TRUE(FileSpec::Equal(forward, backward, !full_match, 
!remove_backup_dots));
+}
Index: source/Host/common/FileSpec.cpp
===
--- source/Host/common/FileSpec.cpp
+++ source/Host/common/FileSpec.cpp

Re: [Lldb-commits] [PATCH] D18976: Handle lookup of names identifying both a variable and a type

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand updated this revision to Diff 53553.
uweigand added a comment.

Add test case.


http://reviews.llvm.org/D18976

Files:
  packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
  packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -866,8 +866,11 @@
  current_id);
 }
 
-if (!context.m_found.variable)
-ClangASTSource::FindExternalVisibleDecls(context);
+// Always call into ClangASTSource::FindExternalVisibleDecls, even if we 
already found
+// some decls above.  It might be that Clang is looking for a type, but we 
have found
+// a variable of the same name instead.  Let ClangASTSource add the type 
to the result
+// list as well; Clang will filter out the decl it is actually interested 
in.
+ClangASTSource::FindExternalVisibleDecls(context);
 }
 
 void
Index: packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
===
--- packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
@@ -19,6 +19,10 @@
 int C::a = ;
 int a = ;
 
+// Verify that LLDB is able to parse "C::a" even when "C" exists both as a
+// type name and a variable name at the same time.
+int C = ;
+
 int main() // break here
 {
 return 0;
Index: packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
===
--- packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
+++ packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
@@ -54,10 +54,12 @@
 'B::a': ,
 'C::a': ,
 '::a': ,
-'a': 
+'a': ,
+'::C': ,
+'C': 
 }
 
-self.assertTrue(global_variables.GetSize() == 4, "target variable 
returns all variables")
+self.assertTrue(global_variables.GetSize() == 5, "target variable 
returns all variables")
 for variable in global_variables:
 name = variable.GetName()
 self.assertTrue(name in global_variables_assert, "target variable 
returns wrong variable " + name)


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -866,8 +866,11 @@
  current_id);
 }
 
-if (!context.m_found.variable)
-ClangASTSource::FindExternalVisibleDecls(context);
+// Always call into ClangASTSource::FindExternalVisibleDecls, even if we already found
+// some decls above.  It might be that Clang is looking for a type, but we have found
+// a variable of the same name instead.  Let ClangASTSource add the type to the result
+// list as well; Clang will filter out the decl it is actually interested in.
+ClangASTSource::FindExternalVisibleDecls(context);
 }
 
 void
Index: packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
===
--- packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
+++ packages/Python/lldbsuite/test/lang/cpp/scope/main.cpp
@@ -19,6 +19,10 @@
 int C::a = ;
 int a = ;
 
+// Verify that LLDB is able to parse "C::a" even when "C" exists both as a
+// type name and a variable name at the same time.
+int C = ;
+
 int main() // break here
 {
 return 0;
Index: packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
===
--- packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
+++ packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
@@ -54,10 +54,12 @@
 'B::a': ,
 'C::a': ,
 '::a': ,
-'a': 
+'a': ,
+'::C': ,
+'C': 
 }
 
-self.assertTrue(global_variables.GetSize() == 4, "target variable returns all variables")
+self.assertTrue(global_variables.GetSize() == 5, "target variable returns all variables")
 for variable in global_variables:
 name = variable.GetName()
 self.assertTrue(name in global_variables_assert, "target variable returns wrong variable " + name)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r266197 - Match types in for loop to fix signedness comparison warning

2016-04-13 Thread Ed Maste via lldb-commits
Author: emaste
Date: Wed Apr 13 08:32:06 2016
New Revision: 266197

URL: http://llvm.org/viewvc/llvm-project?rev=266197&view=rev
Log:
Match types in for loop to fix signedness comparison warning

Modified:
lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=266197&r1=266196&r2=266197&view=diff
==
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Wed Apr 13 08:32:06 2016
@@ -969,7 +969,7 @@ Symtab::InitAddressIndexes()
 // entries that didn't already have a size from the Symbol (e.g. 
if we
 // have a plain linker symbol with an address only, instead of 
debug info
 // where we get an address and a size and a type, etc.)
-for (int i = 0; i < num_entries; i++)
+for (size_t i = 0; i < num_entries; i++)
 {
 FileRangeToIndexMap::Entry *entry = 
m_file_addr_to_index.GetMutableEntryAtIndex (i);
 if (entry->GetByteSize() == 0)
@@ -986,7 +986,7 @@ Symtab::InitAddressIndexes()
 (entry->GetRangeBase() - 
containing_section->GetRangeBase());
 }
 
-for (int j = i; j < num_entries; j++)
+for (size_t j = i; j < num_entries; j++)
 {
 FileRangeToIndexMap::Entry *next_entry = 
m_file_addr_to_index.GetMutableEntryAtIndex (j);
 addr_t next_base_addr = next_entry->GetRangeBase();


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


[Lldb-commits] [lldb] r266196 - Remove obsolete comments

2016-04-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Apr 13 08:26:45 2016
New Revision: 266196

URL: http://llvm.org/viewvc/llvm-project?rev=266196&view=rev
Log:
Remove obsolete comments

Modified:
lldb/trunk/unittests/Host/FileSpecTest.cpp

Modified: lldb/trunk/unittests/Host/FileSpecTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSpecTest.cpp?rev=266196&r1=266195&r2=266196&view=diff
==
--- lldb/trunk/unittests/Host/FileSpecTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSpecTest.cpp Wed Apr 13 08:26:45 2016
@@ -47,7 +47,6 @@ TEST(FileSpecTest, FileAndDirectoryCompo
 
 FileSpec fs_windows_long("F:\\bar\\baz", false, 
FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
-// We get "F:/bar" instead.
 EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
 EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
 
@@ -58,7 +57,6 @@ TEST(FileSpecTest, FileAndDirectoryCompo
 
 FileSpec fs_windows_trailing_slash("F:\\bar\\", false, 
FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString());
-// We get "F:/bar" instead.
 EXPECT_STREQ("F:\\bar", 
fs_windows_trailing_slash.GetDirectory().GetCString());
 EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString());
 }


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


Re: [Lldb-commits] [PATCH] D18976: Handle lookup of names identifying both a variable and a type

2016-04-13 Thread Pavel Labath via lldb-commits
labath added a comment.

I think adding it to the extending the existing test is fine, given that it's a 
fairly small one. (In case of large tests, it's better to make a new one, so it 
can be debugged/xfailed independently). Maybe just add `int C` so that we test 
both the situation when we have a variable, and when we don't?


http://reviews.llvm.org/D18976



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


Re: [Lldb-commits] [PATCH] D18976: Handle lookup of names identifying both a variable and a type

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand added a comment.

In http://reviews.llvm.org/D18976#399633, @labath wrote:

> I think having a self-contained test for this issue (one which does not rely 
> on internals of some system library) would be extremely valuable. Could you 
> add one?


Well, a simple way would be to just add something like

  int A, B, C;

to the lang/cpp/scope/main.cpp test case.   Would that be OK or do you prefer a 
completely separate test?


http://reviews.llvm.org/D18976



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


Re: [Lldb-commits] [PATCH] D18984: Fix ARM instruction emulation tests on big-endian systems

2016-04-13 Thread Muhammad Omair Javaid via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.

LGTM


http://reviews.llvm.org/D18984



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


Re: [Lldb-commits] [PATCH] D18976: Handle lookup of names identifying both a variable and a type

2016-04-13 Thread Pavel Labath via lldb-commits
labath added a subscriber: labath.
labath added a comment.

I think having a self-contained test for this issue (one which does not rely on 
internals of some system library) would be extremely valuable. Could you add 
one?


http://reviews.llvm.org/D18976



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


[Lldb-commits] [lldb] r266192 - Fix test rerun logic

2016-04-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Apr 13 07:05:48 2016
New Revision: 266192

URL: http://llvm.org/viewvc/llvm-project?rev=266192&view=rev
Log:
Fix test rerun logic

result_formatter used inspect.getfile() to get the python file name, which 
returned "*.pyc" if
the bytecode file was present. This resulted in files being displayed with the 
wrong extension,
and more critically, would confuse the rerun logic because it would try to 
rerun the pyc file
(which resulted in an empty rerun list as unittest refused to run those).

Fix: use inspect.getsourcefile() instead.

I am not sure why does was not an issue before. I can only assume that some 
system update
tricked python into producing bytecode files more aggressively.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py?rev=266192&r1=266191&r2=266192&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py Wed Apr 13 
07:05:48 2016
@@ -247,7 +247,7 @@ class EventBuilder(object):
 if hasattr(test, "test_filename"):
 test_filename = test.test_filename
 else:
-test_filename = inspect.getfile(test.__class__)
+test_filename = inspect.getsourcefile(test.__class__)
 
 event = EventBuilder.bare_event(event_type)
 event.update({


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


Re: [Lldb-commits] [PATCH] D18977: Add new ABI callback to provide fallback unwind register locations

2016-04-13 Thread Ulrich Weigand via lldb-commits
uweigand added a comment.

In http://reviews.llvm.org/D18977#399344, @jasonmolenda wrote:

> Just to be clear, my concern is we get an register location which is 
> "undefined" (I've never seen it, I don't know what it means) and now 
> SavedLocationForRegister() will say "this register is volatile, not looking 
> any further" when it used to say "register not found in this stack frame" and 
> the unwinder would keep looking down the stack for a save location.


Note that the default state of a register location if no CFI was found at all 
is "unspecified", which my patch leaves unchanged.  A register location can 
only be "undefined" if it was explicitly set to that state.  The only way this 
can happen, except for my new code in the GetFallbackRegisterLocation, is as a 
result of a DW_CFA_undefined entry in DWARF CFI.

As Tamas points out, that DWARF opcode is defined to mean the register is not 
recoverable in this frame, i.e. treating it as "volatile" should do exactly the 
right thing.  (Note that this may be mostly theoretical, since I've not seen 
any compiler ever in fact issue DW_CFA_undefined ...)

This is was I was briefly alluding to in my original comment "this might now 
theoretically also trigger when CFI contains an explicit DW_CFA_undefined, but 
it should actually do the right thing then as well."


http://reviews.llvm.org/D18977



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


Re: [Lldb-commits] [PATCH] D18880: -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-13 Thread Hafiz Abid Qadeer via lldb-commits
abidh added a comment.

In http://reviews.llvm.org/D18880#395530, @zturner wrote:

> Looks fine to me.  TBH I haven't seen any of the lldb-mi owners around in 
> months, so I'm not sure if they're still active


Sorry for late reply. I have been busy lately but keep an eye on lldb-mi 
patches.


http://reviews.llvm.org/D18880



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


[Lldb-commits] [PATCH] D19052: Make destructor breakpoint location test more resilient

2016-04-13 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added subscribers: lldb-commits, zturner, ovyalov.

The original breakpoint location test was failing for linux, because the 
compilers here tend to
merge the full-object and subobject destructors even at -O0 (as a result, we 
are getting only 2
breakpoint locations, and not 4 as the test expected. The fixup in r266164 
substantially weakened
the test, as it now did not check whether both kinds of destructors were being 
found.

Because of these contraints, I have altered the logic of the test. It sets the
breakpoint by name, and then independently verifies that the breakpoint is set 
on the correct
demangled symbol name (which is not very meaningful since both kinds of 
destructors demangle to
the same name) *and* the correct symbol address (which is obtained by looking 
up the mangled
symbol name).

http://reviews.llvm.org/D19052

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py

Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
===
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -26,7 +26,7 @@
 name = bp_dict['name']
 names = bp_dict['loc_names']
 bp = target.BreakpointCreateByName (name)
-self.assertTrue (bp.GetNumLocations() <= len(names), "Make sure we 
find the right number of breakpoint locations")
+self.assertEquals(bp.GetNumLocations(), len(names), "Make sure we find 
the right number of breakpoint locations")
 
 bp_loc_names = list()
 for bp_loc in bp:
@@ -48,19 +48,48 @@
 { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 
'b::c::func1()'] },
 { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 
'c::d::func2()'] },
 { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 
'b::c::func3()', 'c::d::func3()'] },
-{ 'name' : '~c', 'loc_names' : [ 'a::c::~c()', 'b::c::~c()', 
'a::c::~c()', 'b::c::~c()'] },
 { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 
'b::c::func1()'] },
 { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] },
 { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 
'b::c::func3()'] },
-{ 'name' : 'c::~c', 'loc_names' : [ 'a::c::~c()', 'b::c::~c()', 
'a::c::~c()', 'b::c::~c()'] },
 { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] },
 { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] },
 { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] },
 { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] },
 { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] },
 { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] },
-{ 'name' : 'c::~c()', 'loc_names' : [ 'a::c::~c()', 'b::c::~c()', 
'a::c::~c()', 'b::c::~c()'] },
 ]
 
 for bp_dict in bp_dicts:
 self.verify_breakpoint_locations(target, bp_dict)
+
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
+def test_destructors(self):
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+
+# Don't skip prologue, so we can check the breakpoint address more 
easily
+self.runCmd("settings set target.skip-prologue false")
+try:
+names = ['~c', 'c::~c', 'c::~c()']
+loc_names = {'a::c::~c()', 'b::c::~c()'}
+# TODO: For windows targets we should put windows mangled names 
here
+symbols = ['_ZN1a1cD1Ev', '_ZN1a1cD2Ev', '_ZN1b1cD1Ev', 
'_ZN1b1cD2Ev']
+
+for name in names:
+bp = target.BreakpointCreateByName(name)
+
+bp_loc_names = { bp_loc.GetAddress().GetFunction().GetName() 
for bp_loc in bp }
+self.assertEquals(bp_loc_names, loc_names, "Breakpoint set on 
the correct symbol")
+
+bp_addresses = { bp_loc.GetLoadAddress() for bp_loc in bp }
+symbol_addresses = set()
+for symbol in symbols:
+sc_list = target.FindSymbols(symbol, lldb.eSymbolTypeCode)
+self.assertEquals(sc_list.GetSize(), 1)
+symbol = sc_list.GetContextAtIndex(0).GetSymbol()
+
symbol_addresses.add(symbol.GetStartAddress().GetLoadAddress(target))
+
+self.assertEquals(symbol_addresses, bp_addresses, "Breakpoint 
set on correct address")
+finally:
+self.runCmd("settings clear target.skip-prologue")


Index: packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
==

Re: [Lldb-commits] [PATCH] D18977: Add new ABI callback to provide fallback unwind register locations

2016-04-13 Thread Tamas Berghammer via lldb-commits
tberghammer added a subscriber: tberghammer.
tberghammer added a comment.

My understanding of the eh_frame is that "undefined" means the value of the 
register is not recoverable in the current frame (default for volatile 
registers) while the meaning of "same" is that this frame haven't messed with 
the register so we should continue looking for its value down the stack. Based 
on this I think this change is doing the right thing and our previous 
implementation is the one what is incorrect in some case.

The relevant information from the dwarf spec (from section 6.4.1):

> undefined: A register that has this rule has no recoverable value in the 
> previous frame. (By convention, it is not preserved by a callee.)

>  same value: This register has not been modified from the previous frame. (By 
> convention, it is preserved by the callee, but the callee has not modified 
> it.)


Additionally I run this code through TestStandartUnwind on ARM what is a basic 
stress test for the unwinding system and it detected no issues.


http://reviews.llvm.org/D18977



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


Re: [Lldb-commits] [PATCH] D18984: Fix ARM instruction emulation tests on big-endian systems

2016-04-13 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.

Looks good


http://reviews.llvm.org/D18984



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


Re: [Lldb-commits] [Diffusion] rL266139: Fixed being able to set breakpoints on destructors when we don't fully…

2016-04-13 Thread Tamas Berghammer via lldb-commits
tberghammer added subscribers: lldb-commits, tberghammer.

/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:333 I think 
we don't need the second '~' as now you are accepting things like 
``` ~~Foo, ~, ~~ ```
what shouldn't been accepted. I am happy to make the CL for removing it, but 
wanted to make sure I am not missing something.

http://reviews.llvm.org/rL266139



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