[Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-06 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer added a comment.

Can you make the usage of "using namespace llvm::sys::fs;" a bit more 
consistent? Sometime you write fully qualified name, sometime you add it to the 
top of the file while sometime only to the function where it is used.




Comment at: llvm/include/llvm/Support/FileSystem.h:482-486
 /// @brief Does status represent a directory?
 ///
 /// @param status A file_status previously returned from status.
 /// @returns status.type() == file_type::directory_file.
+file_type get_file_type(const Twine &Path);

Please fix the comment


https://reviews.llvm.org/D30624



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


[Lldb-commits] [lldb] r297013 - Fix Log unit tests

2017-03-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar  6 09:17:36 2017
New Revision: 297013

URL: http://llvm.org/viewvc/llvm-project?rev=297013&view=rev
Log:
Fix Log unit tests

the llvm function for getting the thread name dropped the _np suffix
during review. Zachary's commit did not reflect that.

Modified:
lldb/trunk/unittests/Utility/LogTest.cpp

Modified: lldb/trunk/unittests/Utility/LogTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/LogTest.cpp?rev=297013&r1=297012&r2=297013&view=diff
==
--- lldb/trunk/unittests/Utility/LogTest.cpp (original)
+++ lldb/trunk/unittests/Utility/LogTest.cpp Mon Mar  6 09:17:36 2017
@@ -73,9 +73,8 @@ TEST(LogTest, log_options) {
   "World 47\n",
   GetLogString(LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION, "Hello World {0}", 
47));
 
-  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n",
-  ::getpid(),
-  llvm::get_threadid_np())
+  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n", ::getpid(),
+  llvm::get_threadid())
 .str(),
 GetLogString(LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD,
  "Hello World {0}", 47));


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


Re: [Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-06 Thread Zachary Turner via lldb-commits
I put the using only if I have to type the namespace more than once. I can
change the global using to be local, but I don't think it makes sense to
either always put the using or never put it
On Mon, Mar 6, 2017 at 3:59 AM Tamas Berghammer via Phabricator <
revi...@reviews.llvm.org> wrote:

> tberghammer added a comment.
>
> Can you make the usage of "using namespace llvm::sys::fs;" a bit more
> consistent? Sometime you write fully qualified name, sometime you add it to
> the top of the file while sometime only to the function where it is used.
>
>
>
> 
> Comment at: llvm/include/llvm/Support/FileSystem.h:482-486
>  /// @brief Does status represent a directory?
>  ///
>  /// @param status A file_status previously returned from status.
>  /// @returns status.type() == file_type::directory_file.
> +file_type get_file_type(const Twine &Path);
> 
> Please fix the comment
>
>
> https://reviews.llvm.org/D30624
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looks great, just a couple of style nits in the tests.




Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:82
 
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringSwitch.h"

Is this include still necessary?



Comment at: unittests/Signals/UnixSignalsTest.cpp:43
+
+#define ASSERT_EQ_ARRAYS(expected, observed)   
\
+  AssertEqArrays((expected), (observed), __FILE__, __LINE__);

This (and the function) should probably have an EXPECT_.. prefix instead, as it 
does not abort the evaluation of the function it is in (like other ASSERT_*** 
macros).



Comment at: unittests/Signals/UnixSignalsTest.cpp:64
+  signals.GetSignalInfo(signo, should_suppress, should_stop, 
should_notify);
+  EXPECT_EQ(name, "SIG4");
+  EXPECT_EQ(should_suppress, true);

We generally put the "expected" value first, and the observed second. The 
ASSERT_ macro does that, but here you seem to have inverted it.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30622: Remove FileSpec::ReadFileContents

2017-03-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks great. One thing I'd consider is adding a function which returns the data 
buffer as a StringRef (`AsStringRef()` ?) instead of the GetChars function, but 
I don't feel strongly about it.


https://reviews.llvm.org/D30622



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


[Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Cool.

I would find `using fs = llvm::sys::fs` (or whatever is the correct namespace 
alias syntax)  more readable, as you then still have `fs::` in the references, 
but maybe that's just my preference...


https://reviews.llvm.org/D30624



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


Re: [Lldb-commits] [lldb] r297013 - Fix Log unit tests

2017-03-06 Thread Zachary Turner via lldb-commits
Weird, I could have sworn I fixed this.  But looking at my disk, it's
sitting uncommitted :-/

On Mon, Mar 6, 2017 at 7:29 AM Pavel Labath via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: labath
> Date: Mon Mar  6 09:17:36 2017
> New Revision: 297013
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297013&view=rev
> Log:
> Fix Log unit tests
>
> the llvm function for getting the thread name dropped the _np suffix
> during review. Zachary's commit did not reflect that.
>
> Modified:
> lldb/trunk/unittests/Utility/LogTest.cpp
>
> Modified: lldb/trunk/unittests/Utility/LogTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/LogTest.cpp?rev=297013&r1=297012&r2=297013&view=diff
>
> ==
> --- lldb/trunk/unittests/Utility/LogTest.cpp (original)
> +++ lldb/trunk/unittests/Utility/LogTest.cpp Mon Mar  6 09:17:36 2017
> @@ -73,9 +73,8 @@ TEST(LogTest, log_options) {
>"World 47\n",
>GetLogString(LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION, "Hello World
> {0}", 47));
>
> -  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n",
> -  ::getpid(),
> -  llvm::get_threadid_np())
> +  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n",
> ::getpid(),
> +  llvm::get_threadid())
>  .str(),
>  GetLogString(LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD,
>   "Hello World {0}", 47));
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r297035 - Fix line endings of deps analysis script.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 11:40:36 2017
New Revision: 297035

URL: http://llvm.org/viewvc/llvm-project?rev=297035&view=rev
Log:
Fix line endings of deps analysis script.

Modified:
lldb/trunk/scripts/analyze-project-deps.py

Modified: lldb/trunk/scripts/analyze-project-deps.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/analyze-project-deps.py?rev=297035&r1=297034&r2=297035&view=diff
==
--- lldb/trunk/scripts/analyze-project-deps.py (original)
+++ lldb/trunk/scripts/analyze-project-deps.py Mon Mar  6 11:40:36 2017
@@ -1,66 +1,66 @@
-import os
-import re
-
-from use_lldb_suite import lldb_root
-
-src_dir = os.path.join(lldb_root, "source")
-inc_dir = os.path.join(lldb_root, "include")
-
-src_map = {}
-
-include_regex = re.compile('#include \"(lldb(.*/)+).*\"')
-
-def scan_deps(this_dir, file):
-includes = set()
-with open(file) as f:
-for line in list(f):
-m = include_regex.match(line)
-if m is not None:
-relative = m.groups()[0].rstrip("/")
-if relative != this_dir:
-includes.add(relative)
-return includes
-
-def insert_or_add_mapping(base, deps):
-global src_map
-if len(deps) > 0:
-if base in src_map:
-existing_deps = src_map[base]
-existing_deps.update(deps)
-else:
-src_map[base] = deps
-
-for (base, dirs, files) in os.walk(inc_dir):
-dir = os.path.basename(base)
-relative = os.path.relpath(base, inc_dir)
-inc_files = filter(lambda x : os.path.splitext(x)[1] in [".h"], files)
-deps = set()
-relative = relative.replace("\\", "/")
-for inc in inc_files:
-inc_path = os.path.join(base, inc)
-deps.update(scan_deps(relative, inc_path))
-insert_or_add_mapping(relative, deps)
-
-for (base, dirs, files) in os.walk(src_dir):
-dir = os.path.basename(base)
-relative = os.path.relpath(base, src_dir)
-src_files = filter(lambda x : os.path.splitext(x)[1] in [".cpp", ".h", 
".mm"], files)
-deps = set()
-norm_base_path = os.path.normpath(os.path.join("lldb", relative))
-norm_base_path = norm_base_path.replace("\\", "/")
-for src in src_files:
-src_path = os.path.join(base, src)
-deps.update(scan_deps(norm_base_path, src_path))
-insert_or_add_mapping(norm_base_path, deps)
-pass
-
-items = list(src_map.iteritems())
-items.sort(lambda A, B : cmp(A[0], B[0]))
-
-for (path, deps) in items:
-print path + ":"
-sorted_deps = list(deps)
-sorted_deps.sort()
-for dep in sorted_deps:
-print "\t" + dep
+import os
+import re
+
+from use_lldb_suite import lldb_root
+
+src_dir = os.path.join(lldb_root, "source")
+inc_dir = os.path.join(lldb_root, "include")
+
+src_map = {}
+
+include_regex = re.compile('#include \"(lldb(.*/)+).*\"')
+
+def scan_deps(this_dir, file):
+includes = set()
+with open(file) as f:
+for line in list(f):
+m = include_regex.match(line)
+if m is not None:
+relative = m.groups()[0].rstrip("/")
+if relative != this_dir:
+includes.add(relative)
+return includes
+
+def insert_or_add_mapping(base, deps):
+global src_map
+if len(deps) > 0:
+if base in src_map:
+existing_deps = src_map[base]
+existing_deps.update(deps)
+else:
+src_map[base] = deps
+
+for (base, dirs, files) in os.walk(inc_dir):
+dir = os.path.basename(base)
+relative = os.path.relpath(base, inc_dir)
+inc_files = filter(lambda x : os.path.splitext(x)[1] in [".h"], files)
+deps = set()
+relative = relative.replace("\\", "/")
+for inc in inc_files:
+inc_path = os.path.join(base, inc)
+deps.update(scan_deps(relative, inc_path))
+insert_or_add_mapping(relative, deps)
+
+for (base, dirs, files) in os.walk(src_dir):
+dir = os.path.basename(base)
+relative = os.path.relpath(base, src_dir)
+src_files = filter(lambda x : os.path.splitext(x)[1] in [".cpp", ".h", 
".mm"], files)
+deps = set()
+norm_base_path = os.path.normpath(os.path.join("lldb", relative))
+norm_base_path = norm_base_path.replace("\\", "/")
+for src in src_files:
+src_path = os.path.join(base, src)
+deps.update(scan_deps(norm_base_path, src_path))
+insert_or_add_mapping(norm_base_path, deps)
+pass
+
+items = list(src_map.iteritems())
+items.sort(lambda A, B : cmp(A[0], B[0]))
+
+for (path, deps) in items:
+print path + ":"
+sorted_deps = list(deps)
+sorted_deps.sort()
+for dep in sorted_deps:
+print "\t" + dep
 pass
\ No newline at end of file


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


[Lldb-commits] [lldb] r297036 - A few improvements to deps analysis scripts.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 11:41:00 2017
New Revision: 297036

URL: http://llvm.org/viewvc/llvm-project?rev=297036&view=rev
Log:
A few improvements to deps analysis scripts.

1) Looks in Plugins and clang
2) Adds a mode to display the deps sorted by the number of times
   the deps occurs in a particular project

