[Lldb-commits] [lldb] remove common libc tuners (PR #66136)

2023-09-13 Thread Siva Chandra via lldb-commits

https://github.com/sivachandra closed 
https://github.com/llvm/llvm-project/pull/66136
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] remove common libc tuners (PR #66136)

2023-09-13 Thread Siva Chandra via lldb-commits

https://github.com/sivachandra updated 
https://github.com/llvm/llvm-project/pull/66136:

>From d1a9fda20a2be37385b44dcbf2f73b1890fa7d78 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy 
Date: Tue, 12 Sep 2023 05:42:37 +
Subject: [PATCH 1/3] [libc][NFC] Make entrypoint alias targets real library
 targets.

This is part of a libc wide CMake cleanup which aims to eliminate
certain explicitly duplicated logic which is available in CMake-3.20.
This change in particular makes the entrypoint aliases real library
targets so that they can be treated as normal library targets by other
libc build rules.
---
 libc/cmake/modules/LLVMLibCObjectRules.cmake | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake 
b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 709acd9ad614fbe..006b8949b6fd0a1 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -559,6 +559,8 @@ function(create_entrypoint_object fq_target_name)
 return()
   endif()
 
+  set(internal_target_name ${fq_target_name}.__internal__)
+
   if(ADD_ENTRYPOINT_OBJ_ALIAS)
 # Alias targets help one add aliases to other entrypoint object targets.
 # One can use alias targets setup OS/machine independent entrypoint 
targets.
@@ -586,10 +588,23 @@ function(create_entrypoint_object fq_target_name)
   message(FATAL_ERROR "The aliasee of an entrypoint alias should be an 
entrypoint.")
 endif()
 
-add_custom_target(${fq_target_name})
-add_dependencies(${fq_target_name} ${fq_dep_name})
+# add_custom_target(${fq_target_name})
 get_target_property(object_file ${fq_dep_name} "OBJECT_FILE")
 get_target_property(object_file_raw ${fq_dep_name} "OBJECT_FILE_RAW")
+add_library(
+  ${internal_target_name}
+  EXCLUDE_FROM_ALL
+  OBJECT
+  ${object_file_raw}
+)
+add_dependencies(${internal_target_name} ${fq_dep_name})
+add_library(
+  ${fq_target_name}
+  EXCLUDE_FROM_ALL
+  OBJECT
+  ${object_file}
+)
+add_dependencies(${fq_target_name} ${fq_dep_name} ${internal_target_name})
 set_target_properties(
   ${fq_target_name}
   PROPERTIES
@@ -619,7 +634,6 @@ function(create_entrypoint_object fq_target_name)
 "${ADD_ENTRYPOINT_OBJ_FLAGS}"
 ${ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS}
   )
-  set(internal_target_name ${fq_target_name}.__internal__)
   set(include_dirs ${LIBC_SOURCE_DIR} ${LIBC_INCLUDE_DIR})
   get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
   set(full_deps_list ${fq_deps_list} libc.src.__support.common)

>From f0475c5918f4f645e45f05f8e07f472e9fd94559 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy 
Date: Tue, 12 Sep 2023 16:30:50 +
Subject: [PATCH 2/3] [libc][NFC] Remove stray comment.

---
 libc/cmake/modules/LLVMLibCObjectRules.cmake | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake 
b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 006b8949b6fd0a1..4d5835cc6b4d809 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -588,7 +588,6 @@ function(create_entrypoint_object fq_target_name)
   message(FATAL_ERROR "The aliasee of an entrypoint alias should be an 
entrypoint.")
 endif()
 
-# add_custom_target(${fq_target_name})
 get_target_property(object_file ${fq_dep_name} "OBJECT_FILE")
 get_target_property(object_file_raw ${fq_dep_name} "OBJECT_FILE_RAW")
 add_library(

>From 1eeb5e0eda3bdcf6d4eec6e1afac5c6c3f45 Mon Sep 17 00:00:00 2001
From: Siva Chandra Reddy 
Date: Mon, 11 Sep 2023 22:17:32 +
Subject: [PATCH 3/3] [libc] Remove common_libc_tuners.cmake and move options
 into config.json.

The name has been changed to adhere to the config option naming format.
The necessary build changes to use the new option have also been made.
---
 libc/CMakeLists.txt  |  2 --
 libc/cmake/modules/LLVMLibCObjectRules.cmake |  2 ++
 libc/common_libc_tuners.cmake| 14 --
 libc/config/config.json  |  6 ++
 libc/docs/configure.rst  |  2 ++
 libc/src/string/CMakeLists.txt   |  9 +
 libc/src/string/string_utils.h   |  4 ++--
 7 files changed, 21 insertions(+), 18 deletions(-)
 delete mode 100644 libc/common_libc_tuners.cmake

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 12fff25c197e2d9..cf90919c20fd969 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -64,8 +64,6 @@ add_compile_definitions(LIBC_NAMESPACE=${LIBC_NAMESPACE})
 # Flags to pass down to the compiler while building the libc functions.
 set(LIBC_COMPILE_OPTIONS_DEFAULT "" CACHE STRING "Architecture to tell clang 
to optimize for (e.g. -march=... or -mcpu=...)")
 
-include(common_libc_tuners.cmake)
-
 list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT ${LIBC_COMMON_TUNE_OPTIONS})
 
 # 

Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-13 Thread Siva Chandra via lldb-commits
On Mon, Oct 12, 2020 at 10:01 PM Galina Kistanova via lldb-commits
 wrote:
> If somebody else could move their AnnotatedCommand bots to the staging area, 
> that would be much appreciated.

I moved the libc bots to staging to now.

Thanks,
Siva Chandra
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r267478 - Fix StackFrame::GetVariables(...) function that was broken by 261858 when lambda functions were added to Block::AppendBlockVariables(). The Stackframe::GetVariables

2016-04-25 Thread Siva Chandra via lldb-commits
Clang is probably right. Why bother to emit an unused file static scalar?

On Mon, Apr 25, 2016 at 4:21 PM, Chaoren Lin  wrote:
> Ah, I see. Is that a known clang bug?
>
> On Mon, Apr 25, 2016 at 4:07 PM, Siva Chandra 
> wrote:
>>
>> AFAICT, happens only with Clang; Using g_static_var, say as "return
>> g_static_var - 123;", fixes for me.
>>
>> On Mon, Apr 25, 2016 at 3:50 PM, Chaoren Lin via lldb-commits
>>  wrote:
>> > Is g_global_var necessarily static?
>> >
>> > On Linux, we're only seeing 2 static variables when your test expects 3.
>> >
>> >>  static_names = ['static_var', 'g_global_var', 'static_var']
>> >
>> > I'm guessing g_global_var isn't treated as static.
>> >
>> > On Mon, Apr 25, 2016 at 2:54 PM, Greg Clayton via lldb-commits
>> >  wrote:
>> >>
>> >> Author: gclayton
>> >> Date: Mon Apr 25 16:54:10 2016
>> >> New Revision: 267478
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=267478=rev
>> >> Log:
>> >> Fix StackFrame::GetVariables(...) function that was broken by 261858
>> >> when
>> >> lambda functions were added to Block::AppendBlockVariables(). The
>> >> Stackframe::GetVariables(...) function should get all variables
>> >> regardless
>> >> if they are in scope.
>> >>
>> >> This wasn't caught by the test suite so I added a test for it.
>> >>
>> >>
>> >> Added:
>> >>
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/
>> >>
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> >>
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> >>
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/main.c
>> >> Modified:
>> >> lldb/trunk/source/Target/StackFrame.cpp
>> >>
>> >> Added:
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile?rev=267478=auto
>> >>
>> >>
>> >> ==
>> >> ---
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> >> (added)
>> >> +++
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> >> Mon Apr 25 16:54:10 2016
>> >> @@ -0,0 +1,5 @@
>> >> +LEVEL = ../../../make
>> >> +
>> >> +C_SOURCES := main.c
>> >> +
>> >> +include $(LEVEL)/Makefile.rules
>> >>
>> >> Added:
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py?rev=267478=auto
>> >>
>> >>
>> >> ==
>> >> ---
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> >> (added)
>> >> +++
>> >>
>> >> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> >> Mon Apr 25 16:54:10 2016
>> >> @@ -0,0 +1,190 @@
>> >> +"""
>> >> +Test that SBFrame::GetVariables() calls work correctly.
>> >> +"""
>> >> +
>> >> +from __future__ import print_function
>> >> +
>> >> +
>> >> +
>> >> +import os, time
>> >> +import lldb
>> >> +from lldbsuite.test.decorators import *
>> >> +from lldbsuite.test.lldbtest import *
>> >> +from lldbsuite.test import lldbplatform
>> >> +from lldbsuite.test import lldbutil
>> >> +
>> >> +def get_names_from_value_list(value_list):
>> >> +names = list()
>> >> +for value in value_list:
>> >> +names.append(value.GetName())
>> >> +return names
>> >> +
>> >> +class TestGetVariables(TestBase):
>> >> +
>> >> +mydir = TestBase.compute_mydir(__file__)
>> >> +
>> >> +def setUp(self):
>> >> +# Call super's setUp().
>> >> +TestBase.setUp(self)
>> >> +self.source = 'main.c'
>> >> +
>> >> +def verify_variable_names(self, description, value_list, names):
>> >> +copy_names = list(names)
>> >> +actual_names = get_names_from_value_list(value_list)
>> >> +for name in actual_names:
>> >> +if name in copy_names:
>> >> +copy_names.remove(name)
>> >> +else:
>> >> +self.assertTrue(False, "didn't find '%s' in %s" %
>> >> (name,
>> >> copy_names))
>> >> +self.assertEqual(len(copy_names), 0, "%s: we didn't find
>> >> variables: %s in value list (%s)" % (description, copy_names,
>> >> actual_names))
>> >> +
>> >> +def test (self):
>> >> +self.build ()
>> >> +
>> >> +# Set debugger into synchronous mode
>> >> +self.dbg.SetAsync(False)
>> >> +
>> >> +# Create a target by the debugger.
>> >> +

Re: [Lldb-commits] [lldb] r267478 - Fix StackFrame::GetVariables(...) function that was broken by 261858 when lambda functions were added to Block::AppendBlockVariables(). The Stackframe::GetVariables

2016-04-25 Thread Siva Chandra via lldb-commits
AFAICT, happens only with Clang; Using g_static_var, say as "return
g_static_var - 123;", fixes for me.

On Mon, Apr 25, 2016 at 3:50 PM, Chaoren Lin via lldb-commits
 wrote:
> Is g_global_var necessarily static?
>
> On Linux, we're only seeing 2 static variables when your test expects 3.
>
>>  static_names = ['static_var', 'g_global_var', 'static_var']
>
> I'm guessing g_global_var isn't treated as static.
>
> On Mon, Apr 25, 2016 at 2:54 PM, Greg Clayton via lldb-commits
>  wrote:
>>
>> Author: gclayton
>> Date: Mon Apr 25 16:54:10 2016
>> New Revision: 267478
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=267478=rev
>> Log:
>> Fix StackFrame::GetVariables(...) function that was broken by 261858 when
>> lambda functions were added to Block::AppendBlockVariables(). The
>> Stackframe::GetVariables(...) function should get all variables regardless
>> if they are in scope.
>>
>> This wasn't caught by the test suite so I added a test for it.
>>
>>
>> Added:
>>
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/
>>
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>>
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>>
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/main.c
>> Modified:
>> lldb/trunk/source/Target/StackFrame.cpp
>>
>> Added:
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile?rev=267478=auto
>>
>> ==
>> ---
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> (added)
>> +++
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/Makefile
>> Mon Apr 25 16:54:10 2016
>> @@ -0,0 +1,5 @@
>> +LEVEL = ../../../make
>> +
>> +C_SOURCES := main.c
>> +
>> +include $(LEVEL)/Makefile.rules
>>
>> Added:
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py?rev=267478=auto
>>
>> ==
>> ---
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> (added)
>> +++
>> lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
>> Mon Apr 25 16:54:10 2016
>> @@ -0,0 +1,190 @@
>> +"""
>> +Test that SBFrame::GetVariables() calls work correctly.
>> +"""
>> +
>> +from __future__ import print_function
>> +
>> +
>> +
>> +import os, time
>> +import lldb
>> +from lldbsuite.test.decorators import *
>> +from lldbsuite.test.lldbtest import *
>> +from lldbsuite.test import lldbplatform
>> +from lldbsuite.test import lldbutil
>> +
>> +def get_names_from_value_list(value_list):
>> +names = list()
>> +for value in value_list:
>> +names.append(value.GetName())
>> +return names
>> +
>> +class TestGetVariables(TestBase):
>> +
>> +mydir = TestBase.compute_mydir(__file__)
>> +
>> +def setUp(self):
>> +# Call super's setUp().
>> +TestBase.setUp(self)
>> +self.source = 'main.c'
>> +
>> +def verify_variable_names(self, description, value_list, names):
>> +copy_names = list(names)
>> +actual_names = get_names_from_value_list(value_list)
>> +for name in actual_names:
>> +if name in copy_names:
>> +copy_names.remove(name)
>> +else:
>> +self.assertTrue(False, "didn't find '%s' in %s" % (name,
>> copy_names))
>> +self.assertEqual(len(copy_names), 0, "%s: we didn't find
>> variables: %s in value list (%s)" % (description, copy_names, actual_names))
>> +
>> +def test (self):
>> +self.build ()
>> +
>> +# Set debugger into synchronous mode
>> +self.dbg.SetAsync(False)
>> +
>> +# Create a target by the debugger.
>> +exe = os.path.join(os.getcwd(), "a.out")
>> +target = self.dbg.CreateTarget(exe)
>> +self.assertTrue(target, VALID_TARGET)
>> +
>> +line1 = line_number(self.source, '// breakpoint 1')
>> +line2 = line_number(self.source, '// breakpoint 2')
>> +line3 = line_number(self.source, '// breakpoint 3')
>> +
>> +breakpoint1 = target.BreakpointCreateByLocation (self.source,
>> line1);
>> +breakpoint2 = target.BreakpointCreateByLocation (self.source,
>> line2);
>> +breakpoint3 = target.BreakpointCreateByLocation (self.source,
>> line3);
>> +
>> +self.assertTrue(breakpoint1.GetNumLocations() >= 1,
>> PROCESS_IS_VALID)
>> +self.assertTrue(breakpoint2.GetNumLocations() >= 1,

[Lldb-commits] [lldb] r264217 - [JITLoaderGDB] Read jit entry struct manually.

2016-03-23 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Wed Mar 23 18:27:23 2016
New Revision: 264217

URL: http://llvm.org/viewvc/llvm-project?rev=264217=rev
Log:
[JITLoaderGDB] Read jit entry struct manually.

Summary:
Though r264012 was fancy enough to make reading the jit entry struct
work with templates, the packing and alignment attributes do not work on
Windows. So, this change makes it plain and simple with manual reading
of the jit entry struct.

Reviewers: clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp?rev=264217=264216=264217=diff
==
--- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (original)
+++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp Wed Mar 23 
18:27:23 2016
@@ -9,7 +9,10 @@
 
 // C Includes
 
+#include "llvm/Support/MathExtras.h"
+
 #include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -22,12 +25,41 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 #include "JITLoaderGDB.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+//--
+// Debug Interface Structures
+//--
+typedef enum
+{
+JIT_NOACTION = 0,
+JIT_REGISTER_FN,
+JIT_UNREGISTER_FN
+} jit_actions_t;
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size;
+};
+
+template 
+struct jit_descriptor
+{
+uint32_t version;
+uint32_t action_flag; // Values are jit_action_t
+ptr_trelevant_entry; // pointer
+ptr_tfirst_entry; // pointer
+};
+
 namespace {
 
 PropertyDefinition
@@ -78,44 +110,34 @@ namespace {
 return g_settings_sp;
 }
 
-}  // anonymous namespace end
-
-//--
-// Debug Interface Structures
-//--
-typedef enum
-{
-JIT_NOACTION = 0,
-JIT_REGISTER_FN,
-JIT_UNREGISTER_FN
-} jit_actions_t;
+template 
+bool ReadJITEntry(const addr_t from_addr, Process *process, 
jit_code_entry *entry)
+{
+lldbassert(from_addr % sizeof(ptr_t) == 0);
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((aligned (8)));
-};
+ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
+bool i386_target = ArchSpec::kCore_x86_32_first <= core && core <= 
ArchSpec::kCore_x86_32_last;
+uint8_t uint64_align_bytes =  i386_target ? 4 : 8;
+const size_t data_byte_size = llvm::alignTo(sizeof(ptr_t) * 3, 
uint64_align_bytes) + sizeof(uint64_t);
+
+Error error;
+DataBufferHeap data(data_byte_size, 0);
+size_t bytes_read = process->ReadMemory(from_addr, data.GetBytes(), 
data.GetByteSize(), error);
+if (bytes_read != data_byte_size || !error.Success())
+return false;
+
+DataExtractor extractor (data.GetBytes(), data.GetByteSize(), 
process->GetByteOrder(), sizeof(ptr_t));
+lldb::offset_t offset = 0;
+entry->next_entry = extractor.GetPointer();
+entry->prev_entry = extractor.GetPointer();
+entry->symfile_addr = extractor.GetPointer();
+offset = llvm::alignTo(offset, uint64_align_bytes);
+entry->symfile_size = extractor.GetU64();
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((packed));
-};
+return true;
+}
 
-template 
-struct jit_descriptor
-{
-uint32_t version;
-uint32_t action_flag; // Values are jit_action_t
-ptr_trelevant_entry; // pointer
-ptr_tfirst_entry; // pointer
-};
+}  // anonymous namespace end
 
 JITLoaderGDB::JITLoaderGDB (lldb_private::Process *process) :
 JITLoader(process),
@@ -278,21 +300,13 @@ static void updateSectionLoadAddress(con
 bool
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
-Target  = m_process->GetTarget();
-const ArchSpec _spec = target.GetArchitecture();
-if (arch_spec.GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl

Re: [Lldb-commits] [PATCH] D18379: [JITLoaderGDB] Read jit entry struct manually.

2016-03-23 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:110-119
@@ -80,3 +109,12 @@
 
-}  // anonymous namespace end
+template 
+T
+Align(const T v, uint8_t bytes)
+{
+uint8_t rem = v % bytes;
+if (rem == 0)
+return v;
+else
+return  v + bytes - rem;
+}
 

clayborg wrote:
> Unless this align is special and different from other align functions, we 
> should use llvm::alignTo(...).
Removed.


Comment at: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:122
@@ +121,3 @@
+template 
+bool ReadJITEntry(const addr_t _addr, Process *process, 
jit_code_entry *entry)
+{

clayborg wrote:
> Why is "from_addr" passed by reference? No one is updating this address and 
> it is const. This should be "const addr_t from_addr" or it should be non 
> const and "from_addr" should be updated in the call to ReadJITEntry().
Made it a value. Making it a reference was a slip.


Comment at: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:125-126
@@ +124,4 @@
+ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
+bool i386_target = ArchSpec::kCore_x86_32_first <= core && core <= 
ArchSpec::kCore_x86_32_last;
+uint8_t uint64_align_bytes =  i386_target ? 4 : 8;
+const size_t data_byte_size = Align(sizeof(ptr_t) * 3, 
uint64_align_bytes) + sizeof(uint64_t);

clayborg wrote:
> Is this truly for i386 only? Not for all 32 bit architectures?
Per my reading of the arm32, mip32 and x86 (i386) ABI specs, only x86 aligns 8 
byte values at 4-byte boundaries. Others align 8 byte values are 8-byte 
boundaries.

For my testing, I have arm32 and i386 Android devices at hand which validate 
the changes.

You can correct me if you think I got it wrong or if I have to consider more 
archs.


Comment at: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:131
@@ +130,3 @@
+DataBufferHeap data(data_byte_size, 0);
+addr_t aligned_addr = Align(from_addr, sizeof(ptr_t)); // Playing 
absolutely safe
+size_t bytes_read = process->ReadMemory(aligned_addr, data.GetBytes(), 
data.GetByteSize(), error);

clayborg wrote:
> Do you really want to adjust this here? Shouldn't this actually be:
> 
> ```
> if (from_addr % sizeof(ptr_t))
> return false;
> ```
Replaced this with an assert.


http://reviews.llvm.org/D18379



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


Re: [Lldb-commits] [PATCH] D18379: [JITLoaderGDB] Read jit entry struct manually.

2016-03-23 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 51466.
sivachandra added a comment.

Address comments.


http://reviews.llvm.org/D18379

Files:
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -9,7 +9,10 @@
 
 // C Includes
 
+#include "llvm/Support/MathExtras.h"
+
 #include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -22,12 +25,41 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 #include "JITLoaderGDB.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+//--
+// Debug Interface Structures
+//--
+typedef enum
+{
+JIT_NOACTION = 0,
+JIT_REGISTER_FN,
+JIT_UNREGISTER_FN
+} jit_actions_t;
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size;
+};
+
+template 
+struct jit_descriptor
+{
+uint32_t version;
+uint32_t action_flag; // Values are jit_action_t
+ptr_trelevant_entry; // pointer
+ptr_tfirst_entry; // pointer
+};
+
 namespace {
 
 PropertyDefinition
@@ -78,44 +110,34 @@
 return g_settings_sp;
 }
 
-}  // anonymous namespace end
+template 
+bool ReadJITEntry(const addr_t from_addr, Process *process, jit_code_entry *entry)
+{
+lldbassert(from_addr % sizeof(ptr_t) == 0);
 
-//--
-// Debug Interface Structures
-//--
-typedef enum
-{
-JIT_NOACTION = 0,
-JIT_REGISTER_FN,
-JIT_UNREGISTER_FN
-} jit_actions_t;
+ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
+bool i386_target = ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last;
+uint8_t uint64_align_bytes =  i386_target ? 4 : 8;
+const size_t data_byte_size = llvm::alignTo(sizeof(ptr_t) * 3, uint64_align_bytes) + sizeof(uint64_t);
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((aligned (8)));
-};
+Error error;
+DataBufferHeap data(data_byte_size, 0);
+size_t bytes_read = process->ReadMemory(from_addr, data.GetBytes(), data.GetByteSize(), error);
+if (bytes_read != data_byte_size || !error.Success())
+return false;
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((packed));
-};
+DataExtractor extractor (data.GetBytes(), data.GetByteSize(), process->GetByteOrder(), sizeof(ptr_t));
+lldb::offset_t offset = 0;
+entry->next_entry = extractor.GetPointer();
+entry->prev_entry = extractor.GetPointer();
+entry->symfile_addr = extractor.GetPointer();
+offset = llvm::alignTo(offset, uint64_align_bytes);
+entry->symfile_size = extractor.GetU64();
 
-template 
-struct jit_descriptor
-{
-uint32_t version;
-uint32_t action_flag; // Values are jit_action_t
-ptr_trelevant_entry; // pointer
-ptr_tfirst_entry; // pointer
-};
+return true;
+}
+
+}  // anonymous namespace end
 
 JITLoaderGDB::JITLoaderGDB (lldb_private::Process *process) :
 JITLoader(process),
