Re: [Lldb-commits] [PATCH] D18519: Allow building LLDB on Windows with MinGW 64/4.9.2 and later

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

In http://reviews.llvm.org/D18519#390337, @eran.ifrah wrote:

> Spoke too soon, the hack into `CMakeLists.txt` is still needed
>  Passing ` -mbig-obj` crashes `ld.exe`  (although it crashes in a much later 
> stage, at about 77% in the build)


Clang only puts /bigobj on a couple of files, which are known to produce 
extremely large object files. Would that help you get past the linker error by 
any chance?



Comment at: source/API/CMakeLists.txt:74-85
@@ -73,6 +73,14 @@
 # want every single library taking a dependency on the script interpreters.
-target_link_libraries(liblldb PRIVATE
-  lldbPluginScriptInterpreterNone
-  lldbPluginScriptInterpreterPython
-  )
+if(MINGW)
+  target_link_libraries(liblldb PRIVATE
+lldbPluginScriptInterpreterNone
+lldbPluginScriptInterpreterPython
+Dbghelp # Needed for MiniDumpWriteDump
+)
+else()
+  target_link_libraries(liblldb PRIVATE
+lldbPluginScriptInterpreterNone
+lldbPluginScriptInterpreterPython
+)
+endif()
 

I think you should add this library to `system_libs` in LLDBConfig.cmake. Then 
it should get linked in automatically.


Comment at: source/Plugins/Process/Windows/Live/DebuggerThread.cpp:380-383
@@ -379,5 +379,6 @@
 {
+DWORD dwPidToDetach = m_pid_to_detach;
 WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_EXCEPTION | 
WINDOWS_LOG_PROCESS,
 "Breakpoint exception is cue to detach from 
process 0x%x",
-m_pid_to_detach);
+dwPidToDetach);
 ::DebugActiveProcessStop(m_pid_to_detach);

zturner: The point here is that m_pid_to_detach is an std::atomic, and you 
shouldn't be passing those through `...` (I am not sure how it even worked in 
the first place).

An alternative would be putting `m_pid_to_detach.load()` here...


Comment at: tools/argdumper/CMakeLists.txt:6-8
@@ +5,5 @@
+if(MINGW)
+  # link directly against the dll file
+  add_dependencies(lldb-argdumper liblldb)
+  target_link_libraries(lldb-argdumper -L"${CMAKE_BINARY_DIR}/bin" -llldb)
+else()

It's a hack, but I think I know why you need it... there are issues with 
multiply defined symbols in lldb on windows, so I guess mingw is just more 
sensitive to them...


http://reviews.llvm.org/D18519



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


[Lldb-commits] [lldb] r265294 - Fix flakyness in TestWatchpointMultipleThreads

2016-04-04 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Apr  4 09:18:21 2016
New Revision: 265294

URL: http://llvm.org/viewvc/llvm-project?rev=265294&view=rev
Log:
Fix flakyness in TestWatchpointMultipleThreads

This addresses the same problem as r264846 (the test not expecting the 
situation when two thread
hit the watchpoint simultaneously), but for a different test.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=265294&r1=265293&r2=265294&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
 Mon Apr  4 09:18:21 2016
@@ -54,9 +54,6 @@ class HelloWatchLocationTestCase(TestBas
'stop reason = breakpoint'])
 
 # Now let's set a write-type watchpoint pointed to by 'g_char_ptr'.
-# The main.cpp, by design, misbehaves by not following the agreed upon
-# protocol of using a mutex while accessing the global pool and by not
-# incrmenting the global pool by 2.
 self.expect("watchpoint set expression -w write -s 1 -- g_char_ptr", 
WATCHPOINT_CREATED,
 substrs = ['Watchpoint created', 'size = 1', 'type = w'])
 # Get a hold of the watchpoint id just created, it is used later on to

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp?rev=265294&r1=265293&r2=265294&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/main.cpp
 Mon Apr  4 09:18:21 2016
@@ -43,15 +43,13 @@ uint32_t
 access_pool (bool flag = false)
 {
 static std::mutex g_access_mutex;
-if (!flag)
-g_access_mutex.lock();
+g_access_mutex.lock();
 
 char old_val = *g_char_ptr;
 if (flag)
 do_bad_thing_with_location(g_char_ptr, old_val + 1);
 
-if (!flag)
-g_access_mutex.unlock();
+g_access_mutex.unlock();
 return *g_char_ptr;
 }
 


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


[Lldb-commits] [lldb] r265299 - Make FileSpec handling platform-independent

2016-04-04 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Apr  4 09:39:12 2016
New Revision: 265299

URL: http://llvm.org/viewvc/llvm-project?rev=265299&view=rev
Log:
Make FileSpec handling platform-independent

Summary:
Even though FileSpec attempted to handle both kinds of path syntaxes (posix and 
windows) on both
platforms, it relied on the llvm path library to do its work, whose behavior 
differed on
different platforms. This led to subtle differences in FileSpec behavior 
between platforms. This
replaces the pieces of the llvm library with our own implementations. The 
functions are simply
copied from llvm, with #ifdefs replaced by runtime checks for 
ePathSyntaxWindows.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/unittests/Host/FileSpecTest.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=265299&r1=265298&r2=265299&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Apr  4 09:39:12 2016
@@ -57,10 +57,22 @@ PathSyntaxIsPosix(FileSpec::PathSyntax s
  FileSystem::GetNativePathSyntax() == FileSpec::ePathSyntaxPosix));
 }
 
+const char *
+GetPathSeparators(FileSpec::PathSyntax syntax)
+{
+return PathSyntaxIsPosix(syntax) ? "/" : "\\/";
+}
+
 char
-GetPathSeparator(FileSpec::PathSyntax syntax)
+GetPrefferedPathSeparator(FileSpec::PathSyntax syntax)
+{
+return GetPathSeparators(syntax)[0];
+}
+
+bool
+IsPathSeparator(char value, FileSpec::PathSyntax syntax)
 {
-return PathSyntaxIsPosix(syntax) ? '/' : '\\';
+return value == '/' || (!PathSyntaxIsPosix(syntax) && value == '\\');
 }
 
 void
@@ -94,8 +106,69 @@ GetFileStats (const FileSpec *file_spec,
 return false;
 }
 
+size_t
+FilenamePos(llvm::StringRef str, FileSpec::PathSyntax syntax)
+{
+if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
+return 0;
+
+if (str.size() > 0 && IsPathSeparator(str.back(), syntax))
+return str.size() - 1;
+
+size_t pos = str.find_last_of(GetPathSeparators(syntax), str.size() - 1);
+
+if (!PathSyntaxIsPosix(syntax) && pos == llvm::StringRef::npos)
+pos = str.find_last_of(':', str.size() - 2);
+
+if (pos == llvm::StringRef::npos || (pos == 1 && IsPathSeparator(str[0], 
syntax)))
+return 0;
+
+return pos + 1;
 }
 
