Re: [Lldb-commits] Improving the documentation

2016-03-10 Thread Jim Ingham via lldb-commits
Few more comments...

+/// If an address comes from an existing module, then it will be resolved
+/// into an offset from its containing section in that module.  That way it
+/// can refer to the same logical location as the module that holds it even

Probably my error, but "location as the module" -> "location in the module"

You use the terms "file virtual address" and "load virtual address".  I don't 
know what virtual means in that context.


+//--
+/// Tries to resolve the address within the target.  If this fails,

"target" -> "target's modules"?  That makes it clearer what's going on.

+/// assumes the address is absolute, e.g., on the stack or heap.  The
+/// object becomes valid.
+///
+/// @param[in] load_addr
+/// A new offset value for this object.

This isn't right, it isn't the new offset value, for instance if this is a load 
address from a loaded module,
the SBAddress will be the containing section + offset, and load_addr != 
SBAddress.GetOffset().  This is just the
load address that will be resolved.

+///
+/// @param[in] target
+/// The target within which the offset is valid.

"The target within which the load address will be resolved" is better.  This 
will always return a valid SBAddress, it
just might or might not be a section-relative one.

+//--
 void
 SetLoadAddress (lldb::addr_t load_addr, 
 lldb::SBTarget );

And "The target within which the offset is valid." -> "The target within which 
the load address will be resolved"?


+//--
+/// Set the offset for this address, relative to the current section,
+/// if any.
+///
+/// @param[in] offset
+/// A new offset value for this object.
+//--
+// FIXME:  Should this be SetOffsetAddress?
 bool
 OffsetAddress (addr_t offset);

This call actually slides the SBAddress, so new_offset = old_offset + offset


> On Mar 10, 2016, at 10:46 AM, John Lindal  
> wrote:
> 
> Thanks for your patience and feedback!  Attached is the updated file.
> 
> John
> 
> On Wed, Mar 9, 2016 at 3:10 PM, Jim Ingham  wrote:
> The relation between section offsets and files is stronger than you are 
> stating here.  You say:
> 
> +/// Represents an address.  An address may refer to code or data from an
> +/// existing module, or it may refer to something on the stack or heap.
> +///
> 
> That part is good, but you should use that in the next paragraph, so instead 
> of:
> 
> +/// If an address comes from a file on disk that has section relative
> +/// addresses, then it has a virtual address that is relative to a unique
> +/// section in the object file. Sections get resolved at runtime by
> +/// DynamicLoader plug-ins as images (executables and shared libraries) get
> +/// loaded/unloaded. If a section is loaded, then the load address can be
> +/// resolved.
> 
> Something like:
> 
> If an address comes from an existing module, then it will be resolved into an 
> offset
> from its containing section in that module.  That way it can refer to the 
> same logical
> location as the module that holds it is unloaded and loaded at different 
> addresses.
> Module based SBAddresses are not bound to a particular target or process, but 
> you
> can ask the SBAddress where/if it has been loaded in a particular target.
> 
> I don't think you need to mention the Dynamic loader plugin here, it isn't 
> essential to know who tracks the
> loads to understand what these do.  Also, you use "resolve" in the rest of 
> the docs to mean "resolve to
> section/offset in a Module.  So using it for loading libraries here is 
> confusing.  Better to define it
> here as you are going to use it.
> 
> This bit doesn't seem right to me:
> 
> -// The following queries can lookup symbol information for a given 
> address.
> -// An address might refer to code or data from an existing module, or it
> -// might refer to something on the stack or heap. The following functions
> -// will only return valid values if the address has been resolved to a 
> code
> -// or data address using "void SBAddress::SetLoadAddress(...)" or
> -// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
> +//--
> +/// Lookup symbol information for this address. This function will only
> +/// return a valid object if the address has been resolved to a code or
> +/// data address using "void SBAddress::SetLoadAddress(...)" or
> +/// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
> +///
> +/// @param[in] resolve_scope
> +/// lldb::SymbolContextItem value specifying the scope 

Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Jim Ingham via lldb-commits
jingham added a comment.

Oh, yeah, and note the other branch of the if holds the thread list mutex the 
whole time.  So you'll need to change that to get the list of threads, then 
drop the mutex & iterate over them or you'll get into the same problem if 
somebody does:

(lldb) thread backtrace 1 2 3 4 5

or whatever.


http://reviews.llvm.org/D18075



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


Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Jim Ingham via lldb-commits
jingham added a comment.

Another even safer way to do this is to take the thread list, turn it into a 
vector of TID's, then iterate over the TID's looking them up one at a time as 
you go.  That way you don't have to worry about your ThreadSP going stale.  You 
could even change HandleOneThread to take a tid, so you could centralize the 
lookup.


http://reviews.llvm.org/D18075



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


Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Jim Ingham via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Yeah, I'm beginning to wonder whether we're doing ourselves a favor by putting 
off computing the ObjC runtime symbols till some time that's bound to be more 
inconvenient than right when we've stopped, but that's beyond the scope of this 
patch.

