Re: [Lldb-commits] [PATCH] D12100: [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-19 Thread Sagar Thakur via lldb-commits
sagar added inline comments.


Comment at: include/lldb/Core/RegisterValue.h:185
@@ -190,1 +184,3 @@
+llvm::APInt
+GetAsUInt128 (llvm::APInt& fail_value, bool *success_ptr = NULL) const;
 

ovyalov wrote:
> Could you pass fail_value as a const reference?
Yes, I have changed fail_value to const reference.


Repository:
  rL LLVM

http://reviews.llvm.org/D12100



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


Re: [Lldb-commits] [PATCH] D12113: [LLDB-MI] Add (gdb) prompt after =breakpoint-modified and =breakpoint-created.

2015-08-19 Thread Hafiz Abid Qadeer via lldb-commits
abidh accepted this revision.
abidh added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D12113



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


Re: [Lldb-commits] [PATCH] D12138: On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Pavel Labath via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks good. Thanks for catching this.

Does the test you mentioned pass after this, or does it still fail 
intermittently as the original bug indicates? If it seems to pass, you should 
also enable the test.


http://reviews.llvm.org/D12138



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


Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line when Windows filenames are used.

2015-08-19 Thread Hafiz Abid Qadeer via lldb-commits
abidh added a comment.

This command uses "target modules lookup" to obtain the information while 
-symbol-list-lines uses "target modules dump line-table". Although there is 
difference in the format of the output of these 2 commands, the format for path 
and line is same. I think we should have one code handling path strings in both 
of these places to avoid duplication.

It would be even better if we have some API which we can use to query this 
data. Then there would be no need for this parsing.


Repository:
  rL LLVM

http://reviews.llvm.org/D12115



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


Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 32526.
labath marked 4 inline comments as done.
labath added a comment.

- Address review comments


http://reviews.llvm.org/D12104

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  test/functionalities/thread/create_during_instruction_step/Makefile
  
test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
  test/functionalities/thread/create_during_instruction_step/main.cpp

Index: test/functionalities/thread/create_during_instruction_step/main.cpp
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/main.cpp
@@ -0,0 +1,36 @@
+//===-- main.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+#include 
+
+std::atomic flag(false);
+
+void do_nothing()
+{
+while (flag)
+;
+}
+
+int main ()
+{
+// Instruction-level stepping over a creation of the first thread takes a very long time, so
+// we give the threading machinery a chance to initialize all its data structures.
+// This way, stepping over the second thread will be much faster.
+std::thread dummy(do_nothing);
+dummy.join();
+
+// Make sure the new thread does not exit before we get a chance to notice the main thread stopped
+flag = true;
+
+std::thread thread(do_nothing); // Set breakpoint here
+flag = false; // Release the new thread.
+thread.join();
+return 0;
+}
Index: test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
@@ -0,0 +1,79 @@
+"""
+This tests that we do not lose control of the inferior, while doing an instruction-level step
+over a thread creation instruction.
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class CreateDuringInstructionStepTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers to break and continue.
+self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
+
+@dsym_test
+def test_step_inst_with_dsym(self):
+self.buildDsym(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+@dwarf_test
+def test_step_inst_with_dwarf(self):
+self.buildDwarf(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+def create_during_step_inst_test(self):
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target and target.IsValid(), "Target is valid")
+
+# This should create a breakpoint in the stepping thread.
+self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=-1)
+
+# Run the program.
+process = target.LaunchSimple(None, None, self.get_process_working_directory())
+self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1,
+STOPPED_DUE_TO_BREAKPOINT)
+
+# Get the number of threads
+num_threads = process.GetNumThreads()
+
+# Make sure we see only one threads
+self.assertEqual(num_threads, 1, 'Number of expected threads and actual threads do not match.')
+
+thread = process.GetThreadAtIndex(0)
+
+# Keep stepping until we see the thread creation
+while process.GetNumThreads() < 2:
+thread.StepInstruction(False)
+self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete, "StepInstruction succeeded")
+self.assertTrue(thread and thread.IsValid(), "Thread is valid")
+if self.TraceOn():
+self.runCmd("disassemble --pc")
+
+if self.TraceOn():
+self.runCmd("thread list")
+
+# We have successfully caught thread creation. Now just run to completion
+process.Continue()
+
+# At this po

Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:1457
@@ -1453,3 +1456,3 @@
 
-thread_sp = AddThread(pid);
+thread_sp = 
std::static_pointer_cast(AddThread(pid));
 assert (thread_sp.get() && "failed to create the tracking data for 
newly created inferior thread");

ovyalov wrote:
> Since AddThread is private method of NPL we can make it to return 
> NativeThreadLinuxSP.
I've been wanting to do this as well, but I'd prefer to do this as a separate 
commit, if possible.


Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:3056
@@ +3055,3 @@
+if (step_result.Success())
+SetState(eStateRunning, true);
+return step_result;

ovyalov wrote:
> Should it be eStateStepping?
That's a good question. Previously, the state of the whole process was indeed 
set to eStateStepping, and I have (accidentally) failed to preserve that while 
refactoring.

However, now that I think about it, this had the problem that the state of the 
process was nondeterministic and depended on the order in which you resume 
threads (If you are continuing one thread and stepping another, the process 
state would depend on which thread you resumed last). The test suite passes, so 
i think we can assume no one is depending on this stepping state now, but to 
avoid introducing nondeterministic bugs in the future, I think we should just 
abolish the stepping state and say that the process is running if any of its 
threads are stepping or running.

What do you think?


http://reviews.llvm.org/D12104



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


Re: [Lldb-commits] [PATCH] D12138: On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Yacine Belkadi via lldb-commits
ybelkadi updated this revision to Diff 32529.
ybelkadi added a comment.

Yes, the test passes, but as PR19246 reported intermittent failures, I thought 
I'd wait for the results of the tests run by the bots.

Here is an updated patch also enabling the test. Could you please commit it if 
it's accepted?


http://reviews.llvm.org/D12138

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  test/expression_command/call-restarts/TestCallThatRestarts.py

Index: test/expression_command/call-restarts/TestCallThatRestarts.py
===
--- test/expression_command/call-restarts/TestCallThatRestarts.py
+++ test/expression_command/call-restarts/TestCallThatRestarts.py
@@ -29,7 +29,6 @@
 
 @dwarf_test
 @skipIfFreeBSD # llvm.org/pr19246: intermittent failure
-@expectedFailureLinux("llvm.org/pr19246")
 @skipIfDarwin # llvm.org/pr19246: intermittent failure
 @skipIfWindows # Test relies on signals, unsupported on Windows
 def test_with_dwarf(self):
Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -554,7 +554,8 @@
 eDupStderrFailed,
 eChdirFailed,
 eExecFailed,
-eSetGidFailed
+eSetGidFailed,
+eSetSigMaskFailed
 };
 
 // Child process.
@@ -629,6 +630,12 @@
 }
 }
 
+// Clear the signal mask to prevent the child from being affected by
+// any masking done by the parent.
+sigset_t set;
+if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, 
nullptr) != 0)
+exit(eSetSigMaskFailed);
+
 // Execute.  We should never return...
 execve(argv[0],
const_cast(argv),
@@ -686,6 +693,9 @@
 case eSetGidFailed:
 error.SetErrorString("Child setgid failed.");
 break;
+case eSetSigMaskFailed:
+error.SetErrorString("Child failed to set signal mask.");
+break;
 default:
 error.SetErrorString("Child returned unknown exit status.");
 break;


Index: test/expression_command/call-restarts/TestCallThatRestarts.py
===
--- test/expression_command/call-restarts/TestCallThatRestarts.py
+++ test/expression_command/call-restarts/TestCallThatRestarts.py
@@ -29,7 +29,6 @@
 
 @dwarf_test
 @skipIfFreeBSD # llvm.org/pr19246: intermittent failure
-@expectedFailureLinux("llvm.org/pr19246")
 @skipIfDarwin # llvm.org/pr19246: intermittent failure
 @skipIfWindows # Test relies on signals, unsupported on Windows
 def test_with_dwarf(self):
Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -554,7 +554,8 @@
 eDupStderrFailed,
 eChdirFailed,
 eExecFailed,
-eSetGidFailed
+eSetGidFailed,
+eSetSigMaskFailed
 };
 
 // Child process.
@@ -629,6 +630,12 @@
 }
 }
 
+// Clear the signal mask to prevent the child from being affected by
+// any masking done by the parent.
+sigset_t set;
+if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0)
+exit(eSetSigMaskFailed);
+
 // Execute.  We should never return...
 execve(argv[0],
const_cast(argv),
@@ -686,6 +693,9 @@
 case eSetGidFailed:
 error.SetErrorString("Child setgid failed.");
 break;
+case eSetSigMaskFailed:
+error.SetErrorString("Child failed to set signal mask.");
+break;
 default:
 error.SetErrorString("Child returned unknown exit status.");
 break;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r245428 - Fix lldb-server arm-linux-g++ build

2015-08-19 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Wed Aug 19 05:44:16 2015
New Revision: 245428

URL: http://llvm.org/viewvc/llvm-project?rev=245428&view=rev
Log:
Fix lldb-server arm-linux-g++ build


Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=245428&r1=245427&r2=245428&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Aug 19 
05:44:16 2015
@@ -3284,7 +3284,7 @@ NativeProcessLinux::SigchldHandler()
 {
 signal = WTERMSIG(status);
 status_cstr = "SIGNALED";
-if (wait_pid == static_cast<::pid_t>(GetID())) {
+if (wait_pid == static_cast< ::pid_t>(GetID())) {
 exited = true;
 exit_status = -1;
 }


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


Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 32545.
labath added a comment.

Fix test on android arm - skip single-stepping over some functions


http://reviews.llvm.org/D12104

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  test/functionalities/thread/create_during_instruction_step/Makefile
  
test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
  test/functionalities/thread/create_during_instruction_step/main.cpp

Index: test/functionalities/thread/create_during_instruction_step/main.cpp
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/main.cpp
@@ -0,0 +1,36 @@
+//===-- main.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+#include 
+
+std::atomic flag(false);
+
+void do_nothing()
+{
+while (flag)
+;
+}
+
+int main ()
+{
+// Instruction-level stepping over a creation of the first thread takes a very long time, so
+// we give the threading machinery a chance to initialize all its data structures.
+// This way, stepping over the second thread will be much faster.
+std::thread dummy(do_nothing);
+dummy.join();
+
+// Make sure the new thread does not exit before we get a chance to notice the main thread stopped
+flag = true;
+
+std::thread thread(do_nothing); // Set breakpoint here
+flag = false; // Release the new thread.
+thread.join();
+return 0;
+}
Index: test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
@@ -0,0 +1,85 @@
+"""
+This tests that we do not lose control of the inferior, while doing an instruction-level step
+over a thread creation instruction.
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class CreateDuringInstructionStepTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers to break and continue.
+self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
+
+@dsym_test
+def test_step_inst_with_dsym(self):
+self.buildDsym(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+@dwarf_test
+def test_step_inst_with_dwarf(self):
+self.buildDwarf(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+def create_during_step_inst_test(self):
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target and target.IsValid(), "Target is valid")
+
+# This should create a breakpoint in the stepping thread.
+self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=-1)
+
+# Run the program.
+process = target.LaunchSimple(None, None, self.get_process_working_directory())
+self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1,
+STOPPED_DUE_TO_BREAKPOINT)
+
+# Get the number of threads
+num_threads = process.GetNumThreads()
+
+# Make sure we see only one threads
+self.assertEqual(num_threads, 1, 'Number of expected threads and actual threads do not match.')
+
+thread = process.GetThreadAtIndex(0)
+self.assertTrue(thread and thread.IsValid(), "Thread is valid")
+
+# Keep stepping until we see the thread creation
+while process.GetNumThreads() < 2:
+if thread.GetFrameAtIndex(0).GetFunctionName() in ['__sync_fetch_and_add_4', 'pthread_mutex_lock']:
+# This skips some functions we have trouble stepping into. Testing stepping
+# through these is not the purpose of this test. We just want to find the
+# instruction, which creates the thread.
+thread.StepOut()
+else:
+thread.StepInstruction(False)
+self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_S

