Re: [Lldb-commits] [PATCH] D15241: Simplify TestThreadSpecificBreakpoint.py

2015-12-07 Thread Pavel Labath via lldb-commits
labath added a comment.

In http://reviews.llvm.org/D15241#302942, @zturner wrote:

> I don't have any examples, one of the linux guys might.  But you can look at 
> the decorators at the top, which say this:
>
>   @skipIfFreeBSD # test frequently times out or hangs
>   @expectedFailureFreeBSD('llvm.org/pr18522') # hits break in another thread 
> in testrun
>   @expectedFlakeyLinux # this test fails 6/100 dosep runs
>   
>
> So the only platform it seems to be robust on is OSX, for whatever reason.  
> Sadly I don't have any more info than that though.


I've been going through the flaky tests on linux, but I haven't reached this 
one yet, so unfortunately can't provide more information. It is marked flaky, 
but I
 haven't seen it fail lately, so it must be running pretty well on linux (it 
has to fail twice it a row to be considered a failure in the flaky mode).

I don't think timeouts are affecting this test (as the flaky logic does not 
help there), but I can certainly see how extra load might trigger some corner 
cases.

I'd also be in favor of keeping this test, and I am planning to re-audit all 
the flaky decorators on linux, time permitting.


http://reviews.llvm.org/D15241



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


[Lldb-commits] [PATCH] D15273: [LLDB][MIPS] Handle PIC calling convention for MIPS32

2015-12-07 Thread Bhushan Attarde via lldb-commits
bhushan created this revision.
bhushan added a reviewer: clayborg.
bhushan added subscribers: lldb-commits, nitesh.jain, sagar, mohit.bhakkad, 
jaydeep.
bhushan set the repository for this revision to rL LLVM.

This patch includes:

1. PrepareTrivialCall() to setup register r25 with the address of function to 
be called.
   This is needed because the PIC calling convention for MIPS requires that on 
entry to 
   a function, the r25 (t9) register holds the address of the function’s entry 
point.
   
2. RegisterIsCalleeSaved() to use name of a register instead of its byte_offset.


Repository:
  rL LLVM

http://reviews.llvm.org/D15273

Files:
  source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp

Index: source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
===
--- source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -241,6 +241,7 @@
 const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
 const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
 
 if (log)
 log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
@@ -262,7 +263,14 @@
 // Set pc to the address of the called function.
 if (!reg_ctx->WriteRegisterFromUnsigned (pc_reg_info, func_addr))
 return false;
-
+
+if (log)
+log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+
+// All callers of position independent functions must place the address of 
the called function in t9 (r25)
+if (!reg_ctx->WriteRegisterFromUnsigned (r25_info, func_addr))
+return false;
+  
 return true;
 }
 
@@ -546,13 +554,36 @@
 {
 // Preserved registers are :
 // r16-r23, r28, r29, r30, r31
+const char *name = reg_info->name;
 
-int reg = ((reg_info->byte_offset) / 4);
-
-bool save  = (reg >= 16) && (reg <= 23);
- save |= (reg >= 28) && (reg <= 31);
+if (name[0] == 'r')
+{
+switch (name[1])
+{
+case '1': 
+if (name[2] == '6' || name[2] == '7' || name[2] == '8' || 
name[2] == '9') // r16-r19
+return name[3] == '\0';
+break;
+case '2': 
+if (name[2] == '0' || name[2] == '1' || name[2] == '2' || 
name[2] == '3'  // r20-r23
+|| name[2] == '8' || name[2] == '9')   
   // r28 and r29
+return name[3] == '\0';
+break;
+case '3': 
+if (name[2] == '0' || name[2] == '1')   // r30 and r31
+return name[3] == '\0';
+break;
+}
 
-return save;
+if (name[0] == 'g' && name[1] == 'p' && name[2] == '\0')   // gp 
(r28)
+return true;
+if (name[0] == 's' && name[1] == 'p' && name[2] == '\0')   // sp 
(r29)
+return true;
+if (name[0] == 'f' && name[1] == 'p' && name[2] == '\0')   // fp 
(r30)
+return true;
+if (name[0] == 'r' && name[1] == 'a' && name[2] == '\0')   // ra 
(r31)
+return true;
+}
 }
 return false;
 }


Index: source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
===
--- source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -241,6 +241,7 @@
 const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
 const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
 
 if (log)
 log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
@@ -262,7 +263,14 @@
 // Set pc to the address of the called function.
 if (!reg_ctx->WriteRegisterFromUnsigned (pc_reg_info, func_addr))
 return false;
-
+
+if (log)
+log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+
+// All callers of position independent functions must place the address of the called function in t9 (r25)
+if (!reg_ctx->WriteRegisterFromUnsigned (r25_info, func_addr))
+return false;
+  
 return true;
 }
 
@@ -546,13 +554,36 @@
 {
 // Preserved registers are :
 // r16-r23, r28, r29, r30, r31
+const char *name = reg_info->name;
 
-int reg = ((reg_info->byte_offset) / 4);
-
-

Re: [Lldb-commits] [PATCH] D13970: Add support for abstract domain sockets.

2015-12-07 Thread Pavel Labath via lldb-commits
labath closed this revision.
labath added a comment.

I believe this has landed a while back.


http://reviews.llvm.org/D13970



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


Re: [Lldb-commits] [PATCH] D15233: Make TestThreadStates more stable

2015-12-07 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254901: Make TestThreadStates more stable (authored by 
labath).

Changed prior to commit:
  http://reviews.llvm.org/D15233?vs=41885&id=42044#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15233

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
@@ -36,10 +36,11 @@
 @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
 @expectedFailureDarwin('llvm.org/pr23669')
 @expectedFailureWindows("llvm.org/pr24660")
+@unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
 def test_state_after_expression(self):
 """Test thread state after expression."""
 self.build(dictionary=self.getBuildFlags(use_cpp11=False))
-self.thread_state_after_continue_test()
+self.thread_state_after_expression_test()
 
 @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
 @expectedFailureWindows("llvm.org/pr24668") # Breakpoints not resolved correctly
@@ -70,10 +71,6 @@
 # This should create a breakpoint in the main thread.
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoint with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -102,6 +99,12 @@
 # Kill the process
 self.runCmd("process kill")
 
+def wait_for_running_event(self):
+listener = self.dbg.GetListener()
+if lldb.remote_platform:
+lldbutil.expect_state_changes(self, listener, [lldb.eStateConnected])
+lldbutil.expect_state_changes(self, listener, [lldb.eStateRunning])
+
 def thread_state_after_continue_test(self):
 """Test thread state after continue."""
 exe = os.path.join(os.getcwd(), "a.out")
@@ -111,10 +114,6 @@
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -139,7 +138,7 @@
 # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
 self.dbg.SetAsync(True)
 self.runCmd("continue")
-time.sleep(1)
+self.wait_for_running_event()
 
 # Check the thread state. It should be running.
 self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.")
@@ -160,10 +159,6 @@
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -204,10 +199,6 @@
 # This should create a breakpoint in the main thread.
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -229,7 +220,7 @@
 # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
 self.dbg.SetAsync(True)
 self.runCmd("continue")
-time.sleep(1)
+self.wait_for_running_event()
 
 # Go back to synchronous interactions
 self.dbg.SetAsync(False)
@@ -258,11 +249,6 @@
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expecte

[Lldb-commits] [lldb] r254901 - Make TestThreadStates more stable

2015-12-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  7 05:09:14 2015
New Revision: 254901

URL: http://llvm.org/viewvc/llvm-project?rev=254901&view=rev
Log:
Make TestThreadStates more stable

Summary:
Because of the large number of XFAILs TestThreadStates has decayed quite a bit. 
This commit does
the following:
- removes the "breakpoint list" expectations. Most tests have been failing on 
this, because the
  command output changed quite a while back. I remove it, because 
run_break_set_by_file_and_line
  already does a decent amount of checking
- fixup test_state_after_expression: this was calling the wrong function by 
mistake. As now the
  function actually tests something (which we know is broken), I needed to 
XFAIL it as well.
- replaces the sleep() with a proper wait-for-event functionality in parts 
which use async mode,
  to stabilize the one function that actually tests something.

Reviewers: clayborg

Subscribers: lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py?rev=254901&r1=254900&r2=254901&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
 Mon Dec  7 05:09:14 2015
@@ -36,10 +36,11 @@ class ThreadStateTestCase(TestBase):
 @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
 @expectedFailureDarwin('llvm.org/pr23669')
 @expectedFailureWindows("llvm.org/pr24660")
+@unittest2.expectedFailure("llvm.org/pr16712") # thread states not 
properly maintained
 def test_state_after_expression(self):
 """Test thread state after expression."""
 self.build(dictionary=self.getBuildFlags(use_cpp11=False))
-self.thread_state_after_continue_test()
+self.thread_state_after_expression_test()
 
 @unittest2.expectedFailure("llvm.org/pr16712") # thread states not 
properly maintained
 @expectedFailureWindows("llvm.org/pr24668") # Breakpoints not resolved 
correctly
@@ -70,10 +71,6 @@ class ThreadStateTestCase(TestBase):
 # This should create a breakpoint in the main thread.
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", 
self.break_1, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoint with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown 
correctly",
-substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % 
self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -102,6 +99,12 @@ class ThreadStateTestCase(TestBase):
 # Kill the process
 self.runCmd("process kill")
 
+def wait_for_running_event(self):
+listener = self.dbg.GetListener()
+if lldb.remote_platform:
+lldbutil.expect_state_changes(self, listener, 
[lldb.eStateConnected])
+lldbutil.expect_state_changes(self, listener, [lldb.eStateRunning])
+
 def thread_state_after_continue_test(self):
 """Test thread state after continue."""
 exe = os.path.join(os.getcwd(), "a.out")
@@ -111,10 +114,6 @@ class ThreadStateTestCase(TestBase):
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", 
self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", 
self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f", "Breakpoint location shown 
correctly",
-substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, 
locations = 1" % self.break_1])
-
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -139,7 +138,7 @@ class ThreadStateTestCase(TestBase):
 # Continue, the inferior will go into an infinite loop waiting for 
'g_test' to change.
 self.dbg.SetAsync(True)
 self.runCmd("continue")
-time.sleep(1)
+self.wait_for_running_event()
 
 # Check the thread state. It should be running.
 self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when 
it should be running.")
@@ -160,10 +159,6 @@ class ThreadStateTestCase(TestBase):
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", 
self.break_1, num_expected_locations=1)
 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", 
self.break_2, num_expected_locations=1)
 
-# The breakpoint list should show 1 breakpoints with 1 location.
-self.expect("breakpoint list -f",

Re: [Lldb-commits] [PATCH] D15152: Add a new option to Platform::LoadImage to install the image

2015-12-07 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 42055.
tberghammer added a comment.

Update API documentation in SBProcess.h


http://reviews.llvm.org/D15152

Files:
  include/lldb/API/SBProcess.h
  include/lldb/Target/Platform.h
  packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
  source/API/SBProcess.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Target/Platform.cpp

Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1985,14 +1985,52 @@
 }
 
 uint32_t
-Platform::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error)
+Platform::LoadImage(lldb_private::Process* process,
+const lldb_private::FileSpec& local_file,
+const lldb_private::FileSpec& remote_file,
+lldb_private::Error& error)
+{
+if (local_file && remote_file)
+{
+// Both local and remote file was specified. Install the local file to the given location.
+error = Install(local_file, remote_file);
+if (error.Fail())
+return LLDB_INVALID_IMAGE_TOKEN;
+return DoLoadImage(process, remote_file, error);
+}
+
+if (local_file)
+{
+// Only local file was specified. Install it to the current working directory.
+FileSpec target_file = GetWorkingDirectory();
+target_file.AppendPathComponent(local_file.GetFilename().AsCString());
+error = Install(local_file, target_file);
+if (error.Fail())
+return LLDB_INVALID_IMAGE_TOKEN;
+return DoLoadImage(process, target_file, error);
+}
+
+if (remote_file)
+{
+// Only remote file was specified so we don't have to do any copying
+return DoLoadImage(process, remote_file, error);
+}
+
+error.SetErrorString("Neither local nor remote file was specified");
+return LLDB_INVALID_IMAGE_TOKEN;
+}
+
+uint32_t
+Platform::DoLoadImage (lldb_private::Process* process,
+   const lldb_private::FileSpec& remote_file,
+   lldb_private::Error& error)
 {
 error.SetErrorString("LoadImage is not supported on the current platform");
 return LLDB_INVALID_IMAGE_TOKEN;
 }
 
 Error
 Platform::UnloadImage(lldb_private::Process* process, uint32_t image_token)
 {
-return Error("UnLoadImage is not supported on the current platform");
+return Error("UnloadImage is not supported on the current platform");
 }
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.h
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -174,9 +174,9 @@
 DisconnectRemote () override;
 
 uint32_t
-LoadImage (lldb_private::Process* process,
-   const lldb_private::FileSpec& image_spec,
-   lldb_private::Error& error) override;
+DoLoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error) override;
 
 lldb_private::Error
 UnloadImage (lldb_private::Process* process, uint32_t image_token) override;
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
===
--- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -898,10 +898,12 @@
 }
 
 uint32_t