+size_t
+RootDirStart(llvm::StringRef str, FileSpec::PathSyntax syntax)
+{
+// case "c:/"
+if (!PathSyntaxIsPosix(syntax) && (str.size() > 2 && str[1] == ':' && 
IsPathSeparator(str[2], syntax)))
+return 2;
+
+// case "//"
+if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
+return llvm::StringRef::npos;
+
+// case "//net"
+if (str.size() > 3 && IsPathSeparator(str[0], syntax) && str[0] == str[1] 
&& !IsPathSeparator(str[2], syntax))
+return str.find_first_of(GetPathSeparators(syntax), 2);
+
+// case "/"
+if (str.size() > 0 && IsPathSeparator(str[0], syntax))
+return 0;
+
+return llvm::StringRef::npos;
+}
+
+size_t
+ParentPathEnd(llvm::StringRef path, FileSpec::PathSyntax syntax)
+{
+size_t end_pos = FilenamePos(path, syntax);
+
+bool filename_was_sep = path.size() > 0 && IsPathSeparator(path[end_pos], 
syntax);
+
+// Skip separators except for root dir.
+size_t root_dir_pos = RootDirStart(path.substr(0, end_pos), syntax);
+
+while (end_pos > 0 && (end_pos - 1) != root_dir_pos && 
IsPathSeparator(path[end_pos - 1], syntax))
+--end_pos;
+
+if (end_pos == 1 && root_dir_pos == 0 && filename_was_sep)
+return llvm::StringRef::npos;
+
+return end_pos;
+}
+
+} // end anonymous namespace
+
 // Resolves the username part of a path of the form ~user/other/directories, 
and
 // writes the result into dst_path.  This will also resolve "~" to the current 
user.
 // If you want to complete "~" to the list of users, pass it to 
ResolvePartialUsername.
@@ -313,30 +386,32 @@ FileSpec::SetFile (const char *pathname,
 if (pathname == NULL || pathname[0] == '\0')
 return;
 
-llvm::SmallString<64> normalized(pathname);
+llvm::SmallString<64> resolved(pathname);
 
 if (resolve)
 {
-FileSpec::Resolve (normalized);
+FileSpec::Resolve (resolved);
 m_is_resolved = true;
 }
 
-// Only normalize after resolving the path.  Resolution will modify the 
path
-// string, potentially adding wrong kinds of slashes to the path, that need
-// to be re-normalized.
-Normalize(normalized, syntax);
-
-llvm::StringRef resolve_path_ref(normalized.c_str());
-llvm::StringRef filename_ref = llvm::sys::path::filename(resolve_path_ref);
-if (!filename_ref.empty())
-{
-m_filename.SetString (f

Re: [Lldb-commits] [PATCH] D18689: Make FileSpec handling platform-independent

2016-04-04 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL265299: Make FileSpec handling platform-independent 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D18689?vs=52348&id=52556#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18689

Files:
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/unittests/Host/FileSpecTest.cpp

Index: lldb/trunk/unittests/Host/FileSpecTest.cpp
===
--- lldb/trunk/unittests/Host/FileSpecTest.cpp
+++ lldb/trunk/unittests/Host/FileSpecTest.cpp
@@ -22,18 +22,23 @@
 
 FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
-EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString());
+EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString());
 EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
 
 FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
 EXPECT_STREQ("/", fs_posix_root.GetCString());
 EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString());
 EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString());
 
-FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows);
-EXPECT_STREQ("F:", fs_windows_root.GetCString());
-EXPECT_EQ(nullptr, fs_windows_root.GetDirectory().GetCString());
-EXPECT_STREQ("F:", fs_windows_root.GetFilename().GetCString());
+FileSpec fs_windows_drive("F:", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:", fs_windows_drive.GetCString());
+EXPECT_EQ(nullptr, fs_windows_drive.GetDirectory().GetCString());
+EXPECT_STREQ("F:", fs_windows_drive.GetFilename().GetCString());
+
+FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
+EXPECT_STREQ("F:\\", fs_windows_root.GetCString());
+EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
+EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString());
 
 FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::ePathSyntaxPosix);
 EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString());
@@ -43,7 +48,7 @@
 FileSpec fs_windows_long("F:\\bar\\baz", false, FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
 // We get "F:/bar" instead.
-// EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
+EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString());
 EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
 
 FileSpec fs_posix_trailing_slash("/foo/bar/", false, FileSpec::ePathSyntaxPosix);
@@ -54,7 +59,7 @@
 FileSpec fs_windows_trailing_slash("F:\\bar\\", false, FileSpec::ePathSyntaxWindows);
 EXPECT_STREQ("F:\\bar\\.", fs_windows_trailing_slash.GetCString());
 // We get "F:/bar" instead.
-// EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetDirectory().GetCString());
+EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetDirectory().GetCString());
 EXPECT_STREQ(".", fs_windows_trailing_slash.GetFilename().GetCString());
 }
 
@@ -66,22 +71,22 @@
 EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
 EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
 
-FileSpec fs_windows("F:", false, FileSpec::ePathSyntaxWindows);
-fs_windows.AppendPathComponent("bar");
-EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
-EXPECT_STREQ("F:", fs_windows.GetDirectory().GetCString());
-EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
+FileSpec fs_windows("F:\\bar", false, FileSpec::ePathSyntaxWindows);
+fs_windows.AppendPathComponent("baz");
+EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString());
+EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString());
+EXPECT_STREQ("baz", fs_windows.GetFilename().GetCString());
 
 FileSpec fs_posix_root("/", false, FileSpec::ePathSyntaxPosix);
 fs_posix_root.AppendPathComponent("bar");
 EXPECT_STREQ("/bar", fs_posix_root.GetCString());
 EXPECT_STREQ("/", fs_posix_root.GetDirectory().GetCString());
 EXPECT_STREQ("bar", fs_posix_root.GetFilename().GetCString());
 
-FileSpec fs_windows_root("F:", false, FileSpec::ePathSyntaxWindows);
+FileSpec fs_windows_root("F:\\", false, FileSpec::ePathSyntaxWindows);
 fs_windows_root.AppendPathComponent("bar");
 EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
-EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
+EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString());
 EXPECT_STREQ("bar", fs_windows_root.GetFilename().GetCString());
 }
 
Index: lldb/trunk/source/Host/common/FileSpec.cpp
===
--- lldb/trunk/source/Host/common/FileSpec.cpp
+++ lldb/trunk/source/Host/common/FileSpec.cpp
@@ -57,10 +57,22 @@
  FileSystem::GetNativePathSyntax() == FileS

[Lldb-commits] [lldb] r265308 - Set the architecture type from minidump more precisely. Differentiate i686 v i386 when possible.

2016-04-04 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Apr  4 11:41:16 2016
New Revision: 265308

URL: http://llvm.org/viewvc/llvm-project?rev=265308&view=rev
Log:
Set the architecture type from minidump more precisely.  Differentiate i686 v 
i386 when possible.