Modified:
lldb/trunk/scripts/analyze-project-deps.py

Modified: lldb/trunk/scripts/analyze-project-deps.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/analyze-project-deps.py?rev=297036&r1=297035&r2=297036&view=diff
==
--- lldb/trunk/scripts/analyze-project-deps.py (original)
+++ lldb/trunk/scripts/analyze-project-deps.py Mon Mar  6 11:41:00 2017
@@ -1,57 +1,68 @@
+import argparse
 import os
 import re
 
 from use_lldb_suite import lldb_root
 
+parser = argparse.ArgumentParser(
+description='Analyze LLDB project #include dependencies.')
+parser.add_argument('--show-counts', default=False, action='store_true', 
+help='When true, show the number of dependencies from each subproject')
+args = parser.parse_args()
+
 src_dir = os.path.join(lldb_root, "source")
 inc_dir = os.path.join(lldb_root, "include")
 
 src_map = {}
 
-include_regex = re.compile('#include \"(lldb(.*/)+).*\"')
+include_regex = re.compile('#include \"((lldb|Plugins|clang)(.*/)+).*\"')
+
+def normalize_host(str):
+if str.startswith("lldb/Host"):
+return "lldb/Host"
+return str
 
 def scan_deps(this_dir, file):
-includes = set()
+global src_map
+deps = {}
+this_dir = normalize_host(this_dir)
+if this_dir in src_map:
+deps = src_map[this_dir]
+
 with open(file) as f:
 for line in list(f):
 m = include_regex.match(line)
-if m is not None:
-relative = m.groups()[0].rstrip("/")
-if relative != this_dir:
-includes.add(relative)
-return includes
-
-def insert_or_add_mapping(base, deps):
-global src_map
-if len(deps) > 0:
-if base in src_map:
-existing_deps = src_map[base]
-existing_deps.update(deps)
-else:
-src_map[base] = deps
+if m is None:
+continue
+relative = m.groups()[0].rstrip("/")
+if relative == this_dir:
+continue
+relative = normalize_host(relative)
+if relative in deps:
+deps[relative] += 1
+else:
+deps[relative] = 1
+if this_dir not in src_map and len(deps) > 0:
+src_map[this_dir] = deps
 
 for (base, dirs, files) in os.walk(inc_dir):
 dir = os.path.basename(base)
 relative = os.path.relpath(base, inc_dir)
 inc_files = filter(lambda x : os.path.splitext(x)[1] in [".h"], files)
-deps = set()
 relative = relative.replace("\\", "/")
 for inc in inc_files:
 inc_path = os.path.join(base, inc)
-deps.update(scan_deps(relative, inc_path))
-insert_or_add_mapping(relative, deps)
+scan_deps(relative, inc_path)
 
 for (base, dirs, files) in os.walk(src_dir):
 dir = os.path.basename(base)
 relative = os.path.relpath(base, src_dir)
 src_files = filter(lambda x : os.path.splitext(x)[1] in [".cpp", ".h", 
".mm"], files)
-deps = set()
 norm_base_path = os.path.normpath(os.path.join("lldb", relative))
 norm_base_path = norm_base_path.replace("\\", "/")
 for src in src_files:
 src_path = os.path.join(base, src)
-deps.update(scan_deps(norm_base_path, src_path))
-insert_or_add_mapping(norm_base_path, deps)
+scan_deps(norm_base_path, src_path)
 pass
 
 items = list(src_map.iteritems())
@@ -59,8 +70,13 @@ items.sort(lambda A, B : cmp(A[0], B[0])
 
 for (path, deps) in items:
 print path + ":"
-sorted_deps = list(deps)
-sorted_deps.sort()
-for dep in sorted_deps:
-print "\t" + dep
+sorted_deps = list(deps.iteritems())
+if args.show_counts:
+sorted_deps.sort(lambda A, B: cmp(A[1], B[1]))
+for dep in sorted_deps:
+print "\t{} [{}]".format(dep[0], dep[1])
+else:
+sorted_deps.sort(lambda A, B: cmp(A[0], B[0]))
+for dep in sorted_deps:
+print "\t{}".format(dep[0])
 pass
\ No newline at end of file


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


[Lldb-commits] [lldb] r297053 - Update log_options unit test

2017-03-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar  6 13:10:19 2017
New Revision: 297053

URL: http://llvm.org/viewvc/llvm-project?rev=297053&view=rev
Log:
Update log_options unit test

it was accessing the details of the Log class directly. Let it go
through the channel class instead.

This also discovered a bug when we were setting but not clearing the log
options when enabling a channel.

Modified:
lldb/trunk/source/Utility/Log.cpp
lldb/trunk/unittests/Utility/LogTest.cpp

Modified: lldb/trunk/source/Utility/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=297053&r1=297052&r2=297053&view=diff
==
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Mon Mar  6 13:10:19 2017
@@ -89,7 +89,7 @@ void Log::Channel::Enable(Log &log,
   uint32_t options, uint32_t flags) {
   log.GetMask().Set(flags);
   if (log.GetMask().Get()) {
-log.GetOptions().Set(options);
+log.GetOptions().Reset(options);
 log.SetStream(stream_sp);
 log_ptr.store(&log, std::memory_order_release);
   }

Modified: lldb/trunk/unittests/Utility/LogTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/LogTest.cpp?rev=297053&r1=297052&r2=297053&view=diff
==
--- lldb/trunk/unittests/Utility/LogTest.cpp (original)
+++ lldb/trunk/unittests/Utility/LogTest.cpp Mon Mar  6 13:10:19 2017
@@ -39,47 +39,11 @@ struct LogChannelTest : public ::testing
   }
 };
 
-static std::string GetLogString(uint32_t log_options, const char *format,
-int arg) {
-  std::string stream_string;
-  std::shared_ptr stream_sp(
-  new llvm::raw_string_ostream(stream_string));
-  Log log_(stream_sp);
-  log_.GetOptions().Reset(log_options);
-  Log *log = &log_;
-  LLDB_LOG(log, format, arg);
-  return stream_sp->str();
-}
-
 TEST(LogTest, LLDB_LOG_nullptr) {
   Log *log = nullptr;
   LLDB_LOG(log, "{0}", 0); // Shouldn't crash
 }
 