@@ -278,21 +300,13 @@
 bool
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
-Target  = m_process->GetTarget();
-const ArchSpec _spec = target.GetArchitecture();
-if (arch_spec.GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+if (m_process->GetTarget().GetArchitecture().GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-{
-ArchSpec::Core core = arch_spec.GetCore();
-if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
-return 

Re: [Lldb-commits] [PATCH] D18379: [JITLoaderGDB] Read jit entry struct manually.

2016-03-22 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

How does this look?


http://reviews.llvm.org/D18379



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


Re: [Lldb-commits] [PATCH] D18379: [JITLoaderGDB] Read jit entry struct manually.

2016-03-22 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 51370.
sivachandra added a comment.

Modify according to suggestions.


http://reviews.llvm.org/D18379

Files:
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -10,6 +10,7 @@
 // C Includes
 
 #include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -28,6 +29,34 @@
 using namespace lldb;
 using namespace lldb_private;
 
+//--
+// Debug Interface Structures
+//--
+typedef enum
+{
+JIT_NOACTION = 0,
+JIT_REGISTER_FN,
+JIT_UNREGISTER_FN
+} jit_actions_t;
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size;
+};
+
+template 
+struct jit_descriptor
+{
+uint32_t version;
+uint32_t action_flag; // Values are jit_action_t
+ptr_trelevant_entry; // pointer
+ptr_tfirst_entry; // pointer
+};
+
 namespace {
 
 PropertyDefinition
@@ -78,44 +107,44 @@
 return g_settings_sp;
 }
 
-}  // anonymous namespace end
+template 
+T
+Align(const T v, uint8_t bytes)
+{
+uint8_t rem = v % bytes;
+if (rem == 0)
+return v;
+else
+return  v + bytes - rem;
+}
 
-//--
-// Debug Interface Structures
-//--
-typedef enum
-{
-JIT_NOACTION = 0,
-JIT_REGISTER_FN,
-JIT_UNREGISTER_FN
-} jit_actions_t;
+template 
+bool ReadJITEntry(const addr_t _addr, Process *process, jit_code_entry *entry)
+{
+ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
+bool i386_target = ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last;
+uint8_t uint64_align_bytes =  i386_target ? 4 : 8;
+const size_t data_byte_size = Align(sizeof(ptr_t) * 3, uint64_align_bytes) + sizeof(uint64_t);
+
+Error error;
+DataBufferHeap data(data_byte_size, 0);
+addr_t aligned_addr = Align(from_addr, sizeof(ptr_t)); // Playing absolutely safe
+size_t bytes_read = process->ReadMemory(aligned_addr, data.GetBytes(), data.GetByteSize(), error);
+if (bytes_read != data_byte_size || !error.Success())
+return false;
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((aligned (8)));
-};
+DataExtractor extractor (data.GetBytes(), data.GetByteSize(), process->GetByteOrder(), sizeof(ptr_t));
+lldb::offset_t offset = 0;
+entry->next_entry = extractor.GetPointer();
+entry->prev_entry = extractor.GetPointer();
+entry->symfile_addr = extractor.GetPointer();
+offset = Align(offset, uint64_align_bytes);
+entry->symfile_size = extractor.GetU64();
 
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((packed));
-};
+return true;
+}
 
-template 
-struct jit_descriptor
-{
-uint32_t version;
-uint32_t action_flag; // Values are jit_action_t
-ptr_trelevant_entry; // pointer
-ptr_tfirst_entry; // pointer
-};
+}  // anonymous namespace end
 
 JITLoaderGDB::JITLoaderGDB (lldb_private::Process *process) :
 JITLoader(process),
@@ -278,21 +307,13 @@
 bool
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
-Target  = m_process->GetTarget();
-const ArchSpec _spec = target.GetArchitecture();
-if (arch_spec.GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+if (m_process->GetTarget().GetArchitecture().GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-{
-ArchSpec::Core core = arch_spec.GetCore();
-if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
-  

[Lldb-commits] [PATCH] D18379: [JITLoaderGDB] Read jit entry struct manually.

2016-03-22 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: clayborg.
sivachandra added a subscriber: lldb-commits.

Though r264012 was fancy enough to make reading the jit entry struct
work with templates, the packing and alignment attributes do not work on
Windows. So, this change makes it plain and simple with manual reading
of the jit entry struct.

http://reviews.llvm.org/D18379

Files:
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -28,6 +28,34 @@
 using namespace lldb;
 using namespace lldb_private;
 
+//--
+// Debug Interface Structures
+//--
+typedef enum
+{
+JIT_NOACTION = 0,
+JIT_REGISTER_FN,
+JIT_UNREGISTER_FN
+} jit_actions_t;
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size;
+};
+
+template 
+struct jit_descriptor
+{
+uint32_t version;
+uint32_t action_flag; // Values are jit_action_t
+ptr_trelevant_entry; // pointer
+ptr_tfirst_entry; // pointer
+};
+
 namespace {
 
 PropertyDefinition
@@ -78,44 +106,42 @@
 return g_settings_sp;
 }
 
-}  // anonymous namespace end
-
-//--
-// Debug Interface Structures
-//--
-typedef enum
-{
-JIT_NOACTION = 0,
-JIT_REGISTER_FN,
-JIT_UNREGISTER_FN
-} jit_actions_t;
-
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((aligned (8)));
-};
-
-template 
-struct jit_code_entry
-{
-ptr_tnext_entry; // pointer
-ptr_tprev_entry; // pointer
-ptr_tsymfile_addr; // pointer
-uint64_t symfile_size __attribute__ ((packed));
-};
+template 
+bool ReadJITEntry(const addr_t _addr, Process *process, jit_code_entry *entry)
+{
+addr_t addr = from_addr;
+Error error;
+size_t bytes_read = 0;
+
+ bytes_read = process->DoReadMemory(addr, >next_entry, sizeof(ptr_t), error);
+ if (bytes_read != sizeof(ptr_t) || !error.Success())
+ return false;
+ addr += sizeof(ptr_t);
+
+ bytes_read = process->DoReadMemory(addr, >prev_entry, sizeof(ptr_t), error);
+ if (bytes_read != sizeof(ptr_t) || !error.Success())
+ return false;
+ addr += sizeof(ptr_t);
+
+ bytes_read = process->DoReadMemory(addr, >symfile_addr, sizeof(ptr_t), error);
+ if (bytes_read != sizeof(ptr_t) || !error.Success())
+ return false;
+ addr += sizeof(ptr_t);
+
+ ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
+ if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
+ addr += addr % 4;
+ else
+ addr += addr % 8;
+
+ bytes_read = process->DoReadMemory(addr, >symfile_size, 8, error);
+ if (bytes_read != 8 || !error.Success())
+ return false;
+
+ return true;
+}
 
-template 
-struct jit_descriptor
-{
-uint32_t version;
-uint32_t action_flag; // Values are jit_action_t
-ptr_trelevant_entry; // pointer
-ptr_tfirst_entry; // pointer
-};
+}  // anonymous namespace end
 
 JITLoaderGDB::JITLoaderGDB (lldb_private::Process *process) :
 JITLoader(process),
