Re: [Lldb-commits] [lldb] r258485 - Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB during expression evaluation

2016-01-25 Thread Bhushan Attarde via lldb-commits
Hi Hans,

Could you please add this to the release branch?

Thanks,
Bhushan


-Original Message-
From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of 
Bhushan D. Attarde via lldb-commits
Sent: 22 January 2016 10:32
To: lldb-commits@lists.llvm.org
Subject: [Lldb-commits] [lldb] r258485 - Use "_$" prefix instead of "$" for 
dynamic checker function inserted by LLDB during expression evaluation

Author: bhushan.attarde
Date: Thu Jan 21 23:02:02 2016
New Revision: 258485

URL: http://llvm.org/viewvc/llvm-project?rev=258485&view=rev
Log:
Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB 
during expression evaluation

SUMMARY:
The symbol "$" has a special meaning for MIPS i.e it is marker for 
temporary symbols for MIPS.
So this patch uses additional _ prefix for "$__lldb_valid_pointer_check" so 
that it wont be marked as temporary symbol in case of MIPS.

Reviewers: clayborg, spyffe
Subscribers: dean, emaste, mohit.bhakkad, sagar, jaydeep, lldb-commits
Differential http://reviews.llvm.org/D14111

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

Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=258485&r1=258484&r2=258485&view=diff
==
--- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original)
+++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Thu Jan 21 23:02:02 
+++ 2016
@@ -35,12 +35,12 @@ using namespace lldb_private;
 
 static char ID;
 
-#define VALID_POINTER_CHECK_NAME "$__lldb_valid_pointer_check"
+#define VALID_POINTER_CHECK_NAME "_$__lldb_valid_pointer_check"
 #define VALID_OBJC_OBJECT_CHECK_NAME "$__lldb_objc_object_check"
 
 static const char g_valid_pointer_check_text[] =  "extern \"C\" void\n"
-"$__lldb_valid_pointer_check (unsigned char *$__lldb_arg_ptr)\n"
+"_$__lldb_valid_pointer_check (unsigned char *$__lldb_arg_ptr)\n"
 "{\n"
 "unsigned char $__lldb_local_val = *$__lldb_arg_ptr;\n"
 "}";


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


[Lldb-commits] [lldb] r258684 - [LLDB][MIPS] Fix TestExprsChar.py

2016-01-25 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Mon Jan 25 06:27:46 2016
New Revision: 258684

URL: http://llvm.org/viewvc/llvm-project?rev=258684&view=rev
Log:
[LLDB][MIPS] Fix TestExprsChar.py

Patch by Nitesh Jain.

Summary: When incorrect type used for 'char' then (at least) one of the 
expression evaluates to incorrect value. Please refer to bug llvm.org/pr23069

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, bhushan, jaydeep
Differential: reviews.llvm.org/D16132

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=258684&r1=258683&r2=258684&view=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 Jan 25 06:27:46 2016
@@ -65,5 +65,6 @@ class ExprCharTestCase(TestBase):
 @expectedFailurei386("llvm.org/pr23069")
 @expectedFailurex86_64("llvm.org/pr23069")
 @expectedFailureWindows("llvm.org/pr21765")
+@expectedFailureAll(bugnumber="llvm.org/pr23069", triple = 'mips*')
 def test_unsigned_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-funsigned-char'})


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


Re: [Lldb-commits] [PATCH] D16132: [LLDB][MIPS] Fix TestExprsChar.py

2016-01-25 Thread Sagar Thakur via lldb-commits
sagar closed this revision.
sagar added a comment.

Committed in revision 258684


Repository:
  rL LLVM

http://reviews.llvm.org/D16132



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


[Lldb-commits] [lldb] r258685 - [LLDB][MIPS] Fix TestPrintStackTraces.py

2016-01-25 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Mon Jan 25 06:33:03 2016
New Revision: 258685

URL: http://llvm.org/viewvc/llvm-project?rev=258685&view=rev
Log:
[LLDB][MIPS] Fix TestPrintStackTraces.py

Patch by Nitesh Jain.

Summary: The thread_start function in libc doesn't contain any epilogue and 
prologue instructions. Hence unwinding fail when we are stopped in thread_start.

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, bhushan, jaydeep
Differential: reviews.llvm.org/D16136

Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py?rev=258685&r1=258684&r2=258685&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
 Mon Jan 25 06:33:03 2016
@@ -22,6 +22,10 @@ class ThreadsStackTracesTestCase(TestBas
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
 @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"]) # We 
are unable to produce a backtrace of the main thread when the thread is blocked 
in fgets
+
+#The __thread_start function in libc doesn't contain any epilogue and 
prologue instructions 
+#hence unwinding fail when we are stopped in __thread_start
+@expectedFailureAll(triple = 'mips*')
 @expectedFailureWindows("llvm.org/pr24778")
 @add_test_categories(['pyapi'])
 def test_stack_traces(self):


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


Re: [Lldb-commits] [PATCH] D16107: Fix for Bug 25338

2016-01-25 Thread Luke Drummond via lldb-commits
ldrumm added a subscriber: ldrumm.
ldrumm added a comment.

This differential seems to have introduced a regression on x86_64 Android, 
where `std::bad_alloc` is thrown during process attach. I've reverted this 
locally, and filed a bug , but as 
this is code I'm not familiar with, I'd appreciate it if @ravitheja were able 
to take a look at this again.


http://reviews.llvm.org/D16107



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


Re: [Lldb-commits] [PATCH] D16136: [LLDB][MIPS] Fix TestPrintStackTraces.py

2016-01-25 Thread Sagar Thakur via lldb-commits
sagar closed this revision.
sagar added a comment.

Committed in revision 258685.


Repository:
  rL LLVM

http://reviews.llvm.org/D16136



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


Re: [Lldb-commits] [PATCH] D16107: Fix for Bug 25338

2016-01-25 Thread Ravitheja Addepally via lldb-commits
ravitheja added a comment.

Hello, Ok I will take a look.


http://reviews.llvm.org/D16107



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


Re: [Lldb-commits] [PATCH] D16508: NetBSD: Define initial RegisterContextNetBSD_x86_64

2016-01-25 Thread Greg Clayton via lldb-commits
clayborg added a comment.

This kind of stuff:

  struct UserArea {
  GPR  gpr;
  FPR  fpr;
  DBG  dbg;
  };

Was done on MacOSX systems because we have thread_get_state() and 
thread_set_state() that take a flavor (enumeration) that specifies which 
registers we should read. It also takes a pointer to a structure to fill in and 
the size in bytes of that structure. For this reason, we ended up making a 
UserArea that looked like above.

What you should be doing for your register context is duplicating the 
structures that are in the system headers so that they can be compiled on a 
system without these header files. So, this should be a duplication (don't use 
the exact same names for the structure types):

  typedef struct {
  __gregset_t __gregs;
  __greg_t_mc_tlsbase;
  __fpregset_t__fpregs;
  } mcontext_t;

Then if you have only one "read all registers" call that fills in all 
registers, you should make any single register read kick off a single read of 
all registers and mark all registers as valid. For MacOSX, a register read will 
trigger a thread_get_state() and the GPR, FPU or DBG register flavor will be 
used to fill in the register context for the thread and all registers one of 
GPR, FPU, DBG will be marked as valid. If you have an API on your system that 
allows each register to be read/written individually, you could do them 
separately and mark each individual register valid after it is read. So this 
really depends on your system interface for reading registers. There is usually 
ptrace() calls for most unix based systems to read registers and you end up 
reading them in sets.

The other thing to note, is that LLDB expects your registers numbers to start 
at zero, and never have any register number gaps.

So as long as your changes adhere to what was said above, it is a good start.


Repository:
  rL LLVM

http://reviews.llvm.org/D16508



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


[Lldb-commits] [lldb] r258704 - Fix TestSourceManager.py on Windows.

2016-01-25 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Jan 25 13:13:35 2016
New Revision: 258704

URL: http://llvm.org/viewvc/llvm-project?rev=258704&view=rev
Log:
Fix TestSourceManager.py on Windows.

Python 3.5 is picky about writing strings to binary files, so we now open the
file in text mode, and we explicitly set the newline mode to avoid re-writing
it with CR+LF on Windows (which causes git to think the file had changed).

Modified:

lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py?rev=258704&r1=258703&r2=258704&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py 
Mon Jan 25 13:13:35 2016
@@ -80,13 +80,13 @@ class SourceManagerTestCase(TestBase):
 main_c_hidden = os.path.join("hidden", main_c)
 os.rename(main_c, main_c_hidden)
 
+# Restore main.c after the test.
+self.addTearDownHook(lambda: os.rename(main_c_hidden, main_c))
+
 if self.TraceOn():
 system([["ls"]])
 system([["ls", "hidden"]])
 
-# Restore main.c after the test.
-self.addTearDownHook(lambda: os.rename(main_c_hidden, main_c))
-
 # Set target.source-map settings.
 self.runCmd("settings set target.source-map %s %s" % (os.getcwd(), 
os.path.join(os.getcwd(), "hidden")))
 # And verify that the settings work.
@@ -133,7 +133,7 @@ class SourceManagerTestCase(TestBase):
 self.assertTrue(int(m.group(1)) > 0)
 
 # Read the main.c file content.
-with open('main.c', 'r') as f:
+with io.open('main.c', 'r', newline='\n') as f:
 original_content = f.read()
 if self.TraceOn():
 print("original content:", original_content)
@@ -145,7 +145,7 @@ class SourceManagerTestCase(TestBase):
 def restore_file():
 #print("os.path.getmtime() before restore:", 
os.path.getmtime('main.c'))
 time.sleep(1)