For this patch, there's no guarantee that running the JIT'ed code won't cause a 
thread to exit, so that by the time you got around calling HandleOneThread in 
this loop it had no real backing .  The Thread your ThreadSP is keeping alive 
should have been Clear()ed in that case, so IsValid will return false.  It 
would be good to put an explicit check for that in this loop, and if the thread 
is no longer valid, report some useful message ("thread disappeared while 
computing the backtraces.")  Actually, that check should be done before the 
HandleOneThread in the the other branch of the if as well.


http://reviews.llvm.org/D18075



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


[Lldb-commits] [lldb] r263183 - Fix SBDebugger.GetOutputFileHandle() on OS X.

2016-03-10 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Mar 10 19:57:45 2016
New Revision: 263183

URL: http://llvm.org/viewvc/llvm-project?rev=263183=rev
Log:
Fix SBDebugger.GetOutputFileHandle() on OS X.

The swig typemaps had some magic for output File *'s on OS X that made:

SBDebugger.GetOutputFileHandle() 

actually work.  That was protected by a "#ifdef __MACOSX__", but the 
corresponding define
got lost going from the Darwin shell scripts to the python scripts for running
swig, so the code was elided.  I need to pass the define to SWIG, but only when
targetting Darwin.

So I added a target-platform argument to prepare_bindings, and if that 
is Darwin, I pass -D__APPLE__ to swig, and that activates this code again, and
GetOutputFileHandle works again.  Note, I only pass that argument for the Xcode
build.  I'm sure it is possible to do that for cmake, but my cmake-foo is weak.

I should have been able to write a test for this by creating a debugger, 
setting the 
output file handle to something file, writing to it, getting the output file 
handle 
and reading it.  But SetOutputFileHandle doesn't seem to work from Python, so 
I'd 
have to write a pexpect test to test this, which I'd rather not do.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/scripts/Python/prepare_binding_Python.py
lldb/trunk/scripts/Python/python-typemaps.swig
lldb/trunk/scripts/prepare_bindings.py

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=263183=263182=263183=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Mar 10 19:57:45 2016
@@ -6258,7 +6258,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
-   shellScript = "/usr/bin/python 
$SRCROOT/scripts/prepare_bindings.py --find-swig --framework --src-root 
$SRCROOT --target-dir $TARGET_BUILD_DIR --config-build-dir 
$CONFIGURATION_BUILD_DIR";
+   shellScript = "/usr/bin/python 
$SRCROOT/scripts/prepare_bindings.py --find-swig --framework --src-root 
$SRCROOT --target-dir $TARGET_BUILD_DIR --config-build-dir 
$CONFIGURATION_BUILD_DIR --target-platform Darwin";
};
4959511A1A1ACE9500F6F8FC /* Install Clang compiler headers */ = 
{
isa = PBXShellScriptBuildPhase;

Modified: lldb/trunk/scripts/Python/prepare_binding_Python.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/prepare_binding_Python.py?rev=263183=263182=263183=diff
==
--- lldb/trunk/scripts/Python/prepare_binding_Python.py (original)
+++ lldb/trunk/scripts/Python/prepare_binding_Python.py Thu Mar 10 19:57:45 2016
@@ -16,7 +16,7 @@ import re
 import shutil
 import subprocess
 import sys
-
+import platform
 
 class SwigSettings(object):
 """Provides a single object to represent swig files and settings."""
@@ -205,6 +205,8 @@ def do_swig_rebuild(options, dependency_
 "-I\"%s\"" % os.path.normcase("./."),
 "-D__STDC_LIMIT_MACROS",
 "-D__STDC_CONSTANT_MACROS"]
+if options.target_platform == "Darwin":
+command.append("-D__APPLE__")
 if options.generate_dependency_file:
 command.append("-MMD -MF \"%s\"" % temp_dep_file_path)
 command.extend([

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=263183=263182=263183=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Thu Mar 10 19:57:45 2016
@@ -534,7 +534,7 @@
 
 %typemap(out) FILE * {
char mode[4] = {0};
-#ifdef __MACOSX__
+#ifdef __APPLE__
int i = 0;
short flags = $1->_flags;
 

Modified: lldb/trunk/scripts/prepare_bindings.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/prepare_bindings.py?rev=263183=263182=263183=diff
==
--- lldb/trunk/scripts/prepare_bindings.py (original)
+++ lldb/trunk/scripts/prepare_bindings.py Thu Mar 10 19:57:45 2016
@@ -152,6 +152,11 @@ def process_args(args):
 "Specifies the build dir where the language binding "
 "should be placed"))
 
+parser.add_argument(
+"--target-platform",
+help=(
+"Specifies the platform we are building for."
+"Should be the same as what platform.system() returns."))
 # Process args.
 options = parser.parse_args(args)
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org

Re: [Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Francis Ricci via lldb-commits
fjricci updated this revision to Diff 50387.
fjricci added a comment.

Remove duplication of index variable


http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
 else if (command.GetArgumentCount() == 1 && ::strcmp 
(command.GetArgumentAtIndex(0), "all") == 0)
 {
 Process *process = m_exe_ctx.GetProcessPtr();
-uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
 if (!HandleOneThread(*(thread_sp.get()), result))
 return false;
-++idx;
 }
 }
 else


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
 else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
 {
 Process *process = m_exe_ctx.GetProcessPtr();
-uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
 if (!HandleOneThread(*(thread_sp.get()), result))
 return false;
-++idx;
 }
 }
 else
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c

2016-03-10 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: jingham, clayborg, andrew.w.kaylor.
fjricci added subscribers: lldb-commits, sas.

The gdb-remote async thread cannot modify thread state while the main thread
holds a lock on the state. Don't use locking thread iteration for bt all.

Specifically, the deadlock manifests when lldb attempts to JIT code to
symbolicate objective c while backtracing. As part of this code path,
SetPrivateState() is called on an async thread. This async thread will
block waiting for the thread_list lock held by the main thread in
CommandObjectIterateOverThreads. The main thread will also block on the
async thread during DoResume (although with a timeout), leading to a
deadlock. Due to the timeout, the deadlock is not immediately apparent,
but the inferior will be left in an invalid state after the bt all completes,
and objective-c symbols will not be successfully resolved in the backtrace.

http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -73,8 +73,13 @@
 {
 Process *process = m_exe_ctx.GetProcessPtr();
 uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t i = 0; i < thread_list.GetSize(); ++i)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(i);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -73,8 +73,13 @@
 {
 Process *process = m_exe_ctx.GetProcessPtr();
 uint32_t idx = 0;
-for (ThreadSP thread_sp : process->Threads())
+
+// Manually iterate to avoid locking the threadlist,
+// which can cause deadlocks when JIT-ing code
+ThreadList thread_list = process->GetThreadList();
+for (uint32_t i = 0; i < thread_list.GetSize(); ++i)
 {
+ThreadSP thread_sp = thread_list.GetThreadAtIndex(i);
 if (idx != 0 && m_add_return)
 result.AppendMessage("");
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-03-10 Thread Jim Ingham via lldb-commits
jingham added a comment.

More precisely, the "Public running lock..." part of the comment.


http://reviews.llvm.org/D17635



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


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-03-10 Thread Jim Ingham via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

I marked a comment left over from a previous draft of the patch that isn't 
needed.  Other than that, this looks fine.



Comment at: source/Target/Process.cpp:3561-3562
@@ +3560,4 @@
+Error error;
+// Cannot resume already exited process. Public running lock is
+// held when PrivateResume is entered
+if (!IsAlive())

Is this comment needed anymore?


http://reviews.llvm.org/D17635



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


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-03-10 Thread Petr Hons via lldb-commits
Honsik updated this revision to Diff 50373.
Honsik added a comment.

Sorry for the delay, I have been on holiday.

I have modified the patch as jingham requested. The public run lock is reset 
back on error in both Resume and ResumeSynchronous methods.


http://reviews.llvm.org/D17635

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
  packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -1740,14 +1740,23 @@
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
 if (log)
 log->Printf("Process::Resume -- locking run lock");
+
+Error error;
 if (!m_public_run_lock.TrySetRunning())
 {
-Error error("Resume request failed - process still running.");
+error.SetErrorString("Resume request failed - process still running.");
 if (log)
 log->Printf ("Process::Resume: -- TrySetRunning failed, not resuming.");
 return error;
 }
-return PrivateResume();
+
+error = PrivateResume();
+if (error.Fail())
+{
+// PrivateResume failed, reset the public run lock back
+m_public_run_lock.SetStopped();
+}
+return error;
 }
 
 Error
@@ -1775,6 +1784,11 @@
 if (!StateIsStoppedState(state, must_be_alive))
 error.SetErrorStringWithFormat("process not in stopped state after synchronous resume: %s", StateAsCString(state));
 }
+else
+{
+// PrivateResume failed, reset the public run lock back
+m_public_run_lock.SetStopped();
+}
 
 // Undo the hijacking of process events...
 RestoreProcessEvents();
@@ -3543,7 +3557,16 @@
 StateAsCString(m_public_state.GetValue()),
 StateAsCString(m_private_state.GetValue()));
 