Modified:
lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp?rev=265308&r1=265307&r2=265308&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp 
Mon Apr  4 11:41:16 2016
@@ -411,9 +411,17 @@ ProcessWinMiniDump::Impl::DetermineArchi
 switch (system_info_ptr->ProcessorArchitecture)
 {
 case PROCESSOR_ARCHITECTURE_INTEL:
-return ArchSpec(eArchTypeCOFF, IMAGE_FILE_MACHINE_I386, 
LLDB_INVALID_CPUTYPE);
+if (system_info_ptr->ProcessorLevel == 6)
+{
+return ArchSpec("i686-pc-windows");
+}
+else
+{
+return ArchSpec("i386-pc-windows");
+}
+break;
 case PROCESSOR_ARCHITECTURE_AMD64:
-return ArchSpec(eArchTypeCOFF, IMAGE_FILE_MACHINE_AMD64, 
LLDB_INVALID_CPUTYPE);
+return ArchSpec("x86_64-pc-windows");
 default:
 break;
 }


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


Re: [Lldb-commits] [PATCH] D18697: Fix a bug in linux core file handling

2016-04-04 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 52572.
labath added a comment.

Address review comments.


http://reviews.llvm.org/D18697

Files:
  include/lldb/Target/Process.h
  
packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py
  packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.c
  
packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.core
  
packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.out
  
packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.h
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -3422,7 +3422,7 @@
 else if (!process_arch.IsValid())
 {
 ProcessInstanceInfo process_info;
-platform_sp->GetProcessInfo (GetID(), process_info);
+GetProcessInfo(process_info);
 const ArchSpec &process_arch = process_info.GetArchitecture();
 if (process_arch.IsValid() && !GetTarget().GetArchitecture().IsExactMatch(process_arch))
 {
@@ -6481,6 +6481,18 @@
 }
 }
 
+bool
+Process::GetProcessInfo(ProcessInstanceInfo &info)
+{
+info.Clear();
+
+PlatformSP platform_sp = GetTarget().GetPlatform();
+if (! platform_sp)
+return false;
+
+return platform_sp->GetProcessInfo(GetID(), info);
+}
+
 ThreadCollectionSP
 Process::GetHistoryThreads(lldb::addr_t addr)
 {
Index: source/Plugins/Process/elf-core/ProcessElfCore.h
===
--- source/Plugins/Process/elf-core/ProcessElfCore.h
+++ source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -111,6 +111,9 @@
 const lldb::DataBufferSP
 GetAuxvData() override;
 
+bool
+GetProcessInfo(lldb_private::ProcessInstanceInfo &info) override;
+
 protected:
 void
 Clear ( );
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -637,3 +637,18 @@
 lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(start, len));
 return buffer;
 }
+
+bool
+ProcessElfCore::GetProcessInfo(ProcessInstanceInfo &info)
+{
+info.Clear();
+info.SetProcessID(GetID());
+info.SetArchitecture(GetArchitecture());
+lldb::ModuleSP module_sp = GetTarget().GetExecutableModule();
+if (module_sp)
+{
+const bool add_exe_file_as_first_arg = false;
+info.SetExecutableFile(GetTarget().GetExecutableModule()->GetFileSpec(), add_exe_file_as_first_arg);
+}
+return true;
+}
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -656,7 +656,7 @@
 const auto platform_sp = target.GetPlatform ();
 
 ProcessInstanceInfo process_info;