-with open('main.c', 'wb') as f:
+with io.open('main.c', 'w', newline='\n') as f:
 f.write(original_content)
 if self.TraceOn():
 with open('main.c', 'r') as f:
@@ -156,9 +156,8 @@ class SourceManagerTestCase(TestBase):
 print("os.path.getmtime() after restore:", 
os.path.getmtime('main.c'))
 
 
-
 # Modify the source code file.
-with open('main.c', 'wb') as f:
+with io.open('main.c', 'w', newline='\n') as f:
 time.sleep(1)
 f.write(new_content)
 if self.TraceOn():


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


Re: [Lldb-commits] [lldb] r258485 - Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB during expression evaluation

2016-01-25 Thread Hans Wennborg via lldb-commits
SGTM if Greg approves.

On Mon, Jan 25, 2016 at 2:03 AM, Bhushan Attarde
 wrote:
> Could you please add this to the release branch?
>
> Thanks,
> Bhushan
>
>
> -Original Message-
> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of 
> Bhushan D. Attarde via lldb-commits
> Sent: 22 January 2016 10:32
> To: lldb-commits@lists.llvm.org
> Subject: [Lldb-commits] [lldb] r258485 - Use "_$" prefix instead of "$" for 
> dynamic checker function inserted by LLDB during expression evaluation
>
> Author: bhushan.attarde
> Date: Thu Jan 21 23:02:02 2016
> New Revision: 258485
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258485&view=rev
> Log:
> Use "_$" prefix instead of "$" for dynamic checker function inserted by LLDB 
> during expression evaluation
>
> SUMMARY:
> The symbol "$" has a special meaning for MIPS i.e it is marker for 
> temporary symbols for MIPS.
> So this patch uses additional _ prefix for "$__lldb_valid_pointer_check" 
> so that it wont be marked as temporary symbol in case of MIPS.
>
> Reviewers: clayborg, spyffe
> Subscribers: dean, emaste, mohit.bhakkad, sagar, jaydeep, lldb-commits
> Differential http://reviews.llvm.org/D14111
>
> Modified:
> lldb/trunk/source/Expression/IRDynamicChecks.cpp
>
> Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=258485&r1=258484&r2=258485&view=diff
> ==
> --- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original)
> +++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Thu Jan 21 23:02:02
> +++ 2016
> @@ -35,12 +35,12 @@ using namespace lldb_private;
>
>  static char ID;
>
> -#define VALID_POINTER_CHECK_NAME "$__lldb_valid_pointer_check"
> +#define VALID_POINTER_CHECK_NAME "_$__lldb_valid_pointer_check"
>  #define VALID_OBJC_OBJECT_CHECK_NAME "$__lldb_objc_object_check"
>
>  static const char g_valid_pointer_check_text[] =  "extern \"C\" void\n"
> -"$__lldb_valid_pointer_check (unsigned char *$__lldb_arg_ptr)\n"
> +"_$__lldb_valid_pointer_check (unsigned char *$__lldb_arg_ptr)\n"
>  "{\n"
>  "unsigned char $__lldb_local_val = *$__lldb_arg_ptr;\n"
>  "}";
>
>
> ___
> 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] D16397: [LLDB] Consider only valid symbols while resolving by address

2016-01-25 Thread Adrian McCarthy via lldb-commits
amccarth added a subscriber: amccarth.
amccarth added a comment.

This patch  broke approximately 10 tests on Windows, mostly related to thread 
step-over, thread step-out, etc.  We probably  need to fix something in 
PECOFF::GetSymTab that's causing all the symbols to be rejected.  I'll look 
into it more.



Comment at: lldb/trunk/source/Symbol/Symtab.cpp:1077
@@ -1076,1 +1076,3 @@
 void
+Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr, std::function 
 const &callback)
+{

Addresss has too many `s`s.


Comment at: lldb/trunk/source/Symbol/Symtab.cpp:1092
@@ +1091,3 @@
+if (!callback(SymbolAtIndex(all_addr_indexes[i])))
+break;
+}

Indentation problem.


Repository:
  rL LLVM

http://reviews.llvm.org/D16397



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


Re: [Lldb-commits] [PATCH] D16397: [LLDB] Consider only valid symbols while resolving by address

2016-01-25 Thread Zachary Turner via lldb-commits
Also various other formatting problems.  Please run clang-format in the
future.

Steps to running clang-format
1. Compile it with "ninja clang-format"
2. Add your bin directory to PATH
3. Stage your changes with git add as you normally do
4. Run "git clang-format"

On Mon, Jan 25, 2016 at 11:51 AM Adrian McCarthy via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> amccarth added a subscriber: amccarth.
> amccarth added a comment.
>
> This patch  broke approximately 10 tests on Windows, mostly related to
> thread step-over, thread step-out, etc.  We probably  need to fix something
> in PECOFF::GetSymTab that's causing all the symbols to be rejected.  I'll
> look into it more.
>
>
> 
> Comment at: lldb/trunk/source/Symbol/Symtab.cpp:1077
> @@ -1076,1 +1076,3 @@
>  void
> +Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr,
> std::function  const &callback)
> +{
> 
> Addresss has too many `s`s.
>
> 
> Comment at: lldb/trunk/source/Symbol/Symtab.cpp:1092
> @@ +1091,3 @@
> +if (!callback(SymbolAtIndex(all_addr_indexes[i])))
> +break;
> +}
> 
> Indentation problem.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D16397
>
>
>
> ___
> 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] D16397: [LLDB] Consider only valid symbols while resolving by address

2016-01-25 Thread Zachary Turner via lldb-commits
zturner added a subscriber: zturner.
zturner added a comment.

Also various other formatting problems.  Please run clang-format in the
future.

Steps to running clang-format

1. Compile it with "ninja clang-format"
2. Add your bin directory to PATH
3. Stage your changes with git add as you normally do
4. Run "git clang-format"


Repository:
  rL LLVM

http://reviews.llvm.org/D16397



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


Re: [Lldb-commits] [PATCH] D16477: Make all x86 target builds on MSVC use the amd64_x86 toolchain

2016-01-25 Thread Galina via lldb-commits
gkistanova accepted this revision.
gkistanova added a comment.
This revision is now accepted and ready to land.

LGTM

Thanks

Galina


http://reviews.llvm.org/D16477



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


[Lldb-commits] [lldb] r258741 - Fix swig typemap for SBEvent.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 17:21:09 2016
New Revision: 258741

URL: http://llvm.org/viewvc/llvm-project?rev=258741&view=rev
Log:
Fix swig typemap for SBEvent.

This needs to be able to handle bytes, strings, and bytearray objects.
In Python 2 this was easy because bytes and strings are the same thing,
but in Python 3 the 2 cases need to be handled separately.  So as not
to mix raw Python C API code with PythonDataObjects code, I've also
introduced a PythonByteArray class to PythonDataObjects to make the
paradigm used here consistent.

Modified:
lldb/trunk/scripts/Python/python-typemaps.swig
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=258741&r1=258740&r2=258741&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Jan 25 17:21:09 2016
@@ -113,13 +113,21 @@
 // typemap for an outgoing buffer
 // See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t 