-TEST(LogTest, log_options) {
-  EXPECT_EQ("Hello World 47\n", GetLogString(0, "Hello World {0}", 47));
-  EXPECT_EQ("Hello World 47\n",
-GetLogString(LLDB_LOG_OPTION_THREADSAFE, "Hello World {0}", 47));
-
-  {
-std::string msg =
-GetLogString(LLDB_LOG_OPTION_PREPEND_SEQUENCE, "Hello World {0}", 47);
-int seq_no;
-EXPECT_EQ(1, sscanf(msg.c_str(), "%d Hello World 47", &seq_no));
-  }
-
-  EXPECT_EQ(
-  "LogTest.cpp:GetLogString Hello "
-  "World 47\n",
-  GetLogString(LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION, "Hello World {0}", 
47));
-
-  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n", ::getpid(),
-  llvm::get_threadid())
-.str(),
-GetLogString(LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD,
- "Hello World {0}", 47));
-}
-
 TEST(LogTest, Register) {
   llvm::llvm_shutdown_obj obj;
   Log::Register("chan", test_channel);
@@ -187,6 +151,47 @@ TEST_F(LogChannelTest, List) {
   EXPECT_EQ("Invalid log channel 'chanchan'.\n", str.GetString().str());
 }
 
+static std::string GetLogString(uint32_t log_options, const char *format,
+int arg) {
+  std::string message;
+  std::shared_ptr stream_sp(
+  new llvm::raw_string_ostream(message));
+  StreamString err;
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, log_options, "chan", {}, err));
+
+  Log *log = test_channel.GetLogIfAll(FOO);
+  EXPECT_NE(nullptr, log);
+
+  LLDB_LOG(log, format, arg);
+  EXPECT_TRUE(Log::DisableLogChannel("chan", {}, err));
+
+  return stream_sp->str();
+}
+
+TEST_F(LogChannelTest, log_options) {
+  EXPECT_EQ("Hello World 47\n", GetLogString(0, "Hello World {0}", 47));
+  EXPECT_EQ("Hello World 47\n",
+GetLogString(LLDB_LOG_OPTION_THREADSAFE, "Hello World {0}", 47));
+
+  {
+std::string msg =
+GetLogString(LLDB_LOG_OPTION_PREPEND_SEQUENCE, "Hello World {0}", 47);
+int seq_no;
+EXPECT_EQ(1, sscanf(msg.c_str(), "%d Hello World 47", &seq_no));
+  }
+
+  EXPECT_EQ(
+  "LogTest.cpp:GetLogString Hello "
+  "World 47\n",
+  GetLogString(LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION, "Hello World {0}", 
47));
+
+  EXPECT_EQ(llvm::formatv("[{0,0+4}/{1,0+4}] Hello World 47\n", ::getpid(),
+  llvm::get_threadid())
+.str(),
+GetLogString(LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD,
+ "Hello World {0}", 47));
+}
+
 TEST_F(LogChannelTest, LogThread) {
   // Test that we are able to concurrently write to a log channel and disable
   // it.


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


[Lldb-commits] [PATCH] D30454: [LLDB][MIPS] Fix typo in MatchesModuleSpec()

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So a ModuleSpec allows you to specify a module by path, UUID and many other 
things. This is falling down for a magic file that doesn't actually exist 
right? "vsdo" is just a made up name for the table of loaded shared libraries? 
Is that correct? I need to understand what is going on before I can offer 
correct guidance.


https://reviews.llvm.org/D30454



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


[Lldb-commits] [PATCH] D29581: Initial implementation of SB APIs for Tracing support.

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Much better. Found some extra stuff. In general we should be using 
SBStructuredData when ever we want to get/set stuff from structured data like 
JSON, XML or Apple plist, etc. If we make the APIs use SBStructuredData instead 
of using a SBStream, we can add constructors to SBStructuredData to init with 
JSON, XML, Apple plist, and more. All this will be parsed into a 
SBStructuredData or StructuredData::ObjectSP underneath, and then all people 
will use the StructuredData::ObjectSP on the inside.




Comment at: include/lldb/API/SBProcess.h:267
+  lldb::SBTrace StartTrace(SBTraceOptions &options, lldb::SBError &error,
+   lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
+

Seems like the thread_id should go into the SBTraceOptions.



Comment at: include/lldb/API/SBTrace.h:16
+
+class SBTraceImpl;
+

Remove SB from SBTraceImpl. Anything "SB" prefixed should be in the lldb 
namespace and should be exported, This shouldn't be exported.



Comment at: include/lldb/API/SBTrace.h:97-99
+  /// @param[in] thread_id
+  /// The thread_id could be optionally provided to obtain the
+  /// configuration used by a particular thread.

Do the SBTraceOptions allow you to specify different things for different 
threads? If not, this parameter probably isn't needed, or could be extracted 
from the SBTraceOptions class itself. Seems like this isn't needed.



Comment at: include/lldb/API/SBTrace.h:109
+protected:
+  typedef std::shared_ptr SBTraceImplSP;
+

Use TraceImpl instead of SBTraceImpl



Comment at: include/lldb/API/SBTraceOptions.h:31
+  /// The returned parameters would be formatted as a JSON Array.
+  lldb::SBError getTraceParams(lldb::SBStream &ss);
+

Seems like this might be better as:

```
lldb::SBStructuredData getTraceParams(lldb::SBError &error);
```

The SBStructuredData can then emit to JSON or XML or any other format 
eventually.



Comment at: include/lldb/API/SBTraceOptions.h:38
+  /// They should be formatted as a JSON Array.
+  void setTraceParams(lldb::SBStream ¶ms);
+

This should probably be:

```
void setTraceParams(lldb::SBStructuredData ¶ms);
```

Then we can add extra functions to SBStructuredData that allow you construct 
one from XML, JSON, Apple plist, or any other structured data.



Comment at: include/lldb/API/SBTraceOptions.h:52
+
+  typedef std::shared_ptr TraceOptionsSP;
+  TraceOptionsSP m_traceoptions_sp;

We should move this typedef into lldb-forward.h



Comment at: include/lldb/API/SBTraceOptions.h:53
+  typedef std::shared_ptr TraceOptionsSP;
+  TraceOptionsSP m_traceoptions_sp;
+};

If we move this to lldb-forward.h, this will become "lldb::TraceOptionsSP"



Comment at: include/lldb/Target/Process.h:78
+
+  void setTraceParams(std::string ¶ms) {
+StructuredData::ObjectSP dict_obj = StructuredData::ParseJSON(params);

We should start with SBStructuredData from the API, and then this function will 
just take a StructuredData::ObjectSP dict_obj



Comment at: include/lldb/lldb-enumerations.h:721
 
+enum TraceType { eTraceTypeNone = 0, eTraceTypeProcessorTrace };
+

Maybe a bit more documentation here for eTraceTypeProcessorTrace? Saying 
something like "this requests the raw trace buffer bytes from what ever CPU you 
are using, ...".



Comment at: scripts/interface/SBTrace.i:12
+
+class LLDB_API SBTrace {
+public:

Do we want something in here that explains what kind of trace buffer data you 
will be getting? I am thinking that even though we know we ask for 
"eTraceTypeProcessorTrace", this might not be enough for a plug-in to interpret 
these bytes. Do we need something like:

```
class SBTrace {
const char *GetTraceDataName();
};
```

And for intel it might return "intel processor trace version 2.0"? Or Maybe it 
would. be better as:

```
class SBTrace {
lldb::SBStructuredData GetTraceDataInfo();
};
```

This could return data that could be accessed as JSON. The version could be 
encoded in here. Maybe the exact CPU type, or CPU ID could also be encoded. I 
am guessing that the intel processor trace has already changed format from CPU 
to CPU and might also change in the future? This would help the plug-in that 
will interpret the trace byte to extract them correctly?



Comment at: scripts/interface/SBTraceOptions.i:22
+
+  lldb::SBError getTraceParams(lldb::SBStream &ss);
+

Use lldb::SBStructuredData instead of SBStream



Comment at: source/API/SBTrace.cpp:30
+  ProcessSP process_sp(GetSP());
+  Log *log(lldb_private::GetLog

[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

That looks good.  This is a good addition for processes that are really chatty 
with some signals.  Thanks for working on this.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Pretty close. My only objection is we have many "lldb_private::Process::Will" 
and "lldb_private::Process::Did" prefixed functions and none of them are 
required to call the superclass version. I would prefer that this doesn't 
change. See my inlined comments,




Comment at: source/Target/Process.cpp:1624-1627
+Error Process::WillResume() {
+  UpdateAutomaticSignalFiltering();
+  return Error();
+}

I would prefer to not require people to call the base class functions for any 
"Process::Will*" or "Process::Did*" there are many of these and the ideas are 
that these are things that can be overridden. These aren't called in that many 
places, so it will be easy to just call this function before calling it, or 
adding a Process::PrivateWillResume that calls UpdateAutomaticSignalFiltering() 
followed by Process::WillResume().



Comment at: source/Target/Process.cpp:1629
+
+void Process::DidLaunch() { UpdateAutomaticSignalFiltering(); }
+

Ditto.



Comment at: unittests/Signals/UnixSignalsTest.cpp:64
+  signals.GetSignalInfo(signo, should_suppress, should_stop, 
should_notify);
+  EXPECT_EQ(name, "SIG4");
+  EXPECT_EQ(should_suppress, true);

labath wrote:
> We generally put the "expected" value first, and the observed second. The 
> ASSERT_ macro does that, but here you seem to have inverted it.
Is this "expected" value being first documented somewhere? If not it should be. 
I have seen this comment a few times and it would be great if the headerdoc 
already says this. 


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

My main objection is that if we have 10 "lldb_private::Process::Will*" 
functions and only some require you to call the superclass, then it is 
confusing. It is also hard to enforce. We probably have other process 
subclasses that override these functions and they all would be broken. It also 
makes it harder when merging code to other branches that might have an extra 
process subclass. The merge would go fine, but any process subclasses that 
exist only in other branches would now be out of date and doing the wrong thing 
by not calling the superclass.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 90755.
eugene added a comment.

Addressing review comments on SignalTests and getting rid of dependency on 
DidLaunch and WillResume


https://reviews.llvm.org/D30520

Files:
  include/lldb/Target/Process.h
  include/lldb/Target/UnixSignals.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  source/Target/UnixSignals.cpp
  unittests/CMakeLists.txt
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  unittests/Signals/CMakeLists.txt
  unittests/Signals/UnixSignalsTest.cpp

Index: unittests/Signals/UnixSignalsTest.cpp
===
--- /dev/null
+++ unittests/Signals/UnixSignalsTest.cpp
@@ -0,0 +1,140 @@
+//===-- UnixSignalsTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include 
+
+#include "gtest/gtest.h"
+
+#include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using llvm::None;
+
+class TestSignals : public UnixSignals {
+public:
+  TestSignals() {
+m_signals.clear();
+AddSignal(2, "SIG2", false, true, true, "DESC2");
+AddSignal(4, "SIG4", true, false, true, "DESC4");
+AddSignal(8, "SIG8", true, true, true, "DESC8");
+AddSignal(16, "SIG16", true, false, false, "DESC16");
+  }
+};
+
+void AssertEqArrays(llvm::ArrayRef expected,
+llvm::ArrayRef observed, const char *file,
+int line) {
+  std::string location = llvm::formatv("{0}:{1}", file, line);
+  ASSERT_EQ(expected.size(), observed.size()) << location;
+
+  for (size_t i = 0; i < observed.size(); ++i) {
+ASSERT_EQ(expected[i], observed[i])
+<< "array index: " << i << "location:" << location;
+  }
+}
+
+#define ASSERT_EQ_ARRAYS(expected, observed)   \
+  AssertEqArrays((expected), (observed), __FILE__, __LINE__);
+
+TEST(UnixSignalsTest, Iteration) {
+  TestSignals signals;
+
+  EXPECT_EQ(4, signals.GetNumSignals());
+  EXPECT_EQ(2, signals.GetFirstSignalNumber());
+  EXPECT_EQ(4, signals.GetNextSignalNumber(2));
+  EXPECT_EQ(8, signals.GetNextSignalNumber(4));
+  EXPECT_EQ(16, signals.GetNextSignalNumber(8));
+  EXPECT_EQ(LLDB_INVALID_SIGNAL_NUMBER, signals.GetNextSignalNumber(16));
+}
+
+TEST(UnixSignalsTest, GetInfo) {
+  TestSignals signals;
+
+  bool should_suppress = false, should_stop = false, should_notify = false;
+  int32_t signo = 4;
+  std::string name =
+  signals.GetSignalInfo(signo, should_suppress, should_stop, should_notify);
+  EXPECT_EQ("SIG4", name);
+  EXPECT_EQ(true, should_suppress);
+  EXPECT_EQ(false, should_stop);
+  EXPECT_EQ(true, should_notify);
+
+  EXPECT_EQ(true, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(false, signals.GetShouldStop(signo));
+  EXPECT_EQ(true, signals.GetShouldNotify(signo));
+  EXPECT_EQ(name, signals.GetSignalAsCString(signo));
+}
+
+TEST(UnixSignalsTest, VersionChange) {
+  TestSignals signals;
+
+  int32_t signo = 8;
+  uint64_t ver = signals.GetVersion();
+  EXPECT_GT(ver, 0ull);
+  EXPECT_EQ(true, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(true, signals.GetShouldStop(signo));
+  EXPECT_EQ(true, signals.GetShouldNotify(signo));
+
+  EXPECT_EQ(signals.GetVersion(), ver);
+
+  signals.SetShouldSuppress(signo, false);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  signals.SetShouldStop(signo, true);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  signals.SetShouldNotify(signo, false);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  EXPECT_EQ(false, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(true, signals.GetShouldStop(signo));
+  EXPECT_EQ(false, signals.GetShouldNotify(signo));
+
+  EXPECT_EQ(ver, signals.GetVersion());
+}
+
+TEST(UnixSignalsTest, GetFilteredSignals) {
+  TestSignals signals;
+
+  auto all_signals = signals.GetFilteredSignals(None, None, None);
+  std::vector expected = {2, 4, 8, 16};
+  ASSERT_EQ_ARRAYS(expected, all_signals);
+
+  auto supressed = signals.GetFilteredSignals(true, None, None);
+  expected = {4, 8, 16};
+  ASSERT_EQ_ARRAYS(expected, supressed);
+
+  auto not_supressed = signals.GetFilteredSignals(false, None, None);
+  expected = {2};
+  ASSERT_EQ_ARRAYS(expected, not_supressed);
+
+  auto stopped = signals.GetFilteredSignals(None, true, None);
+  expected = {2, 8};
+  ASSERT_EQ_ARRAYS(expected, stopped);
+
+  auto not_stopped = signals.GetFilteredSignals(None, false, None);

[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene marked 3 inline comments as done.
eugene added a comment.

Addressing review comments.




Comment at: unittests/Signals/UnixSignalsTest.cpp:43
+
+#define ASSERT_EQ_ARRAYS(expected, observed)   
\
+  AssertEqArrays((expected), (observed), __FILE__, __LINE__);

labath wrote:
> This (and the function) should probably have an EXPECT_.. prefix instead, as 
> it does not abort the evaluation of the function it is in (like other 
> ASSERT_*** macros).
This function calls ASSERT_EQ so it does abort evaluation.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [lldb] r297096 - Remove dependency from FileSpec to ArchSpec.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 17:42:44 2017
New Revision: 297096

URL: http://llvm.org/viewvc/llvm-project?rev=297096&view=rev
Log:
Remove dependency from FileSpec to ArchSpec.

All it really needs is the llvm::Triple, so make FileSpec take
the Triple directly instead of the ArchSpec.

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297096&r1=297095&r2=297096&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Mar  6 17:42:44 2017
@@ -21,6 +21,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
 
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/FormatVariadic.h"
 
 namespace lldb_private {
@@ -84,7 +85,8 @@ public:
   explicit FileSpec(llvm::StringRef path, bool resolve_path,
 PathSyntax syntax = ePathSyntaxHostNative);
 
-  explicit FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch);
+  explicit FileSpec(llvm::StringRef path, bool resolve_path,
+const llvm::Triple &Triple);
 
   //--
   /// Copy constructor
@@ -520,7 +522,8 @@ public:
   void SetFile(llvm::StringRef path, bool resolve_path,
PathSyntax syntax = ePathSyntaxHostNative);
 
-  void SetFile(llvm::StringRef path, bool resolve_path, ArchSpec arch);
+  void SetFile(llvm::StringRef path, bool resolve_path,
+   const llvm::Triple &Triple);
 
   bool IsResolved() const { return m_is_resolved; }
 

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297096&r1=297095&r2=297096&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar  6 17:42:44 2017
@@ -25,7 +25,6 @@
 #include 
 #endif
 
-#include "lldb/Core/ArchSpec.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/CleanUp.h"
@@ -284,10 +283,10 @@ FileSpec::FileSpec(llvm::StringRef path,
   SetFile(path, resolve_path, syntax);
 }
 
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch)
-: FileSpec{path, resolve_path, arch.GetTriple().isOSWindows()
-   ? ePathSyntaxWindows
-   : ePathSyntaxPosix} {}
+FileSpec::FileSpec(llvm::StringRef path, bool resolve_path,
+   const llvm::Triple &Triple)
+: FileSpec{path, resolve_path,
+   Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix} {}
 
 //--
 // Copy constructor
@@ -374,10 +373,10 @@ void FileSpec::SetFile(llvm::StringRef p
: resolve_path_ref.substr(filename_begin));
 }
 
-void FileSpec::SetFile(llvm::StringRef path, bool resolve, ArchSpec arch) {
-  return SetFile(path, resolve, arch.GetTriple().isOSWindows()
-? ePathSyntaxWindows
-: ePathSyntaxPosix);
+void FileSpec::SetFile(llvm::StringRef path, bool resolve,
+   const llvm::Triple &Triple) {
+  return SetFile(path, resolve,
+ Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix);
 }
 
 //--

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=297096&r1=297095&r2=297096&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Mon Mar  6 17:42:44 2017
@@ -1660,7 +1660,7 @@ bool GDBRemoteCommunicationClient::GetWo
   return false;
 std::string cwd;
 response.GetHexByteString(cwd);
-working_dir.SetFile(cwd, false, GetHostArchitecture());
+working_dir.SetFile(cwd, false, GetHostArchitecture().GetTriple());
 return !cwd.empty();
   }
   return false;
@@ -3191,7 +3191,7 @@ bool GDBRemoteCommunicationClient::GetMo
   StringExtractor extractor(value);
   std::string path;
   extractor.GetHexByteString(path);
-  module_spec.GetFileSpec() = FileSpec(path, false, arch_spec);
+  module_spec.GetFileSpec() = FileSpec(path, false, arch_spec.GetTripl

[Lldb-commits] [PATCH] D30622: Remove FileSpec::ReadFileContents

2017-03-06 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297095: Remove FileSpec::ReadFileContents. (authored by 
zturner).

Changed prior to commit:
  https://reviews.llvm.org/D30622?vs=90617&id=90759#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30622

Files:
  lldb/trunk/include/lldb/Host/FileSpec.h
  lldb/trunk/include/lldb/Utility/DataBufferLLVM.h
  lldb/trunk/source/API/SBSection.cpp
  lldb/trunk/source/Commands/CommandObjectMemory.cpp
  lldb/trunk/source/Core/SourceManager.cpp
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/trunk/source/Symbol/ObjectFile.cpp
  lldb/trunk/source/Utility/DataBufferLLVM.cpp
  lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/trunk/include/lldb/Utility/DataBufferLLVM.h
===
--- lldb/trunk/include/lldb/Utility/DataBufferLLVM.h
+++ lldb/trunk/include/lldb/Utility/DataBufferLLVM.h
@@ -26,12 +26,17 @@
   ~DataBufferLLVM();
 
   static std::shared_ptr
-  CreateFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset);
+  CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset, bool Private = false);
+
+  static std::shared_ptr
+  CreateFromPath(const llvm::Twine &Path, bool NullTerminate = false, bool Private = false);
 
   uint8_t *GetBytes() override;
   const uint8_t *GetBytes() const override;
   lldb::offset_t GetByteSize() const override;
 
+  char *GetChars() { return reinterpret_cast(GetBytes()); }
+
 private:
   /// \brief Construct a DataBufferLLVM from \p Buffer.  \p Buffer must be a
   /// valid pointer.
Index: lldb/trunk/include/lldb/Host/FileSpec.h
===
--- lldb/trunk/include/lldb/Host/FileSpec.h
+++ lldb/trunk/include/lldb/Host/FileSpec.h
@@ -498,55 +498,6 @@
   size_t MemorySize() const;
 
   //--
-  /// Read part of, or the entire contents of, a file into a heap based data
-  /// buffer.
-  ///
-  /// Returns a shared pointer to a data buffer that contains all or
-  /// part of the contents of a file. The data copies into a heap based
-  /// buffer that lives in the DataBuffer shared pointer object returned.
-  /// The data that is cached will start \a offset bytes into the
-  /// file, and \a length bytes will be mapped. If \a length is
-  /// greater than the number of bytes available in the file starting
-  /// at \a offset, the number of bytes will be appropriately
-  /// truncated. The final number of bytes that get mapped can be
-  /// verified using the DataBuffer::GetByteSize() function.
-  ///
-  /// @param[in] offset
-  /// The offset in bytes from the beginning of the file where
-  /// memory mapping should begin.
-  ///
-  /// @param[in] length
-  /// The size in bytes that should be mapped starting \a offset
-  /// bytes into the file. If \a length is \c SIZE_MAX, map
-  /// as many bytes as possible.
-  ///
-  /// @return
-  /// A shared pointer to the memory mapped data. This shared
-  /// pointer can contain a nullptr DataBuffer pointer, so the contained
-  /// pointer must be checked prior to using it.
-  //--
-  lldb::DataBufferSP ReadFileContents(off_t offset = 0,
-  size_t length = SIZE_MAX,
-  Error *error_ptr = nullptr) const;
-
-  size_t ReadFileContents(off_t file_offset, void *dst, size_t dst_len,
-  Error *error_ptr) const;
-
-  //--
-  /// Read the entire contents of a file as data that can be used
-  /// as a C string.
-  ///
-  /// Read the entire contents of a file and ensure that the data
-  /// is NULL terminated so it can be used as a C string.
-  ///
-  /// @return
-  /// A shared pointer to the data. This shared pointer can
-  /// contain a nullptr DataBuffer pointer, so the contained pointer
-  /// must be checked prior to using it.
-  //--
-  lldb::DataBufferSP ReadFileContentsAsCString(E

[Lldb-commits] [lldb] r297095 - Remove FileSpec::ReadFileContents.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 17:42:14 2017
New Revision: 297095

URL: http://llvm.org/viewvc/llvm-project?rev=297095&view=rev
Log:
Remove FileSpec::ReadFileContents.

This functionality is subsumed by DataBufferLLVM, which is
also more efficient since it will try to mmap.  However, we
don't yet support mmaping writable private sections, and in
some cases we were using ReadFileContents and then modifying
the buffer.  To address that I've added a flag to the
DataBufferLLVM methods that allow you to map privately, which
disables the mmaping path entirely.  Eventually we should teach
DataBufferLLVM to use mmap with writable private, but that is
orthogonal to this effort.

Differential Revision: https://reviews.llvm.org/D30622

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/include/lldb/Utility/DataBufferLLVM.h
lldb/trunk/source/API/SBSection.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/SourceManager.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp

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

lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Utility/DataBufferLLVM.cpp
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297095&r1=297094&r2=297095&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Mar  6 17:42:14 2017
@@ -498,55 +498,6 @@ public:
   size_t MemorySize() const;
 
   //--
-  /// Read part of, or the entire contents of, a file into a heap based data
-  /// buffer.
-  ///
-  /// Returns a shared pointer to a data buffer that contains all or
-  /// part of the contents of a file. The data copies into a heap based
-  /// buffer that lives in the DataBuffer shared pointer object returned.
-  /// The data that is cached will start \a offset bytes into the
-  /// file, and \a length bytes will be mapped. If \a length is
-  /// greater than the number of bytes available in the file starting
-  /// at \a offset, the number of bytes will be appropriately
-  /// truncated. The final number of bytes that get mapped can be
-  /// verified using the DataBuffer::GetByteSize() function.
-  ///
-  /// @param[in] offset
-  /// The offset in bytes from the beginning of the file where
-  /// memory mapping should begin.
-  ///
-  /// @param[in] length
-  /// The size in bytes that should be mapped starting \a offset
-  /// bytes into the file. If \a length is \c SIZE_MAX, map
-  /// as many bytes as possible.
-  ///
-  /// @return
-  /// A shared pointer to the memory mapped data. This shared
-  /// pointer can contain a nullptr DataBuffer pointer, so the contained
-  /// pointer must be checked prior to using it.
-  //--
-  lldb::DataBufferSP ReadFileContents(off_t offset = 0,
-  size_t length = SIZE_MAX,
-  Error *error_ptr = nullptr) const;
-
-  size_t ReadFileContents(off_t file_offset, void *dst, size_t dst_len,
-  Error *error_ptr) const;
-
-  //--
-  /// Read the entire contents of a file as data that can be used
-  /// as a C string.
-  ///
-  /// Read the entire contents of a file and ensure that the data
-  /// is NULL terminated so it can be used as a C string.
-  ///
-  /// @return
-  /// A shared pointer to the data. This shared pointer can
-  /// contain a nullptr DataBuffer pointer, so the contained pointer
-  /// must be checked prior to using it.
-  //--
-  lldb::DataBufferSP ReadFileContentsAsCString(Error *error_ptr = nullptr);
-
-  //--
   /// Normalize a pathname by collapsing redundant separators and
   /// up-level references.
   //

[Lldb-commits] [lldb] r297102 - Add missing include in FileSpec.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 17:52:57 2017
New Revision: 297102

URL: http://llvm.org/viewvc/llvm-project?rev=297102&view=rev
Log:
Add missing include in FileSpec.

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

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297102&r1=297101&r2=297102&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar  6 17:52:57 2017
@@ -25,6 +25,7 @@
 #include 
 #endif
 
+#include "lldb/Core/StringList.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/CleanUp.h"


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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Very close. Can we try to get UpdateAutomaticSignalFiltering out of 
lldb_private::Process as my inline comments suggest? It would be cleaner and I 
am not sure we actually need Process::UpdateAutomaticSignalFiltering() for all 
processes.




Comment at: include/lldb/Target/Process.h:3148
 
+  virtual Error UpdateAutomaticSignalFiltering();
+

Can we remove this and only have it in ProcessGDBRemote? Then we just call it 
when we need to in ProcessGDBRemote? This seems like something that 
ProcessGDBRemote should take care of without having Process knowing about it. 
Seems like a adding a call to 
ProcessGDBRemote::UpdateAutomaticSignalFiltering() can be done in 
ProcessGDBRemote::WillResume() and ProcessGDBRemote::DidLaunch() might do the 
trick? It seems like each process plug-in will have different needs regarding 
signals.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h:401
+  Error UpdateAutomaticSignalFiltering() override;
+
 private:

Remove the override if we handle this in UpdateAutomaticSignalFiltering in 
specific to ProcessGDBRemote only?


https://reviews.llvm.org/D30520



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


[Lldb-commits] [lldb] r297104 - cleanup.

2017-03-06 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Mar  6 18:00:35 2017
New Revision: 297104

URL: http://llvm.org/viewvc/llvm-project?rev=297104&view=rev
Log:
cleanup.

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=297104&r1=297103&r2=297104&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Mar  6 18:00:35 2017
@@ -395,7 +395,6 @@
2689002D13353E0400698AC0 /* AddressResolverFileLine.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034211752C720086C050 /* 
AddressResolverFileLine.cpp */; };
2689002E13353E0400698AC0 /* AddressResolverName.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9AC7034411752C790086C050 /* 
AddressResolverName.cpp */; };
2689002F13353E0400698AC0 /* ArchSpec.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */; };
-   2689003013353E0400698AC0 /* Baton.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26A0604811A5D03C00F75969 /* Baton.cpp */; };
2689003113353E0400698AC0 /* Broadcaster.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */; 
};
2689003213353E0400698AC0 /* Communication.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E6E10F1B85900F91463 /* Communication.cpp 
*/; };
2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; };
@@ -419,7 +418,6 @@
2689004F13353E0400698AC0 /* StreamFile.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7E9210F1B85900F91463 /* StreamFile.cpp */; };
2689005113353E0400698AC0 /* StringList.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 9A35765F116E76B900E8ED2F /* StringList.cpp */; };
2689005213353E0400698AC0 /* Timer.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E9610F1B85900F91463 /* Timer.cpp */; };
-   2689005313353E0400698AC0 /* UserID.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E9810F1B85900F91463 /* UserID.cpp */; };
2689005413353E0400698AC0 /* UserSettingsController.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A4633DC11F65D9A00955CE1 /* 
UserSettingsController.cpp */; };
2689005613353E0400698AC0 /* Value.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E9910F1B85900F91463 /* Value.cpp */; };
2689005713353E0400698AC0 /* ValueObject.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E9A10F1B85900F91463 /* ValueObject.cpp */; 
};
@@ -428,7 +426,6 @@
2689005A13353E0400698AC0 /* ValueObjectList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E9C10F1B85900F91463 /* ValueObjectList.cpp 
*/; };
2689005B13353E0400698AC0 /* ValueObjectRegister.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 264334381110F63100CDB6C6 /* 
ValueObjectRegister.cpp */; };
2689005C13353E0400698AC0 /* ValueObjectVariable.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 26BC7E9D10F1B85900F91463 /* 
ValueObjectVariable.cpp */; };
-   2689005D13353E0400698AC0 /* VMRange.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E9E10F1B85900F91463 /* VMRange.cpp */; };
2689005E13353E0E00698AC0 /* ClangASTSource.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49D7072811B5AD11001AD875 /* ClangASTSource.cpp 
*/; };
2689005F13353E0E00698AC0 /* ClangFunctionCaller.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 4C98D3DA118FB96F00E575D0 /* 
ClangFunctionCaller.cpp */; };
2689006013353E0E00698AC0 /* ClangExpressionDeclMap.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 49F1A74511B3388F003ED505 /* 
ClangExpressionDeclMap.cpp */; };
@@ -663,7 +660,6 @@
26F4A21C13FBA31A0064B613 /* ThreadMemory.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26F4A21A13FBA31A0064B613 /* ThreadMemory.cpp */; 
};
26F5C27710F3D9E4009D5894 /* Driver.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26F5C27310F3D9E4009D5894 /* Driver.cpp */; };
26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */; 
};
-   26F73062139D8FDB00FD51C7 /* History.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26F73061139D8FDB00FD51C7 /* History.cpp */; };
26FFC19914FC072100087D58 /* AuxVector.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26FFC19314FC072100087D58 /* AuxVector.cpp */; };
26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26FF