@@ -278,21 +304,13 @@
 bool
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
-Target  = m_process->GetTarget();
-const ArchSpec _spec = target.GetArchitecture();
-if (arch_spec.GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+if (m_process->GetTarget().GetArchitecture().GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-{
-ArchSpec::Core core = arch_spec.GetCore();
-if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
-return ReadJITDescriptorImpl(all_entries);
-else
-return ReadJITDescriptorImpl

[Lldb-commits] [lldb] r264104 - [lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.

2016-03-22 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Tue Mar 22 16:37:56 2016
New Revision: 264104

URL: http://llvm.org/viewvc/llvm-project?rev=264104=rev
Log:
[lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/tools/lldb-mi/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-mi/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/CMakeLists.txt?rev=264104=264103=264104=diff
==
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt Tue Mar 22 16:37:56 2016
@@ -92,7 +92,7 @@ if ( NOT CMAKE_SYSTEM_NAME MATCHES "Wind
 endif ()
 
 # TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
+target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
 llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
 
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})


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


[Lldb-commits] [PATCH] D18377: [lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.

2016-03-22 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: zturner.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D18377

Files:
  tools/lldb-mi/CMakeLists.txt

Index: tools/lldb-mi/CMakeLists.txt
===
--- tools/lldb-mi/CMakeLists.txt
+++ tools/lldb-mi/CMakeLists.txt
@@ -92,7 +92,7 @@
 endif ()
 
 # TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
+target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
 llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
 
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})


Index: tools/lldb-mi/CMakeLists.txt
===
--- tools/lldb-mi/CMakeLists.txt
+++ tools/lldb-mi/CMakeLists.txt
@@ -92,7 +92,7 @@
 endif ()
 
 # TODO: why isn't this done by add_lldb_executable?
-#target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
+target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
 llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
 
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r264012 - [JITLoaderGDB] Pack the jit entry struct according to the target arch.

2016-03-21 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Mon Mar 21 19:35:31 2016
New Revision: 264012

URL: http://llvm.org/viewvc/llvm-project?rev=264012=rev
Log:
[JITLoaderGDB] Pack the jit entry struct according to the target arch.

Reviewers: clayborg

Subscribers: tberghammer, dsrbecky, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp?rev=264012=264011=264012=diff
==
--- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (original)
+++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp Mon Mar 21 
19:35:31 2016
@@ -90,14 +90,24 @@ typedef enum
 JIT_UNREGISTER_FN
 } jit_actions_t;
 
-template 
+template 
 struct jit_code_entry
 {
 ptr_tnext_entry; // pointer
 ptr_tprev_entry; // pointer
 ptr_tsymfile_addr; // pointer
-uint64_t symfile_size;
+uint64_t symfile_size __attribute__ ((aligned (8)));
+};
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size __attribute__ ((packed));
 };
+
 template 
 struct jit_descriptor
 {
@@ -269,13 +279,20 @@ bool
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
 Target  = m_process->GetTarget();
-if (target.GetArchitecture().GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+const ArchSpec _spec = target.GetArchitecture();
+if (arch_spec.GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-return ReadJITDescriptorImpl(all_entries);
+{
+ArchSpec::Core core = arch_spec.GetCore();
+if (ArchSpec::kCore_x86_32_first <= core && core <= 
ArchSpec::kCore_x86_32_last)
+return ReadJITDescriptorImpl(all_entries);
+else
+return ReadJITDescriptorImpl(all_entries);
+}
 }
 
-template 
+template 
 bool
 JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries)
 {
@@ -309,7 +326,7 @@ JITLoaderGDB::ReadJITDescriptorImpl(bool
 
 while (jit_relevant_entry != 0)
 {
-jit_code_entry jit_entry;
+jit_code_entry jit_entry;
 const size_t jit_entry_size = sizeof(jit_entry);
 bytes_read = m_process->DoReadMemory(jit_relevant_entry, _entry, 
jit_entry_size, error);
 if (bytes_read != jit_entry_size || !error.Success())

Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h?rev=264012=264011=264012=diff
==
--- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h (original)
+++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.h Mon Mar 21 19:35:31 
2016
@@ -83,7 +83,7 @@ private:
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 


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


Re: [Lldb-commits] [PATCH] D18334: [JITLoaderGDB] Pack the jit entry struct according to the target arch.

2016-03-21 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

Thanks for the quick review.
I will put this in for now. Will revisit if a need for an elaborate solution 
arises.


http://reviews.llvm.org/D18334



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


Re: [Lldb-commits] [PATCH] D18334: [JITLoaderGDB] Pack the jit entry struct according to the target arch.

2016-03-21 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 51246.
sivachandra added a comment.

Explicitly set the alignment of the size field in the unpacked struct
to 8 bytes. This should take care of the case where in the host is i386
and the target is arm (for example).


http://reviews.llvm.org/D18334

Files:
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -90,14 +90,24 @@
 JIT_UNREGISTER_FN
 } jit_actions_t;
 
-template 
+template 
 struct jit_code_entry
 {
 ptr_tnext_entry; // pointer
 ptr_tprev_entry; // pointer
 ptr_tsymfile_addr; // pointer
-uint64_t symfile_size;
+uint64_t symfile_size __attribute__ ((aligned (8)));
 };
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size __attribute__ ((packed));
+};
+
 template 
 struct jit_descriptor
 {
@@ -269,13 +279,20 @@
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
 Target  = m_process->GetTarget();
-if (target.GetArchitecture().GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+const ArchSpec _spec = target.GetArchitecture();
+if (arch_spec.GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-return ReadJITDescriptorImpl(all_entries);
+{
+ArchSpec::Core core = arch_spec.GetCore();
+if (ArchSpec::kCore_x86_32_first <= core && core <= 
ArchSpec::kCore_x86_32_last)
+return ReadJITDescriptorImpl(all_entries);
+else
+return ReadJITDescriptorImpl(all_entries);
+}
 }
 
-template 
+template 
 bool
 JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries)
 {
@@ -309,7 +326,7 @@
 
 while (jit_relevant_entry != 0)
 {
-jit_code_entry jit_entry;
+jit_code_entry jit_entry;
 const size_t jit_entry_size = sizeof(jit_entry);
 bytes_read = m_process->DoReadMemory(jit_relevant_entry, _entry, 
jit_entry_size, error);
 if (bytes_read != jit_entry_size || !error.Success())


Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -90,14 +90,24 @@
 JIT_UNREGISTER_FN
 } jit_actions_t;
 
-template 
+template 
 struct jit_code_entry
 {
 ptr_tnext_entry; // pointer
 ptr_tprev_entry; // pointer
 ptr_tsymfile_addr; // pointer
-uint64_t symfile_size;
+uint64_t symfile_size __attribute__ ((aligned (8)));
 };
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size __attribute__ ((packed));
+};
+
 template 
 struct jit_descriptor
 {
@@ -269,13 +279,20 @@
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
 Target  = m_process->GetTarget();
-if (target.GetArchitecture().GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+const ArchSpec _spec = target.GetArchitecture();
+if (arch_spec.GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-return ReadJITDescriptorImpl(all_entries);
+{
+ArchSpec::Core core = arch_spec.GetCore();
+if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
+return ReadJITDescriptorImpl(all_entries);
+else
+return ReadJITDescriptorImpl(all_entries);
+}
 }
 
-template 
+template 
 bool
 JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries)
 {
@@ -309,7 +326,7 @@
 
 while (jit_relevant_entry != 0)
 {
-jit_code_entry jit_entry;
+jit_code_entry jit_entry;

Re: [Lldb-commits] [PATCH] D18334: [JITLoaderGDB] Pack the jit entry struct according to the target arch.

2016-03-21 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

This fixes an issue we are seeing with i386 JIT entry handling.

I have chosen a least disruptive change. However, since alignment is actually 
determined by the ABI, one could add some API to the ABI interface to determine 
the packing. However, it seemed like an overkill for doing something special 
only for i386.


http://reviews.llvm.org/D18334



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


[Lldb-commits] [PATCH] D18334: [JITLoaderGDB] Pack the jit entry struct according to the target arch.

2016-03-21 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: clayborg.
sivachandra added subscribers: lldb-commits, dsrbecky, tberghammer.

http://reviews.llvm.org/D18334

Files:
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.h

Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -90,14 +90,24 @@
 JIT_UNREGISTER_FN
 } jit_actions_t;
 
-template 
+template 
 struct jit_code_entry
 {
 ptr_tnext_entry; // pointer
 ptr_tprev_entry; // pointer
 ptr_tsymfile_addr; // pointer
 uint64_t symfile_size;
 };
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size __attribute__ ((packed));
+};
+
 template 
 struct jit_descriptor
 {
@@ -269,13 +279,20 @@
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
 Target  = m_process->GetTarget();
-if (target.GetArchitecture().GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+const ArchSpec _spec = target.GetArchitecture();
+if (arch_spec.GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-return ReadJITDescriptorImpl(all_entries);
+{
+ArchSpec::Core core = arch_spec.GetCore();
+if (ArchSpec::kCore_x86_32_first <= core && core <= 
ArchSpec::kCore_x86_32_last)
+return ReadJITDescriptorImpl(all_entries);
+else
+return ReadJITDescriptorImpl(all_entries);
+}
 }
 
-template 
+template 
 bool
 JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries)
 {
@@ -309,7 +326,7 @@
 
 while (jit_relevant_entry != 0)
 {
-jit_code_entry jit_entry;
+jit_code_entry jit_entry;
 const size_t jit_entry_size = sizeof(jit_entry);
 bytes_read = m_process->DoReadMemory(jit_relevant_entry, _entry, 
jit_entry_size, error);
 if (bytes_read != jit_entry_size || !error.Success())


Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.h
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.h
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.h
@@ -83,7 +83,7 @@
 bool
 ReadJITDescriptor(bool all_entries);
 
-template 
+template 
 bool
 ReadJITDescriptorImpl(bool all_entries);
 
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -90,14 +90,24 @@
 JIT_UNREGISTER_FN
 } jit_actions_t;
 
-template 
+template 
 struct jit_code_entry
 {
 ptr_tnext_entry; // pointer
 ptr_tprev_entry; // pointer
 ptr_tsymfile_addr; // pointer
 uint64_t symfile_size;
 };
+
+template 
+struct jit_code_entry
+{
+ptr_tnext_entry; // pointer
+ptr_tprev_entry; // pointer
+ptr_tsymfile_addr; // pointer
+uint64_t symfile_size __attribute__ ((packed));
+};
+
 template 
 struct jit_descriptor
 {
@@ -269,13 +279,20 @@
 JITLoaderGDB::ReadJITDescriptor(bool all_entries)
 {
 Target  = m_process->GetTarget();
-if (target.GetArchitecture().GetAddressByteSize() == 8)
-return ReadJITDescriptorImpl(all_entries);
+const ArchSpec _spec = target.GetArchitecture();
+if (arch_spec.GetAddressByteSize() == 8)
+return ReadJITDescriptorImpl(all_entries);
 else
-return ReadJITDescriptorImpl(all_entries);
+{
+ArchSpec::Core core = arch_spec.GetCore();
+if (ArchSpec::kCore_x86_32_first <= core && core <= ArchSpec::kCore_x86_32_last)
+return ReadJITDescriptorImpl(all_entries);
+else
+return ReadJITDescriptorImpl(all_entries);
+}
 }
 
-template 
+template 
 bool
 JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries)
 {
@@ -309,7 +326,7 @@
 
 while (jit_relevant_entry != 0)
 {
-jit_code_entry jit_entry;
+jit_code_entry jit_entry;
 const size_t jit_entry_size = sizeof(jit_entry);
 bytes_read = m_process->DoReadMemory(jit_relevant_entry, _entry, jit_entry_size, error);
 if (bytes_read != jit_entry_size || !error.Success())

Re: [Lldb-commits] [lldb] r262970 - [TestRegisterVariables] Adjust compiler range in expected failure decorator.

2016-03-14 Thread Siva Chandra via lldb-commits
On Mon, Mar 14, 2016 at 8:08 AM, Ed Maste <ema...@freebsd.org> wrote:
> On 8 March 2016 at 19:02, Siva Chandra via lldb-commits
> <lldb-commits@lists.llvm.org> wrote:
>> Author: sivachandra
>> Date: Tue Mar  8 18:02:00 2016
>> New Revision: 262970
>>
>> -@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
>> +@expectedFailureAll(compiler="clang", compiler_version=['>', '3.5'])
>
> This test is now reporting Failure on FreeBSD 10, with system Clang
> 3.4.1. Should this be > 3.4 now instead?

Feel free to change it.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r263085 - [DWARFASTParserClang] Start with member offset of 0 for members of union types.

2016-03-09 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Wed Mar  9 19:15:17 2016
New Revision: 263085

URL: http://llvm.org/viewvc/llvm-project?rev=263085=rev
Log:
[DWARFASTParserClang] Start with member offset of 0 for members of union types.

Summary:
GCC does not emit DW_AT_data_member_location for members of a union.
Starting with a 0 value for member locations helps is reading union types
in such cases.

Reviewers: clayborg

Subscribers: ldrumm, lldb-commits

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/
lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/main.c
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/Makefile?rev=263085=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/Makefile Wed Mar  9 
19:15:17 2016
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py?rev=263085=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py 
Wed Mar  9 19:15:17 2016
@@ -0,0 +1,46 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class TestUnionMembers(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_union_members(self):
+self._load_exe()
+
+# Set breakpoints
+bp = self.target.BreakpointCreateBySourceRegex("Break here", 
self.src_file_spec)
+self.assertTrue(bp.IsValid() and bp.GetNumLocations() >= 1, 
VALID_BREAKPOINT)
+
+# Launch the process
+self.process = self.target.LaunchSimple(None, None, 
self.get_process_working_directory())
+self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
+self.assertTrue(self.process.GetState() == lldb.eStateStopped, 
PROCESS_STOPPED)
+
+thread = lldbutil.get_stopped_thread(self.process, 
lldb.eStopReasonBreakpoint)
+self.assertTrue(thread.IsValid())
+frame = thread.GetSelectedFrame()
+self.assertTrue(frame.IsValid())
+
+val = frame.EvaluateExpression("u");
+self.assertTrue(val.IsValid())
+val = frame.EvaluateExpression("u.s");
+self.assertTrue(val.IsValid())
+self.assertEqual(val.GetNumChildren(), 2)
+
+def _load_exe(self):
+self.build()
+
+cwd = os.getcwd()
+
+src_file = os.path.join(cwd, "main.c")
+self.src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
+
+# Get the path of the executable
+exe_path  = os.path.join(cwd, 'a.out')
+
+# Load the executable
+self.target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(self.target.IsValid(), VALID_TARGET)

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/main.c?rev=263085=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/main.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/main.c Wed Mar  9 
19:15:17 2016
@@ -0,0 +1,18 @@
+#include 
+
+union S
+{
+int32_t n; // occupies 4 bytes
+uint16_t s[2]; // occupies 4 bytes
+uint8_t c; // occupies 1 byte
+}; // the whole union occupies 4 bytes
+
+int main()
+{
+  union S u;
+
+  u.s[0] = 1234;
+  u.s[1] = 4321;
+
+  return 0; // Break here
+}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=263085=263084=263085=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Wed Mar  
9 19:15:17 2016
@@ -2673,7 +2673,7 @@ DWARFASTParserClang::ParseChildMembers (
 bool is_artificial = false;
 DWARFFormValue encoding_form;
  

[Lldb-commits] [PATCH] D18008: [DWARFASTParserClang] Start with member offset of 0 for members of union types.

2016-03-09 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: clayborg.
sivachandra added a subscriber: lldb-commits.

GCC does not emit DW_AT_data_member_location for members of a union.
Starting with a 0 value for member locations helps is reading union types
in such cases.

http://reviews.llvm.org/D18008

Files:
  packages/Python/lldbsuite/test/lang/c/unions/Makefile
  packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
  packages/Python/lldbsuite/test/lang/c/unions/main.c
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2673,7 +2673,7 @@
 bool is_artificial = false;
 DWARFFormValue encoding_form;
 AccessType accessibility = eAccessNone;
-uint32_t member_byte_offset = UINT32_MAX;
+uint32_t member_byte_offset = (parent_die.Tag() == 
DW_TAG_union_type) ? 0 : UINT32_MAX;
 size_t byte_size = 0;
 size_t bit_offset = 0;
 size_t bit_size = 0;
Index: packages/Python/lldbsuite/test/lang/c/unions/main.c
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/c/unions/main.c
@@ -0,0 +1,18 @@
+#include 
+
+union S
+{
+int32_t n; // occupies 4 bytes
+uint16_t s[2]; // occupies 4 bytes
+uint8_t c; // occupies 1 byte
+}; // the whole union occupies 4 bytes
+
+int main()
+{
+  union S u;
+
+  u.s[0] = 1234;
+  u.s[1] = 4321;
+
+  return 0; // Break here
+}
Index: packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
@@ -0,0 +1,46 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class TestUnionMembers(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_union_members(self):
+self._load_exe()
+
+# Set breakpoints
+bp = self.target.BreakpointCreateBySourceRegex("Break here", 
self.src_file_spec)
+self.assertTrue(bp.IsValid() and bp.GetNumLocations() >= 1, 
VALID_BREAKPOINT)
+
+# Launch the process
+self.process = self.target.LaunchSimple(None, None, 
self.get_process_working_directory())
+self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
+self.assertTrue(self.process.GetState() == lldb.eStateStopped, 
PROCESS_STOPPED)
+
+thread = lldbutil.get_stopped_thread(self.process, 
lldb.eStopReasonBreakpoint)
+self.assertTrue(thread.IsValid())
+frame = thread.GetSelectedFrame()
+self.assertTrue(frame.IsValid())
+
+val = frame.EvaluateExpression("u");
+self.assertTrue(val.IsValid())
+val = frame.EvaluateExpression("u.s");
+self.assertTrue(val.IsValid())
+self.assertEqual(val.GetNumChildren(), 2)
+
+def _load_exe(self):
+self.build()
+
+cwd = os.getcwd()
+
+src_file = os.path.join(cwd, "main.c")
+self.src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
+
+# Get the path of the executable
+exe_path  = os.path.join(cwd, 'a.out')
+
+# Load the executable
+self.target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(self.target.IsValid(), VALID_TARGET)
Index: packages/Python/lldbsuite/test/lang/c/unions/Makefile
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/c/unions/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules


Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2673,7 +2673,7 @@
 bool is_artificial = false;
 DWARFFormValue encoding_form;
 AccessType accessibility = eAccessNone;
-uint32_t member_byte_offset = UINT32_MAX;
+uint32_t member_byte_offset = (parent_die.Tag() == DW_TAG_union_type) ? 0 : UINT32_MAX;
 size_t byte_size = 0;
 size_t bit_offset = 0;
 size_t bit_size = 0;
Index: packages/Python/lldbsuite/test/lang/c/unions/main.c
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/c/unions/main.c
@@ -0,0 +1,18 @@
+#include 
+

[Lldb-commits] [lldb] r262970 - [TestRegisterVariables] Adjust compiler range in expected failure decorator.

2016-03-08 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Tue Mar  8 18:02:00 2016
New Revision: 262970

URL: http://llvm.org/viewvc/llvm-project?rev=262970=rev
Log:
[TestRegisterVariables] Adjust compiler range in expected failure decorator.

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py?rev=262970=262969=262970=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
 Tue Mar  8 18:02:00 2016
@@ -15,8 +15,8 @@ class RegisterVariableTestCase(TestBase)
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=['macosx'], compiler='clang', 
compiler_version=['<', '7.0.0'], debug_info="dsym")
-@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
-@expectedFailureAll(compiler="gcc", compiler_version=['=', '4.8.2'])
+@expectedFailureAll(compiler="clang", compiler_version=['>', '3.5'])
+@expectedFailureAll(compiler="gcc", compiler_version=['>=', '4.8.2'])
 def test_and_run_command(self):
 """Test expressions on register values."""
 self.build()


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


Re: [Lldb-commits] [PATCH] D17972: [TestRegisterVariables] Adjust compiler range in expected failure decorator.

2016-03-08 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262970: [TestRegisterVariables] Adjust compiler range in 
expected failure decorator. (authored by sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D17972?vs=50079=50086#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17972

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
@@ -15,8 +15,8 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=['macosx'], compiler='clang', 
compiler_version=['<', '7.0.0'], debug_info="dsym")
-@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
-@expectedFailureAll(compiler="gcc", compiler_version=['=', '4.8.2'])
+@expectedFailureAll(compiler="clang", compiler_version=['>', '3.5'])
+@expectedFailureAll(compiler="gcc", compiler_version=['>=', '4.8.2'])
 def test_and_run_command(self):
 """Test expressions on register values."""
 self.build()


Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
@@ -15,8 +15,8 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0'], debug_info="dsym")
-@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
-@expectedFailureAll(compiler="gcc", compiler_version=['=', '4.8.2'])
+@expectedFailureAll(compiler="clang", compiler_version=['>', '3.5'])
+@expectedFailureAll(compiler="gcc", compiler_version=['>=', '4.8.2'])
 def test_and_run_command(self):
 """Test expressions on register values."""
 self.build()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.

2016-02-25 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 49138.
sivachandra added a comment.

Add more gtest unittests.


http://reviews.llvm.org/D17618

Files:
  include/lldb/Symbol/SymbolFile.h
  packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
  packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  unittests/CMakeLists.txt
  unittests/Language/CMakeLists.txt
  unittests/Language/CPlusPlus/CMakeLists.txt
  unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp
  unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp

Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
===
--- /dev/null
+++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
@@ -0,0 +1,32 @@
+//===-- ScalarTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+TEST(TypeNamesEqualTest, Equality)
+{
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const"));
+}
+
+TEST(TypeNamesEqualTest, InEquality)
+{
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const"));
+}
Index: unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp
===
--- /dev/null
+++ unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp
@@ -0,0 +1,25 @@
+//===-- ScalarTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+TEST(SplitIntoArgumentsTest, Equality)
+{
+llvm::StringRef input = "(std::basic_string, std::basic_string)";
+std::vector args;
+
+CPlusPlusLanguage::SplitIntoArguments(input, args);
+ASSERT_EQ(args.size(), static_cast(2));
+ASSERT_STREQ(args[0].c_str(), "std::basic_string");
+ASSERT_STREQ(args[1].c_str(), "std::basic_string");
+}
Index: unittests/Language/CPlusPlus/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CPlusPlus/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(LLDBCPlusCPlusLanguageTests
+  TypeNamesEqualityTest.cpp
+  SplitIntoArgsTest.cpp
+  )
+
+  target_link_libraries(lldbPluginCPlusPlusLanguage)
Index: unittests/Language/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(CPlusPlus)
Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -28,5 +28,6 @@
 add_subdirectory(Expression)
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
+add_subdirectory(Language)
 add_subdirectory(ScriptInterpreter)
 add_subdirectory(Utility)
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -135,7 +135,10 @@
 }
 
 void
-SymbolFile::GetMangledNamesForFunction(const std::string _qualified_name, std::vector _names)
+SymbolFile::GetMangledNamesForFunction(const SymbolContext ,
+

Re: [Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.

2016-02-25 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 49098.
sivachandra added a comment.

Fix a comment in file, fix formatting in another.


http://reviews.llvm.org/D17618

Files:
  include/lldb/Symbol/SymbolFile.h
  packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
  packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  unittests/CMakeLists.txt
  unittests/Language/CMakeLists.txt
  unittests/Language/CPlusPlus/CMakeLists.txt
  unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp

Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
===
--- /dev/null
+++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
@@ -0,0 +1,32 @@
+//===-- ScalarTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+TEST(TypeNamesEqualTest, Equality)
+{
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const"));
+}
+
+TEST(TypeNamesEqualTest, InEquality)
+{
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const"));
+}
Index: unittests/Language/CPlusPlus/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CPlusPlus/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_lldb_unittest(LLDBCPlusCPlusLanguageTests
+  TypeNamesEqualityTest.cpp
+  )
+
+  target_link_libraries(lldbPluginCPlusPlusLanguage)
Index: unittests/Language/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(CPlusPlus)
Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -28,5 +28,6 @@
 add_subdirectory(Expression)
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
+add_subdirectory(Language)
 add_subdirectory(ScriptInterpreter)
 add_subdirectory(Utility)
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -135,7 +135,10 @@
 }
 
 void
-SymbolFile::GetMangledNamesForFunction(const std::string _qualified_name, std::vector _names)
+SymbolFile::GetMangledNamesForFunction(const SymbolContext ,
+   const std::string _qualified_name,
+   const std::vector ,
+   std::vector _names)
 {
 return;
 }
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -209,7 +209,9 @@
lldb_private::SymbolContextList& sc_list) override;
 
 void
-GetMangledNamesForFunction (const std::string _qualified_name,
+GetMangledNamesForFunction (const lldb_private::SymbolContext& sc,
+const std::string _qualified_name,
+const std::vector ,
 std::vector _names) override;
 
 uint32_t
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2966,7 +2966,9 @@
 }
 
 void
-SymbolFileDWARF::GetMangledNamesForFunction (const std::string _qualified_name,

[Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.

2016-02-25 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: spyffe, clayborg.
sivachandra added a subscriber: lldb-commits.

This, in a way, extends the existing "workaroud" by matching function
argument type names individually [instead of just matching "(args1...)"
with "(args2...)"]. For type name matching, a new method
CPlusPlusLanguage::TypeNamesEqual has been added. For now, this method
can only handle variations like:

  * vs *
 const  vs  const
 const  * const vs  const * const

We can extend it to handle more complex name formats as needed.

The immediate benefit of this change is with evaluating std::map's
subscript operator when producer is GCC. Consider the following:

  std::map m;
  std::string s("1");
  m[s] = "one";
  ... ; // Break here

The command "expr m[s]" fails without this change if the producer is
GCC.

http://reviews.llvm.org/D17618

Files:
  include/lldb/Symbol/SymbolFile.h
  packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
  packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/SymbolFile.cpp
  unittests/CMakeLists.txt
  unittests/Language/CMakeLists.txt
  unittests/Language/CPlusPlus/CMakeLists.txt
  unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp

Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
===
--- /dev/null
+++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp
@@ -0,0 +1,32 @@
+//===-- ScalarTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
+using namespace lldb_private;
+
+TEST(TypeNamesEqualTest, Equality)
+{
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *"));
+ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const"));
+}
+
+TEST(TypeNamesEqualTest, InEquality)
+{
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const"));
+ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const"));
+}
Index: unittests/Language/CPlusPlus/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CPlusPlus/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_lldb_unittest(LLDBCPlusCPlusLanguageTests
+  TypeNamesEqualityTest.cpp
+  )
+
+  target_link_libraries(lldbPluginCPlusPlusLanguage)
Index: unittests/Language/CMakeLists.txt
===
--- /dev/null
+++ unittests/Language/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(CPlusPlus)
Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -28,5 +28,6 @@
 add_subdirectory(Expression)
 add_subdirectory(Host)
 add_subdirectory(Interpreter)
+add_subdirectory(Language)
 add_subdirectory(ScriptInterpreter)
 add_subdirectory(Utility)
Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -135,7 +135,10 @@
 }
 
 void
-SymbolFile::GetMangledNamesForFunction(const std::string _qualified_name, std::vector _names)
+SymbolFile::GetMangledNamesForFunction(const SymbolContext ,
+   const std::string _qualified_name,
+   const std::vector ,
+   std::vector _names)
 {
 return;
 }
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -209,7 +209,9 @@
lldb_private::SymbolContextList& sc_list) override;
 

Re: [Lldb-commits] [PATCH] D17182: Adjust for Python-3.

2016-02-12 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 47835.
sivachandra marked an inline comment as done.
sivachandra added a comment.

Address comments


http://reviews.llvm.org/D17182

Files:
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/plugins/builder_linux.py
  packages/Python/lldbsuite/test/plugins/builder_linux2.py
  scripts/Python/modules/readline/readline.cpp
  source/API/liblldb.exports

Index: source/API/liblldb.exports
===
--- source/API/liblldb.exports
+++ source/API/liblldb.exports
@@ -1,3 +1,4 @@
 _ZN4lldb*
 _ZNK4lldb*
 init_lld*
+PyInit__lldb
Index: scripts/Python/modules/readline/readline.cpp
===
--- scripts/Python/modules/readline/readline.cpp
+++ scripts/Python/modules/readline/readline.cpp
@@ -20,11 +20,6 @@
 // work around LLVM pr18841 to avoid seg faults in the stock Python
 // readline.so linked against GNU readline.
 
-static struct PyMethodDef moduleMethods[] =
-{
-{nullptr, nullptr, 0, nullptr}
-};
-
 #ifndef LLDB_DISABLE_LIBEDIT
 PyDoc_STRVAR(
 moduleDocumentation,
@@ -35,9 +30,33 @@
 "Stub module meant to avoid linking GNU readline.");
 #endif
 
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module =
+{
+PyModuleDef_HEAD_INIT, // m_base
+"readline",// m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] =
+{
+{nullptr, nullptr, 0, nullptr}
+};
+#endif
+
 #ifndef LLDB_DISABLE_LIBEDIT
 static char*
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
 simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
 {
 rl_instream = stdin;
 rl_outstream = stdout;
@@ -67,10 +86,15 @@
 #ifndef LLDB_DISABLE_LIBEDIT
 PyOS_ReadlineFunctionPointer = simple_readline;
 #endif
+
+#if PY_MAJOR_VERSION >= 3
+return PyModule_Create(_module);
+#else
 Py_InitModule4(
 "readline",
 moduleMethods,
 moduleDocumentation,
 static_cast(NULL),
 PYTHON_API_VERSION);
+#endif
 }
Index: packages/Python/lldbsuite/test/plugins/builder_linux2.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/plugins/builder_linux2.py
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, 
clean=True):
-return False
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -440,6 +440,10 @@
 return __import__("builder_freebsd")
 if sys.platform.startswith("netbsd"):
 return __import__("builder_netbsd")
+if sys.platform.startswith("linux"):
+# sys.platform with Python-3.x returns 'linux', but with
+# Python-2.x it returns 'linux2'.
+return __import__("builder_linux")
 return __import__("builder_" + sys.platform)
 
 


Index: source/API/liblldb.exports
===
--- source/API/liblldb.exports
+++ source/API/liblldb.exports
@@ -1,3 +1,4 @@
 _ZN4lldb*
 _ZNK4lldb*
 init_lld*
+PyInit__lldb
Index: scripts/Python/modules/readline/readline.cpp
===
--- scripts/Python/modules/readline/readline.cpp
+++ scripts/Python/modules/readline/readline.cpp
@@ -20,11 +20,6 @@
 // work around LLVM pr18841 to avoid seg faults in the stock Python
 // readline.so linked against GNU readline.
 
-static struct PyMethodDef moduleMethods[] =
-{
-{nullptr, nullptr, 0, nullptr}
-};
-
 #ifndef LLDB_DISABLE_LIBEDIT
 PyDoc_STRVAR(
 moduleDocumentation,
@@ -35,9 +30,33 @@
 "Stub module meant to avoid linking GNU readline.");
 #endif
 
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module =
+{
+PyModuleDef_HEAD_INIT, // m_base
+"readline",// m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] =
+{
+{nullptr, nullptr, 0, nullptr}
+};
+#endif
+
 #ifndef LLDB_DISABLE_LIBEDIT
 static char*
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
 simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
 {
 rl_instream = stdin;
 

[Lldb-commits] [lldb] r260721 - Adjust for Python-3.

2016-02-12 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Fri Feb 12 14:30:47 2016
New Revision: 260721

URL: http://llvm.org/viewvc/llvm-project?rev=260721=rev
Log:
Adjust for Python-3.

Summary:
This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.

Reviewers: tfiala, labath, zturner

Subscribers: lldb-commits

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py
  - copied unchanged from r260720, 
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
Removed:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/scripts/Python/modules/readline/readline.cpp
lldb/trunk/source/API/liblldb.exports

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=260721=260720=260721=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Feb 12 14:30:47 
2016
@@ -440,6 +440,10 @@ def builder_module():
 return __import__("builder_freebsd")
 if sys.platform.startswith("netbsd"):
 return __import__("builder_netbsd")
+if sys.platform.startswith("linux"):
+# sys.platform with Python-3.x returns 'linux', but with
+# Python-2.x it returns 'linux2'.
+return __import__("builder_linux")
 return __import__("builder_" + sys.platform)
 
 

Removed: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py?rev=260720=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py 
(removed)
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, 
clean=True):
-return False

Modified: lldb/trunk/scripts/Python/modules/readline/readline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/readline/readline.cpp?rev=260721=260720=260721=diff
==
--- lldb/trunk/scripts/Python/modules/readline/readline.cpp (original)
+++ lldb/trunk/scripts/Python/modules/readline/readline.cpp Fri Feb 12 14:30:47 
2016
@@ -20,11 +20,6 @@
 // work around LLVM pr18841 to avoid seg faults in the stock Python
 // readline.so linked against GNU readline.
 
-static struct PyMethodDef moduleMethods[] =
-{
-{nullptr, nullptr, 0, nullptr}
-};
-
 #ifndef LLDB_DISABLE_LIBEDIT
 PyDoc_STRVAR(
 moduleDocumentation,
@@ -35,9 +30,33 @@ PyDoc_STRVAR(
 "Stub module meant to avoid linking GNU readline.");
 #endif
 
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module =
+{
+PyModuleDef_HEAD_INIT, // m_base
+"readline",// m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] =
+{
+{nullptr, nullptr, 0, nullptr}
+};
+#endif
+
 #ifndef LLDB_DISABLE_LIBEDIT
 static char*
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
 simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
 {
 rl_instream = stdin;
 rl_outstream = stdout;
@@ -67,10 +86,15 @@ initreadline(void)
 #ifndef LLDB_DISABLE_LIBEDIT
 PyOS_ReadlineFunctionPointer = simple_readline;
 #endif
+
+#if PY_MAJOR_VERSION >= 3
+return PyModule_Create(_module);
+#else
 Py_InitModule4(
 "readline",
 moduleMethods,
 moduleDocumentation,
 static_cast(NULL),
 PYTHON_API_VERSION);
+#endif
 }

Modified: lldb/trunk/source/API/liblldb.exports
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/liblldb.exports?rev=260721=260720=260721=diff
==
--- lldb/trunk/source/API/liblldb.exports (original)
+++ lldb/trunk/source/API/liblldb.exports Fri Feb 12 14:30:47 2016
@@ -1,3 +1,4 @@
 _ZN4lldb*
 _ZNK4lldb*
 init_lld*
+PyInit__lldb


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


Re: [Lldb-commits] [PATCH] D17182: Adjust for Python-3.

2016-02-12 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: source/API/liblldb.exports:4
@@ -3,1 +3,2 @@
 init_lld*
+PyInit__lld*

labath wrote:
> zturner wrote:
> > I don't really know what the syntax of this file is, but the symbol is 
> > called `PyInit__lldb`, not `PyInit__lld`.  Is this still correct?  Does it 
> > matter that you're exporting both the Python 2 and the Python 3 symbol in 
> > both versions even when they're not defined?
> This just restricts the exported symbols to the ones matching the wildcards, 
> so I don't think it matters that both are present. 
> OTOH, unless we know the reason why the `b` has to be omitted from the 
> wildcard, then I suggest you add it.
I just followed the existing "convention". Works without the "*" as well, so 
removed it according to the suggestion.


Comment at: source/API/liblldb.exports:4
@@ -3,1 +3,2 @@
 init_lld*
+PyInit__lld*

sivachandra wrote:
> labath wrote:
> > zturner wrote:
> > > I don't really know what the syntax of this file is, but the symbol is 
> > > called `PyInit__lldb`, not `PyInit__lld`.  Is this still correct?  Does 
> > > it matter that you're exporting both the Python 2 and the Python 3 symbol 
> > > in both versions even when they're not defined?
> > This just restricts the exported symbols to the ones matching the 
> > wildcards, so I don't think it matters that both are present. 
> > OTOH, unless we know the reason why the `b` has to be omitted from the 
> > wildcard, then I suggest you add it.
> I just followed the existing "convention". Works without the "*" as well, so 
> removed it according to the suggestion.
zturner: The listing here does not say what *should* be exported, but that a 
symbol should be exported only if matches one of these regexes.


http://reviews.llvm.org/D17182



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


[Lldb-commits] [lldb] r260793 - [TestLibCxxAtomic] Skip for GCC.

2016-02-12 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Fri Feb 12 20:11:11 2016
New Revision: 260793

URL: http://llvm.org/viewvc/llvm-project?rev=260793=rev
Log:
[TestLibCxxAtomic] Skip for GCC.

Summary: This is the form on other libc++ tests.

Reviewers: sivachandra

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py?rev=260793=260792=260793=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
 Fri Feb 12 20:11:11 2016
@@ -22,6 +22,7 @@ class LibCxxAtomicTestCase(TestBase):
 var.SetPreferSyntheticValue(True)
 return var
 
+@skipIf(compiler="gcc")
 @skipIfWindows # libc++ not ported to Windows yet
 def test(self):
 """Test that std::atomic as defined by libc++ is correctly printed by 
LLDB"""


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


Re: [Lldb-commits] [PATCH] D17230: [TestLibCxxAtomic] Skip for GCC.

2016-02-12 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260793: [TestLibCxxAtomic] Skip for GCC. (authored by 
sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D17230?vs=47885=47886#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17230

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
@@ -22,6 +22,7 @@
 var.SetPreferSyntheticValue(True)
 return var
 
+@skipIf(compiler="gcc")
 @skipIfWindows # libc++ not ported to Windows yet
 def test(self):
 """Test that std::atomic as defined by libc++ is correctly printed by 
LLDB"""


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
@@ -22,6 +22,7 @@
 var.SetPreferSyntheticValue(True)
 return var
 
+@skipIf(compiler="gcc")
 @skipIfWindows # libc++ not ported to Windows yet
 def test(self):
 """Test that std::atomic as defined by libc++ is correctly printed by LLDB"""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17227: [TestLibCxxAtomic] Fix Makefile so that the test builds on Linux.

2016-02-12 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: granata.enrico.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D17227

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile

Index: 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
===
--- 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
+++ 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
@@ -1,4 +1,5 @@
 LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules


Index: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
===
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
@@ -1,4 +1,5 @@
 LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r260770 - [TestLibCxxAtomic] Fix Makefile so that the test builds on Linux.

2016-02-12 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Fri Feb 12 18:09:42 2016
New Revision: 260770

URL: http://llvm.org/viewvc/llvm-project?rev=260770=rev
Log:
[TestLibCxxAtomic] Fix Makefile so that the test builds on Linux.

Reviewers: granata.enrico

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile?rev=260770=260769=260770=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile
 Fri Feb 12 18:09:42 2016
@@ -1,4 +1,5 @@
 LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
+USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules


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


Re: [Lldb-commits] [PATCH] D17182: Adjust for Python-3.

2016-02-11 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

BTW, I should mention that the testsuite run with Python-2.x is still clean 
with this change applied.


http://reviews.llvm.org/D17182



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


[Lldb-commits] [PATCH] D17182: Adjust for Python-3.

2016-02-11 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: zturner, tfiala, labath.
sivachandra added a subscriber: lldb-commits.

This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.

http://reviews.llvm.org/D17182

Files:
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/plugins/builder_linux.py
  packages/Python/lldbsuite/test/plugins/builder_linux2.py
  scripts/Python/modules/readline/readline.cpp
  source/API/liblldb.exports

Index: source/API/liblldb.exports
===
--- source/API/liblldb.exports
+++ source/API/liblldb.exports
@@ -1,3 +1,4 @@
 _ZN4lldb*
 _ZNK4lldb*
 init_lld*
+PyInit__lld*
Index: scripts/Python/modules/readline/readline.cpp
===
--- scripts/Python/modules/readline/readline.cpp
+++ scripts/Python/modules/readline/readline.cpp
@@ -20,11 +20,6 @@
 // work around LLVM pr18841 to avoid seg faults in the stock Python
 // readline.so linked against GNU readline.
 
-static struct PyMethodDef moduleMethods[] =
-{
-{nullptr, nullptr, 0, nullptr}
-};
-
 #ifndef LLDB_DISABLE_LIBEDIT
 PyDoc_STRVAR(
 moduleDocumentation,
@@ -35,9 +30,33 @@
 "Stub module meant to avoid linking GNU readline.");
 #endif
 
+#if PY_VERSION_HEX >= 0x0300
+static struct PyModuleDef readline_module =
+{
+PyModuleDef_HEAD_INIT, // m_base
+"readline",// m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] =
+{
+{nullptr, nullptr, 0, nullptr}
+};
+#endif
+
 #ifndef LLDB_DISABLE_LIBEDIT
 static char*
+#if PY_VERSION_HEX >= 0x0300
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
 simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
 {
 rl_instream = stdin;
 rl_outstream = stdout;
@@ -67,10 +86,15 @@
 #ifndef LLDB_DISABLE_LIBEDIT
 PyOS_ReadlineFunctionPointer = simple_readline;
 #endif
+
+#if PY_VERSION_HEX >= 0x0300
+return PyModule_Create(_module);
+#else
 Py_InitModule4(
 "readline",
 moduleMethods,
 moduleDocumentation,
 static_cast(NULL),
 PYTHON_API_VERSION);
+#endif
 }
Index: packages/Python/lldbsuite/test/plugins/builder_linux2.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/plugins/builder_linux2.py
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, 
clean=True):
-return False
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -440,6 +440,10 @@
 return __import__("builder_freebsd")
 if sys.platform.startswith("netbsd"):
 return __import__("builder_netbsd")
+if sys.platform.startswith("linux"):
+# sys.platform with Python-3.x returns 'linux', but with
+# Python-2.x it returns 'linux2'.
+return __import__("builder_linux")
 return __import__("builder_" + sys.platform)
 
 


Index: source/API/liblldb.exports
===
--- source/API/liblldb.exports
+++ source/API/liblldb.exports
@@ -1,3 +1,4 @@
 _ZN4lldb*
 _ZNK4lldb*
 init_lld*
+PyInit__lld*
Index: scripts/Python/modules/readline/readline.cpp
===
--- scripts/Python/modules/readline/readline.cpp
+++ scripts/Python/modules/readline/readline.cpp
@@ -20,11 +20,6 @@
 // work around LLVM pr18841 to avoid seg faults in the stock Python
 // readline.so linked against GNU readline.
 
-static struct PyMethodDef moduleMethods[] =
-{
-{nullptr, nullptr, 0, nullptr}
-};
-
 #ifndef LLDB_DISABLE_LIBEDIT
 PyDoc_STRVAR(
 moduleDocumentation,
@@ -35,9 +30,33 @@
 "Stub module meant to avoid linking GNU readline.");
 #endif
 
+#if PY_VERSION_HEX >= 0x0300
+static struct PyModuleDef readline_module =
+{
+PyModuleDef_HEAD_INIT, // m_base
+"readline",// m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] =
+{
+{nullptr, nullptr, 0, nullptr}
+};
+#endif
+
 #ifndef LLDB_DISABLE_LIBEDIT
 static char*
+#if PY_VERSION_HEX >= 

Re: [Lldb-commits] [lldb] r260422 - Remove expectedFailureLinux decorator.

2016-02-10 Thread Siva Chandra via lldb-commits
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py?rev=260422=260421=260422=diff
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py 
> (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py 
> Wed Feb 10 13:53:36 2016
> @@ -19,7 +19,7 @@ class CModulesTestCase(TestBase):
>
>  @skipIfFreeBSD
>  @expectedFailureDarwin('http://llvm.org/pr24302')
> -@expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown 
> return type
> +@expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], 
> bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")

Why did you add arm archs? It fails for x86_64 and i386 as well:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11254

>  @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: 
> Name lookup not working correctly on Windows")
>  def test_expr(self):
>  if platform.system() == "Darwin" and platform.release() < 
> StrictVersion('12.0.0'):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r260192 - [TestExprsChar] Fix a typo is failure archs list

2016-02-08 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Mon Feb  8 20:18:50 2016
New Revision: 260192

URL: http://llvm.org/viewvc/llvm-project?rev=260192=rev
Log:
[TestExprsChar] Fix a typo is failure archs list

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py?rev=260192=260191=260192=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
 Mon Feb  8 20:18:50 2016
@@ -62,7 +62,7 @@ class ExprCharTestCase(TestBase):
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-@expectedFailureAll(archs=["i[3-6]86", "x86_x64"], 
bugnumber="llvm.org/pr23069")
+@expectedFailureAll(archs=["i[3-6]86", "x86_64"], 
bugnumber="llvm.org/pr23069")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple = 'mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):


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


Re: [Lldb-commits] [PATCH] D17014: [TestExprsChar] Fix a typo is failure archs list

2016-02-08 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260192: [TestExprsChar] Fix a typo is failure archs list 
(authored by sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D17014?vs=47283=47284#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17014

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -62,7 +62,7 @@
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-@expectedFailureAll(archs=["i[3-6]86", "x86_x64"], 
bugnumber="llvm.org/pr23069")
+@expectedFailureAll(archs=["i[3-6]86", "x86_64"], 
bugnumber="llvm.org/pr23069")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple = 'mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):


Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -62,7 +62,7 @@
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-@expectedFailureAll(archs=["i[3-6]86", "x86_x64"], bugnumber="llvm.org/pr23069")
+@expectedFailureAll(archs=["i[3-6]86", "x86_64"], bugnumber="llvm.org/pr23069")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple = 'mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17014: [TestExprsChar] Fix a typo is failure archs list

2016-02-08 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: zturner.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D17014

Files:
  packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py

Index: packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
===
--- packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -62,7 +62,7 @@
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-@expectedFailureAll(archs=["i[3-6]86", "x86_x64"], 
bugnumber="llvm.org/pr23069")
+@expectedFailureAll(archs=["i[3-6]86", "x86_64"], 
bugnumber="llvm.org/pr23069")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple = 'mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):


Index: packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
===
--- packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -62,7 +62,7 @@
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
-@expectedFailureAll(archs=["i[3-6]86", "x86_x64"], bugnumber="llvm.org/pr23069")
+@expectedFailureAll(archs=["i[3-6]86", "x86_64"], bugnumber="llvm.org/pr23069")
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple = 'mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r259902 - Take 2: Use an artifical namespace so that member vars do not hide local vars.

2016-02-05 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Fri Feb  5 13:10:04 2016
New Revision: 259902

URL: http://llvm.org/viewvc/llvm-project?rev=259902=rev
Log:
Take 2: Use an artifical namespace so that member vars do not hide local vars.

Summary: This relands r259810 with fix for failures on Mac.

Reviewers: spyffe, tfiala

Subscribers: tfiala, lldb-commits

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Expression/ExpressionSourceCode.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=259902=259901=259902=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Feb  5 13:10:04 2016
@@ -422,6 +422,11 @@ public:
 GetUniqueNamespaceDeclaration (const char *name,
clang::DeclContext *decl_ctx);
 
+static clang::NamespaceDecl *
+GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+   const char *name,
+   clang::DeclContext *decl_ctx);
+
 //--
 // Function Types
 //--
@@ -565,7 +570,9 @@ public:
 //--
 
 std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) 
override;
+DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_using_decls) override;
 
 bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=259902=259901=259902=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Fri Feb  5 13:10:04 
2016
@@ -66,7 +66,7 @@ public:
 IsClang () const;
 
 std::vector
-FindDeclByName (ConstString name);
+FindDeclByName (ConstString name, const bool ignore_using_decls);
 
 //--
 /// Checks if this decl context represents a method of a class.

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=259902=259901=259902=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Fri Feb  5 13:10:04 2016
@@ -143,7 +143,9 @@ public:
 //--
 
 virtual std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
+DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_imported_decls);
 
 virtual bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0;

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile?rev=259902=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
 Fri Feb  5 13:10:04 2016
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES = main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 

[Lldb-commits] [PATCH] D16900: Take 2: Use an artifical namespace so that member vars do not hide local vars.

2016-02-04 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: spyffe, tfiala.
sivachandra added a subscriber: lldb-commits.

This relands r259810 with fix for failures on Mac.

http://reviews.llvm.org/D16900

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/TypeSystem.h
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/TypeSystem.cpp

Index: source/Symbol/TypeSystem.cpp
===
--- source/Symbol/TypeSystem.cpp
+++ source/Symbol/TypeSystem.cpp
@@ -153,7 +153,9 @@
 
 
 std::vector
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   bool ignore_imported_decls)
 {
 return std::vector();
 }
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -15,10 +15,11 @@
 using namespace lldb_private;
 
 std::vector
-CompilerDeclContext::FindDeclByName (ConstString name)
+CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls)
 {
 if (IsValid())
-return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
+return m_type_system->DeclContextFindDeclByName(
+m_opaque_decl_ctx, name, ignore_using_decls);
 else
 return std::vector();
 }
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1885,6 +1885,17 @@
 return namespace_decl;
 }
 
+NamespaceDecl *
+ClangASTContext::GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+const char *name,
+clang::DeclContext *decl_ctx)
+{
+ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
+if (ast_ctx == nullptr)
+return nullptr;
+
+return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx);
+}
 
 clang::BlockDecl *
 ClangASTContext::CreateBlockDeclaration (clang::DeclContext *ctx)
@@ -9781,7 +9792,9 @@
 //--
 
 std::vector
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_using_decls)
 {
 std::vector found_decls;
 if (opaque_decl_ctx)
@@ -9805,12 +9818,16 @@
 {
 if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_using_decls)
+continue;
 clang::DeclContext *from = ud->getCommonAncestor();
 if (searched.find(ud->getNominatedNamespace()) == searched.end())
 search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
 }
 else if (clang::UsingDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_using_decls)
+continue;
 for (clang::UsingShadowDecl *usd : ud->shadows())
 {
 clang::Decl *target = usd->getTargetDecl();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,6 +707,9 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
+
+ClangASTContext *
+GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -57,6 

Re: [Lldb-commits] [PATCH] D16900: Take 2: Use an artifical namespace so that member vars do not hide local vars.

2016-02-04 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: source/Expression/ExpressionSourceCode.cpp:188
@@ +187,3 @@
+ConstString var_name = var_sp->GetName();
+if (var_name == ConstString("this") || var_name == 
ConstString(".block_descriptor"))
+continue;

This line is the only one difference between the previous version and this. An 
additional check for a var with name ".block_descriptor" has been added.


http://reviews.llvm.org/D16900



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


Re: [Lldb-commits] [PATCH] D16900: Take 2: Use an artifical namespace so that member vars do not hide local vars.

2016-02-04 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

Thanks a lot Todd. I will put this in tomorrow morning just to be on the safer 
side.


http://reviews.llvm.org/D16900



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


[Lldb-commits] [lldb] r259810 - Use an artifical namespace so that member vars do not hide local vars.

2016-02-04 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Thu Feb  4 12:38:35 2016
New Revision: 259810

URL: http://llvm.org/viewvc/llvm-project?rev=259810=rev
Log:
Use an artifical namespace so that member vars do not hide local vars.

Summary:
While evaluating expressions when stopped in a class method, there was a
problem of member variables hiding local variables. This was happening
because, in the context of a method, clang already knew about member
variables with their name and assumed that they were the only variables
with those names in scope. Consequently, clang never checks with LLDB
about the possibility of local variables with the same name and goes
wrong. This change addresses the problem by using an artificial
namespace "$__lldb_local_vars". All local variables in scope are
declared in the "$__lldb_expr" method as follows:

using $__lldb_local_vars::;
using $__lldb_local_vars::;
...

This hides the member variables with the same name and forces clang to
enquire about the variables which it thinks are declared in
$__lldb_local_vars. When LLDB notices that clang is enquiring about
variables in $__lldb_local_vars, it looks up local vars and conveys
their information if found. This way, member variables do not hide local
variables, leading to correct evaluation of expressions.

A point to keep in mind is that the above solution does not solve the
problem for one specific case:

namespace N
{
int a;
}

class A
{
public:
void Method();
int a;
};

void
A::Method()
{
using N::a;
...

// Since the above solution only touches locals, it does not
// force clang to enquire about "a" coming from namespace N.
}

Reviewers: clayborg, spyffe

Subscribers: lldb-commits

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Expression/ExpressionSourceCode.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=259810=259809=259810=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Feb  4 12:38:35 2016
@@ -422,6 +422,11 @@ public:
 GetUniqueNamespaceDeclaration (const char *name,
clang::DeclContext *decl_ctx);
 
+static clang::NamespaceDecl *
+GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+   const char *name,
+   clang::DeclContext *decl_ctx);
+
 //--
 // Function Types
 //--
@@ -565,7 +570,9 @@ public:
 //--
 
 std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) 
override;
+DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_using_decls) override;
 
 bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=259810=259809=259810=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Thu Feb  4 12:38:35 
2016
@@ -66,7 +66,7 @@ public:
 IsClang () const;
 
 std::vector
-FindDeclByName (ConstString name);
+FindDeclByName (ConstString name, const bool ignore_using_decls);
 
 //--
 /// Checks if this decl context represents a method of a class.

Modified: 

[Lldb-commits] [PATCH] D16895: Revert "Use an artifical namespace so that member vars do not hide local vars."

2016-02-04 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: spyffe.
sivachandra added a subscriber: lldb-commits.

This reverts commit 8af14b5f9af68c31ac80945e5b5d56f0a14b38e4.
Reverting as it breaks a few tests on Mac.

http://reviews.llvm.org/D16895

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/TypeSystem.h
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/TypeSystem.cpp

Index: source/Symbol/TypeSystem.cpp
===
--- source/Symbol/TypeSystem.cpp
+++ source/Symbol/TypeSystem.cpp
@@ -153,9 +153,7 @@
 
 
 std::vector
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
-   ConstString name,
-   bool ignore_imported_decls)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
 {
 return std::vector();
 }
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -15,11 +15,10 @@
 using namespace lldb_private;
 
 std::vector
-CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls)
+CompilerDeclContext::FindDeclByName (ConstString name)
 {
 if (IsValid())
-return m_type_system->DeclContextFindDeclByName(
-m_opaque_decl_ctx, name, ignore_using_decls);
+return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
 else
 return std::vector();
 }
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1885,17 +1885,6 @@
 return namespace_decl;
 }
 
-NamespaceDecl *
-ClangASTContext::GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
-const char *name,
-clang::DeclContext *decl_ctx)
-{
-ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
-if (ast_ctx == nullptr)
-return nullptr;
-
-return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx);
-}
 
 clang::BlockDecl *
 ClangASTContext::CreateBlockDeclaration (clang::DeclContext *ctx)
