Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Pavel Labath via lldb-commits
labath added a comment.

Looks good to me. :)

If you do end up adding a command line option, I think you can go for 
`--enable-core-on-timeout` and default to off for all platforms. I suspect I am 
the only one using this, and it makes a much safer default.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D12994: Improve support of the ncurses dependency on NetBSD

2015-09-28 Thread Pavel Labath via lldb-commits
labath added a subscriber: labath.
labath added a comment.

In http://reviews.llvm.org/D12994#254468, @brucem wrote:

> I'm also not sure offhand how this would impact the Xcode build that the 
> Apple folks use.


Since the xcode build is only used on Darwin, I think we can hardcode any 
#defines that are needed in the xcode project.


Repository:
  rL LLVM

http://reviews.llvm.org/D12994



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


Re: [Lldb-commits] [PATCH] D13201: Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile()

2015-09-28 Thread Vadim Macagon via lldb-commits
enlight added a comment.

I've updated the summary with the scenario. I don't know how one would go about 
writing a test for this, mixed platform remote debugging is a bit finicky.



Comment at: source/Host/common/Symbols.cpp:238-250
@@ -237,15 +237,15 @@
 
 // Add /usr/lib/debug directory.
 debug_file_search_paths.AppendIfUnique (FileSpec("/usr/lib/debug", 
true));
 
 std::string uuid_str;
 const UUID &module_uuid = module_spec.GetUUID();
 if (module_uuid.IsValid())
 {
 // Some debug files are stored in the .build-id directory like 
this:
 //   
/usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
 uuid_str = module_uuid.GetAsString("");
 uuid_str.insert (2, 1, '/');
 uuid_str = uuid_str + ".debug";
 }
 

zturner wrote:
> Can you do all of this only if the target is not Windows?
You mean if the **host** is not Windows? Skipping `/usr/lib/debug` on Windows 
makes sense, but it seems like the `uuid_str` stuff could still apply if the 
symbol files are copied to or shared with Windows.


Comment at: source/Host/common/Symbols.cpp:263-270
@@ -266,6 +262,10 @@
 
 files.push_back (dirname + "/" + symbol_filename);
 files.push_back (dirname + "/.debug/" + symbol_filename);
 files.push_back (dirname + "/.build-id/" + uuid_str);
-files.push_back (dirname + module_directory + "/" + 
symbol_filename);
+
+// Some debug files may stored in the module directory like this:
+//   /usr/lib/debug/usr/lib/library.so.debug
+if (!file_dir.IsEmpty())
+files.push_back (dirname + file_dir.AsCString() + "/" + 
symbol_filename);
 

zturner wrote:
> Don't use literal slashes anywhere.  I know you're just copying the existing 
> code, which was already broken, but it seems easy enough to fix all this by 
> calling llvm::sys::path::append, which will do the right thing dependign on 
> the Host platform.
> 
> Since this code is in Host, it's ok to do this, since we're ultimately going 
> to pass this path directly through to the filesystem anyway, we already need 
> to be able to assume that we're dealing with a path that has the appropriate 
> separator for the platform anyway.
I'll submit a separate patch for the requested path separator changes. I'd 
prefer to do it after this patch though.


Repository:
  rL LLVM

http://reviews.llvm.org/D13201



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


[Lldb-commits] [lldb] r248702 - Revert "Fix race condition during process detach"

2015-09-28 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Sep 28 04:37:51 2015
New Revision: 248702

URL: http://llvm.org/viewvc/llvm-project?rev=248702&view=rev
Log:
Revert "Fix race condition during process detach"

This fix is not correct on its own until D12968 is resolved. Will resumbit once 
that is done.

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp
lldb/trunk/test/functionalities/attach_resume/TestAttachResume.py

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=248702&r1=248701&r2=248702&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Sep 28 04:37:51 2015
@@ -3479,7 +3479,7 @@ protected:
 }
 
 Error
-StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
+HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
 
 bool
 StateChangedIsExternallyHijacked();

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=248702&r1=248701&r2=248702&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Sep 28 04:37:51 2015
@@ -3916,46 +3916,52 @@ Process::Halt (bool clear_thread_plans)
 }
 
 Error
-Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp)
+Process::HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp)
 {
 Error error;
 if (m_public_state.GetValue() == eStateRunning)
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 if (log)
-log->Printf("Process::%s() About to stop.", __FUNCTION__);
-
-SendAsyncInterrupt();
-
-// Consume the interrupt event.
-TimeValue timeout (TimeValue::Now());
-timeout.OffsetWithSeconds(10);
-StateType state = WaitForProcessToStop (&timeout, &exit_event_sp);
-
-// If the process exited while we were waiting for it to stop, put the 
exited event into
-// the shared pointer passed in and return.  Our caller doesn't need 
to do anything else, since
-// they don't have a process anymore...
-
-if (state == eStateExited || m_private_state.GetValue() == 
eStateExited)
+log->Printf("Process::%s() About to halt.", __FUNCTION__);
+error = Halt();
+if (error.Success())
 {
-if (log)
-log->Printf("Process::%s() Process exited while waiting to 
stop.", __FUNCTION__);
-return error;
+// Consume the halt event.
+TimeValue timeout (TimeValue::Now());
+timeout.OffsetWithSeconds(1);
+StateType state = WaitForProcessToStop (&timeout, &exit_event_sp);
+
+// If the process exited while we were waiting for it to stop, put 
the exited event into
+// the shared pointer passed in and return.  Our caller doesn't 
need to do anything else, since
+// they don't have a process anymore...
+
+if (state == eStateExited || m_private_state.GetValue() == 
eStateExited)
+{
+if (log)
+log->Printf("Process::HaltForDestroyOrDetach() Process 
exited while waiting to Halt.");
+return error;
+}
+else
+exit_event_sp.reset(); // It is ok to consume any non-exit 
stop events
+
+if (state != eStateStopped)
+{
+if (log)
+log->Printf("Process::HaltForDestroyOrDetach() Halt failed 
to stop, state is: %s", StateAsCString(state));
+// If we really couldn't stop the process then we should just 
error out here, but if the
+// lower levels just bobbled sending the event and we really 
are stopped, then continue on.
+StateType private_state = m_private_state.GetValue();
+if (private_state != eStateStopped)
+{
+return error;
+}
+}
 }
 else
-exit_event_sp.reset(); // It is ok to consume any non-exit stop 
events
-
-if (state != eStateStopped)
 {
 if (log)
-log->Printf("Process::%s() failed to stop, state is: %s", 
__FUNCTION__, StateAsCString(state));
-// If we really couldn't stop the process then we should just 
error out here, but if the
-// lower levels just bobbled sending the event and we really are 
stopped, then continue on.
-StateType private_state = m_private_state.GetValue();
-if (private_state != eStateStopped)
-{
-return error;
-}
+log->Printf("

Re: [Lldb-commits] [PATCH] D13056: Fix race condition during process detach

2015-09-28 Thread Pavel Labath via lldb-commits
labath added a comment.

I have reverted this for now. This fix is not complete without 
http://reviews.llvm.org/D12968.


Repository:
  rL LLVM

http://reviews.llvm.org/D13056



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


Re: [Lldb-commits] [PATCH] D12994: Improve support of the ncurses dependency on NetBSD

2015-09-28 Thread Kamil Rytarowski via lldb-commits
krytarowski added inline comments.


Comment at: include/lldb/Config/config.h.cmake:6
@@ +5,3 @@
+#else
+#define CONFIG_H
+

brucem wrote:
> brucem wrote:
> > This should be `LLDB_CONFIG_CONFIG_H` rather than just `CONFIG_H`.
> > 
> > Also, why not use the same `#ifndef` technique that everything else uses in 
> > the header files?
> Also, other headers in LLDB tend to have capitalized names, so maybe this 
> should be `include/lldb/Config/Config.h.cmake`.
I was following the clang/llvm approach of exclusing llvm's config.h and 
subprojects' one.


Repository:
  rL LLVM

http://reviews.llvm.org/D12994



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


[Lldb-commits] [lldb] r248711 - Remove XTIMEOUT from TestProcessAttach on linux

2015-09-28 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Sep 28 08:27:48 2015
New Revision: 248711

URL: http://llvm.org/viewvc/llvm-project?rev=248711&view=rev
Log:
Remove XTIMEOUT from TestProcessAttach on 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=248711&r1=248710&r2=248711&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Mon Sep 28 08:27:48 2015
@@ -959,7 +959,6 @@ def getExpectedTimeouts(platform_name):
 
 if target.startswith("linux"):
 expected_timeout |= {
-"TestProcessAttach.py",
 "TestConnectRemote.py",
 "TestCreateAfterAttach.py",
 "TestEvents.py",


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


Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run

2015-09-28 Thread Kirill Lapshin via lldb-commits
KLapshin updated the summary for this revision.
KLapshin updated this revision to Diff 35865.

Repository:
  rL LLVM

http://reviews.llvm.org/D12977

Files:
  test/tools/lldb-mi/control/TestMiExec.py
  tools/lldb-mi/MICmdCmdExec.cpp
  tools/lldb-mi/MICmdCmdExec.h
  tools/lldb-mi/MICmdCmdSupportList.cpp

Index: tools/lldb-mi/MICmdCmdExec.cpp
===
--- tools/lldb-mi/MICmdCmdExec.cpp
+++ tools/lldb-mi/MICmdCmdExec.cpp
@@ -48,6 +48,7 @@
 // Throws:  None.
 //--
 CMICmdCmdExecRun::CMICmdCmdExecRun()
+: m_constStrArgStart("start")
 {
 // Command factory matches this name with that received from the stdin stream
 m_strMiCmd = "exec-run";
@@ -68,6 +69,23 @@
 }
 
 //++ 
+// Details: The invoker requires this function. The parses the command line options
+//  arguments to extract values for each of those arguments.
+// Type:Overridden.
+// Args:None.
+// Return:  MIstatus::success - Functional succeeded.
+//  MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMICmdCmdExecRun::ParseArgs()
+{
+m_setCmdArgs.Add(
+new CMICmdArgValOptionLong(m_constStrArgStart, false, true, CMICmdArgValListBase::eArgValType_OptionLong, 0));
+return ParseValidateCmdOptions();
+}
+
+//++ 
 // Details: The invoker requires this function. The command does work in this function.
 //  The command is likely to communicate with the LLDB SBDebugger in here.
 // Type:Overridden.
@@ -84,6 +102,15 @@
 lldb::SBStream errMsg;
 lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo();
 launchInfo.SetListener(rSessionInfo.GetListener());
+
+CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart);
+
+// Run to first instruction or main() requested ?
+if (pArgStart->GetFound())
+{
+launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() | lldb::eLaunchFlagStopAtEntry);
+}
+
 lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error);
 if ((!process.IsValid()) || (error.Fail()))
 {
Index: tools/lldb-mi/MICmdCmdExec.h
===
--- tools/lldb-mi/MICmdCmdExec.h
+++ tools/lldb-mi/MICmdCmdExec.h
@@ -55,6 +55,7 @@
 // From CMICmdInvoker::ICmd
 bool Execute() override;
 bool Acknowledge() override;
+bool ParseArgs() override;
 // From CMICmnBase
 /* dtor */ ~CMICmdCmdExecRun() override;
 
@@ -61,6 +62,7 @@
 // Attributes:
   private:
 lldb::SBCommandReturnObject m_lldbResult;
+const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first instruction or main(), just run process if not specified
 };
 
 //++ 
Index: tools/lldb-mi/MICmdCmdSupportList.cpp
===
--- tools/lldb-mi/MICmdCmdSupportList.cpp
+++ tools/lldb-mi/MICmdCmdSupportList.cpp
@@ -71,8 +71,13 @@
 bool
 CMICmdCmdSupportListFeatures::Acknowledge()
 {
-const CMICmnMIValueConst miValueConst("data-read-memory-bytes");
-const CMICmnMIValueList miValueList(miValueConst);
+// Declare supported features here
+const CMICmnMIValueConst miValueConst1("data-read-memory-bytes");
+const CMICmnMIValueConst miValueConst2("exec-run-start-option");
+CMICmnMIValueList miValueList(true);
+// Some features may depend on host or/and target, decide what to add below
+miValueList.Add(miValueConst1);
+miValueList.Add(miValueConst2);
 const CMICmnMIValueResult miValueResult("features", miValueList);
 const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult);
 m_miResultRecord = miRecordResult;
Index: test/tools/lldb-mi/control/TestMiExec.py
===
--- test/tools/lldb-mi/control/TestMiExec.py
+++ test/tools/lldb-mi/control/TestMiExec.py
@@ -12,6 +12,25 @@
 
 @lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented
+def test_lldbmi_exec_run(self):
+"""Test that 'lldb-mi --interpreter' can stop at entry."""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+# Test that program is stopped at entry
+self.runCmd("-exec-run --start")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
+# Test that lldb-mi is ready to execute n

Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run

2015-09-28 Thread Kirill Lapshin via lldb-commits
KLapshin marked an inline comment as done.
KLapshin added a comment.

Requested changes applied, updated patch uploaded.



Comment at: tools/lldb-mi/MICmdCmdExec.h:58
@@ -57,2 +57,3 @@
 bool Acknowledge() override;
+bool ParseArgs() override;
 // From CMICmnBase

Ilia, I checked string positions for ParseArgs() method in MICmdCmdExec.h and 
other command headers - ParseArgs() placed always third, so this change done in 
accordance with current, at least public, lldb-mi headers and minimal patching 
as possible.

What inconsistency you mentioned ?

Please take a look on ExecRun command class modified with ParseArgs() method 
added and non-modified classes in lldb-mi - ExecFinish or ExecNext, for example:


```
class CMICmdCmdExecRun : public CMICmdBase
{
// Statics:
  public:
// Required by the CMICmdFactory when registering *this command
static CMICmdBase *CreateSelf();

// Methods:
  public:
/* ctor */ CMICmdCmdExecRun();

// Overridden:
  public:
// From CMICmdInvoker::ICmd
bool Execute() override;
bool Acknowledge() override;
bool ParseArgs() override;
// From CMICmnBase
/* dtor */ ~CMICmdCmdExecRun() override;

// Attributes:
  private:
lldb::SBCommandReturnObject m_lldbResult;
const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first 
instruction or main(), just run process if not specified
};
```


```
class CMICmdCmdExecFinish : public CMICmdBase
{
// Statics:
  public:
// Required by the CMICmdFactory when registering *this command
static CMICmdBase *CreateSelf();

// Methods:
  public:
/* ctor */ CMICmdCmdExecFinish();

// Overridden:
  public:
// From CMICmdInvoker::ICmd
bool Execute() override;
bool Acknowledge() override;
bool ParseArgs() override;  <---
// From CMICmnBase
/* dtor */ ~CMICmdCmdExecFinish() override;

// Attributes:
  private:
lldb::SBCommandReturnObject m_lldbResult;
const CMIUtilString m_constStrArgThread; // Not specified in MI spec but 
Eclipse gives this option
const CMIUtilString m_constStrArgFrame;  // Not specified in MI spec but 
Eclipse gives this option
};
```


Repository:
  rL LLVM

http://reviews.llvm.org/D12977



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


Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations

2015-09-28 Thread Mohit Bhakkad via lldb-commits
mohit.bhakkad updated this revision to Diff 35879.
mohit.bhakkad added a comment.

Adding a simple test to check displayed value of vector


Repository:
  rL LLVM

http://reviews.llvm.org/D13202

Files:
  source/Breakpoint/Watchpoint.cpp
  test/functionalities/watchpoint/watchpoint_on_vectors/Makefile
  
test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
  test/functionalities/watchpoint/watchpoint_on_vectors/main.c

Index: test/functionalities/watchpoint/watchpoint_on_vectors/main.c
===
--- /dev/null
+++ test/functionalities/watchpoint/watchpoint_on_vectors/main.c
@@ -0,0 +1,14 @@
+//===-- main.c --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+typedef short v8i16 __attribute__ ((vector_size(16)));
+v8i16 global_vector = {1, 2, 3, 4, 5, 6, 7, 8};
+
+int main()
+{
+}
Index: test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
===
--- /dev/null
+++ test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
@@ -0,0 +1,56 @@
+"""
+Test displayed value of a vector variable while doing watchpoint operations
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestValueOfVectorVariableTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@dsym_test
+def test_value_of_vector_variable_with_dsym_using_watchpoint_set(self):
+"""Test verify displayed value of vector variable."""
+self.buildDsym(dictionary=self.d)
+self.setTearDownCleanup(dictionary=self.d)
+self.value_of_vector_variable_with_watchpoint_set()
+
+@dwarf_test
+def test_value_of_vector_variable_with_dwarf_using_watchpoint_set(self):
+"""Test verify displayed value of vector variable."""
+self.buildDwarf(dictionary=self.d)
+self.setTearDownCleanup(dictionary=self.d)
+self.value_of_vector_variable_with_watchpoint_set()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Our simple source filename.
+self.source = 'main.c'
+self.exe_name = 'a.out'
+self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+def value_of_vector_variable_with_watchpoint_set(self):
+"""Test verify displayed value of vector variable"""
+exe = os.path.join(os.getcwd(), 'a.out')
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+# Set break to get a frame
+self.runCmd("b main")
+
+# Run the program.
+self.runCmd("run", RUN_SUCCEEDED)
+
+# Value of a vector variable should be displayed correctly
+self.expect("watchpoint set variable global_vector", WATCHPOINT_CREATED,
+substrs = ['new value: (1, 2, 3, 4, 5, 6, 7, 8)'])
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
Index: test/functionalities/watchpoint/watchpoint_on_vectors/Makefile
===
--- /dev/null
+++ test/functionalities/watchpoint/watchpoint_on_vectors/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
Index: source/Breakpoint/Watchpoint.cpp
===
--- source/Breakpoint/Watchpoint.cpp
+++ source/Breakpoint/Watchpoint.cpp
@@ -218,14 +218,21 @@
 s->Printf("\nWatchpoint %u hit:", GetID());
 prefix = "";
 }
-
+
 if (m_old_value_sp)
 {
-s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString());
+if (m_old_value_sp->GetValueAsCString())
+s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetValueAsCString());
+else
+s->Printf("\n%sold value: %s", prefix, m_old_value_sp->GetSummaryAsCString());
 }
+
 if (m_new_value_sp)
 {
-s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString());
+if (m_new_value_sp->GetValueAsCString())
+s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetValueAsCString());
+else
+s->Printf("\n%snew value: %s", prefix, m_new_value_sp->GetSummaryAsCString());
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254487, @labath wrote:

> Looks good to me. :)
>
> If you do end up adding a command line option, I think you can go for 
> `--enable-core-on-timeout` and default to off for all platforms. I suspect I 
> am the only one using this, and it makes a much safer default.


Okay, sounds good.  I expect some additions that will be needed from Zachary, 
so if we want to default it off and add a flag, I'll probably get that part in 
with the initial check-in.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
Sorry, our desks were reconfigured over the weekend, so I just now got my
computer turned on.  I'm syncing code and hopefully will have a working
build soon.

On Mon, Sep 28, 2015 at 9:28 AM Todd Fiala  wrote:

> tfiala added a comment.
>
> In http://reviews.llvm.org/D13124#254487, @labath wrote:
>
> > Looks good to me. :)
> >
> > If you do end up adding a command line option, I think you can go for
> `--enable-core-on-timeout` and default to off for all platforms. I suspect
> I am the only one using this, and it makes a much safer default.
>
>
> Okay, sounds good.  I expect some additions that will be needed from
> Zachary, so if we want to default it off and add a flag, I'll probably get
> that part in with the initial check-in.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r248722 - Bind listener to 127.0.0.1 to make sure that loopback address is used.

2015-09-28 Thread Oleksiy Vyalov via lldb-commits
Author: ovyalov
Date: Mon Sep 28 12:42:16 2015
New Revision: 248722

URL: http://llvm.org/viewvc/llvm-project?rev=248722&view=rev
Log:
Bind listener to 127.0.0.1 to make sure that loopback address is used.


Modified:

lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp

Modified: 
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp?rev=248722&r1=248721&r2=248722&view=diff
==
--- 
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp 
Mon Sep 28 12:42:16 2015
@@ -53,7 +53,7 @@ static Error
 FindUnusedPort (uint16_t& port)
 {
 Socket* socket = nullptr;
-auto error = Socket::TcpListen ("localhost:0", false, socket, nullptr);
+auto error = Socket::TcpListen ("127.0.0.1:0", false, socket, nullptr);
 if (error.Success ())
 {
 port = socket->GetLocalPortNumber ();


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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254900, @zturner wrote:

> Sorry, our desks were reconfigured over the weekend, so I just now got my
>  computer turned on.  I'm syncing code and hopefully will have a working
>  build soon.


Sounds good.  I expect you'll find a few things you'll want to add/adjust.  If 
you get those patches to me, I'll include them in the check-in.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254935, @tfiala wrote:

> In http://reviews.llvm.org/D13124#254900, @zturner wrote:
>
> > Sorry, our desks were reconfigured over the weekend, so I just now got my
> >  computer turned on.  I'm syncing code and hopefully will have a working
> >  build soon.
>
>
> Sounds good.  I expect you'll find a few things you'll want to add/adjust.  
> If you get those patches to me, I'll include them in the check-in.


Also note the test code for this check-in assumes there is a python in the path 
when it builds the command to run the inferior test subject.  (This is the 
thing we run against to verify that the ProcessDriver --- aka child process 
runner with timeout support --- gets return codes, witnesses timeouts, 
witnesses children processes that choose to ignore soft terminate signals and 
gets the bad guy with a more lethal (hard) termination option, etc.).  You 
might need to tweak that in the test runner.  That python invocation doesn't 
require any special lldb support - it is just testing that a process can be 
launched, and that process happens to be a python interpreter session running 
the inferior.py test subject.  So I figured that was probably fine as is.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

Looks good to me.  Just add a decorator to both tests to skip unless the 
compiler is gcc or clang  ( `__attribute((vector_size))__` doesn't work on MSVC 
or clang-cl, for example


Repository:
  rL LLVM

http://reviews.llvm.org/D13202



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


Re: [Lldb-commits] [PATCH] D13202: [LLDB] Fix display of value of a vector variables in watchpoint operations

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

Actually I'm wrong.  Leave it enabled and I'll see what happens.  clang-cl 
(which we require for windows tests) supports that syntax after all.


Repository:
  rL LLVM

http://reviews.llvm.org/D13202



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
Can you rebase against ToT?  I'm having trouble applying the patch.

On Mon, Sep 28, 2015 at 11:00 AM Todd Fiala  wrote:

> tfiala added a comment.
>
> In http://reviews.llvm.org/D13124#254935, @tfiala wrote:
>
> > In http://reviews.llvm.org/D13124#254900, @zturner wrote:
> >
> > > Sorry, our desks were reconfigured over the weekend, so I just now got
> my
> > >  computer turned on.  I'm syncing code and hopefully will have a
> working
> > >  build soon.
> >
> >
> > Sounds good.  I expect you'll find a few things you'll want to
> add/adjust.  If you get those patches to me, I'll include them in the
> check-in.
>
>
> Also note the test code for this check-in assumes there is a python in the
> path when it builds the command to run the inferior test subject.  (This is
> the thing we run against to verify that the ProcessDriver --- aka child
> process runner with timeout support --- gets return codes, witnesses
> timeouts, witnesses children processes that choose to ignore soft terminate
> signals and gets the bad guy with a more lethal (hard) termination option,
> etc.).  You might need to tweak that in the test runner.  That python
> invocation doesn't require any special lldb support - it is just testing
> that a process can be launched, and that process happens to be a python
> interpreter session running the inferior.py test subject.  So I figured
> that was probably fine as is.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

Sorry, ignore me.  My brain is just off, it's working


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254950, @zturner wrote:

> Sorry, ignore me.  My brain is just off, it's working


Okay, cool.  Yeah I can update it if needed, I think I saw a 1-line dosep.py go 
in between my last update late last night and early this morning.  But it 
sounds like you made it past there.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
This is what I get.

d:\src\llvm\tools\lldb\test>cd test_runner

d:\src\llvm\tools\lldb\test\test_runner>cd test

d:\src\llvm\tools\lldb\test\test_runner\test>c:\Python27_LLDB\x86\python_d.exe
process_control_tests.py
..E.EE
==
ERROR: test_hard_timeout_works (__main__.ProcessControlTimeoutTests)
Driver falls back to hard terminate when soft terminate is ignored.
--
Traceback (most recent call last):
  File "process_control_tests.py", line 177, in test_hard_timeout_works
options="--sleep 120"),
  File "process_control_tests.py", line 83, in inferior_command
cls._suppress_soft_terminate(command)
  File "process_control_tests.py", line 70, in _suppress_soft_terminate
for signum in helper.soft_terminate_signals():
TypeError: 'NoneType' object is not iterable

==
ERROR: test_soft_timeout_works_core (__main__.ProcessControlTimeoutTests)
Driver uses soft terminate (with core request) when process times out.
--
Traceback (most recent call last):
  File "process_control_tests.py", line 157, in test_soft_timeout_works_core
self._soft_timeout_works(True)
  File "process_control_tests.py", line 150, in _soft_timeout_works
helper.was_soft_terminate(driver.returncode, with_core),
  File "..\lib\process_control.py", line 192, in was_soft_terminate
raise Exception("platform needs to implement")
Exception: platform needs to implement

==
ERROR: test_soft_timeout_works_no_core (__main__.ProcessControlTimeoutTests)
Driver uses soft terminate (no core request) when process times out.
--
Traceback (most recent call last):
  File "process_control_tests.py", line 162, in
test_soft_timeout_works_no_core
self._soft_timeout_works(False)
  File "process_control_tests.py", line 150, in _soft_timeout_works
helper.was_soft_terminate(driver.returncode, with_core),
  File "..\lib\process_control.py", line 192, in was_soft_terminate
raise Exception("platform needs to implement")
Exception: platform needs to implement

--
Ran 6 tests in 10.351s

FAILED (errors=3)
[37558 refs]

Looking into these now.

On Mon, Sep 28, 2015 at 11:18 AM Todd Fiala  wrote:

> tfiala added a comment.
>
> In http://reviews.llvm.org/D13124#254950, @zturner wrote:
>
> > Sorry, ignore me.  My brain is just off, it's working
>
>
> Okay, cool.  Yeah I can update it if needed, I think I saw a 1-line
> dosep.py go in between my last update late last night and early this
> morning.  But it sounds like you made it past there.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13028: Merge dsym and dwarf test cases

2015-09-28 Thread Ed Maste via lldb-commits
emaste added a comment.

No objection from me on the FreeBSD side. I'm leaving shortly to travel to 
EuroBSDCon so probably will not be able to test before Wednesday, but I can 
investigate and update decorators as appropriate afterwards.


http://reviews.llvm.org/D13028



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254958, @zturner wrote:

> This is what I get.
>
> d:\src\llvm\tools\lldb\test>cd test_runner
>
> d:\src\llvm\tools\lldb\test\test_runner>cd test
>
> d:\src\llvm\tools\lldb\test\test_runner\test>c:\Python27_LLDB\x86\python_d.exe
>  process_control_tests.py
>  ..E.EE
>  ==
>  ERROR: test_hard_timeout_works (__main__.ProcessControlTimeoutTests)
>  Driver falls back to hard terminate when soft terminate is ignored.
>
>  --
>
> Traceback (most recent call last):
>
>   File "process_control_tests.py", line 177, in test_hard_timeout_works
> options="--sleep 120"),
>   File "process_control_tests.py", line 83, in inferior_command
> cls._suppress_soft_terminate(command)
>   File "process_control_tests.py", line 70, in _suppress_soft_terminate
> for signum in helper.soft_terminate_signals():
>
> TypeError: 'NoneType' object is not iterable


This is going to be what appears to be a missing "is not None" check on the 
helper.soft_terminate_signals().  I'm expecting we'll need to figure out how 
Windows will want to test the "child process ignores the pleasant/nice kill 
attempt -- aka a soft terminate".  I doubt the right thing to do is to tell the 
inferior to ignore signal numbers on Windows.  In this case, here:

File "process_control_tests.py", line 83, in inferior_command

  cls._suppress_soft_terminate(command)

we'll need to figure out what Windows needs to do to tell the inferior.py 
script how to ignore soft terminate signals.

One option I almost did but wanted to figure out if you need it is to switch 
the inferior.py parameter from the sense of "ignore these signals" to "do 
whatever platform thing is necessary to avoid a soft terminate".  For the 
Posix-y systems, that would be ignoring SIGTERM and SIGQUIT.  For Windows, it 
would be whatever you need.  Then the test side can just add that (new) flag 
that says something like "--ignore-soft-terminate".  That is probably the way 
to go here.  You still need to figure out what needs to go in the handler for 
that in inferior.py, but that would be the general idea.

> ==

>  ERROR: test_soft_timeout_works_core (__main__.ProcessControlTimeoutTests)

>  Driver uses soft terminate (with core request) when process times out.

> 

>  --

> 

> Traceback (most recent call last):

> 

>   File "process_control_tests.py", line 157, in test_soft_timeout_works_core

> self._soft_timeout_works(True)

>   File "process_control_tests.py", line 150, in _soft_timeout_works

> helper.was_soft_terminate(driver.returncode, with_core),

>   File "..\lib\process_control.py", line 192, in was_soft_terminate

> raise Exception("platform needs to implement")

> 

> Exception: platform needs to implement

> 

> ==

>  ERROR: test_soft_timeout_works_no_core (__main__.ProcessControlTimeoutTests)

>  Driver uses soft terminate (no core request) when process times out.

> 

>  --

> 

> Traceback (most recent call last):

> 

>   File "process_control_tests.py", line 162, in

> 

> test_soft_timeout_works_no_core

> 

> self._soft_timeout_works(False)

>   File "process_control_tests.py", line 150, in _soft_timeout_works

> helper.was_soft_terminate(driver.returncode, with_core),

>   File "..\lib\process_control.py", line 192, in was_soft_terminate

> raise Exception("platform needs to implement")

> 

> Exception: platform needs to implement


This is one of the spots I need you to fill in.

> 

> 

>  --

> 

> Ran 6 tests in 10.351s

> 

> FAILED (errors=3)

>  [37558 refs]

> 

> Looking into these now.



http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

The "was_soft_terminate()" method is looking at the subprocess.Popen-like 
object's returncode and, judging by that, certifying that it was (or was not) a 
soft terminate that caused the exit.

If you need the Popen-like object to figure that out (e.g. if you need to look 
at some of the Windows-extended Popen attributes), we can rearrange this to 
take the Popen-like object rather than only its returncode.  That would be 
totally fine.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
As far as I can tell, the value of the return code is undocumented when you
use Popen.terminate() on Windows.  I don't know what that means for the
patch.  It's quite a bit more complicated than I anticipated based on the
original thread to lldb-dev.  I thought it was just going to call
Popen.terminate and assume that means it was a hard terminate.  I still
don't grasp the need for all the complexity.

A few experiments on a throwaway program suggest that using
Popen.terminate() sets returncode to 1, but there doesn't seem to be any
guarantee that this is always the case.

On Mon, Sep 28, 2015 at 11:53 AM Todd Fiala  wrote:

> tfiala added a comment.
>
> The "was_soft_terminate()" method is looking at the subprocess.Popen-like
> object's returncode and, judging by that, certifying that it was (or was
> not) a soft terminate that caused the exit.
>
> If you need the Popen-like object to figure that out (e.g. if you need to
> look at some of the Windows-extended Popen attributes), we can rearrange
> this to take the Popen-like object rather than only its returncode.  That
> would be totally fine.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#255034, @zturner wrote:

> As far as I can tell, the value of the return code is undocumented when you
>  use Popen.terminate() on Windows.


Okay, interesting.  I found what looked like a race on Linux and OS X where 
calling the Popen-object returncode member (the normal way to get the 
returncode) would flip from the actual result (received after a wait() call, 
i.e.

popen_object.wait()
self.returncode = popen_object.returncode

...
returncode2 = popen_object.returncode

and find
returncode2 != self.returncode

I switched to using the result of wait() as the official return code.

I don't know what that means for the

> patch.  It's quite a bit more complicated than I anticipated based on the

>  original thread to lldb-dev.  I thought it was just going to call

>  Popen.terminate and assume that means it was a hard terminate.  I still

>  don't grasp the need for all the complexity.


It's the need for the core file generation, which requires a soft (i.e. 
deflectable by the target process) terminate request.  Which requires a 2-level 
kill mechanism, as we need to make sure the process really dies for a real test 
runner environment that needs to be long-lived.

I can do one more adjustment.  I'll make the soft terminate optional per 
platform.  We'll disable it on Windows and only enable it on Posixy stuff.  
Then on Windows there will only be the hard terminate.

> A few experiments on a throwaway program suggest that using

>  Popen.terminate() sets returncode to 1, but there doesn't seem to be any

>  guarantee that this is always the case.


What I was doing was writing a value into the subprocess.Popen-like object on 
the Posix side, to store extra state needed.  (e.g. whether we're killing by 
process group --- if we created a process group --- or if we're just killing a 
process directly.  Those are different operations on the Posix side).  For 
this, you could just write into the popen object that you killed it with a hard 
terminate.  And then read back that value on the verification side to say "oh 
yes, that was really the mechanism by which it  was killed."

That point is moot, though, if there is only one way to kill on Windows.  If 
there is only one way to kill, then one of these should happen:

1. If we don't care about crashdumps on Windows, which I think I heard you say 
is true, then we make the soft terminate level optional by platform, and skip 
it (i.e. indicate it is not available) on Windows.

2. If we do care about crashdumps on Windows, then we probably need to untangle 
the conflation of the soft terminate level (where a target process can ignore) 
from crash dump generation.  On Posix, crash dump request is tied to the soft 
termination signal used.  But on Windows, we could allow that to happen on the 
(one and only) hard terminate level.

I can get that together (assuming option #1) relatively quickly.

I don't think we can drop the complexity of the 2-tier kill level in the 
driver, though, given the desire to support core dump generation.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.



> I can get that together (assuming option #1) relatively quickly.

> 

> I don't think we can drop the complexity of the 2-tier kill level in the 
> driver, though, given the desire to support core dump generation.


I'm not going to touch this until I hear back from you, though, Zachary.  
Anything I do on this is way beyond the time I have to allocate to it at this 
point, so I'll have to stub out a dead simple solution (i.e. essentially just 
about what it was doing before) for Windows if none of this sounds good for 
you.  I have to get OS X to stop hanging.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
Yea, on Windows we can support core dump generation externally without
touching the python script, so that's not neded for us.

Ironically, at the system level there is a way to specify the return code
of the process when you terminate it.  And Python internally must be using
this API, because it's the only way to do it.  They just decided not to
expose that parameter through the subprocess.terminate() method, and
instead they pass their own magic value.  If someone is clever enough to
dig through python source code and figure out what value it uses, we could
use that.  But I think on Windows it's safe to assume that if you call
process.terminate(), then it was a hard terminate, and we can ignore
everything else.

Does that make sense / is easy to do?

On Mon, Sep 28, 2015 at 12:45 PM Todd Fiala  wrote:

> tfiala added a comment.
>
>
>
> > I can get that together (assuming option #1) relatively quickly.
>
> >
>
> > I don't think we can drop the complexity of the 2-tier kill level in the
> driver, though, given the desire to support core dump generation.
>
>
> I'm not going to touch this until I hear back from you, though, Zachary.
> Anything I do on this is way beyond the time I have to allocate to it at
> this point, so I'll have to stub out a dead simple solution (i.e.
> essentially just about what it was doing before) for Windows if none of
> this sounds good for you.  I have to get OS X to stop hanging.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#255044, @zturner wrote:

> Yea, on Windows we can support core dump generation externally without
>  touching the python script, so that's not neded for us.


Okay, good!

> Ironically, at the system level there is a way to specify the return code

>  of the process when you terminate it.  And Python internally must be using

>  this API, because it's the only way to do it.


Hah, that's interesting.

> They just decided not to

>  expose that parameter through the subprocess.terminate() method, and

>  instead they pass their own magic value.  If someone is clever enough to

>  dig through python source code and figure out what value it uses, we could

>  use that.  But I think on Windows it's safe to assume that if you call

>  process.terminate(), then it was a hard terminate, and we can ignore

>  everything else.

> 

> Does that make sense / is easy to do?


Yes, makes sense and yes I can accommodate by just making that soft terminate 
level optional by platform.  I'll get to working on that after lunch and I hope 
to have a patch up way before I head home today.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

A few more comments



Comment at: test/test_runner/test/process_control_tests.py:63
@@ +62,3 @@
+def _suppress_soft_terminate(cls, command):
+if platform.system() == 'nt':
+# Add whatever is needed to the command line to

Change `nt` to `Windows` (unless you're removing this logic as discussed 
earlier)


Comment at: test/test_runner/test/process_control_tests.py:80
@@ +79,3 @@
+# Base command.
+command = (["python", "inferior.py"])
+

Change `"python"` to `sys.executable`


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
Random thought: If you want to generate a core dump, we already have LLDB
attached to the process, so you have an SBProcess.  Couldn't you use
Process.Halt, then call whatever method is necessary to have the debugger
create a core, then Process.Kill?

On Mon, Sep 28, 2015 at 1:03 PM Zachary Turner  wrote:

> zturner added a comment.
>
> A few more comments
>
>
> 
> Comment at: test/test_runner/test/process_control_tests.py:63
> @@ +62,3 @@
> +def _suppress_soft_terminate(cls, command):
> +if platform.system() == 'nt':
> +# Add whatever is needed to the command line to
> 
> Change `nt` to `Windows` (unless you're removing this logic as discussed
> earlier)
>
> 
> Comment at: test/test_runner/test/process_control_tests.py:80
> @@ +79,3 @@
> +# Base command.
> +command = (["python", "inferior.py"])
> +
> 
> Change `"python"` to `sys.executable`
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D13224: [DWARFASTParserClang] Strengthen incomplete type handling.

2015-09-28 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added a reviewer: clayborg.
sivachandra added a subscriber: lldb-commits.

This change fixes pr24916. As associated test has been added.

http://reviews.llvm.org/D13224

Files:
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  test/lang/cpp/pr24916/Makefile
  test/lang/cpp/pr24916/TestWithLimitDebugInfo.py
  test/lang/cpp/pr24916/base.cpp
  test/lang/cpp/pr24916/base.h
  test/lang/cpp/pr24916/derived.cpp
  test/lang/cpp/pr24916/derived.h
  test/lang/cpp/pr24916/main.cpp
  test/make/Makefile.rules

Index: test/make/Makefile.rules
===
--- test/make/Makefile.rules
+++ test/make/Makefile.rules
@@ -170,6 +170,11 @@
 	endif
 endif
 
+LIMIT_DEBUG_INFO_FLAGS =
+ifneq (,$(findstring clang,$(CC)))
+   LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+endif
+
 CFLAGS ?= -g -O0 -fno-builtin
 ifeq "$(OS)" "Darwin"
 	CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
Index: test/lang/cpp/pr24916/main.cpp
===
--- /dev/null
+++ test/lang/cpp/pr24916/main.cpp
@@ -0,0 +1,7 @@
+#include "derived.h"
+
+int main() {
+Foo f; // break here
+f.bar();
+return f.baz();
+}
Index: test/lang/cpp/pr24916/derived.h
===
--- /dev/null
+++ test/lang/cpp/pr24916/derived.h
@@ -0,0 +1,13 @@
+#include "base.h"
+
+class Foo : public FooNS
+{
+public:
+Foo() {
+a = 12345;
+}
+
+char baz() override;
+int a;
+};
+
Index: test/lang/cpp/pr24916/derived.cpp
===
--- /dev/null
+++ test/lang/cpp/pr24916/derived.cpp
@@ -0,0 +1,6 @@
+#include "derived.h"
+
+char Foo::baz() {
+return (char)(x&0xff);
+}
+
Index: test/lang/cpp/pr24916/base.h
===
--- /dev/null
+++ test/lang/cpp/pr24916/base.h
@@ -0,0 +1,10 @@
+class FooNS
+{
+public:
+virtual void bar();
+virtual char baz() = 0;
+
+protected:
+int x;
+};
+
Index: test/lang/cpp/pr24916/base.cpp
===
--- /dev/null
+++ test/lang/cpp/pr24916/base.cpp
@@ -0,0 +1,6 @@
+#include "base.h"
+
+void FooNS::bar() {
+x = 54321;
+}
+
Index: test/lang/cpp/pr24916/TestWithLimitDebugInfo.py
===
--- /dev/null
+++ test/lang/cpp/pr24916/TestWithLimitDebugInfo.py
@@ -0,0 +1,48 @@
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestWithLimitDebugInfo(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@dwarf_test
+def test_with_dwarf(self):
+self.buildDwarf()
+
+cwd = os.getcwd()
+
+src_file = os.path.join(cwd, "main.cpp")
+src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
+
+# Get the path of the executable
+exe_path  = os.path.join(cwd, 'a.out')
+
+# Load the executable
+target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(target.IsValid(), VALID_TARGET)
+
+# Break on main function
+breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
+self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+
+# Launch the process
+process = target.LaunchSimple(None, None, self.get_process_working_directory())
+self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+thread.StepInto()
+
+# Get frame for current thread
+frame = thread.GetSelectedFrame()
+
+v1 = frame.EvaluateExpression("1")
+self.assertTrue(v1.IsValid(), "'expr 1' results in a valid SBValue object")
+self.assertTrue(v1.GetError().Success(), "'expr 1' succeeds without an error.")
+
+v2 = frame.EvaluateExpression("this")
+self.assertTrue(v2.IsValid(), "'expr this' results in a valid SBValue object")
+self.assertTrue(v2.GetError().Success(), "'expr this' succeeds without an error.")
Index: test/lang/cpp/pr24916/Makefile
===
--- /dev/null
+++ test/lang/cpp/pr24916/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+CXX_SOURCES = main.cpp derived.cpp base.cpp
+
+CFLAGS_EXTRAS += $(LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules
Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cp

Re: [Lldb-commits] [PATCH] D13224: [DWARFASTParserClang] Strengthen incomplete type handling.

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a subscriber: zturner.
zturner added a comment.

Can you change the name of the folder to something more descripive than 
`pr24916`.  For example, you could put `pr24916` in a comment in the test, but 
the test itself could have a descriptive name.  Enrico at Apple just went and 
did a sweep removing rdar's from bug trackers.  The public tracker is not 
exactly the same since it's, well, public.  But still it requires more mental 
(and physical) cycles to parse than it does to parse something like 
limit-debug-info.


http://reviews.llvm.org/D13224



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


Re: [Lldb-commits] [PATCH] D13224: [DWARFASTParserClang] Strengthen incomplete type handling.

2015-09-28 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 35907.
sivachandra added a comment.

Rename test directory to limit-debug-info.


http://reviews.llvm.org/D13224

Files:
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  test/lang/cpp/limit-debug-info/Makefile
  test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
  test/lang/cpp/limit-debug-info/base.cpp
  test/lang/cpp/limit-debug-info/base.h
  test/lang/cpp/limit-debug-info/derived.cpp
  test/lang/cpp/limit-debug-info/derived.h
  test/lang/cpp/limit-debug-info/main.cpp
  test/make/Makefile.rules

Index: test/make/Makefile.rules
===
--- test/make/Makefile.rules
+++ test/make/Makefile.rules
@@ -170,6 +170,11 @@
 	endif
 endif
 
+LIMIT_DEBUG_INFO_FLAGS =
+ifneq (,$(findstring clang,$(CC)))
+   LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
+endif
+
 CFLAGS ?= -g -O0 -fno-builtin
 ifeq "$(OS)" "Darwin"
 	CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
Index: test/lang/cpp/limit-debug-info/main.cpp
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/main.cpp
@@ -0,0 +1,7 @@
+#include "derived.h"
+
+int main() {
+Foo f; // break here
+f.bar();
+return f.baz();
+}
Index: test/lang/cpp/limit-debug-info/derived.h
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/derived.h
@@ -0,0 +1,13 @@
+#include "base.h"
+
+class Foo : public FooNS
+{
+public:
+Foo() {
+a = 12345;
+}
+
+char baz() override;
+int a;
+};
+
Index: test/lang/cpp/limit-debug-info/derived.cpp
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/derived.cpp
@@ -0,0 +1,6 @@
+#include "derived.h"
+
+char Foo::baz() {
+return (char)(x&0xff);
+}
+
Index: test/lang/cpp/limit-debug-info/base.h
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/base.h
@@ -0,0 +1,10 @@
+class FooNS
+{
+public:
+virtual void bar();
+virtual char baz() = 0;
+
+protected:
+int x;
+};
+
Index: test/lang/cpp/limit-debug-info/base.cpp
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/base.cpp
@@ -0,0 +1,6 @@
+#include "base.h"
+
+void FooNS::bar() {
+x = 54321;
+}
+
Index: test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
@@ -0,0 +1,48 @@
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestWithLimitDebugInfo(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@dwarf_test
+def test_with_dwarf(self):
+self.buildDwarf()
+
+cwd = os.getcwd()
+
+src_file = os.path.join(cwd, "main.cpp")
+src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
+
+# Get the path of the executable
+exe_path  = os.path.join(cwd, 'a.out')
+
+# Load the executable
+target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(target.IsValid(), VALID_TARGET)
+
+# Break on main function
+breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
+self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+
+# Launch the process
+process = target.LaunchSimple(None, None, self.get_process_working_directory())
+self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+thread.StepInto()
+
+# Get frame for current thread
+frame = thread.GetSelectedFrame()
+
+v1 = frame.EvaluateExpression("1")
+self.assertTrue(v1.IsValid(), "'expr 1' results in a valid SBValue object")
+self.assertTrue(v1.GetError().Success(), "'expr 1' succeeds without an error.")
+
+v2 = frame.EvaluateExpression("this")
+self.assertTrue(v2.IsValid(), "'expr this' results in a valid SBValue object")
+self.assertTrue(v2.GetError().Success(), "'expr this' succeeds without an error.")
Index: test/lang/cpp/limit-debug-info/Makefile
===
--- /dev/null
+++ test/lang/cpp/limit-debug-info/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+CXX_SOURCES = main.cpp derived.cpp base.cpp
+
+CFLAGS_EXTRAS += $(LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules
Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
==

Re: [Lldb-commits] [PATCH] D13224: [DWARFASTParserClang] Strengthen incomplete type handling.

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

Makefile stuff looks good.  Is the plan to do the same thing for the previous 
patch you submitted last week?  What's the status of that?


http://reviews.llvm.org/D13224



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


Re: [Lldb-commits] [PATCH] D13201: Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile()

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

As for the test, this could be a good candidate for a unit test.  It's not 
advertised very well so there's definitely some work for us to do on that 
front, but basically you can run `ninja check-lldb-unit`.  Seems like you could 
just create a `ModuleSpec` on the stack, construct it the way you want, and 
pass it to this function, and verify the output in a couple of different 
scenarios.  At a minimum the one you ran into this segfault with, but if you 
can think of a couple of other useful scenarios to test it wouldn't hurt to 
have a couple go in at the same time.



Comment at: source/Host/common/Symbols.cpp:238-250
@@ -237,15 +237,15 @@
 
 // Add /usr/lib/debug directory.
 debug_file_search_paths.AppendIfUnique (FileSpec("/usr/lib/debug", 
true));
 
 std::string uuid_str;
 const UUID &module_uuid = module_spec.GetUUID();
 if (module_uuid.IsValid())
 {
 // Some debug files are stored in the .build-id directory like 
this:
 //   
/usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
 uuid_str = module_uuid.GetAsString("");
 uuid_str.insert (2, 1, '/');
 uuid_str = uuid_str + ".debug";
 }
 

enlight wrote:
> zturner wrote:
> > Can you do all of this only if the target is not Windows?
> You mean if the **host** is not Windows? Skipping `/usr/lib/debug` on Windows 
> makes sense, but it seems like the `uuid_str` stuff could still apply if the 
> symbol files are copied to or shared with Windows.
You're right, the host.  Also seems reasonable about the `uuid_str` stuff.


Repository:
  rL LLVM

http://reviews.llvm.org/D13201



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


Re: [Lldb-commits] [PATCH] D13224: [DWARFASTParserClang] Strengthen incomplete type handling.

2015-09-28 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

About Makefile changes in other tests, I will one day clean all places where 
no-limit-debug-info shows up in the Makefile.
Just in case, zturner's comment about Makefiles on the other change came in a 
day after I landed the change. So, I will have to do it in another change.


http://reviews.llvm.org/D13224



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added inline comments.


Comment at: test/test_runner/test/process_control_tests.py:63
@@ +62,3 @@
+def _suppress_soft_terminate(cls, command):
+if platform.system() == 'nt':
+# Add whatever is needed to the command line to

zturner wrote:
> Change `nt` to `Windows` (unless you're removing this logic as discussed 
> earlier)
Ah okay.  I was copying the "nt" from somewhere else in the source code.  We 
might want to grep for that if it is wholesale wrong.  I assumed that was 
leftover from transition over to the NT codebase in W2k time period.


Comment at: test/test_runner/test/process_control_tests.py:80
@@ +79,3 @@
+# Base command.
+command = (["python", "inferior.py"])
+

zturner wrote:
> Change `"python"` to `sys.executable`
Okay.  Better.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: test/test_runner/test/process_control_tests.py:63
@@ +62,3 @@
+def _suppress_soft_terminate(cls, command):
+if platform.system() == 'nt':
+# Add whatever is needed to the command line to

tfiala wrote:
> zturner wrote:
> > Change `nt` to `Windows` (unless you're removing this logic as discussed 
> > earlier)
> Ah okay.  I was copying the "nt" from somewhere else in the source code.  We 
> might want to grep for that if it is wholesale wrong.  I assumed that was 
> leftover from transition over to the NT codebase in W2k time period.
It's really confusing.  There's `os.name` and `sys.platform()`, which which 
return different strings.  It's possible the one you saw was checking 
`os.name`, for which `nt` is one of the valid return values.  That's another 
good candidate for the cross-platform portability module, we could just have 
lldb_platform.os() which returns an enum.  I was a little bummed to see the 
`process_control` module as a subfolder of `test_runner`, because all of the 
helper-related stuff could be at a higher level usable by anywhere in the test 
suite.  But we can tackle that later.  


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#255058, @zturner wrote:

> Random thought: If you want to generate a core dump, we already have LLDB
>  attached to the process, so you have an SBProcess.  Couldn't you use
>  Process.Halt, then call whatever method is necessary to have the debugger
>  create a core, then Process.Kill?


I'm not sure I follow.  Here's the process layout:

1. dotest.py parallel runner -> 2. worker thread/process -> 3. dotest.py 
inferior process -> 4. optional inferior test subject used by the lldb test

Item 3 above is the process that needs to be killed and possibly core dumped.  
It happens to be a process that may have an optional inferior (item #4) being 
tested by the lldb test code running in #3.  But we're trying to kill 3, and 
all of its children, and have 3 core dump.  (We don't care about a core dump 
for #4).

If we wanted to get a core for #4, that would seem possibly useful, but that's 
not the core we're looking for.

Did I follow your idea right?


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: test/test_runner/test/process_control_tests.py:63
@@ +62,3 @@
+def _suppress_soft_terminate(cls, command):
+if platform.system() == 'nt':
+# Add whatever is needed to the command line to

zturner wrote:
> tfiala wrote:
> > zturner wrote:
> > > Change `nt` to `Windows` (unless you're removing this logic as discussed 
> > > earlier)
> > Ah okay.  I was copying the "nt" from somewhere else in the source code.  
> > We might want to grep for that if it is wholesale wrong.  I assumed that 
> > was leftover from transition over to the NT codebase in W2k time period.
> It's really confusing.  There's `os.name` and `sys.platform()`, which which 
> return different strings.  It's possible the one you saw was checking 
> `os.name`, for which `nt` is one of the valid return values.  That's another 
> good candidate for the cross-platform portability module, we could just have 
> lldb_platform.os() which returns an enum.  I was a little bummed to see the 
> `process_control` module as a subfolder of `test_runner`, because all of the 
> helper-related stuff could be at a higher level usable by anywhere in the 
> test suite.  But we can tackle that later.  
Oh yea, in addition to `sys.platform` there's also `platform.system`, as you've 
used here.  And even *those* don't return the same values.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

In http://reviews.llvm.org/D13124#255140, @tfiala wrote:

> In http://reviews.llvm.org/D13124#255058, @zturner wrote:
>
> > Random thought: If you want to generate a core dump, we already have LLDB
> >  attached to the process, so you have an SBProcess.  Couldn't you use
> >  Process.Halt, then call whatever method is necessary to have the debugger
> >  create a core, then Process.Kill?
>
>
> I'm not sure I follow.  Here's the process layout:
>
> 1. dotest.py parallel runner -> 2. worker thread/process -> 3. dotest.py 
> inferior process -> 4. optional inferior test subject used by the lldb test
>
>   Item 3 above is the process that needs to be killed and possibly core 
> dumped.  It happens to be a process that may have an optional inferior (item 
> #4) being tested by the lldb test code running in #3.  But we're trying to 
> kill 3, and all of its children, and have 3 core dump.  (We don't care about 
> a core dump for #4).
>
>   If we wanted to get a core for #4, that would seem possibly useful, but 
> that's not the core we're looking for.
>
>   Did I follow your idea right?


Ahh ok I thought it was a core of the inferior.  My bad.  Anyway that doesn't 
change anything about what I said earlier about not needing the soft terminate 
logic on Windows :)


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

Ah I see I morphed all those together (the platform naming).

> ... bummed to see them under test_runner...


Heh, that's funny.  I was attempting to do a service of decluttering that top 
level test directory, which to me looks like somebody threw up a bunch of 
python code :-)  I didn't anticipate it would have the opposite effect!

We can tackle that a few ways: make it a package, which accomplishes 99% of 
what I was trying to do --- getting things out of that top level lldb/test, 
*while* still allowing tests to pull in some of that functionality if they 
want.  So it becomes something like:

lldb/test/lldb_platform/

  __init__.py
  ...
  the_files_.py
  ...
  test/
 the tests for the package

And then whatever is in there could be loaded by:
import lldb_platform.{whatever}
or
from lldb_platform import {whatever}

That seems totally reasonable to me.  How does that sound?


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#255142, @zturner wrote:

> In http://reviews.llvm.org/D13124#255140, @tfiala wrote:
>
> > In http://reviews.llvm.org/D13124#255058, @zturner wrote:
> >
> > > Random thought: If you want to generate a core dump, we already have LLDB
> > >  attached to the process, so you have an SBProcess.  Couldn't you use
> > >  Process.Halt, then call whatever method is necessary to have the debugger
> > >  create a core, then Process.Kill?
> >
> >
> > I'm not sure I follow.  Here's the process layout:
> >
> > 1. dotest.py parallel runner -> 2. worker thread/process -> 3. dotest.py 
> > inferior process -> 4. optional inferior test subject used by the lldb test
> >
> >   Item 3 above is the process that needs to be killed and possibly core 
> > dumped.  It happens to be a process that may have an optional inferior 
> > (item #4) being tested by the lldb test code running in #3.  But we're 
> > trying to kill 3, and all of its children, and have 3 core dump.  (We don't 
> > care about a core dump for #4).
> >
> >   If we wanted to get a core for #4, that would seem possibly useful, but 
> > that's not the core we're looking for.
> >
> >   Did I follow your idea right?
>
>
> Ahh ok I thought it was a core of the inferior.  My bad.  Anyway that doesn't 
> change anything about what I said earlier about not needing the soft 
> terminate logic on Windows :)


Okay!


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Zachary Turner via lldb-commits
zturner added a comment.

In http://reviews.llvm.org/D13124#255144, @tfiala wrote:

> Ah I see I morphed all those together (the platform naming).
>
> > ... bummed to see them under test_runner...
>
>
> Heh, that's funny.  I was attempting to do a service of decluttering that top 
> level test directory, which to me looks like somebody threw up a bunch of 
> python code :-)  I didn't anticipate it would have the opposite effect!
>
> We can tackle that a few ways: make it a package, which accomplishes 99% of 
> what I was trying to do --- getting things out of that top level lldb/test, 
> *while* still allowing tests to pull in some of that functionality if they 
> want.  So it becomes something like:
>
> lldb/test/lldb_platform/
>
>   __init__.py
>   ...
>   the_files_.py
>   ...
>   test/
>  the tests for the package
>   
>
> And then whatever is in there could be loaded from an lldb test with:
>  import lldb_platform.{whatever}
> or
>  from lldb_platform import {whatever}
>
> That seems totally reasonable to me.  How does that sound?


If it weren't for the fact that we have all these switches on `os.name`, 
`sys.platform`, and `platform.system` inside the tests as well as the test 
running infrastructure, then hiding it would be good.  But yea, the test suite 
itself is still really fragile due to all the conditionals, so it would be 
great to be able to use this cross platform helpers from anywhere in the test 
suite.  Making it a package sounds good, but I dont' think it needs to be done 
as part of this CL (or even immediately after) unless you really want to.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [lldb] r248048 - Added support for resolving symbolic links to FileSpec.

2015-09-28 Thread Zachary Turner via lldb-commits
Hi Sean, I was digging around in FileSystem.h and I noticed we already have
`FileSystem::Readlink`.  Reading the documentation of `readlink` and
`realpath` there seem to be a few minor differences, but they are just that
- minor.  I'm wondering if you actually *need* any semantics of `realpath`
that `readlink` don't provide.  If not, maybe we can delete
`FileSystem::ResolveSymbolicLink` and use `FileSystem::Readlink` instead.
What do you think?
On Fri, Sep 18, 2015 at 2:42 PM Zachary Turner  wrote:

> Any time there's something involving windows, even if you're just
> #ifdef'ing out a code path, I would prefer if you could wait until I or
> someone else who works on Windows has a chance to comment before committing.
>
> On Fri, Sep 18, 2015 at 2:40 PM Sean Callanan via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> Author: spyffe
>> Date: Fri Sep 18 16:39:31 2015
>> New Revision: 248048
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=248048&view=rev
>> Log:
>> Added support for resolving symbolic links to FileSpec.
>>
>> We use the symbolic link to resolver to find the target of the LLDB shlib
>> symlink if there is a symlink.  This allows us to find shlib-relative
>> resources
>> even when running under the testsuite, where _lldb.so is a symlink in the
>> Python
>> resource directory.
>>
>> Also changed a comment to be slightly more clear about what resolve_path
>> in the
>> constructor for FileSpec means, since if we were actually using
>> realpath() this
>> code wouldn't have been necessary.
>>
>> http://reviews.llvm.org/D12984
>>
>> Modified:
>> lldb/trunk/include/lldb/Host/FileSpec.h
>> lldb/trunk/source/Host/common/FileSpec.cpp
>> lldb/trunk/source/Host/common/HostInfoBase.cpp
>>
>> Modified: lldb/trunk/include/lldb/Host/FileSpec.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=248048&r1=248047&r2=248048&view=diff
>>
>> ==
>> --- lldb/trunk/include/lldb/Host/FileSpec.h (original)
>> +++ lldb/trunk/include/lldb/Host/FileSpec.h Fri Sep 18 16:39:31 2015
>> @@ -73,7 +73,7 @@ public:
>>  /// The full or partial path to a file.
>>  ///
>>  /// @param[in] resolve_path
>> -/// If \b true, then we resolve the path with realpath,
>> +/// If \b true, then we resolve the path, removing stray ../..
>> and so forth,
>>  /// if \b false we trust the path is in canonical form already.
>>  ///
>>  /// @see FileSpec::SetFile (const char *path, bool resolve)
>> @@ -511,6 +511,9 @@ public:
>>
>>  bool
>>  IsSymbolicLink () const;
>> +
>> +FileSpec
>> +ResolveSymbolicLink () const;
>>
>>  //--
>>  /// Get the memory cost of this object.
>>
>> Modified: lldb/trunk/source/Host/common/FileSpec.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=248048&r1=248047&r2=248048&view=diff
>>
>> ==
>> --- lldb/trunk/source/Host/common/FileSpec.cpp (original)
>> +++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Sep 18 16:39:31 2015
>> @@ -811,6 +811,32 @@ FileSpec::IsSymbolicLink () const
>>  #endif
>>  }
>>
>> +FileSpec
>> +FileSpec::ResolveSymbolicLink () const {
>> +if (!IsSymbolicLink())
>> +{
>> +return *this;
>> +}
>> +
>> +char resolved_path[PATH_MAX];
>> +if (!GetPath (resolved_path, sizeof (resolved_path)))
>> +{
>> +return *this;
>> +}
>> +
>> +#ifdef _WIN32
>> +return *this; // TODO make this work on win32
>> +#else
>> +char real_path[PATH_MAX + 1];
>> +if (realpath(resolved_path, real_path) == nullptr)
>> +{
>> +return *this;
>> +}
>> +
>> +return FileSpec(real_path, false);
>> +#endif
>> +}
>> +
>>  uint32_t
>>  FileSpec::GetPermissions () const
>>  {
>>
>> Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=248048&r1=248047&r2=248048&view=diff
>>
>> ==
>> --- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
>> +++ lldb/trunk/source/Host/common/HostInfoBase.cpp Fri Sep 18 16:39:31
>> 2015
>> @@ -306,7 +306,10 @@ HostInfoBase::ComputeSharedLibraryDirect
>>
>>  FileSpec lldb_file_spec(
>>  Host::GetModuleFileSpecForHostAddress(reinterpret_cast> *>(reinterpret_cast(HostInfoBase::GetLLDBPath;
>> -
>> +
>> +// This is necessary because when running the testsuite the shlib
>> might be a symbolic link inside the Python resource dir.
>> +lldb_file_spec = lldb_file_spec.ResolveSymbolicLink();
>> +
>>  // Remove the filename so that this FileSpec only represents the
>> directory.
>>  file_spec.GetDirectory() = lldb_file_spec.GetDirectory();
>>

Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added a comment.



> If it weren't for the fact that we have all these switches on `os.name`, 
> `sys.platform`, and `platform.system` inside the tests as well as the test 
> running infrastructure, then hiding it would be good.  But yea, the test 
> suite itself is still really fragile due to all the conditionals, so it would 
> be great to be able to use this cross platform helpers from anywhere in the 
> test suite.  Making it a package sounds good, but I dont' think it needs to 
> be done as part of this CL (or even immediately after) unless you really want 
> to.


Good - I'll hold off on that part until later.


http://reviews.llvm.org/D13124



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


[Lldb-commits] [lldb] r248755 - Remove one of the three spaces after a period in one of the breakpoint

2015-09-28 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Sep 28 18:02:00 2015
New Revision: 248755

URL: http://llvm.org/viewvc/llvm-project?rev=248755&view=rev
Log:
Remove one of the three spaces after a period in one of the breakpoint
set help messages.
 


Modified:
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=248755&r1=248754&r2=248755&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Mon Sep 28 18:02:00 
2015
@@ -774,7 +774,7 @@ CommandObjectBreakpointSet::CommandOptio
 
 { LLDB_OPT_SET_4, true, "fullname", 'F', OptionParser::eRequiredArgument, 
NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFullName,
 "Set the breakpoint by fully qualified function names. For C++ this 
means namespaces and all arguments, and "
-"for Objective C this means a full function prototype with class and 
selector.   "
+"for Objective C this means a full function prototype with class and 
selector.  "
 "Can be repeated multiple times to make one breakpoint for multiple 
names." },
 
 { LLDB_OPT_SET_5, true, "selector", 'S', OptionParser::eRequiredArgument, 
NULL, NULL, 0, eArgTypeSelector,


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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala updated this revision to Diff 35921.
tfiala added a comment.

Changes:

- soft terminate is now optional by platform, not supported by default, and 
listed as supported on POSIX-y systems.
- run with timeout now uses soft terminate only when supported.
- soft terminate tests are now skipped when soft terminate isn't supported by 
the platform.
- other issues called out should be fixed.

This change does not:

- add the lldb_platform package.  (I'll do that later.)
- plumb through the option to make core file generation accessible by the 
command line.  (I'll do that later.)  Right now it maintains core file 
generation requests for Linux and nobody else.

@zturner, can you give this a run?


http://reviews.llvm.org/D13124

Files:
  test/dosep.py
  test/test_runner/README.txt
  test/test_runner/lib/lldb_utils.py
  test/test_runner/lib/process_control.py
  test/test_runner/test/inferior.py
  test/test_runner/test/process_control_tests.py

Index: test/test_runner/test/process_control_tests.py
===
--- /dev/null
+++ test/test_runner/test/process_control_tests.py
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+"""
+The LLVM Compiler Infrastructure
+
+This file is distributed under the University of Illinois Open Source
+License. See LICENSE.TXT for details.
+
+Provides classes used by the test results reporting infrastructure
+within the LLDB test suite.
+
+
+Tests the process_control module.
+"""
+
+# System imports.
+import os
+import platform
+import unittest
+import sys
+import threading
+
+# Add lib dir to pythonpath
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
+
+# Our imports.
+import process_control
+
+
+class TestInferiorDriver(process_control.ProcessDriver):
+def __init__(self, soft_terminate_timeout=None):
+super(TestInferiorDriver, self).__init__(
+soft_terminate_timeout=soft_terminate_timeout)
+self.started_event = threading.Event()
+self.started_event.clear()
+
+self.completed_event = threading.Event()
+self.completed_event.clear()
+
+self.was_timeout = False
+self.returncode = None
+self.output = None
+
+def write(self, content):
+# We'll swallow this to keep tests non-noisy.
+# Uncomment the following line if you want to see it.
+# sys.stdout.write(content)
+pass
+
+def on_process_started(self):
+self.started_event.set()
+
+def on_process_exited(self, command, output, was_timeout, exit_status):
+self.returncode = exit_status
+self.was_timeout = was_timeout
+self.output = output
+self.returncode = exit_status
+self.completed_event.set()
+
+
+class ProcessControlTests(unittest.TestCase):
+@classmethod
+def _suppress_soft_terminate(cls, command):
+# Do the right thing for your platform here.
+# Right now only POSIX-y systems are reporting
+# soft terminate support, so this is set up for
+# those.
+helper = process_control.ProcessHelper.process_helper()
+signals = helper.soft_terminate_signals()
+if signals is not None:
+for signum in helper.soft_terminate_signals():
+command.extend(["--ignore-signal", str(signum)])
+
+@classmethod
+def inferior_command(
+cls,
+ignore_soft_terminate=False,
+options=None):
+
+# Base command.
+command = ([sys.executable, "inferior.py"])
+
+if ignore_soft_terminate:
+cls._suppress_soft_terminate(command)
+
+# Handle options as string or list.
+if isinstance(options, str):
+command.extend(options.split())
+elif isinstance(options, list):
+command.extend(options)
+
+# Return full command.
+return command
+
+
+class ProcessControlNoTimeoutTests(ProcessControlTests):
+"""Tests the process_control module."""
+def test_run_completes(self):
+"""Test that running completes and gets expected stdout/stderr."""
+driver = TestInferiorDriver()
+driver.run_command(self.inferior_command())
+self.assertTrue(
+driver.completed_event.wait(5), "process failed to complete")
+self.assertEqual(driver.returncode, 0, "return code does not match")
+
+def test_run_completes_with_code(self):
+"""Test that running completes and gets expected stdout/stderr."""
+driver = TestInferiorDriver()
+driver.run_command(self.inferior_command(options="-r10"))
+self.assertTrue(
+driver.completed_event.wait(5), "process failed to complete")
+self.assertEqual(driver.returncode, 10, "return code does not match")
+
+
+class ProcessControlTimeoutTests(ProcessControlTests):
+def test_run_completes(self):
+"""Test that running completes and gets expected return code."""
+driver = TestInferiorDr

Re: [Lldb-commits] [PATCH] D12994: Improve support of the ncurses dependency on NetBSD

2015-09-28 Thread Kamil Rytarowski via lldb-commits
krytarowski updated this revision to Diff 35922.
krytarowski added a comment.

Fix typo.


Repository:
  rL LLVM

http://reviews.llvm.org/D12994

Files:
  CMakeLists.txt
  cmake/LLDBDependencies.cmake
  cmake/modules/LLDBConfig.cmake
  include/lldb/Config/config.h.cmake
  include/lldb/Config/config.h.in
  source/Core/CMakeLists.txt
  source/Core/IOHandler.cpp

Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -11,6 +11,7 @@
 #include 
 
 #include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Config/config.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
@@ -29,8 +30,17 @@
 #include "lldb/Target/ThreadPlan.h"
 
 #ifndef LLDB_DISABLE_CURSES
+
+#if defined(HAVE_NCURSES_H)
 #include 
 #include 
+#elif defined(HAVE_NCURSES_NCURSES_H)
+#include 
+#include 
+#else
+#error No NCURSES header!
+#endif
+
 #endif
 
 using namespace lldb;
Index: source/Core/CMakeLists.txt
===
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -74,3 +74,5 @@
   VMRange.cpp
   )
 
+include_directories(${CURSES_INCLUDE_DIR})
+target_link_libraries(lldbCore ${CURSES_LIBRARIES})
Index: include/lldb/Config/config.h.in
===
--- /dev/null
+++ include/lldb/Config/config.h.in
@@ -0,0 +1,14 @@
+/* This generated file is for internal use. Do not include it from headers. */
+
+#ifdef CONFIG_H
+#error config.h can only be included once
+#else
+#define CONFIG_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_NCURSES_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_NCURSES_NCURSES_H
+
+#endif
Index: include/lldb/Config/config.h.cmake
===
--- /dev/null
+++ include/lldb/Config/config.h.cmake
@@ -0,0 +1,23 @@
+/* This generated file is for internal use. Do not include it from headers. */
+
+#ifdef CONFIG_H
+#error config.h can only be included once
+#else
+#define CONFIG_H
+
+/* Define to 1 if you have the  header file. */
+#cmakedefine CURSES_HAVE_NCURSES_H
+
+/* Define to 1 if you have the  header file. */
+#cmakedefine CURSES_HAVE_NCURSES_NCURSES_H
+
+/* autotools compat */
+#ifdef CURSES_HAVE_NCURSES_H
+#define HAVE_NCURSES_H 1
+#endif
+
+#ifdef CURSES_HAVE_NCURSES_NCURSES_H
+#define HAVE_NCURSES_NCURSES_H 1
+#endif
+
+#endif // CONFIG_H
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -190,7 +190,7 @@
   find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
 
   add_definitions( -DLIBXML2_DEFINED )
-  list(APPEND system_libs xml2 ncurses panel)
+  list(APPEND system_libs xml2)
   list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
   ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
   ${DEBUG_SYMBOLS_LIBRARY})
@@ -276,3 +276,17 @@
 else()
 set(LLDB_CAN_USE_DEBUGSERVER 0)
 endif()
+
+if (NOT LLDB_DISABLE_CURSES)
+set(CURSES_NEED_NCURSES TRUE)
+find_package(Curses REQUIRED)
+
+find_library(NCURSES_PANEL_LIBRARY NAMES panel DOC "The ncurses panel library")
+if (CURSES_FOUND)
+# Add panels to the library path
+set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSES_PANEL_LIBRARY})
+endif ()
+
+list(APPEND system_libs ${CURSES_LIBRARIES})
+include_directories(${CURSES_INCLUDE_DIR})
+endif ()
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -141,7 +141,7 @@
 list(APPEND LLDB_SYSTEM_LIBS edit)
   endif()
   if (NOT LLDB_DISABLE_CURSES)
-list(APPEND LLDB_SYSTEM_LIBS panel ncurses)
+list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
 if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
   list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
 endif()
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -15,6 +15,10 @@
 add_subdirectory(unittests)
 add_subdirectory(lit)
 
+configure_file(
+${LLDB_SOURCE_DIR}/include/lldb/Config/config.h.cmake
+${LLDB_BINARY_DIR}/include/lldb/Config/config.h)
+
 if (NOT LLDB_DISABLE_PYTHON)
 # Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
 add_custom_target( finish_swig ALL
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12748: Include platform agnostic in the place of

2015-09-28 Thread Kamil Rytarowski via lldb-commits
krytarowski updated this revision to Diff 35923.
krytarowski added a comment.

Put the include into proper line and use "" instead of <>.


Repository:
  rL LLVM

http://reviews.llvm.org/D12748

Files:
  tools/lldb-server/lldb-gdbserver.cpp

Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -9,7 +9,6 @@
 
 // C Includes
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -28,6 +27,7 @@
 #include "lldb/Core/ConnectionMachPort.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/common/GetOptInc.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/OptionParser.h"


Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -9,7 +9,6 @@
 
 // C Includes
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -28,6 +27,7 @@
 #include "lldb/Core/ConnectionMachPort.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/common/GetOptInc.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/OptionParser.h"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala added inline comments.


Comment at: test/test_runner/lib/process_control.py:552
@@ +551,3 @@
+# We don't have anything else to try.
+terminated = self.process.returncode is not None
+done_trying = True

Drats, this should be self.returncode.  I'll be adjusting that.  Not germaine 
for your case, Zachary.


Comment at: test/test_runner/lib/process_control.py:562
@@ +561,3 @@
+# We don't have anything else to try.
+terminated = self.process.returncode is not None
+done_trying = True

Same as above.  Should be testing against self.returncode.  I saw a few times 
where this value returned differently across calls.  (i.e. started as 
-{signal-number} after the first wait() call after its death, then called it 
again in a print statement a few lines later and it returned 0).  This would 
hit that same issue.

Granted this code block shouldn't ever get hit, since we don't ever try again 
after a hard kill attempt.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala updated this revision to Diff 35925.
tfiala added a comment.

Fixed up my previous inline comments.  I was caching the popen object's 
returncode returned from wait(), since it was showing unstable characteristics 
when reading after a successful wait().  But I failed to use it everywhere.  
Fixed that.


http://reviews.llvm.org/D13124

Files:
  test/dosep.py
  test/test_runner/README.txt
  test/test_runner/lib/lldb_utils.py
  test/test_runner/lib/process_control.py
  test/test_runner/test/inferior.py
  test/test_runner/test/process_control_tests.py

Index: test/test_runner/test/process_control_tests.py
===
--- /dev/null
+++ test/test_runner/test/process_control_tests.py
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+"""
+The LLVM Compiler Infrastructure
+
+This file is distributed under the University of Illinois Open Source
+License. See LICENSE.TXT for details.
+
+Provides classes used by the test results reporting infrastructure
+within the LLDB test suite.
+
+
+Tests the process_control module.
+"""
+
+# System imports.
+import os
+import platform
+import unittest
+import sys
+import threading
+
+# Add lib dir to pythonpath
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
+
+# Our imports.
+import process_control
+
+
+class TestInferiorDriver(process_control.ProcessDriver):
+def __init__(self, soft_terminate_timeout=None):
+super(TestInferiorDriver, self).__init__(
+soft_terminate_timeout=soft_terminate_timeout)
+self.started_event = threading.Event()
+self.started_event.clear()
+
+self.completed_event = threading.Event()
+self.completed_event.clear()
+
+self.was_timeout = False
+self.returncode = None
+self.output = None
+
+def write(self, content):
+# We'll swallow this to keep tests non-noisy.
+# Uncomment the following line if you want to see it.
+# sys.stdout.write(content)
+pass
+
+def on_process_started(self):
+self.started_event.set()
+
+def on_process_exited(self, command, output, was_timeout, exit_status):
+self.returncode = exit_status
+self.was_timeout = was_timeout
+self.output = output
+self.returncode = exit_status
+self.completed_event.set()
+
+
+class ProcessControlTests(unittest.TestCase):
+@classmethod
+def _suppress_soft_terminate(cls, command):
+# Do the right thing for your platform here.
+# Right now only POSIX-y systems are reporting
+# soft terminate support, so this is set up for
+# those.
+helper = process_control.ProcessHelper.process_helper()
+signals = helper.soft_terminate_signals()
+if signals is not None:
+for signum in helper.soft_terminate_signals():
+command.extend(["--ignore-signal", str(signum)])
+
+@classmethod
+def inferior_command(
+cls,
+ignore_soft_terminate=False,
+options=None):
+
+# Base command.
+command = ([sys.executable, "inferior.py"])
+
+if ignore_soft_terminate:
+cls._suppress_soft_terminate(command)
+
+# Handle options as string or list.
+if isinstance(options, str):
+command.extend(options.split())
+elif isinstance(options, list):
+command.extend(options)
+
+# Return full command.
+return command
+
+
+class ProcessControlNoTimeoutTests(ProcessControlTests):
+"""Tests the process_control module."""
+def test_run_completes(self):
+"""Test that running completes and gets expected stdout/stderr."""
+driver = TestInferiorDriver()
+driver.run_command(self.inferior_command())
+self.assertTrue(
+driver.completed_event.wait(5), "process failed to complete")
+self.assertEqual(driver.returncode, 0, "return code does not match")
+
+def test_run_completes_with_code(self):
+"""Test that running completes and gets expected stdout/stderr."""
+driver = TestInferiorDriver()
+driver.run_command(self.inferior_command(options="-r10"))
+self.assertTrue(
+driver.completed_event.wait(5), "process failed to complete")
+self.assertEqual(driver.returncode, 10, "return code does not match")
+
+
+class ProcessControlTimeoutTests(ProcessControlTests):
+def test_run_completes(self):
+"""Test that running completes and gets expected return code."""
+driver = TestInferiorDriver()
+timeout_seconds = 5
+driver.run_command_with_timeout(
+self.inferior_command(),
+"{}s".format(timeout_seconds),
+False)
+self.assertTrue(
+driver.completed_event.wait(2*timeout_seconds),
+"process failed to complete")
+self.assertEqual(driver.returncode, 0)
+
+def _soft_terminate_works(sel

Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-28 Thread Todd Fiala via lldb-commits
tfiala marked 6 inline comments as done.
tfiala added a comment.

Clearing out all fixed comments.


http://reviews.llvm.org/D13124



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


[Lldb-commits] LLVM buildnaster will be restarted tonight

2015-09-28 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be restarted after 6 PM Pacific time today.

Thanks

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