-Error error (WillResume());
+Error error;
+// Cannot resume already exited process. Public running lock is
+// held when PrivateResume is entered
+if (!IsAlive())
+{
+error.SetErrorString("Process is not alive");
+return error;
+}
+
+error = WillResume();
 // Tell the process it is about to resume before the thread list
 if (error.Success())
 {
Index: packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
===
--- packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
+++ packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
@@ -284,3 +284,40 @@
 if self.TraceOn() and error.Success():
 print("Number of supported hardware watchpoints: %d" % num)
 
+@add_test_categories(['pyapi'])
+def test_continue_after_process_exit(self):
+"""Test SBProcess.Continue() API after the process exits."""
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
+self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+# Launch the process, and do not stop at the entry point.
+process = target.LaunchSimple (None, None, self.get_process_working_directory())
+
+thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+
+frame = thread.GetFrameAtIndex(0)
+le = frame.GetLineEntry()
+self.assertTrue(le.IsValid(), "There should be valid line entry at breakpoint")
+self.assertEqual(self.line, le.GetLine(), "There should be valid line number")
+
+# Continue the return out of main
+err = process.Continue()
+self.assertTrue(err.Success(), "Continue after breakpoint should be valid")
+
+# At this point, the inferior process should have exited.
+self.assertEqual(lldb.eStateExited, process.GetState(), PROCESS_EXITED)
+
+# Continue after proces exited should fail with good message, try it multiple times
+for i in range(2):
+err = process.Continue()
+self.assertTrue(err.Fail(), "Continue after exit shouldn't be valid")
+self.assertIn("Process is not alive", err.GetCString())
+
\ No newline at end of file
Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
===
--- 

[Lldb-commits] [lldb] r263174 - Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.

2016-03-10 Thread Eugene Zelenko via lldb-commits
Author: eugenezelenko
Date: Thu Mar 10 17:57:12 2016
New Revision: 263174

URL: http://llvm.org/viewvc/llvm-project?rev=263174=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; 
other minor fixes.

Modified:
lldb/trunk/source/Core/ConstString.cpp
lldb/trunk/source/Core/Error.cpp
lldb/trunk/source/Core/Event.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/Listener.cpp
lldb/trunk/source/Core/Log.cpp

Modified: lldb/trunk/source/Core/ConstString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConstString.cpp?rev=263174=263173=263174=diff
==
--- lldb/trunk/source/Core/ConstString.cpp (original)
+++ lldb/trunk/source/Core/ConstString.cpp Thu Mar 10 17:57:12 2016
@@ -6,14 +6,21 @@
 // License. See LICENSE.TXT for details.
 //
 
//===--===//
+
 #include "lldb/Core/ConstString.h"
-#include "lldb/Core/Stream.h"
+
+// C Includes
+// C++ Includes
+#include 
+#include 
+
+// Other libraries and framework includes
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/RWMutex.h"
 
-#include 
-#include 
+// Project includes
+#include "lldb/Core/Stream.h"
 
 using namespace lldb_private;
 
@@ -34,7 +41,7 @@ public:
 size_t
 GetConstCStringLength (const char *ccstr) const
 {
-if (ccstr)
+if (ccstr != nullptr)
 {
 const uint8_t h = hash (llvm::StringRef(ccstr));
 llvm::sys::SmartScopedReader 
rlock(m_string_pools[h].m_mutex);
@@ -47,19 +54,19 @@ public:
 StringPoolValueType
 GetMangledCounterpart (const char *ccstr) const
 {
-if (ccstr)
+if (ccstr != nullptr)
 {
 const uint8_t h = hash (llvm::StringRef(ccstr));
 llvm::sys::SmartScopedReader 
rlock(m_string_pools[h].m_mutex);
 return GetStringMapEntryFromKeyData (ccstr).getValue();
 }
-return 0;
+return nullptr;
 }
 
 bool
 SetMangledCounterparts (const char *key_ccstr, const char *value_ccstr)
 {
-if (key_ccstr && value_ccstr)
+if (key_ccstr != nullptr && value_ccstr != nullptr)
 {
 {
 const uint8_t h = hash (llvm::StringRef(key_ccstr));
@@ -79,7 +86,7 @@ public:
 const char *
 GetConstCString (const char *cstr)
 {
-if (cstr)
+if (cstr != nullptr)
 return GetConstCStringWithLength (cstr, strlen (cstr));
 return nullptr;
 }
@@ -87,7 +94,7 @@ public:
 const char *
 GetConstCStringWithLength (const char *cstr, size_t cstr_len)
 {
-if (cstr)
+if (cstr != nullptr)
 return GetConstCStringWithStringRef(llvm::StringRef(cstr, 
cstr_len));
 return nullptr;
 }
@@ -116,7 +123,7 @@ public:
 const char *
 GetConstCStringAndSetMangledCounterPart (const char *demangled_cstr, const 
char *mangled_ccstr)
 {
-if (demangled_cstr)
+if (demangled_cstr != nullptr)
 {
 const char *demangled_ccstr = nullptr;
 
@@ -150,7 +157,7 @@ public:
 const char *
 GetConstTrimmedCStringWithLength (const char *cstr, size_t cstr_len)
 {
-if (cstr)
+if (cstr != nullptr)
 {
 const size_t trimmed_len = std::min (strlen (cstr), 
cstr_len);
 return GetConstCStringWithLength (cstr, trimmed_len);
@@ -253,7 +260,7 @@ Stream&
 lldb_private::operator << (Stream& s, const ConstString& str)
 {
 const char *cstr = str.GetCString();
-if (cstr)
+if (cstr != nullptr)
 s << cstr;
 
 return s;
@@ -306,18 +313,18 @@ ConstString::Compare(const ConstString &
 }
 
 if (lhs_cstr)
-return +1;  // LHS isn't NULL but RHS is
+return +1;  // LHS isn't nullptr but RHS is
 else
-return -1;  // LHS is NULL but RHS isn't
+return -1;  // LHS is nullptr but RHS isn't
 }
 
 void
 ConstString::Dump(Stream *s, const char *fail_value) const
 {
-if (s)
+if (s != nullptr)
 {
 const char *cstr = AsCString (fail_value);
-if (cstr)
+if (cstr != nullptr)
 s->PutCString (cstr);
 }
 }
@@ -327,7 +334,7 @@ ConstString::DumpDebug(Stream *s) const
 {
 const char *cstr = GetCString ();
 size_t cstr_len = GetLength();
-// Only print the parens if we have a non-NULL string
+// Only print the parens if we have a non-nullptr string
 const char *parens = cstr ? "\"" : "";
 s->Printf("%*p: ConstString, string = %s%s%s, length = %" PRIu64,
   static_cast(sizeof(void*) * 2),

Modified: lldb/trunk/source/Core/Error.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Error.cpp?rev=263174=263173=263174=diff
==
--- 

Re: [Lldb-commits] [PATCH] D18005: Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union

2016-03-10 Thread Marianne Mailhot-Sarrasin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263166: Fixed ValueObject::GetExpressionPath() for paths 
including anonymous… (authored by mamai).

Changed prior to commit:
  http://reviews.llvm.org/D18005?vs=50192=50353#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18005

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
  lldb/trunk/source/Core/ValueObject.cpp

Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -2536,7 +2536,7 @@
 if (!is_deref_of_parent)
 {
 ValueObject *non_base_class_parent = GetNonBaseClassParent();
-if (non_base_class_parent)
+if (non_base_class_parent && 
!non_base_class_parent->GetName().IsEmpty())
 {
 CompilerType non_base_class_parent_compiler_type = 
non_base_class_parent->GetCompilerType();
 if (non_base_class_parent_compiler_type)
Index: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
@@ -112,6 +112,17 @@
 if not error.Success() or value != 0:
 self.fail ("failed to get the correct value for element a in n")
 
+def test_nest_flat(self):
+self.build()
+self.common_setup(self.line2)
+
+# These should display correctly.
+self.expect('frame variable n --flat',
+substrs = ['n.a = 0',
+   'n.b = 2',
+   'n.foo.c = 0',
+   'n.foo.d = 4'])
+
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)


Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -2536,7 +2536,7 @@
 if (!is_deref_of_parent)
 {
 ValueObject *non_base_class_parent = GetNonBaseClassParent();
-if (non_base_class_parent)
+if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty())
 {
 CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType();
 if (non_base_class_parent_compiler_type)
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
@@ -112,6 +112,17 @@
 if not error.Success() or value != 0:
 self.fail ("failed to get the correct value for element a in n")
 
+def test_nest_flat(self):
+self.build()
+self.common_setup(self.line2)
+
+# These should display correctly.
+self.expect('frame variable n --flat',
+substrs = ['n.a = 0',
+   'n.b = 2',
+   'n.foo.c = 0',
+   'n.foo.d = 4'])
+
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r263166 - Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union

2016-03-10 Thread Marianne Mailhot-Sarrasin via lldb-commits
Author: mamai
Date: Thu Mar 10 16:10:59 2016
New Revision: 263166

URL: http://llvm.org/viewvc/llvm-project?rev=263166=rev
Log:
Fixed ValueObject::GetExpressionPath() for paths including anonymous 
struct/union

When the parent of an expression is anonymous, skip adding '.' or '->' before 
the expression name.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
lldb/trunk/source/Core/ValueObject.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py?rev=263166=263165=263166=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py 
Thu Mar 10 16:10:59 2016
@@ -112,6 +112,17 @@ class AnonymousTestCase(TestBase):
 if not error.Success() or value != 0:
 self.fail ("failed to get the correct value for element a in n")
 
+def test_nest_flat(self):
+self.build()
+self.common_setup(self.line2)
+
+# These should display correctly.
+self.expect('frame variable n --flat',
+substrs = ['n.a = 0',
+   'n.b = 2',
+   'n.foo.c = 0',
+   'n.foo.d = 4'])
+
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=263166=263165=263166=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Mar 10 16:10:59 2016
@@ -2536,7 +2536,7 @@ ValueObject::GetExpressionPath (Stream &
 if (!is_deref_of_parent)
 {
 ValueObject *non_base_class_parent = GetNonBaseClassParent();
-if (non_base_class_parent)
+if (non_base_class_parent && 
!non_base_class_parent->GetName().IsEmpty())
 {
 CompilerType non_base_class_parent_compiler_type = 
non_base_class_parent->GetCompilerType();
 if (non_base_class_parent_compiler_type)


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


Re: [Lldb-commits] [PATCH] D18057: Fixed an issue where python would always use stdin, stdout and stderr

2016-03-10 Thread Greg Clayton via lldb-commits
clayborg closed this revision.
clayborg added a comment.

Submitted with SVN revision 263161.


http://reviews.llvm.org/D18057



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


[Lldb-commits] [lldb] r263161 - Fixed the python interpreter so that it correctly inherits the top IOHandler's files instead of always using stdin/out/err.

2016-03-10 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Thu Mar 10 14:49:32 2016
New Revision: 263161

URL: http://llvm.org/viewvc/llvm-project?rev=263161=rev
Log:
Fixed the python interpreter so that it correctly inherits the top IOHandler's 
files instead of always using stdin/out/err.

Removed lldb_private::File::Duplicate() and the copy constructor and the 
assignment operator that used to duplicate the file handles and made them 
private so no one uses them. Previously the lldb_private::File::Duplicate() 
function duplicated files that used file descriptors, (int) but not file 
streams (FILE *), so the lldb_private::File::Duplicate() function only worked 
some of the time. No one else excep thee ScriptInterpreterPython was using 
these functions, so that aren't needed nor desired. Previously every time you 
would drop into the python interpreter we would duplicate files, and now we 
avoid this file churn.




Modified:
lldb/trunk/include/lldb/Host/File.h
lldb/trunk/source/Host/common/File.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Modified: lldb/trunk/include/lldb/Host/File.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=263161=263160=263161=diff
==
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Thu Mar 10 14:49:32 2016
@@ -74,8 +74,6 @@ public:
 {
 }
 
-File (const File );
-
 //--
 /// Constructor with path.
 ///
@@ -138,9 +136,6 @@ public:
 //--
 ~File() override;
 
-File &
-operator= (const File );
-
 bool
 IsValid() const override
 {
@@ -226,9 +221,6 @@ public:
 void
 Clear ();
 
-Error
-Duplicate (const File );
-
 int
 GetDescriptor() const;
 
@@ -557,6 +549,9 @@ protected:
 LazyBool m_is_interactive;
 LazyBool m_is_real_terminal;
 LazyBool m_supports_colors;
+
+private:
+DISALLOW_COPY_AND_ASSIGN(File);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=263161=263160=263161=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Thu Mar 10 14:49:32 2016
@@ -109,27 +109,6 @@ File::File (const FileSpec& filespec,
 }
 }
 
-File::File (const File ) :
-IOObject(eFDTypeFile, false),
-m_descriptor (kInvalidDescriptor),
-m_stream (kInvalidStream),
-m_options (0),
-m_own_stream (false),
-m_is_interactive (eLazyBoolCalculate),
-m_is_real_terminal (eLazyBoolCalculate)
-{
-Duplicate (rhs);
-}
-
-
-File &
-File::operator = (const File )
-{
-if (this != )
-Duplicate (rhs);
-return *this;
-}
-
 File::~File()
 {
 Close ();
@@ -215,7 +194,6 @@ File::GetStream ()
 return m_stream;
 }
 
-
 void
 File::SetStream (FILE *fh, bool transfer_ownership)
 {
@@ -226,35 +204,6 @@ File::SetStream (FILE *fh, bool transfer
 }
 
 Error
-File::Duplicate (const File )
-{
-Error error;
-if (IsValid ())
-Close();
-
-if (rhs.DescriptorIsValid())
-{
-#ifdef _WIN32
-m_descriptor = ::_dup(rhs.GetDescriptor());
-#else
-m_descriptor = dup(rhs.GetDescriptor());
-#endif
-if (!DescriptorIsValid())
-error.SetErrorToErrno();
-else
-{
-m_options = rhs.m_options;
-m_should_close_fd = true;
-}
-}
-else
-{
-error.SetErrorString ("invalid file to duplicate");
-}
-return error;
-}
-
-Error
 File::Open (const char *path, uint32_t options, uint32_t permissions)
 {
 Error error;

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=263161=263160=263161=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Thu Mar 10 14:49:32 2016
@@ -547,6 +547,27 @@ ScriptInterpreterPython::LeaveSession ()
 }
 
 bool
+ScriptInterpreterPython::SetStdHandle(File , const char *py_name, 
PythonFile _file, const char *mode)
+{
+if (file.IsValid())
+{
+// Flush the file before giving it to python to avoid interleaved 
output.
+file.Flush();
+
+PythonDictionary _module_dict = GetSysModuleDictionary();
+
+save_file = 

[Lldb-commits] Buildbot numbers for week of 2/28/2016 - 3/05/2016

2016-03-10 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the last week of 2/28/2016 - 3/05/2016.

Thanks

Galina


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername| builds |
changes | status change ratio
++-+-
 lldb-windows7-android  | 96 |
49 |51.0
 libcxx-libcxxabi-x86_64-linux-debian   |  2
|   1 |50.0
 clang-native-aarch64-full  | 19
|   9 |47.4
 perf-x86_64-penryn-O3-polly| 74 |
34 |45.9
 clang-ppc64le-linux-lnt| 78 |
30 |38.5
 lldb-x86_64-darwin-13.4|117 |
38 |32.5
 lldb-x86_64-ubuntu-14.04-android   |118 |
34 |28.8
 sanitizer-x86_64-linux | 87 |
24 |27.6
 clang-cmake-aarch64-full   | 37 |
10 |27.0
 clang-ppc64le-linux-multistage | 33
|   6 |18.2
 sanitizer-ppc64le-linux| 49
|   8 |16.3
 llvm-clang-lld-x86_64-debian-fast  |188 |
26 |13.8
 clang-x64-ninja-win7   |171 |
23 |13.5
 sanitizer-x86_64-linux-bootstrap   | 50
|   6 |12.0
 clang-x86-win2008-selfhost |138 |
16 |11.6
 clang-x86_64-debian-fast   |141 |
15 |10.6
 clang-ppc64be-linux-multistage |113 |
12 |10.6
 perf-x86_64-penryn-O3-polly-parallel-fast  |236 |
25 |10.6
 clang-cmake-mipsel | 19
|   2 |10.5
 clang-ppc64be-linux-lnt|191 |
18 | 9.4
 clang-s390x-linux  |283 |
26 | 9.2
 sanitizer-ppc64be-linux| 87
|   8 | 9.2
 clang-ppc64le-linux|201 |
18 | 9.0
 clang-ppc64be-linux|228 |
20 | 8.8
 clang-cmake-armv7-a15-selfhost-neon| 28
|   2 | 7.1
 clang-bpf-build|297 |
20 | 6.7
 lldb-x86_64-ubuntu-14.04-cmake |214 |
14 | 6.5
 clang-cmake-thumbv7-a15|192 |
12 | 6.3
 clang-cmake-mips   | 97
|   6 | 6.2
 clang-atom-d525-fedora-rel | 97
|   6 | 6.2
 clang-cmake-armv7-a15  |164 |
10 | 6.1
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   |372 |
20 | 5.4
 sanitizer-x86_64-linux-fast|197 |
10 | 5.1
 clang-cmake-aarch64-42vma  |158
|   8 | 5.1
 clang-hexagon-elf  |289 |
14 | 4.8
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast |372 |
18 | 4.8
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 23
|   1 | 4.3
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 23
|   1 | 4.3
 clang-cmake-aarch64-quick  |145
|   6 | 4.1
 clang-cmake-armv7-a15-full |104
|   4 | 3.8
 llvm-mips-linux| 60
|   2 | 3.3
 llvm-hexagon-elf   |197
|   6 | 3.0
 lldb-amd64-ninja-netbsd7   |143
|   4 | 2.8
 sanitizer-windows  |343
|   9 | 2.6
 perf-x86_64-penryn-O3-polly-fast   | 40
|   1 | 2.5
 perf-x86_64-penryn-O3-polly-unprofitable   |218
|   5 | 2.3
 sanitizer-x86_64-linux-fuzzer 

[Lldb-commits] Buildbot numbers for week of 2/21/2016 - 2/27/2016

2016-03-10 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the week of 2/21/2016 - 2/27/2016.

Thanks

Galina


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername   | builds |
changes | status change ratio
---++-+-
 sanitizer-x86_64-linux|116 |
54 |46.6
 clang-ppc64le-linux-lnt   | 93 |
39 |41.9
 lldb-windows7-android |137 |
41 |29.9
 clang-cmake-mipsel| 21 |
6 |28.6
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  7 |
2 |28.6
 lldb-x86_64-darwin-13.4   |118 |
33 |28.0
 lldb-x86_64-ubuntu-14.04-android  |120 |
32 |26.7
 clang-cmake-armv7-a15-selfhost| 38 |
10 |26.3
 clang-native-aarch64-full | 18 |
4 |22.2
 libcxx-libcxxabi-arm-linux|  9 |
2 |22.2
 clang-cmake-aarch64-full  | 41 |
9 |22.0
 sanitizer-ppc64le-linux   | 58 |
10 |17.2
 clang-cmake-armv7-a15-selfhost-neon   | 25 |
4 |16.0
 clang-x86_64-debian-fast  |138 |
21 |15.2
 clang-ppc64be-linux-multistage|148 |
22 |14.9
 clang-ppc64le-linux   |206 |
30 |14.6
 llvm-clang-lld-x86_64-debian-fast |186 |
26 |14.0
 clang-x64-ninja-win7  |194 |
26 |13.4
 perf-x86_64-penryn-O3-polly   |160 |
21 |13.1
 clang-cmake-thumbv7-a15-full-sh   | 24 |
3 |12.5
 lld-x86_64-win7   |217 |
26 |12.0
 llvm-mips-linux   | 51 |
6 |11.8
 lldb-x86_64-ubuntu-14.04-cmake|226 |
26 |11.5
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 92 |
10 |10.9
 clang-x86-win2008-selfhost|128 |
14 |10.9
 sanitizer-x86_64-linux-bootstrap  | 56 |
6 |10.7
 sanitizer-ppc64be-linux   |117 |
12 |10.3
 clang-s390x-linux |283 |
28 | 9.9
 clang-ppc64be-linux   |285 |
28 | 9.8
 clang-cmake-aarch64-42vma |181 |
17 | 9.4
 clang-cmake-armv7-a15-full|120 |
11 | 9.2
 sanitizer-x86_64-linux-fast   |181 |
16 | 8.8
 clang-cmake-aarch64-quick |159 |
14 | 8.8
 clang-cmake-thumbv7-a15   |208 |
18 | 8.7
 clang-ppc64be-linux-lnt   |232 |
20 | 8.6
 clang-atom-d525-fedora-rel|120 |
10 | 8.3
 sanitizer-windows |363 |
30 | 8.3
 clang-bpf-build   |297 |
24 | 8.1
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  |375 |
30 | 8.0
 clang-cmake-armv7-a15 |185 |
14 | 7.6
 lldb-x86-windows-msvc2015 |214 |
16 | 7.5
 sanitizer-x86_64-linux-autoconf   |315 |
22 | 7.0
 sanitizer-x86_64-linux-fuzzer |202 |
14 | 6.9
 clang-native-arm-lnt  |117 |
8 | 6.8
 lldb-amd64-ninja-netbsd7  |159 |
10 | 6.3
 clang-hexagon-elf |288 |
18 | 6.3
 lldb-x86_64-ubuntu-14.04-buildserver  |150 |
8 | 5.3
 perf-x86_64-penryn-O3 |150 |
7 | 4.7
 

[Lldb-commits] [PATCH] D18057: Fixed an issue where python would always use stdin, stdout and stderr

2016-03-10 Thread Greg Clayton via lldb-commits
clayborg created this revision.
clayborg added a reviewer: zturner.
clayborg added a subscriber: lldb-commits.

After the Python 3 fixes the interactive python interpreter stopped working in 
Xcode. The issue was the python interpreter tried to adopt the top IOHandler 
file handles, but it failed due to lldb_private::File objects failing to copy 
themselves into another lldb_private::File because they contained "FILE *" file 
stream pointer, not just an integer file descriptor, and File::Duplicate() 
didn't handle duplicating "FILE *". But we really don't want files duplicating 
themselves each time we run a python expression, we just want to use the files.

The fix involves removing File::Duplicate() since we shouldn't be using this 
and duplicating files. It also removes File's assignment operator and copy 
constructor. It then fixes the python interpreter to correctly adopt the file 
handles from the top IOHandler.

http://reviews.llvm.org/D18057

Files:
  include/lldb/Host/File.h
  source/Host/common/File.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -581,6 +581,9 @@
 bool
 GetEmbeddedInterpreterModuleObjects ();
 
+bool
+SetStdHandle(File , const char *py_name, PythonFile _file, const char *mode);
+
 PythonFile m_saved_stdin;
 PythonFile m_saved_stdout;
 PythonFile m_saved_stderr;
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -547,6 +547,27 @@
 }
 
 bool
+ScriptInterpreterPython::SetStdHandle(File , const char *py_name, PythonFile _file, const char *mode)
+{
+if (file.IsValid())
+{
+// Flush the file before giving it to python to avoid interleaved output.
+file.Flush();
+
+PythonDictionary _module_dict = GetSysModuleDictionary();
+
+save_file = sys_module_dict.GetItemForKey(PythonString(py_name)).AsType();
+
+PythonFile new_file(file, mode);
+sys_module_dict.SetItemForKey(PythonString(py_name), new_file);
+return true;
+}
+else
+save_file.Reset();
+return false;
+}
+
+bool
 ScriptInterpreterPython::EnterSession (uint16_t on_entry_flags,
FILE *in,
FILE *out,
@@ -604,54 +625,31 @@
 if (!in_file.IsValid() || !out_file.IsValid() || !err_file.IsValid())
 m_interpreter.GetDebugger().AdoptTopIOHandlerFilesIfInvalid (in_sp, out_sp, err_sp);
 
-m_saved_stdin.Reset();
 
-if ((on_entry_flags & Locker::NoSTDIN) == 0)
+if (on_entry_flags & Locker::NoSTDIN)
 {
-// STDIN is enabled
-if (!in_file.IsValid() && in_sp)
-in_file = in_sp->GetFile();
-if (in_file.IsValid())
+m_saved_stdin.Reset();
+}
+else
+{
+if (!SetStdHandle(in_file, "stdin", m_saved_stdin, "r"))
 {
-// Flush the file before giving it to python to avoid interleaved output.
-in_file.Flush();
-
-m_saved_stdin = sys_module_dict.GetItemForKey(PythonString("stdin")).AsType();
-// This call can deadlock your process if the file is locked
-PythonFile new_file(in_file, "r");
-sys_module_dict.SetItemForKey (PythonString("stdin"), new_file);
+if (in_sp)
+SetStdHandle(in_sp->GetFile(), "stdin", m_saved_stdin, "r");
 }
 }
 
-if (!out_file.IsValid() && out_sp)
-out_file = out_sp->GetFile();
-if (out_file.IsValid())
+if (!SetStdHandle(out_file, "stdout", m_saved_stdout, "w"))
 {
-// Flush the file before giving it to python to avoid interleaved output.
-out_file.Flush();
-
-m_saved_stdout = sys_module_dict.GetItemForKey(PythonString("stdout")).AsType();
-
-PythonFile new_file(out_file, "w");
-sys_module_dict.SetItemForKey (PythonString("stdout"), new_file);
+if (out_sp)
+SetStdHandle(out_sp->GetFile(), "stdout", m_saved_stdout, "w");
 }
-else
-m_saved_stdout.Reset();
 
-if (!err_file.IsValid() && err_sp)
-err_file = err_sp->GetFile();
-if (err_file.IsValid())
+if (!SetStdHandle(err_file, "stderr", m_saved_stderr, "w"))
 {
-// Flush the file 

Re: [Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush

2016-03-10 Thread Marianne Mailhot-Sarrasin via lldb-commits
mamai added a comment.

Could someone commit it for me please? I don't have commit access.


Repository:
  rL LLVM

http://reviews.llvm.org/D18050



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


Re: [Lldb-commits] [PATCH] D18044: Fix a couple of cornercases in FileSpec + tests

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

Looks good.


http://reviews.llvm.org/D18044



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


[Lldb-commits] [PATCH] D18050: Fixed MemoryCache L1 cache flush

2016-03-10 Thread Marianne Mailhot-Sarrasin via lldb-commits
mamai created this revision.
mamai added a reviewer: clayborg.
mamai added a subscriber: lldb-commits.
mamai set the repository for this revision to rL LLVM.

Use the same method to find the cache line as in Read().

Repository:
  rL LLVM

http://reviews.llvm.org/D18050

Files:
  packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile
  packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
  packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp
  source/Target/Memory.cpp

Index: source/Target/Memory.cpp
===
--- source/Target/Memory.cpp
+++ source/Target/Memory.cpp
@@ -78,7 +78,11 @@
 if (!m_L1_cache.empty())
 {
 AddrRange flush_range(addr, size);
-BlockMap::iterator pos = m_L1_cache.lower_bound(addr);
+BlockMap::iterator pos = m_L1_cache.upper_bound(addr);
+if (pos != m_L1_cache.begin())
+{
+--pos;
+}
 while (pos != m_L1_cache.end())
 {
 AddrRange chunk_range(pos->first, pos->second->GetByteSize());
Index: packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp
===
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/memory/cache/main.cpp
@@ -0,0 +1,14 @@
+//===-- main.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+int main ()
+{
+int my_ints[] = {0x42};
+return 0; // Set break point at this line.
+}
Index: packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
@@ -0,0 +1,62 @@
+"""
+Test the MemoryCache L1 flush.
+"""
+
+from __future__ import print_function
+
+
+
+import os, time
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class MemoryCacheTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.line = line_number('main.cpp', '// Set break point at this line.')
+
+def test_memory_cache(self):
+"""Test the MemoryCache class with a sequence of 'memory read' and 'memory write' operations."""
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+# Break in main() after the variables are assigned values.
+lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ['stopped', 'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+substrs = [' resolved, hit count = 1'])
+
+# Read a chunk of memory containing _ints[0]. The number of bytes read
+# must be greater than m_L2_cache_line_byte_size to make sure the L1
+# cache is used.
+self.runCmd('memory read -f d -c 201 `_ints - 100`')
+
+# Check the value of my_ints[0] is the same as set in main.cpp.
+line = self.res.GetOutput().splitlines()[100]
+self.assertTrue(0x0042 == int(line.split(':')[1], 0))
+
+# Change the value of my_ints[0] in memory.
+self.runCmd("memory write `_ints` AA")
+
+# Re-read the chunk of memory. The cache line should have been
+# flushed because of the 'memory write'.
+self.runCmd('memory read -f d -c 201 `_ints - 100`')
+
+# Check the value of my_ints[0] have been updated correctly.
+line = self.res.GetOutput().splitlines()[100]
+self.assertTrue(0x00AA == int(line.split(':')[1], 0))
Index: packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile
===
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/memory/cache/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r263134 - [Renderscript] Add stack argument reading code for Mipsel 3

2016-03-10 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Thu Mar 10 11:50:01 2016
New Revision: 263134

URL: http://llvm.org/viewvc/llvm-project?rev=263134=rev
Log:
[Renderscript] Add stack argument reading code for Mipsel 3

Fix a problem raised with the previous patches being applied in the wrong order.

Committed on behalf of: Dean De Leo 

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263134=263133=263134=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Thu Mar 10 11:50:01 2016
@@ -141,6 +141,8 @@ GetArgsX86(const GetArgsCtx , ArgIte
 {
 Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
 
+Error error;
+
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
 
@@ -365,20 +367,18 @@ GetArgsMipsel(GetArgsCtx , ArgItem *
 else
 {
 const size_t arg_size = sizeof(uint32_t);
-uint64_t sp = ctx.reg_ctx->GetSP();
-uint32_t offset = i * arg_size;
 arg.value = 0;
-Error error;
-size_t bytes_read = ctx.process->ReadMemory(sp + offset, 
, arg_size, error);
+size_t bytes_read = ctx.process->ReadMemory(sp, , 
arg_size, error);
 success = (error.Success() && bytes_read == arg_size);
-if (!success && log)
-log->Printf ("RenderScriptRuntime::GetArgSimple - error 
reading Mips stack: %s.", error.AsCString());
+// advance the stack pointer
+sp += arg_size;
 }
 // fail if we couldn't read this argument
 if (!success)
 {
 if (log)
-log->Printf("%s - error reading argument: %" PRIu64, 
__FUNCTION__, uint64_t(i));
+log->Printf("%s - error reading argument: %" PRIu64", reason: 
%s",
+__FUNCTION__, uint64_t(i), error.AsCString("n/a"));
 return false;
 }
 }


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


[Lldb-commits] [lldb] r263131 - [Renderscript] Add stack argument reading code for Mipsel 2

2016-03-10 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Thu Mar 10 11:37:02 2016
New Revision: 263131

URL: http://llvm.org/viewvc/llvm-project?rev=263131=rev
Log:
[Renderscript] Add stack argument reading code for Mipsel 2

This commit implements the reading of stack spilled function arguments for 
little endian MIPS targets.

Committed on behalf of: Dean De Leo 

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263131=263130=263131=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Thu Mar 10 11:37:02 2016
@@ -364,8 +364,15 @@ GetArgsMipsel(GetArgsCtx , ArgItem *
 // arguments passed on the stack
 else
 {
-if (log)
-log->Printf("%s - reading arguments spilled to stack not 
implemented.", __FUNCTION__);
+const size_t arg_size = sizeof(uint32_t);
+uint64_t sp = ctx.reg_ctx->GetSP();
+uint32_t offset = i * arg_size;
+arg.value = 0;
+Error error;
+size_t bytes_read = ctx.process->ReadMemory(sp + offset, 
, arg_size, error);
+success = (error.Success() && bytes_read == arg_size);
+if (!success && log)
+log->Printf ("RenderScriptRuntime::GetArgSimple - error 
reading Mips stack: %s.", error.AsCString());
 }
 // fail if we couldn't read this argument
 if (!success)


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


[Lldb-commits] [lldb] r263130 - [Renderscript] Add stack argument reading code for Mipsel

2016-03-10 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Thu Mar 10 11:27:41 2016
New Revision: 263130

URL: http://llvm.org/viewvc/llvm-project?rev=263130=rev
Log:
[Renderscript] Add stack argument reading code for Mipsel

This commit implements the reading of stack spilled function arguments for 
little endian MIPS targets.

Committed on behalf of: Dean De Leo 

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263130=263129=263130=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Thu Mar 10 11:27:41 2016
@@ -184,6 +184,8 @@ GetArgsX86_64(GetArgsCtx , ArgItem *
 4, // eBool,
 }};
 
+Error error;
+
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
 // step over the return address
@@ -227,7 +229,6 @@ GetArgsX86_64(GetArgsCtx , ArgItem *
 // read the argument from memory
 arg.value = 0;
 // note: due to little endian layout reading 4 or 8 bytes will 
give the correct value.
-Error error;
 size_t read = ctx.process->ReadMemory(sp, , size, error);
 success = (error.Success() && read==size);
 // advance past this argument
@@ -237,7 +238,8 @@ GetArgsX86_64(GetArgsCtx , ArgItem *
 if (!success)
 {
 if (log)
-log->Printf("%s - error reading argument: %" PRIu64, 
__FUNCTION__, uint64_t(i));
+log->Printf("%s - error reading argument: %" PRIu64", reason: 
%s",
+__FUNCTION__, uint64_t(i), error.AsCString("n/a"));
 return false;
 }
 }
@@ -252,6 +254,8 @@ GetArgsArm(GetArgsCtx , ArgItem *arg
 
 Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
 
+Error error;
+
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
 
@@ -275,7 +279,6 @@ GetArgsArm(GetArgsCtx , ArgItem *arg
 // clear all 64bits
 arg.value = 0;
 // read this argument from memory
-Error error;
 size_t bytes_read = ctx.process->ReadMemory(sp, , 
arg_size, error);
 success = (error.Success() && bytes_read == arg_size);
 // advance the stack pointer
@@ -285,7 +288,8 @@ GetArgsArm(GetArgsCtx , ArgItem *arg
 if (!success)
 {
 if (log)
-log->Printf("%s - error reading argument: %" PRIu64, 
__FUNCTION__, uint64_t(i));
+log->Printf("%s - error reading argument: %" PRIu64", reason: 
%s",
+__FUNCTION__, uint64_t(i), error.AsCString("n/a"));
 return false;
 }
 }
@@ -340,6 +344,11 @@ GetArgsMipsel(GetArgsCtx , ArgItem *
 
 Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
 
+Error error;
+
+// find offset to arguments on the stack (+16 to skip over a0-a3 shadow 
space)
+uint64_t sp = ctx.reg_ctx->GetSP() + 16;
+
 for (size_t i = 0; i < num_args; ++i)
 {
 bool success = false;
@@ -379,6 +388,8 @@ GetArgsMips64el(GetArgsCtx , ArgItem
 
 Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
 
+Error error;
+
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
 
@@ -402,7 +413,6 @@ GetArgsMips64el(GetArgsCtx , ArgItem
 // clear all 64bits
 arg.value = 0;
 // read this argument from memory
-Error error;
 size_t bytes_read = ctx.process->ReadMemory(sp, , 
arg_size, error);
 success = (error.Success() && bytes_read == arg_size);
 // advance the stack pointer
@@ -412,7 +422,8 @@ GetArgsMips64el(GetArgsCtx , ArgItem
 if (!success)
 {
 if (log)
-log->Printf("%s - error reading argument: %" PRIu64, 
__FUNCTION__, uint64_t(i));
+log->Printf("%s - error reading argument: %" PRIu64", reason: 
%s",
+__FUNCTION__, uint64_t(i), error.AsCString("n/a"));
 return false;
 }
 }


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


[Lldb-commits] [lldb] r263129 - [Renderscript] Explicitly set the language to evaluate allocations

2016-03-10 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Thu Mar 10 11:23:33 2016
New Revision: 263129

URL: http://llvm.org/viewvc/llvm-project?rev=263129=rev
Log:
[Renderscript] Explicitly set the language to evaluate allocations

Currently it is not specified, and since allocations are usually
requested once we hit a renderscript breakpoint, the language will be
inferred being as renderscript by the ExpressionParser.
Actually allocations attempt to invoke functions part of the RS runtime,
written in C/C++, so evaluating the calls in RenderScript could be
misleading.

In particular, in MIPS, the ABI between C/C++ (mips o32) and
renderscript (arm) might introduce subtle bugs when evaluating such
expressions.

This change explicitly sets the language used to evaluate the allocations
as C++.

Committed on behalf of: Dean De Leo 

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263129=263128=263129=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Thu Mar 10 11:23:33 2016
@@ -1457,8 +1457,10 @@ RenderScriptRuntime::EvalRSExpression(co
 log->Printf("%s(%s)", __FUNCTION__, expression);
 
 ValueObjectSP expr_result;
+EvaluateExpressionOptions options;
+options.SetLanguage(lldb::eLanguageTypeC_plus_plus);
 // Perform the actual expression evaluation
-GetProcess()->GetTarget().EvaluateExpression(expression, frame_ptr, 
expr_result);
+GetProcess()->GetTarget().EvaluateExpression(expression, frame_ptr, 
expr_result, options);
 
 if (!expr_result)
 {


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


Re: [Lldb-commits] [PATCH] D16872: Move some of the common decorators to decorators.py

2016-03-10 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.

This happened, right?  Can we close?


http://reviews.llvm.org/D16872



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


[Lldb-commits] [lldb] r263122 - Eliminate the TestStarted-XXX and TestFinished-XXX files from check-lldb runs.

2016-03-10 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Thu Mar 10 09:41:11 2016
New Revision: 263122

URL: http://llvm.org/viewvc/llvm-project?rev=263122=rev
Log:
Eliminate the TestStarted-XXX and TestFinished-XXX files from check-lldb runs.

Nobody seems to know what purpose these files serve, yet they were accumulating 
by the thousands in the test traces directory.  I'm proposing we delete them.

Creating these files accounted for about 2.5% of the time to run ninja 
check-lldb on my machine, which isn't a lot, but it's something.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=263122=263121=263122=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Thu Mar 10 09:41:11 2016
@@ -987,12 +987,6 @@ def run_suite():
 except OSError as exception:
 if exception.errno != errno.EEXIST:
 raise
-where_to_save_session = os.getcwd()
-fname = os.path.join(configuration.sdir_name, "TestStarted-%d" % 
os.getpid())
-with open(fname, "w") as f:
-print("Test started at: %s\n" % timestamp_started, file=f)
-print(configuration.svn_info, file=f)
-print("Command invoked: %s\n" % getMyCommandLine(), file=f)
 
 #
 # Invoke the default TextTestRunner to run the test suite, possibly 
iterating
@@ -1109,11 +1103,6 @@ def run_suite():
 for category in configuration.failuresPerCategory:
 sys.stderr.write("%s - %d\n" % (category, 
configuration.failuresPerCategory[category]))
 
-os.chdir(where_to_save_session)
-fname = os.path.join(configuration.sdir_name, "TestFinished-%d" % 
os.getpid())
-with open(fname, "w") as f:
-print("Test finished at: %s\n" % 
datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S"), file=f)
-
 # Terminate the test suite if ${LLDB_TESTSUITE_FORCE_FINISH} is defined.
 # This should not be necessary now.
 if ("LLDB_TESTSUITE_FORCE_FINISH" in os.environ):


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


Re: [Lldb-commits] [PATCH] D18044: Fix a couple of cornercases in FileSpec + tests

2016-03-10 Thread Pavel Labath via lldb-commits
labath added a comment.





Comment at: unittests/Host/FileSpecTest.cpp:57
@@ +56,3 @@
+// We get "F:/bar" instead.
+// EXPECT_STREQ("F:\\bar", 
fs_windows_trailing_slash.GetDirectory().GetCString());
+EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString());

I've also identified one more issue in windows path handling (GetDirectory() 
always returns posix-style paths), which I do not attempt to address right now.


http://reviews.llvm.org/D18044



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


[Lldb-commits] [PATCH] D18044: Fix a couple of cornercases in FileSpec + tests

2016-03-10 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, zturner.
labath added a subscriber: lldb-commits.

This fixes a couple of corner cases in FileSpec, related to AppendPathComponent 
and
handling of root directory (/) file spec. I add a bunch of unit tests for the 
new behavior.

Summary of changes:
FileSpec("/bar").GetCString(): before "//bar", after "/bar".
FileSpec("/").CopyByAppendingPathComponent("bar").GetCString(): before "//bar", 
after "/bar".
FileSpec("C:", 
ePathSyntaxWindows).CopyByAppendingPathComponent("bar").GetCString(): before 
"C:/bar", after "C:\bar".

http://reviews.llvm.org/D18044

Files:
  source/Host/common/FileSpec.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/FileSpecTest.cpp

Index: unittests/Host/FileSpecTest.cpp
===
--- /dev/null
+++ unittests/Host/FileSpecTest.cpp
@@ -0,0 +1,94 @@
+//===-- FileSpecTest.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Host/FileSpec.h"
+
+using namespace lldb_private;
+
+TEST(FileSpecTest, FileAndDirectoryComponents)
+{
+FileSpec fs_posix("/foo/bar", false, FileSpec::ePathSyntaxPosix);
+EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
+EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
+EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
+
+FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
+EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString());
+EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
+
+FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
+EXPECT_STREQ("/", fs_posix_root.GetCString());
+EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString());
+EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString());
+
+FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:", fs_windows_root.GetCString());
+EXPECT_EQ(nullptr, fs_windows_root.GetDirectory().GetCString());
+EXPECT_STREQ("F:", fs_windows_root.GetFilename().GetCString());
+
+FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::ePathSyntaxPosix);
+EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString());
+EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString());
+EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString());
+
+FileSpec fs_windows_long("F:\\bar\\baz", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
+// We get "F:/bar" instead.
+// EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
+EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
+
+FileSpec fs_posix_trailing_slash("/foo/bar/", false, FileSpec::ePathSyntaxPosix);
+EXPECT_STREQ("/foo/bar/.", fs_posix_trailing_slash.GetCString());
+EXPECT_STREQ("/foo/bar", fs_posix_trailing_slash.GetDirectory().GetCString());
+EXPECT_STREQ(".", fs_posix_trailing_slash.GetFilename().GetCString());
+
+FileSpec fs_windows_trailing_slash("F:\\bar\\", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString());
+// We get "F:/bar" instead.
+// EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetDirectory().GetCString());
+EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString());
+}
+
+TEST(FileSpecTest, AppendPathComponent)
+{
+FileSpec fs_posix("/foo", false, FileSpec::ePathSyntaxPosix);
+fs_posix.AppendPathComponent("bar");
+EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
+EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
+EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
+
+FileSpec fs_windows("F:", false, FileSpec::ePathSyntaxWindows);
+fs_windows.AppendPathComponent("bar");
+EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
+EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString());
+EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
+
+FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
+fs_posix_root.AppendPathComponent("bar");
+EXPECT_STREQ("/bar", fs_posix_root.GetCString());
+EXPECT_STREQ("/", fs_posix_root.GetDirectory().GetCString());
+EXPECT_STREQ("bar", fs_posix_root.GetFilename().GetCString());
+
+FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows);
+fs_windows_root.AppendPathComponent("bar");
+EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
+EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
+EXPECT_STREQ("bar", 

[Lldb-commits] [lldb] r263107 - Revert "Track expression language from one place in ClangExpressionParser"

2016-03-10 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Thu Mar 10 06:38:55 2016
New Revision: 263107

URL: http://llvm.org/viewvc/llvm-project?rev=263107=rev
Log:
Revert "Track expression language from one place in ClangExpressionParser"

r263099 seems to have broken some OSX tests

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=263107=263106=263107=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Mar 10 06:38:55 2016
@@ -157,7 +157,7 @@ ClangExpressionParser::ClangExpressionPa
 
 // 1. Create a new compiler instance.
 m_compiler.reset(new CompilerInstance());
-m_language = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
+lldb::LanguageType frame_lang = expr.Language(); // defaults to 
lldb::eLanguageTypeUnknown
 bool overridden_target_opts = false;
 lldb_private::LanguageRuntime *lang_rt = nullptr;
 lldb::TargetSP target_sp;
@@ -176,14 +176,14 @@ ClangExpressionParser::ClangExpressionPa
 
 // Make sure the user hasn't provided a preferred execution language
 // with `expression --language X -- ...`
-if (frame && m_language == lldb::eLanguageTypeUnknown)
-m_language = frame->GetLanguage();
+if (frame && frame_lang == lldb::eLanguageTypeUnknown)
+frame_lang = frame->GetLanguage();
 
-if (m_language != lldb::eLanguageTypeUnknown)
+if (frame_lang != lldb::eLanguageTypeUnknown)
 {
-lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(m_language);
+lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(frame_lang);
 if (log)
-log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(m_language));
+log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(frame_lang));
 }
 
 // 2. Configure the compiler with a set of default options that are 
appropriate
@@ -263,7 +263,9 @@ ClangExpressionParser::ClangExpressionPa
 assert (m_compiler->hasTarget());
 
 // 5. Set language options.
-switch (m_language)
+lldb::LanguageType language = expr.Language();
+
+switch (language)
 {
 case lldb::eLanguageTypeC:
 case lldb::eLanguageTypeC89:

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h?rev=263107=263106=263107=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h 
Thu Mar 10 06:38:55 2016
@@ -129,8 +129,6 @@ private:
 class LLDBPreprocessorCallbacks;
 LLDBPreprocessorCallbacks   *m_pp_callbacks; ///< 
Called when the preprocessor encounters module imports
 std::unique_ptr m_ast_context;
-lldb::LanguageType   m_language;///< The 
the source language of the expression
-/// which 
may be explicitly set or inferred.
 };
 
 }


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


Re: [Lldb-commits] [PATCH] D17719: Track expression language from one place in ClangExpressionParser

2016-03-10 Thread Ewan Crawford via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263099: Track expression language from one place in 
ClangExpressionParser (authored by EwanCrawford).

Changed prior to commit:
  http://reviews.llvm.org/D17719?vs=49531=50253#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17719

Files:
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h

Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
@@ -129,6 +129,8 @@
 class LLDBPreprocessorCallbacks;
 LLDBPreprocessorCallbacks   *m_pp_callbacks; ///< 
Called when the preprocessor encounters module imports
 std::unique_ptr m_ast_context;
+lldb::LanguageType   m_language;///< The 
the source language of the expression
+/// which 
may be explicitly set or inferred.
 };
 
 }
Index: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -157,7 +157,7 @@
 
 // 1. Create a new compiler instance.
 m_compiler.reset(new CompilerInstance());
-lldb::LanguageType frame_lang = expr.Language(); // defaults to 
lldb::eLanguageTypeUnknown
+m_language = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
 bool overridden_target_opts = false;
 lldb_private::LanguageRuntime *lang_rt = nullptr;
 lldb::TargetSP target_sp;
@@ -176,14 +176,14 @@
 
 // Make sure the user hasn't provided a preferred execution language
 // with `expression --language X -- ...`
-if (frame && frame_lang == lldb::eLanguageTypeUnknown)
-frame_lang = frame->GetLanguage();
+if (frame && m_language == lldb::eLanguageTypeUnknown)
+m_language = frame->GetLanguage();
 
-if (frame_lang != lldb::eLanguageTypeUnknown)
+if (m_language != lldb::eLanguageTypeUnknown)
 {
-lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(frame_lang);
+lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(m_language);
 if (log)
-log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(frame_lang));
+log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(m_language));
 }
 
 // 2. Configure the compiler with a set of default options that are 
appropriate
@@ -263,9 +263,7 @@
 assert (m_compiler->hasTarget());
 
 // 5. Set language options.
-lldb::LanguageType language = expr.Language();
-
-switch (language)
+switch (m_language)
 {
 case lldb::eLanguageTypeC:
 case lldb::eLanguageTypeC89:


Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
@@ -129,6 +129,8 @@
 class LLDBPreprocessorCallbacks;
 LLDBPreprocessorCallbacks   *m_pp_callbacks; ///< Called when the preprocessor encounters module imports
 std::unique_ptr m_ast_context;
+lldb::LanguageType   m_language;///< The the source language of the expression
+/// which may be explicitly set or inferred.
 };
 
 }
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -157,7 +157,7 @@
 
 // 1. Create a new compiler instance.
 m_compiler.reset(new CompilerInstance());
-lldb::LanguageType frame_lang = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
+m_language = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
 bool overridden_target_opts = false;
 lldb_private::LanguageRuntime *lang_rt = nullptr;
 lldb::TargetSP target_sp;
@@ -176,14 +176,14 @@
 
 // Make sure the user hasn't provided a preferred execution language
 // with `expression --language X -- ...`
-if (frame && frame_lang == lldb::eLanguageTypeUnknown)
-frame_lang = frame->GetLanguage();
+if (frame && m_language == 

[Lldb-commits] [lldb] r263099 - Track expression language from one place in ClangExpressionParser

2016-03-10 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Thu Mar 10 04:31:08 2016
New Revision: 263099

URL: http://llvm.org/viewvc/llvm-project?rev=263099=rev
Log:
Track expression language from one place in ClangExpressionParser

The current expression language is currently tracked in a few places within the 
ClangExpressionParser constructor. 
This patch adds a private lldb::LanguageType attribute to the 
ClangExpressionParser class and tracks the expression language from that one 
place.

Author: Luke Drummond 
Differential Revision: http://reviews.llvm.org/D17719

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=263099=263098=263099=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Mar 10 04:31:08 2016
@@ -157,7 +157,7 @@ ClangExpressionParser::ClangExpressionPa
 
 // 1. Create a new compiler instance.
 m_compiler.reset(new CompilerInstance());
-lldb::LanguageType frame_lang = expr.Language(); // defaults to 
lldb::eLanguageTypeUnknown
+m_language = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
 bool overridden_target_opts = false;
 lldb_private::LanguageRuntime *lang_rt = nullptr;
 lldb::TargetSP target_sp;
@@ -176,14 +176,14 @@ ClangExpressionParser::ClangExpressionPa
 
 // Make sure the user hasn't provided a preferred execution language
 // with `expression --language X -- ...`
-if (frame && frame_lang == lldb::eLanguageTypeUnknown)
-frame_lang = frame->GetLanguage();
+if (frame && m_language == lldb::eLanguageTypeUnknown)
+m_language = frame->GetLanguage();
 
-if (frame_lang != lldb::eLanguageTypeUnknown)
+if (m_language != lldb::eLanguageTypeUnknown)
 {
-lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(frame_lang);
+lang_rt = 
exe_scope->CalculateProcess()->GetLanguageRuntime(m_language);
 if (log)
-log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(frame_lang));
+log->Printf("Frame has language of type %s", 
Language::GetNameForLanguageType(m_language));
 }
 
 // 2. Configure the compiler with a set of default options that are 
appropriate
@@ -263,9 +263,7 @@ ClangExpressionParser::ClangExpressionPa
 assert (m_compiler->hasTarget());
 
 // 5. Set language options.
-lldb::LanguageType language = expr.Language();
-
-switch (language)
+switch (m_language)
 {
 case lldb::eLanguageTypeC:
 case lldb::eLanguageTypeC89:

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h?rev=263099=263098=263099=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h 
Thu Mar 10 04:31:08 2016
@@ -129,6 +129,8 @@ private:
 class LLDBPreprocessorCallbacks;
 LLDBPreprocessorCallbacks   *m_pp_callbacks; ///< 
Called when the preprocessor encounters module imports
 std::unique_ptr m_ast_context;
+lldb::LanguageType   m_language;///< The 
the source language of the expression
+/// which 
may be explicitly set or inferred.
 };
 
 }


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


Re: [Lldb-commits] [PATCH] D18017: Eliminate the TestStarted-XXX and TestFinished-XXX files from the test traces

2016-03-10 Thread Pavel Labath via lldb-commits
labath accepted this revision.
labath added a comment.

In http://reviews.llvm.org/D18017#371362, @zturner wrote:

> lgtm, Pavel does Android build infrastructure need these files for some 
> reason?


Nope, let's get rid of them.


http://reviews.llvm.org/D18017



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