-PlatformPOSIX::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error)
+PlatformPOSIX::DoLoadImage(lldb_private::Process* process,
+   const lldb_private::FileSpec& remote_file,
+   lldb_private::Error& error)
 {
 char path[PATH_MAX];
-image_spec.GetPath(path, sizeof(path));
+remote_file.GetPath(path, sizeof(path));
 
 StreamString expr;
 expr.Printf(R"(
Index: source/Commands/CommandObjectProcess.cpp
===
--- source/Commands/CommandObjectProcess.cpp
+++ source/Commands/CommandObjectProcess.cpp
@@ -1174,6 +1174,57 @@
 class CommandObjectProcessLoad : public CommandObjectParsed
 {
 public:
+class CommandOptions : public Options
+{
+public:
+CommandOptions (CommandInterpreter &interpreter) :
+Options(interpreter)
+{
+// Keep default values of all options in one place: OptionParsingStarting ()
+OptionParsingStarting ();
+}
+
+~CommandOptions () override = default;
+
+Error
+SetOptionValue (uint32_t option_idx, const char *option_arg) override
+{
+Error error;
+const int short_option = m_getopt_table[option_idx].val;
+switch (short_option)
+

Re: [Lldb-commits] [PATCH] D15152: Add a new option to Platform::LoadImage to install the image

2015-12-07 Thread Tamas Berghammer via lldb-commits
tberghammer added inline comments.


Comment at: include/lldb/API/SBProcess.h:301-307
@@ +300,9 @@
+
+// Load an image to the currently running process.
+// If both local and remote image is specified then copy the local image 
to the remote image and
+// then load it from thew remote path.
+// If only the local image is specified then the image will be copied to 
the current working
+// directory and opened from there.
+// If only the remote image is specified then open the image from the 
target (no compying done
+// in this case)
+uint32_t

clayborg wrote:
> Add correct header doc for this if we are going to add documentation to the 
> header file.
Done


Comment at: include/lldb/Target/Platform.h:1023-1027
@@ -1013,6 +1022,7 @@
 //--
-virtual uint32_t
+uint32_t
 LoadImage (lldb_private::Process* process,
-   const lldb_private::FileSpec& image_spec,
+   const lldb_private::FileSpec& local_file,
+   const lldb_private::FileSpec& remote_file,
lldb_private::Error& error);
 

clayborg wrote:
> This can still be virtual just in case other platforms want to do something 
> completely different that what is supported in the default implementation.
Currently I don't see any valid reason to override the implementation of this 
function as it still have to respect the API specification. For now I would 
prefer to leave it non-virtual and we can change it in the future if we need to.


http://reviews.llvm.org/D15152



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


[Lldb-commits] [lldb] r254902 - Recommit "Fix race during process interruption"

2015-12-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  7 06:36:52 2015
New Revision: 254902

URL: http://llvm.org/viewvc/llvm-project?rev=254902&view=rev
Log:
Recommit "Fix race during process interruption"

This is a resubmit of r254403, see that commit's message for context. This 
fixes an issue in the
original commit, where we would incorrectly interrupt the process if the 
interrupt request came
just as we were about to send the stopped event to the public.

Modified:
lldb/trunk/include/lldb/Target/Process.h

lldb/trunk/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=254902&r1=254901&r2=254902&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Dec  7 06:36:52 2015
@@ -1328,6 +1328,7 @@ public:
 
 Error
 ResumeSynchronous (Stream *stream);
+
 //--
 /// Halts a running process.
 ///
@@ -1340,12 +1341,15 @@ public:
 /// @param[in] clear_thread_plans
 /// If true, when the process stops, clear all thread plans.
 ///
+/// @param[in] use_run_lock
+/// Whether to release the run lock after the stop.
+///
 /// @return
 /// Returns an error object.  If the error is empty, the process is 
halted.
 /// otherwise the halt has failed.
 //--
 Error
-Halt (bool clear_thread_plans = false);
+Halt (bool clear_thread_plans = false, bool use_run_lock = true);
 
 //--
 /// Detaches from a running or stopped process.
@@ -1656,9 +1660,8 @@ public:
 /// DoHalt must produce one and only one stop StateChanged event if it 
actually
 /// stops the process.  If the stop happens through some natural event (for
 /// instance a SIGSTOP), then forwarding that event will do.  Otherwise, 
you must 
-/// generate the event manually.  Note also, the private event thread is 
stopped when 
-/// DoHalt is run to prevent the events generated while halting to trigger
-/// other state changes before the halt is complete.
+/// generate the event manually. This function is called from the context 
of the
+/// private state thread.
 ///
 /// @param[out] caused_stop
 /// If true, then this Halt caused the stop, otherwise, the 
@@ -2834,12 +2837,16 @@ public:
 // Returns the process state when it is stopped. If specified, event_sp_ptr
 // is set to the event which triggered the stop. If wait_always = false,
 // and the process is already stopped, this function returns immediately.
+// If the process is hijacked and use_run_lock is true (the default), then 
this
+// function releases the run lock after the stop. Setting use_run_lock to 
false
+// will avoid this behavior.
 lldb::StateType
 WaitForProcessToStop(const TimeValue *timeout,
  lldb::EventSP *event_sp_ptr = nullptr,
  bool wait_always = true,
  Listener *hijack_listener = nullptr,
- Stream *stream = nullptr);
+ Stream *stream = nullptr,
+ bool use_run_lock = true);
 
 uint32_t
 GetIOHandlerID () const
@@ -3263,12 +3270,6 @@ protected:
 std::string m_exit_string;
 };
 
-bool 
-HijackPrivateProcessEvents (Listener *listener);
-
-void 
-RestorePrivateProcessEvents ();
-
 bool
 PrivateStateThreadIsValid () const
 {
@@ -3354,7 +3355,6 @@ protected:
 std::vector m_pre_resume_actions;
 ProcessRunLock  m_public_run_lock;
 ProcessRunLock  m_private_run_lock;
-Predicate m_currently_handling_event; // This predicate 
is set in HandlePrivateEvent while all its business is being done.
 ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
 boolm_currently_handling_do_on_removals;
 boolm_resume_requested; // If 
m_currently_handling_event or m_currently_handling_do_on_removals are true, 
Resume will only request a resume, using this flag to check.
@@ -3418,6 +3418,9 @@ protected:
 void
 HandlePrivateEvent (lldb::EventSP &event_sp);
 
+Error
+HaltPrivate();
+
 lldb::StateType
 WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP 
&event_sp);
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py
URL

Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-07 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 42063.

http://reviews.llvm.org/D14952

Files:
  docs/lldb-gdb-remote.txt
  include/lldb/Target/Platform.h
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/Makefile
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
  
packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/main.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  source/Target/Platform.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  tools/lldb-server/lldb-platform.cpp

Index: tools/lldb-server/lldb-platform.cpp
===
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -285,6 +285,12 @@
 exit(option_error);
 }
 
+// Skip any options we consumed with getopt_long_only.
+argc -= optind;
+argv += optind;
+lldb_private::Args inferior_arguments;
+inferior_arguments.SetArguments(argc, const_cast(argv));
+
 const bool children_inherit_listen_socket = false;
 // the test suite makes many connections in parallel, let's not miss any.
 // The highest this should get reasonably is a function of the number
@@ -309,15 +315,15 @@
 error = save_socket_id_to_file(acceptor_up->GetLocalSocketId(), socket_file);
 if (error.Fail())
 {
-fprintf(stderr, "failed to write socket id to %s: %s", socket_file.GetPath().c_str(), error.AsCString());
+fprintf(stderr, "failed to write socket id to %s: %s\n", socket_file.GetPath().c_str(), error.AsCString());
 return 1;
 }
 }
 
 do {
 GDBRemoteCommunicationServerPlatform platform(acceptor_up->GetSocketProtocol(),
   acceptor_up->GetSocketScheme());
-
+
 if (port_offset > 0)
 platform.SetPortOffset(port_offset);
 
@@ -365,6 +371,22 @@
 
 if (platform.IsConnected())
 {
+if (inferior_arguments.GetArgumentCount() > 0)
+{
+lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
+uint16_t port = 0;
+std::string socket_name;
+Error error = platform.LaunchGDBServer(inferior_arguments,
+   "", // hostname
+   pid,
+   port,
+   socket_name);
+if (error.Success())
+platform.SetPendingGdbServer(pid, port, socket_name);
+else
+fprintf(stderr, "failed to start gdbserver: %s\n", error.AsCString());
+}
+
 // After we connected, we need to get an initial ack from...
 if (platform.HandshakeWithClient())
 {
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -54,6 +54,7 @@
 eServerPacketType_qGroupName,
 eServerPacketType_qHostInfo,
 eServerPacketType_qLaunchGDBServer,
+eServerPacketType_qQueryGDBServer,
 eServerPacketType_qKillSpawnedProcess,
 eServerPacketType_qLaunchSuccess,
 eServerPacketType_qModuleInfo,
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -163,12 +163,12 @@
 case 'K':
 if (PACKET_STARTS_WITH ("qKillSpawnedProcess")) return eServerPacketType_qKillSpawnedProcess;
 break;
-
+
 case 'L':
 if (PACKET_STARTS_WITH ("qLaunchGDBServer"))return eServerPacketType_qLaunchGDBServ

Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-07 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

I can't move the functionality into Platform::ConnectRemote because to connect 
to a process we need a debugger instance while Platform::ConnectRemote is 
called in scenarios where we don't have access to it (from 
SBPlatform::ConnectRemote). To clean up the API I added a new method to the 
Platform class called ConnectToWaitingProcesses what is connecting to all 
process waiting for a new debugger connection. In case of remote debugging it 
can be based on the gdb protocol (what I implemented with this CL) but if 
somebody want to support an embedded system with 1 process for each core then 
ConnectToWaitingProcesses can create a process for each core instead of 
connecting over the gdb protocol and everything should just work.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp:184
@@ +183,3 @@
+std::string hostname;
+// TODO: /tmp/ should not be hardcoded. User might want to override /tmp
+// with the TMPDIR environment variable

labath wrote:
> The TMPDIR and "sleep" comments seem to be obsolete...
Done


http://reviews.llvm.org/D14952



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


[Lldb-commits] [lldb] r254910 - [RenderScript] Mips64 allocations workaround

2015-12-07 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Mon Dec  7 07:50:32 2015
New Revision: 254910

URL: http://llvm.org/viewvc/llvm-project?rev=254910&view=rev
Log:
[RenderScript] Mips64 allocations workaround

Workaround for Mips64 compiler bug by using function pointers to call 
functions for expression evaluation. This avoids the emission of the JAL 
instruction, 
which can only jump within a particular range of the PC.

Author: Dean De Leo, d...@codeplay.com

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=254910&r1=254909&r2=254910&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Dec  7 07:50:32 2015
@@ -1114,61 +1114,136 @@ RenderScriptRuntime::EvalRSExpression(co
 return true;
 }
 
-// Used to index expression format strings
-enum ExpressionStrings
+namespace // anonymous
 {
-   eExprGetOffsetPtr = 0,
-   eExprAllocGetType,
-   eExprTypeDimX,
-   eExprTypeDimY,
-   eExprTypeDimZ,
-   eExprTypeElemPtr,
-   eExprElementType,
-   eExprElementKind,
-   eExprElementVec,
-   eExprElementFieldCount,
-   eExprSubelementsId,
-   eExprSubelementsName,
-   eExprSubelementsArrSize
-};
-
-// Format strings containing the expressions we may need to evaluate.
-const char runtimeExpressions[][256] =
-{
- // Mangled GetOffsetPointer(Allocation*, xoff, yoff, zoff, lod, cubemap)
- 
"(int*)_Z12GetOffsetPtrPKN7android12renderscript10AllocationE23RsAllocationCubemapFace(0x%lx,
 %u, %u, %u, 0, 0)",
-
- // Type* rsaAllocationGetType(Context*, Allocation*)
- "(void*)rsaAllocationGetType(0x%lx, 0x%lx)",
-
- // rsaTypeGetNativeData(Context*, Type*, void* typeData, size)
- // Pack the data in the following way mHal.state.dimX; mHal.state.dimY; 
mHal.state.dimZ;
- // mHal.state.lodCount; mHal.state.faces; mElement; into typeData
- // Need to specify 32 or 64 bit for uint_t since this differs between devices
- "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); 
data[0]", // X dim
- "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); 
data[1]", // Y dim
- "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); 
data[2]", // Z dim
- "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); 
data[5]", // Element ptr
-
- // rsaElementGetNativeData(Context*, Element*, uint32_t* elemData,size)
- // Pack mType; mKind; mNormalized; mVectorSize; NumSubElements into elemData
- "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); 
data[0]", // Type
- "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); 
data[1]", // Kind
- "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); 
data[3]", // Vector Size
- "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); 
data[4]", // Field Count
-
-  // rsaElementGetSubElements(RsContext con, RsElement elem, uintptr_t *ids, 
const char **names,
-  // size_t *arraySizes, uint32_t dataSize)
-  // Needed for Allocations of structs to gather details about 
fields/Subelements
- "void* ids[%u]; const char* names[%u]; size_t arr_size[%u];"
- "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); 
ids[%u]", // Element* of field
-
- "void* ids[%u]; const char* names[%u]; size_t arr_size[%u];"
- "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); 
names[%u]",   // Name of field
-
- "void* ids[%u]; const char* names[%u]; size_t arr_size[%u];"
- "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); 
arr_size[%u]" // Array size of field
-};
+// max length of an expanded expression
+const int jit_max_expr_size = 768;
+
+// Format strings containing the expressions we may need to evaluate.
+const char runtimeExpressions[][256] =
+{
+ // Mangled GetOffsetPointer(Allocation*, xoff, yoff, zoff, lod, cubemap)
+ 
"(int*)_Z12GetOffsetPtrPKN7android12renderscript10AllocationE23RsAllocationCubemapFace(0x%lx,
 %u, %u, %u, 0, 0)",
+
+ // Type* rsaAllocationGetType(Context*, Allocation*)
+ "(void*)rsaAllocationGetType(0x%lx, 0x%lx)",
+
+ // rsaTypeGetNativeData(Context*, Type*, void* typeData, size)
+ // Pack the data in the following way mHal.state.dimX; mHal.state.dimY; 
mHal.state.dimZ;
+ // mHal.state.lodCount; mHal.state.faces; mElement; into typeData
+ // Need to specify 32 or 64 bit for uint_t sinc

[Lldb-commits] LLVM buildmaster outage during the weekend

2015-12-07 Thread Galina Kistanova via lldb-commits
Hello everyone,

There was LLVM buildmaster outage during the weekend. Sorry about this.
It seems llvm lab outgrow consumer-grade router and should be updated later
or sooner.
I will look more at this what could be done about this.

Thanks

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


Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

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

Looks good, just check me inline comment and make changes if you think you need 
to.



Comment at: source/Commands/CommandObjectPlatform.cpp:414-419
@@ -413,1 +413,8 @@
+
+
platform_sp->ConnectToWaitingProcesses(m_interpreter.GetDebugger(), error);
+if (error.Fail())
+{
+result.AppendError (error.AsCString());
+result.SetStatus (eReturnStatusFailed);
+}
 }

So should the default Platform::ConnectToWaitingProcesses() return an error? 
Seems like this calls should be documented to say "only return an error if you 
actually tried to connect to a waiting process and that failed, and if there 
are no processes, return an error that has been cleared". We don't want 
"platform connect" to fail due to not being able to connect to a waiting 
process do we?


http://reviews.llvm.org/D14952



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


Re: [Lldb-commits] [PATCH] D14952: Modify "platform connect" to connect to processes as well

2015-12-07 Thread Tamas Berghammer via lldb-commits
tberghammer added inline comments.


Comment at: source/Commands/CommandObjectPlatform.cpp:414-419
@@ -413,1 +413,8 @@
+
+
platform_sp->ConnectToWaitingProcesses(m_interpreter.GetDebugger(), error);
+if (error.Fail())
+{
+result.AppendError (error.AsCString());
+result.SetStatus (eReturnStatusFailed);
+}
 }

clayborg wrote:
> So should the default Platform::ConnectToWaitingProcesses() return an error? 
> Seems like this calls should be documented to say "only return an error if 
> you actually tried to connect to a waiting process and that failed, and if 
> there are no processes, return an error that has been cleared". We don't want 
> "platform connect" to fail due to not being able to connect to a waiting 
> process do we?
I agree that we don't want "platform connect" to fail if no process is waiting 
(if a process is waiting but we failed to connect then I think it should but it 
isn't the case with the default platform).

Currently ConnectToWaitingProcesses tries to connect to all processes what are 
waiting what is 0 processes for the default platform and return an error if any 
of them failed, but with 0 processes waiting it can't happen.


http://reviews.llvm.org/D14952



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


[Lldb-commits] [lldb] r254924 - test commit.

2015-12-07 Thread Chuck Ries via lldb-commits
Author: chuckr
Date: Mon Dec  7 13:08:15 2015
New Revision: 254924

URL: http://llvm.org/viewvc/llvm-project?rev=254924&view=rev
Log:
test commit.

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

Modified: lldb/trunk/tools/lldb-mi/MIExtensions.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIExtensions.txt?rev=254924&r1=254923&r2=254924&view=diff
==
--- lldb/trunk/tools/lldb-mi/MIExtensions.txt (original)
+++ lldb/trunk/tools/lldb-mi/MIExtensions.txt Mon Dec  7 13:08:15 2015
@@ -98,7 +98,7 @@ For example:
 Synopsis
 
 Additional syntax provided by lldb-mi:
-   -target-attach -n  [--waitfor]
+-target-attach -n  [--waitfor]
 
 Attach to an executable. Using -n allows specifying an executable name to 
attach to. 
 Using this with --watifor can do a deffered attach. The flags -n and --waitfor 
match the syntax of lldb proper's 'process attach' command.


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


[Lldb-commits] [lldb] r254931 - Fix watchpoint check to use watchpoint ranges

2015-12-07 Thread Ted Woodward via lldb-commits
Author: ted
Date: Mon Dec  7 13:38:58 2015
New Revision: 254931

URL: http://llvm.org/viewvc/llvm-project?rev=254931&view=rev
Log:
Fix watchpoint check to use watchpoint ranges

Summary: Watchpoints, unlike breakpoints, have an address range. This patch 
changes WatchpointList::FindByAddress() to match on any address in the 
watchpoint range, instead of only matching on the watchpoint's base address.

Reviewers: clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Breakpoint/WatchpointList.cpp

Modified: lldb/trunk/source/Breakpoint/WatchpointList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointList.cpp?rev=254931&r1=254930&r2=254931&view=diff
==
--- lldb/trunk/source/Breakpoint/WatchpointList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointList.cpp Mon Dec  7 13:38:58 2015
@@ -75,10 +75,15 @@ WatchpointList::FindByAddress (lldb::add
 {
 wp_collection::const_iterator pos, end = m_watchpoints.end();
 for (pos = m_watchpoints.begin(); pos != end; ++pos)
-if ((*pos)->GetLoadAddress() == addr) {
+{
+lldb::addr_t wp_addr = (*pos)->GetLoadAddress();
+uint32_t wp_bytesize = (*pos)->GetByteSize();
+if ((wp_addr <= addr) && ((wp_addr + wp_bytesize) > addr))
+{
 wp_sp = *pos;
 break;
 }
+}
 }
 
 return wp_sp;


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


[Lldb-commits] [lldb] r254941 - Allow variable names to be quoted with -var-list-children

2015-12-07 Thread Chuck Ries via lldb-commits
Author: chuckr
Date: Mon Dec  7 14:43:52 2015
New Revision: 254941

URL: http://llvm.org/viewvc/llvm-project?rev=254941&view=rev
Log:
Allow variable names to be quoted with -var-list-children

Allow both '-var-list-children var0' and '-var-list-children "var0"' to be used 
with the -var-list-children command. GDB MI allows for this and it is necessary 
if the variable name contains spaces, such as 
var5.std::_Vector_base, 
std::allocator >, std::allocator, std::allocator > > >.

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py?rev=254941&r1=254940&r2=254941&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
Mon Dec  7 14:43:52 2015
@@ -49,6 +49,9 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 self.expect("\^done,status=\"editable\"")
 self.runCmd("-var-list-children var2")
 self.expect("\^done,numchild=\"0\",has_more=\"0\"")
+# Ensure -var-list-children also works with quotes
+self.runCmd("-var-list-children \"var2\"")
+self.expect("\^done,numchild=\"0\",has_more=\"0\"")
 self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
 self.expect("\^done,value=\"30\"")
 self.runCmd("-var-update --all-values var2")

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=254941&r1=254940&r2=254941&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Mon Dec  7 14:43:52 2015
@@ -945,7 +945,7 @@ bool
 CMICmdCmdVarListChildren::ParseArgs()
 {
 m_setCmdArgs.Add(new CMICmdArgValPrintValues(m_constStrArgPrintValues, 
false, true));
-m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true));
+m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, true, true, 
true));
 m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrom, false, true));
 m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgTo, false, true));
 return ParseValidateCmdOptions();


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