Re: [Lldb-commits] [PATCH] D12138: On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Pavel Labath via lldb-commits
labath added a comment.

Ok, I see what you mean. I will commit it with the test enabled, and I will 
keep an eye out on the buildbots.


http://reviews.llvm.org/D12138



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


Re: [Lldb-commits] [PATCH] D12138: On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245436: On Linux, clear the signal mask of the launched 
inferior (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D12138?vs=32529&id=32546#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12138

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py

Index: lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
===
--- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
+++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
@@ -29,7 +29,6 @@
 
 @dwarf_test
 @skipIfFreeBSD # llvm.org/pr19246: intermittent failure
-@expectedFailureLinux("llvm.org/pr19246")
 @skipIfDarwin # llvm.org/pr19246: intermittent failure
 @skipIfWindows # Test relies on signals, unsupported on Windows
 def test_with_dwarf(self):
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -554,7 +554,8 @@
 eDupStderrFailed,
 eChdirFailed,
 eExecFailed,
-eSetGidFailed
+eSetGidFailed,
+eSetSigMaskFailed
 };
 
 // Child process.
@@ -632,6 +633,12 @@
 }
 }
 
+// Clear the signal mask to prevent the child from being affected by
+// any masking done by the parent.
+sigset_t set;
+if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, 
nullptr) != 0)
+exit(eSetSigMaskFailed);
+
 // Execute.  We should never return...
 execve(argv[0],
const_cast(argv),
@@ -689,6 +696,9 @@
 case eSetGidFailed:
 error.SetErrorString("Child setgid failed.");
 break;
+case eSetSigMaskFailed:
+error.SetErrorString("Child failed to set signal mask.");
+break;
 default:
 error.SetErrorString("Child returned unknown exit status.");
 break;


Index: lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
===
--- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
+++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
@@ -29,7 +29,6 @@
 
 @dwarf_test
 @skipIfFreeBSD # llvm.org/pr19246: intermittent failure
-@expectedFailureLinux("llvm.org/pr19246")
 @skipIfDarwin # llvm.org/pr19246: intermittent failure
 @skipIfWindows # Test relies on signals, unsupported on Windows
 def test_with_dwarf(self):
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -554,7 +554,8 @@
 eDupStderrFailed,
 eChdirFailed,
 eExecFailed,
-eSetGidFailed
+eSetGidFailed,
+eSetSigMaskFailed
 };
 
 // Child process.
@@ -632,6 +633,12 @@
 }
 }
 
+// Clear the signal mask to prevent the child from being affected by
+// any masking done by the parent.
+sigset_t set;
+if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0)
+exit(eSetSigMaskFailed);
+
 // Execute.  We should never return...
 execve(argv[0],
const_cast(argv),
@@ -689,6 +696,9 @@
 case eSetGidFailed:
 error.SetErrorString("Child setgid failed.");
 break;
+case eSetSigMaskFailed:
+error.SetErrorString("Child failed to set signal mask.");
+break;
 default:
 error.SetErrorString("Child returned unknown exit status.");
 break;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r245436 - On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Aug 19 08:47:57 2015
New Revision: 245436

URL: http://llvm.org/viewvc/llvm-project?rev=245436&view=rev
Log:
On Linux, clear the signal mask of the launched inferior

Summary:
Due to fork()/execve(), the launched inferior inherits the signal mask of its 
parent (lldb-server). But because lldb-server modifies its signal mask (It 
blocks SIGCHLD, for example), the inferior starts with some signals being 
initially blocked.

One consequence is that TestCallThatRestarts.ExprCommandThatRestartsTestCase 
(test/expression_command/call-restarts) fails because sigchld_handler() in 
lotta-signals.c is not called, due to the SIGCHLD signal being blocked.

To prevent the signal masking done by lldb-server from affecting the created 
inferior, the signal mask of the inferior is now cleared before the execve().

Patch by: Yacine Belkadi

Reviewers: ovyalov, labath

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=245436&r1=245435&r2=245436&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Aug 19 
08:47:57 2015
@@ -554,7 +554,8 @@ NativeProcessLinux::Launch(LaunchArgs *a
 eDupStderrFailed,
 eChdirFailed,
 eExecFailed,
-eSetGidFailed
+eSetGidFailed,
+eSetSigMaskFailed
 };
 
 // Child process.
@@ -632,6 +633,12 @@ NativeProcessLinux::Launch(LaunchArgs *a
 }
 }
 
+// Clear the signal mask to prevent the child from being affected by
+// any masking done by the parent.
+sigset_t set;
+if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, 
nullptr) != 0)
+exit(eSetSigMaskFailed);
+
 // Execute.  We should never return...
 execve(argv[0],
const_cast(argv),
@@ -689,6 +696,9 @@ NativeProcessLinux::Launch(LaunchArgs *a
 case eSetGidFailed:
 error.SetErrorString("Child setgid failed.");
 break;
+case eSetSigMaskFailed:
+error.SetErrorString("Child failed to set signal mask.");
+break;
 default:
 error.SetErrorString("Child returned unknown exit status.");
 break;

Modified: 
lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py?rev=245436&r1=245435&r2=245436&view=diff
==
--- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py 
(original)
+++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py 
Wed Aug 19 08:47:57 2015
@@ -29,7 +29,6 @@ class ExprCommandThatRestartsTestCase(Te
 
 @dwarf_test
 @skipIfFreeBSD # llvm.org/pr19246: intermittent failure
-@expectedFailureLinux("llvm.org/pr19246")
 @skipIfDarwin # llvm.org/pr19246: intermittent failure
 @skipIfWindows # Test relies on signals, unsupported on Windows
 def test_with_dwarf(self):


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


[Lldb-commits] [lldb] r245440 - Add TestCrashDuringStep

2015-08-19 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Aug 19 09:15:45 2015
New Revision: 245440

URL: http://llvm.org/viewvc/llvm-project?rev=245440&view=rev
Log:
Add TestCrashDuringStep

this tests that a crash that happens during instruction step is reported 
correctly.

Added:
lldb/trunk/test/functionalities/thread/crash_during_step/
lldb/trunk/test/functionalities/thread/crash_during_step/Makefile

lldb/trunk/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
lldb/trunk/test/functionalities/thread/crash_during_step/main.cpp

Added: lldb/trunk/test/functionalities/thread/crash_during_step/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/crash_during_step/Makefile?rev=245440&view=auto
==
--- lldb/trunk/test/functionalities/thread/crash_during_step/Makefile (added)
+++ lldb/trunk/test/functionalities/thread/crash_during_step/Makefile Wed Aug 
19 09:15:45 2015
@@ -0,0 +1,4 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py?rev=245440&view=auto
==
--- 
lldb/trunk/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py 
(added)
+++ 
lldb/trunk/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py 
Wed Aug 19 09:15:45 2015
@@ -0,0 +1,66 @@
+"""
+Test that step-inst over a crash behaves correctly.
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class CreateDuringStepTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+@dsym_test
+def test_step_inst_with_dsym(self):
+"""Test thread creation during step-inst handling."""
+self.buildDsym(dictionary=self.getBuildFlags())
+self.crash_during_step_inst_test()
+
+@dwarf_test
+@expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64'])
+def test_step_inst_with_dwarf(self):
+"""Test thread creation during step-inst handling."""
+self.buildDwarf(dictionary=self.getBuildFlags())
+self.crash_during_step_inst_test()
+
+def setUp(self):
+TestBase.setUp(self)
+self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
+
+def crash_during_step_inst_test(self):
+exe = os.path.join(os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target and target.IsValid(), "Target is valid")
+
+self.bp_num = lldbutil.run_break_set_by_file_and_line (self, 
"main.cpp", self.breakpoint, num_expected_locations=1)
+
+# Run the program.
+process = target.LaunchSimple(None, None, 
self.get_process_working_directory())
+self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
+
+# The stop reason should be breakpoint.
+self.assertEqual(process.GetState(), lldb.eStateStopped, 
PROCESS_STOPPED)
+self.assertEqual(lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint).IsValid(), 1,
+STOPPED_DUE_TO_BREAKPOINT)
+
+thread = process.GetThreadAtIndex(0)
+self.assertTrue(thread and thread.IsValid(), "Thread is valid")
+
+# Keep stepping until the inferior crashes
+while process.GetState() == lldb.eStateStopped and not 
lldbutil.is_thread_crashed(self, thread):
+thread.StepInstruction(False)
+
+self.assertEqual(process.GetState(), lldb.eStateStopped, 
PROCESS_STOPPED)
+self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has 
crashed")
+process.Kill()
+
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()

Added: lldb/trunk/test/functionalities/thread/crash_during_step/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/crash_during_step/main.cpp?rev=245440&view=auto
==
--- lldb/trunk/test/functionalities/thread/crash_during_step/main.cpp (added)
+++ lldb/trunk/test/functionalities/thread/crash_during_step/main.cpp Wed Aug 
19 09:15:45 2015
@@ -0,0 +1,16 @@
+//===-- main.cpp *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+void (*crash)() = nullptr;
+
+int main()
+{
+crash(); // Set breakpoint here
+return 0;
+}


_

[Lldb-commits] [lldb] r245448 - Increase timeout in TestCallThatRestarts

2015-08-19 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Aug 19 10:24:02 2015
New Revision: 245448

URL: http://llvm.org/viewvc/llvm-project?rev=245448&view=rev
Log:
Increase timeout in TestCallThatRestarts

the test was failing on android because processing 30 signals involved a lot of 
round-trips,
which was not possible in the 0.5s default timeout. After the increase the test 
seems to pass
reliably.

Modified:
lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py

Modified: 
lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py?rev=245448&r1=245447&r2=245448&view=diff
==
--- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py 
(original)
+++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py 
Wed Aug 19 10:24:02 2015
@@ -81,6 +81,8 @@ class ExprCommandThatRestartsTestCase(Te
 self.assertTrue (self.start_sigchld_no != -1, "Got an actual value for 
sigchld_no")
 
 options = lldb.SBExpressionOptions()
+# processing 30 signals takes a while, increase the expression timeout 
a bit
+options.SetTimeoutInMicroSeconds(300) # 3s
 options.SetUnwindOnError(True)
 
 frame = self.thread.GetFrameAtIndex(0)


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


Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Tamas Berghammer via lldb-commits
tberghammer added inline comments.


Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:1049-1051
@@ -1047,5 +1048,5 @@
 
-NativeThreadProtocolSP new_thread_sp = GetThreadByID(tid);
+NativeThreadLinuxSP new_thread_sp = 
std::static_pointer_cast(GetThreadByID(tid));
 
 if (new_thread_sp)
 {

(nit): You don't need this cast (the value is never used).


Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:1148
@@ +1147,3 @@
+StateType previous_state = thread_sp->GetState();
+thread_sp->SetStoppedWithNoReason();
+

You call SetStoppedWithNoReason before almost all ResumeThread but as far as I 
see it isn't used in ResumeThread (except checked in an assert) and 
ResumeThread overwrites it. I would prefer to remove these as for me they 
complicate the code without any reason, but I might miss their purpose.


Comment at: 
test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py:60
@@ +59,3 @@
+while process.GetNumThreads() < 2:
+if thread.GetFrameAtIndex(0).GetFunctionName() in 
['__sync_fetch_and_add_4', 'pthread_mutex_lock']:
+# This skips some functions we have trouble stepping into. 
Testing stepping

Please make this list architecture specific or add a comment for each function 
with the architecture where it imposes an issue


http://reviews.llvm.org/D12104



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


Re: [Lldb-commits] [PATCH] D12100: [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-19 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D12100



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


Re: [Lldb-commits] [PATCH] D11543: Fix evaluation of global operators in C++

2015-08-19 Thread Sean Callanan via lldb-commits
spyffe accepted this revision.
spyffe added a comment.
This revision is now accepted and ready to land.

This looks great to me.  Thank you!


http://reviews.llvm.org/D11543



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


Re: [Lldb-commits] [PATCH] D12138: On Linux, clear the signal mask of the launched inferior

2015-08-19 Thread Yacine Belkadi via lldb-commits
ybelkadi added a comment.

Thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D12138



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


[Lldb-commits] [PATCH] D12158: Fix typo in lldb --help

2015-08-19 Thread Yacine Belkadi via lldb-commits
ybelkadi created this revision.
ybelkadi added a reviewer: jingham.
ybelkadi added a subscriber: lldb-commits.

http://reviews.llvm.org/D12158

Files:
  tools/driver/Driver.cpp

Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -116,7 +116,7 @@
 { LLDB_3_TO_5,   false, "source-quietly"  , 'Q', no_argument   
   , 0,  eArgTypeNone,
 "Tells the debugger to execute this one-line lldb command before any 
file provided on the command line has been loaded." },
 { LLDB_3_TO_5,   false, "batch"  , 'b', no_argument  , 0,  
eArgTypeNone,
-"Tells the debugger to running the commands from -s, -S, -o & -O, and 
then quit.  However if any run command stopped due to a signal or crash, "
+"Tells the debugger to run the commands from -s, -S, -o & -O, and then 
quit.  However if any run command stopped due to a signal or crash, "
 "the debugger will return to the interactive prompt at the place of 
the crash." },
 { LLDB_3_TO_5,   false, "editor" , 'e', no_argument  , 0,  
eArgTypeNone,
 "Tells the debugger to open source files using the host's \"external 
editor\" mechanism." },


Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -116,7 +116,7 @@
 { LLDB_3_TO_5,   false, "source-quietly"  , 'Q', no_argument  , 0,  eArgTypeNone,
 "Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded." },
 { LLDB_3_TO_5,   false, "batch"  , 'b', no_argument  , 0,  eArgTypeNone,
-"Tells the debugger to running the commands from -s, -S, -o & -O, and then quit.  However if any run command stopped due to a signal or crash, "
+"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.  However if any run command stopped due to a signal or crash, "
 "the debugger will return to the interactive prompt at the place of the crash." },
 { LLDB_3_TO_5,   false, "editor" , 'e', no_argument  , 0,  eArgTypeNone,
 "Tells the debugger to open source files using the host's \"external editor\" mechanism." },
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r245460 - XTIMEOUT TestExitDuringStep for Darwin.

2015-08-19 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 19 12:13:02 2015
New Revision: 245460

URL: http://llvm.org/viewvc/llvm-project?rev=245460&view=rev
Log:
XTIMEOUT TestExitDuringStep for Darwin.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=245460&r1=245459&r2=245460&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 19 12:13:02 2015
@@ -319,6 +319,7 @@ def getExpectedTimeouts(platform_name):
 expected_timeout |= {
 # times out on MBP Retina, Mid 2012
 "TestThreadSpecificBreakpoint.py",
+"TestExitDuringStep.py",
 }
 return expected_timeout
 


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


[Lldb-commits] [lldb] r245464 - XTIMEOUT TestEvents and TestThreadStates for Windows to Android.

2015-08-19 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 19 12:22:12 2015
New Revision: 245464

URL: http://llvm.org/viewvc/llvm-project?rev=245464&view=rev
Log:
XTIMEOUT TestEvents and TestThreadStates for Windows to Android.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=245464&r1=245463&r2=245464&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 19 12:22:12 2015
@@ -277,6 +277,7 @@ def walk_and_invoke(test_directory, test
 def getExpectedTimeouts(platform_name):
 # returns a set of test filenames that might timeout
 # are we running against a remote target?
+host = sys.platform
 if platform_name is None:
 target = sys.platform
 remote = False
@@ -308,6 +309,11 @@ def getExpectedTimeouts(platform_name):
 "TestExitDuringStep.py",
 "TestHelloWorld.py",
 }
+if host.startswith("win32"):
+expected_timeout |= {
+"TestEvents.py",
+"TestThreadStates.py",
+}
 elif target.startswith("freebsd"):
 expected_timeout |= {
 "TestBreakpointConditions.py",


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


Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 32571.
labath marked an inline comment as done.
labath added a comment.
Herald added subscribers: srhines, danalbert, tberghammer.

Address review comments


http://reviews.llvm.org/D12104

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/Plugins/Process/Linux/NativeThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.h
  test/functionalities/thread/create_during_instruction_step/Makefile
  
test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
  test/functionalities/thread/create_during_instruction_step/main.cpp

Index: test/functionalities/thread/create_during_instruction_step/main.cpp
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/main.cpp
@@ -0,0 +1,36 @@
+//===-- main.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+#include 
+
+std::atomic flag(false);
+
+void do_nothing()
+{
+while (flag)
+;
+}
+
+int main ()
+{
+// Instruction-level stepping over a creation of the first thread takes a very long time, so
+// we give the threading machinery a chance to initialize all its data structures.
+// This way, stepping over the second thread will be much faster.
+std::thread dummy(do_nothing);
+dummy.join();
+
+// Make sure the new thread does not exit before we get a chance to notice the main thread stopped
+flag = true;
+
+std::thread thread(do_nothing); // Set breakpoint here
+flag = false; // Release the new thread.
+thread.join();
+return 0;
+}
Index: test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
===
--- /dev/null
+++ test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
@@ -0,0 +1,88 @@
+"""
+This tests that we do not lose control of the inferior, while doing an instruction-level step
+over a thread creation instruction.
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class CreateDuringInstructionStepTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers to break and continue.
+self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
+
+@dsym_test
+def test_step_inst_with_dsym(self):
+self.buildDsym(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+@dwarf_test
+def test_step_inst_with_dwarf(self):
+self.buildDwarf(dictionary=self.getBuildFlags())
+self.create_during_step_inst_test()
+
+def create_during_step_inst_test(self):
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target and target.IsValid(), "Target is valid")
+
+# This should create a breakpoint in the stepping thread.
+self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=-1)
+
+# Run the program.
+process = target.LaunchSimple(None, None, self.get_process_working_directory())
+self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1,
+STOPPED_DUE_TO_BREAKPOINT)
+
+# Get the number of threads
+num_threads = process.GetNumThreads()
+
+# Make sure we see only one threads
+self.assertEqual(num_threads, 1, 'Number of expected threads and actual threads do not match.')
+
+thread = process.GetThreadAtIndex(0)
+self.assertTrue(thread and thread.IsValid(), "Thread is valid")
+
+# Keep stepping until we see the thread creation
+while process.GetNumThreads() < 2:
+# This skips some functions we have trouble stepping into. Testing stepping
+# through these is not the purpose of this test. We just want to find the
+# instruction, which creates the thread.
+if thread.GetFrameAtIndex(0).GetFunctionName() in [
+'__sync_fetch_and_add_4', # Android arm: unable to set a breakpoint for software single-step
+'pthread_mutex_lock'  # Android arm: functi

[Lldb-commits] [lldb] r245477 - XTIMEOUT TestChangeProcessGroup for Linux.

2015-08-19 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 19 13:39:25 2015
New Revision: 245477

URL: http://llvm.org/viewvc/llvm-project?rev=245477&view=rev
Log:
XTIMEOUT TestChangeProcessGroup for Linux.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=245477&r1=245476&r2=245477&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 19 13:39:25 2015
@@ -303,6 +303,7 @@ def getExpectedTimeouts(platform_name):
 "TestMultithreaded.py",
 "TestRegisters.py",  # ~12/600 dosep runs (build 3120-3122)
 "TestThreadStepOut.py",
+"TestChangeProcessGroup.py",
 }
 elif target.startswith("android"):
 expected_timeout |= {


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


[Lldb-commits] [PATCH] D12165: Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Paul Herman via lldb-commits
paulherman created this revision.
paulherman added a reviewer: sivachandra.
paulherman added a subscriber: lldb-commits.

http://reviews.llvm.org/D12165

Files:
  test/lang/cpp/chained-calls/TestCppChainedCalls.py
  test/lang/cpp/chained-calls/main.cpp
  test/lang/cpp/nsimport/TestCppNsImport.py
  test/lang/cpp/nsimport/main.cpp

Index: test/lang/cpp/nsimport/main.cpp
===
--- test/lang/cpp/nsimport/main.cpp
+++ test/lang/cpp/nsimport/main.cpp
@@ -1,19 +1,28 @@
-namespace A {
-int x = 11;
-namespace {
-int xx = 22;
-}
+namespace N
+{
+int n;
+}
+
+namespace
+{
+int anon;
 }
 
-using namespace A;
+namespace Nested
+{
+namespace
+{
+int nested;
+}
+}
 
-namespace {
-int xxx = 33;
-};
+using namespace N;
+using namespace Nested;
 
-int main() {
-x;
-xx;
-xxx;
-return 0;
+int main()
+{
+n = 1;
+anon = 2;
+nested = 3;
+return 0; // break 0
 }
Index: test/lang/cpp/nsimport/TestCppNsImport.py
===
--- test/lang/cpp/nsimport/TestCppNsImport.py
+++ test/lang/cpp/nsimport/TestCppNsImport.py
@@ -43,13 +43,13 @@
 self.assertTrue(target.IsValid(), VALID_TARGET)
 
 # Break on main function
-main_breakpoint = target.BreakpointCreateByName("main")
-self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
+self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
 args = None
 env = None
-process = target.LaunchSimple(args, env, self.get_process_working_directory())
+process = target.LaunchSimple(args, env, cwd)
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
 
 # Get the thread of the process
@@ -60,14 +60,18 @@
 frame = thread.GetSelectedFrame()
 
 # Test imported namespaces
-test_result = frame.EvaluateExpression("x")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 11, "x = 11")
+test_result = frame.EvaluateExpression("n")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "n = 1")
 
-test_result = frame.EvaluateExpression("xx")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 22, "xx = 22")
+test_result = frame.EvaluateExpression("N::n")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "N::n = 1")
+
+test_result = frame.EvaluateExpression("nested")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "nested = 3")
+
+test_result = frame.EvaluateExpression("anon")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
 