-if (!platform_sp->GetProcessInfo (m_process->GetID (), process_info))
+if (!m_process->GetProcessInfo(process_info))
 {
 if (log)
 log->Printf ("DynamicLoaderPOSIXDYLD::%s - failed to get process info for pid %" PRIu64,
Index: packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
===
--- packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
+++ packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
@@ -2,6 +2,14 @@
 
 set -e -x
 
+file=$1
+if [ -z "$file" ]; then
+cat <___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18697: Fix a bug in linux core file handling

2016-04-04 Thread Pavel Labath via lldb-commits
labath marked an inline comment as done.
labath added a comment.

I have also added a test which loads two core files with the same pid. (Based 
on very little experimentation) everything seems to be working ok for that case.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:644-647
@@ +643,6 @@
+{
+info.Clear();
+info.SetProcessID(GetID());
+info.SetArchitecture(GetArchitecture());
+lldb::ModuleSP module_sp = GetTarget().GetExecutableModule();
+if (module_sp)

It get's parsed and set as the main target module in `DoLoadCore`, so I load 
the info from there.


http://reviews.llvm.org/D18697



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


[Lldb-commits] [lldb] r265315 - Xcode: modify lldb-python-test-suite target to build inferiors with $(LLDB_PYTHON_TESTSUITE_CC)

2016-04-04 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Mon Apr  4 12:15:57 2016
New Revision: 265315

URL: http://llvm.org/viewvc/llvm-project?rev=265315&view=rev
Log:
Xcode: modify lldb-python-test-suite target to build inferiors with 
$(LLDB_PYTHON_TESTSUITE_CC)

$(LLDB_PYTHON_TESTSUITE_CC) defaults to the just-built clang.  Together
with changes to the zorg repo, this enables the Green Dragon LLDB OS X
Xcode-based builder to run the new TSAN LLDB tests.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=265315&r1=265314&r2=265315&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Apr  4 12:15:57 2016
@@ -5971,7 +5971,7 @@
 /* Begin PBXLegacyTarget section */
2387551E1C24974600CCE8C3 /* lldb-python-test-suite */ = {
isa = PBXLegacyTarget;
-   buildArgumentsString = "-u $(SRCROOT)/test/dotest.py 
--apple-sdk $(PLATFORM_NAME) 
--executable=$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lldb 
--results-formatter lldbsuite.test.xunit_formatter.XunitFormatter 
--results-file $(BUILD_DIR)/test-results.xml --rerun-all-issues --env 
TERM=vt100 -O--xpass=ignore";
+   buildArgumentsString = "-u $(SRCROOT)/test/dotest.py 
--apple-sdk $(PLATFORM_NAME) 
--executable=$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lldb -C 
$(LLDB_PYTHON_TESTSUITE_CC) --results-formatter 
lldbsuite.test.xunit_formatter.XunitFormatter --results-file 
$(BUILD_DIR)/test-results.xml --rerun-all-issues --env TERM=vt100 
-O--xpass=ignore";
buildConfigurationList = 238755241C24974600CCE8C3 /* 
Build configuration list for PBXLegacyTarget "lldb-python-test-suite" */;
buildPhases = (
);
@@ -7472,6 +7472,7 @@
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+   LLDB_PYTHON_TESTSUITE_CC = 
"$(LLVM_BUILD_DIR)/x86_64/bin/clang";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
@@ -7500,6 +7501,7 @@
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+   LLDB_PYTHON_TESTSUITE_CC = 
"$(LLVM_BUILD_DIR)/x86_64/bin/clang";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
@@ -7520,6 +7522,7 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+   LLDB_PYTHON_TESTSUITE_CC = 
"$(LLVM_BUILD_DIR)/x86_64/bin/clang";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
@@ -7540,6 +7543,7 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+   LLDB_PYTHON_TESTSUITE_CC = 
"$(LLVM_BUILD_DIR)/x86_64/bin/clang";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";


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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

2016-04-04 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 52588.
amccarth added a comment.

OK, this now dumps headers for the ObjectFiles of the modules rather than the 
modules themselves, using `target modules dump objfile` as suggested.

My only concern here is that the SB API has a module dump, but no object file 
dump, and this essentially add the reverse for the command line.

I agree with the additional proposals (e.g., adding an arguments parameter, 
decoding some of the fields, grabbing other info like version resources), but 
I'd like to do those as subsequent changes.


http://reviews.llvm.org/D18464

Files:
  source/Commands/CommandObjectTarget.cpp

Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -1544,6 +1544,38 @@
 strm.Printf("%-*s", width, "");
 }
 
+static size_t
+DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
+{
+size_t num_dumped = 0;
+Mutex::Locker modules_locker(module_list.GetMutex());
+const size_t num_modules = module_list.GetSize();
+if (num_modules > 0)
+{
+strm.Printf("Dumping headers for %" PRIu64 " module(s).\n", static_cast(num_modules));
+strm.IndentMore();
+for (size_t image_idx = 0; image_idx < num_modules; ++image_idx)
+{
+Module *module = module_list.GetModulePointerAtIndexUnlocked(image_idx);
+if (module)
+{
+if (num_dumped++ > 0)
+{
+strm.EOL();
+strm.EOL();
+}
+ObjectFile *objfile = module->GetObjectFile();
+strm.Printf("Headers for '%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();
+objfile->Dump(&strm);
+strm.IndentLess();
+}
+}
+strm.IndentLess();
+}
+return num_dumped;
+}
+
 static void
 DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module, SortOrder sort_order)
 {
@@ -1941,7 +1973,6 @@
ModuleList &module_list, 
bool check_global_list)
 {
-// Dump specified images (by basename or fullpath)
 FileSpec module_file_spec(module_name, false);
 ModuleSpec module_spec (module_file_spec);
 
@@ -2108,6 +2139,77 @@
 }
 };
 
+#pragma mark CommandObjectTargetModulesDumpObjfile
+
+class CommandObjectTargetModulesDumpObjfile : public CommandObjectTargetModulesModuleAutoComplete
+{
+public:
+CommandObjectTargetModulesDumpObjfile(CommandInterpreter &interpreter)
+: CommandObjectTargetModulesModuleAutoComplete(interpreter, "target modules dump objfile",
+   "Dump the object file headers from one or more target modules.",
+   nullptr)
+{
+}
+
+~CommandObjectTargetModulesDumpObjfile() override = default;
+
+protected:
+bool
+DoExecute(Args &command, CommandReturnObject &result) override
+{
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr)
+{
+result.AppendError("invalid target, create a debug target using the 'target create' command");
+result.SetStatus(eReturnStatusFailed);
+return false;
+}
+
+uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+size_t num_dumped = 0;
+if (command.GetArgumentCount() == 0)
+{
+// Dump all headers for all modules images
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), target->GetImages());
+if (num_dumped == 0)
+{
+result.AppendError("the target has no associated executable images");
+result.SetStatus(eReturnStatusFailed);
+}
+}
+else
+{
+// Find the modules that match the basename or full path.
+ModuleList module_list;
+const char *arg_cstr;
+for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
+{
+size_t num_matched = FindModulesByName(target, arg_cstr, module_list, true);
+if (num_matched == 0)
+{
+result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
+}
+}
+// Dump all the modules we found.
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), module_list);
+}
+
+if (num_dumped > 0)
+{
+result.SetStatus(eReturnStatusSuccessFinishResult)

[Lldb-commits] [lldb] r265340 - Xcode: run gtests when building the lldb-gtest target

2016-04-04 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Mon Apr  4 14:40:29 2016
New Revision: 265340

URL: http://llvm.org/viewvc/llvm-project?rev=265340&view=rev
Log:
Xcode: run gtests when building the lldb-gtest target

This addresses the following task:
https://llvm.org/bugs/show_bug.cgi?id=27181 Xcode gtests: ensure they run, not 
just build, on Xcode target

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=265340&r1=265339&r2=265340&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Apr  4 14:40:29 2016
@@ -6007,6 +6007,7 @@
239504D01BDD451400963CEA /* Sources */,
239504D11BDD451400963CEA /* Frameworks */,
239504D21BDD451400963CEA /* CopyFiles */,
+   23B9815E1CB2E2F90059938A /* Run gtests */,
);
buildRules = (
);
@@ -6239,6 +6240,20 @@
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
+   23B9815E1CB2E2F90059938A /* Run gtests */ = {
+   isa = PBXShellScriptBuildPhase;
+   buildActionMask = 2147483647;
+   files = (
+   );
+   inputPaths = (
+   );
+   name = "Run gtests";
+   outputPaths = (
+   );
+   runOnlyForDeploymentPostprocessing = 0;
+   shellPath = /bin/sh;
+   shellScript = "# Run the just-built gtest 
executable\n\n# Uncomment this to see the steps in action\n# set -x\n\n# We 
need to hide the lldb.py that goes into BUILT_PRODUCTS\n# because it will 
conflict with finding the lldb module later,\n# which causes the python 
exception tests to fail.\nif [ -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" ]; then\n   
 mv -f \"${BUILT_PRODUCTS_DIR}/lldb.py\" 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\"\nfi\n\n# Tell lldb-gtest where to find 
the lldb package\nexport 
PYTHONPATH=${BUILT_PRODUCTS_DIR}/LLDB.framework/Resources/Python\n\n# We must 
redirect stdin to /dev/null: without this, xcodebuild\n# will wait forever for 
input when we run the TestExceptionStateChecking\n# 
test.\n${BUILT_PRODUCTS_DIR}/lldb-gtest < /dev/null\nRETCODE=$?\n\nif [ -f 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\" ]; then\nmv -f 
\"${BUILT_PRODUCTS_DIR}/park.lldb.py\" 
\"${BUILT_PRODUCTS_DIR}/lldb.py\"\nfi\n\nexit ${RETCODE}";
+   };
261B5A7511C3FA6F00AABD0A /* Fixup Framework Headers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;


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


[Lldb-commits] [lldb] r265342 - disabled TSAN tests until the author can help track down CI failures

2016-04-04 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Mon Apr  4 14:58:24 2016
New Revision: 265342

URL: http://llvm.org/viewvc/llvm-project?rev=265342&view=rev
Log:
disabled TSAN tests until the author can help track down CI failures

These tests run fine locally for me but are failing on the Green Dragon
OS X CI.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py?rev=265342&r1=265341&r2=265342&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
 Mon Apr  4 14:58:24 2016
@@ -17,6 +17,7 @@ class TsanBasicTestCase(TestBase):
 @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
 @skipIfRemote
 @skipUnlessCompilerRt
+@skipIfDarwin  # rdar://25534884  TSAN tests failing on Green Dragon OS X 
CI (not not locally)
 def test (self):
 self.build ()
 self.tsan_tests ()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py?rev=265342&r1=265341&r2=265342&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
 Mon Apr  4 14:58:24 2016
@@ -17,6 +17,7 @@ class TsanThreadLeakTestCase(TestBase):
 @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
 @skipIfRemote
 @skipUnlessCompilerRt
+@skipIfDarwin  # rdar://25534884  TSAN tests failing on Green Dragon OS X 
CI (not not locally)
 def test (self):
 self.build ()
 self.tsan_tests ()


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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

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

Close, we just need to remove the "Headers for" string. See inlined comment.



Comment at: source/Commands/CommandObjectTarget.cpp:1568
@@ +1567,3 @@
+ObjectFile *objfile = module->GetObjectFile();
+strm.Printf("Headers for '%s':\n", 
objfile->GetFileSpec().GetCString());
+strm.IndentMore();

We should probably leave this for the objfile->Dump(...) to print.  "Headers 
for '%s'" doesn't make sense here. So this print should probably be removed, or 
just the filename should be printed out without the "Headers for" part.


http://reviews.llvm.org/D18464



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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

2016-04-04 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 52618.
amccarth added a comment.

Removed the "headers for" string, but kept the name of the file, as not all of 
the ObjectFile::Dump implementations (e.g., ELF) print the file name.


http://reviews.llvm.org/D18464

Files:
  source/Commands/CommandObjectTarget.cpp

Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -1544,6 +1544,38 @@
 strm.Printf("%-*s", width, "");
 }
 
+static size_t
+DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
+{
+size_t num_dumped = 0;
+Mutex::Locker modules_locker(module_list.GetMutex());
+const size_t num_modules = module_list.GetSize();
+if (num_modules > 0)
+{
+strm.Printf("Dumping headers for %" PRIu64 " module(s).\n", static_cast(num_modules));
+strm.IndentMore();
+for (size_t image_idx = 0; image_idx < num_modules; ++image_idx)
+{
+Module *module = module_list.GetModulePointerAtIndexUnlocked(image_idx);
+if (module)
+{
+if (num_dumped++ > 0)
+{
+strm.EOL();
+strm.EOL();
+}
+ObjectFile *objfile = module->GetObjectFile();
+strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();
+objfile->Dump(&strm);
+strm.IndentLess();
+}
+}
+strm.IndentLess();
+}
+return num_dumped;
+}
+
 static void
 DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module, SortOrder sort_order)
 {
@@ -1941,7 +1973,6 @@
ModuleList &module_list, 
bool check_global_list)
 {
-// Dump specified images (by basename or fullpath)
 FileSpec module_file_spec(module_name, false);
 ModuleSpec module_spec (module_file_spec);
 
@@ -2108,6 +2139,77 @@
 }
 };
 
+#pragma mark CommandObjectTargetModulesDumpObjfile
+
+class CommandObjectTargetModulesDumpObjfile : public CommandObjectTargetModulesModuleAutoComplete
+{
+public:
+CommandObjectTargetModulesDumpObjfile(CommandInterpreter &interpreter)
+: CommandObjectTargetModulesModuleAutoComplete(interpreter, "target modules dump objfile",
+   "Dump the object file headers from one or more target modules.",
+   nullptr)
+{
+}
+
+~CommandObjectTargetModulesDumpObjfile() override = default;
+
+protected:
+bool
+DoExecute(Args &command, CommandReturnObject &result) override
+{
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr)
+{
+result.AppendError("invalid target, create a debug target using the 'target create' command");
+result.SetStatus(eReturnStatusFailed);
+return false;
+}
+
+uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+size_t num_dumped = 0;
+if (command.GetArgumentCount() == 0)
+{
+// Dump all headers for all modules images
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), target->GetImages());
+if (num_dumped == 0)
+{
+result.AppendError("the target has no associated executable images");
+result.SetStatus(eReturnStatusFailed);
+}
+}
+else
+{
+// Find the modules that match the basename or full path.
+ModuleList module_list;
+const char *arg_cstr;
+for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
+{
+size_t num_matched = FindModulesByName(target, arg_cstr, module_list, true);
+if (num_matched == 0)
+{
+result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
+}
+}
+// Dump all the modules we found.
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), module_list);
+}
+
+if (num_dumped > 0)
+{
+result.SetStatus(eReturnStatusSuccessFinishResult);
+}
+else
+{
+result.AppendError("no matching executable images found");
+result.SetStatus(eReturnStatusFailed);
+}
+return result.Succeeded();
+}
+};
+
 #pragma mark CommandObjectTargetModulesDumpSymtab
 
 class CommandObjectTargetModulesDumpSymtab : public CommandObjectTargetModulesMod

Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

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

See inlined comments.



Comment at: source/Commands/CommandObjectTarget.cpp:1568
@@ +1567,3 @@
+ObjectFile *objfile = module->GetObjectFile();
+strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();

Actually looking at the ObjectFilePECOFF and ObjectFileMachO dump functions, 
they both do something like:

```
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
s->Printf("%p: ", static_cast(this));
s->Indent();
if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
s->PutCString("ObjectFileMachO64");
else
s->PutCString("ObjectFileMachO32");

ArchSpec header_arch;
GetArchitecture(header_arch);

*s << ", file = '" << m_file << "', arch = " << 
header_arch.GetArchitectureName() << "\n";
```

We should update ObjectFileELF to do the same kind of thing and remove the 
filename from here.


Comment at: source/Commands/CommandObjectTarget.cpp:1569
@@ +1568,3 @@
+strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();
+objfile->Dump(&strm);

No need to indent more if we aren't printing anything.


Comment at: source/Commands/CommandObjectTarget.cpp:1571
@@ +1570,3 @@
+objfile->Dump(&strm);
+strm.IndentLess();
+}

No need to indent less if we aren't printing anything.


http://reviews.llvm.org/D18464



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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

2016-04-04 Thread Adrian McCarthy via lldb-commits
amccarth added inline comments.


Comment at: source/Commands/CommandObjectTarget.cpp:1568
@@ +1567,3 @@
+ObjectFile *objfile = module->GetObjectFile();
+strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();

clayborg wrote:
> Actually looking at the ObjectFilePECOFF and ObjectFileMachO dump functions, 
> they both do something like:
> 
> ```
> lldb_private::Mutex::Locker locker(module_sp->GetMutex());
> s->Printf("%p: ", static_cast(this));
> s->Indent();
> if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
> s->PutCString("ObjectFileMachO64");
> else
> s->PutCString("ObjectFileMachO32");
> 
> ArchSpec header_arch;
> GetArchitecture(header_arch);
> 
> *s << ", file = '" << m_file << "', arch = " << 
> header_arch.GetArchitectureName() << "\n";
> ```
> 
> We should update ObjectFileELF to do the same kind of thing and remove the 
> filename from here.
Can do.  Is locking the module mutex actually necessary to dump the object file?


Comment at: source/Commands/CommandObjectTarget.cpp:1569
@@ +1568,3 @@
+strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+strm.IndentMore();
+objfile->Dump(&strm);

clayborg wrote:
> No need to indent more if we aren't printing anything.
I thought IndentMore changes the state of the stream so that the dump on the 
next line would be indented relative to the file name we just printed.  Is that 
not how it works?

Perhaps you meant that, since this will no longer print the file name, there's 
no point in indenting.


http://reviews.llvm.org/D18464



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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

2016-04-04 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 52624.
amccarth added a comment.

Removed the per-file header from the common code and make the 
ObjectFileELF::Dump print its own header like the others.


http://reviews.llvm.org/D18464

Files:
  source/Commands/CommandObjectTarget.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2996,6 +2996,22 @@
 void
 ObjectFileELF::Dump(Stream *s)
 {
+ModuleSP module_sp(GetModule());
+if (!module_sp)
+{
+return;
+}
+
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+s->Printf("%p: ", static_cast(this));
+s->Indent();
+s->PutCString("ObjectFileELF");
+
+ArchSpec header_arch;
+GetArchitecture(header_arch);
+
+*s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n";
+
 DumpELFHeader(s, m_header);
 s->EOL();
 DumpELFProgramHeaders(s);
Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -1544,6 +1544,35 @@
 strm.Printf("%-*s", width, "");
 }
 
+static size_t
+DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
+{
+size_t num_dumped = 0;
+Mutex::Locker modules_locker(module_list.GetMutex());
+const size_t num_modules = module_list.GetSize();
+if (num_modules > 0)
+{
+strm.Printf("Dumping headers for %" PRIu64 " module(s).\n", static_cast(num_modules));
+strm.IndentMore();
+for (size_t image_idx = 0; image_idx < num_modules; ++image_idx)
+{
+Module *module = module_list.GetModulePointerAtIndexUnlocked(image_idx);
+if (module)
+{
+if (num_dumped++ > 0)
+{
+strm.EOL();
+strm.EOL();
+}
+ObjectFile *objfile = module->GetObjectFile();
+objfile->Dump(&strm);
+}
+}
+strm.IndentLess();
+}
+return num_dumped;
+}
+
 static void
 DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module, SortOrder sort_order)
 {
@@ -1941,7 +1970,6 @@
ModuleList &module_list, 
bool check_global_list)
 {
-// Dump specified images (by basename or fullpath)
 FileSpec module_file_spec(module_name, false);
 ModuleSpec module_spec (module_file_spec);
 
@@ -2108,6 +2136,77 @@
 }
 };
 
+#pragma mark CommandObjectTargetModulesDumpObjfile
+
+class CommandObjectTargetModulesDumpObjfile : public CommandObjectTargetModulesModuleAutoComplete
+{
+public:
+CommandObjectTargetModulesDumpObjfile(CommandInterpreter &interpreter)
+: CommandObjectTargetModulesModuleAutoComplete(interpreter, "target modules dump objfile",
+   "Dump the object file headers from one or more target modules.",
+   nullptr)
+{
+}
+
+~CommandObjectTargetModulesDumpObjfile() override = default;
+
+protected:
+bool
+DoExecute(Args &command, CommandReturnObject &result) override
+{
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr)
+{
+result.AppendError("invalid target, create a debug target using the 'target create' command");
+result.SetStatus(eReturnStatusFailed);
+return false;
+}
+
+uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+size_t num_dumped = 0;
+if (command.GetArgumentCount() == 0)
+{
+// Dump all headers for all modules images
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), target->GetImages());
+if (num_dumped == 0)
+{
+result.AppendError("the target has no associated executable images");
+result.SetStatus(eReturnStatusFailed);
+}
+}
+else
+{
+// Find the modules that match the basename or full path.
+ModuleList module_list;
+const char *arg_cstr;
+for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
+{
+size_t num_matched = FindModulesByName(target, arg_cstr, module_list, true);
+if (num_matched == 0)
+{
+result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n

Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

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

Looks good. Thanks for making all the changes.


http://reviews.llvm.org/D18464



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


Re: [Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

2016-04-04 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL265349: Implement `target modules dump objfile` (authored by 
amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D18464?vs=52624&id=52626#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18464

Files:
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2996,6 +2996,22 @@
 void
 ObjectFileELF::Dump(Stream *s)
 {
+ModuleSP module_sp(GetModule());
+if (!module_sp)
+{
+return;
+}
+
+lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+s->Printf("%p: ", static_cast(this));
+s->Indent();
+s->PutCString("ObjectFileELF");
+
+ArchSpec header_arch;
+GetArchitecture(header_arch);
+
+*s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n";
+
 DumpELFHeader(s, m_header);
 s->EOL();
 DumpELFProgramHeaders(s);
Index: lldb/trunk/source/Commands/CommandObjectTarget.cpp
===
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp
@@ -1544,6 +1544,35 @@
 strm.Printf("%-*s", width, "");
 }
 
+static size_t
+DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
+{
+size_t num_dumped = 0;
+Mutex::Locker modules_locker(module_list.GetMutex());
+const size_t num_modules = module_list.GetSize();
+if (num_modules > 0)
+{
+strm.Printf("Dumping headers for %" PRIu64 " module(s).\n", static_cast(num_modules));
+strm.IndentMore();
+for (size_t image_idx = 0; image_idx < num_modules; ++image_idx)
+{
+Module *module = module_list.GetModulePointerAtIndexUnlocked(image_idx);
+if (module)
+{
+if (num_dumped++ > 0)
+{
+strm.EOL();
+strm.EOL();
+}
+ObjectFile *objfile = module->GetObjectFile();
+objfile->Dump(&strm);
+}
+}
+strm.IndentLess();
+}
+return num_dumped;
+}
+
 static void
 DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module, SortOrder sort_order)
 {
@@ -1941,7 +1970,6 @@
ModuleList &module_list, 
bool check_global_list)
 {
-// Dump specified images (by basename or fullpath)
 FileSpec module_file_spec(module_name, false);
 ModuleSpec module_spec (module_file_spec);
 
@@ -2108,6 +2136,77 @@
 }
 };
 
+#pragma mark CommandObjectTargetModulesDumpObjfile
+
+class CommandObjectTargetModulesDumpObjfile : public CommandObjectTargetModulesModuleAutoComplete
+{
+public:
+CommandObjectTargetModulesDumpObjfile(CommandInterpreter &interpreter)
+: CommandObjectTargetModulesModuleAutoComplete(interpreter, "target modules dump objfile",
+   "Dump the object file headers from one or more target modules.",
+   nullptr)
+{
+}
+
+~CommandObjectTargetModulesDumpObjfile() override = default;
+
+protected:
+bool
+DoExecute(Args &command, CommandReturnObject &result) override
+{
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr)
+{
+result.AppendError("invalid target, create a debug target using the 'target create' command");
+result.SetStatus(eReturnStatusFailed);
+return false;
+}
+
+uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+size_t num_dumped = 0;
+if (command.GetArgumentCount() == 0)
+{
+// Dump all headers for all modules images
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), target->GetImages());
+if (num_dumped == 0)
+{
+result.AppendError("the target has no associated executable images");
+result.SetStatus(eReturnStatusFailed);
+}
+}
+else
+{
+// Find the modules that match the basename or full path.
+ModuleList module_list;
+const char *arg_cstr;
+for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
+{
+size_t num_matched = FindModulesByName(target, arg_cstr, module_list,

[Lldb-commits] [lldb] r265349 - Implement `target modules dump objfile`

2016-04-04 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Apr  4 16:21:49 2016
New Revision: 265349

URL: http://llvm.org/viewvc/llvm-project?rev=265349&view=rev
Log:
Implement `target modules dump objfile`

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

Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=265349&r1=265348&r2=265349&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Apr  4 16:21:49 2016
@@ -1544,6 +1544,35 @@ DumpBasename (Stream &strm, const FileSp
 strm.Printf("%-*s", width, "");
 }
 
+static size_t
+DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
+{
+size_t num_dumped = 0;
+Mutex::Locker modules_locker(module_list.GetMutex());
+const size_t num_modules = module_list.GetSize();
+if (num_modules > 0)
+{
+strm.Printf("Dumping headers for %" PRIu64 " module(s).\n", 
static_cast(num_modules));
+strm.IndentMore();
+for (size_t image_idx = 0; image_idx < num_modules; ++image_idx)
+{
+Module *module = 
module_list.GetModulePointerAtIndexUnlocked(image_idx);
+if (module)
+{
+if (num_dumped++ > 0)
+{
+strm.EOL();
+strm.EOL();
+}
+ObjectFile *objfile = module->GetObjectFile();
+objfile->Dump(&strm);
+}
+}
+strm.IndentLess();
+}
+return num_dumped;
+}
+
 static void
 DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module 
*module, SortOrder sort_order)
 {
@@ -1941,7 +1970,6 @@ FindModulesByName (Target *target,
ModuleList &module_list, 
bool check_global_list)
 {
-// Dump specified images (by basename or fullpath)
 FileSpec module_file_spec(module_name, false);
 ModuleSpec module_spec (module_file_spec);
 
@@ -2108,6 +2136,77 @@ public:
 }
 };
 
+#pragma mark CommandObjectTargetModulesDumpObjfile
+
+class CommandObjectTargetModulesDumpObjfile : public 
CommandObjectTargetModulesModuleAutoComplete
+{
+public:
+CommandObjectTargetModulesDumpObjfile(CommandInterpreter &interpreter)
+: CommandObjectTargetModulesModuleAutoComplete(interpreter, "target 
modules dump objfile",
+   "Dump the object file 
headers from one or more target modules.",
+   nullptr)
+{
+}
+
+~CommandObjectTargetModulesDumpObjfile() override = default;
+
+protected:
+bool
+DoExecute(Args &command, CommandReturnObject &result) override
+{
+Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+if (target == nullptr)
+{
+result.AppendError("invalid target, create a debug target using 
the 'target create' command");
+result.SetStatus(eReturnStatusFailed);
+return false;
+}
+
+uint32_t addr_byte_size = 
target->GetArchitecture().GetAddressByteSize();
+result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+size_t num_dumped = 0;
+if (command.GetArgumentCount() == 0)
+{
+// Dump all headers for all modules images
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), 
target->GetImages());
+if (num_dumped == 0)
+{
+result.AppendError("the target has no associated executable 
images");
+result.SetStatus(eReturnStatusFailed);
+}
+}
+else
+{
+// Find the modules that match the basename or full path.
+ModuleList module_list;
+const char *arg_cstr;
+for (int arg_idx = 0; (arg_cstr = 
command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
+{
+size_t num_matched = FindModulesByName(target, arg_cstr, 
module_list, true);
+if (num_matched == 0)
+{
+result.AppendWarningWithFormat("Unable to find an image 
that matches '%s'.\n", arg_cstr);
+}
+}
+// Dump all the modules we found.
+num_dumped = DumpModuleObjfileHeaders(result.GetOutputStream(), 
module_list);
+}
+
+if (num_dumped > 0)
+{
+result.SetStatus(eReturnStatusSuccessFinishResult);
+}
+else
+{
+result.AppendError("no matching executable images found");
+result.SetStatu

[Lldb-commits] [lldb] r265357 - Improve the way LLDB escapes arguments before passing them to the shell

2016-04-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Apr  4 17:46:38 2016
New Revision: 265357

URL: http://llvm.org/viewvc/llvm-project?rev=265357&view=rev
Log:
Improve the way LLDB escapes arguments before passing them to the shell

Teach LLDB that different shells have different characters they are sensitive 
to, and use that knowledge to do shell-aware escaping

This helps solve a class of problems on OS X where LLDB would try to launch via 
sh, and run into problems if the command line being passed to the inferior 
contained such special markers (hint: the shell would error out and we'd fail 
to launch)
This makes those launch scenarios work transparently via shell expansion

Slightly improve the error message when this kind of failure occurs to at least 
suggest that the user try going through 'process launch' directly

Fixes rdar://problem/22749408


Modified:
lldb/trunk/include/lldb/API/SBLaunchInfo.h
lldb/trunk/include/lldb/Interpreter/Args.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/ProcessLaunchInfo.cpp

Modified: lldb/trunk/include/lldb/API/SBLaunchInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLaunchInfo.h?rev=265357&r1=265356&r2=265357&view=diff
==
--- lldb/trunk/include/lldb/API/SBLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBLaunchInfo.h Mon Apr  4 17:46:38 2016
@@ -145,7 +145,7 @@ public:
 GetShellExpandArguments ();
 
 void
-SetShellExpandArguments (bool glob);
+SetShellExpandArguments (bool expand);
 
 uint32_t
 GetResumeCount ();

Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=265357&r1=265356&r2=265357&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Mon Apr  4 17:46:38 2016
@@ -403,7 +403,7 @@ public:
 StringToVersion (const char *s, uint32_t &major, uint32_t &minor, uint32_t 
&update);
 
 static const char *
-GetShellSafeArgument (const char *unsafe_arg, std::string &safe_arg);
+GetShellSafeArgument (const FileSpec& shell, const char *unsafe_arg, 
std::string &safe_arg);
 
 // EncodeEscapeSequences will change the textual representation of common
 // escape sequences like "\n" (two characters) into a single '\n'. It does

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py?rev=265357&r1=265356&r2=265357&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
 Mon Apr  4 17:46:38 2016
@@ -30,7 +30,7 @@ class LaunchWithShellExpandTestCase(Test
 breakpoint = target.BreakpointCreateBySourceRegex ('break here', 
lldb.SBFileSpec ("main.cpp", False))
 self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
-self.runCmd("process launch -X true -w %s -- fi*.tx?" % (os.getcwd()))
+self.runCmd("process launch -X true -w %s -- fi*.tx? () > <" % 
(os.getcwd()))
 
 process = self.process()
 
@@ -51,7 +51,11 @@ class LaunchWithShellExpandTestCase(Test
 self.expect("frame variable argv[2]", substrs=['file2.txt'])
 self.expect("frame variable argv[3]", substrs=['file3.txt'])
 self.expect("frame variable argv[4]", substrs=['file4.txy'])
+self.expect("frame variable argv[5]", substrs=['()'])
+self.expect("frame variable argv[6]", substrs=['>'])
+self.expect("frame variable argv[7]", substrs=['<'])
 self.expect("frame variable argv[5]", substrs=['file5.tyx'], 
matching=False)
+self.expect("frame variable argv[8]", substrs=['file5.tyx'], 
matching=False)
 
 self.runCmd("process kill")
 

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=265357&r1=265356&r2=265357&view=diff
==
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Mon Apr  4 17:46:38 2016
@@ -887,14 +887,43 @@ Args::StringToVersion (const char *s, ui
 }
 
 const char *
-Args::GetShellSafeArgument (const char *unsafe_arg, std::string &safe_arg)
+Args::GetShellSafeArgument (con

[Lldb-commits] [PATCH] D18779: Fix dotest.py '-p' option for multi-process mode

2016-04-04 Thread Francis Ricci via lldb-commits
fjricci created this revision.
fjricci added reviewers: zturner, tfiala.
fjricci added subscribers: sas, lldb-commits.

The '-p' option for dotest.py was ignored in multiprocess mode,
as the -p argument to the inferior would overwrite the -p argument
passed on the command line.

http://reviews.llvm.org/D18779

Files:
  packages/Python/lldbsuite/test/dosep.py

Index: packages/Python/lldbsuite/test/dosep.py
===
--- packages/Python/lldbsuite/test/dosep.py
+++ packages/Python/lldbsuite/test/dosep.py
@@ -420,6 +420,10 @@
 results = []
 for (base_name, full_test_path) in files:
 import __main__ as main
+global dotest_options
+if dotest_options.p and not re.search(dotest_options.p, base_name):
+continue
+
 script_file = main.__file__
 command = ([sys.executable, script_file] +
dotest_argv +


Index: packages/Python/lldbsuite/test/dosep.py
===
--- packages/Python/lldbsuite/test/dosep.py
+++ packages/Python/lldbsuite/test/dosep.py
@@ -420,6 +420,10 @@
 results = []
 for (base_name, full_test_path) in files:
 import __main__ as main
+global dotest_options
+if dotest_options.p and not re.search(dotest_options.p, base_name):
+continue
+
 script_file = main.__file__
 command = ([sys.executable, script_file] +
dotest_argv +
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18779: Fix dotest.py '-p' option for multi-process mode

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

That looks fine.  Thanks for the fix!


http://reviews.llvm.org/D18779



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


[Lldb-commits] [lldb] r265377 - Consolidate the knowledge of what arm cores are always executing

2016-04-04 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Apr  5 00:01:30 2016
New Revision: 265377

URL: http://llvm.org/viewvc/llvm-project?rev=265377&view=rev
Log:
Consolidate the knowledge of what arm cores are always executing
in thumb mode into one method in ArchSpec, replace checks for
specific cores in the disassembler with calls to this.  Also call
this from the arm instruction emulation code.

The determination of whether a given ArchSpec is thumb-only is still
a bit of a hack, but at least the hack is consolidated into a single
place.  In my original version of this patch http://reviews.llvm.org/D13578
I was calling into llvm's feature arm feature tables to make this
determination, like

#include "llvm/Support/TargetRegistry.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/../../lib/Target/ARM/ARMGenRegisterInfo.inc"
#include "llvm/../../lib/Target/ARM/ARMFeatures.h"

[...]

std::string triple (GetTriple().getTriple());
const char *cpu = "";
const char *features_str = "";
const llvm::Target *curr_target = 
llvm::TargetRegistry::lookupTarget(triple.c_str(), Error);
std::unique_ptr subtarget_info_up 
(curr_target->createMCSubtargetInfo(triple.c_str(), cpu, features_str));
if (subtarget_info_up->getFeatureBits()[llvm::ARM::FeatureNoARM])
{
return true;
}

but those tables are post-llvm-build generated and linking against them
for all of our different build system methods was a big hiccup that I
haven't had time to revisit convincingly.

I'll keep that reviews.llvm.org patch around to remind myself that I
need to take another run at linking against the necessary tables 
again in llvm.

 


Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=265377&r1=265376&r2=265377&view=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Tue Apr  5 00:01:30 2016
@@ -622,6 +622,22 @@ public:
 bool &os_version_different,
 bool &env_different);
 
+//--
+/// Detect whether this architecture uses thumb code exclusively
+///
+/// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can
+/// only execute the Thumb instructions, never Arm.  We should normally
+/// pick up arm/thumbness from their the processor status bits (cpsr/xpsr)
+/// or hints on each function - but when doing bare-boards low level
+/// debugging (especially common with these embedded processors), we may
+/// not have those things easily accessible.
+///
+/// @return true if this is an arm ArchSpec which can only execute Thumb
+/// instructions
+//--
+bool
+IsAlwaysThumbInstructions () const;
+
 uint32_t
 GetFlags () const
 {

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=265377&r1=265376&r2=265377&view=diff
==
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Tue Apr  5 00:01:30 2016
@@ -898,6 +898,17 @@ ArchSpec::MergeFrom(const ArchSpec &othe
 if (other.TripleVendorWasSpecified())
 GetTriple().setEnvironment(other.GetTriple().getEnvironment());
 }
+// If this and other are both arm ArchSpecs and this ArchSpec is a generic 
"some kind of arm"
+// spec but the other ArchSpec is a specific arm core, adopt the specific 
arm core.
+if (GetTriple().getArch() == llvm::Triple::arm
+&& other.GetTriple().getArch() == llvm::Triple::arm
+&& IsCompatibleMatch (other)
+&& GetCore() == ArchSpec::eCore_arm_generic
+&& other.GetCore() != ArchSpec::eCore_arm_generic)
+{
+m_core = other.GetCore();
+CoreUpdated (true);
+}
 }
 
 bool
@@ -1522,6 +1533,31 @@ ArchSpec::PiecewiseTripleCompare (const
 env_different = (me.getEnvironment() != them.getEnvironment());
 }
 
+bool
+ArchSpec::IsAlwaysThumbInstructions () const
+{
+std::string Error;
+if (GetTriple().getArch() == llvm::Triple::arm || GetTriple().getArch() == 
llvm::Triple::thumb)
+{
+// v. https://en.wikipedia.org/wiki/ARM_Cortex-M
+//
+// Cortex-M0 through Cortex-M7 are ARM processor cores which can only
+// execute thumb instructions.  We map the cores to arch names like 
this: