[Lldb-commits] [PATCH] D21064: [LLDB][MIPS] Fix Emulation of Compact branch and ADDIU instructions

2016-06-07 Thread Nitesh Jain via lldb-commits
nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, bhushan, jaydeep.
nitesh.jain added subscribers: slthakur, mohit.bhakkad, lldb-commits.
nitesh.jain set the repository for this revision to rL LLVM.
Herald added subscribers: sdardis, dsanders.

This patch contains 2 changes:
1. Corrected target address calculation of compact branch instructions to 
reflect changes in disassembler (http://reviews.llvm.org/D17540).
2. Added emulation for (missing) 'Addiu' instruction.

Repository:
  rL LLVM

http://reviews.llvm.org/D21064

Files:
  source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp

Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
===
--- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
+++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
@@ -483,6 +483,7 @@
 // Prologue/Epilogue instructions
 //--
 { "DADDiu", &EmulateInstructionMIPS64::Emulate_DADDiu,  "DADDIU rt,rs,immediate"},
+{ "ADDiu",  &EmulateInstructionMIPS64::Emulate_DADDiu,  "ADDIU rt,rs,immediate" },
 { "SD", &EmulateInstructionMIPS64::Emulate_SD,  "SD rt,offset(rs)"  },
 { "LD", &EmulateInstructionMIPS64::Emulate_LD,  "LD rt,offset(base)"},
 
@@ -1066,7 +1067,7 @@
 if (!success)
 return false;
 
-target = pc + 4 + offset;
+target = pc + offset;
 
 Context context;
 
@@ -1240,7 +1241,7 @@
 if (!success)
 return false;
 
-target = pc + 4 + offset;
+target = pc + offset;
 
 Context context;
 
@@ -1289,56 +1290,56 @@
 if (!strcasecmp (op_name, "BEQC"))
 {
 if (rs_val == rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BNEC"))
 {
 if (rs_val != rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BLTC"))
 {
 if (rs_val < rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BGEC"))
 {
 if (rs_val >= rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BLTUC"))
 {
 if (rs_val < rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BGEUC"))
 {
 if ((uint32_t)rs_val >= (uint32_t)rt_val)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BOVC"))
 {
 if (IsAdd64bitOverflow (rs_val, rt_val))
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BNVC"))
 {
 if (!IsAdd64bitOverflow (rs_val, rt_val))
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
@@ -1381,42 +1382,42 @@
 if (!strcasecmp (op_name, "BLTZC"))
 {
 if (rs_val < 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BLEZC"))
 {
 if (rs_val <= 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BGEZC"))
 {
 if (rs_val >= 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BGTZC"))
 {
 if (rs_val > 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BEQZC"))
 {
 if (rs_val == 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
 else if (!strcasecmp (op_name, "BNEZC"))
 {
 if (rs_val != 0)
-target = pc + 4 + offset;
+target = pc + offset;
 else
 target = pc + 4;
 }
Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
===
--- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp

[Lldb-commits] [lldb] r272024 - Make lldbinline.py regenerate the Makefile each time it builds.

2016-06-07 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Tue Jun  7 12:22:18 2016
New Revision: 272024

URL: http://llvm.org/viewvc/llvm-project?rev=272024&view=rev
Log:
Make lldbinline.py regenerate the Makefile each time it builds.

If a lldbinline test's source file changed language, then the Makefile wasn't
updated.  This was a problem if the Makefile was checked into the repository.

Now lldbinline.py always regenerates the Makefile and asserts if the
newly-generated version is not the same as the one already there.  This ensures
that the repository will never be out of date without a buildbot failing.

http://reviews.llvm.org/D21032

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/extern_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile?rev=272024&r1=272023&r2=272024&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
 Tue Jun  7 12:22:18 2016
@@ -1,12 +1,13 @@
 LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD 
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
 ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
+CFLAGS_EXTRAS += -fno-limit-debug-info
 endif
 
 include $(LEVEL)/Makefile.rules
+
+
+cleanup:
+   rm -f Makefile *.d
+

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile?rev=272024&r1=272023&r2=272024&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
 Tue Jun  7 12:22:18 2016
@@ -1,4 +1,13 @@
 LEVEL = ../../../make
 OBJC_SOURCES := main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+ifneq (,$(findstring clang,$(CC)))
+CFLAGS_EXTRAS += -fno-limit-debug-info
+endif
+
 include $(LEVEL)/Makefile.rules
-LDFLAGS += -framework Foundation
+
+
+cleanup:
+   rm -f Makefile *.d
+

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile?rev=272024&r1=272023&r2=272024&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
 Tue Jun  7 12:22:18 2016
@@ -1,12 +1,13 @@
 LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD 
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
 ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
+CFLAGS_EXTRAS += -fno-limit-debug-info
 endif
 
 include $(LEVEL)/Makefile.rules
+
+
+cleanup:
+   rm -f Makefile *.d
+

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile?rev=272024&r1=272023&r2=272024&view=diff
==
--- 
lldb/trunk/packages/

[Lldb-commits] [PATCH] D21088: Don't use SO_REUSEADDR for *client* sockets

2016-06-07 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added a subscriber: lldb-commits.
Herald added subscribers: danalbert, tberghammer.

In the case of client sockets, we are not binding to a specific port, so we
should be able to just request a new one. Disregarding refactors, this code
has been here since the initial LLDB checkin, so I was unable to figure out
whether it was added as a fix for a specific problem, or just for symmetry
with server sockets, but I see no side-effect from removing it now. I was
still able to create 1 connections within a couple of seconds, so I think
it's unlikely we will exhaust the port space (previously, I would get an
error after a couple thousand connections).

This fixes an occasional issue with connecting to the android debug bridge
deamon on OSX when running the test suite, which would occasionaly fail with
EADDRINUSE. My best guess is that this was happening because two processes
were assigned the same client port number, and then things blew up because
they were both trying to connect to the same ADB server port. I have not
observed this issue happening on Linux or Windows.

http://reviews.llvm.org/D21088

Files:
  source/Host/common/TCPSocket.cpp

Index: source/Host/common/TCPSocket.cpp
===
--- source/Host/common/TCPSocket.cpp
+++ source/Host/common/TCPSocket.cpp
@@ -112,9 +112,6 @@
 if (!DecodeHostAndPort (name, host_str, port_str, port, &error))
 return error;
 
-// Enable local address reuse
-SetOptionReuseAddress();
-
 struct sockaddr_in sa;
 ::memset (&sa, 0, sizeof (sa));
 sa.sin_family = kDomain;


Index: source/Host/common/TCPSocket.cpp
===
--- source/Host/common/TCPSocket.cpp
+++ source/Host/common/TCPSocket.cpp
@@ -112,9 +112,6 @@
 if (!DecodeHostAndPort (name, host_str, port_str, port, &error))
 return error;
 
-// Enable local address reuse
-SetOptionReuseAddress();
-
 struct sockaddr_in sa;
 ::memset (&sa, 0, sizeof (sa));
 sa.sin_family = kDomain;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r272036 - LLDB is leaking memory in Editline.cpp on MacOSX.

2016-06-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Jun  7 13:16:39 2016
New Revision: 272036

URL: http://llvm.org/viewvc/llvm-project?rev=272036&view=rev
Log:
LLDB is leaking memory in Editline.cpp on MacOSX. 

When USE_SETUPTERM_WORKAROUND is enabled, we were calling setupterm() multiple 
times and leaking memory on each subsequent call. This is now fixed by calling 
setupterm() once in the constructor and tracking if we have already setup a 
terminal for a file descriptor.

Calls to "el_set (m_editline, EL_ADDFN, ..." were leaking memory. If we switch 
over to call el_wset with wide strings when LLDB_EDITLINE_USE_WCHAR is set, 
then we no longer leak memory each time we construct a new Editline object.

The calls to "el_set (m_editline, EL_ADDFN, ..." were changed over to call 
"el_wset (m_editline, EL_ADDFN, ...". Note that when LLDB_EDITLINE_USE_WCHAR is 
not defined, then el_wset is #define'ed to el_set. All strings are wrapped in 
EditLineConstString which will use wide strings when needed, and normal C 
strings when LLDB_EDITLINE_USE_WCHAR is not defined.



Modified:
lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=272036&r1=272035&r2=272036&view=diff
==
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Tue Jun  7 13:16:39 2016
@@ -1074,36 +1074,34 @@ Editline::ConfigureEditor (bool multilin
 }));
 
 // Commands used for multiline support, registered whether or not they're 
used
-el_set (m_editline, EL_ADDFN, "lldb-break-line", "Insert a line break",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor (editline)->BreakLineCommand (ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-delete-next-char", "Delete next 
character",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor (editline)->DeleteNextCharCommand 
(ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-delete-previous-char", "Delete 
previous character",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor 
(editline)->DeletePreviousCharCommand (ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-previous-line", "Move to previous 
line",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor (editline)->PreviousLineCommand 
(ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-next-line", "Move to next line",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor (editline)->NextLineCommand (ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-buffer-start", "Move to start of 
buffer",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-   return Editline::InstanceFor (editline)->BufferStartCommand 
(ch);
-   }));
-el_set (m_editline, EL_ADDFN, "lldb-buffer-end", "Move to end of buffer",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
-return Editline::InstanceFor (editline)->BufferEndCommand (ch);
+el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-break-line"), 
EditLineConstString("Insert a line break"),
+(EditlineCommandCallbackType)(
+[](EditLine *editline, int ch) { return 
Editline::InstanceFor(editline)->BreakLineCommand(ch); }));
+el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-delete-next-char"),
+EditLineConstString("Delete next character"), 
(EditlineCommandCallbackType)([](EditLine *editline, int ch) {
+return 
Editline::InstanceFor(editline)->DeleteNextCharCommand(ch);
 }));
-el_set (m_editline, EL_ADDFN, "lldb-fix-indentation", "Fix line 
indentation",
-   (EditlineCommandCallbackType)([] (EditLine * editline, int ch) {
+el_wset(m_editline, EL_ADDFN, 
EditLineConstString("lldb-delete-previous-char"),
+EditLineConstString("Delete previous character"),
+(EditlineCommandCallbackType)([](EditLine *editline, int ch) {
+return 
Editline::InstanceFor(editline)->DeletePreviousCharCommand(ch);
+}));
+el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-previous-line"),
+EditLineConstString("Move to previous line"), 
(EditlineCommandCallbackType)([](EditLine *editline, int ch) {
+return 
Editline::InstanceFor(editline)->PreviousLineCommand(ch);
+}));
+el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-next-line"), 
EditLineConstString("Move to next line"),
+(Edit

Re: [Lldb-commits] [PATCH] D21088: Don't use SO_REUSEADDR for *client* sockets

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

I am fine with this as long as all test suites on all systems pass.


http://reviews.llvm.org/D21088



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


[Lldb-commits] [lldb] r272041 - Don't use SO_REUSEADDR for *client* sockets

2016-06-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jun  7 13:36:38 2016
New Revision: 272041

URL: http://llvm.org/viewvc/llvm-project?rev=272041&view=rev
Log:
Don't use SO_REUSEADDR for *client* sockets

Summary:
In the case of client sockets, we are not binding to a specific port, so we
should be able to just request a new one. Disregarding refactors, this code
has been here since the initial LLDB checkin, so I was unable to figure out
whether it was added as a fix for a specific problem, or just for symmetry
with server sockets, but I see no side-effect from removing it now. I was
still able to create 1 connections within a couple of seconds, so I think
it's unlikely we will exhaust the port space (previously, I would get an
error after a couple thousand connections).

This fixes an occasional issue with connecting to the android debug bridge
deamon on OSX when running the test suite, which would occasionaly fail with
EADDRINUSE. My best guess is that this was happening because two processes
were assigned the same client port number, and then things blew up because
they were both trying to connect to the same ADB server port. I have not
observed this issue happening on Linux or Windows.

Reviewers: clayborg

Subscribers: tberghammer, danalbert, lldb-commits

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

Modified:
lldb/trunk/source/Host/common/TCPSocket.cpp

Modified: lldb/trunk/source/Host/common/TCPSocket.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TCPSocket.cpp?rev=272041&r1=272040&r2=272041&view=diff
==
--- lldb/trunk/source/Host/common/TCPSocket.cpp (original)
+++ lldb/trunk/source/Host/common/TCPSocket.cpp Tue Jun  7 13:36:38 2016
@@ -112,9 +112,6 @@ TCPSocket::Connect(llvm::StringRef name)
 if (!DecodeHostAndPort (name, host_str, port_str, port, &error))
 return error;
 
-// Enable local address reuse
-SetOptionReuseAddress();
-
 struct sockaddr_in sa;
 ::memset (&sa, 0, sizeof (sa));
 sa.sin_family = kDomain;


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


Re: [Lldb-commits] [PATCH] D21088: Don't use SO_REUSEADDR for *client* sockets

2016-06-07 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272041: Don't use SO_REUSEADDR for *client* sockets 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D21088?vs=59916&id=59922#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21088

Files:
  lldb/trunk/source/Host/common/TCPSocket.cpp

Index: lldb/trunk/source/Host/common/TCPSocket.cpp
===
--- lldb/trunk/source/Host/common/TCPSocket.cpp
+++ lldb/trunk/source/Host/common/TCPSocket.cpp
@@ -112,9 +112,6 @@
 if (!DecodeHostAndPort (name, host_str, port_str, port, &error))
 return error;
 
-// Enable local address reuse
-SetOptionReuseAddress();
-
 struct sockaddr_in sa;
 ::memset (&sa, 0, sizeof (sa));
 sa.sin_family = kDomain;


Index: lldb/trunk/source/Host/common/TCPSocket.cpp
===
--- lldb/trunk/source/Host/common/TCPSocket.cpp
+++ lldb/trunk/source/Host/common/TCPSocket.cpp
@@ -112,9 +112,6 @@
 if (!DecodeHostAndPort (name, host_str, port_str, port, &error))
 return error;
 
-// Enable local address reuse
-SetOptionReuseAddress();
-
 struct sockaddr_in sa;
 ::memset (&sa, 0, sizeof (sa));
 sa.sin_family = kDomain;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r272062 - Revert "Make lldbinline.py regenerate the Makefile each time it builds."

2016-06-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Jun  7 16:29:46 2016
New Revision: 272062

URL: http://llvm.org/viewvc/llvm-project?rev=272062&view=rev
Log:
Revert "Make lldbinline.py regenerate the Makefile each time it builds."

This reverts commit r272024 as it is not windows-compatible.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/extern_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_const_addrof/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile?rev=272062&r1=272061&r2=272062&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
 Tue Jun  7 16:29:46 2016
@@ -1,13 +1,12 @@
 LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
+
+# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD 
+# targets.  Other targets do not, which causes this test to fail.
+# This flag enables FullDebugInfo for all targets.
 ifneq (,$(findstring clang,$(CC)))
-CFLAGS_EXTRAS += -fno-limit-debug-info
+  CFLAGS_EXTRAS += -fno-limit-debug-info
 endif
 
 include $(LEVEL)/Makefile.rules
-
-
-cleanup:
-   rm -f Makefile *.d
-

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile?rev=272062&r1=272061&r2=272062&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/Makefile
 Tue Jun  7 16:29:46 2016
@@ -1,13 +1,4 @@
 LEVEL = ../../../make
 OBJC_SOURCES := main.m
-LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
-ifneq (,$(findstring clang,$(CC)))
-CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
 include $(LEVEL)/Makefile.rules
-
-
-cleanup:
-   rm -f Makefile *.d
-
+LDFLAGS += -framework Foundation

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile?rev=272062&r1=272061&r2=272062&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
 Tue Jun  7 16:29:46 2016
@@ -1,13 +1,12 @@
 LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
+
+# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD 
+# targets.  Other targets do not, which causes this test to fail.
+# This flag enables FullDebugInfo for all targets.
 ifneq (,$(findstring clang,$(CC)))
-CFLAGS_EXTRAS += -fno-limit-debug-info
+  CFLAGS_EXTRAS += -fno-limit-debug-info
 endif
 
 include $(LEVEL)/Makefile.rules
-
-
-cleanup:
-   rm -f Makefile *.d
-

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile?rev=272062&r1=272061&r2=272062&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/Makefile
 Tue Jun  7 16:29:46 2016
@@ -1,13 +1,4 @@
 LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 CXXFLAGS += -std=c++11
-ifneq (,$(findstring clang,$(CC)))
- 

Re: [Lldb-commits] [PATCH] D21032: Eliminate differences in lldbinline-generated Makefiles and ensure they're regenerated every time

2016-06-07 Thread Pavel Labath via lldb-commits
labath added subscribers: zturner, labath.
labath added a comment.

Hi, I have reverted this commit, as it makes a number of assumptions, which are 
not true on windows. Please see comments for details.

If you need help testing out a revised version on windows, let me know. I think 
Zachary will be able to help with that as well (:P).



Comment at: packages/Python/lldbsuite/test/lldbinline.py:135
@@ +134,3 @@
+if os.path.exists("Makefile"):
+if not filecmp.cmp("Makefile", "Makefile.tmp"):
+sys.exit("Existing Makefile doesn't match generated Makefile!")

This files will not end up being identical, due to different path separators 
and newlines when this is being run on windows.

I like the idea of diffing, but it needs to be done in a way that it will work 
on windows.


Comment at: packages/Python/lldbsuite/test/lldbinline.py:136
@@ +135,3 @@
+if not filecmp.cmp("Makefile", "Makefile.tmp"):
+sys.exit("Existing Makefile doesn't match generated Makefile!")
+

This will not cause the error to be reported in the test runner. See 

 where, this code is triggered, but the test is still not marked as failed in 
the summary at the end. I think throwing an exception here would do the 
expected thing.


Comment at: packages/Python/lldbsuite/test/lldbinline.py:138
@@ +137,3 @@
+
+os.rename("Makefile.tmp", "Makefile")
+

Windows does not support in-place renames, so this will just fail.


Repository:
  rL LLVM

http://reviews.llvm.org/D21032



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


Re: [Lldb-commits] [PATCH] D21032: Eliminate differences in lldbinline-generated Makefiles and ensure they're regenerated every time

2016-06-07 Thread Zachary Turner via lldb-commits
zturner added a comment.

For the diffing issue seems like we should be able to generate makefiles
with stable separators. I haven't seen the generation code, but it seems
like we could write a function lldbsuite.support.fs.unixpath() that works
like normpath but always uses /, never \. Would that fix it?

When you say it doesn't support in place renames, the only issue I'm aware
of is that you can't use os.rename if the destination already exists. As
such, you also can't implement atomic rename. As long as that isn't
required, you should be able to unlink first, then rename. I thought we had
a function in lldbsuite.support.fs that does this, but I can't remember


Repository:
  rL LLVM

http://reviews.llvm.org/D21032



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


Re: [Lldb-commits] [PATCH] D21032: Eliminate differences in lldbinline-generated Makefiles and ensure they're regenerated every time

2016-06-07 Thread Zachary Turner via lldb-commits
For the diffing issue seems like we should be able to generate makefiles
with stable separators. I haven't seen the generation code, but it seems
like we could write a function lldbsuite.support.fs.unixpath() that works
like normpath but always uses /, never \. Would that fix it?

When you say it doesn't support in place renames, the only issue I'm aware
of is that you can't use os.rename if the destination already exists. As
such, you also can't implement atomic rename. As long as that isn't
required, you should be able to unlink first, then rename. I thought we had
a function in lldbsuite.support.fs that does this, but I can't remember
On Tue, Jun 7, 2016 at 2:48 PM Pavel Labath  wrote:

> labath added subscribers: zturner, labath.
> labath added a comment.
>
> Hi, I have reverted this commit, as it makes a number of assumptions,
> which are not true on windows. Please see comments for details.
>
> If you need help testing out a revised version on windows, let me know. I
> think Zachary will be able to help with that as well (:P).
>
>
> 
> Comment at: packages/Python/lldbsuite/test/lldbinline.py:135
> @@ +134,3 @@
> +if os.path.exists("Makefile"):
> +if not filecmp.cmp("Makefile", "Makefile.tmp"):
> +sys.exit("Existing Makefile doesn't match generated
> Makefile!")
> 
> This files will not end up being identical, due to different path
> separators and newlines when this is being run on windows.
>
> I like the idea of diffing, but it needs to be done in a way that it will
> work on windows.
>
> 
> Comment at: packages/Python/lldbsuite/test/lldbinline.py:136
> @@ +135,3 @@
> +if not filecmp.cmp("Makefile", "Makefile.tmp"):
> +sys.exit("Existing Makefile doesn't match generated
> Makefile!")
> +
> 
> This will not cause the error to be reported in the test runner. See <
> http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/6268/steps/test1/logs/stdio>
> where, this code is triggered, but the test is still not marked as failed
> in the summary at the end. I think throwing an exception here would do the
> expected thing.
>
> 
> Comment at: packages/Python/lldbsuite/test/lldbinline.py:138
> @@ +137,3 @@
> +
> +os.rename("Makefile.tmp", "Makefile")
> +
> 
> Windows does not support in-place renames, so this will just fail.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D21032
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r272069 - Fix a memory leak in InstructionLLVMC where it held onto a strong reference to the DisassemblerLLVMC which in turn had a vector of InstructionSP causing the strong cycl

2016-06-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Jun  7 17:56:40 2016
New Revision: 272069

URL: http://llvm.org/viewvc/llvm-project?rev=272069&view=rev
Log:
Fix a memory leak in InstructionLLVMC where it held onto a strong reference to 
the DisassemblerLLVMC which in turn had a vector of InstructionSP causing the 
strong cycle. This is fixed now.

Rules are as follows for internal code using lldb::DisassemblerSP and 
lldb::InstructionSP:
1 - The disassembler needs to stay around as long as instructions do as the 
Instruction subclass now has a weak pointer to the disassembler
2 - The public API has been fixed so that if you get a SBInstruction, it will 
hold onto a strong reference to the disassembler in a new InstructionImpl class

This will keep code like like: 

inst = lldb.target.ReadInstructions(frame.GetPCAddress(), 
1).GetInstructionAtIndex(0)
inst.GetMnemonic()

Working as expected (not the SBInstructionList() that was returned by 
SBTarget.ReadInstructions() is gone, but "inst" has a strong reference inside 
of it to the disassembler and the instruction.
 
All code inside the LLDB shared library was verified to correctly hold onto the 
disassembler instance in all places.




Modified:
lldb/trunk/include/lldb/API/SBInstruction.h
lldb/trunk/source/API/SBInstruction.cpp
lldb/trunk/source/API/SBInstructionList.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

Modified: lldb/trunk/include/lldb/API/SBInstruction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=272069&r1=272068&r2=272069&view=diff
==
--- lldb/trunk/include/lldb/API/SBInstruction.h (original)
+++ lldb/trunk/include/lldb/API/SBInstruction.h Tue Jun  7 17:56:40 2016
@@ -18,6 +18,8 @@
 // There's a lot to be fixed here, but need to wait for underlying insn 
implementation
 // to be revised & settle down first.
 
+class InstructionImpl;
+
 namespace lldb {
 
 class LLDB_API SBInstruction
@@ -81,14 +83,17 @@ public:
 protected:
 friend class SBInstructionList;
 
-SBInstruction (const lldb::InstructionSP &inst_sp);
+SBInstruction(const lldb::DisassemblerSP &disasm_sp, const 
lldb::InstructionSP &inst_sp);
 
 void
-SetOpaque (const lldb::InstructionSP &inst_sp);
+SetOpaque(const lldb::DisassemblerSP &disasm_sp, const 
lldb::InstructionSP& inst_sp);
+
+lldb::InstructionSP
+GetOpaque();
 
 private:
 
-lldb::InstructionSP  m_opaque_sp;
+std::shared_ptr m_opaque_sp;
 };
 
 

Modified: lldb/trunk/source/API/SBInstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=272069&r1=272068&r2=272069&view=diff
==
--- lldb/trunk/source/API/SBInstruction.cpp (original)
+++ lldb/trunk/source/API/SBInstruction.cpp Tue Jun  7 17:56:40 2016
@@ -26,15 +26,63 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 
+//--
+// We recently fixed a leak in one of the Instruction subclasses where
+// the instruction will only hold a weak reference to the disassembler
+// to avoid a cycle that was keeping both objects alive (leak) and we
+// need the InstructionImpl class to make sure our public API behaves
+// as users would expect. Calls in our public API allow clients to do
+// things like:
+//
+// 1  lldb::SBInstruction inst;
+// 2  inst = target.ReadInstructions(pc, 1).GetInstructionAtIndex(0)
+// 3  if (inst.DoesBranch())
+// 4  ...
+//
+// There was a temporary lldb::DisassemblerSP object created in the
+// SBInstructionList that was returned by lldb.target.ReadInstructions()
+// that will go away after line 2 but the "inst" object should be able
+// to still answer questions about itself. So we make sure that any
+// SBInstruction objects that are given out have a strong reference to
+// the disassembler and the instruction so that the object can live and
+// successfully respond to all queries.
+//--
+class InstructionImpl
+{
+public:
+InstructionImpl (const lldb::DisassemblerSP &disasm_sp, const 
lldb::InstructionSP& inst_sp) :
+m_disasm_sp(disasm_sp),
+m_inst_sp(inst_sp)
+{
+}
+
+lldb::InstructionSP
+GetSP() const
+{
+return m_inst_sp;
+}
+
+bool
+IsValid() const
+{
+return (bool)m_inst_sp;
+}
+
+protected:
+lldb::DisassemblerSP m_disasm_sp; // Can be empty/invalid
+lldb::InstructionSP m_inst_sp;
+};
+
 using namespace lldb;
 using namespace lldb_private;
 
-SBInstruction::SBInstruction ()
+SBInstruction::SBInstruction() :
+m_opaque_sp()
 {
 }
 
-SBInstruction::SBInstruction (const lldb::InstructionSP& inst_sp) :
-m_opaque_sp (inst_sp)
+SBInstruction::SBInstruction(const lldb::D

[Lldb-commits] [lldb] r272071 - Now that there are no cycles that cause leaks in the disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue.

2016-06-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Jun  7 18:19:00 2016
New Revision: 272071

URL: http://llvm.org/viewvc/llvm-project?rev=272071&view=rev
Log:
Now that there are no cycles that cause leaks in the disassembler/instruction 
classes, we can get rid of the FIXME lines that were working around this issue.




Modified:
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Expression/IRExecutionUnit.cpp

lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=272071&r1=272070&r2=272071&view=diff
==
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jun  7 18:19:00 2016
@@ -1475,10 +1475,6 @@ DataExtractor::Dump (Stream *s,
 ExecutionContext exe_ctx;
 exe_scope->CalculateExecutionContext(exe_ctx);
 disassembler_sp->GetInstructionList().Dump (s,  
show_address, show_bytes, &exe_ctx);
-
-// FIXME: The DisassemblerLLVMC has a reference cycle and 
won't go away if it has any active instructions.
-// I'll fix that but for now, just clear the list and it 
will go away nicely.
-disassembler_sp->GetInstructionList().Clear();
 }
 }
 }

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=272071&r1=272070&r2=272071&view=diff
==
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Jun  7 18:19:00 2016
@@ -302,19 +302,8 @@ Disassembler::Disassemble(Debugger &debu
 if (bytes_disassembled == 0)
 return false;
 
-bool result = PrintInstructions (disasm_sp.get(),
- debugger,
- arch,
- exe_ctx,
- num_instructions,
- num_mixed_context_lines,
- options,
- strm);
-
-// FIXME: The DisassemblerLLVMC has a reference cycle and won't go 
away if it has any active instructions.
-// I'll fix that but for now, just clear the list and it will go 
away nicely.
-disasm_sp->GetInstructionList().Clear();
-return result;
+return PrintInstructions(disasm_sp.get(), debugger, arch, exe_ctx, 
num_instructions,
+ num_mixed_context_lines, options, strm);
 }
 }
 return false;
@@ -349,33 +338,17 @@ Disassembler::Disassemble(Debugger &debu
   
prefer_file_cache);
 if (bytes_disassembled == 0)
 return false;
-bool result = PrintInstructions (disasm_sp.get(),
- debugger,
- arch,
- exe_ctx,
- num_instructions,
- num_mixed_context_lines,
- options,
- strm);
-
-// FIXME: The DisassemblerLLVMC has a reference cycle and won't go 
away if it has any active instructions.
-// I'll fix that but for now, just clear the list and it will go 
away nicely.
-disasm_sp->GetInstructionList().Clear();
-return result;
+return PrintInstructions(disasm_sp.get(), debugger, arch, exe_ctx, 
num_instructions,
+ num_mixed_context_lines, options, strm);
 }
 }
 return false;
 }
-
-bool 
-Disassembler::PrintInstructions(Disassembler *disasm_ptr,
-Debugger &debugger,
-const ArchSpec &arch,
-const ExecutionContext &exe_ctx,
-uint32_t num_instructions,
-uint32_t num_mixed_context_lines,
-uint32_t options,
-Stream &strm)
+
+bool
+Disassembler::PrintInstructions(Disassembler *disasm_ptr, Debugger &debugger, 
const ArchSpec &arch,
+   

[Lldb-commits] [lldb] r272087 - Revive the error message from "process load" and SBProcess::LoadImage.

2016-06-07 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue Jun  7 20:29:21 2016
New Revision: 272087

URL: http://llvm.org/viewvc/llvm-project?rev=272087&view=rev
Log:
Revive the error message from "process load" and SBProcess::LoadImage.

IsPointedCString has problems with ValueObjects of type eTypeHostAddress.  We 
should
figure out the right thing to do in that case, but the test is silly here 
because we're
reading a type we've defined, so we know it is a const char *, and if the 
memory is good, 
we won't be able to read any characters, when we do ReadPointedString.



Modified:
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=272087&r1=272086&r2=272087&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Tue Jun  7 
20:29:21 2016
@@ -943,7 +943,7 @@ PlatformPOSIX::DoLoadImage(lldb_private:
 if (image_ptr == 0)
 {
 ValueObjectSP error_str_sp = result_valobj_sp->GetChildAtIndex(1, 
true);
-if (error_str_sp && error_str_sp->IsCStringContainer(true))
+if (error_str_sp)
 {
 DataBufferSP buffer_sp(new DataBufferHeap(10240,0));
 size_t num_chars = error_str_sp->ReadPointedString (buffer_sp, 
error, 10240).first;


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