cstr_len).
 %typemap(in) (const char *cstr, uint32_t cstr_len) {
-   if (PyString_Check($input)) {
-  $1 = (char *) PyString_AsString($input);
-  $2 = PyString_Size($input);
+   using namespace lldb_private;
+   if (PythonString::Check($input)) {
+  PythonString str(PyRefType::Borrowed, $input);
+  $1 = (char*)str.GetString().data();
+  $2 = str.GetSize();
}
-   else if(PyByteArray_Check($input)) {
-  $1 = (char *) PyByteArray_AsString($input);
-  $2 = PyByteArray_Size($input);
+   else if(PythonByteArray::Check($input)) {
+  PythonByteArray bytearray(PyRefType::Borrowed, $input);
+  $1 = (char*)bytearray.GetBytes().data();
+  $2 = bytearray.GetSize();
+   }
+   else if (PythonBytes::Check($input)) {
+  PythonBytes bytes(PyRefType::Borrowed, $input);
+  $1 = (char*)bytes.GetBytes().data();
+  $2 = bytes.GetSize();
}
else {
   PyErr_SetString(PyExc_ValueError, "Expecting a string");

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=258741&r1=258740&r2=258741&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Mon Jan 25 17:21:09 2016
@@ -83,6 +83,8 @@ PythonObject::GetObjectType() const
 if (PythonBytes::Check(m_py_obj))
 return PyObjectType::Bytes;
 #endif
+if (PythonByteArray::Check(m_py_obj))
+return PyObjectType::ByteArray;
 if (PythonInteger::Check(m_py_obj))
 return PyObjectType::Integer;
 if (PythonFile::Check(m_py_obj))
@@ -218,6 +220,8 @@ PythonObject::CreateStructuredObject() c
 return PythonString(PyRefType::Borrowed, 
m_py_obj).CreateStructuredString();
 case PyObjectType::Bytes:
 return PythonBytes(PyRefType::Borrowed, 
m_py_obj).CreateStructuredString();
+case PyObjectType::ByteArray:
+return PythonByteArray(PyRefType::Borrowed, 
m_py_obj).CreateStructuredString();
 case PyObjectType::None:
 return StructuredData::ObjectSP();
 default:
@@ -323,6 +327,87 @@ PythonBytes::CreateStructuredString() co
 return result;
 }
 
+PythonByteArray::PythonByteArray(llvm::ArrayRef bytes) : 
PythonByteArray(bytes.data(), bytes.size())
+{
+}
+
+PythonByteArray::PythonByteArray(const uint8_t *bytes, size_t length)
+{
+const char *str = reinterpret_cast(bytes);
+Reset(PyRefType::Owned, PyByteArray_FromStringAndSize(str, length));
+}
+
+PythonByteArray::PythonByteArray(PyRefType type, PyObject *o)
+{
+Reset(type, o);
+}
+
+PythonByteArray::PythonByteArray(const PythonBytes &object) : 
PythonObject(object)
+{
+}
+
+PythonByteArray::~PythonByteArray()
+{
+}
+
+bool
+PythonByteArray::Check(PyObject *py_obj)
+{
+if (!py_obj)
+return false;
+if (PyByteArray_Check(py_obj))
+return true;
+return false;
+}
+
+void
+PythonByteArray::Reset(PyRefType type, PyObject *py_obj)
+{
+// Grab the desired reference type so that if we end up rejecting
+// `py_obj` it still gets decremented if necessary.
+PythonObject result(type, py_obj);
+
+if (!PythonByteArray::Check(py_obj))
+{
+PythonObject::Reset();
+return;
+}
+
+// Calling PythonObject::Reset(const PythonObject&) will lead to stack 
overflow since it calls
+// back into the virtual implementation.
+Py

[Lldb-commits] [lldb] r258742 - Fix more occurrences of string/bytes/bytearray in swig typemaps.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 17:21:13 2016
New Revision: 258742

URL: http://llvm.org/viewvc/llvm-project?rev=258742&view=rev
Log:
Fix more occurrences of string/bytes/bytearray in swig typemaps.

Modified:
lldb/trunk/scripts/Python/python-typemaps.swig

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=258742&r1=258741&r2=258742&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Jan 25 17:21:13 2016
@@ -136,13 +136,21 @@
 }
 // Ditto for SBProcess::PutSTDIN(const char *src, size_t src_len).
 %typemap(in) (const char *src, size_t src_len) {
-   if (PyString_Check($input)) {
-  $1 = (char *) PyString_AsString($input);
-  $2 = PyString_Size($input);
-   }
-   else if(PyByteArray_Check($input)) {
-  $1 = (char *) PyByteArray_AsString($input);
-  $2 = PyByteArray_Size($input);
+   using namespace lldb_private;
+   if (PythonString::Check($input)) {
+  PythonString str(PyRefType::Borrowed, $input);
+  $1 = (char*)str.GetString().data();
+  $2 = str.GetSize();
+   }
+   else if(PythonByteArray::Check($input)) {
+  PythonByteArray bytearray(PyRefType::Borrowed, $input);
+  $1 = (char*)bytearray.GetBytes().data();
+  $2 = bytearray.GetSize();
+   }
+   else if (PythonBytes::Check($input)) {
+  PythonBytes bytes(PyRefType::Borrowed, $input);
+  $1 = (char*)bytes.GetBytes().data();
+  $2 = bytes.GetSize();
}
else {
   PyErr_SetString(PyExc_ValueError, "Expecting a string");
@@ -151,32 +159,48 @@
 }
 // And SBProcess::WriteMemory.
 %typemap(in) (const void *buf, size_t size) {
-   if (PyString_Check($input)) {
-  $1 = (void *) PyString_AsString($input);
-  $2 = PyString_Size($input);
-   }
-   else if(PyByteArray_Check($input)) {
-  $1 = (void *) PyByteArray_AsString($input);
-  $2 = PyByteArray_Size($input);
+   using namespace lldb_private;
+   if (PythonString::Check($input)) {
+  PythonString str(PyRefType::Borrowed, $input);
+  $1 = (void*)str.GetString().data();
+  $2 = str.GetSize();
+   }
+   else if(PythonByteArray::Check($input)) {
+  PythonByteArray bytearray(PyRefType::Borrowed, $input);
+  $1 = (void*)bytearray.GetBytes().data();
+  $2 = bytearray.GetSize();
+   }
+   else if (PythonBytes::Check($input)) {
+  PythonBytes bytes(PyRefType::Borrowed, $input);
+  $1 = (void*)bytes.GetBytes().data();
+  $2 = bytes.GetSize();
}
else {
-  PyErr_SetString(PyExc_ValueError, "Expecting a string");
+  PyErr_SetString(PyExc_ValueError, "Expecting a buffer");
   return NULL;
}
 }
 
 // For SBDebugger::DispatchInput
 %typemap(in) (const void *data, size_t data_len) {
-   if (PyString_Check($input)) {
-  $1 = static_cast(PyString_AsString($input));
-  $2 = PyString_Size($input);
-   }
-   else if(PyByteArray_Check($input)) {
-  $1 = static_cast(PyByteArray_AsString($input));
-  $2 = PyByteArray_Size($input);
+   using namespace lldb_private;
+   if (PythonString::Check($input)) {
+  PythonString str(PyRefType::Borrowed, $input);
+  $1 = (void*)str.GetString().data();
+  $2 = str.GetSize();
+   }
+   else if(PythonByteArray::Check($input)) {
+  PythonByteArray bytearray(PyRefType::Borrowed, $input);
+  $1 = (void*)bytearray.GetBytes().data();
+  $2 = bytearray.GetSize();
+   }
+   else if (PythonBytes::Check($input)) {
+  PythonBytes bytes(PyRefType::Borrowed, $input);
+  $1 = (void*)bytes.GetBytes().data();
+  $2 = bytes.GetSize();
}
else {
-  PyErr_SetString(PyExc_ValueError, "Expecting a string or byte array");
+  PyErr_SetString(PyExc_ValueError, "Expecting a buffer");
   return NULL;
}
 }


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


[Lldb-commits] [lldb] r258743 - Fix some issues with bytes and strings in Python 3.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 17:21:18 2016
New Revision: 258743

URL: http://llvm.org/viewvc/llvm-project?rev=258743&view=rev
Log:
Fix some issues with bytes and strings in Python 3.

SBProcess::ReadMemory and other related functions such as
WriteMemory are returning Python string() objects.  This means
that in Python 3 that are returning Unicode objects.  In reality
they should be returning bytes objects which is the same as a string
in Python 2, but different in Python 3.  This patch updates the
generated SWIG code to return Python bytes objects for all
memory related functions.

One quirk of this patch is that the C++ signature of ReadCStringFromMemory
has it writing c-string data into a void*.  This confuses our swig
typemaps which expect that a void* means byte data.  So I hacked up
a custom typemap which maps this specific function to treat the
void* as string data instead of byte data.

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

lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
lldb/trunk/scripts/Python/python-typemaps.swig
lldb/trunk/scripts/interface/SBProcess.i

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=258743&r1=258742&r2=258743&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Mon Jan 25 17:21:18 
2016
@@ -84,7 +84,7 @@ def int_to_bytearray(val, bytesize):
 return None
 
 packed = struct.pack(fmt, val)
-return bytearray(list(map(ord, packed)))
+return bytearray(packed)
 
 def bytearray_to_int(bytes, bytesize):
 """Utility function to convert a bytearray into an integer.
@@ -108,7 +108,7 @@ def bytearray_to_int(bytes, bytesize):
 else:
 return None
 
-unpacked = struct.unpack(fmt, str(bytes))
+unpacked = struct.unpack_from(fmt, bytes)
 return unpacked[0]
 
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py?rev=258743&r1=258742&r2=258743&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py 
Mon Jan 25 17:21:18 2016
@@ -56,7 +56,7 @@ class ProcessAPITestCase(TestBase):
 
 self.expect(content, "Result from SBProcess.ReadMemory() matches our 
expected output: 'x'",
 exe=False,
-startstr = 'x')
+startstr = b'x')
 
 # Read (char *)my_char_ptr.
 val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)
@@ -154,7 +154,7 @@ class ProcessAPITestCase(TestBase):
 
 self.expect(content, "Result from SBProcess.ReadMemory() matches our 
expected output: 'a'",
 exe=False,
-startstr = 'a')
+startstr = b'a')
 
 @add_test_categories(['pyapi'])
 def test_access_my_int(self):
@@ -206,9 +206,8 @@ class ProcessAPITestCase(TestBase):
 # But we want to use the WriteMemory() API to assign 256 to the 
variable.
 
 # Now use WriteMemory() API to write 256 into the global variable.
-new_value = str(bytes)
 error = lldb.SBError()
-result = process.WriteMemory(location, new_value, error)
+result = process.WriteMemory(location, bytes, error)
 if not error.Success() or result != byteSize:
 self.fail("SBProcess.WriteMemory() failed")
 
@@ -230,14 +229,11 @@ class ProcessAPITestCase(TestBase):
 if not error.Success():
 self.fail("SBProcess.ReadMemory() failed")
 
-# Use "ascii" as the encoding because each element of 'content' is in 
the range [0..255].
-new_bytes = bytearray(content, "ascii")
-
 # The bytearray_to_int utility function expects a little endian 
bytearray.
 if byteOrder == lldb.eByteOrderBig:
 new_bytes.reverse()
 
-new_value = bytearray_to_int(new_bytes, byteSize)
+new_value = bytearray_to_int(content, byteSize)
 if new_value != 256:
 self.fail("Memory content read from 'my_int' does not match 
(int)256")
 

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=258743&r1=258742&r2=258743&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Jan 25 17:21:18 2016
@@ -93,6 +93,9 @@
}
$1 = (char 

[Lldb-commits] [lldb] r258751 - Fix TestSyntheticCapping for Python 3.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 18:07:09 2016
New Revision: 258751

URL: http://llvm.org/viewvc/llvm-project?rev=258751&view=rev
Log:
Fix TestSyntheticCapping for Python 3.

In Python 3, whitespace inconsistences are errors.  This synthetic
provider had mixed tabs and spaces, as well as inconsistent
indentation widths.  This led to the file not being imported,
and naturally the test failing.  No functional change here, just
whitespace.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py?rev=258751&r1=258750&r2=258751&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
 Mon Jan 25 18:07:09 2016
@@ -1,21 +1,21 @@
 import lldb
 class fooSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
- def num_children(self):
- return 3;
- def get_child_at_index(self, index):
- if index == 0:
- child = self.valobj.GetChildMemberWithName('a');
- if index == 1:
- child = self.valobj.CreateChildAtOffset ('fake_a', 1, 
self.int_type);
- if index == 2:
- child = self.valobj.GetChildMemberWithName('r');
- return child;
- def get_child_index(self, name):
- if name == 'a':
- return 0;
- if name == 'fake_a':
- return 1;
-return 2;
+def __init__(self, valobj, dict):
+self.valobj = valobj;
+self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
+def num_children(self):
+return 3;
+def get_child_at_index(self, index):
+if index == 0:
+child = self.valobj.GetChildMemberWithName('a');
+if index == 1:
+child = self.valobj.CreateChildAtOffset ('fake_a', 1, 
self.int_type);
+if index == 2:
+child = self.valobj.GetChildMemberWithName('r');
+return child;
+def get_child_index(self, name):
+if name == 'a':
+return 0;
+if name == 'fake_a':
+return 1;
+return 2;


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


[Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added reviewers: zturner, clayborg.
amccarth added a subscriber: lldb-commits.

This fixes the regression of several tests on Windows after rL258621.

The root problem is that ObjectFilePECOFF was not setting type information for 
the symbols, and the new CL rejects symbols without type information, breaking 
functionality like `thread step-over`.

The fix sets the type information for functions (and creates a TODO for other 
types).

Along the way, I fixed some typos and formatting that made the code I was 
debugging harder to understand.

In the long run, we should consider replacing most of ObjectFilePECOFF with the 
COFF parsing code from LLVM.

http://reviews.llvm.org/D16563

Files:
  include/lldb/Core/RangeMap.h
  include/lldb/Symbol/Symtab.h
  source/Core/Module.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  source/Symbol/Symtab.cpp

Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -1074,7 +1074,7 @@
 }
 
 void
-Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr, std::function  const &callback)
+Symtab::ForEachSymbolContainingFileAddress(addr_t file_addr, std::function  const &callback)
 {
 Mutex::Locker locker (m_mutex);
 
@@ -1084,9 +1084,9 @@
 std::vector all_addr_indexes;
 
 // Get all symbols with file_addr
-const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContains(file_addr, all_addr_indexes);
+const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContain(file_addr, all_addr_indexes);
 
-for (size_t i=0; i> llvm::COFF::SCT_COMPLEX_TYPE_SHIFT;
+if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION)
+{
+return lldb::eSymbolTypeCode;
+}
+return lldb::eSymbolTypeInvalid;
+}
+
+
 ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp, 
 DataBufferSP& data_sp,
 lldb::offset_t data_offset,
@@ -535,7 +549,7 @@
 const uint32_t symbol_size = 18;
 const uint32_t addr_byte_size = GetAddressByteSize ();
 const size_t symbol_data_size = num_syms * symbol_size; 
-// Include the 4 bytes string table size at the end of the symbols
+// Include the 4-byte string table size at the end of the symbols
 DataBufferSP symtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff, symbol_data_size + 4));
 DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size);
 lldb::offset_t offset = symbol_data_size;
@@ -556,8 +570,8 @@
 coff_symbol_t symbol;
 const uint32_t symbol_offset = offset;
 const char *symbol_name_cstr = NULL;
-// If the first 4 bytes of the symbol string are zero, then we
-// it is followed by a 4 byte string table offset. Else these
+// If the first 4 bytes of the symbol string are zero, then they
+// are followed by a 4-byte string table offset. Else these
 // 8 bytes contain the symbol name
 if (symtab_data.GetU32 (&offset) == 0)
 {
@@ -586,6 +600,7 @@
 {
 Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value);
 symbols[i].GetAddressRef() = symbol_addr;
+symbols[i].SetType(MapSymbolType(symbol.type));
 }
 
 if (symbol.naux > 0)
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -560,14 +560,17 @@
 if (symtab && so_addr.IsSectionOffset())
 {
 Symbol *matching_symbol = nullptr;
-symtab->ForEachSymbolContainingFileAddresss (so_addr.GetFileAddress(), [&matching_symbol](Symbol *symbol) -> bool {
-if (symbol->GetType() != eSymbolTypeInvalid)
+
+symtab->ForEachSymbolContainingFileAddress(so_addr.GetFileAddress(),
+[&matching_symbol](Symbol *symbol) -> bool
 {
-matching_symbol = symbol;
-return false; // Stop iterating
-}
-return true; // Keep iterating
-});
+if (symbol->GetType() != eSymbolTypeInvalid)
+{
+matching_symbol = symbol;
+return false; // Stop iterating
+}
+return true; // Keep iterating
+});

Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

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

Looks fine.


http://reviews.llvm.org/D16563



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


Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: include/lldb/Core/RangeMap.h:1230
@@ -1229,3 +1229,3 @@
 typename Collection::const_iterator pos;
-for(pos = m_entries.begin(); pos != m_entries.end(); pos++)
+for (pos = m_entries.begin(); pos != m_entries.end(); pos++)
 {

If you're making cleanup changes anyway, how about a ranged based for.


Comment at: include/lldb/Symbol/Symtab.h:84
@@ -83,3 +83,3 @@
 Symbol *FindSymbolContainingFileAddress (lldb::addr_t 
file_addr);
-voidForEachSymbolContainingFileAddresss (lldb::addr_t 
file_addr, std::function  const &callback);
+voidForEachSymbolContainingFileAddress (lldb::addr_t 
file_addr, std::function  const &callback);
 size_t  FindFunctionSymbols (const ConstString &name, uint32_t 
name_type_mask, SymbolContextList& sc_list);

Did you use clang-format?  If you had this would have a return type on a new 
line (although obviously you don't want that here since it woudl be 
inconsistent with the rest of the file).

I guess you would need to clang-format it, then don't take the change to this 
line.  (Which maybe is exactly what you did, just checking)


Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:183
@@ +182,3 @@
+}
+return lldb::eSymbolTypeInvalid;
+}

Instead of returning `eSymbolTypeInvalid` here, how about `eSymbolTypeData`?  
If you look in `llvm/Support/COFF.h` all of the non function types are data.


http://reviews.llvm.org/D16563



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


Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
amccarth marked 2 inline comments as done.


Comment at: include/lldb/Core/RangeMap.h:1230
@@ -1229,3 +1229,3 @@
 typename Collection::const_iterator pos;
-for(pos = m_entries.begin(); pos != m_entries.end(); pos++)
+for (pos = m_entries.begin(); pos != m_entries.end(); pos++)
 {

zturner wrote:
> If you're making cleanup changes anyway, how about a ranged based for.
I had thought about it, especially since it violates the LLVM style guide to 
call end() on every iteration, but I was trying not to venture too far from the 
point of the patch.  Done now.


Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:183
@@ +182,3 @@
+}
+return lldb::eSymbolTypeInvalid;
+}

zturner wrote:
> Instead of returning `eSymbolTypeInvalid` here, how about `eSymbolTypeData`?  
> If you look in `llvm/Support/COFF.h` all of the non function types are data.
I'm not sure about that.  Some of the symbols are clearly sections (.text, 
etc.).  Those have 0 for the COFF type, which COFF.h says means "No type 
information or unknown base type."  If .text has a "valid" symbol type, then it 
will be found (instead of, say, "_main"), and I'm not sure if the 
unwinding/stepping would work right.


http://reviews.llvm.org/D16563



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


Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:183
@@ +182,3 @@
+}
+return lldb::eSymbolTypeInvalid;
+}

amccarth wrote:
> zturner wrote:
> > Instead of returning `eSymbolTypeInvalid` here, how about 
> > `eSymbolTypeData`?  If you look in `llvm/Support/COFF.h` all of the non 
> > function types are data.
> I'm not sure about that.  Some of the symbols are clearly sections (.text, 
> etc.).  Those have 0 for the COFF type, which COFF.h says means "No type 
> information or unknown base type."  If .text has a "valid" symbol type, then 
> it will be found (instead of, say, "_main"), and I'm not sure if the 
> unwinding/stepping would work right.
How about:

if (coff_symbol_type == 0)
return lldb::eSymbolTypeInvalid;
if (coff_symbol_type >> llvm::COFF::SCT_COMPLEX_TYPE_SHIFT) == 
llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION)
return lldb::eSymbolTypeCode;
return lldb::eSymbolTypeData;

I feel like we can at least do a little better than always returning 
`eSymbolTypeInvalid` if it's not a function without too much work.


http://reviews.llvm.org/D16563



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


Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 45933.
amccarth marked an inline comment as done.
amccarth added a comment.

Mostly clang-format.


http://reviews.llvm.org/D16563

Files:
  include/lldb/Core/RangeMap.h
  include/lldb/Symbol/Symtab.h
  source/Core/Module.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  source/Symbol/Symtab.cpp

Index: source/Symbol/Symtab.cpp
===
--- source/Symbol/Symtab.cpp
+++ source/Symbol/Symtab.cpp
@@ -1074,7 +1074,7 @@
 }
 
 void
-Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr, std::function  const &callback)
+Symtab::ForEachSymbolContainingFileAddress(addr_t file_addr, std::function const &callback)
 {
 Mutex::Locker locker (m_mutex);
 
@@ -1084,9 +1084,9 @@
 std::vector all_addr_indexes;
 
 // Get all symbols with file_addr
-const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContains(file_addr, all_addr_indexes);
+const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContain(file_addr, all_addr_indexes);
 
-for (size_t i=0; i> llvm::COFF::SCT_COMPLEX_TYPE_SHIFT;
+if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION)
+{
+return lldb::eSymbolTypeCode;
+}
+return lldb::eSymbolTypeInvalid;
+}
 
 ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp, 
 DataBufferSP& data_sp,
@@ -534,8 +546,8 @@
 {
 const uint32_t symbol_size = 18;
 const uint32_t addr_byte_size = GetAddressByteSize ();
-const size_t symbol_data_size = num_syms * symbol_size; 
-// Include the 4 bytes string table size at the end of the symbols
+const size_t symbol_data_size = num_syms * symbol_size;
+// Include the 4-byte string table size at the end of the symbols
 DataBufferSP symtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff, symbol_data_size + 4));
 DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size);
 lldb::offset_t offset = symbol_data_size;
@@ -556,8 +568,8 @@
 coff_symbol_t symbol;
 const uint32_t symbol_offset = offset;
 const char *symbol_name_cstr = NULL;
-// If the first 4 bytes of the symbol string are zero, then we
-// it is followed by a 4 byte string table offset. Else these
+// If the first 4 bytes of the symbol string are zero, then they
+// are followed by a 4-byte string table offset. Else these
 // 8 bytes contain the symbol name
 if (symtab_data.GetU32 (&offset) == 0)
 {
@@ -586,6 +598,7 @@
 {
 Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value);
 symbols[i].GetAddressRef() = symbol_addr;
+symbols[i].SetType(MapSymbolType(symbol.type));
 }
 
 if (symbol.naux > 0)
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -560,14 +560,16 @@
 if (symtab && so_addr.IsSectionOffset())
 {
 Symbol *matching_symbol = nullptr;
-symtab->ForEachSymbolContainingFileAddresss (so_addr.GetFileAddress(), [&matching_symbol](Symbol *symbol) -> bool {
-if (symbol->GetType() != eSymbolTypeInvalid)
-{
-matching_symbol = symbol;
-return false; // Stop iterating
-}
-return true; // Keep iterating
-});
+
+symtab->ForEachSymbolContainingFileAddress(so_addr.GetFileAddress(),
+   [&matching_symbol](Symbol *symbol) -> bool {
+   if (symbol->GetType() != eSymbolTypeInvalid)
+   {
+   matching_symbol = symbol;
+   return false; // Stop iterating
+   }
+   return true; // Keep iterating
+   });
 sc.symbol = matching_symbol;
 if (!sc.symbol &&
 resolve_scope & eSymbolContextFunction && !(resolved_flags & eSymbolContextFunction))
Index: include/lldb/Symbol/Symtab.h
==

Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
amccarth added inline comments.


Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:195
@@ -182,3 +194,3 @@
 m_coff_header_opt (),
 m_sect_headers ()
 {

After discussion with a COFF expert, it seems wise to postpone trying to do 
anything more with this type mapping.


http://reviews.llvm.org/D16563



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


[Lldb-commits] [lldb] r258758 - Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Jan 25 18:58:09 2016
New Revision: 258758

URL: http://llvm.org/viewvc/llvm-project?rev=258758&view=rev
Log:
Set symbol types for function symbols loaded from PE/COFF

This fixes the regression of several tests on Windows after rL258621.

The root problem is that ObjectFilePECOFF was not setting type information for 
the symbols, and the new CL rejects symbols without type information, breaking 
functionality like thread step-over.

The fix sets the type information for functions (and creates a TODO for other 
types).

Along the way, I fixed some typos and formatting that made the code I was 
debugging harder to understand.

In the long run, we should consider replacing most of ObjectFilePECOFF with the 
COFF parsing code from LLVM.

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

Modified:
lldb/trunk/include/lldb/Core/RangeMap.h
lldb/trunk/include/lldb/Symbol/Symtab.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=258758&r1=258757&r2=258758&view=diff
==
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Mon Jan 25 18:58:09 2016
@@ -1218,7 +1218,7 @@ namespace lldb_private {
 }
 
 uint32_t
-FindEntryIndexesThatContains (B addr, std::vector &indexes) 
const
+FindEntryIndexesThatContain(B addr, std::vector &indexes) 
const
 {
 #ifdef ASSERT_RANGEMAP_ARE_SORTED
 assert (IsSorted());
@@ -1227,10 +1227,10 @@ namespace lldb_private {
 if (!m_entries.empty())
 {
 typename Collection::const_iterator pos;
-for(pos = m_entries.begin(); pos != m_entries.end(); pos++)
+for (const auto &entry : m_entries)
 {
-if (pos->Contains(addr))
-indexes.push_back (pos->data);
+if (entry.Contains(addr))
+indexes.push_back(entry.data);
 }
 }
 return indexes.size() ;

Modified: lldb/trunk/include/lldb/Symbol/Symtab.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=258758&r1=258757&r2=258758&view=diff
==
--- lldb/trunk/include/lldb/Symbol/Symtab.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symtab.h Mon Jan 25 18:58:09 2016
@@ -81,7 +81,7 @@ public:
 Symbol *FindFirstSymbolWithNameAndType (const ConstString 
&name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility 
symbol_visibility);
 Symbol *FindSymbolContainingFileAddress (lldb::addr_t 
file_addr, const uint32_t* indexes, uint32_t num_indexes);
 Symbol *FindSymbolContainingFileAddress (lldb::addr_t 
file_addr);
-voidForEachSymbolContainingFileAddresss (lldb::addr_t 
file_addr, std::function  const &callback);
+voidForEachSymbolContainingFileAddress(lldb::addr_t 
file_addr, std::function const &callback);
 size_t  FindFunctionSymbols (const ConstString &name, uint32_t 
name_type_mask, SymbolContextList& sc_list);
 voidCalculateSymbolSizes ();
 

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=258758&r1=258757&r2=258758&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon Jan 25 18:58:09 2016
@@ -560,14 +560,16 @@ Module::ResolveSymbolContextForAddress (
 if (symtab && so_addr.IsSectionOffset())
 {
 Symbol *matching_symbol = nullptr;
-symtab->ForEachSymbolContainingFileAddresss 
(so_addr.GetFileAddress(), [&matching_symbol](Symbol *symbol) -> bool {
-if (symbol->GetType() != eSymbolTypeInvalid)
-{
-matching_symbol = symbol;
-return false; // Stop iterating
-}
-return true; // Keep iterating
-});
+
+
symtab->ForEachSymbolContainingFileAddress(so_addr.GetFileAddress(),
+   
[&matching_symbol](Symbol *symbol) -> bool {
+   if 
(symbol->GetType() != eSymbolTypeInvalid)
+   {
+ 

Re: [Lldb-commits] [PATCH] D16563: Set symbol types for function symbols loaded from PE/COFF

2016-01-25 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258758: Set symbol types for function symbols loaded from 
PE/COFF (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D16563?vs=45933&id=45935#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16563

Files:
  lldb/trunk/include/lldb/Core/RangeMap.h
  lldb/trunk/include/lldb/Symbol/Symtab.h
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  lldb/trunk/source/Symbol/Symtab.cpp

Index: lldb/trunk/source/Symbol/Symtab.cpp
===
--- lldb/trunk/source/Symbol/Symtab.cpp
+++ lldb/trunk/source/Symbol/Symtab.cpp
@@ -1074,7 +1074,7 @@
 }
 
 void
-Symtab::ForEachSymbolContainingFileAddresss (addr_t file_addr, std::function  const &callback)
+Symtab::ForEachSymbolContainingFileAddress(addr_t file_addr, std::function const &callback)
 {
 Mutex::Locker locker (m_mutex);
 
@@ -1084,9 +1084,9 @@
 std::vector all_addr_indexes;
 
 // Get all symbols with file_addr
-const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContains(file_addr, all_addr_indexes);
+const size_t addr_match_count = m_file_addr_to_index.FindEntryIndexesThatContain(file_addr, all_addr_indexes);
 
-for (size_t i=0; iForEachSymbolContainingFileAddresss (so_addr.GetFileAddress(), [&matching_symbol](Symbol *symbol) -> bool {
-if (symbol->GetType() != eSymbolTypeInvalid)
-{
-matching_symbol = symbol;
-return false; // Stop iterating
-}
-return true; // Keep iterating
-});
+
+symtab->ForEachSymbolContainingFileAddress(so_addr.GetFileAddress(),
+   [&matching_symbol](Symbol *symbol) -> bool {
+   if (symbol->GetType() != eSymbolTypeInvalid)
+   {
+   matching_symbol = symbol;
+   return false; // Stop iterating
+   }
+   return true; // Keep iterating
+   });
 sc.symbol = matching_symbol;
 if (!sc.symbol &&
 resolve_scope & eSymbolContextFunction && !(resolved_flags & eSymbolContextFunction))
Index: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -169,6 +169,18 @@
 return magic == IMAGE_DOS_SIGNATURE;
 }
 
+lldb::SymbolType
+ObjectFilePECOFF::MapSymbolType(uint16_t coff_symbol_type)
+{
+// TODO:  We need to complete this mapping of COFF symbol types to LLDB ones.
+// For now, here's a hack to make sure our function have types.
+const auto complex_type = coff_symbol_type >> llvm::COFF::SCT_COMPLEX_TYPE_SHIFT;
+if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION)
+{
+return lldb::eSymbolTypeCode;
+}
+return lldb::eSymbolTypeInvalid;
+}
 
 ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp, 
 DataBufferSP& data_sp,
@@ -534,8 +546,8 @@
 {
 const uint32_t symbol_size = 18;
 const uint32_t addr_byte_size = GetAddressByteSize ();
-const size_t symbol_data_size = num_syms * symbol_size; 
-// Include the 4 bytes string table size at the end of the symbols
+const size_t symbol_data_size = num_syms * symbol_size;
+// Include the 4-byte string table size at the end of the symbols
 DataBufferSP symtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff, symbol_data_size + 4));
 DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size);
 lldb::offset_t offset = symbol_data_size;
@@ -556,8 +568,8 @@
 coff_symbol_t symbol;
 const uint32_t symbol_offset = offset;
 const char *symbol_name_cstr = NULL;
-// If the first 4 bytes of the symbol string are zero, then we
-// it is followed by a 4 byte string table offset. Else these
+// If the first 4 bytes of the symbol string are zero, then they
+// are followed by a 4-byte string table of

[Lldb-commits] [lldb] r258759 - Write the session log file in UTF-8.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 18:59:42 2016
New Revision: 258759

URL: http://llvm.org/viewvc/llvm-project?rev=258759&view=rev
Log:
Write the session log file in UTF-8.

Previously we were writing in the default encoding, which depends
on the operating system and is not guaranteed to be unicode aware.
On Python 3, this would lead to a situation where writing unicode
text to the log file generates an exception.  The fix here is to
write session logs using the proper encoding, which incidentally
fixes another test, so xfail is removed from that.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py?rev=258759&r1=258758&r2=258759&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py 
Mon Jan 25 18:59:42 2016
@@ -25,7 +25,6 @@ class Char1632TestCase(TestBase):
line_number(self.source, '// breakpoint2') ]
 
 @expectedFailureIcc # ICC (13.1) does not emit the DW_TAG_base_type for 
char16_t and char32_t.
-@expectedFailureWindows("llvm.org/pr24489: Name lookup not working 
correctly on Windows")
 def test(self):
 """Test that the C++11 support for char16_t and char32_t works 
correctly."""
 self.build()

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=258759&r1=258758&r2=258759&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Jan 25 18:59:42 
2016
@@ -1436,7 +1436,7 @@ class Base(unittest2.TestCase):
 
 session_file = "{}.log".format(self.log_basename)
 # Python 3 doesn't support unbuffered I/O in text mode.  Open buffered.
-self.session = open(session_file, "w")
+self.session = io.open(session_file, "w", encoding="utf-8")
 
 # Optimistically set __errored__, __failed__, __expected__ to False
 # initially.  If the test errored/failed, the session info


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


[Lldb-commits] [lldb] r258761 - Remove XFAIL Windows from a test that was fixed by r258758.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 19:09:38 2016
New Revision: 258761

URL: http://llvm.org/viewvc/llvm-project?rev=258761&view=rev
Log:
Remove XFAIL Windows from a test that was fixed by r258758.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py?rev=258761&r1=258760&r2=258761&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
 Mon Jan 25 19:09:38 2016
@@ -24,7 +24,6 @@ class SymbolAPITestCase(TestBase):
 self.line2 = line_number('main.c', '// Find the line number for 
breakpoint 2 here.')
 
 @add_test_categories(['pyapi'])
-@expectedFailureWindows("llvm.org/pr24778")
 def test(self):
 """Exercise some SBSymbol and SBAddress APIs."""
 self.build()


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


[Lldb-commits] [lldb] r258763 - Fix the lldbinline tests so they make well-formed Makefiles.

2016-01-25 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Mon Jan 25 19:15:57 2016
New Revision: 258763

URL: http://llvm.org/viewvc/llvm-project?rev=258763&view=rev
Log:
Fix the lldbinline tests so they make well-formed Makefiles.

lldbinline tests previously did not run correctly unless there was already a
Makefile for them.  This was because the syntax of the emitted Makefile made the
default make rule be the "cleanup" rule, which is pretty unhelpful.  Now the
default rule is the one included from Makefile.rules, which is much better.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=258763&r1=258762&r2=258763&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Mon Jan 25 19:15:57 
2016
@@ -116,8 +116,8 @@ class InlineTest(TestBase):
 if ('CXX_SOURCES' in list(categories.keys())):
 makefile.write("CXXFLAGS += -std=c++11\n")
 
-makefile.write("\ncleanup:\n\trm -f Makefile *.d\n\n")
 makefile.write("include $(LEVEL)/Makefile.rules\n")
+makefile.write("\ncleanup:\n\trm -f Makefile *.d\n\n")
 makefile.flush()
 makefile.close()
 


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


[Lldb-commits] [lldb] r258764 - Fix TestRerun.py on Windows.

2016-01-25 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Jan 25 19:19:50 2016
New Revision: 258764

URL: http://llvm.org/viewvc/llvm-project?rev=258764&view=rev
Log:
Fix TestRerun.py on Windows.

This is another example of a test that was looking for the thread
at index 0 instead of requesting the thread that was stopped at
the created breakpoint.  This assumption isn't true on Windows 10.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py?rev=258764&r1=258763&r2=258764&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py 
Mon Jan 25 19:19:50 2016
@@ -31,19 +31,9 @@ class TestRerun(TestBase):
 self.runCmd("process launch 1 2 3")
 
 process = self.process()
-
-self.assertTrue(process.GetState() == lldb.eStateStopped,
-STOPPED_DUE_TO_BREAKPOINT)
-
-thread = process.GetThreadAtIndex (0)
-
-self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid 
thread");
-
-stop_reason = thread.GetStopReason()
-
-self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a 
stop reason of eStopReasonBreakpoint");
+thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, 
breakpoint)
+self.assertIsNotNone(thread, "Process should be stopped at a 
breakpoint in main")
+self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
 
 self.expect("frame variable argv[1]", substrs=['1'])
 self.expect("frame variable argv[2]", substrs=['2'])
@@ -57,19 +47,10 @@ class TestRerun(TestBase):
 self.runCmd("process launch")
 
 process = self.process()
-
-self.assertTrue(process.GetState() == lldb.eStateStopped,
-STOPPED_DUE_TO_BREAKPOINT)
-
-thread = process.GetThreadAtIndex (0)
+thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, 
breakpoint)
 
-self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid 
thread");
-
-stop_reason = thread.GetStopReason()
-
-self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a 
stop reason of eStopReasonBreakpoint");
+self.assertIsNotNone(thread, "Process should be stopped at a 
breakpoint in main");
+self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
 
 self.expect("frame variable argv[1]", substrs=['1'])
 self.expect("frame variable argv[2]", substrs=['2'])


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


[Lldb-commits] LLVM buildmaster will be restarted tonight

2016-01-25 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 9 PM Pacific time
today.

Thanks

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


[Lldb-commits] [lldb] r258791 - Reverting r258759 as it is breaking the OSX build

2016-01-25 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Jan 25 22:53:10 2016
New Revision: 258791

URL: http://llvm.org/viewvc/llvm-project?rev=258791&view=rev
Log:
Reverting r258759 as it is breaking the OSX build


Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py?rev=258791&r1=258790&r2=258791&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py 
Mon Jan 25 22:53:10 2016
@@ -25,6 +25,7 @@ class Char1632TestCase(TestBase):
line_number(self.source, '// breakpoint2') ]
 
 @expectedFailureIcc # ICC (13.1) does not emit the DW_TAG_base_type for 
char16_t and char32_t.
+@expectedFailureWindows("llvm.org/pr24489: Name lookup not working 
correctly on Windows")
 def test(self):
 """Test that the C++11 support for char16_t and char32_t works 
correctly."""
 self.build()

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=258791&r1=258790&r2=258791&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Jan 25 22:53:10 
2016
@@ -1436,7 +1436,7 @@ class Base(unittest2.TestCase):
 
 session_file = "{}.log".format(self.log_basename)
 # Python 3 doesn't support unbuffered I/O in text mode.  Open buffered.
-self.session = io.open(session_file, "w", encoding="utf-8")
+self.session = open(session_file, "w")
 
 # Optimistically set __errored__, __failed__, __expected__ to False
 # initially.  If the test errored/failed, the session info


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