@@ -9792,9 +9781,7 @@
 //--
 
 std::vector
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
-   ConstString name,
-   const bool ignore_using_decls)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
 {
 std::vector found_decls;
 if (opaque_decl_ctx)
@@ -9818,16 +9805,12 @@
 {
 if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
 {
-if (ignore_using_decls)
-continue;
 clang::DeclContext *from = ud->getCommonAncestor();
 if (searched.find(ud->getNominatedNamespace()) == searched.end())
 search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
 }
 else if (clang::UsingDecl *ud = llvm::dyn_cast(child))
 {
-if (ignore_using_decls)
-continue;
 for (clang::UsingShadowDecl *usd : ud->shadows())
 {
 clang::Decl *target = usd->getTargetDecl();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,9 +707,6 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
-
-ClangASTContext *
-GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ 

Re: [Lldb-commits] [PATCH] D16895: Revert "Use an artifical namespace so that member vars do not hide local vars."

2016-02-04 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259823: Revert "Use an artifical namespace so that member 
vars do not hide local vars." (authored by sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D16895?vs=46944=46945#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16895

Files:
  lldb/trunk/include/lldb/Symbol/ClangASTContext.h
  lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
  lldb/trunk/include/lldb/Symbol/TypeSystem.h
  
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  lldb/trunk/source/Expression/ExpressionSourceCode.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Symbol/CompilerDeclContext.cpp
  lldb/trunk/source/Symbol/TypeSystem.cpp

Index: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
===
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
@@ -66,7 +66,7 @@
 IsClang () const;
 
 std::vector
-FindDeclByName (ConstString name, const bool ignore_using_decls);
+FindDeclByName (ConstString name);
 
 //--
 /// Checks if this decl context represents a method of a class.
Index: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
===
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h
@@ -422,11 +422,6 @@
 GetUniqueNamespaceDeclaration (const char *name,
clang::DeclContext *decl_ctx);
 
-static clang::NamespaceDecl *
-GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
-   const char *name,
-   clang::DeclContext *decl_ctx);
-
 //--
 // Function Types
 //--
@@ -570,9 +565,7 @@
 //--
 
 std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx,
-   ConstString name,
-   const bool ignore_using_decls) override;
+DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override;
 
 bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;
Index: lldb/trunk/include/lldb/Symbol/TypeSystem.h
===
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h
@@ -143,9 +143,7 @@
 //--
 
 virtual std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx,
-   ConstString name,
-   const bool ignore_imported_decls);
+DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
 
 virtual bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0;
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES = main.cpp
-
-include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
@@ -1,73 +0,0 @@
-namespace NN
-{
-  int a = 778899;
-  int b = 665544;
-  int c = 445566;
-}
-
-class A
-{
-public:
-  A();
-  int Method(int a, int b);
-
-private:
-  int a, b;
-};
-
-A::A() : a(10), b(100) { }
-
-int a = 112233;
-int b = 445566;
-int c = 778899;
-
-int
-A::Method(int a, int b)
-{
-{
-int a = 12345;
-int b = 54321;
-int c = 34567;
-this->a = a + b + this->b; // Break 2
-}
-
-{
-using namespace NN;
-int a = 10001;
-

[Lldb-commits] [lldb] r259823 - Revert "Use an artifical namespace so that member vars do not hide local vars."

2016-02-04 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Thu Feb  4 14:08:40 2016
New Revision: 259823

URL: http://llvm.org/viewvc/llvm-project?rev=259823=rev
Log:
Revert "Use an artifical namespace so that member vars do not hide local vars."

Summary:
This reverts commit 8af14b5f9af68c31ac80945e5b5d56f0a14b38e4.
Reverting as it breaks a few tests on Mac.

Reviewers: spyffe

Subscribers: lldb-commits

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

Removed:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Expression/ExpressionSourceCode.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=259823=259822=259823=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Feb  4 14:08:40 2016
@@ -422,11 +422,6 @@ public:
 GetUniqueNamespaceDeclaration (const char *name,
clang::DeclContext *decl_ctx);
 
-static clang::NamespaceDecl *
-GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
-   const char *name,
-   clang::DeclContext *decl_ctx);
-
 //--
 // Function Types
 //--
@@ -570,9 +565,7 @@ public:
 //--
 
 std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx,
-   ConstString name,
-   const bool ignore_using_decls) override;
+DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) 
override;
 
 bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=259823=259822=259823=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Thu Feb  4 14:08:40 
2016
@@ -66,7 +66,7 @@ public:
 IsClang () const;
 
 std::vector
-FindDeclByName (ConstString name, const bool ignore_using_decls);
+FindDeclByName (ConstString name);
 
 //--
 /// Checks if this decl context represents a method of a class.

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=259823=259822=259823=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu Feb  4 14:08:40 2016
@@ -143,9 +143,7 @@ public:
 //--
 
 virtual std::vector
-DeclContextFindDeclByName (void *opaque_decl_ctx,
-   ConstString name,
-   const bool ignore_imported_decls);
+DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
 
 virtual bool
 DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0;

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile?rev=259822=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
 (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../../make
-
-CXX_SOURCES = main.cpp
-
-include $(LEVEL)/Makefile.rules

Removed: 

Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-02-03 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

In http://reviews.llvm.org/D16746#342507, @spyffe wrote:

> Siva, I've inlined my comments.  I believe there's a misunderstanding about 
> what role //this// has in the patched version of 
> GetUniqueNamespaceDeclaration.  In fact, as I argue in my inline comment, 
> //this// is unused.  That's confusing code.  You can achieve the same effect 
> by leaving the code as is and just passing the right thing in for //this//.


This comment clears it up for me. I now follow and agree with the rest of your 
inline comments. Will send the updated patch as soon as I can get to this.

Thanks,
Siva Chandra


http://reviews.llvm.org/D16746



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


Re: [Lldb-commits] [PATCH] D16830: Move some android platform functions to lldbplatformutil

2016-02-03 Thread Siva Chandra via lldb-commits
This change broke Android testsuite run:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-android/builds/5147

On Wed, Feb 3, 2016 at 11:20 AM, Zachary Turner via lldb-commits
 wrote:
> zturner added a comment.
>
> In http://reviews.llvm.org/D16830#343232, @zturner wrote:
>
>> In http://reviews.llvm.org/D16830#342842, @tberghammer wrote:
>>
>> > Looks reasonable and I agree with Pavel in the idea of moving the android 
>> > related utility functions into their own file for better separation
>>
>>
>> I thought about creating an android specific module but I decided taht there 
>> is so little code right now it might not make sense.  And then we already 
>> had this lldbplatformutil file that had only 1 function in it, so nobody was 
>> even really using it.  So rather than end up with 2 different modules with 3 
>> functions each, just have just have 1 module with 6 functions.  On the other 
>> hand, if they continue to grow, then splitting apart makes a lot of sense.
>>
>> It's not a big deal to me either way, so if you guys feel strongly I can 
>> move it.  Since you're in a different time zone though and might not get 
>> this for another 24 hours, maybe I'll commit like this and then if you
>
>
> (somehow my previous message got cut off).
>
> if you want it changed let me know and I'll move it to an android-specific 
> file tomorrow.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D16830
>
>
>
> ___
> 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] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-02-03 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1381
@@ +1380,3 @@
+clang::NamespaceDecl *namespace_decl = 
ClangASTContext::GetUniqueNamespaceDeclaration(
+m_ast_context, name_unique_cstr, nullptr);
+if (namespace_decl)