-test_result = frame.EvaluateExpression("xxx")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 33, "xxx = 33")
 
 if __name__ == '__main__':
 import atexit
Index: test/lang/cpp/chained-calls/main.cpp
===
--- test/lang/cpp/chained-calls/main.cpp
+++ test/lang/cpp/chained-calls/main.cpp
@@ -1,186 +1,33 @@
-class S
-{
+class Bool {
 public:
-  S () { }
-  S (S &obj);
-
-  S operator+ (const S &s);
-
-  int a;
+Bool operator&(const Bool other)
+{
+Bool result;
+result.value = value && other.value;
+return result;
+}
+
+bool value;
 };
 
-S::S (S &obj)
+bool get(Bool object)
 {
-  a = obj.a;
+return object.value;
 }
 
-S
-S::operator+ (const S &s)
+Bool set(bool value)
 {
-  S res;
-
-  res.a = a + s.a;
-
-  return res;
+Bool result;
+result.value = value;
+return result;
 }
 
-S
-f (int i)
+int main()
 {
-  S s;
-
-  s.a = i;
-
-  return s;
-}
-
-int
-g (const S &s)
-{
-  return s.a;
-}
-
-class A
-{
-public:
-  A operator+ (const A &);
-  int a;
-};
-
-A
-A::operator+ (const A &obj)
-{
-  A n;
-
-  n.a = a + obj.a;
-
-  return n;
-}
-
-A
-p ()
-{
-  A a;
-  a.a = 12345678;
-  return a;
-}
-
-A
-r ()
-{
-  A a;
-  a.a = 1000;
-  return a;
-}
-
-A
-q (const A &a)
-{
-  return a;
-}
-
-class B
-{
-public:
-  int b[1024];
-};
-
-B
-makeb ()
-{
-  B b;
-  int i;
-
-  for (i = 0; i < 1024; i++)
-b.b[i] = i;
-
-  return b;
-}
-
-int
-getb (const B &b, int i)
-{
-  return b.b[i];
-}
-
-class C
-{
-public:
-  C ();
-  ~C ();
-
-  A operator* ();
-
-  A *a_ptr;
-};
-
-C::C ()
-{
-  a_ptr = new A;
-  a_ptr->a = 5678;
-}
-
-C::~C ()
-{
-  delete a_ptr;
-}
-
-A
-C::operator* ()
-{
-  return *a_ptr;
-}
-
-#define TYPE_INDEX 1
-
-enum type
-{
-  INT,
-  CHAR
-};
-
-union U
-{
-public:
-  U (type t);
-  type get_type ();
-
-  int a;
-  char c;
-  type tp[2];
-};
-
-U::U (ty

Re: [Lldb-commits] [PATCH] D12165: Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Chaoren Lin via lldb-commits
chaoren added a subscriber: chaoren.
chaoren requested changes to this revision.
chaoren added a reviewer: chaoren.
This revision now requires changes to proceed.


Comment at: test/lang/cpp/chained-calls/TestCppChainedCalls.py:45
@@ -45,3 +44,3 @@
 env = None
 process = target.LaunchSimple(args, env, cwd)
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)

Please use `self.get_process_working_directory()` instead of `cwd` for remote 
tests.


http://reviews.llvm.org/D12165



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


Re: [Lldb-commits] [PATCH] D12165: Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 32593.
paulherman added a comment.

Improve tests regarding imported namespaces and chained calls in C++


http://reviews.llvm.org/D12165

Files:
  test/lang/cpp/chained-calls/TestCppChainedCalls.py
  test/lang/cpp/chained-calls/main.cpp
  test/lang/cpp/nsimport/TestCppNsImport.py
  test/lang/cpp/nsimport/main.cpp

Index: test/lang/cpp/nsimport/main.cpp
===
--- test/lang/cpp/nsimport/main.cpp
+++ test/lang/cpp/nsimport/main.cpp
@@ -1,19 +1,28 @@
-namespace A {
-int x = 11;
-namespace {
-int xx = 22;
-}
+namespace N
+{
+int n;
+}
+
+namespace
+{
+int anon;
 }
 
-using namespace A;
+namespace Nested
+{
+namespace
+{
+int nested;
+}
+}
 
-namespace {
-int xxx = 33;
-};
+using namespace N;
+using namespace Nested;
 
-int main() {
-x;
-xx;
-xxx;
-return 0;
+int main()
+{
+n = 1;
+anon = 2;
+nested = 3;
+return 0; // break 0
 }
Index: test/lang/cpp/nsimport/TestCppNsImport.py
===
--- test/lang/cpp/nsimport/TestCppNsImport.py
+++ test/lang/cpp/nsimport/TestCppNsImport.py
@@ -34,22 +34,22 @@
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
 # Get the path of the executable
-cwd = os.getcwd()
+cwd = self.get_process_working_directory()
 exe_file = "a.out"
 exe_path  = os.path.join(cwd, exe_file)
 
 # Load the executable
 target = self.dbg.CreateTarget(exe_path)
 self.assertTrue(target.IsValid(), VALID_TARGET)
 
 # Break on main function
-main_breakpoint = target.BreakpointCreateByName("main")
-self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
+self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
 args = None
 env = None
-process = target.LaunchSimple(args, env, self.get_process_working_directory())
+process = target.LaunchSimple(args, env, cwd)
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
 
 # Get the thread of the process
@@ -60,14 +60,18 @@
 frame = thread.GetSelectedFrame()
 
 # Test imported namespaces
-test_result = frame.EvaluateExpression("x")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 11, "x = 11")
+test_result = frame.EvaluateExpression("n")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "n = 1")
 
-test_result = frame.EvaluateExpression("xx")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 22, "xx = 22")
+test_result = frame.EvaluateExpression("N::n")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "N::n = 1")
+
+test_result = frame.EvaluateExpression("nested")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "nested = 3")
+
+test_result = frame.EvaluateExpression("anon")
+self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
 
-test_result = frame.EvaluateExpression("xxx")
-self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 33, "xxx = 33")
 
 if __name__ == '__main__':
 import atexit
Index: test/lang/cpp/chained-calls/main.cpp
===
--- test/lang/cpp/chained-calls/main.cpp
+++ test/lang/cpp/chained-calls/main.cpp
@@ -1,186 +1,33 @@
-class S
-{
+class Bool {
 public:
-  S () { }
-  S (S &obj);
-
-  S operator+ (const S &s);
-
-  int a;
+Bool operator&(const Bool other)
+{
+Bool result;
+result.value = value && other.value;
+return result;
+}
+
+bool value;
 };
 
-S::S (S &obj)
+bool get(Bool object)
 {
-  a = obj.a;
+return object.value;
 }
 
-S
-S::operator+ (const S &s)
+Bool set(bool value)
 {
-  S res;
-
-  res.a = a + s.a;
-
-  return res;
+Bool result;
+result.value = value;
+return result;
 }
 
-S
-f (int i)
+int main()
 {
-  S s;
-
-  s.a = i;
-
-  return s;
-}
-
-int
-g (const S &s)
-{
-  return s.a;
-}
-
-class A
-{
-public:
-  A operator+ (const A &);
-  int a;
-};
-
-A
-A::operator+ (const A &obj)
-{
-  A n;
-
-  n.a = a + obj.a;
-
-  return n;
-}
-
-A
-p ()
-{
-  A a;
-  a.a = 12345678;
-  return a;
-}
-
-A
-r ()
-{
-  A a;
-  a.a = 1000;
-  return a;
-}
-
-A
-q (const A &a)
-{
-  return a;
-}
-
-class B
-{
-public:
-  int b[1024];
-};
-
-B
-makeb ()
-{
-  B b;
-  int i;
-
-  for (i = 0; i < 1024; i++)
-b.b[i] = i;
-
-  return b;
-}
-
-int
-getb (const B &b, int i)
-{
-  return b.b[i];
-}
-
-class C

Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line when Windows filenames are used.

2015-08-19 Thread Dawn Perchik via lldb-commits
dawn planned changes to this revision.
dawn added a comment.

In http://reviews.llvm.org/D12115#227613, @abidh wrote:

> This command uses "target modules lookup" [...]


Good point.  Yes, it would be good to encapsulate this.  I'll rework this patch 
accordingly when I can find the time (busy with a release now).

That said, I would love to continue the discussion of how to tackle the 
filename/path issue so I can have some direction as to how to resolve it.  
Should that move to lldb-dev?


Repository:
  rL LLVM

http://reviews.llvm.org/D12115



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


[Lldb-commits] [lldb] r245488 - [lldb-mi] Add (gdb) prompt after =breakpoint-modified and =breakpoint-created.

2015-08-19 Thread Dawn Perchik via lldb-commits
Author: dperchik
Date: Wed Aug 19 15:04:03 2015
New Revision: 245488

URL: http://llvm.org/viewvc/llvm-project?rev=245488&view=rev
Log:
[lldb-mi] Add (gdb) prompt after =breakpoint-modified and =breakpoint-created.

Reviewed by: abidh, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12113

Modified:
lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp?rev=245488&r1=245487&r2=245488&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp Wed Aug 19 
15:04:03 2015
@@ -351,7 +351,8 @@ CMICmnLLDBDebuggerHandleEvents::HandleEv
 
 const CMICmnMIValueResult miValueResultC("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, 
miValueResultC);
-const bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 
 return bOk;
 }
@@ -440,6 +441,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleEv
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, 
miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 else
 {
@@ -462,6 +464,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleEv
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointCreated, 
miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 
 return bOk;


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


Re: [Lldb-commits] [PATCH] D12113: [LLDB-MI] Add (gdb) prompt after =breakpoint-modified and =breakpoint-created.

2015-08-19 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245488: [lldb-mi] Add (gdb) prompt after 
=breakpoint-modified and =breakpoint-created. (authored by dperchik).

Changed prior to commit:
  http://reviews.llvm.org/D12113?vs=32443&id=32601#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12113

Files:
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp

Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -351,7 +351,8 @@
 
 const CMICmnMIValueResult miValueResultC("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, 
miValueResultC);
-const bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 
 return bOk;
 }
@@ -440,6 +441,7 @@
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, 
miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 else
 {
@@ -462,6 +464,7 @@
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord 
miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointCreated, 
miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 
 return bOk;


Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -351,7 +351,8 @@
 
 const CMICmnMIValueResult miValueResultC("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, miValueResultC);
-const bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bool bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 
 return bOk;
 }
@@ -440,6 +441,7 @@
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 else
 {
@@ -462,6 +464,7 @@
 const CMICmnMIValueResult miValueResult("bkpt", miValueTuple);
 const CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointCreated, miValueResult);
 bOk = MiOutOfBandRecordToStdout(miOutOfBandRecord);
+bOk = bOk && CMICmnStreamStdout::WritePrompt();
 }
 
 return bOk;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line when Windows filenames are used.

2015-08-19 Thread Zachary Turner via lldb-commits
Seems reasonable to move that to lldb-dev.

On Wed, Aug 19, 2015 at 12:56 PM Dawn Perchik  wrote:

> dawn planned changes to this revision.
> dawn added a comment.
>
> In http://reviews.llvm.org/D12115#227613, @abidh wrote:
>
> > This command uses "target modules lookup" [...]
>
>
> Good point.  Yes, it would be good to encapsulate this.  I'll rework this
> patch accordingly when I can find the time (busy with a release now).
>
> That said, I would love to continue the discussion of how to tackle the
> filename/path issue so I can have some direction as to how to resolve it.
> Should that move to lldb-dev?
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D12115
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r245495 - Read exception records from Windows mini dump

2015-08-19 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Wed Aug 19 15:43:22 2015
New Revision: 245495

URL: http://llvm.org/viewvc/llvm-project?rev=245495&view=rev
Log:
Read exception records from Windows mini dump

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

Modified:
lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h
lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.h

Modified: lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h?rev=245495&r1=245494&r2=245495&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h Wed Aug 19 
15:43:22 2015
@@ -14,6 +14,7 @@
 
 #include "lldb/lldb-forward.h"
 #include "lldb/Host/windows/windows.h"
+#include 
 
 #include 
 #include 
@@ -40,6 +41,24 @@ class ExceptionRecord
 m_thread_id = thread_id;
 m_arguments.assign(record.ExceptionInformation, 
record.ExceptionInformation + record.NumberParameters);
 }
+
+// MINIDUMP_EXCEPTIONs are almost identical to EXCEPTION_RECORDs.
+ExceptionRecord(const MINIDUMP_EXCEPTION &record, lldb::tid_t thread_id) :
+m_code(record.ExceptionCode),
+m_continuable(record.ExceptionFlags == 0),
+m_next_exception(nullptr),
+m_exception_addr(static_cast(record.ExceptionAddress)),
+m_thread_id(thread_id),
+m_arguments(record.ExceptionInformation, record.ExceptionInformation + 
record.NumberParameters)
+{
+// Set up link to nested exception.
+if (record.ExceptionRecord)
+{
+m_next_exception.reset(new ExceptionRecord(*reinterpret_cast(record.ExceptionRecord),
+   thread_id));
+}
+}
+
 virtual ~ExceptionRecord() {}
 
 DWORD

Modified: lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp?rev=245495&r1=245494&r2=245495&view=diff
==
--- lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp Wed 
Aug 19 15:43:22 2015
@@ -24,11 +24,15 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
+#include "../windows/ExceptionRecord.h"  // TODO(amccarth):  move this file to 
a common location
 #include "ThreadWinMiniDump.h"
 
 using namespace lldb_private;
@@ -45,6 +49,7 @@ public:
 HANDLE m_dump_file;  // handle to the open minidump file
 HANDLE m_mapping;  // handle to the file mapping for the minidump file
 void * m_base_addr;  // base memory address of the minidump
+std::shared_ptr m_exception_sp;
 };
 
 ConstString
@@ -129,7 +134,8 @@ ProcessWinMiniDump::DoLoadCore()
 
 m_target.SetArchitecture(DetermineArchitecture());
 // TODO(amccarth):  Build the module list.
-// TODO(amccarth):  Read the exeception record.
+
+ReadExceptionRecord();
 
 return error;
 
@@ -146,21 +152,12 @@ ProcessWinMiniDump::GetDynamicLoader()
 bool
 ProcessWinMiniDump::UpdateThreadList(ThreadList &old_thread_list, ThreadList 
&new_thread_list)
 {
-assert(m_data_up != nullptr);
-assert(m_data_up->m_base_addr != 0);
-
-MINIDUMP_DIRECTORY *dir = nullptr;
-void *ptr = nullptr;
-ULONG size = 0;
-if (::MiniDumpReadDumpStream(m_data_up->m_base_addr, ThreadListStream, 
&dir, &ptr, &size))
-{
-assert(dir->StreamType == ThreadListStream);
-assert(size == dir->Location.DataSize);
-assert(ptr == 
static_cast(static_cast(m_data_up->m_base_addr) + 
dir->Location.Rva));
-auto thread_list_ptr = static_cast(ptr);
+size_t size = 0;
+auto thread_list_ptr = static_cast(FindDumpStream(ThreadListStream, &size));
+if (thread_list_ptr)
+{
 const ULONG32 thread_count = thread_list_ptr->NumberOfThreads;
-assert(thread_count < std::numeric_limits::max());
-for (int i = 0; i < thread_count; ++i) {
+for (ULONG32 i = 0; i < thread_count; ++i) {
 std::shared_ptr thread_sp(new 
ThreadWinMiniDump(*this, thread_list_ptr->Threads[i].ThreadId));
 new_thread_list.AddThread(thread_sp);
 }
@@ -172,6 +169,20 @@ ProcessWinMiniDump::UpdateThreadList(Thr
 void
 ProcessWinMiniDu

Re: [Lldb-commits] [PATCH] D12126: Read exception records from Windows mini dump

2015-08-19 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245495: Read exception records from Windows mini dump 
(authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D12126?vs=32476&id=32606#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12126

Files:
  lldb/trunk/source/Plugins/Process/Windows/ExceptionRecord.h
  lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
  lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.h

Index: lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.h
===
--- lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.h
+++ lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.h
@@ -97,6 +97,15 @@
 lldb_private::ArchSpec
 DetermineArchitecture();
 
+void
+ReadExceptionRecord();
+
+// A thin wrapper around WinAPI's MiniDumpReadDumpStream to avoid redundant
+// checks.  If there's a failure (e.g., if the requested stream doesn't exist),
+// the function returns nullptr and sets *size_out to 0.
+void *
+FindDumpStream(unsigned stream_number, size_t *size_out);
+
 // Isolate the data to keep Windows-specific types out of this header.  Can't
 // use the typical pimpl idiom because the implementation of this class also
 // needs access to public and protected members of the base class.
Index: lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
===
--- lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
+++ lldb/trunk/source/Plugins/Process/win-minidump/ProcessWinMiniDump.cpp
@@ -24,11 +24,15 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 
+#include "../windows/ExceptionRecord.h"  // TODO(amccarth):  move this file to a common location
 #include "ThreadWinMiniDump.h"
 
 using namespace lldb_private;
@@ -45,6 +49,7 @@
 HANDLE m_dump_file;  // handle to the open minidump file
 HANDLE m_mapping;  // handle to the file mapping for the minidump file
 void * m_base_addr;  // base memory address of the minidump
+std::shared_ptr m_exception_sp;
 };
 
 ConstString
@@ -129,7 +134,8 @@
 
 m_target.SetArchitecture(DetermineArchitecture());
 // TODO(amccarth):  Build the module list.
-// TODO(amccarth):  Read the exeception record.
+
+ReadExceptionRecord();
 
 return error;
 
@@ -146,21 +152,12 @@
 bool
 ProcessWinMiniDump::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
 {
-assert(m_data_up != nullptr);
-assert(m_data_up->m_base_addr != 0);
-
-MINIDUMP_DIRECTORY *dir = nullptr;
-void *ptr = nullptr;
-ULONG size = 0;
-if (::MiniDumpReadDumpStream(m_data_up->m_base_addr, ThreadListStream, &dir, &ptr, &size))
-{
-assert(dir->StreamType == ThreadListStream);
-assert(size == dir->Location.DataSize);
-assert(ptr == static_cast(static_cast(m_data_up->m_base_addr) + dir->Location.Rva));
-auto thread_list_ptr = static_cast(ptr);
+size_t size = 0;
+auto thread_list_ptr = static_cast(FindDumpStream(ThreadListStream, &size));
+if (thread_list_ptr)
+{
 const ULONG32 thread_count = thread_list_ptr->NumberOfThreads;
-assert(thread_count < std::numeric_limits::max());
-for (int i = 0; i < thread_count; ++i) {
+for (ULONG32 i = 0; i < thread_count; ++i) {
 std::shared_ptr thread_sp(new ThreadWinMiniDump(*this, thread_list_ptr->Threads[i].ThreadId));
 new_thread_list.AddThread(thread_sp);
 }
@@ -172,6 +169,20 @@
 void
 ProcessWinMiniDump::RefreshStateAfterStop()
 {
+if (!m_data_up) return;
+if (!m_data_up->m_exception_sp) return;
+
+auto active_exception = m_data_up->m_exception_sp;
+std::string desc;
+llvm::raw_string_ostream desc_stream(desc);
+desc_stream << "Exception "
+<< llvm::format_hex(active_exception->GetExceptionCode(), 8)
+<< " encountered at address "
+<< llvm::format_hex(active_exception->GetExceptionAddress(), 8);
+m_thread_list.SetSelectedThreadByID(active_exception->GetThreadID());
+auto stop_thread = m_thread_list.GetSelectedThread();
+auto stop_info = StopInfo::CreateStopReasonWithException(*stop_thread, desc_stream.str().c_str());
+stop_thread->SetStopInfo(stop_info);
 }
 
 Error
@@ -302,18 +313,10 @@
 ArchSpec
 ProcessWinMiniDump::DetermineArchitecture()
 {
-assert(m_data_up != nullptr);
-assert(m_data_up->m_base_addr != 0);

Re: [Lldb-commits] [PATCH] D12165: Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Siva Chandra via lldb-commits
sivachandra accepted this revision.
sivachandra added a comment.

LGTM


http://reviews.llvm.org/D12165



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


[Lldb-commits] [lldb] r245505 - Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Paul Herman via lldb-commits
Author: paulherman
Date: Wed Aug 19 16:23:01 2015
New Revision: 245505

URL: http://llvm.org/viewvc/llvm-project?rev=245505&view=rev
Log:
Improve tests regarding imported namespaces and chained calls in C++

Modified:
lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py
lldb/trunk/test/lang/cpp/chained-calls/main.cpp
lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py
lldb/trunk/test/lang/cpp/nsimport/main.cpp

Modified: lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py?rev=245505&r1=245504&r2=245505&view=diff
==
--- lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py (original)
+++ lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py Wed Aug 19 
16:23:01 2015
@@ -3,16 +3,15 @@ from lldbtest import *
 import lldbutil
 
 class TestCppChainedCalls(TestBase):
-
+
 mydir = TestBase.compute_mydir(__file__)
-
+
 @skipUnlessDarwin
 @dsym_test
 def test_with_dsym_and_run_command(self):
 self.buildDsym()
 self.check()
 
-@expectedFailureGcc
 @dwarf_test
 def test_with_dwarf_and_run_command(self):
 self.buildDwarf()
@@ -26,18 +25,18 @@ class TestCppChainedCalls(TestBase):
 src_file = "main.cpp"
 src_file_spec = lldb.SBFileSpec(src_file)
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
-
+
 # Get the path of the executable
-cwd = os.getcwd() 
+cwd = self.get_process_working_directory()
 exe_file = "a.out"
 exe_path  = os.path.join(cwd, exe_file)
-
+
 # Load the executable
 target = self.dbg.CreateTarget(exe_path)
 self.assertTrue(target.IsValid(), VALID_TARGET)
 
 # Break on main function
-main_breakpoint = target.BreakpointCreateBySourceRegex("Break here", 
src_file_spec)
+main_breakpoint = target.BreakpointCreateBySourceRegex("break here", 
src_file_spec)
 self.assertTrue(main_breakpoint.IsValid() and 
main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
 
 # Launch the process
@@ -50,43 +49,39 @@ class TestCppChainedCalls(TestBase):
 self.assertTrue(process.GetState() == lldb.eStateStopped, 
PROCESS_STOPPED)
 thread = lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint)
 
-# Get frame for current thread 
+# Get frame for current thread
 frame = thread.GetSelectedFrame()
-
-# Test chained calls
-test_result = frame.EvaluateExpression("g(f(12345))")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 12345, "g(f(12345)) = 12345")
-
-test_result = frame.EvaluateExpression("q(p()).a")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 12345678, "q(p()).a = 12345678")
 
-test_result = frame.EvaluateExpression("(p() + r()).a")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 22345678, "(p() + r()).a = 22345678")
+# Test chained calls
+test_result = frame.EvaluateExpression("get(set(true))")
+self.assertTrue(test_result.IsValid() and test_result.GetValue() == 
"true", "get(set(true)) = true")
 
-test_result = frame.EvaluateExpression("q(p() + r()).a")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 22345678, "q(p() + r()).a = 22345678")
+test_result = frame.EvaluateExpression("get(set(false))")
+self.assertTrue(test_result.IsValid() and test_result.GetValue() == 
"false", "get(set(false)) = false")
 
-test_result = frame.EvaluateExpression("g(f(6700) + f(89))")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 6789, "g(f(6700) + f(89)) = 6789")
+test_result = frame.EvaluateExpression("get(t & f)")
+self.assertTrue(test_result.IsValid() and test_result.GetValue() == 
"false", "get(t & f) = false")
 
-test_result = frame.EvaluateExpression("g(f(g(f(300) + f(40))) + 
f(5))")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 345, "g(f(g(f(300) + f(40))) + f(5)) = 345")
+test_result = frame.EvaluateExpression("get(f & t)")
+self.assertTrue(test_result.IsValid() and test_result.GetValue() == 
"false", "get(f & t) = false")
 
-test_result = frame.EvaluateExpression("getb(makeb(), 789)")
-self.assertTrue(test_result.IsValid() and 
test_result.GetValueAsSigned() == 789, "getb(makeb(), 789) = 789")
+test_result = frame.EvaluateExpression("get(t & t)")
+self.assertTrue(test_result.IsValid() and test_result.GetValue() == 
"true", "get(t & t) = true")
 
-test_result = frame.EvaluateExpression("(*c).a")
-self.assertTrue(test_result.IsValid(

[Lldb-commits] [lldb] r245508 - Fix evaluation of global operators in C++

2015-08-19 Thread Paul Herman via lldb-commits
Author: paulherman
Date: Wed Aug 19 16:44:56 2015
New Revision: 245508

URL: http://llvm.org/viewvc/llvm-project?rev=245508&view=rev
Log:
Fix evaluation of global operators in C++

Added:
lldb/trunk/test/lang/cpp/global_operators/
lldb/trunk/test/lang/cpp/global_operators/Makefile
lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py
lldb/trunk/test/lang/cpp/global_operators/main.cpp
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=245508&r1=245507&r2=245508&view=diff
==
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Aug 19 16:44:56 2015
@@ -125,11 +125,10 @@ ClangASTSource::FindExternalVisibleDecls
 }
 break;
 
-// Operator names.  Not important for now.
+// Operator names.
 case DeclarationName::CXXOperatorName:
 case DeclarationName::CXXLiteralOperatorName:
-  SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-  return false;
+break;
 
 // Using directives found in this context.
 // Tell Sema we didn't find any or we'll end up getting asked a *lot*.
@@ -1964,11 +1963,14 @@ NameSearchContext::AddFunDecl (const Com
   false);
 }
 
+// Pass the identifier info for functions the decl_name is needed for 
operators
+clang::DeclarationName decl_name = m_decl_name.getNameKind() == 
DeclarationName::Identifier ? m_decl_name.getAsIdentifierInfo() : m_decl_name;
+
 clang::FunctionDecl *func_decl = FunctionDecl::Create (*ast,
context,
SourceLocation(),
SourceLocation(),
-   
m_decl_name.getAsIdentifierInfo(),
+   decl_name,
qual_type,
NULL,
SC_Extern,

Added: lldb/trunk/test/lang/cpp/global_operators/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/global_operators/Makefile?rev=245508&view=auto
==
--- lldb/trunk/test/lang/cpp/global_operators/Makefile (added)
+++ lldb/trunk/test/lang/cpp/global_operators/Makefile Wed Aug 19 16:44:56 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py?rev=245508&view=auto
==
--- lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py (added)
+++ lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py Wed Aug 
19 16:44:56 2015
@@ -0,0 +1,72 @@
+"""
+Test that global operators are found and evaluated.
+"""
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestCppGlobalOperators(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+@dsym_test
+def test_with_dsym_and_run_command(self):
+self.buildDsym()
+self.check()
+
+@dwarf_test
+def test_with_dwarf_and_run_command(self):
+self.buildDwarf()
+self.check()
+
+def setUp(self):
+TestBase.setUp(self)
+
+def check(self):
+# Get main source file
+src_file = "main.cpp"
+src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(src_file_spec.IsValid(), "Main source file")
+
+# Get the path of the executable
+cwd = self.get_process_working_directory()
+exe_file = "a.out"
+exe_path  = os.path.join(cwd, exe_file)
+
+# Load the executable
+target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(target.IsValid(), VALID_TARGET)
+
+# Break on main function
+main_breakpoint = target.BreakpointCreateBySourceRegex("// break 
here", src_file_spec)
+self.assertTrue(main_breakpoint.IsValid() and 
main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+
+# Launch the process
+args = None
+env = None
+process = target.LaunchSimple(args, env, cwd)
+self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, 
PROCESS_S

Re: [Lldb-commits] [PATCH] D12165: Improve tests regarding imported namespaces and chained calls in C++

2015-08-19 Thread Chaoren Lin via lldb-commits
chaoren requested changes to this revision.
This revision now requires changes to proceed.


Comment at: test/lang/cpp/nsimport/TestCppNsImport.py:37
@@ -36,3 +36,3 @@
 # Get the path of the executable
-cwd = os.getcwd()
+cwd = self.get_process_working_directory()
 exe_file = "a.out"

You shouldn't make the change here, since the location of the target binary wrt 
`CreateTarget` is indeed `os.getcwd()`, but the working directory wrt to 
`LaunchSimple` could be an arbitrary remote path.


http://reviews.llvm.org/D12165



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


[Lldb-commits] [lldb] r245515 - Fix tests to work on remote targets.

2015-08-19 Thread Paul Herman via lldb-commits
Author: paulherman
Date: Wed Aug 19 17:44:48 2015
New Revision: 245515

URL: http://llvm.org/viewvc/llvm-project?rev=245515&view=rev
Log:
Fix tests to work on remote targets.

Modified:
lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py
lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py
lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py

Modified: lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py?rev=245515&r1=245514&r2=245515&view=diff
==
--- lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py (original)
+++ lldb/trunk/test/lang/cpp/chained-calls/TestCppChainedCalls.py Wed Aug 19 
17:44:48 2015
@@ -27,7 +27,7 @@ class TestCppChainedCalls(TestBase):
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
 # Get the path of the executable
-cwd = self.get_process_working_directory()
+cwd = os.getcwd() 
 exe_file = "a.out"
 exe_path  = os.path.join(cwd, exe_file)
 
@@ -42,7 +42,7 @@ class TestCppChainedCalls(TestBase):
 # Launch the process
 args = None
 env = None
-process = target.LaunchSimple(args, env, cwd)
+process = target.LaunchSimple(args, env, 
self.get_process_working_directory())
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
 
 # Get the thread of the process

Modified: lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py?rev=245515&r1=245514&r2=245515&view=diff
==
--- lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py 
(original)
+++ lldb/trunk/test/lang/cpp/global_operators/TestCppGlobalOperators.py Wed Aug 
19 17:44:48 2015
@@ -30,7 +30,7 @@ class TestCppGlobalOperators(TestBase):
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
 # Get the path of the executable
-cwd = self.get_process_working_directory()
+cwd = os.getcwd()
 exe_file = "a.out"
 exe_path  = os.path.join(cwd, exe_file)
 
@@ -45,7 +45,7 @@ class TestCppGlobalOperators(TestBase):
 # Launch the process
 args = None
 env = None
-process = target.LaunchSimple(args, env, cwd)
+process = target.LaunchSimple(args, env, 
self.get_process_working_directory())
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
 
 # Get the thread of the process

Modified: lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py?rev=245515&r1=245514&r2=245515&view=diff
==
--- lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py (original)
+++ lldb/trunk/test/lang/cpp/nsimport/TestCppNsImport.py Wed Aug 19 17:44:48 
2015
@@ -34,7 +34,7 @@ class TestCppNsImport(TestBase):
 self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
 # Get the path of the executable
-cwd = self.get_process_working_directory()
+cwd = os.getcwd()
 exe_file = "a.out"
 exe_path  = os.path.join(cwd, exe_file)
 
@@ -49,7 +49,7 @@ class TestCppNsImport(TestBase):
 # Launch the process
 args = None
 env = None
-process = target.LaunchSimple(args, env, cwd)
+process = target.LaunchSimple(args, env, 
self.get_process_working_directory())
 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
 
 # Get the thread of the process


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


[Lldb-commits] [lldb] r245532 - XTIMEOUT TestIntegerTypesExpr for Darwin.

2015-08-19 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Wed Aug 19 20:26:57 2015
New Revision: 245532

URL: http://llvm.org/viewvc/llvm-project?rev=245532&view=rev
Log:
XTIMEOUT TestIntegerTypesExpr for Darwin.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=245532&r1=245531&r2=245532&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Aug 19 20:26:57 2015
@@ -327,6 +327,7 @@ def getExpectedTimeouts(platform_name):
 # times out on MBP Retina, Mid 2012
 "TestThreadSpecificBreakpoint.py",
 "TestExitDuringStep.py",
+"TestIntegerTypesExpr.py",
 }
 return expected_timeout
 


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


Re: [Lldb-commits] [PATCH] D12104: [NativeProcessLinux] Fix a bug in instruction-stepping over thread creation

2015-08-19 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.
ovyalov added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:3051
@@ +3050,3 @@
+return step_result;
+}
+default:

Let's go ahead with eStateRunning instead of eStateStepping - I believe it 
sounds reasonable.


http://reviews.llvm.org/D12104



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


[Lldb-commits] [lldb] r245536 - When the target definition is unparseable, print an error message

2015-08-19 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Aug 19 22:05:09 2015
New Revision: 245536

URL: http://llvm.org/viewvc/llvm-project?rev=245536&view=rev
Log:
When the target definition is unparseable, print an error message
to the user.  e.g. specified via the
plugin.process.gdb-remote.target-definition-file 
setting.  Currently we silently ignore the target definition if
there is a parse error.


Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=245536&r1=245535&r2=245536&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Aug 
19 22:05:09 2015
@@ -529,7 +529,14 @@ ProcessGDBRemote::BuildDynamicRegisterIn
 {
 // See if we can get register definitions from a python file
 if (ParsePythonTargetDefinition (target_definition_fspec))
+{
 return;
+}
+else
+{
+StreamSP stream_sp = 
GetTarget().GetDebugger().GetAsyncOutputStream();
+stream_sp->Printf ("ERROR: target description file %s failed to 
parse.\n", target_definition_fspec.GetPath().c_str());
+}
 }
 
 if (GetGDBServerRegisterInfo ())


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


Re: [Lldb-commits] [PATCH] D12025: Make UriParser to support [$HOSTNAME] notation.

2015-08-19 Thread Oleksiy Vyalov via lldb-commits
ovyalov retitled this revision from "Make LLDB URLs to support hex encoding for 
special symbols" to "Make UriParser to support [$HOSTNAME] notation.".
ovyalov updated the summary for this revision.
ovyalov updated this revision to Diff 32655.
ovyalov added a comment.
Herald added subscribers: srhines, danalbert, tberghammer.

Rewrote the CL to make UriParser to support optional [$HOSTNAME] notation for 
LLDB connect URL - i.e. connect://localhost: and connect://[localhost]: 
should be parsed identically.
This change allows us to pass special URL symbols (like colon) as part of a 
hostname.


http://reviews.llvm.org/D12025

Files:
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Utility/UriParser.cpp
  source/Utility/UriParser.h
  unittests/Utility/UriParserTest.cpp

Index: unittests/Utility/UriParserTest.cpp
===
--- unittests/Utility/UriParserTest.cpp
+++ unittests/Utility/UriParserTest.cpp
@@ -79,12 +79,36 @@
 VALIDATE
 }
 
+TEST_F (UriParserTest, LongPath)
+{
+const UriTestCase testCase("x://y/abc/def/xyz", "x", "y", -1, "/abc/def/xyz");
+VALIDATE
+}
+
 TEST_F (UriParserTest, TypicalPortPath)
 {
 const UriTestCase testCase("connect://192.168.100.132:5432/", "connect", "192.168.100.132", 5432, "/");
 VALIDATE
 }
 
+TEST_F (UriParserTest, BracketedHostnamePort)
+{
+const UriTestCase testCase("connect://[192.168.100.132]:5432/", "connect", "192.168.100.132", 5432, "/");
+VALIDATE
+}
+
+TEST_F (UriParserTest, BracketedHostname)
+{
+const UriTestCase testCase("connect://[192.168.100.132]", "connect", "192.168.100.132", -1, "/");
+VALIDATE
+}
+
+TEST_F (UriParserTest, BracketedHostnameWithColon)
+{
+const UriTestCase testCase("connect://[192.168.100.132:]:1234", "connect", "192.168.100.132:", 1234, "/");
+VALIDATE
+}
+
 TEST_F (UriParserTest, SchemeHostSeparator)
 {
 const UriTestCase testCase("x:/y");
Index: source/Utility/UriParser.h
===
--- source/Utility/UriParser.h
+++ source/Utility/UriParser.h
@@ -28,12 +28,12 @@
 //
 //   if the url is invalid, function returns false and
 //   output parameters remain unchanged
-static bool Parse(const char* uri,
-std::string& scheme,
-std::string& hostname,
-int& port,
-std::string& path
-);
+static bool
+Parse(const std::string& uri,
+  std::string& scheme,
+  std::string& hostname,
+  int& port,
+  std::string& path);
 };
 
 #endif  // utility_UriParser_h_
Index: source/Utility/UriParser.cpp
===
--- source/Utility/UriParser.cpp
+++ source/Utility/UriParser.cpp
@@ -10,8 +10,7 @@
 #include "Utility/UriParser.h"
 
 // C Includes
-#include 
-#include 
+#include 
 
 // C++ Includes
 // Other libraries and framework includes
@@ -24,43 +23,71 @@
 // UriParser::Parse
 //--
 bool
-UriParser::Parse(const char* uri,
-std::string& scheme,
-std::string& hostname,
-int& port,
-std::string& path
-)
+UriParser::Parse(const std::string& uri,
+ std::string& scheme,
+ std::string& hostname,
+ int& port,
+ std::string& path)
 {
-char scheme_buf[100] = {0};
-char hostname_buf[256] = {0};
-char port_buf[11] = {0}; // 10==strlen(2^32)
-char path_buf[2049] = {'/', 0};
-  
-bool ok = false;
- if (4==sscanf(uri, "%99[^:/]://%255[^/:]:%10[^/]/%2047s", scheme_buf, hostname_buf, port_buf, path_buf+1)) { ok = true; }
-else if (3==sscanf(uri, "%99[^:/]://%255[^/:]:%10[^/]", scheme_buf, hostname_buf, port_buf)) { ok = true; }
-else if (3==sscanf(uri, "%99[^:/]://%255[^/]/%2047s", scheme_buf, hostname_buf, path_buf+1)) { ok = true; }
-else if (2==sscanf(uri, "%99[^:/]://%255[^/]", scheme_buf, hostname_buf)) { ok = true; }
+std::string tmp_scheme, tmp_hostname, tmp_port, tmp_path;
 
-bool success = false;
-int port_tmp = -1;
-if (port_buf[0])
+static const char* kSchemeSep = "://";
+auto pos = uri.find(kSchemeSep);
+if (pos == std::string::npos)
+return false;
+
+// Extract path.
+tmp_scheme = uri.substr(0, pos);
+auto host_pos = pos + strlen(kSchemeSep);
+auto path_pos = uri.find_first_of("/", host_pos);
+if (path_pos != std::string::npos)
+tmp_path = uri.substr(path_pos);
+else
+tmp_path = "/";
+
+auto host_port = uri.substr(
+host_pos, ((path_pos != std::string::npos) ? path_pos  : uri.size()) - host_po

[Lldb-commits] [lldb] r245537 - If the filename specified by plugin.process.gdb-remote.target-definition-file,

2015-08-19 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Aug 19 23:29:46 2015
New Revision: 245537

URL: http://llvm.org/viewvc/llvm-project?rev=245537&view=rev
Log:
If the filename specified by plugin.process.gdb-remote.target-definition-file,
doesn't exist, see if it needs tilde expansion before we ignore it completely.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=245537&r1=245536&r2=245537&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Aug 
19 23:29:46 2015
@@ -525,6 +525,11 @@ ProcessGDBRemote::BuildDynamicRegisterIn
 // 3 - Fall back on the qRegisterInfo packets.
 
 FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (!target_definition_fspec.Exists())
+{
+// If the filename doesn't exist, it may be a ~ not having been 
expanded - try to resolve it.
+target_definition_fspec.ResolvePath();
+}
 if (target_definition_fspec)
 {
 // See if we can get register definitions from a python file


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


[Lldb-commits] [PATCH] D12184: [MIPS] Avoid breakpoint in delay slot

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

In MIPS, when a breakpoint is hit in a delay slot then the PC points to the 
previous branch/jump instruction. In this case, CAUSE.BD bit is set and we can 
correct the PC accordingly. 
However doing a single step at this point will continue execution from the 
current PC and not from the target of previous branch/jump instruction. 
Solution to this is to not allow breakpoint in a delay slot and move it to 
previous branch/jump instruction (which will have same effect).

When user tries to set breakpoint by address then this patch checks if the 
instruction at that address is a delay slot instruction and if it is then the 
breakpoint is moved to its previous instruction.

Repository:
  rL LLVM

http://reviews.llvm.org/D12184

Files:
  include/lldb/Core/Disassembler.h
  include/lldb/Target/Target.h
  source/Core/Disassembler.cpp
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -44,6 +44,8 @@
 #include "lldb/Interpreter/Property.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
@@ -344,6 +346,10 @@
 Target::CreateBreakpoint (lldb::addr_t addr, bool internal, bool hardware)
 {
 Address so_addr;
+uint32_t shift_size = 0;
+
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+
 // Attempt to resolve our load address if possible, though it is ok if
 // it doesn't resolve to section/offset.
 
@@ -354,6 +360,17 @@
 // The address didn't resolve, so just set this as an absolute address
 so_addr.SetOffset (addr);
 }
+
+// Check if the instruction at this address is in delay slot.
+// If it is, then move the breakpoint to it's previous instruction.
+shift_size = AdjustBreakpointInDelaySlot (addr);
+if (shift_size)
+{
+so_addr.SetOffset (so_addr.GetOffset () - shift_size);
+if (log)
+log->Printf ("Target::%s Breakpoint at 0x%8.8" PRIx64 " is shifted to 0x%8.8" PRIx64 " \n", __FUNCTION__, addr, (addr - shift_size));
+}
+
 BreakpointSP bp_sp (CreateBreakpoint(so_addr, internal, hardware));
 return bp_sp;
 }
@@ -2134,6 +2151,163 @@
 return opcode_addr;
 }
 
+uint32_t
+Target::AdjustBreakpointInDelaySlot (lldb::addr_t addr)
+{
+uint32_t shift_size = 0;
+Address resolved_addr;
+SectionLoadList §ion_load_list = GetSectionLoadList();
+
+if (section_load_list.IsEmpty())
+// No sections are loaded, so we must assume we are not running yet
+// and need to operate only on file address.
+m_images.ResolveFileAddress (addr, resolved_addr); 
+else
+section_load_list.ResolveLoadAddress(addr, resolved_addr);
+
+switch (m_arch.GetMachine())
+{
+default:
+break;
+case llvm::Triple::mips:
+case llvm::Triple::mipsel:
+case llvm::Triple::mips64:
+case llvm::Triple::mips64el:
+{
+addr_t function_start = 0;
+addr_t current_offset = 0;
+uint32_t loop_count = 0;
+uint32_t arch_flags = m_arch.GetFlags ();
+bool IsMips16 = arch_flags & ArchSpec::eMIPSAse_mips16;
+bool IsMicromips = arch_flags & ArchSpec::eMIPSAse_micromips;
+
+// Get the function boundaries to make sure we don't scan back before the beginning of the current function.
+ModuleSP temp_addr_module_sp (resolved_addr.GetModule());
+if (temp_addr_module_sp)
+{
+SymbolContext sc;
+uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
+uint32_t resolved_mask = temp_addr_module_sp->ResolveSymbolContextForAddress(resolved_addr, resolve_scope, sc);
+if (sc.function)
+{
+function_start = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(this);
+if (function_start == LLDB_INVALID_ADDRESS)
+function_start = sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
+}
+else if (sc.symbol)
+{
+Address sym_addr = sc.symbol->GetAddress();
+function_start = sym_addr.GetFileAddress();
+}
+current_offset = addr - function_start;
+}
+
+// If breakpoint address is start of function then we dont have to do anything.
+if (current_offset == 0)
+return shift_siz