[Lldb-commits] [lldb] r254944 - getwd(3) with NULL pointer extension is supported on NetBSD

2015-12-07 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Mon Dec  7 15:21:12 2015
New Revision: 254944

URL: http://llvm.org/viewvc/llvm-project?rev=254944&view=rev
Log:
getwd(3) with NULL pointer extension is supported on NetBSD

Summary:
The getwd() and getcwd() functions conform to IEEE Std 1003.1-1990
(POSIX.1).  The IEEE Std 1003.1-2004 (POSIX.1) revision marked
getwd() as legacy and recommended the use of getcwd() instead.  The IEEE
Std 1003.1-2008 (``POSIX.1'') revision removed getwd() from the
specification.

The ability to specify a NULL pointer and have getcwd() allocate memory
as necessary is an extension.

The getwd() function appeared in 4.0BSD.

Reviewers: emaste, tfiala, clayborg

Subscribers: lldb-commits, joerg

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/common.h

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/common.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/common.h?rev=254944&r1=254943&r2=254944&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/common.h 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/common.h Mon 
Dec  7 15:21:12 2015
@@ -56,9 +56,9 @@ public:
   }
 };
 
-/// Allocates a char buffer with the current working directory on Linux/Darwin
+/// Allocates a char buffer with the current working directory
 inline char* get_working_dir() {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
 return getwd(0);
 #else
 return get_current_dir_name();


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


[Lldb-commits] [lldb] r254946 - Rename test_results.py to result_formatter.py.

2015-12-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Dec  7 15:23:41 2015
New Revision: 254946

URL: http://llvm.org/viewvc/llvm-project?rev=254946&view=rev
Log:
Rename test_results.py to result_formatter.py.

There is already a class called LLDBTestResults which I would like
to move into a separate file, but the most appropriate filename
was taken.

Added:
lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
  - copied, changed from r254944, 
lldb/trunk/packages/Python/lldbsuite/test/test_results.py
Removed:
lldb/trunk/packages/Python/lldbsuite/test/test_results.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
lldb/trunk/packages/Python/lldbsuite/test/dosep.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py?rev=254946&r1=254945&r2=254946&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py Mon 
Dec  7 15:23:41 2015
@@ -13,10 +13,11 @@ from __future__ import print_function
 import os
 
 # Our imports
-from . import test_results
+from . import result_formatter
 import lldbsuite
 
-class BasicResultsFormatter(test_results.ResultsFormatter):
+
+class BasicResultsFormatter(result_formatter.ResultsFormatter):
 """Provides basic test result output."""
 @classmethod
 def arg_parser(cls):
@@ -240,16 +241,16 @@ class BasicResultsFormatter(test_results
 # Output each of the test result entries.
 categories = [
 # result id, printed name, print matching tests?, detail label
-[test_results.EventBuilder.STATUS_SUCCESS,
+[result_formatter.EventBuilder.STATUS_SUCCESS,
  "Success", False, None],
-[test_results.EventBuilder.STATUS_EXPECTED_FAILURE,
+[result_formatter.EventBuilder.STATUS_EXPECTED_FAILURE,
  "Expected Failure", False, None],
-[test_results.EventBuilder.STATUS_FAILURE,
+[result_formatter.EventBuilder.STATUS_FAILURE,
  "Failure", True, "FAIL"],
-[test_results.EventBuilder.STATUS_ERROR, "Error", True, "ERROR"],
-[test_results.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
+[result_formatter.EventBuilder.STATUS_ERROR, "Error", True, 
"ERROR"],
+[result_formatter.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
  "Unexpected Success", True, "UNEXPECTED SUCCESS"],
-[test_results.EventBuilder.STATUS_SKIP, "Skip", False, None]]
+[result_formatter.EventBuilder.STATUS_SKIP, "Skip", False, None]]
 
 # Partition all the events by test result status
 result_events_by_status = self._partition_results_by_status(

Modified: lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/curses_results.py?rev=254946&r1=254945&r2=254946&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/curses_results.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/curses_results.py Mon Dec  7 
15:23:41 2015
@@ -23,11 +23,11 @@ import time
 
 # LLDB modules
 from . import lldbcurses
-from . import test_results
-from .test_results import EventBuilder
+from . import result_formatter
+from .result_formatter import EventBuilder
 
 
-class Curses(test_results.ResultsFormatter):
+class Curses(result_formatter.ResultsFormatter):
 """Receives live results from tests that are running and reports them to 
the terminal in a curses GUI"""
 
 def __init__(self, out_file, options):

Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=254946&r1=254945&r2=254946&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Mon Dec  7 15:23:41 2015
@@ -53,7 +53,7 @@ import lldbsuite.support.seven as seven
 
 from . import dotest_channels
 from . import dotest_args
-from . import test_results
+from . import result_formatter
 
 # Todo: Convert this folder layout to be relative-import friendly and don't 
hack up
 # sys.path like this
@@ -1429,9 +1429,9 @@ def main(print_details_on_success, num_t
 # Figure out exit code by count of test result types.
 issue_count = (
 results_formatter.counts_by_test_result_status(
-test_results.EventBuilder.STATUS_ERROR) +
+result

[Lldb-commits] [lldb] r254947 - Return gmake as the default name for GNU make on NetBSD

2015-12-07 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Mon Dec  7 15:24:25 2015
New Revision: 254947

URL: http://llvm.org/viewvc/llvm-project?rev=254947&view=rev
Log:
Return gmake as the default name for GNU make on NetBSD

Summary:
The base make(1) on NetBSD is BSD make.

In the default installation of NetBSD GNU make comes via pkgsrc under the gmake 
name.

Reviewers: emaste, tfiala, clayborg

Subscribers: joerg, lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py?rev=254947&r1=254946&r2=254947&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py Mon Dec  
7 15:24:25 2015
@@ -40,7 +40,7 @@ def getArchFlag():
 
 def getMake():
 """Returns the name for GNU make"""
-if platform.system() == "FreeBSD":
+if platform.system() == "FreeBSD" or platform.system() == "NetBSD":
   return "gmake"
 else:
   return "make"


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


[Lldb-commits] [lldb] r254948 - Add initial NetBSD support in lldbsuite/test/lldbtest.py

2015-12-07 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Mon Dec  7 15:25:57 2015
New Revision: 254948

URL: http://llvm.org/viewvc/llvm-project?rev=254948&view=rev
Log:
Add initial NetBSD support in lldbsuite/test/lldbtest.py

Summary:
Add new functions:

  - expectedFailureNetBSD()
  - expectedFlakeyNetBSD()
  - skipIfNetBSD()

Add new NetBSD entry in:

  - getPlatform()
  - getHostPlatform()

Assume that libc++ is installed and use the GNU toolchain

Reviewers: joerg, emaste, tfiala, clayborg

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=254948&r1=254947&r2=254948&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec  7 15:25:57 
2015
@@ -740,6 +740,9 @@ def expectedFailureFreeBSD(bugnumber=Non
 def expectedFailureLinux(bugnumber=None, compilers=None, debug_info=None):
 return expectedFailureOS(['linux'], bugnumber, compilers, 
debug_info=debug_info)
 
+def expectedFailureNetBSD(bugnumber=None, compilers=None, debug_info=None):
+return expectedFailureOS(['netbsd'], bugnumber, compilers, 
debug_info=debug_info)
+
 def expectedFailureWindows(bugnumber=None, compilers=None, debug_info=None):
 return expectedFailureOS(['windows'], bugnumber, compilers, 
debug_info=debug_info)
 
@@ -826,11 +829,14 @@ def expectedFlakeyDarwin(bugnumber=None,
 # For legacy reasons, we support both "darwin" and "macosx" as OS X 
triples.
 return expectedFlakeyOS(getDarwinOSTriples(), bugnumber, compilers)
 
+def expectedFlakeyFreeBSD(bugnumber=None, compilers=None):
+return expectedFlakeyOS(['freebsd'], bugnumber, compilers)
+
 def expectedFlakeyLinux(bugnumber=None, compilers=None):
 return expectedFlakeyOS(['linux'], bugnumber, compilers)
 
-def expectedFlakeyFreeBSD(bugnumber=None, compilers=None):
-return expectedFlakeyOS(['freebsd'], bugnumber, compilers)
+def expectedFlakeyNetBSD(bugnumber=None, compilers=None):
+return expectedFlakeyOS(['netbsd'], bugnumber, compilers)
 
 def expectedFlakeyCompiler(compiler, compiler_version=None, bugnumber=None):
 if compiler_version is None:
@@ -927,6 +933,10 @@ def skipIfFreeBSD(func):
 """Decorate the item to skip tests that should be skipped on FreeBSD."""
 return skipIfPlatform(["freebsd"])(func)
 
+def skipIfNetBSD(func):
+"""Decorate the item to skip tests that should be skipped on NetBSD."""
+return skipIfPlatform(["netbsd"])(func)
+
 def getDarwinOSTriples():
 return ['darwin', 'macosx', 'ios']
 
@@ -996,6 +1006,8 @@ def getPlatform():
 platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
 if platform.startswith('freebsd'):
 platform = 'freebsd'
+elif platform.startswith('netbsd'):
+platform = 'netbsd'
 return platform
 
 def getHostPlatform():
@@ -1009,6 +1021,8 @@ def getHostPlatform():
 return 'darwin'
 elif sys.platform.startswith('freebsd'):
 return 'freebsd'
+elif sys.platform.startswith('netbsd'):
+return 'netbsd'
 else:
 return sys.platform
 
@@ -1311,7 +1325,7 @@ class Base(unittest2.TestCase):
 # Set platform context.
 if platformIsDarwin():
 cls.platformContext = _PlatformContext('DYLD_LIBRARY_PATH', 'lib', 
'dylib')
-elif getPlatform() == "linux" or getPlatform() == "freebsd":
+elif getPlatform() in ("freebsd", "linux", "netbsd"):
 cls.platformContext = _PlatformContext('LD_LIBRARY_PATH', 'lib', 
'so')
 else:
 cls.platformContext = None
@@ -2063,7 +2077,7 @@ class Base(unittest2.TestCase):
 """ Returns the proper -stdlib flag, or empty if not required."""
 if self.platformIsDarwin() or self.getPlatform() == "freebsd":
 stdlibflag = "-stdlib=libc++"
-else:
+else: # this includes NetBSD
 stdlibflag = ""
 return stdlibflag
 
@@ -2238,6 +2252,8 @@ class Base(unittest2.TestCase):
 cflags += "c++11"
 if self.platformIsDarwin() or self.getPlatform() == "freebsd":
 cflags += " -stdlib=libc++"
+elif self.getPlatform() == "netbsd":
+cflags += " -stdlib=libstdc++"
 elif "clang" in self.getCompiler():
 cflags += " -stdlib=libstdc++"
 
@@ -2269,7 +2285,7 @@ class Base(unittest2.TestCase):
 return lib_dir
 
 def getLibcPlusPlusLibs(self):
-if self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux':
+if self.getPlatform() in ('freebsd', 'linux', 'netbsd'):
 return ['libc++.so.1']
 else:
 return ['libc++.1.dylib','libc++abi.dylib']


_

[Lldb-commits] [lldb] r254949 - Add NetBSD in platform specific logging of the specified category in RegisterCommandsTestCase()

2015-12-07 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Mon Dec  7 15:26:56 2015
New Revision: 254949

URL: http://llvm.org/viewvc/llvm-project?rev=254949&view=rev
Log:
Add NetBSD in platform specific logging of the specified category in 
RegisterCommandsTestCase()

Summary: NetBSD soon will reuse this feature while running tests.

Reviewers: emaste, tfiala, clayborg

Subscribers: lldb-commits, joerg

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py?rev=254949&r1=254948&r2=254949&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
 Mon Dec  7 15:26:56 2015
@@ -133,6 +133,9 @@ class RegisterCommandsTestCase(TestBase)
 if sys.platform.startswith("linux"):
 self.platform = "linux"
 
+if sys.platform.startswith("netbsd"):
+self.platform = "netbsd"
+
 if self.platform != "":
 self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
 self.runCmd("log enable " + self.platform + " " + str(category) + 
" registers -v -f " + self.log_file, RUN_SUCCEEDED)


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


Re: [Lldb-commits] [PATCH] D15261: Return gmake as the default name for GNU make on NetBSD

2015-12-07 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Thank you!


Repository:
  rL LLVM

http://reviews.llvm.org/D15261



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


Re: [Lldb-commits] [PATCH] D15260: getwd(3) with NULL pointer extension is supported on NetBSD

2015-12-07 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Thank you!


Repository:
  rL LLVM

http://reviews.llvm.org/D15260



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


Re: [Lldb-commits] [PATCH] D15263: Add NetBSD in platform specific logging of the specified category in RegisterCommandsTestCase()

2015-12-07 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Thank you!


Repository:
  rL LLVM

http://reviews.llvm.org/D15263



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


Re: [Lldb-commits] [PATCH] D15262: Add initial NetBSD support in lldbsuite/test/lldbtest.py

2015-12-07 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

Thank you!


Repository:
  rL LLVM

http://reviews.llvm.org/D15262



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


[Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.

2015-12-07 Thread Dawn Perchik via lldb-commits
dawn created this revision.
dawn added reviewers: paulherman, clayborg, granata.enrico.
dawn added a subscriber: lldb-commits.
dawn set the repository for this revision to rL LLVM.

When multiple functions are found by name, lldb removes duplicate entries of 
functions with the same type, so the first function in the symbol context list 
is chosen, even if it isn't in scope.  This patch uses the declaration context 
of the execution context to select the function which is in scope.

This fixes cases like the following:

int func();
namespace ns {
int func();
void here() {
// Run to BP here and eval 'p func()';
// lldb used to find ::func(), now finds ns::func().
}
}


Repository:
  rL LLVM

http://reviews.llvm.org/D15312

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/TypeSystem.h
  packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile
  packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
  packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9224,6 +9224,96 @@
 return found_decls;
 }
 
+// Look for opaque_find_decl_ctx's lookup scope in opaque_decl_ctx and its parents,
+// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL
+// if not found.  If the decl was imported via a using declaration, its name and
+// type, if set, will be used to check that the decl found in the scope is a match.
+//
+// NOTE: Because file statics are at the TranslationUnit along with globals, a
+// function at file scope will return the same level as a function at global scope.
+// Ideally we'd like to treat the file scope as an additional scope just below the
+// global scope.  More work needs to be done to recognise that, if the decl we're
+// trying to look up is static, we should compare its source file with that of the
+// current scope and return a lower number for it.
+uint32_t
+ClangASTContext::DeclContextCountDeclLevels(void *opaque_decl_ctx,
+void *opaque_find_decl_ctx,
+ConstString *find_name,
+CompilerType *find_type)
+{
+int level = LLDB_INVALID_DECL_LEVEL;
+if (opaque_decl_ctx)
+{
+DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx;
+DeclContext *find_decl_ctx = (DeclContext *)opaque_find_decl_ctx;
+std::set searched;
+std::multimap search_queue;
+SymbolFile *symbol_file = GetSymbolFile();
+
+// Get the lookup scope for the decl we're trying to find.
+find_decl_ctx = find_decl_ctx->getLookupParent();
+
+// Look for it in our scope's decl context and its parents.
+for (clang::DeclContext *decl_context = root_decl_ctx; decl_context != nullptr; decl_context = decl_context->getParent())
+{
+if (!decl_context->isLookupContext())
+continue;
+++level;
+if (decl_context == find_decl_ctx)
+// Found it!
+return level;
+search_queue.insert(std::make_pair(decl_context, decl_context));
+
+for (auto it = search_queue.find(decl_context); it != search_queue.end(); it++)
+{
+if (searched.find(it->second) != searched.end())
+continue;
+searched.insert(it->second);
+symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second));
+
+for (clang::Decl *child : it->second->decls())
+{
+if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
+{
+clang::DeclContext *ns = ud->getNominatedNamespace();
+if (ns == find_decl_ctx)
+// Found it!
+return level;
+clang::DeclContext *from = ud->getCommonAncestor();
+if (searched.find(ns) == searched.end())
+search_queue.insert(std::make_pair(from, ns));
+}
+else if (find_name &&
+ clang::UsingDecl *ud = llvm::dyn_cast(child))
+{
+for (clang::UsingShadowDecl *usd : ud->shadows())
+{
+  

Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.

2015-12-07 Thread Dawn Perchik via lldb-commits
dawn updated this revision to Diff 42115.
dawn added a comment.

Updated patch to removed change related to Pascal language - it should be part 
of a separate patch.


Repository:
  rL LLVM

http://reviews.llvm.org/D15312

Files:
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/GoASTContext.h
  include/lldb/Symbol/TypeSystem.h
  packages/Python/lldbsuite/test/lang/cpp/namespace/Makefile
  packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
  packages/Python/lldbsuite/test/lang/cpp/namespace/main.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns.h
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns2.cpp
  packages/Python/lldbsuite/test/lang/cpp/namespace/ns3.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -9224,6 +9224,98 @@
 return found_decls;
 }
 
+// Look for opaque_find_decl_ctx's lookup scope in opaque_decl_ctx and its parents,
+// and return the number of levels it took to find it, or LLDB_INVALID_DECL_LEVEL
+// if not found.  If the decl was imported via a using declaration, its name and
+// type, if set, will be used to check that the decl found in the scope is a match.
+//
+// NOTE: Because file statics are at the TranslationUnit along with globals, a
+// function at file scope will return the same level as a function at global scope.
+// Ideally we'd like to treat the file scope as an additional scope just below the
+// global scope.  More work needs to be done to recognise that, if the decl we're
+// trying to look up is static, we should compare its source file with that of the
+// current scope and return a lower number for it.
+uint32_t
+ClangASTContext::DeclContextCountDeclLevels(void *opaque_decl_ctx,
+void *opaque_find_decl_ctx,
+ConstString *find_name,
+CompilerType *find_type)
+{
+int level = LLDB_INVALID_DECL_LEVEL;
+if (opaque_decl_ctx)
+{
+DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx;
+DeclContext *find_decl_ctx = (DeclContext *)opaque_find_decl_ctx;
+std::set searched;
+std::multimap search_queue;
+SymbolFile *symbol_file = GetSymbolFile();
+
+// Get the lookup scope for the decl we're trying to find.
+find_decl_ctx = find_decl_ctx->getLookupParent();
+
+// Look for it in our scope's decl context and its parents.
+for (clang::DeclContext *decl_context = root_decl_ctx; decl_context != nullptr; decl_context = decl_context->getParent())
+{
+if (!decl_context->isLookupContext())
+continue;
+++level;
+if (decl_context == find_decl_ctx)
+// Found it!
+return level;
+search_queue.insert(std::make_pair(decl_context, decl_context));
+
+for (auto it = search_queue.find(decl_context); it != search_queue.end(); it++)
+{
+if (searched.find(it->second) != searched.end())
+continue;
+searched.insert(it->second);
+symbol_file->ParseDeclsForContext(CompilerDeclContext(this, it->second));
+
+for (clang::Decl *child : it->second->decls())
+{
+if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast(child))
+{
+clang::DeclContext *ns = ud->getNominatedNamespace();
+if (ns == find_decl_ctx)
+// Found it!
+return level;
+clang::DeclContext *from = ud->getCommonAncestor();
+if (searched.find(ns) == searched.end())
+search_queue.insert(std::make_pair(from, ns));
+}
+else if (find_name)
+{
+if (clang::UsingDecl *ud = llvm::dyn_cast(child))
+{
+for (clang::UsingShadowDecl *usd : ud->shadows())
+{
+clang::Decl *target = usd->getTargetDecl();
+clang::NamedDecl *nd = llvm::dyn_cast(target);
+if (!nd)
+continue;
+// Check names.
+IdentifierInfo *ii = nd->getIdentifier();
+if (ii == nullptr || !ii->getName().equals(find_name->AsCString(nullptr)))
+continue;
+  

Re: [Lldb-commits] [lldb] r254946 - Rename test_results.py to result_formatter.py.

2015-12-07 Thread Todd Fiala via lldb-commits
This is okay, but I was planning on breaking that out into multiple files.
Right now the test_results module also has the EventBuilder in it, which is
not a results formatter.  But we can break that out separately.

On Mon, Dec 7, 2015 at 1:23 PM, Zachary Turner via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: zturner
> Date: Mon Dec  7 15:23:41 2015
> New Revision: 254946
>
> URL: http://llvm.org/viewvc/llvm-project?rev=254946&view=rev
> Log:
> Rename test_results.py to result_formatter.py.
>
> There is already a class called LLDBTestResults which I would like
> to move into a separate file, but the most appropriate filename
> was taken.
>
> Added:
> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>   - copied, changed from r254944,
> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
> Removed:
> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
> lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
> lldb/trunk/packages/Python/lldbsuite/test/dosep.py
> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py?rev=254946&r1=254945&r2=254946&view=diff
>
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
> (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
> Mon Dec  7 15:23:41 2015
> @@ -13,10 +13,11 @@ from __future__ import print_function
>  import os
>
>  # Our imports
> -from . import test_results
> +from . import result_formatter
>  import lldbsuite
>
> -class BasicResultsFormatter(test_results.ResultsFormatter):
> +
> +class BasicResultsFormatter(result_formatter.ResultsFormatter):
>  """Provides basic test result output."""
>  @classmethod
>  def arg_parser(cls):
> @@ -240,16 +241,16 @@ class BasicResultsFormatter(test_results
>  # Output each of the test result entries.
>  categories = [
>  # result id, printed name, print matching tests?, detail label
> -[test_results.EventBuilder.STATUS_SUCCESS,
> +[result_formatter.EventBuilder.STATUS_SUCCESS,
>   "Success", False, None],
> -[test_results.EventBuilder.STATUS_EXPECTED_FAILURE,
> +[result_formatter.EventBuilder.STATUS_EXPECTED_FAILURE,
>   "Expected Failure", False, None],
> -[test_results.EventBuilder.STATUS_FAILURE,
> +[result_formatter.EventBuilder.STATUS_FAILURE,
>   "Failure", True, "FAIL"],
> -[test_results.EventBuilder.STATUS_ERROR, "Error", True,
> "ERROR"],
> -[test_results.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
> +[result_formatter.EventBuilder.STATUS_ERROR, "Error", True,
> "ERROR"],
> +[result_formatter.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
>   "Unexpected Success", True, "UNEXPECTED SUCCESS"],
> -[test_results.EventBuilder.STATUS_SKIP, "Skip", False, None]]
> +[result_formatter.EventBuilder.STATUS_SKIP, "Skip", False,
> None]]
>
>  # Partition all the events by test result status
>  result_events_by_status = self._partition_results_by_status(
>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/curses_results.py?rev=254946&r1=254945&r2=254946&view=diff
>
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/curses_results.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/curses_results.py Mon Dec  7
> 15:23:41 2015
> @@ -23,11 +23,11 @@ import time
>
>  # LLDB modules
>  from . import lldbcurses
> -from . import test_results
> -from .test_results import EventBuilder
> +from . import result_formatter
> +from .result_formatter import EventBuilder
>
>
> -class Curses(test_results.ResultsFormatter):
> +class Curses(result_formatter.ResultsFormatter):
>  """Receives live results from tests that are running and reports them
> to the terminal in a curses GUI"""
>
>  def __init__(self, out_file, options):
>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=254946&r1=254945&r2=254946&view=diff
>
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Mon Dec  7 15:23:41
> 2015
> @@ -53,7 +53,7 @@ import lldbsuite.support.seven as seven
>
>  from . impo

Re: [Lldb-commits] [PATCH] D15312: Fix scope-based lookup when more than one function is found.

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

So one of two things needs to happen here:

- ClangASTContext::DeclContextCountDeclLevels() becomes a function that is on 
ClangASTContext only and the opaque arguments get changed into 
"clang::DeclContext *" args, then remove all DeclContextCountDeclLevels 
functions from TypeSystem.h and GoASTContext.h.
- Change ClangASTContext::DeclContextCountDeclLevels() over to use 
CompilerDeclContext objects for both "void *opaque_decl_ctx" and "void 
*opaque_find_decl_ctx" and add any functions you need to do CompilerDeclContext 
that is needed to complete the functionality of this function without 
downcasting to clang objects.

So either make it generic, or clang specific.

I would vote for the first method since this functionality is very clang and 
C++ specific. It doesn't seem like a nice general purpose function any other 
language would use. If you do go the second route, you really need to abstract 
the heck out of this and add any needed methods to CompilerDeclContext.



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1443
@@ +1442,3 @@
+comp_sym_ctx = 
frame->GetSymbolContext(lldb::eSymbolContextFunction|lldb::eSymbolContextBlock);
+CompilerDeclContext compiler_decl_context = comp_sym_ctx.block 
!= nullptr ? comp_sym_ctx.block->GetDeclContext() : CompilerDeclContext();
+

"compiler_decl_context" should probably be named "frame_decl_ctx" for clarity


Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1467-1468
@@ +1466,4 @@
+// Filter out class/instance methods.
+if (decl_ctx.IsClassMethod(nullptr, nullptr, 
nullptr))
+continue;
+sc_func_list.Append(sym_ctx);

Why are we pulling out class methods here?


Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1485
@@ +1484,3 @@
+};
+auto initFuncDeclInfo = [this, compiler_decl_context, 
ast](const SymbolContext &sym_ctx)
+{

There is no need for this lamba, inline the code at the one and only place that 
it is used.


Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1505-1509
@@ +1504,7 @@
+// scope and shadows the other.
+fdi.m_func_decl_lvl =
+
ast->DeclContextCountDeclLevels(compiler_decl_context.GetOpaqueDeclContext(),
+
func_decl_context.GetOpaqueDeclContext(),
+
&fdi.m_function_name,
+
&fdi.m_copied_function_type);
+}

Seems like you actually want this to be something like:

```
fdi.m_func_decl_lvl = func_decl_context.Depth(compiler_decl_context);
```

This would be a function on CompilerDeclContext that would calculate the depth 
of a decl context if the first argument (compiler_decl_context) is contained 
within the object (func_decl_context). This would be a useful API to add to 
CompilerDeclContext. It can return an integer and return "-1" if the 
compiler_decl_context ins't contained within func_decl_context, or zero or 
greater if it is.

Then you would need to add more functions the CompilerDeclContext to get 
"fdi.m_function_name" and "fdi.m_copied_function_type".



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1517
@@ +1516,3 @@
+uint32_t num_indices = sc_func_list.GetSize();
+std::vector fdi_cache;
+fdi_cache.reserve(num_indices);

wouldn't this be better as std::multimap where the 
uint32_t is the depth? Then you can change your foo loop at 1531 to just grab 
the first entry in the map and iterate as long as the depth is the same...


Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:1524
@@ +1523,3 @@
+
+struct FuncDeclInfo fdi = initFuncDeclInfo(sym_ctx);
+fdi_cache.emplace_back(fdi);

inline the initFuncDeclInfo lambda here without needing a lambda


Repository:
  rL LLVM

http://reviews.llvm.org/D15312



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


Re: [Lldb-commits] [lldb] r254946 - Rename test_results.py to result_formatter.py.

2015-12-07 Thread Zachary Turner via lldb-commits
Yea, that actually came up on my radar too, but when I tried to do more
things at once it started turning into a rats nest.  Refactoring Python is
kind of hard so I want to make the changes as small as possible that if
anything breaks, bisecting will narrow the problem down as much as possible.

On Mon, Dec 7, 2015 at 3:35 PM Todd Fiala  wrote:

> This is okay, but I was planning on breaking that out into multiple
> files.  Right now the test_results module also has the EventBuilder in it,
> which is not a results formatter.  But we can break that out separately.
>
> On Mon, Dec 7, 2015 at 1:23 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> Author: zturner
>> Date: Mon Dec  7 15:23:41 2015
>> New Revision: 254946
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=254946&view=rev
>> Log:
>> Rename test_results.py to result_formatter.py.
>>
>> There is already a class called LLDBTestResults which I would like
>> to move into a separate file, but the most appropriate filename
>> was taken.
>>
>> Added:
>> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>>   - copied, changed from r254944,
>> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
>> Removed:
>> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>> lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
>> lldb/trunk/packages/Python/lldbsuite/test/dosep.py
>> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py?rev=254946&r1=254945&r2=254946&view=diff
>>
>> ==
>> --- lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>> (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>> Mon Dec  7 15:23:41 2015
>> @@ -13,10 +13,11 @@ from __future__ import print_function
>>  import os
>>
>>  # Our imports
>> -from . import test_results
>> +from . import result_formatter
>>  import lldbsuite
>>
>> -class BasicResultsFormatter(test_results.ResultsFormatter):
>> +
>> +class BasicResultsFormatter(result_formatter.ResultsFormatter):
>>  """Provides basic test result output."""
>>  @classmethod
>>  def arg_parser(cls):
>> @@ -240,16 +241,16 @@ class BasicResultsFormatter(test_results
>>  # Output each of the test result entries.
>>  categories = [
>>  # result id, printed name, print matching tests?, detail
>> label
>> -[test_results.EventBuilder.STATUS_SUCCESS,
>> +[result_formatter.EventBuilder.STATUS_SUCCESS,
>>   "Success", False, None],
>> -[test_results.EventBuilder.STATUS_EXPECTED_FAILURE,
>> +[result_formatter.EventBuilder.STATUS_EXPECTED_FAILURE,
>>   "Expected Failure", False, None],
>> -[test_results.EventBuilder.STATUS_FAILURE,
>> +[result_formatter.EventBuilder.STATUS_FAILURE,
>>   "Failure", True, "FAIL"],
>> -[test_results.EventBuilder.STATUS_ERROR, "Error", True,
>> "ERROR"],
>> -[test_results.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
>> +[result_formatter.EventBuilder.STATUS_ERROR, "Error", True,
>> "ERROR"],
>> +[result_formatter.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
>>   "Unexpected Success", True, "UNEXPECTED SUCCESS"],
>> -[test_results.EventBuilder.STATUS_SKIP, "Skip", False, None]]
>> +[result_formatter.EventBuilder.STATUS_SKIP, "Skip", False,
>> None]]
>>
>>  # Partition all the events by test result status
>>  result_events_by_status = self._partition_results_by_status(
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/curses_results.py?rev=254946&r1=254945&r2=254946&view=diff
>>
>> ==
>> --- lldb/trunk/packages/Python/lldbsuite/test/curses_results.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/curses_results.py Mon Dec
>> 7 15:23:41 2015
>> @@ -23,11 +23,11 @@ import time
>>
>>  # LLDB modules
>>  from . import lldbcurses
>> -from . import test_results
>> -from .test_results import EventBuilder
>> +from . import result_formatter
>> +from .result_formatter import EventBuilder
>>
>>
>> -class Curses(test_results.ResultsFormatter):
>> +class Curses(result_formatter.ResultsFormatter):
>>  """Receives live results from tests that are running and reports
>> them to the terminal in a curses GUI"""
>>
>>  def __init__(self, out_file, options):
>>
>> Modified: lldb/trunk/packages/Python/lldbsuit

[Lldb-commits] Buildbot numbers for week of 11/29/2015 - 12/05/2015

2015-12-07 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the last week of 11/29/2015 -
12/05/2015.

Thanks

Galina



Top 10 fastest builders(not docs):

 lldb-amd64-ninja-freebsd11
 clang-bpf-build
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
 libomp-gcc-x86_64-linux-debian
 sanitizer-windows
 llvm-hexagon-elf
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14
 lldb-x86-win7-msvc


 10 most slow builders:

 clang-native-arm-lnt-perf
 clang-atom-d525-fedora
 clang-cmake-thumbv7-a15-full-sh
 clang-native-aarch64-full
 perf-x86_64-penryn-O3-polly
 perf-x86_64-penryn-O3
 llvm-mips-linux
 clang-cmake-armv7-a15-selfhost-neon
 clang-cmake-armv7-a15-selfhost
 ppc64le-clang



Number of commits by project:

 project   |   commits
---+---
 llvm  |   337
 cfe   |83
 lldb  |50
 compiler-rt   |47
 lld   |21
 libcxx| 9
 clang-tools-extra | 7
 polly | 6
 openmp| 4
 libcxxabi | 3
 ---
   567


Number of completed builds, failed builds and average build time for
successful builds per active builder:

 buildername   | completed  |
failed | time
-
 clang-aarch64-lnt | 58
|  2 | 02:32:07
 clang-atom-d525-fedora| 15
|| 08:44:10
 clang-atom-d525-fedora-rel| 69
|| 01:40:33
 clang-bpf-build   |339
|  7 | 00:03:00
 clang-cmake-aarch64-42vma |276
| 14 | 00:18:01
 clang-cmake-aarch64-full  | 38
| 11 | 03:09:07
 clang-cmake-aarch64-quick |215
|  6 | 00:25:45
 clang-cmake-armv7-a15 |189
|  9 | 00:28:01
 clang-cmake-armv7-a15-full|144
|  6 | 00:44:34
 clang-cmake-armv7-a15-selfhost| 36
|  6 | 03:52:55
 clang-cmake-armv7-a15-selfhost-neon   | 30
|  5 | 04:52:57
 clang-cmake-mips  |211
| 17 | 00:27:43
 clang-cmake-thumbv7-a15   |180
| 11 | 00:29:57
 clang-cmake-thumbv7-a15-full-sh   | 16
|  2 | 06:40:33
 clang-hexagon-elf |251
| 44 | 00:16:38
 clang-native-aarch64-full | 24
|| 06:24:15
 clang-native-arm-lnt  | 81
|  4 | 01:07:36
 clang-native-arm-lnt-perf | 10
|  1 | 09:45:56
 clang-ppc64-elf-linux |119
|  1 | 01:04:37
 clang-ppc64-elf-linux2| 84
|  3 | 01:37:48
 clang-sphinx-docs |121
|| 00:00:22
 clang-x64-ninja-win7  |193
| 49 | 00:35:14
 clang-x86-win2008-selfhost|129
| 28 | 01:04:06
 clang-x86_64-darwin13-cross-arm   |245
|  4 | 00:20:08
 clang-x86_64-darwin13-cross-mingw32   |223
|  3 | 00:23:48
 clang-x86_64-debian-fast  |153
|| 00:11:37
 clang-x86_64-linux-abi-test   |342
|  2 | 00:18:53
 clang-x86_64-linux-selfhost-modules   |275
| 65 | 00:15:13
 clang-x86_64-ubuntu-gdb-75|143
| 25 | 00:50:20
 libcxx-libcxxabi-arm-linux|  3
|| 01:10:06
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   |  6
|  1 | 00:08:42
 libcxx-libcxxabi-x86_64-linux-debian  |  6
|| 00:09:05
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  5
|| 00:08:53
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan |  5
|| 00:12:40
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03|  5
|| 00:06:10
 

[Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: tfiala, clayborg.
zturner added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Since this is a big patch, you may just want to apply it locally and verify 
that nothing breaks.  I've tested both the old and new result formatter paths, 
and everything seems fine.  But unfortunately with Python you need 100% code 
coverage to be sure.  So let me know if this breaks anything.

Get rid of global variables in dotest.py

This moves all the global variables into a separate module called
`configuration`.  This has a number of advantages:

1. Configuration data is centrally maintained so it's easy to get
   a high level overview of what configuration data the test suite
   makes use of.
2. The method of sharing configuration data among different parts
   of the test suite becomes standardized.  Previously we would
   put some things into the `lldb` module, some things into the
   `lldbtest_config` module, and some things would not get shared.
   Now everything is shared through one module and is available to
   the entire test suite.
3. It opens the door to moving some of the initialization code into
   the `configuration` module, simplifying the implementation of
   `dotest.py`.

There are a few stragglers that didn't get converted over to using
the `configuration` module in this patch, because it would have grown
the size of the patch unnecessarily.  This includes everything
currently in the `lldbtest_config` module, as well as the
`lldb.remote_platform` variable.  We can address these in the future.

http://reviews.llvm.org/D15318

Files:
  packages/Python/lldbsuite/test/__init__.py
  
packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py
  packages/Python/lldbsuite/test/benchmarks/disassembly/TestDisassembly.py
  
packages/Python/lldbsuite/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
  
packages/Python/lldbsuite/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
  packages/Python/lldbsuite/test/benchmarks/expression/TestExpressionCmd.py
  packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py
  
packages/Python/lldbsuite/test/benchmarks/frame_variable/TestFrameVariableResponse.py
  packages/Python/lldbsuite/test/benchmarks/startup/TestStartupDelays.py
  
packages/Python/lldbsuite/test/benchmarks/stepping/TestRunHooksThenSteppings.py
  packages/Python/lldbsuite/test/benchmarks/stepping/TestSteppingSpeed.py
  
packages/Python/lldbsuite/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
  packages/Python/lldbsuite/test/configuration.py
  packages/Python/lldbsuite/test/dotest.py
  
packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
  
packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
  
packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Index: packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -19,6 +19,7 @@
 import sys
 import tempfile
 import time
+from lldbsuite.test import configuration
 from lldbsuite.test.lldbtest import *
 from lldbgdbserverutils import *
 import logging
@@ -60,13 +61,13 @@
 self.named_pipe = None
 self.named_pipe_fd = None
 self.stub_sends_two_stop_notifications_on_kill = False
-if lldb.platform_url:
-if lldb.platform_url.startswith('unix-'):
+if configuration.lldb_platform_url:
+if configuration.lldb_platform_url.startswith('unix-'):
 url_pattern = '(.+)://\[?(.+?)\]?/.*'
 else:
 url_pattern = '(.+)://(.+):\d+'
-scheme, host = re.match(url_pattern, lldb.platform_url).groups()
-if lldb.remote_platform_name == 'remote-android' and host != 'localhost':
+scheme, host = re.match(url_pattern, configuration.lldb_platform_url).groups()
+if configuration.lldb_platform_name == 'remote-android' and host != 'localhost':
 self.stub_device = host
 self.stub_hostname = 'localhost'
 else:
Index: packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
===
--- packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
+++ packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
@@ -26,7 +26,7 @@
 TestBase.setUp

[Lldb-commits] [lldb] r254979 - Refactor ResultsFormatter creation into result_formatter.

2015-12-07 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Mon Dec  7 18:53:56 2015
New Revision: 254979

URL: http://llvm.org/viewvc/llvm-project?rev=254979&view=rev
Log:
Refactor ResultsFormatter creation into result_formatter.

This cleans up dotest.py and is a pre-step for getting
the test inferior runner to send post-inferior run events
to the events collector, as this code needs to be accessed
from within dosep.py.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254979&r1=254978&r2=254979&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7 18:53:56 2015
@@ -239,7 +239,6 @@ test_runner_name = None
 # Test results handling globals
 results_filename = None
 results_port = None
-results_file_object = None
 results_formatter_name = None
 results_formatter_object = None
 results_formatter_options = None
@@ -910,73 +909,24 @@ def createSocketToLocalPort(port):
 def setupTestResults():
 """Sets up test results-related objects based on arg settings."""
 global results_filename
-global results_file_object
 global results_formatter_name
 global results_formatter_object
 global results_formatter_options
 global results_port
 
-default_formatter_name = None
-cleanup_func = None
+# Setup the results formatter configuration.
+config = result_formatter.FormatterConfig()
+config.filename = results_filename
+config.formatter_name = results_formatter_name
+config.formatter_options = results_formatter_options
+config.port = results_port
+
+# Create the results formatter.
+formatter_spec = result_formatter.create_results_formatter(config)
+if formatter_spec is not None and formatter_spec.formatter is not None:
+results_formatter_object = formatter_spec.formatter
 
-if results_filename:
-# Open the results file for writing.
-if results_filename == 'stdout':
-results_file_object = sys.stdout
-cleanup_func = None
-elif results_filename == 'stderr':
-results_file_object = sys.stderr
-cleanup_func = None
-else:
-results_file_object = open(results_filename, "w")
-cleanup_func = results_file_object.close
-default_formatter_name = 
"lldbsuite.test.result_formatter.XunitFormatter"
-elif results_port:
-# Connect to the specified localhost port.
-results_file_object, cleanup_func = createSocketToLocalPort(
-results_port)
-default_formatter_name = (
-"lldbsuite.test.result_formatter.RawPickledFormatter")
-
-# If we have a results formatter name specified and we didn't specify
-# a results file, we should use stdout.
-if results_formatter_name is not None and results_file_object is None:
-# Use stdout.
-results_file_object = sys.stdout
-cleanup_func = None
-
-if results_file_object:
-# We care about the formatter.  Choose user-specified or, if
-# none specified, use the default for the output type.
-if results_formatter_name:
-formatter_name = results_formatter_name
-else:
-formatter_name = default_formatter_name
-
-# Create an instance of the class.
-# First figure out the package/module.
-components = formatter_name.split(".")
-module = importlib.import_module(".".join(components[:-1]))
-
-# Create the class name we need to load.
-clazz = getattr(module, components[-1])
-
-# Handle formatter options for the results formatter class.
-formatter_arg_parser = clazz.arg_parser()
-if results_formatter_options and len(results_formatter_options) > 0:
-command_line_options = results_formatter_options
-else:
-command_line_options = []
-
-formatter_options = formatter_arg_parser.parse_args(
-command_line_options)
-
-# Create the TestResultsFormatter given the processed options.
-results_formatter_object = clazz(
-results_file_object, formatter_options)
-
-# Start the results formatter session - we'll only have one
-# during a given dotest process invocation.
+# Send an intialize message to the formatter.
 initialize_event = EventBuilder.bare_event("initialize")
 if isMultiprocessTestRunner():
 if test_runner_name is not None and test_runner_name == "serial":
@@ -989,19 +939,11 @@ def setupTestResults():
 worker_count = 1
 initialize_event["worker_count"] = worker_count
 
-results_formatter_object.handle_ev

Re: [Lldb-commits] [lldb] r254979 - Refactor ResultsFormatter creation into result_formatter.

2015-12-07 Thread Zachary Turner via lldb-commits
I'm going to have to merge this into my patch.  Can you hold off on any
other patches until I get in?

On Mon, Dec 7, 2015 at 4:56 PM Todd Fiala via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: tfiala
> Date: Mon Dec  7 18:53:56 2015
> New Revision: 254979
>
> URL: http://llvm.org/viewvc/llvm-project?rev=254979&view=rev
> Log:
> Refactor ResultsFormatter creation into result_formatter.
>
> This cleans up dotest.py and is a pre-step for getting
> the test inferior runner to send post-inferior run events
> to the events collector, as this code needs to be accessed
> from within dosep.py.
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254979&r1=254978&r2=254979&view=diff
>
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7
> 18:53:56 2015
> @@ -239,7 +239,6 @@ test_runner_name = None
>  # Test results handling globals
>  results_filename = None
>  results_port = None
> -results_file_object = None
>  results_formatter_name = None
>  results_formatter_object = None
>  results_formatter_options = None
> @@ -910,73 +909,24 @@ def createSocketToLocalPort(port):
>  def setupTestResults():
>  """Sets up test results-related objects based on arg settings."""
>  global results_filename
> -global results_file_object
>  global results_formatter_name
>  global results_formatter_object
>  global results_formatter_options
>  global results_port
>
> -default_formatter_name = None
> -cleanup_func = None
> +# Setup the results formatter configuration.
> +config = result_formatter.FormatterConfig()
> +config.filename = results_filename
> +config.formatter_name = results_formatter_name
> +config.formatter_options = results_formatter_options
> +config.port = results_port
> +
> +# Create the results formatter.
> +formatter_spec = result_formatter.create_results_formatter(config)
> +if formatter_spec is not None and formatter_spec.formatter is not
> None:
> +results_formatter_object = formatter_spec.formatter
>
> -if results_filename:
> -# Open the results file for writing.
> -if results_filename == 'stdout':
> -results_file_object = sys.stdout
> -cleanup_func = None
> -elif results_filename == 'stderr':
> -results_file_object = sys.stderr
> -cleanup_func = None
> -else:
> -results_file_object = open(results_filename, "w")
> -cleanup_func = results_file_object.close
> -default_formatter_name =
> "lldbsuite.test.result_formatter.XunitFormatter"
> -elif results_port:
> -# Connect to the specified localhost port.
> -results_file_object, cleanup_func = createSocketToLocalPort(
> -results_port)
> -default_formatter_name = (
> -"lldbsuite.test.result_formatter.RawPickledFormatter")
> -
> -# If we have a results formatter name specified and we didn't specify
> -# a results file, we should use stdout.
> -if results_formatter_name is not None and results_file_object is None:
> -# Use stdout.
> -results_file_object = sys.stdout
> -cleanup_func = None
> -
> -if results_file_object:
> -# We care about the formatter.  Choose user-specified or, if
> -# none specified, use the default for the output type.
> -if results_formatter_name:
> -formatter_name = results_formatter_name
> -else:
> -formatter_name = default_formatter_name
> -
> -# Create an instance of the class.
> -# First figure out the package/module.
> -components = formatter_name.split(".")
> -module = importlib.import_module(".".join(components[:-1]))
> -
> -# Create the class name we need to load.
> -clazz = getattr(module, components[-1])
> -
> -# Handle formatter options for the results formatter class.
> -formatter_arg_parser = clazz.arg_parser()
> -if results_formatter_options and len(results_formatter_options) >
> 0:
> -command_line_options = results_formatter_options
> -else:
> -command_line_options = []
> -
> -formatter_options = formatter_arg_parser.parse_args(
> -command_line_options)
> -
> -# Create the TestResultsFormatter given the processed options.
> -results_formatter_object = clazz(
> -results_file_object, formatter_options)
> -
> -# Start the results formatter session - we'll only have one
> -# during a given dotest process inv

[Lldb-commits] [lldb] r254980 - Trying to submit 254476 one more time. This implement -gmodule debugging support.

2015-12-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon Dec  7 19:02:08 2015
New Revision: 254980

URL: http://llvm.org/viewvc/llvm-project?rev=254980&view=rev
Log:
Trying to submit 254476 one more time. This implement -gmodule debugging 
support.

It was previously reverted due to issues that showed up only on linux. I was 
able to reproduce these issues and fix the underlying cause.

So this is the same patch as 254476 with the following two fixes:
- Fix not trying to complete classes that don't have external sources
- Fix ClangASTSource::CompleteType() to check the decl context of types that it 
finds by basename to ensure we don't complete a type "S" with a type like 
"std::S". Before this fix ClangASTSource::CompleteType() would accept _any_ 
type that had a matching basename and copy it into the other type.




Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/include/lldb/lldb-private-enumerations.h

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/source/Symbol/Type.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=254980&r1=254979&r2=254980&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Dec  7 19:02:08 2015
@@ -151,7 +151,16 @@ public:
 {
 return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
 }
-
+
+static void
+DumpDeclHiearchy (clang::Decl *decl);
+
+static void
+DumpDeclContextHiearchy (clang::DeclContext *decl_ctx);
+
+static bool
+DeclsAreEquivalent (clang::Decl *lhs_decl, clang::Decl *rhs_decl);
+
 static bool
 GetCompleteDecl (clang::ASTContext *ast,
  clang::Decl *decl);
@@ -1006,10 +1015,18 @@ public:
lldb::AccessType access,
bool is_artificial);
 
-bool
+static bool
 SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern);
 
-
+
+static bool
+CanImport (const CompilerType &type, lldb_private::ClangASTImporter 
&importer);
+
+static bool
+Import (const CompilerType &type, lldb_private::ClangASTImporter 
&importer);
+
+static bool
+GetHasExternalStorage (const CompilerType &type);
 //--
 // Tag Declarations
 //--
@@ -1092,13 +1109,19 @@ public:
 
 void
 DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream *s) 
override;
-
+
+static void
+DumpTypeName (const CompilerType &type);
+
 static clang::EnumDecl *
 GetAsEnumDecl (const CompilerType& type);
 
 static clang::RecordDecl *
 GetAsRecordDecl (const CompilerType& type);
-
+
+static clang::TagDecl *
+GetAsTagDecl (const CompilerType& type);
+
 clang::CXXRecordDecl *
 GetAsCXXRecordDecl (lldb::opaque_compiler_type_t type);
 
@@ -1109,9 +1132,12 @@ public:
 GetQualType (const CompilerType& type)
 {
 // Make sure we have a clang type before making a clang::QualType
-ClangASTContext *ast = 
llvm::dyn_cast_or_null(type.GetTypeSystem());
-if (ast)
-return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
+if (type.GetOpaqueQualType())
+{
+ClangASTContext *ast = 
llvm::dyn_cast_or_null(type.GetTypeSystem());
+if (ast)
+return 
clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
+}
 return clang::QualType();
 }
 

Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: 
http://llvm.or

Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
zturner added a comment.

This is mostly mechanical, and since it looks like we have 2 people making big 
changes at the same time I'll go ahead and put this in so we don't step on each 
others' toes.  But feel free to revert if this breaks anything.  If you do 
experience any errors, it is most likely to be an unbound variable reference, 
which you can probably fix by changing `x` to `configuration.x`.  But I think I 
got everything.


http://reviews.llvm.org/D15318



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


[Lldb-commits] [lldb] r254983 - Move LLDBTestResult class to its own module.

2015-12-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Dec  7 19:15:44 2015
New Revision: 254983

URL: http://llvm.org/viewvc/llvm-project?rev=254983&view=rev
Log:
Move LLDBTestResult class to its own module.

Added:
lldb/trunk/packages/Python/lldbsuite/test/test_result.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/configuration.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=254983&r1=254982&r2=254983&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Mon Dec  7 
19:15:44 2015
@@ -221,3 +221,14 @@ all_tests = set()
 # safe default
 setCrashInfoHook = lambda x : None
 __setupCrashInfoHook()
+
+def shouldSkipBecauseOfCategories(test_categories):
+if useCategories:
+if len(test_categories) == 0 or len(categoriesList & 
set(test_categories)) == 0:
+return True
+
+for category in skipCategories:
+if category in test_categories:
+return True
+
+return False

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254983&r1=254982&r2=254983&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7 19:15:44 2015
@@ -45,6 +45,7 @@ from . import dotest_args
 from . import lldbtest_config
 from . import test_categories
 from . import result_formatter
+from . import test_result
 from .result_formatter import EventBuilder
 from ..support import seven
 
@@ -197,17 +198,6 @@ o GDB_REMOTE_LOG: if defined, specifies
 """)
 sys.exit(0)
 
-def shouldSkipBecauseOfCategories(test_categories):
-if configuration.useCategories:
-if len(test_categories) == 0 or len(configuration.categoriesList & 
set(test_categories)) == 0:
-return True
-
-for category in configuration.skipCategories:
-if category in test_categories:
-return True
-
-return False
-
 def parseOptionsAndInitTestdirs():
 """Initialize the list of directories containing our unittest scripts.
 
@@ -787,7 +777,7 @@ def setupSysPath():
 if lldbtest_config.lldbExec and is_exe(lldbtest_config.lldbExec + "-mi"):
 lldbMiExec = lldbtest_config.lldbExec + "-mi"
 if not lldbMiExec:
-if not shouldSkipBecauseOfCategories(["lldb-mi"]):
+if not configuration.shouldSkipBecauseOfCategories(["lldb-mi"]):
 print("The 'lldb-mi' executable cannot be located.  The lldb-mi 
tests can not be run as a result.")
 configuration.skipCategories.append("lldb-mi")
 else:
@@ -1365,222 +1355,6 @@ def run_suite():
  % (configuration.suite.countTestCases(),
 configuration.suite.countTestCases() != 1 
and "s" or ""))
 
-class LLDBTestResult(unittest2.TextTestResult):
-"""
-Enforce a singleton pattern to allow introspection of test 
progress.
-
-Overwrite addError(), addFailure(), and addExpectedFailure() 
methods
-to enable each test instance to track its failure/error 
status.  It
-is used in the LLDB test framework to emit detailed trace 
messages
-to a log file for easier human inspection of test 
failures/errors.
-"""
-__singleton__ = None
-__ignore_singleton__ = False
-
-@staticmethod
-def getTerminalSize():
-import os
-env = os.environ
-def ioctl_GWINSZ(fd):
-try:
-import fcntl, termios, struct, os
-cr = struct.unpack('hh', fcntl.ioctl(fd, 
termios.TIOCGWINSZ,
-'1234'))
-except:
-return
-return cr
-cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
-if not cr:
-try:
-fd = os.open(os.ctermid(), os.O_RDONLY)
-cr = ioctl_GWINSZ(fd)
-os.close(fd)
-except:
-pass
-if not cr:
-cr = (env.get('LINES', 25), env.get('COLUMNS', 80))
-return int(cr[1]), int(cr[0])
-
-def __init__(self, *args):
-if not LLDBTestResult.__ignore_singleton__ and 
LLDB

Re: [Lldb-commits] [lldb] r254979 - Refactor ResultsFormatter creation into result_formatter.

2015-12-07 Thread Todd Fiala via lldb-commits
Yep sure thing.

On Mon, Dec 7, 2015 at 5:00 PM, Zachary Turner  wrote:

> I'm going to have to merge this into my patch.  Can you hold off on any
> other patches until I get in?
>
> On Mon, Dec 7, 2015 at 4:56 PM Todd Fiala via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> Author: tfiala
>> Date: Mon Dec  7 18:53:56 2015
>> New Revision: 254979
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=254979&view=rev
>> Log:
>> Refactor ResultsFormatter creation into result_formatter.
>>
>> This cleans up dotest.py and is a pre-step for getting
>> the test inferior runner to send post-inferior run events
>> to the events collector, as this code needs to be accessed
>> from within dosep.py.
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254979&r1=254978&r2=254979&view=diff
>>
>> ==
>> --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7
>> 18:53:56 2015
>> @@ -239,7 +239,6 @@ test_runner_name = None
>>  # Test results handling globals
>>  results_filename = None
>>  results_port = None
>> -results_file_object = None
>>  results_formatter_name = None
>>  results_formatter_object = None
>>  results_formatter_options = None
>> @@ -910,73 +909,24 @@ def createSocketToLocalPort(port):
>>  def setupTestResults():
>>  """Sets up test results-related objects based on arg settings."""
>>  global results_filename
>> -global results_file_object
>>  global results_formatter_name
>>  global results_formatter_object
>>  global results_formatter_options
>>  global results_port
>>
>> -default_formatter_name = None
>> -cleanup_func = None
>> +# Setup the results formatter configuration.
>> +config = result_formatter.FormatterConfig()
>> +config.filename = results_filename
>> +config.formatter_name = results_formatter_name
>> +config.formatter_options = results_formatter_options
>> +config.port = results_port
>> +
>> +# Create the results formatter.
>> +formatter_spec = result_formatter.create_results_formatter(config)
>> +if formatter_spec is not None and formatter_spec.formatter is not
>> None:
>> +results_formatter_object = formatter_spec.formatter
>>
>> -if results_filename:
>> -# Open the results file for writing.
>> -if results_filename == 'stdout':
>> -results_file_object = sys.stdout
>> -cleanup_func = None
>> -elif results_filename == 'stderr':
>> -results_file_object = sys.stderr
>> -cleanup_func = None
>> -else:
>> -results_file_object = open(results_filename, "w")
>> -cleanup_func = results_file_object.close
>> -default_formatter_name =
>> "lldbsuite.test.result_formatter.XunitFormatter"
>> -elif results_port:
>> -# Connect to the specified localhost port.
>> -results_file_object, cleanup_func = createSocketToLocalPort(
>> -results_port)
>> -default_formatter_name = (
>> -"lldbsuite.test.result_formatter.RawPickledFormatter")
>> -
>> -# If we have a results formatter name specified and we didn't specify
>> -# a results file, we should use stdout.
>> -if results_formatter_name is not None and results_file_object is
>> None:
>> -# Use stdout.
>> -results_file_object = sys.stdout
>> -cleanup_func = None
>> -
>> -if results_file_object:
>> -# We care about the formatter.  Choose user-specified or, if
>> -# none specified, use the default for the output type.
>> -if results_formatter_name:
>> -formatter_name = results_formatter_name
>> -else:
>> -formatter_name = default_formatter_name
>> -
>> -# Create an instance of the class.
>> -# First figure out the package/module.
>> -components = formatter_name.split(".")
>> -module = importlib.import_module(".".join(components[:-1]))
>> -
>> -# Create the class name we need to load.
>> -clazz = getattr(module, components[-1])
>> -
>> -# Handle formatter options for the results formatter class.
>> -formatter_arg_parser = clazz.arg_parser()
>> -if results_formatter_options and len(results_formatter_options)
>> > 0:
>> -command_line_options = results_formatter_options
>> -else:
>> -command_line_options = []
>> -
>> -formatter_options = formatter_arg_parser.parse_args(
>> -command_line_options)
>> -
>> -# Create the TestResultsFormatter given the processed options.
>> -results_fo

Re: [Lldb-commits] [lldb] r254979 - Refactor ResultsFormatter creation into result_formatter.

2015-12-07 Thread Todd Fiala via lldb-commits
(We're highly intersecting right now - I've got some other goo that I
figured I'd hold off on since I'm sure we're hitting the same files).

On Mon, Dec 7, 2015 at 9:21 PM, Todd Fiala  wrote:

> Yep sure thing.
>
> On Mon, Dec 7, 2015 at 5:00 PM, Zachary Turner  wrote:
>
>> I'm going to have to merge this into my patch.  Can you hold off on any
>> other patches until I get in?
>>
>> On Mon, Dec 7, 2015 at 4:56 PM Todd Fiala via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>>
>>> Author: tfiala
>>> Date: Mon Dec  7 18:53:56 2015
>>> New Revision: 254979
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=254979&view=rev
>>> Log:
>>> Refactor ResultsFormatter creation into result_formatter.
>>>
>>> This cleans up dotest.py and is a pre-step for getting
>>> the test inferior runner to send post-inferior run events
>>> to the events collector, as this code needs to be accessed
>>> from within dosep.py.
>>>
>>> Modified:
>>> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>>> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>>>
>>> Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254979&r1=254978&r2=254979&view=diff
>>>
>>> ==
>>> --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
>>> +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7
>>> 18:53:56 2015
>>> @@ -239,7 +239,6 @@ test_runner_name = None
>>>  # Test results handling globals
>>>  results_filename = None
>>>  results_port = None
>>> -results_file_object = None
>>>  results_formatter_name = None
>>>  results_formatter_object = None
>>>  results_formatter_options = None
>>> @@ -910,73 +909,24 @@ def createSocketToLocalPort(port):
>>>  def setupTestResults():
>>>  """Sets up test results-related objects based on arg settings."""
>>>  global results_filename
>>> -global results_file_object
>>>  global results_formatter_name
>>>  global results_formatter_object
>>>  global results_formatter_options
>>>  global results_port
>>>
>>> -default_formatter_name = None
>>> -cleanup_func = None
>>> +# Setup the results formatter configuration.
>>> +config = result_formatter.FormatterConfig()
>>> +config.filename = results_filename
>>> +config.formatter_name = results_formatter_name
>>> +config.formatter_options = results_formatter_options
>>> +config.port = results_port
>>> +
>>> +# Create the results formatter.
>>> +formatter_spec = result_formatter.create_results_formatter(config)
>>> +if formatter_spec is not None and formatter_spec.formatter is not
>>> None:
>>> +results_formatter_object = formatter_spec.formatter
>>>
>>> -if results_filename:
>>> -# Open the results file for writing.
>>> -if results_filename == 'stdout':
>>> -results_file_object = sys.stdout
>>> -cleanup_func = None
>>> -elif results_filename == 'stderr':
>>> -results_file_object = sys.stderr
>>> -cleanup_func = None
>>> -else:
>>> -results_file_object = open(results_filename, "w")
>>> -cleanup_func = results_file_object.close
>>> -default_formatter_name =
>>> "lldbsuite.test.result_formatter.XunitFormatter"
>>> -elif results_port:
>>> -# Connect to the specified localhost port.
>>> -results_file_object, cleanup_func = createSocketToLocalPort(
>>> -results_port)
>>> -default_formatter_name = (
>>> -"lldbsuite.test.result_formatter.RawPickledFormatter")
>>> -
>>> -# If we have a results formatter name specified and we didn't
>>> specify
>>> -# a results file, we should use stdout.
>>> -if results_formatter_name is not None and results_file_object is
>>> None:
>>> -# Use stdout.
>>> -results_file_object = sys.stdout
>>> -cleanup_func = None
>>> -
>>> -if results_file_object:
>>> -# We care about the formatter.  Choose user-specified or, if
>>> -# none specified, use the default for the output type.
>>> -if results_formatter_name:
>>> -formatter_name = results_formatter_name
>>> -else:
>>> -formatter_name = default_formatter_name
>>> -
>>> -# Create an instance of the class.
>>> -# First figure out the package/module.
>>> -components = formatter_name.split(".")
>>> -module = importlib.import_module(".".join(components[:-1]))
>>> -
>>> -# Create the class name we need to load.
>>> -clazz = getattr(module, components[-1])
>>> -
>>> -# Handle formatter options for the results formatter class.
>>> -formatter_arg_parser = clazz.arg_parser()
>>> -if results_formatter_options and len(results_formatter_options)
>>> > 0:
>>> -com

Re: [Lldb-commits] [lldb] r254946 - Rename test_results.py to result_formatter.py.

2015-12-07 Thread Todd Fiala via lldb-commits
Yep all good.  We'll get to it soon enough.

On Mon, Dec 7, 2015 at 4:30 PM, Zachary Turner  wrote:

> Yea, that actually came up on my radar too, but when I tried to do more
> things at once it started turning into a rats nest.  Refactoring Python is
> kind of hard so I want to make the changes as small as possible that if
> anything breaks, bisecting will narrow the problem down as much as possible.
>
> On Mon, Dec 7, 2015 at 3:35 PM Todd Fiala  wrote:
>
>> This is okay, but I was planning on breaking that out into multiple
>> files.  Right now the test_results module also has the EventBuilder in it,
>> which is not a results formatter.  But we can break that out separately.
>>
>> On Mon, Dec 7, 2015 at 1:23 PM, Zachary Turner via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>>
>>> Author: zturner
>>> Date: Mon Dec  7 15:23:41 2015
>>> New Revision: 254946
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=254946&view=rev
>>> Log:
>>> Rename test_results.py to result_formatter.py.
>>>
>>> There is already a class called LLDBTestResults which I would like
>>> to move into a separate file, but the most appropriate filename
>>> was taken.
>>>
>>> Added:
>>> lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
>>>   - copied, changed from r254944,
>>> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
>>> Removed:
>>> lldb/trunk/packages/Python/lldbsuite/test/test_results.py
>>> Modified:
>>> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>>> lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
>>> lldb/trunk/packages/Python/lldbsuite/test/dosep.py
>>> lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>>>
>>> Modified:
>>> lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py?rev=254946&r1=254945&r2=254946&view=diff
>>>
>>> ==
>>> --- lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>>> (original)
>>> +++ lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
>>> Mon Dec  7 15:23:41 2015
>>> @@ -13,10 +13,11 @@ from __future__ import print_function
>>>  import os
>>>
>>>  # Our imports
>>> -from . import test_results
>>> +from . import result_formatter
>>>  import lldbsuite
>>>
>>> -class BasicResultsFormatter(test_results.ResultsFormatter):
>>> +
>>> +class BasicResultsFormatter(result_formatter.ResultsFormatter):
>>>  """Provides basic test result output."""
>>>  @classmethod
>>>  def arg_parser(cls):
>>> @@ -240,16 +241,16 @@ class BasicResultsFormatter(test_results
>>>  # Output each of the test result entries.
>>>  categories = [
>>>  # result id, printed name, print matching tests?, detail
>>> label
>>> -[test_results.EventBuilder.STATUS_SUCCESS,
>>> +[result_formatter.EventBuilder.STATUS_SUCCESS,
>>>   "Success", False, None],
>>> -[test_results.EventBuilder.STATUS_EXPECTED_FAILURE,
>>> +[result_formatter.EventBuilder.STATUS_EXPECTED_FAILURE,
>>>   "Expected Failure", False, None],
>>> -[test_results.EventBuilder.STATUS_FAILURE,
>>> +[result_formatter.EventBuilder.STATUS_FAILURE,
>>>   "Failure", True, "FAIL"],
>>> -[test_results.EventBuilder.STATUS_ERROR, "Error", True,
>>> "ERROR"],
>>> -[test_results.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
>>> +[result_formatter.EventBuilder.STATUS_ERROR, "Error", True,
>>> "ERROR"],
>>> +[result_formatter.EventBuilder.STATUS_UNEXPECTED_SUCCESS,
>>>   "Unexpected Success", True, "UNEXPECTED SUCCESS"],
>>> -[test_results.EventBuilder.STATUS_SKIP, "Skip", False,
>>> None]]
>>> +[result_formatter.EventBuilder.STATUS_SKIP, "Skip", False,
>>> None]]
>>>
>>>  # Partition all the events by test result status
>>>  result_events_by_status = self._partition_results_by_status(
>>>
>>> Modified: lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/curses_results.py?rev=254946&r1=254945&r2=254946&view=diff
>>>
>>> ==
>>> --- lldb/trunk/packages/Python/lldbsuite/test/curses_results.py
>>> (original)
>>> +++ lldb/trunk/packages/Python/lldbsuite/test/curses_results.py Mon Dec
>>> 7 15:23:41 2015
>>> @@ -23,11 +23,11 @@ import time
>>>
>>>  # LLDB modules
>>>  from . import lldbcurses
>>> -from . import test_results
>>> -from .test_results import EventBuilder
>>> +from . import result_formatter
>>> +from .result_formatter import EventBuilder
>>>
>>>
>>> -class Curses(test_results.ResultsFormatter):
>>> +class Curses(result_formatter.ResultsForma

Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

Yep, sounds good.  I saw it go in.  I'll do a couple runs here but I'm sure 
we'll fix up anything if something breaks.  I much prefer to get it in :-)


http://reviews.llvm.org/D15318



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


Re: [Lldb-commits] [lldb] r254979 - Refactor ResultsFormatter creation into result_formatter.

2015-12-07 Thread Zachary Turner via lldb-commits
I'll hold off a bit on major changes for now.  I'm going to start working
on non-controversial command line options tomorrow, but no more major code
moves.  I worked on this today since I wanted to get final agreement on the
command line options first.

On Mon, Dec 7, 2015 at 9:21 PM Todd Fiala  wrote:

> (We're highly intersecting right now - I've got some other goo that I
> figured I'd hold off on since I'm sure we're hitting the same files).
>
> On Mon, Dec 7, 2015 at 9:21 PM, Todd Fiala  wrote:
>
>> Yep sure thing.
>>
>> On Mon, Dec 7, 2015 at 5:00 PM, Zachary Turner 
>> wrote:
>>
>>> I'm going to have to merge this into my patch.  Can you hold off on any
>>> other patches until I get in?
>>>
>>> On Mon, Dec 7, 2015 at 4:56 PM Todd Fiala via lldb-commits <
>>> lldb-commits@lists.llvm.org> wrote:
>>>
 Author: tfiala
 Date: Mon Dec  7 18:53:56 2015
 New Revision: 254979

 URL: http://llvm.org/viewvc/llvm-project?rev=254979&view=rev
 Log:
 Refactor ResultsFormatter creation into result_formatter.

 This cleans up dotest.py and is a pre-step for getting
 the test inferior runner to send post-inferior run events
 to the events collector, as this code needs to be accessed
 from within dosep.py.

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

 Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
 URL:
 http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=254979&r1=254978&r2=254979&view=diff

 ==
 --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
 +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec  7
 18:53:56 2015
 @@ -239,7 +239,6 @@ test_runner_name = None
  # Test results handling globals
  results_filename = None
  results_port = None
 -results_file_object = None
  results_formatter_name = None
  results_formatter_object = None
  results_formatter_options = None
 @@ -910,73 +909,24 @@ def createSocketToLocalPort(port):
  def setupTestResults():
  """Sets up test results-related objects based on arg settings."""
  global results_filename
 -global results_file_object
  global results_formatter_name
  global results_formatter_object
  global results_formatter_options
  global results_port

 -default_formatter_name = None
 -cleanup_func = None
 +# Setup the results formatter configuration.
 +config = result_formatter.FormatterConfig()
 +config.filename = results_filename
 +config.formatter_name = results_formatter_name
 +config.formatter_options = results_formatter_options
 +config.port = results_port
 +
 +# Create the results formatter.
 +formatter_spec = result_formatter.create_results_formatter(config)
 +if formatter_spec is not None and formatter_spec.formatter is not
 None:
 +results_formatter_object = formatter_spec.formatter

 -if results_filename:
 -# Open the results file for writing.
 -if results_filename == 'stdout':
 -results_file_object = sys.stdout
 -cleanup_func = None
 -elif results_filename == 'stderr':
 -results_file_object = sys.stderr
 -cleanup_func = None
 -else:
 -results_file_object = open(results_filename, "w")
 -cleanup_func = results_file_object.close
 -default_formatter_name =
 "lldbsuite.test.result_formatter.XunitFormatter"
 -elif results_port:
 -# Connect to the specified localhost port.
 -results_file_object, cleanup_func = createSocketToLocalPort(
 -results_port)
 -default_formatter_name = (
 -"lldbsuite.test.result_formatter.RawPickledFormatter")
 -
 -# If we have a results formatter name specified and we didn't
 specify
 -# a results file, we should use stdout.
 -if results_formatter_name is not None and results_file_object is
 None:
 -# Use stdout.
 -results_file_object = sys.stdout
 -cleanup_func = None
 -
 -if results_file_object:
 -# We care about the formatter.  Choose user-specified or, if
 -# none specified, use the default for the output type.
 -if results_formatter_name:
 -formatter_name = results_formatter_name
 -else:
 -formatter_name = default_formatter_name
 -
 -# Create an instance of the class.
 -# First figure out the package/module.
 -components = formatter_name.split(".")
>>

Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Here's what I'm seeing so far (as of r254983) when running on OS X:

  $ test/dotest.py --results-formatter 
lldbsuite.test.basic_results_formatter.BasicResultsFormatter
  Traceback (most recent call last):
File "test/dotest.py", line 6, in 
  import lldbsuite.test
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py", 
line 5, in 
  from . import dotest
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py", 
line 43, in 
  from . import configuration
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 223, in 
  __setupCrashInfoHook()
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 33, in __setupCrashInfoHook
  test_dir = os.environ['LLDB_TEST']
File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
 line 23, in __getitem__
  raise KeyError(key)
  KeyError: 'LLDB_TEST'



  $ test/dotest.py --curses
  Traceback (most recent call last):
File "test/dotest.py", line 6, in 
  import lldbsuite.test
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py", 
line 5, in 
  from . import dotest
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py", 
line 43, in 
  from . import configuration
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 223, in 
  __setupCrashInfoHook()
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 33, in __setupCrashInfoHook
  test_dir = os.environ['LLDB_TEST']
File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
 line 23, in __getitem__
  raise KeyError(key)
  KeyError: 'LLDB_TEST'



  $ test/dotest.py
  Traceback (most recent call last):
File "test/dotest.py", line 6, in 
  import lldbsuite.test
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py", 
line 5, in 
  from . import dotest
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py", 
line 43, in 
  from . import configuration
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 223, in 
  __setupCrashInfoHook()
File 
"/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
 line 33, in __setupCrashInfoHook
  test_dir = os.environ['LLDB_TEST']
File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
 line 23, in __getitem__
  raise KeyError(key)
  KeyError: 'LLDB_TEST'


http://reviews.llvm.org/D15318



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


Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
Hmm, yea that code path only gets run on OSX.  I think the problem is that
I changed the order that happens in.  It now happens right when you import
`configuration` for the first time, and it used to happen explicitly in
`main()`.  So maybe just make that function public, and call in the same
place it used to be called.

On Mon, Dec 7, 2015 at 9:55 PM Todd Fiala  wrote:

> tfiala added a comment.
>
> Here's what I'm seeing so far (as of r254983) when running on OS X:
>
>   $ test/dotest.py --results-formatter
> lldbsuite.test.basic_results_formatter.BasicResultsFormatter
>   Traceback (most recent call last):
> File "test/dotest.py", line 6, in 
>   import lldbsuite.test
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py",
> line 5, in 
>   from . import dotest
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py",
> line 43, in 
>   from . import configuration
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 223, in 
>   __setupCrashInfoHook()
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 33, in __setupCrashInfoHook
>   test_dir = os.environ['LLDB_TEST']
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
> line 23, in __getitem__
>   raise KeyError(key)
>   KeyError: 'LLDB_TEST'
>
>
>
>   $ test/dotest.py --curses
>   Traceback (most recent call last):
> File "test/dotest.py", line 6, in 
>   import lldbsuite.test
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py",
> line 5, in 
>   from . import dotest
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py",
> line 43, in 
>   from . import configuration
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 223, in 
>   __setupCrashInfoHook()
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 33, in __setupCrashInfoHook
>   test_dir = os.environ['LLDB_TEST']
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
> line 23, in __getitem__
>   raise KeyError(key)
>   KeyError: 'LLDB_TEST'
>
>
>
>   $ test/dotest.py
>   Traceback (most recent call last):
> File "test/dotest.py", line 6, in 
>   import lldbsuite.test
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/__init__.py",
> line 5, in 
>   from . import dotest
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/dotest.py",
> line 43, in 
>   from . import configuration
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 223, in 
>   __setupCrashInfoHook()
> File
> "/Users/tfiala/src/lldb-tot/lldb/packages/Python/lldbsuite/test/configuration.py",
> line 33, in __setupCrashInfoHook
>   test_dir = os.environ['LLDB_TEST']
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
> line 23, in __getitem__
>   raise KeyError(key)
>   KeyError: 'LLDB_TEST'
>
>
> http://reviews.llvm.org/D15318
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
zturner added a subscriber: zturner.
zturner added a comment.

Hmm, yea that code path only gets run on OSX.  I think the problem is that
I changed the order that happens in.  It now happens right when you import
`configuration` for the first time, and it used to happen explicitly in
`main()`.  So maybe just make that function public, and call in the same
place it used to be called.


http://reviews.llvm.org/D15318



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


Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
To be clear, we explicitly set the LLDB_TEST environment variable as part
of initialization, and it's now trying to read the value of the environment
variable before it's been set.  At least I think anyway, I'm going off of
memory, don't have code in front of me.

On Mon, Dec 7, 2015 at 9:58 PM Zachary Turner  wrote:

> zturner added a subscriber: zturner.
> zturner added a comment.
>
> Hmm, yea that code path only gets run on OSX.  I think the problem is that
> I changed the order that happens in.  It now happens right when you import
> `configuration` for the first time, and it used to happen explicitly in
> `main()`.  So maybe just make that function public, and call in the same
> place it used to be called.
>
>
> http://reviews.llvm.org/D15318
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15318: Get rid of global variables in dotest.py

2015-12-07 Thread Zachary Turner via lldb-commits
zturner added a comment.

To be clear, we explicitly set the LLDB_TEST environment variable as part
of initialization, and it's now trying to read the value of the environment
variable before it's been set.  At least I think anyway, I'm going off of
memory, don't have code in front of me.


http://reviews.llvm.org/D15318



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


[Lldb-commits] [lldb] r255005 - [LLDB][MIPS] Handle PIC calling convention for MIPS32

2015-12-07 Thread Bhushan D. Attarde via lldb-commits
Author: bhushan.attarde
Date: Tue Dec  8 00:05:57 2015
New Revision: 255005

URL: http://llvm.org/viewvc/llvm-project?rev=255005&view=rev
Log:
[LLDB][MIPS] Handle PIC calling convention for MIPS32

SUMMARY:
- PrepareTrivialCall() to setup register r25 with the address of function 
to be called.
- RegisterIsCalleeSaved() to use name of a register instead of its 
byte_offset.

Reviewers: clayborg
Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
Differential Revision: http://reviews.llvm.org/D15273

Modified:
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=255005&r1=255004&r2=255005&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Tue Dec  8 
00:05:57 2015
@@ -241,6 +241,7 @@ ABISysV_mips::PrepareTrivialCall (Thread
 const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
 const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
 const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo 
(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
 
 if (log)
 log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
@@ -262,7 +263,14 @@ ABISysV_mips::PrepareTrivialCall (Thread
 // Set pc to the address of the called function.
 if (!reg_ctx->WriteRegisterFromUnsigned (pc_reg_info, func_addr))
 return false;
-
+
+if (log)
+log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+
+// All callers of position independent functions must place the address of 
the called function in t9 (r25)
+if (!reg_ctx->WriteRegisterFromUnsigned (r25_info, func_addr))
+return false;
+  
 return true;
 }
 
@@ -546,13 +554,36 @@ ABISysV_mips::RegisterIsCalleeSaved (con
 {
 // Preserved registers are :
 // r16-r23, r28, r29, r30, r31
+const char *name = reg_info->name;
 
-int reg = ((reg_info->byte_offset) / 4);
-
-bool save  = (reg >= 16) && (reg <= 23);
- save |= (reg >= 28) && (reg <= 31);
+if (name[0] == 'r')
+{
+switch (name[1])
+{
+case '1': 
+if (name[2] == '6' || name[2] == '7' || name[2] == '8' || 
name[2] == '9') // r16-r19
+return name[3] == '\0';
+break;
+case '2': 
+if (name[2] == '0' || name[2] == '1' || name[2] == '2' || 
name[2] == '3'  // r20-r23
+|| name[2] == '8' || name[2] == '9')   
   // r28 and r29
+return name[3] == '\0';
+break;
+case '3': 
+if (name[2] == '0' || name[2] == '1')   // r30 and r31
+return name[3] == '\0';
+break;
+}
 
-return save;
+if (name[0] == 'g' && name[1] == 'p' && name[2] == '\0')   // gp 
(r28)
+return true;
+if (name[0] == 's' && name[1] == 'p' && name[2] == '\0')   // sp 
(r29)
+return true;
+if (name[0] == 'f' && name[1] == 'p' && name[2] == '\0')   // fp 
(r30)
+return true;
+if (name[0] == 'r' && name[1] == 'a' && name[2] == '\0')   // ra 
(r31)
+return true;
+}
 }
 return false;
 }


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


[Lldb-commits] [PATCH] D15326: Rework breakpoint language filtering to use the symbol context's language.

2015-12-07 Thread Dawn Perchik via lldb-commits
dawn created this revision.
dawn added a reviewer: jingham.
dawn added a subscriber: lldb-commits.
dawn set the repository for this revision to rL LLVM.

This patch reworks the breakpoint filter-by-language patch to use the symbol 
context instead of trying to guess the language solely from the symbol's name.  
This has the advantage that symbols compiled with debug info will have their 
actual language known.  Symbols without debug info will still do the same 
"guess"ing because Symbol::GetLanguage() is implemented using 
Mangled::GuessLanguage().  The recognition of ObjC names was merged into 
Mangled::GuessLanguage.

Repository:
  rL LLVM

http://reviews.llvm.org/D15326

Files:
  include/lldb/Symbol/SymbolContext.h
  include/lldb/Target/Language.h
  include/lldb/Target/LanguageRuntime.h
  source/Breakpoint/BreakpointResolverName.cpp
  source/Core/Mangled.cpp
  source/Symbol/SymbolContext.cpp
  source/Target/Language.cpp
  source/Target/LanguageRuntime.cpp

Index: source/Target/LanguageRuntime.cpp
===
--- source/Target/LanguageRuntime.cpp
+++ source/Target/LanguageRuntime.cpp
@@ -345,28 +345,3 @@
 {
 return m_process->GetTarget().GetSearchFilterForModule(NULL);
 }
-
-lldb::LanguageType
-LanguageRuntime::GuessLanguageForSymbolByName (Target &target, const char *symbol_name)
-{
-// We "guess" the language because we can't determine a symbol's language from it's name.
-// For example, a Pascal symbol can be mangled using the C++ Itanium scheme, and defined
-// in a compilation unit within the same module as other C++ units.
-//
-// In addition, different targets could have different ways of mangling names from a given
-// language, likewise compilation units within those targets.  It would help to be able to
-// ask the various LanguageRuntime plugin instances for this target to recognize the name,
-// but right now the plugin instances depend on the process, not the target.  That is
-// unfortunate, because to use this for filtering breakpoints by language, we need to know
-// the "language for symbol-name" prior to running.  So we'd have to make a
-// "LanguageRuntimeTarget" and "LanguageRuntimeProcess", and direct the questions that don't
-// need a running process to the former, and that do to the latter.
-//
-// That's more work than I want to do for this feature.
-if (CPlusPlusLanguage::IsCPPMangledName (symbol_name))
-return eLanguageTypeC_plus_plus;
-else if (ObjCLanguage::IsPossibleObjCMethodName (symbol_name))
-return eLanguageTypeObjC;
-else
-return eLanguageTypeUnknown;
-}
Index: source/Target/Language.cpp
===
--- source/Target/Language.cpp
+++ source/Target/Language.cpp
@@ -287,6 +287,57 @@
 }
 }
 
+LanguageType
+Language::GetPrimaryLanguage (LanguageType language)
+{
+switch (language)
+{
+case eLanguageTypeC_plus_plus:
+case eLanguageTypeC_plus_plus_03:
+case eLanguageTypeC_plus_plus_11:
+case eLanguageTypeC_plus_plus_14:
+return eLanguageTypeC_plus_plus;
+case eLanguageTypeC:
+case eLanguageTypeC89:
+case eLanguageTypeC99:
+case eLanguageTypeC11:
+return eLanguageTypeC;
+case eLanguageTypeObjC:
+case eLanguageTypeObjC_plus_plus:
+return eLanguageTypeObjC;
+case eLanguageTypePascal83:
+case eLanguageTypeCobol74:
+case eLanguageTypeCobol85:
+case eLanguageTypeFortran77:
+case eLanguageTypeFortran90:
+case eLanguageTypeFortran95:
+case eLanguageTypeFortran03:
+case eLanguageTypeFortran08:
+case eLanguageTypeAda83:
+case eLanguageTypeAda95:
+case eLanguageTypeModula2:
+case eLanguageTypeJava:
+case eLanguageTypePLI:
+case eLanguageTypeUPC:
+case eLanguageTypeD:
+case eLanguageTypePython:
+case eLanguageTypeOpenCL:
+case eLanguageTypeGo:
+case eLanguageTypeModula3:
+case eLanguageTypeHaskell:
+case eLanguageTypeOCaml:
+case eLanguageTypeRust:
+case eLanguageTypeSwift:
+case eLanguageTypeJulia:
+case eLanguageTypeDylan:
+case eLanguageTypeMipsAssembler:
+case eLanguageTypeExtRenderScript:
+case eLanguageTypeUnknown:
+default:
+return language;
+}
+}
+
 void
 Language::GetLanguagesSupportingTypeSystems (std::set &languages,
  std::set &languages_for_expressions)
Index: source/Symbol/SymbolContext.cpp
===
--- source/Symbol/SymbolContext.cpp
+++ source/Symbol/SymbolContext.cpp
@@ -525,6 +525,38 @@
 return false;
 }
 
+LanguageType
+SymbolContext::GetLanguage () const
+{
+LanguageType lang;
+if