Done. I hope I understood you right.


http://reviews.llvm.org/D16746



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


Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-02-03 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 46852.
sivachandra added a comment.

Address Sean's comment.


http://reviews.llvm.org/D16746

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/TypeSystem.h
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/TypeSystem.cpp

Index: source/Symbol/TypeSystem.cpp
===
--- source/Symbol/TypeSystem.cpp
+++ source/Symbol/TypeSystem.cpp
@@ -153,7 +153,9 @@
 
 
 std::vector
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   bool ignore_imported_decls)
 {
 return std::vector();
 }
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -15,10 +15,11 @@
 using namespace lldb_private;
 
 std::vector
-CompilerDeclContext::FindDeclByName (ConstString name)
+CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_imported_decls)
 {
 if (IsValid())
-return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
+return m_type_system->DeclContextFindDeclByName(
+m_opaque_decl_ctx, name, ignore_imported_decls);
 else
 return std::vector();
 }
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1885,6 +1885,17 @@
 return namespace_decl;
 }
 
+NamespaceDecl *
+ClangASTContext::GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+const char *name,
+clang::DeclContext *decl_ctx)
+{
+ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
+if (ast_ctx == nullptr)
+return nullptr;
+
+return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx);
+}
 
 clang::BlockDecl *
 ClangASTContext::CreateBlockDeclaration (clang::DeclContext *ctx)
@@ -9781,7 +9792,9 @@
 //--
 
 std::vector
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_imported_decls)
 {
 std::vector found_decls;
 if (opaque_decl_ctx)
@@ -9805,12 +9818,16 @@
 {
 if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_imported_decls)
+continue;
 clang::DeclContext *from = ud->getCommonAncestor();
 if (searched.find(ud->getNominatedNamespace()) == searched.end())
 search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
 }
 else if (clang::UsingDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_imported_decls)
+continue;
 for (clang::UsingShadowDecl *usd : ud->shadows())
 {
 clang::Decl *target = usd->getTargetDecl();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,6 +707,9 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
+
+ClangASTContext *
+GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -57,6 +57,11 @@
 using namespace lldb_private;
 using namespace clang;

Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-02-03 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 46861.
sivachandra added a comment.

Address the arg name change comment.


http://reviews.llvm.org/D16746

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/TypeSystem.h
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/TypeSystem.cpp

Index: source/Symbol/TypeSystem.cpp
===
--- source/Symbol/TypeSystem.cpp
+++ source/Symbol/TypeSystem.cpp
@@ -153,7 +153,9 @@
 
 
 std::vector
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   bool ignore_imported_decls)
 {
 return std::vector();
 }
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -15,10 +15,11 @@
 using namespace lldb_private;
 
 std::vector
-CompilerDeclContext::FindDeclByName (ConstString name)
+CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls)
 {
 if (IsValid())
-return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
+return m_type_system->DeclContextFindDeclByName(
+m_opaque_decl_ctx, name, ignore_using_decls);
 else
 return std::vector();
 }
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1885,6 +1885,17 @@
 return namespace_decl;
 }
 
+NamespaceDecl *
+ClangASTContext::GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+const char *name,
+clang::DeclContext *decl_ctx)
+{
+ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
+if (ast_ctx == nullptr)
+return nullptr;
+
+return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx);
+}
 
 clang::BlockDecl *
 ClangASTContext::CreateBlockDeclaration (clang::DeclContext *ctx)
@@ -9781,7 +9792,9 @@
 //--
 
 std::vector
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_using_decls)
 {
 std::vector found_decls;
 if (opaque_decl_ctx)
@@ -9805,12 +9818,16 @@
 {
 if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_using_decls)
+continue;
 clang::DeclContext *from = ud->getCommonAncestor();
 if (searched.find(ud->getNominatedNamespace()) == searched.end())
 search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
 }
 else if (clang::UsingDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_using_decls)
+continue;
 for (clang::UsingShadowDecl *usd : ud->shadows())
 {
 clang::Decl *target = usd->getTargetDecl();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,6 +707,9 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
+
+ClangASTContext *
+GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -57,6 +57,11 @@
 using namespace lldb_private;
 using namespace clang;
 

[Lldb-commits] [lldb] r259607 - Fix a thinko in StackFrame::GetInScopeVariableList.

2016-02-02 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Tue Feb  2 17:49:41 2016
New Revision: 259607

URL: http://llvm.org/viewvc/llvm-project?rev=259607=rev
Log:
Fix a thinko in StackFrame::GetInScopeVariableList.

Reviewers: clayborg

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=259607=259606=259607=diff
==
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Tue Feb  2 17:49:41 2016
@@ -597,7 +597,7 @@ StackFrame::GetInScopeVariableList (bool
  var_list_sp.get());
 }
  
-if (m_sc.comp_unit)
+if (m_sc.comp_unit && get_file_globals)
 {
 VariableListSP global_variable_list_sp 
(m_sc.comp_unit->GetVariableList(true));
 if (global_variable_list_sp)


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


Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-02-02 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 46717.
sivachandra added a comment.

1. Added tests.
2. Extended the scope of this feature in presense of "using namespace ;"

decls.

3. Addressed one of the two comments by Sean. Will respond to the other on the

review page.


http://reviews.llvm.org/D16746

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/TypeSystem.h
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/TypeSystem.cpp

Index: source/Symbol/TypeSystem.cpp
===
--- source/Symbol/TypeSystem.cpp
+++ source/Symbol/TypeSystem.cpp
@@ -153,7 +153,9 @@
 
 
 std::vector
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
+   ConstString name,
+   bool ignore_imported_decls)
 {
 return std::vector();
 }
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -15,10 +15,11 @@
 using namespace lldb_private;
 
 std::vector
-CompilerDeclContext::FindDeclByName (ConstString name)
+CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_imported_decls)
 {
 if (IsValid())
-return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
+return m_type_system->DeclContextFindDeclByName(
+m_opaque_decl_ctx, name, ignore_imported_decls);
 else
 return std::vector();
 }
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1804,10 +1804,11 @@
 #pragma mark Namespace Declarations
 
 NamespaceDecl *
-ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx)
+ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx, ASTContext *ast)
 {
 NamespaceDecl *namespace_decl = nullptr;
-ASTContext *ast = getASTContext();
+if (ast == nullptr)
+ast = getASTContext();
 TranslationUnitDecl *translation_unit_decl = ast->getTranslationUnitDecl ();
 if (decl_ctx == nullptr)
 decl_ctx = translation_unit_decl;
@@ -9780,7 +9781,9 @@
 //--
 
 std::vector
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
+   ConstString name,
+   const bool ignore_imported_decls)
 {
 std::vector found_decls;
 if (opaque_decl_ctx)
@@ -9804,12 +9807,16 @@
 {
 if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_imported_decls)
+continue;
 clang::DeclContext *from = ud->getCommonAncestor();
 if (searched.find(ud->getNominatedNamespace()) == searched.end())
 search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
 }
 else if (clang::UsingDecl *ud = llvm::dyn_cast(child))
 {
+if (ignore_imported_decls)
+continue;
 for (clang::UsingShadowDecl *usd : ud->shadows())
 {
 clang::Decl *target = usd->getTargetDecl();
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,6 +707,9 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
+
+ClangASTContext *
+GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- 

[Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-01-29 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: clayborg, spyffe.
sivachandra added a subscriber: lldb-commits.

While evaluating expressions when stopped in a class method, there was a
problem of member variables hiding local variables. This was happening
because, in the context of a method, clang already knew about member
variables with their name and assumed that they were the only variables
with those names in scope. Consequently, clang never checks with LLDB
about the possibility of local variables with the same name and goes
wrong. This change addresses the problem by using an artificial
namespace "$__lldb_local_vars". All local variables in scope are
declared in the "$__lldb_expr" method as follows:

using $__lldb_local_vars::;
using $__lldb_local_vars::;
...

This hides the member variables with the same name and forces clang to
enquire about the variables which it thinks are declared in
$__lldb_local_vars. When LLDB notices that clang is enquiring about
variables in $__lldb_local_vars, it looks up local vars and conveys
their information if found. This way, member variables do not hide local
variables, leading to correct evaluation of expressions.

http://reviews.llvm.org/D16746

Files:
  include/lldb/Symbol/ClangASTContext.h
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Symbol/ClangASTContext.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -597,7 +597,7 @@
  var_list_sp.get());
 }
  
-if (m_sc.comp_unit)
+if (m_sc.comp_unit && get_file_globals)
 {
 VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
 if (global_variable_list_sp)
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1804,10 +1804,11 @@
 #pragma mark Namespace Declarations
 
 NamespaceDecl *
-ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx)
+ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx, ASTContext *ast)
 {
 NamespaceDecl *namespace_decl = nullptr;
-ASTContext *ast = getASTContext();
+if (ast == nullptr)
+ast = getASTContext();
 TranslationUnitDecl *translation_unit_decl = ast->getTranslationUnitDecl ();
 if (decl_ctx == nullptr)
 decl_ctx = translation_unit_decl;
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -707,6 +707,9 @@
 AddThisType(NameSearchContext ,
 TypeFromUser ,
 unsigned int current_id);
+
+ClangASTContext *
+GetClangASTContext();
 };
 
 } // namespace lldb_private
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -57,6 +57,11 @@
 using namespace lldb_private;
 using namespace clang;
 
+namespace
+{
+const char *g_lldb_local_vars_namespace_cstr = "$__lldb_local_vars";
+} // anonymous namespace
+
 ClangExpressionDeclMap::ClangExpressionDeclMap (bool keep_result_in_memory,
 Materializer::PersistentVariableDelegate *result_delegate,
 ExecutionContext _ctx) :
@@ -1004,6 +1009,24 @@
 return VariableSP();
 }
 
+ClangASTContext *
+ClangExpressionDeclMap::GetClangASTContext ()
+{
+StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
+if (frame == nullptr)
+return nullptr;
+
+SymbolContext sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction|lldb::eSymbolContextBlock);
+if (sym_ctx.block == nullptr)
+return nullptr;
+
+CompilerDeclContext frame_decl_context = sym_ctx.block->GetDeclContext();
+if (!frame_decl_context)
+return nullptr;
+
+return llvm::dyn_cast_or_null(frame_decl_context.GetTypeSystem());
+}
+
 // Interface for ClangASTSource
 
 void
@@ -1039,6 +1062,13 @@
 
 if (const NamespaceDecl *namespace_context = dyn_cast(context.m_decl_context))
 {
+if (namespace_context->getName().str() == std::string(g_lldb_local_vars_namespace_cstr))
+{
+CompilerDeclContext compiler_decl_ctx(GetClangASTContext(), (void*)context.m_decl_context);
+   

Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-01-29 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

I have tested this with examples and the test run is clean. I will add tests if 
you think the overall approach is acceptable.


http://reviews.llvm.org/D16746



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


[Lldb-commits] [PATCH] D16745: Fix a thinko in StackFrame::GetInScopeVariableList.

2016-01-29 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: clayborg.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D16745

Files:
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -597,7 +597,7 @@
  var_list_sp.get());
 }
  
-if (m_sc.comp_unit)
+if (m_sc.comp_unit && get_file_globals)
 {
 VariableListSP global_variable_list_sp 
(m_sc.comp_unit->GetVariableList(true));
 if (global_variable_list_sp)


Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -597,7 +597,7 @@
  var_list_sp.get());
 }
  
-if (m_sc.comp_unit)
+if (m_sc.comp_unit && get_file_globals)
 {
 VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
 if (global_variable_list_sp)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D16745: Fix a thinko in StackFrame::GetInScopeVariableList.

2016-01-29 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

I found this while digging into some other problem. Test run is clean for me.


http://reviews.llvm.org/D16745



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


Re: [Lldb-commits] [PATCH] D16746: Use an artifical namespace so that member vars do not hide local vars.

2016-01-29 Thread Siva Chandra via lldb-commits
sivachandra added inline comments.


Comment at: source/Target/StackFrame.cpp:600
@@ -599,3 +599,3 @@
  
-if (m_sc.comp_unit)
+if (m_sc.comp_unit && get_file_globals)
 {

This should not be part of this change. I have another patch for that: 
http://reviews.llvm.org/D16745


http://reviews.llvm.org/D16746



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


Re: [Lldb-commits] [lldb] r257946 - Fix TestDebugBreak.py.

2016-01-15 Thread Siva Chandra via lldb-commits
SGTM. You want to do it?

On Fri, Jan 15, 2016 at 3:24 PM, Zachary Turner  wrote:
> How about `lldb.eStopReasonException if osIsWindows() else
> lldb.eStopReasonSignal`?
>
> Seems like that should work for everyone?
>
> On Fri, Jan 15, 2016 at 3:20 PM Siva Chandra  wrote:
>>
>> This fails for i386 (not enabled for x86_64 anyway):
>>
>> http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/10400
>>
>> If I replace lldb.eStopReasonException with lldb.eStopReasonSignal on
>> my local machine, it works.
>>
>> On Fri, Jan 15, 2016 at 2:22 PM, Zachary Turner via lldb-commits
>>  wrote:
>> > Author: zturner
>> > Date: Fri Jan 15 16:22:40 2016
>> > New Revision: 257946
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=257946=rev
>> > Log:
>> > Fix TestDebugBreak.py.
>> >
>> > We can't assume that the main thread of an inferior has index 0,
>> > even in a single-threaded app.
>> >
>> > Modified:
>> >
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> >
>> > Modified:
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py?rev=257946=257945=257946=diff
>> >
>> > ==
>> > ---
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> > (original)
>> > +++
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> > Fri Jan 15 16:22:40 2016
>> > @@ -26,13 +26,14 @@ class DebugBreakTestCase(TestBase):
>> >
>> >  # We've hit the first stop, so grab the frame.
>> >  self.assertEqual(process.GetState(), lldb.eStateStopped)
>> > -thread = process.GetThreadAtIndex(0)
>> > +thread = lldbutil.get_stopped_thread(process,
>> > lldb.eStopReasonException)
>> > +self.assertIsNotNone(thread, "Unable to find thread stopped at
>> > the __debugbreak()")
>> >  frame = thread.GetFrameAtIndex(0)
>> >
>> >  # We should be in funciton 'bar'.
>> >  self.assertTrue(frame.IsValid())
>> >  function_name = frame.GetFunctionName()
>> > -self.assertTrue('bar' in function_name)
>> > +self.assertTrue('bar' in function_name, "Unexpected function
>> > name {}".format(function_name))
>> >
>> >  # We should be able to evaluate the parameter foo.
>> >  value = frame.EvaluateExpression('*foo')
>> >
>> >
>> > ___
>> > 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] [lldb] r257644 - Fix an issue where scripted commands would not actually print any of their output if an immediate output file was set in the result object via a Python file object

2016-01-15 Thread Siva Chandra via lldb-commits
On Fri, Jan 15, 2016 at 2:18 AM, Pavel Labath via lldb-commits
 wrote:
> I don't really understand the purpose of the test, but if the purpose
> of it is to check whether something appears on stdout, then a pexpect
> test does seem like the right tool for the job.
>
> I have tried entering the commands from the test manually, and the
> required text does *not* appear when using the lldb built on the
> buildbot, while it *does* appear when using the lldb I build locally.
> So, this appears to be a genuine bug caused by something in the
> buildbot environment, but it's not clear to me now what it could be.

FWIW, before I asked Ying to take this over, I observed the same.
However, Ying *was* able to reproduce this on her local WS
consistently!

> That said, there is currently a big problem with the way this test is
> written, and that's the fact that the prompt expectation does not play
> well with the lldb's colored prompt feature. LLDB colors the prompt by
> overwriting the text which was already written by editline, resulting
> in something like "(lldb) \33[2m(lldb) \33[22m" written to stdout.
> This throws pexpect completely off scent, as the prompt substring
> appears twice, causing the commands and their expectations to
> misalign. Right now it does not matter, because as soon as you start
> looking for the pattern "this is a test string", the streams will
> align up, but it can cause you a lot of problems if you execute a
> command and then try to observe some external side effects of it,
> because pexpect will return before the command has even been given a
> chance to complete.

I suspected colors as well, but it is something different which is
causing the failure on the bot machine. To spawn LLDB without colors
though, we could pass --no-use-colors like here:
http://reviews.llvm.org/D6671

> BTW: the skipIfRemote decorator is not needed. It was needed on
> TestBatchMode, because that one actually runs executables, which needs
> some plumbing to work remotely, but since this test just plays with
> python commands it will execute just fine in the remote mode.
>
> pl
>
> On 14 January 2016 at 19:06, Jim Ingham via lldb-commits
>  wrote:
>> Well, actually on Unix MOST things are files, it was Plan 9 in which that 
>> all things are files, IIRC...
>>
>> Jim
>>
>>> On Jan 14, 2016, at 11:04 AM, Jim Ingham  wrote:
>>>
>>> Yes, on unix all things are files and all files work the same except when 
>>> they don't.  I'd rather test the thing we ACTUALLY care about, rather than 
>>> testing something else and assuming that it is going to work in the case we 
>>> care about as well.
>>>
>>> Jim
>>>
 On Jan 14, 2016, at 10:58 AM, Zachary Turner  wrote:

 Wouldn't testing with output redirecxted to a file still test that it is 
 being streamed as it is obtained rather than a big dump at the end?  I 
 mean that's what stdout is right?  Just a file.  If you use a file on the 
 filesystem instead, just check the contents of the file after each 
 operation.

 On Thu, Jan 14, 2016 at 10:42 AM Jim Ingham  wrote:
 I worry giving up on testing using Python's stdout for the immediate 
 output stream.  This is a very useful feature, allowing users to make 
 Python based commands that produce a bunch of output, and stream the 
 output as it is being gathered rather than having the command stall and 
 then dump a bunch of text at the end.  This isn't speculative, that's how 
 many of the commands that the OS X kernel team ships for inspecting kernel 
 state work.

 So we really should be testing this feature.  Maybe the flakiness on Linux 
 is just a pexpect bug, and streaming to stdout would always work correctly 
 hooked up to a "real" terminal.  But until we know that we should presume 
 that it is something in LLDB->Python or in the way we use Python, and keep 
 testing it.

 If you want to separate the two issues, then it would be fine to write 
 another test that just tests the type maps for FILE *, but I still think 
 this one is valuable.

 Jim

> On Jan 14, 2016, at 10:16 AM, Zachary Turner via lldb-commits 
>  wrote:
>
> How much time do you think it would take to determine whether or not 
> using the file-based approach would work?  Because on the surface it 
> sounds fairly straightforward, and fixing it that way would allow us to 
> not have to xfail this on more platforms for reasons that we don't 
> understand.
>
> On Thu, Jan 14, 2016 at 10:15 AM Enrico Granata via lldb-commits 
>  wrote:
> The log just shows a timeout is happening in pexpect() - which I don’t 
> have a ready explanation for
>
> X-failing for now is the proper recourse. But you might want to debug 

Re: [Lldb-commits] [lldb] r257946 - Fix TestDebugBreak.py.

2016-01-15 Thread Siva Chandra via lldb-commits
Thanks a lot.

On Fri, Jan 15, 2016 at 3:26 PM, Zachary Turner  wrote:
> Sure
>
> On Fri, Jan 15, 2016 at 3:25 PM Siva Chandra  wrote:
>>
>> SGTM. You want to do it?
>>
>> On Fri, Jan 15, 2016 at 3:24 PM, Zachary Turner 
>> wrote:
>> > How about `lldb.eStopReasonException if osIsWindows() else
>> > lldb.eStopReasonSignal`?
>> >
>> > Seems like that should work for everyone?
>> >
>> > On Fri, Jan 15, 2016 at 3:20 PM Siva Chandra 
>> > wrote:
>> >>
>> >> This fails for i386 (not enabled for x86_64 anyway):
>> >>
>> >>
>> >> http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/10400
>> >>
>> >> If I replace lldb.eStopReasonException with lldb.eStopReasonSignal on
>> >> my local machine, it works.
>> >>
>> >> On Fri, Jan 15, 2016 at 2:22 PM, Zachary Turner via lldb-commits
>> >>  wrote:
>> >> > Author: zturner
>> >> > Date: Fri Jan 15 16:22:40 2016
>> >> > New Revision: 257946
>> >> >
>> >> > URL: http://llvm.org/viewvc/llvm-project?rev=257946=rev
>> >> > Log:
>> >> > Fix TestDebugBreak.py.
>> >> >
>> >> > We can't assume that the main thread of an inferior has index 0,
>> >> > even in a single-threaded app.
>> >> >
>> >> > Modified:
>> >> >
>> >> >
>> >> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> >> >
>> >> > Modified:
>> >> >
>> >> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> >> > URL:
>> >> >
>> >> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py?rev=257946=257945=257946=diff
>> >> >
>> >> >
>> >> > ==
>> >> > ---
>> >> >
>> >> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> >> > (original)
>> >> > +++
>> >> >
>> >> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>> >> > Fri Jan 15 16:22:40 2016
>> >> > @@ -26,13 +26,14 @@ class DebugBreakTestCase(TestBase):
>> >> >
>> >> >  # We've hit the first stop, so grab the frame.
>> >> >  self.assertEqual(process.GetState(), lldb.eStateStopped)
>> >> > -thread = process.GetThreadAtIndex(0)
>> >> > +thread = lldbutil.get_stopped_thread(process,
>> >> > lldb.eStopReasonException)
>> >> > +self.assertIsNotNone(thread, "Unable to find thread stopped
>> >> > at
>> >> > the __debugbreak()")
>> >> >  frame = thread.GetFrameAtIndex(0)
>> >> >
>> >> >  # We should be in funciton 'bar'.
>> >> >  self.assertTrue(frame.IsValid())
>> >> >  function_name = frame.GetFunctionName()
>> >> > -self.assertTrue('bar' in function_name)
>> >> > +self.assertTrue('bar' in function_name, "Unexpected function
>> >> > name {}".format(function_name))
>> >> >
>> >> >  # We should be able to evaluate the parameter foo.
>> >> >  value = frame.EvaluateExpression('*foo')
>> >> >
>> >> >
>> >> > ___
>> >> > 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] [lldb] r257946 - Fix TestDebugBreak.py.

2016-01-15 Thread Siva Chandra via lldb-commits
This fails for i386 (not enabled for x86_64 anyway):
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/10400

If I replace lldb.eStopReasonException with lldb.eStopReasonSignal on
my local machine, it works.

On Fri, Jan 15, 2016 at 2:22 PM, Zachary Turner via lldb-commits
 wrote:
> Author: zturner
> Date: Fri Jan 15 16:22:40 2016
> New Revision: 257946
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257946=rev
> Log:
> Fix TestDebugBreak.py.
>
> We can't assume that the main thread of an inferior has index 0,
> even in a single-threaded app.
>
> Modified:
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py?rev=257946=257945=257946=diff
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
>  Fri Jan 15 16:22:40 2016
> @@ -26,13 +26,14 @@ class DebugBreakTestCase(TestBase):
>
>  # We've hit the first stop, so grab the frame.
>  self.assertEqual(process.GetState(), lldb.eStateStopped)
> -thread = process.GetThreadAtIndex(0)
> +thread = lldbutil.get_stopped_thread(process, 
> lldb.eStopReasonException)
> +self.assertIsNotNone(thread, "Unable to find thread stopped at the 
> __debugbreak()")
>  frame = thread.GetFrameAtIndex(0)
>
>  # We should be in funciton 'bar'.
>  self.assertTrue(frame.IsValid())
>  function_name = frame.GetFunctionName()
> -self.assertTrue('bar' in function_name)
> +self.assertTrue('bar' in function_name, "Unexpected function name 
> {}".format(function_name))
>
>  # We should be able to evaluate the parameter foo.
>  value = frame.EvaluateExpression('*foo')
>
>
> ___
> 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] [PATCH] D16125: [TestThreadJump] Adjust match sub-string after recent change.

2016-01-12 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: zturner.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D16125

Files:
  packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py

Index: 
packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -34,7 +34,7 @@
 # The stop reason of the thread should be breakpoint 1.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
 substrs = ['stopped',
-   'main.cpp:{}, stop reason = breakpoint 
1'.format(self.mark3)])
+   "main.cpp:{0}, name = '{1}', stop reason = breakpoint 
1".format(self.mark3, os.path.basename(exe))])
 
 self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int 
path, force it to return 'a'
 self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int 
path, force it to return 'b'


Index: packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -34,7 +34,7 @@
 # The stop reason of the thread should be breakpoint 1.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
 substrs = ['stopped',
-   'main.cpp:{}, stop reason = breakpoint 1'.format(self.mark3)])
+   "main.cpp:{0}, name = '{1}', stop reason = breakpoint 1".format(self.mark3, os.path.basename(exe))])
 
 self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int path, force it to return 'a'
 self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int path, force it to return 'b'
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r257531 - [TestThreadJump] Adjust match sub-string after recent change.

2016-01-12 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Tue Jan 12 16:33:19 2016
New Revision: 257531

URL: http://llvm.org/viewvc/llvm-project?rev=257531=rev
Log:
[TestThreadJump] Adjust match sub-string after recent change.

Reviewers: zturner

Subscribers: zturner, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py?rev=257531=257530=257531=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
 Tue Jan 12 16:33:19 2016
@@ -33,8 +33,7 @@ class ThreadJumpTestCase(TestBase):
 
 # The stop reason of the thread should be breakpoint 1.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
-substrs = ['stopped',
-   'main.cpp:{}, stop reason = breakpoint 
1'.format(self.mark3)])
+substrs=['stopped', 'main.cpp:{}'.format(self.mark3), 
'stop reason = breakpoint 1'])
 
 self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int 
path, force it to return 'a'
 self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int 
path, force it to return 'b'


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


Re: [Lldb-commits] [PATCH] D16125: [TestThreadJump] Adjust match sub-string after recent change.

2016-01-12 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 44674.
sivachandra added a comment.

Address comment


http://reviews.llvm.org/D16125

Files:
  packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py

Index: 
packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -33,8 +33,7 @@
 
 # The stop reason of the thread should be breakpoint 1.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
-substrs = ['stopped',
-   'main.cpp:{}, stop reason = breakpoint 
1'.format(self.mark3)])
+substrs=['stopped', 'main.cpp:{}'.format(self.mark3), 
'stop reason = breakpoint 1'])
 
 self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int 
path, force it to return 'a'
 self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int 
path, force it to return 'b'


Index: packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
===
--- packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -33,8 +33,7 @@
 
 # The stop reason of the thread should be breakpoint 1.
 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
-substrs = ['stopped',
-   'main.cpp:{}, stop reason = breakpoint 1'.format(self.mark3)])
+substrs=['stopped', 'main.cpp:{}'.format(self.mark3), 'stop reason = breakpoint 1'])
 
 self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int path, force it to return 'a'
 self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int path, force it to return 'b'
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r257113 - Better scheme to lookup alternate mangled name when looking up function address.

2016-01-07 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Thu Jan  7 17:32:34 2016
New Revision: 257113

URL: http://llvm.org/viewvc/llvm-project?rev=257113=rev
Log:
Better scheme to lookup alternate mangled name when looking up function address.

Summary:
This change is relevant for inferiors compiled with GCC. GCC does not
emit complete debug info for std::basic_string<...>, and consequently, Clang
(the LLDB compiler) does not generate correct mangled names for certain
functions.

This change removes the hard-coded alternate names in
ItaniumABILanguageRuntime.cpp.

Before the hard-coded names were put in ItaniumABILanguageRuntime.cpp, one could
not evaluate std::string methods (ex. std::string::length). After putting in
the hard-coded names, one could evaluate them. However, it did not still
enable one to call methods on, say for example, std::vector.
This change makes that possible.

There is some amount of incompleteness in this change. Consider the
following example:

std::string hello("hello"), world("world");
std::map m;
m[hello] = world;

One can still not evaluate the expression "m[hello]" in LLDB. Will
address this issue in another pass.

Reviewers: jingham, vharron, evgeny777, spyffe, dawn

Subscribers: clayborg, dawn, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=257113=257112=257113=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Jan  7 17:32:34 2016
@@ -573,6 +573,9 @@ public:
 ConstString
 DeclContextGetName (void *opaque_decl_ctx) override;
 
+ConstString
+DeclContextGetScopeQualifiedName (void *opaque_decl_ctx) override;
+
 bool
 DeclContextIsClassMethod (void *opaque_decl_ctx,
   lldb::LanguageType *language_ptr,

Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=257113=257112=257113=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Thu Jan  7 17:32:34 
2016
@@ -128,6 +128,9 @@ public:
 ConstString
 GetName () const;
 
+ConstString
+GetScopeQualifiedName() const;
+
 bool
 IsStructUnionOrClass () const;
 

Modified: lldb/trunk/include/lldb/Symbol/GoASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/GoASTContext.h?rev=257113=257112=257113=diff
==
--- lldb/trunk/include/lldb/Symbol/GoASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/GoASTContext.h Thu Jan  7 17:32:34 2016
@@ -112,6 +112,12 @@ class GoASTContext : public TypeSystem
 return ConstString();
 }
 
+ConstString
+DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
+{
+return ConstString();
+}
+
 bool
 DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType 
*language_ptr, bool *is_instance_method_ptr,
  ConstString *language_object_name_ptr) override

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=257113=257112=257113=diff
==
--- 

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

2016-01-07 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 44274.
sivachandra added a comment.

Rebase


http://reviews.llvm.org/D12809

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Target/CPPLanguageRuntime.h
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  source/Plugins/SymbolFile/DWARF/DIERef.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/SymbolFile.cpp

Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -134,6 +134,12 @@
 return 0;
 }
 
+void
+SymbolFile::GetMangledNamesForFunction(const std::string _qualified_name, std::vector _names)
+{
+return;
+}
+
 uint32_t
 SymbolFile::FindTypes (const SymbolContext& sc, const ConstString , const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types)
 {
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -38,6 +38,15 @@
 return ConstString();
 }
 
+ConstString
+CompilerDeclContext::GetScopeQualifiedName () const
+{
+if (IsValid())
+return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);
+else
+return ConstString();
+}
+
 bool
 CompilerDeclContext::IsStructUnionOrClass () const
 {
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9969,6 +9969,18 @@
 return ConstString();
 }
 
+ConstString
+ClangASTContext::DeclContextGetScopeQualifiedName (void *opaque_decl_ctx)
+{
+if (opaque_decl_ctx)
+{
+clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx);
+if (named_decl)
+return ConstString(llvm::StringRef(named_decl->getQualifiedNameAsString()));
+}
+return ConstString();
+}
+
 bool
 ClangASTContext::DeclContextIsClassMethod (void *opaque_decl_ctx,
lldb::LanguageType *language_ptr,
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -208,6 +208,10 @@
bool append,
lldb_private::SymbolContextList& sc_list) override;
 
+void
+GetMangledNamesForFunction (const std::string _qualified_name,
+std::vector _names) override;
+
 uint32_t
 FindTypes (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString ,
@@ -577,6 +581,9 @@
 m_fetched_external_modules:1;
 lldb_private::LazyBool  m_supports_DW_AT_APPLE_objc_complete_type;
 
+typedef std::shared_ptr DIERefSetSP;
+typedef std::unordered_map NameToOffsetMap;
+NameToOffsetMap m_function_scope_qualified_name_map;
 std::unique_ptr m_ranges;
 UniqueDWARFASTTypeMap m_unique_ast_type_map;
 DIEToTypePtr m_die_to_type;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2927,6 +2927,40 @@
 return sc_list.GetSize() - original_size;
 }
 