Re: [Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Jim Ingham via lldb-commits

> On Mar 6, 2017, at 4:10 PM, Greg Clayton via Phabricator 
>  wrote:
> 
> clayborg requested changes to this revision.
> clayborg added a comment.
> This revision now requires changes to proceed.
> 
> Very close. Can we try to get UpdateAutomaticSignalFiltering out of 
> lldb_private::Process as my inline comments suggest? It would be cleaner and 
> I am not sure we actually need Process::UpdateAutomaticSignalFiltering() for 
> all processes.
> 
> 
> 
> 
> Comment at: include/lldb/Target/Process.h:3148
> 
> +  virtual Error UpdateAutomaticSignalFiltering();
> +
> 
> Can we remove this and only have it in ProcessGDBRemote? Then we just call it 
> when we need to in ProcessGDBRemote? This seems like something that 
> ProcessGDBRemote should take care of without having Process knowing about it. 
> Seems like a adding a call to 
> ProcessGDBRemote::UpdateAutomaticSignalFiltering() can be done in 
> ProcessGDBRemote::WillResume() and ProcessGDBRemote::DidLaunch() might do the 
> trick? It seems like each process plug-in will have different needs regarding 
> signals.

I disagree.  The different processes are at this point more about transport 
than about the platform details.  That indicates to me that it's more likely 
that different process implementations will have different ways of implementing 
signal filtering, but the input of which signals will be filtered will be the 
same.  Plus for each process the place where you would implement turning on and 
changing the filtering are the same.  So it makes more sense to have the part 
that says "go do this filtering" all be in common code, and the particular 
plugins implement how to do this.

Jim


> 
> 
> 
> Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h:401
> +  Error UpdateAutomaticSignalFiltering() override;
> +
> private:
> 
> Remove the override if we handle this in UpdateAutomaticSignalFiltering in 
> specific to ProcessGDBRemote only?
> 
> 
> https://reviews.llvm.org/D30520
> 
> 
> 

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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene added inline comments.



Comment at: include/lldb/Target/Process.h:3148
 
+  virtual Error UpdateAutomaticSignalFiltering();
+

clayborg wrote:
> Can we remove this and only have it in ProcessGDBRemote? Then we just call it 
> when we need to in ProcessGDBRemote? This seems like something that 
> ProcessGDBRemote should take care of without having Process knowing about it. 
> Seems like a adding a call to 
> ProcessGDBRemote::UpdateAutomaticSignalFiltering() can be done in 
> ProcessGDBRemote::WillResume() and ProcessGDBRemote::DidLaunch() might do the 
> trick? It seems like each process plug-in will have different needs regarding 
> signals.
I 100% agree with you here. UpdateAutomaticSignalFiltering() is very much 
implementation specific and it shouldn't be in the  lldb_private::Process.  And 
it was how I originally implemented it in older revision. 

But Jim felt differently and I trusted his judgement given that he has vastly 
more experience working with LLDB codebase.




https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Jim Ingham said (in email):

> I disagree.  The different processes are at this point more about transport 
> than about the platform details.  That indicates to me that it's more likely 
> that different process implementations will have different ways of 
> implementing signal filtering, but the input of which signals will be 
> filtered will be the same.  Plus for each process the place where you would 
> implement turning on and changing the filtering are the same.  So it makes 
> more sense to have the part that says "go do this filtering" all be in common 
> code, and the particular plugins implement how to do this.

That is fine. Seems like the UnixSignals class should be coordinating this 
instead of doing it manually in the process? Seems like the UnixSignals class 
should have guts here and call through to the 
Process::UpdateAutomaticSignalFiltering() only if needed?


https://reviews.llvm.org/D30520



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


Re: [Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Jim Ingham via lldb-commits
The UnixSignals class produces the array of signal numbers that it knows it 
doesn't want to hear about.  But it has no idea how any particular Process 
plugin would implement ignoring those symbols.  So that part belongs to the 
Process plugin.  I suggested in a previous comment also adding a 
UnixSignals::NeedsUpdating, UnixSignals::SetNeedsUpdating, it seemed to me that 
that bit should also be managed by UnixSignals.  But nobody else thought that 
was particularly compelling.

Jim

> On Mar 6, 2017, at 4:56 PM, Greg Clayton via Phabricator 
>  wrote:
> 
> clayborg added a comment.
> 
> Jim Ingham said (in email):
> 
>> I disagree.  The different processes are at this point more about transport 
>> than about the platform details.  That indicates to me that it's more likely 
>> that different process implementations will have different ways of 
>> implementing signal filtering, but the input of which signals will be 
>> filtered will be the same.  Plus for each process the place where you would 
>> implement turning on and changing the filtering are the same.  So it makes 
>> more sense to have the part that says "go do this filtering" all be in 
>> common code, and the particular plugins implement how to do this.
> 
> That is fine. Seems like the UnixSignals class should be coordinating this 
> instead of doing it manually in the process? Seems like the UnixSignals class 
> should have guts here and call through to the 
> Process::UpdateAutomaticSignalFiltering() only if needed?
> 
> 
> https://reviews.llvm.org/D30520
> 
> 
> 

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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene added a comment.

UnixSignals is a nice self contained class that already does 99% of the work 
(see UnixSignals::GetFilteredSignals). I don't think we should have it call 
anybody. 
Only process knows when it is the right time to send actual QPassSignals 
packet, there is not need to somehow push this knowledge into UnixSignals.

Let's just decide if UpdateAutomaticSignalFiltering() is specific enough to 
live in GDBProcess or it's generic enough to live in the base process. I'm fine 
either way.


https://reviews.llvm.org/D30520



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


Re: [Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Jim Ingham via lldb-commits
I like it in the base class and Greg was okay with that too.  So let's leave 
that where it is.

The only bit of this behavior that could be moved into UnixSignals as it seemed 
to me was the handling of "needs updating".  I was mostly proposing that 
because then you can already pass the UnixSignals into the communication client 
to test that the signals get suppressed, so if the "needs updating" was in 
UnixSignals you could test this part in the same way.

So I'm not pushing hard on this change.

Jim


> On Mar 6, 2017, at 5:09 PM, Eugene Zemtsov via Phabricator 
>  wrote:
> 
> eugene added a comment.
> 
> UnixSignals is a nice self contained class that already does 99% of the work 
> (see UnixSignals::GetFilteredSignals). I don't think we should have it call 
> anybody. 
> Only process knows when it is the right time to send actual QPassSignals 
> packet, there is not need to somehow push this knowledge into UnixSignals.
> 
> Let's just decide if UpdateAutomaticSignalFiltering() is specific enough to 
> live in GDBProcess or it's generic enough to live in the base process. I'm 
> fine either way.
> 
> 
> https://reviews.llvm.org/D30520
> 
> 
> 

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


Re: [Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Eugene Zemtsov via lldb-commits
UnixSignals::NeedsUpdating() method suggests that there is always at most
one observer of changes in UnixSignals, the guys who clear the flag. Even
though it might be the case now, it still feels like a bomb waiting to
explode when another observer starts calling UnixSignals::ResetNeedsUpdating().
I wouldn't want to introduce this limitation unless I absolutely have to.

On Mon, Mar 6, 2017 at 5:09 PM, Jim Ingham  wrote:

> I like it in the base class and Greg was okay with that too.  So let's
> leave that where it is.
>
> The only bit of this behavior that could be moved into UnixSignals as it
> seemed to me was the handling of "needs updating".  I was mostly proposing
> that because then you can already pass the UnixSignals into the
> communication client to test that the signals get suppressed, so if the
> "needs updating" was in UnixSignals you could test this part in the same
> way.
>
> So I'm not pushing hard on this change.
>
> Jim
>
>
> > On Mar 6, 2017, at 5:09 PM, Eugene Zemtsov via Phabricator <
> revi...@reviews.llvm.org> wrote:
> >
> > eugene added a comment.
> >
> > UnixSignals is a nice self contained class that already does 99% of the
> work (see UnixSignals::GetFilteredSignals). I don't think we should have
> it call anybody.
> > Only process knows when it is the right time to send actual QPassSignals
> packet, there is not need to somehow push this knowledge into UnixSignals.
> >
> > Let's just decide if UpdateAutomaticSignalFiltering() is specific
> enough to live in GDBProcess or it's generic enough to live in the base
> process. I'm fine either way.
> >
> >
> > https://reviews.llvm.org/D30520
> >
> >
> >
>
>


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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

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

Ok, sounds like everyone thought through the solution. Lets start with this and 
we can iterate if needed.


https://reviews.llvm.org/D30520



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


Re: [Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-06 Thread Jim Ingham via lldb-commits
Yes formally that seems problematic.  It wouldn't be a problem in practice 
because you should only call ResetNeedsUpdating in 
UpdateAutomaticSignalFiltering, and the only place where 
UpdateAutomaticSignalFiltering should be called is when Launching or Resuming, 
and you can't call either of these latter calls concurrently.  So you'd just 
have to obey those rules, and make sure you couldn't change the state of the 
UnixSignals between computing the list of ignored signals and resetting 
NeedsUpdating, and you'd be fine.

Might be ugly to figure out how you would enforce this arrangement, however.

Jim

> On Mar 6, 2017, at 5:19 PM, Eugene Zemtsov  wrote:
> 
> UnixSignals::NeedsUpdating() method suggests that there is always at most one 
> observer of changes in UnixSignals, the guys who clear the flag. Even though 
> it might be the case now, it still feels like a bomb waiting to explode when 
> another observer starts calling UnixSignals::ResetNeedsUpdating(). I wouldn't 
> want to introduce this limitation unless I absolutely have to.
> 
> On Mon, Mar 6, 2017 at 5:09 PM, Jim Ingham  wrote:
> I like it in the base class and Greg was okay with that too.  So let's leave 
> that where it is.
> 
> The only bit of this behavior that could be moved into UnixSignals as it 
> seemed to me was the handling of "needs updating".  I was mostly proposing 
> that because then you can already pass the UnixSignals into the communication 
> client to test that the signals get suppressed, so if the "needs updating" 
> was in UnixSignals you could test this part in the same way.
> 
> So I'm not pushing hard on this change.
> 
> Jim
> 
> 
> > On Mar 6, 2017, at 5:09 PM, Eugene Zemtsov via Phabricator 
> >  wrote:
> >
> > eugene added a comment.
> >
> > UnixSignals is a nice self contained class that already does 99% of the 
> > work (see UnixSignals::GetFilteredSignals). I don't think we should have it 
> > call anybody.
> > Only process knows when it is the right time to send actual QPassSignals 
> > packet, there is not need to somehow push this knowledge into UnixSignals.
> >
> > Let's just decide if UpdateAutomaticSignalFiltering() is specific enough to 
> > live in GDBProcess or it's generic enough to live in the base process. I'm 
> > fine either way.
> >
> >
> > https://reviews.llvm.org/D30520
> >
> >
> >
> 
> 
> 
> 
> -- 
> Thanks,
> Eugene Zemtsov.

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


[Lldb-commits] Buildbot numbers for the week of 02/19/2017 - 02/25/2017

2017-03-06 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the week of 02/19/2017 - 02/25/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername | was_red
+-
 sanitizer-ppc64be-linux| 81:13:41
 clang-ppc64be-linux-multistage | 80:20:26
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 45:57:09
 clang-ppc64be-linux-lnt| 39:21:32
 sanitizer-x86_64-linux-bootstrap   | 37:38:21
 sanitizer-x86_64-linux-fast| 35:13:52
 clang-ppc64be-linux| 21:00:45
 lldb-x86_64-ubuntu-14.04-buildserver   | 18:54:19
 llvm-mips-linux| 17:02:13
 sanitizer-x86_64-linux | 15:46:57
 clang-lld-x86_64-2stage| 14:26:21
 sanitizer-ppc64le-linux| 13:38:17
 clang-with-thin-lto-ubuntu | 13:16:20
 clang-with-lto-ubuntu  | 13:08:11
 clang-cmake-armv7-a15  | 10:31:05
 lldb-windows7-android  | 10:11:50
 clang-cmake-thumbv7-a15| 09:49:33
 lld-x86_64-win7| 09:31:34
 clang-s390x-linux  | 09:04:07
 clang-cmake-mips   | 08:12:53
 clang-cmake-aarch64-lld| 07:56:15
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 06:58:49
 clang-cuda-build   | 06:56:26
 polly-arm-linux| 06:55:12
 clang-hexagon-elf  | 06:46:36
 polly-amd64-linux  | 06:33:29
 clang-cmake-mipsel | 05:16:43
 clang-atom-d525-fedora-rel | 05:10:06
 clang-ppc64le-linux-multistage | 05:09:03
 clang-x86_64-linux-selfhost-modules-2  | 04:55:19
 clang-x86_64-linux-selfhost-modules| 04:54:18
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 04:49:39
 clang-cmake-aarch64-42vma  | 04:30:25
 clang-3stage-ubuntu| 04:26:16
 clang-cmake-thumbv7-a15-full-sh| 04:10:34
 clang-cmake-armv7-a15-selfhost | 03:16:24
 libcxx-libcxxabi-libunwind-arm-linux   | 03:06:32
 clang-ppc64le-linux| 02:52:43
 clang-cmake-aarch64-full   | 02:46:44
 clang-x64-ninja-win7   | 02:37:46
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan  | 02:35:02
 clang-cmake-armv7-a15-full | 02:20:56
 perf-x86_64-penryn-O3-polly-unprofitable   | 02:15:11
 llvm-hexagon-elf   | 02:14:11
 clang-cmake-aarch64-quick  | 02:12:33
 clang-cmake-aarch64-39vma  | 02:10:08
 sanitizer-x86_64-linux-autoconf| 01:51:50
 sanitizer-x86_64-linux-fuzzer  | 01:51:45
 lld-x86_64-darwin13| 01:33:26
 lldb-amd64-ninja-netbsd7   | 01:28:47
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 01:23:06
 libcxx-libcxxabi-libunwind-aarch64-linux   | 01:19:49
 lldb-x86_64-darwin-13.4| 01:17:49
 lld-x86_64-freebsd | 01:06:22
 lldb-amd64-ninja-freebsd11 | 01:01:49
 perf-x86_64-penryn-O3-polly-parallel-fast  | 00:48:38
 lld-sphinx-docs| 00:48:13
 lldb-x86_64-ubuntu-14.04-android   | 00:43:44
 lldb-x86_64-ubuntu-14.04-cmake | 00:38:03
 clang-tools-sphinx-docs  

[Lldb-commits] Buildbot numbers for the week of 02/26/2017 - 03/04/2017

2017-03-06 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the last week of 02/26/2017 -
03/04/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername |  was_red
+--
 sanitizer-windows  | 130:46:38
 clang-x86-windows-msvc2015 | 78:20:10
 clang-ppc64le-linux-lnt| 75:51:23
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 46:50:08
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 31:29:46
 clang-x86_64-linux-selfhost-modules| 30:04:05
 clang-x86_64-linux-selfhost-modules-2  | 29:51:20
 clang-ppc64le-linux-multistage | 29:05:06
 clang-with-thin-lto-ubuntu | 28:49:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z | 28:06:33
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11 | 27:43:03
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14 | 27:42:46
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03 | 27:30:39
 lldb-windows7-android  | 25:15:40
 perf-x86_64-penryn-O3-polly-parallel-fast  | 25:10:43
 sanitizer-x86_64-linux-autoconf| 22:55:44
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 22:04:59
 clang-3stage-ubuntu| 21:50:36
 sanitizer-x86_64-linux-fast| 20:45:55
 sanitizer-x86_64-linux-bootstrap   | 19:35:51
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 16:35:34
 sanitizer-x86_64-linux | 11:01:32
 perf-x86_64-penryn-O3  | 09:10:37
 perf-x86_64-penryn-O3-polly| 09:08:34
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 08:27:29
 clang-cmake-armv7-a15-selfhost-neon| 07:29:12
 clang-cmake-armv7-a15-selfhost | 07:13:13
 sanitizer-ppc64le-linux| 06:09:17
 clang-cmake-aarch64-full   | 05:57:24
 polly-arm-linux| 05:36:38
 clang-ppc64be-linux-multistage | 05:30:26
 clang-cmake-thumbv7-a15-full-sh| 05:26:26
 sanitizer-ppc64be-linux| 05:23:18
 lldb-x86_64-ubuntu-14.04-buildserver   | 05:20:57
 polly-amd64-linux  | 05:13:48
 clang-cmake-aarch64-lld| 05:12:42
 llvm-mips-linux| 04:57:44
 clang-cmake-armv7-a15  | 04:40:30
 clang-with-lto-ubuntu  | 04:30:02
 clang-cmake-aarch64-39vma  | 04:24:12
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 04:19:50
 clang-cmake-mips   | 03:54:05
 perf-x86_64-penryn-O3-polly-unprofitable   | 03:51:47
 clang-ppc64be-linux-lnt| 03:15:31
 lldb-x86_64-ubuntu-14.04-android   | 03:15:22
 llvm-hexagon-elf   | 03:14:48
 clang-lld-x86_64-2stage| 03:05:52
 clang-x86_64-debian-fast   | 03:01:22
 clang-ppc64be-linux| 02:58:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 02:51:00
 clang-cmake-thumbv7-a15| 02:42:32
 clang-native-arm-lnt   | 02:37:02
 clang-cmake-armv7-a15-full | 02:11:20
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 02:09:38
 clang-s390x-linux  | 02:05:24
 clang-cmake-aarch64-42vma  | 02:03:49
 lldb-amd64-ninja-freebsd11 | 02:01:07
 clang-atom-d525-fedora-rel | 01:57:43
 clang-hexagon-elf  | 01:56:48
 sanitizer-x86_64-linu

[Lldb-commits] [lldb] r297116 - Use LLVM for all stat-related functionality.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 21:43:17 2017
New Revision: 297116

URL: http://llvm.org/viewvc/llvm-project?rev=297116&view=rev
Log:
Use LLVM for all stat-related functionality.

This deletes LLDB's FileType enumeration and replaces all
users, and all calls to functions that check whether a file
exists etc with corresponding calls to LLVM.

Differential Revision: https://reviews.llvm.org/D30624

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/API/SBPlatform.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/FileSpecList.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/source/Host/macosx/Symbols.cpp
lldb/trunk/source/Host/posix/FileSystem.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/ModuleCache.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/TargetList.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297116&r1=297115&r2=297116&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Mar  6 21:43:17 2017
@@ -22,6 +22,7 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/Triple.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatVariadic.h"
 
 namespace lldb_private {
@@ -46,17 +47,6 @@ namespace lldb_private {
 //--
 class FileSpec {
 public:
-  typedef enum FileType {
-eFileTypeInvalid = -1,
-eFileTypeUnknown = 0,
-eFileTypeDirectory,
-eFileTypePipe,
-eFileTypeRegular,
-eFileTypeSocket,
-eFileTypeSymbolicLink,
-eFileTypeOther
-  } FileType;
-
   enum PathSyntax {
 ePathSyntaxPosix,
 ePathSyntaxWindows,
@@ -455,8 +445,6 @@ public:
   //--
   ConstString GetFileNameStrippingExtension() const;
 
-  FileType GetFileType() const;
-
   //--
   /// Return the current permissions of the path.
   ///
@@ -471,20 +459,6 @@ public:
   //--
   uint32_t GetPermissions() const;
 
-  bool IsDirectory() const {
-return GetFileType() == FileSpec::eFileTypeDirectory;
-  }
-
-  bool IsPipe() const { return GetFileType() == FileSpec::eFileTypePipe; }
-
-  bool IsRegularFile() const {
-return GetFileType() == FileSpec::eFileTypeRegular;
-  }
-
-  bool IsSocket() const { return GetFileType() == FileSpec::eFileTypeSocket; }
-
-  bool IsSymbolicLink() const;
-
   //--
   /// Get the memory cost of this object.
   ///
@@ -596,7 +570,7 @@ public:
   };
 
   typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
-  void *baton, FileType file_type, const FileSpec &spec);
+  void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec);
 
   static EnumerateDirectoryResult
   EnumerateDirectory(llvm::StringRef dir_path, bool find_directories,
@@ -604,8 +578,8 @

[Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-06 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297116: Use LLVM for all stat-related functionality. 
(authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D30624?vs=90619&id=90786#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30624

Files:
  lldb/trunk/include/lldb/Host/FileSpec.h
  lldb/trunk/source/API/SBPlatform.cpp
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Core/FileSpecList.cpp
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Core/ModuleList.cpp
  lldb/trunk/source/Core/PluginManager.cpp
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/trunk/source/Host/common/Symbols.cpp
  lldb/trunk/source/Host/macosx/Host.mm
  lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
  lldb/trunk/source/Host/macosx/Symbols.cpp
  lldb/trunk/source/Host/posix/FileSystem.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Target/ModuleCache.cpp
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/source/Target/TargetList.cpp
  llvm/trunk/include/llvm/Support/FileSystem.h
  llvm/trunk/lib/Support/Path.cpp

Index: llvm/trunk/include/llvm/Support/FileSystem.h
===
--- llvm/trunk/include/llvm/Support/FileSystem.h
+++ llvm/trunk/include/llvm/Support/FileSystem.h
@@ -483,6 +483,12 @@
 ///
 /// @param status A file_status previously returned from status.
 /// @returns status.type() == file_type::directory_file.
+file_type get_file_type(const Twine &Path);
+
+/// @brief Does status represent a directory?
+///
+/// @param status A file_status previously returned from status.
+/// @returns status.type() == file_type::directory_file.
 bool is_directory(file_status status);
 
 /// @brief Is path a directory?
Index: llvm/trunk/lib/Support/Path.cpp
===
--- llvm/trunk/lib/Support/Path.cpp
+++ llvm/trunk/lib/Support/Path.cpp
@@ -953,6 +953,13 @@
   return s.type() != file_type::status_error;
 }
 
+file_type get_file_type(const Twine &Path) {
+  file_status st;
+  if (status(Path, st))
+return file_type::status_error;
+  return st.type();
+}
+
 bool is_directory(file_status status) {
   return status.type() == file_type::directory_file;
 }
Index: lldb/trunk/include/lldb/Host/FileSpec.h
===
--- lldb/trunk/include/lldb/Host/FileSpec.h
+++ lldb/trunk/include/lldb/Host/FileSpec.h
@@ -22,6 +22,7 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/Triple.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatVariadic.h"
 
 namespace lldb_private {
@@ -46,17 +47,6 @@
 //--
 class FileSpec {
 public:
-  typedef enum FileType {
-eFileTypeInvalid = -1,
-eFileTypeUnknown = 0,
-eFileTypeDirectory,
-eFileTypePipe,
-eFileTypeRegular,
-eFileTypeSocket,
-eFileTypeSymbolicLink,
-eFileTypeOther
-  } FileType;
-
   enum PathSyntax {
 ePathSyntaxPosix,
 ePathSyntaxWindows,
@@ -455,8 +445,6 @@
   //--
   ConstString GetFileNameStrippingExtension() const;
 
-  FileType GetFileType() const;
-
   //--
   /// Return the current permissions of the path.
   ///
@@ -471,20 +459,6 @@
   //--
   uint32_t GetPermissions() const;
 
-  bool IsDirectory

[Lldb-commits] [lldb] r297117 - Fix linux build.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 21:58:59 2017
New Revision: 297117

URL: http://llvm.org/viewvc/llvm-project?rev=297117&view=rev
Log:
Fix linux build.

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

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297117&r1=297116&r2=297117&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar  6 21:58:59 2017
@@ -905,13 +905,13 @@ FileSpec::ForEachItemInDirectory(llvm::S
   ft = file_type::fifo_file;
   break;
 case DT_CHR:
-  ft = file_type::character_device;
+  ft = file_type::character_file;
   break;
 case DT_DIR:
   ft = file_type::directory_file;
   break;
 case DT_BLK:
-  ft = file_type::block_device;
+  ft = file_type::block_file;
   break;
 case DT_REG:
   ft = file_type::regular_file;


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


[Lldb-commits] [lldb] r297119 - Remove FileSpec dependency on FileSystem.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 22:58:06 2017
New Revision: 297119

URL: http://llvm.org/viewvc/llvm-project?rev=297119&view=rev
Log:
Remove FileSpec dependency on FileSystem.

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

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297119&r1=297118&r2=297119&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar  6 22:58:06 2017
@@ -27,7 +27,6 @@
 
 #include "lldb/Core/StringList.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
@@ -45,10 +44,18 @@ using namespace lldb_private;
 
 namespace {
 
+static constexpr FileSpec::PathSyntax GetNativeSyntax() {
+#if defined(LLVM_ON_WIN32)
+  return FileSpec::ePathSyntaxWindows;
+#else
+  return FileSpec::ePathSyntaxPosix;
+#endif
+}
+
 bool PathSyntaxIsPosix(FileSpec::PathSyntax syntax) {
   return (syntax == FileSpec::ePathSyntaxPosix ||
   (syntax == FileSpec::ePathSyntaxHostNative &&
-   FileSystem::GetNativePathSyntax() == FileSpec::ePathSyntaxPosix));
+   GetNativeSyntax() == FileSpec::ePathSyntaxPosix));
 }
 
 const char *GetPathSeparators(FileSpec::PathSyntax syntax) {
@@ -84,13 +91,6 @@ void Denormalize(llvm::SmallVectorImplGetPath(resolved_path, sizeof(resolved_path)))
-return FileSystem::Stat(resolved_path, stats_ptr) == 0;
-  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;
@@ -273,7 +273,7 @@ void FileSpec::Resolve(llvm::SmallVector
   }
 }
 
-FileSpec::FileSpec() : m_syntax(FileSystem::GetNativePathSyntax()) {}
+FileSpec::FileSpec() : m_syntax(GetNativeSyntax()) {}
 
 //--
 // Default constructor that can take an optional full path to a
@@ -336,9 +336,7 @@ void FileSpec::SetFile(llvm::StringRef p
   m_filename.Clear();
   m_directory.Clear();
   m_is_resolved = false;
-  m_syntax = (syntax == ePathSyntaxHostNative)
- ? FileSystem::GetNativePathSyntax()
- : syntax;
+  m_syntax = (syntax == ePathSyntaxHostNative) ? GetNativeSyntax() : syntax;
 
   if (pathname.empty())
 return;
@@ -615,16 +613,10 @@ void FileSpec::Dump(Stream *s) const {
 //--
 // Returns true if the file exists.
 //--
-bool FileSpec::Exists() const {
-  struct stat file_stats;
-  return GetFileStats(this, &file_stats);
-}
+bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); }
 
 bool FileSpec::Readable() const {
-  const uint32_t permissions = GetPermissions();
-  if (permissions & eFilePermissionsEveryoneR)
-return true;
-  return false;
+  return GetPermissions() & llvm::sys::fs::perms::all_read;
 }
 
 bool FileSpec::ResolveExecutableLocation() {
@@ -677,19 +669,21 @@ bool FileSpec::ResolvePath() {
 }
 
 uint64_t FileSpec::GetByteSize() const {
-  struct stat file_stats;
-  if (GetFileStats(this, &file_stats))
-return file_stats.st_size;
-  return 0;
+  uint64_t Size = 0;
+  if (llvm::sys::fs::file_size(GetPath(), Size))
+return 0;
+  return Size;
 }
 
 FileSpec::PathSyntax FileSpec::GetPathSyntax() const { return m_syntax; }
 
 uint32_t FileSpec::GetPermissions() const {
-  uint32_t file_permissions = 0;
-  if (*this)
-FileSystem::GetFilePermissions(*this, file_permissions);
-  return file_permissions;
+  namespace fs = llvm::sys::fs;
+  fs::file_status st;
+  if (fs::status(GetPath(), st))
+return fs::perms::perms_not_known;
+
+  return st.permissions();
 }
 
 //--


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


[Lldb-commits] [lldb] r297120 - Fix FreeBSD build.

2017-03-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar  6 22:58:53 2017
New Revision: 297120

URL: http://llvm.org/viewvc/llvm-project?rev=297120&view=rev
Log:
Fix FreeBSD build.

Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=297120&r1=297119&r2=297120&view=diff
==
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Mon Mar  6 
22:58:53 2017
@@ -362,8 +362,9 @@ Error ProcessFreeBSD::DoLaunch(Module *m
   assert(m_monitor == NULL);
 
   FileSpec working_dir = launch_info.GetWorkingDirectory();
-  if (working_dir &&
-  (!working_dir.ResolvePath() || 
!llvm::sys::fs::is_directory(working_dir.GetPath())) {
+  namespace fs = llvm::sys::fs;
+  if (working_dir && (!working_dir.ResolvePath() ||
+  !fs::is_directory(working_dir.GetPath( {
 error.SetErrorStringWithFormat("No such file or directory: %s",
working_dir.GetCString());
 return error;


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