+void
+SymbolFileDWARF::GetMangledNamesForFunction (const std::string _qualified_name,
+ std::vector _names)
+{
+DWARFDebugInfo* info = DebugInfo();
+uint32_t num_comp_units = 0;
+if (info)
+num_comp_units = info->GetNumCompileUnits();
+
+for (uint32_t i = 0; i < num_comp_units; i++)
+{
+DWARFCompileUnit *cu = info->GetCompileUnitAtIndex(i);
+if (cu == nullptr)
+continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+if (dwo)
+dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
+}
+
+

Re: [Lldb-commits] [lldb] r257117 - Performance improvement: Change lldb so that it puts a breakpoint

2016-01-07 Thread Siva Chandra via lldb-commits
This broke TestStepNoDebug, atleast on Linux when inferior is compiled
with GCC: 
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/10091

I am able to reproduce this on my machine. Let me know if you need any
help with anything.

On Thu, Jan 7, 2016 at 4:06 PM, Jason Molenda via lldb-commits
 wrote:
> Author: jmolenda
> Date: Thu Jan  7 18:06:03 2016
> New Revision: 257117
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257117=rev
> Log:
> Performance improvement: Change lldb so that it puts a breakpoint
> on the first branch instruction after a function return (or the end
> of a source line), instead of a breakpoint on the return address,
> to skip an extra stop & start of the inferior process.
>
> I changed Process::AdvanceAddressToNextBranchInstruction to not
> take an optional InstructionList argument - no callers are providing
> a cached InstructionList today, and if this function was going to
> do that, the right thing to do would be to fill out / use a
> DisassemblerSP which is a disassembler with the InstructionList for
> this address range.
>
>
> http://reviews.llvm.org/D15708
> 
>
>
> Modified:
> lldb/trunk/include/lldb/Target/Process.h
> lldb/trunk/include/lldb/Target/Thread.h
> lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h
> lldb/trunk/source/Target/Process.cpp
> lldb/trunk/source/Target/Thread.cpp
> lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
> lldb/trunk/source/Target/ThreadPlanStepOut.cpp
> lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
>
> Modified: lldb/trunk/include/lldb/Target/Process.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=257117=257116=257117=diff
> ==
> --- lldb/trunk/include/lldb/Target/Process.h (original)
> +++ lldb/trunk/include/lldb/Target/Process.h Thu Jan  7 18:06:03 2016
> @@ -3149,6 +3149,34 @@ public:
>  void
>  ResetImageToken(size_t token);
>
> +//--
> +/// Find the next branch instruction to set a breakpoint on
> +///
> +/// When instruction stepping through a source line, instead of
> +/// stepping through each instruction, we can put a breakpoint on
> +/// the next branch instruction (within the range of instructions
> +/// we are stepping through) and continue the process to there,
> +/// yielding significant performance benefits over instruction
> +/// stepping.
> +///
> +/// @param[in] default_stop_addr
> +/// The address of the instruction where lldb would put a
> +/// breakpoint normally.
> +///
> +/// @param[in] range_bounds
> +/// The range which the breakpoint must be contained within.
> +/// Typically a source line.
> +///
> +/// @return
> +/// The address of the next branch instruction, or the end of
> +/// the range provided in range_bounds.  If there are any
> +/// problems with the disassembly or getting the instructions,
> +/// the original default_stop_addr will be returned.
> +//--
> +Address
> +AdvanceAddressToNextBranchInstruction (Address default_stop_addr,
> +   AddressRange range_bounds);
> +
>  protected:
>  void
>  SetState (lldb::EventSP _sp);
>
> Modified: lldb/trunk/include/lldb/Target/Thread.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=257117=257116=257117=diff
> ==
> --- lldb/trunk/include/lldb/Target/Thread.h (original)
> +++ lldb/trunk/include/lldb/Target/Thread.h Thu Jan  7 18:06:03 2016
> @@ -888,6 +888,16 @@ public:
>  /// @param[in] run_vote
>  ///See standard meanings for the stop & run votes in ThreadPlan.h.
>  ///
> +/// @param[in] continue_to_next_branch
> +///Normally this will enqueue a plan that will put a breakpoint on 
> the return address and continue
> +///to there.  If continue_to_next_branch is true, this is an 
> operation not involving the user --
> +///e.g. stepping "next" in a source line and we instruction stepped 
> into another function --
> +///so instead of putting a breakpoint on the return address, advance 
> the breakpoint to the
> +///end of the source line that is doing the call, or until the next 
> flow control instruction.
> +///If the return value from the function call is to be retrieved / 
> displayed to the user, you must stop
> +///on the return address.  The return value may be stored in 
> volatile registers which are overwritten
> +///before the next branch instruction.
> +///
>  /// @return
>  /// A shared pointer to the newly queued 

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

2016-01-06 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

Thanks a lot Dwan Perchik, for persisting on my behalf.

And thanks to Sean and Greg for taking a look.

I second Dwan's earlier comment about Greg's code reviews. He has been the best 
reviewer I have worked with, internally and externally.

Will commit this change shortly after rebasing.


http://reviews.llvm.org/D12809



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


[Lldb-commits] [PATCH] D15657: [TestCPPAuto] On linux, we need -fno-limit-debug-info.

2015-12-18 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: granata.enrico.
sivachandra added a subscriber: lldb-commits.

Also xfailed for GCC as there is an problem with debug info generation.

http://reviews.llvm.org/D15657

Files:
  packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
  packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
  packages/Python/lldbsuite/test/make/Makefile.rules

Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -178,8 +178,10 @@
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
+NO_LIMIT_DEBUG_INFO_FLAGS =
 ifneq (,$(findstring clang,$(CC)))
LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+   NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
 endif
 
 DEBUG_INFO_FLAG ?= -g
Index: packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
===
--- packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
+++ packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -8,7 +8,8 @@
 class CPPAutoTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
+
+@expectedFailureGcc("GCC does not generate complete debug info")
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()
Index: packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
===
--- packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,4 +2,6 @@
 
 CXX_SOURCES := main.cpp
 
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
 include $(LEVEL)/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -178,8 +178,10 @@
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
+NO_LIMIT_DEBUG_INFO_FLAGS =
 ifneq (,$(findstring clang,$(CC)))
LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+   NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
 endif
 
 DEBUG_INFO_FLAG ?= -g
Index: packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
===
--- packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
+++ packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -8,7 +8,8 @@
 class CPPAutoTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
+
+@expectedFailureGcc("GCC does not generate complete debug info")
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()
Index: packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
===
--- packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,4 +2,6 @@
 
 CXX_SOURCES := main.cpp
 
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
 include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15657: [TestCPPAuto] On linux, we need -fno-limit-debug-info.

2015-12-18 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256067: [TestCPPAuto] On linux, we need 
-fno-limit-debug-info. (authored by sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D15657?vs=43283=43284#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15657

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -8,7 +8,8 @@
 class CPPAutoTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
+
+@expectedFailureGcc("GCC does not generate complete debug info")
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,4 +2,6 @@
 
 CXX_SOURCES := main.cpp
 
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -178,8 +178,10 @@
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
+NO_LIMIT_DEBUG_INFO_FLAGS =
 ifneq (,$(findstring clang,$(CC)))
LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+   NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
 endif
 
 DEBUG_INFO_FLAG ?= -g


Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -8,7 +8,8 @@
 class CPPAutoTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
+
+@expectedFailureGcc("GCC does not generate complete debug info")
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,4 +2,6 @@
 
 CXX_SOURCES := main.cpp
 
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -178,8 +178,10 @@
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
+NO_LIMIT_DEBUG_INFO_FLAGS =
 ifneq (,$(findstring clang,$(CC)))
LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+   NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
 endif
 
 DEBUG_INFO_FLAG ?= -g
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r256067 - [TestCPPAuto] On linux, we need -fno-limit-debug-info.

2015-12-18 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Fri Dec 18 18:52:29 2015
New Revision: 256067

URL: http://llvm.org/viewvc/llvm-project?rev=256067=rev
Log:
[TestCPPAuto] On linux, we need -fno-limit-debug-info.

Summary: Also xfailed for GCC as there is an problem with debug info generation.

Reviewers: granata.enrico

Subscribers: lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile?rev=256067=256066=256067=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile Fri Dec 18 
18:52:29 2015
@@ -2,4 +2,6 @@ LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
 
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py?rev=256067=256066=256067=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py Fri 
Dec 18 18:52:29 2015
@@ -8,7 +8,8 @@ import lldbsuite.test.lldbutil as lldbut
 class CPPAutoTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
+
+@expectedFailureGcc("GCC does not generate complete debug info")
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=256067=256066=256067=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Fri Dec 18 
18:52:29 2015
@@ -178,8 +178,10 @@ else
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
+NO_LIMIT_DEBUG_INFO_FLAGS =
 ifneq (,$(findstring clang,$(CC)))
LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+   NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
 endif
 
 DEBUG_INFO_FLAG ?= -g


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


Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-15 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255729: Read macro info from .debug_macro section and use it 
for expression evaluation. (authored by sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D15437?vs=42758=42938#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15437

Files:
  lldb/trunk/include/lldb/Symbol/CompileUnit.h
  lldb/trunk/include/lldb/Symbol/DebugMacros.h
  lldb/trunk/include/lldb/Symbol/SymbolFile.h
  lldb/trunk/include/lldb/Symbol/SymbolVendor.h
  lldb/trunk/include/lldb/lldb-enumerations.h
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/macro1.h
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/macro2.h
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/macros/main.cpp
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/trunk/source/Expression/ExpressionSourceCode.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/trunk/source/Symbol/CMakeLists.txt
  lldb/trunk/source/Symbol/CompileUnit.cpp
  lldb/trunk/source/Symbol/DebugMacros.cpp
  lldb/trunk/source/Symbol/ObjectFile.cpp
  lldb/trunk/source/Symbol/SymbolVendor.cpp
  lldb/trunk/source/Utility/ConvertEnum.cpp

Index: lldb/trunk/include/lldb/lldb-enumerations.h
===
--- lldb/trunk/include/lldb/lldb-enumerations.h
+++ lldb/trunk/include/lldb/lldb-enumerations.h
@@ -603,6 +603,7 @@
 eSectionTypeDWARFDebugLine,
 eSectionTypeDWARFDebugLoc,
 eSectionTypeDWARFDebugMacInfo,
+eSectionTypeDWARFDebugMacro,
 eSectionTypeDWARFDebugPubNames,
 eSectionTypeDWARFDebugPubTypes,
 eSectionTypeDWARFDebugRanges,
Index: lldb/trunk/include/lldb/Symbol/DebugMacros.h
===
--- lldb/trunk/include/lldb/Symbol/DebugMacros.h
+++ lldb/trunk/include/lldb/Symbol/DebugMacros.h
@@ -0,0 +1,140 @@
+//===-- DebugMacros.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_DebugMacros_h_
+#define liblldb_DebugMacros_h_
+
+// C Includes
+// C++ Includes
+#include 
+#include 
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Core/ConstString.h"
+
+namespace lldb_private {
+
+class CompileUnit;
+class DebugMacros;
+typedef std::shared_ptr DebugMacrosSP;
+
+class DebugMacroEntry
+{
+public:
+enum EntryType
+{
+INVALID,
+DEFINE,
+UNDEF,
+START_FILE,
+END_FILE,
+INDIRECT
+};
+
+public:
+static DebugMacroEntry
+CreateDefineEntry(uint32_t line, const char *str);
+
+static DebugMacroEntry
+CreateUndefEntry(uint32_t line, const char *str);
+
+static DebugMacroEntry
+CreateStartFileEntry(uint32_t line, uint32_t debug_line_file_idx);
+
+static DebugMacroEntry
+CreateEndFileEntry();
+
+static DebugMacroEntry
+CreateIndirectEntry(const DebugMacrosSP _macros_sp);
+
+DebugMacroEntry() : m_type(INVALID) { }
+
+~DebugMacroEntry() = default;
+
+EntryType
+GetType() const
+{
+return m_type;
+}
+
+uint64_t
+GetLineNumber() const
+{
+return m_line;
+}
+
+ConstString
+GetMacroString() const
+{
+return m_str;
+}
+
+const FileSpec& GetFileSpec(CompileUnit *comp_unit) const;
+
+DebugMacros *
+GetIndirectDebugMacros() const
+{
+return m_debug_macros_sp.get();
+}
+
+private:
+DebugMacroEntry(EntryType type,
+uint32_t line,
+uint32_t debug_line_file_idx,
+const char *str);
+
+DebugMacroEntry(EntryType type,
+const DebugMacrosSP _macros_sp);
+
+EntryType m_type:3;
+uint32_t m_line:29;
+uint32_t 

[Lldb-commits] [lldb] r255584 - Make few adjustments after r255542.

2015-12-14 Thread Siva Chandra via lldb-commits
Author: sivachandra
Date: Mon Dec 14 18:26:52 2015
New Revision: 255584

URL: http://llvm.org/viewvc/llvm-project?rev=255584=rev
Log:
Make few adjustments after r255542.

Reviewers: zturner

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255584=255583=255584=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14 18:26:52 
2015
@@ -619,10 +619,10 @@ def not_in(iterable):
 def check_list_or_lambda(list_or_lambda, value):
 if six.callable(list_or_lambda):
 return list_or_lambda(value)
-elif isinstance(list_or_lambda, list):
-return list_or_lambda is None or value is None or value in 
list_or_lambda
+elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
+return value is None or value in list_or_lambda
 else:
-return list_or_lambda == value
+return list_or_lambda is None or value is None or list_or_lambda == 
value
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and 
thus means for all


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


Re: [Lldb-commits] [PATCH] D15511: Make few adjustments after r255542.

2015-12-14 Thread Siva Chandra via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255584: Make few adjustments after r255542. (authored by 
sivachandra).

Changed prior to commit:
  http://reviews.llvm.org/D15511?vs=42796=42802#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15511

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -619,10 +619,10 @@
 def check_list_or_lambda(list_or_lambda, value):
 if six.callable(list_or_lambda):
 return list_or_lambda(value)
-elif isinstance(list_or_lambda, list):
-return list_or_lambda is None or value is None or value in 
list_or_lambda
+elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
+return value is None or value in list_or_lambda
 else:
-return list_or_lambda == value
+return list_or_lambda is None or value is None or list_or_lambda == 
value
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and 
thus means for all


Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -619,10 +619,10 @@
 def check_list_or_lambda(list_or_lambda, value):
 if six.callable(list_or_lambda):
 return list_or_lambda(value)
-elif isinstance(list_or_lambda, list):
-return list_or_lambda is None or value is None or value in list_or_lambda
+elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
+return value is None or value in list_or_lambda
 else:
-return list_or_lambda == value
+return list_or_lambda is None or value is None or list_or_lambda == value
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and thus means for all
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15511: Make few adjustments after r255542.

2015-12-14 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

I went ahead and committed this.


Repository:
  rL LLVM

http://reviews.llvm.org/D15511



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


Re: [Lldb-commits] [lldb] r255542 - Make skipIf decorator support not_in() functor.

2015-12-14 Thread Siva Chandra via lldb-commits
This change looks very innocent, but:

On Mon, Dec 14, 2015 at 1:26 PM, Zachary Turner via lldb-commits
 wrote:
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255542=255541=255542=diff
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14 15:26:49 
> 2015
> @@ -613,14 +613,16 @@ def expectedFailure(expected_fn, bugnumb
>  # You can also pass not_in(list) to reverse the sense of the test for the 
> arguments that
>  # are simple lists, namely oslist, compiler, and debug_info.
>
> -def not_in (iterable):
> +def not_in(iterable):
>  return lambda x : x not in iterable
>
> -def check_list_or_lambda (list_or_lambda, value):
> +def check_list_or_lambda(list_or_lambda, value):
>  if six.callable(list_or_lambda):
>  return list_or_lambda(value)
> -else:
> +elif isinstance(list_or_lambda, list):

Previously, list_or_lambda could be a string. It cannot be now. That
is, we should have:

elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):

>  return list_or_lambda is None or value is None or value in 
> list_or_lambda
> +else:
> +return list_or_lambda == value

Previously, if value or list_or_lambda were None, this function
returned True. It returns False now unless both are None. That is, it
should be:

else:
return list_or_lambda is None or value is None or list_or_lambda == value

Will send a change list soon with the above fixed.

>
>  # provide a function to xfail on defined oslist, compiler version, and archs
>  # if none is specified for any argument, that argument won't be checked and 
> thus means for all
> @@ -1090,10 +1092,10 @@ def skipIfLinuxClang(func):
>  # TODO: refactor current code, to make skipIfxxx functions to call this 
> function
>  def skipIf(bugnumber=None, oslist=None, compiler=None, 
> compiler_version=None, archs=None, debug_info=None, swig_version=None, 
> py_version=None, remote=None):
>  def fn(self):
> -oslist_passes = oslist is None or self.getPlatform() in oslist
> -compiler_passes = compiler is None or (compiler in 
> self.getCompiler() and self.expectedCompilerVersion(compiler_version))
> +oslist_passes = check_list_or_lambda(oslist, self.getPlatform())
> +compiler_passes = check_list_or_lambda(self.getCompiler(), compiler) 
> and self.expectedCompilerVersion(compiler_version)
>  arch_passes = self.expectedArch(archs)
> -debug_info_passes = debug_info is None or self.debug_info in 
> debug_info
> +debug_info_passes = check_list_or_lambda(debug_info, self.debug_info)
>  swig_version_passes = (swig_version is None) or (not hasattr(lldb, 
> 'swig_version')) or (check_expected_version(swig_version[0], swig_version[1], 
> lldb.swig_version))
>  py_version_passes = (py_version is None) or 
> check_expected_version(py_version[0], py_version[1], sys.version_info)
>  remote_passes = (remote is None) or (remote == (lldb.remote_platform 
> is not None))
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D15511: Make few adjustments after r255542.

2015-12-14 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: zturner.
sivachandra added a subscriber: lldb-commits.

http://reviews.llvm.org/D15511

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

Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -619,10 +619,10 @@
 def check_list_or_lambda(list_or_lambda, value):
 if six.callable(list_or_lambda):
 return list_or_lambda(value)
-elif isinstance(list_or_lambda, list):
-return list_or_lambda is None or value is None or value in 
list_or_lambda
+elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
+return value is None or value in list_or_lambda
 else:
-return list_or_lambda == value
+return list_or_lambda is None or value is None or list_or_lambda == 
value
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and 
thus means for all


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -619,10 +619,10 @@
 def check_list_or_lambda(list_or_lambda, value):
 if six.callable(list_or_lambda):
 return list_or_lambda(value)
-elif isinstance(list_or_lambda, list):
-return list_or_lambda is None or value is None or value in list_or_lambda
+elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
+return value is None or value in list_or_lambda
 else:
-return list_or_lambda == value
+return list_or_lambda is None or value is None or list_or_lambda == value
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and thus means for all
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r255592 - Welcome to NetBSD signals

2015-12-14 Thread Siva Chandra via lldb-commits
Ah, yes! Thank you.

On Mon, Dec 14, 2015 at 6:41 PM, Jim Ingham <jing...@apple.com> wrote:
> I think Jason already did (r255597).
>
> Jim
>
>> On Dec 14, 2015, at 6:35 PM, Siva Chandra via lldb-commits 
>> <lldb-commits@lists.llvm.org> wrote:
>>
>> On Mon, Dec 14, 2015 at 4:50 PM, Kamil Rytarowski via lldb-commits
>> <lldb-commits@lists.llvm.org> wrote:
>>> Author: kamil
>>> Date: Mon Dec 14 18:50:19 2015
>>> New Revision: 255592
>>>
>>> Added:
>>>lldb/trunk/source/Plugins/Process/Utility/NetBSDSignals.cpp
>>>lldb/trunk/source/Plugins/Process/Utility/NetBSDSignals.h
>>
>> Should these files be added to the xcode build? If yes, can someone
>> help with this?
>>
>>> Modified:
>>>lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
>>>lldb/trunk/source/Target/UnixSignals.cpp
>> ___
>> 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] [lldb] r255549 - Temporarily skip TestWithLimitDebugInfo on Darwin and OS X

2015-12-14 Thread Siva Chandra via lldb-commits
I believe zturner already fixed this. However, there is a problem with
his original change itself; will bring it up in a different thread.

On Mon, Dec 14, 2015 at 1:49 PM, Todd Fiala via lldb-commits
 wrote:
> Author: tfiala
> Date: Mon Dec 14 15:49:39 2015
> New Revision: 255549
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255549=rev
> Log:
> Temporarily skip TestWithLimitDebugInfo on Darwin and OS X
>
> This test is erroring out on a sequence call to a function.
>
> Modified:
> 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py?rev=255549=255548=255549=diff
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>  Mon Dec 14 15:49:39 2015
> @@ -6,6 +6,8 @@ class TestWithLimitDebugInfo(TestBase):
>
>  mydir = TestBase.compute_mydir(__file__)
>
> +@skipIfLinux
> +@skipIfDarwin
>  @skipIf(debug_info=not_in(["dwarf"]))
>  def test_limit_debug_info(self):
>  self.build()
>
>
> ___
> 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] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-14 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 42754.
sivachandra marked 2 inline comments as done.
sivachandra added a comment.

Remove storing of an unused data structure.


http://reviews.llvm.org/D15437

Files:
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/DebugMacros.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  include/lldb/lldb-enumerations.h
  packages/Python/lldbsuite/test/expression_command/macros/Makefile
  packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
  packages/Python/lldbsuite/test/expression_command/macros/macro1.h
  packages/Python/lldbsuite/test/expression_command/macros/macro2.h
  packages/Python/lldbsuite/test/expression_command/macros/main.cpp
  packages/Python/lldbsuite/test/make/Makefile.rules
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/CMakeLists.txt
  source/Symbol/CompileUnit.cpp
  source/Symbol/DebugMacros.cpp
  source/Symbol/ObjectFile.cpp
  source/Symbol/SymbolVendor.cpp
  source/Utility/ConvertEnum.cpp

Index: source/Utility/ConvertEnum.cpp
===
--- source/Utility/ConvertEnum.cpp
+++ source/Utility/ConvertEnum.cpp
@@ -77,6 +77,8 @@
 return "dwarf-loc";
 case eSectionTypeDWARFDebugMacInfo:
 return "dwarf-macinfo";
+case eSectionTypeDWARFDebugMacro:
+return "dwarf-macro";
 case eSectionTypeDWARFDebugPubNames:
 return "dwarf-pubnames";
 case eSectionTypeDWARFDebugPubTypes:
Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -186,6 +186,18 @@
 }
 
 bool
+SymbolVendor::ParseCompileUnitDebugMacros (const SymbolContext )
+{
+ModuleSP module_sp(GetModule());
+if (module_sp)
+{
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+if (m_sym_file_ap.get())
+return m_sym_file_ap->ParseCompileUnitDebugMacros(sc);
+}
+return false;
+}
+bool
 SymbolVendor::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files)
 {
 ModuleSP module_sp(GetModule());
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -362,6 +362,7 @@
 case eSectionTypeDWARFDebugLine:
 case eSectionTypeDWARFDebugLoc:
 case eSectionTypeDWARFDebugMacInfo:
+case eSectionTypeDWARFDebugMacro:
 case eSectionTypeDWARFDebugPubNames:
 case eSectionTypeDWARFDebugPubTypes:
 case eSectionTypeDWARFDebugRanges:
Index: source/Symbol/DebugMacros.cpp
===
--- /dev/null
+++ source/Symbol/DebugMacros.cpp
@@ -0,0 +1,65 @@
+//===-- DebugMacros.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Symbol/DebugMacros.h"
+
+#include "lldb/Symbol/CompileUnit.h"
+
+using namespace lldb_private;
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ uint32_t line,
+ uint32_t debug_line_file_idx,
+ const char *str)
+: m_type(type),
+  m_line(line),
+  m_debug_line_file_idx(debug_line_file_idx),
+  m_str(str)
+{ }
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ const DebugMacrosSP _macros_sp)
+: m_type(type), m_line(0), m_debug_line_file_idx(0), m_debug_macros_sp(debug_macros_sp)
+{ }
+
+const FileSpec&
+DebugMacroEntry::GetFileSpec(CompileUnit *comp_unit) const
+{
+return comp_unit->GetSupportFiles().GetFileSpecAtIndex(m_debug_line_file_idx);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateDefineEntry(uint32_t line, const char *str)
+{
+return DebugMacroEntry(DebugMacroEntry::DEFINE, line, 0, str);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateUndefEntry(uint32_t line, const char 

Re: [Lldb-commits] [lldb] r255525 - Make debug info specification use categories system.

2015-12-14 Thread Siva Chandra via lldb-commits
On Mon, Dec 14, 2015 at 10:49 AM, Zachary Turner via lldb-commits
 wrote:
> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255525=255524=255525=diff
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14 12:49:16 
> 2015
> @@ -549,48 +549,6 @@ def no_debug_info_test(func):
>  wrapper.__no_debug_info_test__ = True
>  return wrapper
>
> -def dsym_test(func):
> -"""Decorate the item as a dsym test."""
> -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
> -raise Exception("@dsym_test can only be used to decorate a test 
> method")
> -@wraps(func)
> -def wrapper(self, *args, **kwargs):
> -if configuration.dont_do_dsym_test:
> -self.skipTest("dsym tests")
> -return func(self, *args, **kwargs)
> -
> -# Mark this function as such to separate them from the regular tests.
> -wrapper.__dsym_test__ = True
> -return wrapper
> -
> -def dwarf_test(func):
> -"""Decorate the item as a dwarf test."""
> -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
> -raise Exception("@dwarf_test can only be used to decorate a test 
> method")
> -@wraps(func)
> -def wrapper(self, *args, **kwargs):
> -if configuration.dont_do_dwarf_test:
> -self.skipTest("dwarf tests")
> -return func(self, *args, **kwargs)
> -
> -# Mark this function as such to separate them from the regular tests.
> -wrapper.__dwarf_test__ = True
> -return wrapper
> -
> -def dwo_test(func):
> -"""Decorate the item as a dwo test."""
> -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
> -raise Exception("@dwo_test can only be used to decorate a test 
> method")
> -@wraps(func)
> -def wrapper(self, *args, **kwargs):
> -if configuration.dont_do_dwo_test:
> -self.skipTest("dwo tests")
> -return func(self, *args, **kwargs)
> -
> -# Mark this function as such to separate them from the regular tests.
> -wrapper.__dwo_test__ = True
> -return wrapper
> -
>  def debugserver_test(func):
>  """Decorate the item as a debugserver test."""
>  if isinstance(func, type) and issubclass(func, unittest2.TestCase):
> @@ -2270,32 +2228,26 @@ class LLDBTestCaseFactory(type):
>  newattrs = {}
>  for attrname, attrvalue in attrs.items():
>  if attrname.startswith("test") and not getattr(attrvalue, 
> "__no_debug_info_test__", False):
> -@dsym_test
> -@wraps(attrvalue)
> -def dsym_test_method(self, attrvalue=attrvalue):
> -self.debug_info = "dsym"
> -return attrvalue(self)
> -dsym_method_name = attrname + "_dsym"
> -dsym_test_method.__name__ = dsym_method_name
> -newattrs[dsym_method_name] = dsym_test_method
> -
> -@dwarf_test
> -@wraps(attrvalue)
> -def dwarf_test_method(self, attrvalue=attrvalue):
> -self.debug_info = "dwarf"
> -return attrvalue(self)
> -dwarf_method_name = attrname + "_dwarf"
> -dwarf_test_method.__name__ = dwarf_method_name
> -newattrs[dwarf_method_name] = dwarf_test_method
> -
> -@dwo_test
> -@wraps(attrvalue)
> -def dwo_test_method(self, attrvalue=attrvalue):
> -self.debug_info = "dwo"
> -return attrvalue(self)
> -dwo_method_name = attrname + "_dwo"
> -dwo_test_method.__name__ = dwo_method_name
> -newattrs[dwo_method_name] = dwo_test_method
> +target_platform = 
> lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
> +
> +# If any debug info categories were explicitly tagged, 
> assume that list to be
> +# authoritative.  If none were specified, try with all debug 
> info formats.
> +all_dbginfo_categories = 
> set(test_categories.debug_info_categories)
> +categories = set(getattr(attrvalue, "categories", [])) & 
> all_dbginfo_categories
> +if not categories:
> +categories = all_dbginfo_categories
> +
> +supported_categories = [x for x in categories
> +if 
> test_categories.is_supported_on_platform(x, target_platform)]
> +for category in supported_categories:
> +@add_test_categories([category])
> +@wraps(attrvalue)
> +def 

Re: [Lldb-commits] [lldb] r255549 - Temporarily skip TestWithLimitDebugInfo on Darwin and OS X

2015-12-14 Thread Siva Chandra via lldb-commits
Looks like, though that particular test was "fixed", zturner's change
triggered a whole bunch of other failures:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/9446

On Mon, Dec 14, 2015 at 1:56 PM, Siva Chandra  wrote:
> I believe zturner already fixed this. However, there is a problem with
> his original change itself; will bring it up in a different thread.
>
> On Mon, Dec 14, 2015 at 1:49 PM, Todd Fiala via lldb-commits
>  wrote:
>> Author: tfiala
>> Date: Mon Dec 14 15:49:39 2015
>> New Revision: 255549
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=255549=rev
>> Log:
>> Temporarily skip TestWithLimitDebugInfo on Darwin and OS X
>>
>> This test is erroring out on a sequence call to a function.
>>
>> Modified:
>> 
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>>
>> Modified: 
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py?rev=255549=255548=255549=diff
>> ==
>> --- 
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>>  (original)
>> +++ 
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>>  Mon Dec 14 15:49:39 2015
>> @@ -6,6 +6,8 @@ class TestWithLimitDebugInfo(TestBase):
>>
>>  mydir = TestBase.compute_mydir(__file__)
>>
>> +@skipIfLinux
>> +@skipIfDarwin
>>  @skipIf(debug_info=not_in(["dwarf"]))
>>  def test_limit_debug_info(self):
>>  self.build()
>>
>>
>> ___
>> 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] [lldb] r255525 - Make debug info specification use categories system.

2015-12-14 Thread Siva Chandra via lldb-commits
Previously, self.debug_info was under different functions
(dwarf_test_method, dwo_test_method etc.). Now, they are all under
test_method. Even I am equally ignorant about the Python nuances here.

On Mon, Dec 14, 2015 at 2:04 PM, Zachary Turner  wrote:
> The previous code was just an unrolled loop as far as I can tell.  Do you
> mean the loop has different behavior than the unrolled loop?  Because it
> looks identical to me (although admittedly python has a lot of nuances that
> I don't understand in great detail)
>
> On Mon, Dec 14, 2015 at 1:59 PM Siva Chandra  wrote:
>>
>> On Mon, Dec 14, 2015 at 10:49 AM, Zachary Turner via lldb-commits
>>  wrote:
>> > Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255525=255524=255525=diff
>> >
>> > ==
>> > --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
>> > +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14
>> > 12:49:16 2015
>> > @@ -549,48 +549,6 @@ def no_debug_info_test(func):
>> >  wrapper.__no_debug_info_test__ = True
>> >  return wrapper
>> >
>> > -def dsym_test(func):
>> > -"""Decorate the item as a dsym test."""
>> > -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
>> > -raise Exception("@dsym_test can only be used to decorate a test
>> > method")
>> > -@wraps(func)
>> > -def wrapper(self, *args, **kwargs):
>> > -if configuration.dont_do_dsym_test:
>> > -self.skipTest("dsym tests")
>> > -return func(self, *args, **kwargs)
>> > -
>> > -# Mark this function as such to separate them from the regular
>> > tests.
>> > -wrapper.__dsym_test__ = True
>> > -return wrapper
>> > -
>> > -def dwarf_test(func):
>> > -"""Decorate the item as a dwarf test."""
>> > -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
>> > -raise Exception("@dwarf_test can only be used to decorate a
>> > test method")
>> > -@wraps(func)
>> > -def wrapper(self, *args, **kwargs):
>> > -if configuration.dont_do_dwarf_test:
>> > -self.skipTest("dwarf tests")
>> > -return func(self, *args, **kwargs)
>> > -
>> > -# Mark this function as such to separate them from the regular
>> > tests.
>> > -wrapper.__dwarf_test__ = True
>> > -return wrapper
>> > -
>> > -def dwo_test(func):
>> > -"""Decorate the item as a dwo test."""
>> > -if isinstance(func, type) and issubclass(func, unittest2.TestCase):
>> > -raise Exception("@dwo_test can only be used to decorate a test
>> > method")
>> > -@wraps(func)
>> > -def wrapper(self, *args, **kwargs):
>> > -if configuration.dont_do_dwo_test:
>> > -self.skipTest("dwo tests")
>> > -return func(self, *args, **kwargs)
>> > -
>> > -# Mark this function as such to separate them from the regular
>> > tests.
>> > -wrapper.__dwo_test__ = True
>> > -return wrapper
>> > -
>> >  def debugserver_test(func):
>> >  """Decorate the item as a debugserver test."""
>> >  if isinstance(func, type) and issubclass(func, unittest2.TestCase):
>> > @@ -2270,32 +2228,26 @@ class LLDBTestCaseFactory(type):
>> >  newattrs = {}
>> >  for attrname, attrvalue in attrs.items():
>> >  if attrname.startswith("test") and not getattr(attrvalue,
>> > "__no_debug_info_test__", False):
>> > -@dsym_test
>> > -@wraps(attrvalue)
>> > -def dsym_test_method(self, attrvalue=attrvalue):
>> > -self.debug_info = "dsym"
>> > -return attrvalue(self)
>> > -dsym_method_name = attrname + "_dsym"
>> > -dsym_test_method.__name__ = dsym_method_name
>> > -newattrs[dsym_method_name] = dsym_test_method
>> > -
>> > -@dwarf_test
>> > -@wraps(attrvalue)
>> > -def dwarf_test_method(self, attrvalue=attrvalue):
>> > -self.debug_info = "dwarf"
>> > -return attrvalue(self)
>> > -dwarf_method_name = attrname + "_dwarf"
>> > -dwarf_test_method.__name__ = dwarf_method_name
>> > -newattrs[dwarf_method_name] = dwarf_test_method
>> > -
>> > -@dwo_test
>> > -@wraps(attrvalue)
>> > -def dwo_test_method(self, attrvalue=attrvalue):
>> > -self.debug_info = "dwo"
>> > -return attrvalue(self)
>> > -dwo_method_name = attrname + "_dwo"
>> > -dwo_test_method.__name__ = dwo_method_name
>> > -newattrs[dwo_method_name] = dwo_test_method
>> > +target_platform 

Re: [Lldb-commits] [lldb] r255525 - Make debug info specification use categories system.

2015-12-14 Thread Siva Chandra via lldb-commits
On Mon, Dec 14, 2015 at 2:15 PM, Zachary Turner  wrote:
> Diff looks like this:
>
> -@dwarf_test
> -@wraps(attrvalue)
> -def dwarf_test_method(self, attrvalue=attrvalue):
> -self.debug_info = "dwarf"
> -return attrvalue(self)
> -dwarf_method_name = attrname + "_dwarf"
> -dwarf_test_method.__name__ = dwarf_method_name
> -newattrs[dwarf_method_name] = dwarf_test_method
>
> ...
>
> +for category in supported_categories:
> +@add_test_categories([category])
> +@wraps(attrvalue)
> +def test_method(self, attrvalue=attrvalue):
> +self.debug_info = category
> +return attrvalue(self)
> +method_name = attrname + "_" + category
> +test_method.__name__ = method_name
> +newattrs[method_name] = test_method
>
>
> So it looks like it's still under a different function.  The difference is
> that before (in the - section of the diff) there were 3 different functions
> with 3 different names.  For example `dwarf_test_method` above.  In the new
> code (+ section of the diff) it looks like one function defined 3 different
> times with the same name `test_method`.  But each of these should be a
> distinct function object that is defined in the context of the closure
> determined by the enclosing scope (the for loop in this case).  So all 3
> functions are actually different.  self is just an argument to the function,
> not some magic value like `this` in C++, so as in the previous version, the
> `debug_info` that gets modified is on whatever instance of `self` gets
> passed into the function, same as before.

I think you are right. I am only basing my theories by feeling the
elephant blind here. When running TestWithLimitDebugInfo, I have
printed the |category| value from test_method and it only prints
"dwo". So, it is |category| which is at fault here as it is the loop
variable. Though two different methods are actually getting added,
self.debug_info refers to the last value of |category|.

> Tamas or Pavel can probably clarify, but that's my understanding.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-14 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 42758.
sivachandra added a comment.

Use std::unordered_map instead of std::map.


http://reviews.llvm.org/D15437

Files:
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/DebugMacros.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  include/lldb/lldb-enumerations.h
  packages/Python/lldbsuite/test/expression_command/macros/Makefile
  packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
  packages/Python/lldbsuite/test/expression_command/macros/macro1.h
  packages/Python/lldbsuite/test/expression_command/macros/macro2.h
  packages/Python/lldbsuite/test/expression_command/macros/main.cpp
  packages/Python/lldbsuite/test/make/Makefile.rules
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/CMakeLists.txt
  source/Symbol/CompileUnit.cpp
  source/Symbol/DebugMacros.cpp
  source/Symbol/ObjectFile.cpp
  source/Symbol/SymbolVendor.cpp
  source/Utility/ConvertEnum.cpp

Index: source/Utility/ConvertEnum.cpp
===
--- source/Utility/ConvertEnum.cpp
+++ source/Utility/ConvertEnum.cpp
@@ -77,6 +77,8 @@
 return "dwarf-loc";
 case eSectionTypeDWARFDebugMacInfo:
 return "dwarf-macinfo";
+case eSectionTypeDWARFDebugMacro:
+return "dwarf-macro";
 case eSectionTypeDWARFDebugPubNames:
 return "dwarf-pubnames";
 case eSectionTypeDWARFDebugPubTypes:
Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -186,6 +186,18 @@
 }
 
 bool
+SymbolVendor::ParseCompileUnitDebugMacros (const SymbolContext )
+{
+ModuleSP module_sp(GetModule());
+if (module_sp)
+{
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+if (m_sym_file_ap.get())
+return m_sym_file_ap->ParseCompileUnitDebugMacros(sc);
+}
+return false;
+}
+bool
 SymbolVendor::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files)
 {
 ModuleSP module_sp(GetModule());
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -362,6 +362,7 @@
 case eSectionTypeDWARFDebugLine:
 case eSectionTypeDWARFDebugLoc:
 case eSectionTypeDWARFDebugMacInfo:
+case eSectionTypeDWARFDebugMacro:
 case eSectionTypeDWARFDebugPubNames:
 case eSectionTypeDWARFDebugPubTypes:
 case eSectionTypeDWARFDebugRanges:
Index: source/Symbol/DebugMacros.cpp
===
--- /dev/null
+++ source/Symbol/DebugMacros.cpp
@@ -0,0 +1,65 @@
+//===-- DebugMacros.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Symbol/DebugMacros.h"
+
+#include "lldb/Symbol/CompileUnit.h"
+
+using namespace lldb_private;
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ uint32_t line,
+ uint32_t debug_line_file_idx,
+ const char *str)
+: m_type(type),
+  m_line(line),
+  m_debug_line_file_idx(debug_line_file_idx),
+  m_str(str)
+{ }
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ const DebugMacrosSP _macros_sp)
+: m_type(type), m_line(0), m_debug_line_file_idx(0), m_debug_macros_sp(debug_macros_sp)
+{ }
+
+const FileSpec&
+DebugMacroEntry::GetFileSpec(CompileUnit *comp_unit) const
+{
+return comp_unit->GetSupportFiles().GetFileSpecAtIndex(m_debug_line_file_idx);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateDefineEntry(uint32_t line, const char *str)
+{
+return DebugMacroEntry(DebugMacroEntry::DEFINE, line, 0, str);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateUndefEntry(uint32_t line, const char *str)
+{
+return 

Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-11 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

The spec says that, for a given compile unit, the macro entries in the debug 
info will be in the order in which the compiler processes them. Hence, at line 
5 in your example, all these are relevant:

  #define FOO puts <<< from foo.h
  #undef FOO <<< from foo.h
  #define FOO print <<< from main.c

I have actually verified that it works as expected; FOO resolves to printf and 
not puts at line 5.

You have tickled one aspect that I have ignored though. What if one is stopped 
in an inlined function/method defined in an included file? I think taking care 
of this is a fairly straightforward change over what I now have. I will need to 
bring back the line index in DebugMacroEntry and use it. Will send an update 
soon.


http://reviews.llvm.org/D15437



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


Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-11 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 42563.
sivachandra marked 11 inline comments as done.
sivachandra added a comment.

Address comments.


http://reviews.llvm.org/D15437

Files:
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/DebugMacros.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  include/lldb/lldb-enumerations.h
  packages/Python/lldbsuite/test/expression_command/macros/Makefile
  packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
  packages/Python/lldbsuite/test/expression_command/macros/macro1.h
  packages/Python/lldbsuite/test/expression_command/macros/macro2.h
  packages/Python/lldbsuite/test/expression_command/macros/main.cpp
  packages/Python/lldbsuite/test/make/Makefile.rules
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/CMakeLists.txt
  source/Symbol/CompileUnit.cpp
  source/Symbol/DebugMacros.cpp
  source/Symbol/ObjectFile.cpp
  source/Symbol/SymbolVendor.cpp
  source/Utility/ConvertEnum.cpp

Index: source/Utility/ConvertEnum.cpp
===
--- source/Utility/ConvertEnum.cpp
+++ source/Utility/ConvertEnum.cpp
@@ -77,6 +77,8 @@
 return "dwarf-loc";
 case eSectionTypeDWARFDebugMacInfo:
 return "dwarf-macinfo";
+case eSectionTypeDWARFDebugMacro:
+return "dwarf-macro";
 case eSectionTypeDWARFDebugPubNames:
 return "dwarf-pubnames";
 case eSectionTypeDWARFDebugPubTypes:
Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -186,6 +186,18 @@
 }
 
 bool
+SymbolVendor::ParseCompileUnitDebugMacros (const SymbolContext )
+{
+ModuleSP module_sp(GetModule());
+if (module_sp)
+{
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+if (m_sym_file_ap.get())
+return m_sym_file_ap->ParseCompileUnitDebugMacros(sc);
+}
+return false;
+}
+bool
 SymbolVendor::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files)
 {
 ModuleSP module_sp(GetModule());
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -362,6 +362,7 @@
 case eSectionTypeDWARFDebugLine:
 case eSectionTypeDWARFDebugLoc:
 case eSectionTypeDWARFDebugMacInfo:
+case eSectionTypeDWARFDebugMacro:
 case eSectionTypeDWARFDebugPubNames:
 case eSectionTypeDWARFDebugPubTypes:
 case eSectionTypeDWARFDebugRanges:
Index: source/Symbol/DebugMacros.cpp
===
--- /dev/null
+++ source/Symbol/DebugMacros.cpp
@@ -0,0 +1,55 @@
+//===-- DebugMacros.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Symbol/DebugMacros.h"
+
+using namespace lldb_private;
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ uint32_t line,
+ const char *str)
+: m_type(type),
+  m_line(line),
+  m_str(str)
+{ }
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ const DebugMacrosSP _macros_sp)
+: m_type(type), m_debug_macros_sp(debug_macros_sp)
+{ }
+
+DebugMacroEntry
+DebugMacroEntry::CreateDefineEntry(uint32_t line, const char *str)
+{
+return DebugMacroEntry(DebugMacroEntry::DEFINE, line, str);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateUndefEntry(uint32_t line, const char *str)
+{
+return DebugMacroEntry(DebugMacroEntry::UNDEF, line, str);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateStartFileEntry(uint32_t line)
+{
+return DebugMacroEntry(DebugMacroEntry::START_FILE, line, nullptr);
+}
+
+DebugMacroEntry
+DebugMacroEntry::CreateEndFileEntry()
+{
+return DebugMacroEntry(DebugMacroEntry::END_FILE, 0, nullptr);
+}
+
+DebugMacroEntry

Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-11 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

I have addressed all the comments (with changes or my own comments).

About the problem with dwo, I have sent a mail to the GCC guys asking for 
guidance. Will fix it when I get clarity on that.

And yes, it would definitely be good if clang can also produce .debug_macro 
sections.



Comment at: include/lldb/Symbol/DebugMacros.h:101
@@ +100,3 @@
+ConstString m_file;
+DebugMacrosSP m_debug_macros_sp;
+};

clayborg wrote:
> We are going to have a million of these objects and we should really store 
> this as efficiently as possible:
> ```
> DebugMacroEntryStorage
> {
> uint32_t m_type:3;
> uint32_t m_line:29;
> uint32_t m_file_idx; // Index to file in CompileUnit::GetSupportFiles() 
> FileSpecList
> ConstString m_str;
> };
> ```
> Then you can expand this into an instance of DebugMacroEntry and have that be 
> what you hand out to external users and this DebugMacroEntry can be as big as 
> you want. Can we inline the entries that are currently representing by adding 
> the m_debug_macros_sp here? Do we really have many places in the macros for a 
> file that include the same thing over and over? I would vote we get rid of 
> the m_debug_macros_sp and just inline the entries where we need to unless we 
> have a specific case where this would make us make way too many 
> DebugMacroEntryStorage objects.
1. I have taken in other changes but did not remove m_debug_macros_sp. 
2. I have removed the file name / file index member completely as we are not 
using it now anyway!
3. I did not understand the benefit of creating a new class/struct.
4. For a simple source file like in the test, I see a 100+ defines inserted by 
default. If we inline them, and if a symbol file contains a 100 simple source 
files, we will be storing 1+ duplicate entries. If each of the source files 
actually includes a standard library header, I would image there would be many 
more common entries exploding the number of duplicate entries we will be 
storing.


Comment at: source/Expression/ExpressionSourceCode.cpp:122
@@ +121,3 @@
+else
+return;
+break;

tberghammer wrote:
> Should this function return an error in this case so the caller know the 
> macro stream is only half ready?
The return here does not mean it is "half ready". The function returns from 
here as macro entries after this appear on or after the current line in the 
main source file.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h:48
@@ +47,3 @@
+uint8_t entry_count;
+std::map entry_map; // Mapping from opcode number to its 
entry.
+

tberghammer wrote:
> Why do we need this data structure? Currently nobody is using it.
> Also should we store DWARFFormValue instead of llvm::dwarf::Form here? It 
> have a lot of feature in it what makes it work with split dwarf (dwo).
I have refactored the code around this now. Since the entire header has to be 
read past to get to the macro entries, I have collected the data in a 
data-structure. After the refactor, it is only lives on the stack. While I am 
OK to take it off if you want, I see no harm in keeping it as a data structure.

Also, since the form value is unused anyway, I have now made it dw_form_t.


http://reviews.llvm.org/D15437



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


Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-11 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

PTAL. I have now covered the case I missed. Added test for that as well.


http://reviews.llvm.org/D15437



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


[Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-10 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: clayborg, tberghammer, spyffe.
sivachandra added a subscriber: lldb-commits.

DWARF 5 proposes a reinvented .debug_macro section. This change follows
that spec.

Currently, only GCC produces the .debug_macro section and hence
the added test is annottated with expectedFailureClang.

http://reviews.llvm.org/D15437

Files:
  include/lldb/Symbol/CompileUnit.h
  include/lldb/Symbol/DebugMacros.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  include/lldb/lldb-enumerations.h
  packages/Python/lldbsuite/test/expression_command/macros/Makefile
  packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py
  packages/Python/lldbsuite/test/expression_command/macros/macro1.h
  packages/Python/lldbsuite/test/expression_command/macros/macro2.h
  packages/Python/lldbsuite/test/expression_command/macros/main.cpp
  packages/Python/lldbsuite/test/make/Makefile.rules
  source/Expression/ExpressionSourceCode.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Symbol/CMakeLists.txt
  source/Symbol/CompileUnit.cpp
  source/Symbol/DebugMacros.cpp
  source/Symbol/ObjectFile.cpp
  source/Symbol/SymbolVendor.cpp
  source/Utility/ConvertEnum.cpp

Index: source/Utility/ConvertEnum.cpp
===
--- source/Utility/ConvertEnum.cpp
+++ source/Utility/ConvertEnum.cpp
@@ -77,6 +77,8 @@
 return "dwarf-loc";
 case eSectionTypeDWARFDebugMacInfo:
 return "dwarf-macinfo";
+case eSectionTypeDWARFDebugMacro:
+return "dwarf-macro";
 case eSectionTypeDWARFDebugPubNames:
 return "dwarf-pubnames";
 case eSectionTypeDWARFDebugPubTypes:
Index: source/Symbol/SymbolVendor.cpp
===
--- source/Symbol/SymbolVendor.cpp
+++ source/Symbol/SymbolVendor.cpp
@@ -186,6 +186,18 @@
 }
 
 bool
+SymbolVendor::ParseCompileUnitDebugMacros (const SymbolContext )
+{
+ModuleSP module_sp(GetModule());
+if (module_sp)
+{
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+if (m_sym_file_ap.get())
+return m_sym_file_ap->ParseCompileUnitDebugMacros(sc);
+}
+return false;
+}
+bool
 SymbolVendor::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files)
 {
 ModuleSP module_sp(GetModule());
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -362,6 +362,7 @@
 case eSectionTypeDWARFDebugLine:
 case eSectionTypeDWARFDebugLoc:
 case eSectionTypeDWARFDebugMacInfo:
+case eSectionTypeDWARFDebugMacro:
 case eSectionTypeDWARFDebugPubNames:
 case eSectionTypeDWARFDebugPubTypes:
 case eSectionTypeDWARFDebugRanges:
Index: source/Symbol/DebugMacros.cpp
===
--- /dev/null
+++ source/Symbol/DebugMacros.cpp
@@ -0,0 +1,57 @@
+//===-- DebugMacros.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Symbol/DebugMacros.h"
+
+using namespace lldb_private;
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ uint64_t line,
+ const char *str,
+ const char *file_name)
+: m_type(type),
+  m_line(line),
+  m_str(str),
+  m_file(file_name)
+{ }
+
+DebugMacroEntry::DebugMacroEntry(EntryType type,
+ const DebugMacrosSP _macros_sp)
+: m_type(type), m_debug_macros_sp(debug_macros_sp)
+{ }
+
+DebugMacroEntry *
+DebugMacroEntry::NewDefineEntry(uint64_t line, const char *str)
+{
+return new DebugMacroEntry(DebugMacroEntry::DEFINE, line, str, NULL);
+}
+
+DebugMacroEntry *
+DebugMacroEntry::NewUndefEntry(uint64_t line, const char *str)
+{
+return new DebugMacroEntry(DebugMacroEntry::UNDEF, line, str, NULL);
+}
+

Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-10 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

The dwo_test_method fails for the added test as I think there is some GCC bug 
with the combination of -gsplit-dwarf and -g3.


http://reviews.llvm.org/D15437



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


Re: [Lldb-commits] [PATCH] D15437: Read macro info from .debug_macro section and use it for expression evaluation.

2015-12-10 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

I should also mention that I did not implement the complete spec as I do not 
know of any producer which produces all the flavors of the new spec.


http://reviews.llvm.org/D15437



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


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

2015-12-03 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

@dawn: Thanks for accepting the patch. I guess I still need to wait for 
sign-off/comments from a CODE_OWNER.


http://reviews.llvm.org/D12809



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


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

2015-12-02 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 41706.
sivachandra added a comment.

Rebased and updated to take in DWO changes.


http://reviews.llvm.org/D12809

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/CompilerDeclContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Target/CPPLanguageRuntime.h
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  source/Plugins/SymbolFile/DWARF/DIERef.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/ClangASTContext.cpp
  source/Symbol/CompilerDeclContext.cpp
  source/Symbol/SymbolFile.cpp

Index: source/Symbol/SymbolFile.cpp
===
--- source/Symbol/SymbolFile.cpp
+++ source/Symbol/SymbolFile.cpp
@@ -134,6 +134,12 @@
 return 0;
 }
 
+void
+SymbolFile::GetMangledNamesForFunction(const std::string _qualified_name, std::vector _names)
+{
+return;
+}
+
 uint32_t
 SymbolFile::FindTypes (const SymbolContext& sc, const ConstString , const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types)
 {
Index: source/Symbol/CompilerDeclContext.cpp
===
--- source/Symbol/CompilerDeclContext.cpp
+++ source/Symbol/CompilerDeclContext.cpp
@@ -42,6 +42,15 @@
 return ConstString();
 }
 
+ConstString
+CompilerDeclContext::GetScopeQualifiedName () const
+{
+if (IsValid())
+return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);
+else
+return ConstString();
+}
+
 bool
 CompilerDeclContext::IsStructUnionOrClass () const
 {
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9245,6 +9245,18 @@
 return ConstString();
 }
 
+ConstString
+ClangASTContext::DeclContextGetScopeQualifiedName (void *opaque_decl_ctx)
+{
+if (opaque_decl_ctx)
+{
+clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx);
+if (named_decl)
+return ConstString(llvm::StringRef(named_decl->getQualifiedNameAsString()));
+}
+return ConstString();
+}
+
 bool
 ClangASTContext::DeclContextIsClassMethod (void *opaque_decl_ctx,
lldb::LanguageType *language_ptr,
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // Other libraries and framework includes
@@ -203,6 +204,10 @@
bool append,
lldb_private::SymbolContextList& sc_list) override;
 
+void
+GetMangledNamesForFunction (const std::string _qualified_name,
+std::vector _names) override;
+
 uint32_t
 FindTypes (const lldb_private::SymbolContext& sc,
const lldb_private::ConstString ,
@@ -560,6 +565,9 @@
 m_fetched_external_modules:1;
 lldb_private::LazyBool  m_supports_DW_AT_APPLE_objc_complete_type;
 
+typedef std::shared_ptr DIERefSetSP;
+typedef std::unordered_map NameToOffsetMap;
+NameToOffsetMap m_function_scope_qualified_name_map;
 std::unique_ptr m_ranges;
 UniqueDWARFASTTypeMap m_unique_ast_type_map;
 DIEToTypePtr m_die_to_type;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2856,6 +2856,40 @@
 return sc_list.GetSize() - original_size;
 }
 
+void
+SymbolFileDWARF::GetMangledNamesForFunction (const std::string _qualified_name,
+ std::vector _names)
+{
+DWARFDebugInfo* info = DebugInfo();
+uint32_t num_comp_units = 0;
+if (info)
+num_comp_units = info->GetNumCompileUnits();
+
+for (uint32_t i = 0; i < num_comp_units; i++)
+{
+DWARFCompileUnit *cu = info->GetCompileUnitAtIndex(i);
+if (cu == nullptr)
+continue;
+
+SymbolFileDWARFDwo 

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

2015-12-02 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

A test for this already exists: TestCallStdStringFunction.py


http://reviews.llvm.org/D12809



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


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

2015-12-02 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

PTaL
I finally got time to work on this. I have now rebased it and updated it take 
in DWO changes.

I understand this change only enhances debug experience when GCC is used as the 
DWARF producer (the targeted functionality already works as expected when the 
producer is clang). However, GCC is still very important for Android 
development and hence this fix is very useful for us.


http://reviews.llvm.org/D12809



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


Re: [Lldb-commits] [PATCH] D14881: Revert "Make skipIf support the not_in function (second attempt)."

2015-11-20 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

Reverting as this introduces more regressions.


http://reviews.llvm.org/D14881



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


[Lldb-commits] [PATCH] D14881: Revert "Make skipIf support the not_in function (second attempt)."

2015-11-20 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: amccarth, zturner.
sivachandra added a subscriber: lldb-commits.

This reverts commit 70dca28976ee8137acce2cc203dd394f4d761276.

http://reviews.llvm.org/D14881

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

Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -648,15 +648,11 @@
 def not_in (iterable):
 return lambda x : x not in iterable
 
-def check_decorator_attribute(attr, value):
-if attr is None:
-return True
-if six.callable(attr):
-return attr(value)
-elif isinstance(attr, (list, tuple)):
-return value in attr
-else:
-return value == attr
+def check_list_or_lambda (list_or_lambda, value):
+if six.callable(list_or_lambda):
+return list_or_lambda(value)
+else:
+return list_or_lambda is None or value is None or value in 
list_or_lambda
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and 
thus means for all
@@ -666,11 +662,11 @@
 # @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), 
xfail for gcc>=4.9 on linux with i386
 def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, 
compiler_version=None, archs=None, triple=None, debug_info=None, 
swig_version=None, py_version=None):
 def fn(self):
-oslist_passes = check_decorator_attribute(oslist, self.getPlatform())
-compiler_passes = check_decorator_attribute(self.getCompiler(), 
compiler) and self.expectedCompilerVersion(compiler_version)
+oslist_passes = check_list_or_lambda(oslist, self.getPlatform())
+compiler_passes = check_list_or_lambda(self.getCompiler(), compiler) 
and self.expectedCompilerVersion(compiler_version)
 arch_passes = self.expectedArch(archs)
 triple_passes = triple is None or re.match(triple, 
lldb.DBG.GetSelectedPlatform().GetTriple())
-debug_info_passes = check_decorator_attribute(debug_info, 
self.debug_info)
+debug_info_passes = check_list_or_lambda(debug_info, self.debug_info)
 swig_version_passes = (swig_version is None) or (not hasattr(lldb, 
'swig_version')) or (check_expected_version(swig_version[0], swig_version[1], 
lldb.swig_version))
 py_version_passes = (py_version is None) or 
check_expected_version(py_version[0], py_version[1], sys.version_info)
 
@@ -1104,10 +1100,10 @@
 # TODO: refactor current code, to make skipIfxxx functions to call this 
function
 def skipIf(bugnumber=None, oslist=None, compiler=None, compiler_version=None, 
archs=None, debug_info=None, swig_version=None, py_version=None):
 def fn(self):
-oslist_passes = check_decorator_attribute(oslist, self.getPlatform())
-compiler_passes = check_decorator_attribute(compiler, 
self.getCompiler()) and self.expectedCompilerVersion(compiler_version)
+oslist_passes = oslist is None or self.getPlatform() in oslist
+compiler_passes = compiler is None or (compiler in self.getCompiler() 
and self.expectedCompilerVersion(compiler_version))
 arch_passes = self.expectedArch(archs)
-debug_info_passes = check_decorator_attribute(debug_info, 
self.debug_info)
+debug_info_passes = debug_info is None or self.debug_info in debug_info
 swig_version_passes = (swig_version is None) or (not hasattr(lldb, 
'swig_version')) or (check_expected_version(swig_version[0], swig_version[1], 
lldb.swig_version))
 py_version_passes = (py_version is None) or 
check_expected_version(py_version[0], py_version[1], sys.version_info)
 


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -648,15 +648,11 @@
 def not_in (iterable):
 return lambda x : x not in iterable
 
-def check_decorator_attribute(attr, value):
-if attr is None:
-return True
-if six.callable(attr):
-return attr(value)
-elif isinstance(attr, (list, tuple)):
-return value in attr
-else:
-return value == attr
+def check_list_or_lambda (list_or_lambda, value):
+if six.callable(list_or_lambda):
+return list_or_lambda(value)
+else:
+return list_or_lambda is None or value is None or value in list_or_lambda
 
 # provide a function to xfail on defined oslist, compiler version, and archs
 # if none is specified for any argument, that argument won't be checked and thus means for all
@@ -666,11 +662,11 @@
 # @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), xfail for gcc>=4.9 on linux with i386
 def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, compiler_version=None, 

  1   2   >