[Lldb-commits] [lldb] r288999 - Fixed DoConnectRemote issues where ProcessKDP wasn't switched over to use the version that needed a StringRef as the URL, and also updated all virtual functions to say

2016-12-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Dec  7 17:51:49 2016
New Revision: 288999

URL: http://llvm.org/viewvc/llvm-project?rev=288999&view=rev
Log:
Fixed DoConnectRemote issues where ProcessKDP wasn't switched over to use the 
version that needed a StringRef as the URL, and also updated all virtual 
functions to say "override" to make sure this doesn't happen again.

Modified:
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=288999&r1=288998&r2=288999&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed Dec  7 
17:51:49 2016
@@ -221,7 +221,7 @@ bool ProcessKDP::GetHostArchitecture(Arc
   return false;
 }
 
-Error ProcessKDP::DoConnectRemote(Stream *strm, const char *remote_url) {
+Error ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) {
   Error error;
 
   // Don't let any JIT happen when doing KDP as we can't allocate
@@ -229,8 +229,8 @@ Error ProcessKDP::DoConnectRemote(Stream
   // already be handling exceptions
   SetCanJIT(false);
 
-  if (remote_url == NULL || remote_url[0] == '\0') {
-error.SetErrorStringWithFormat("invalid connection URL '%s'", remote_url);
+  if (remote_url.empty()) {
+error.SetErrorStringWithFormat("empty connection URL");
 return error;
   }
 
@@ -360,7 +360,8 @@ Error ProcessKDP::DoConnectRemote(Stream
 }
   } else {
 if (error.Success())
-  error.SetErrorStringWithFormat("failed to connect to '%s'", remote_url);
+  error.SetErrorStringWithFormat("failed to connect to '%s'",
+ remote_url.str().c_str());
   }
   if (error.Fail())
 m_comm.Disconnect();

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=288999&r1=288998&r2=288999&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Wed Dec  7 
17:51:49 2016
@@ -56,107 +56,107 @@ public:
   //--
   ProcessKDP(lldb::TargetSP target_sp, lldb::ListenerSP listener);
 
-  virtual ~ProcessKDP();
+  ~ProcessKDP() override;
 
   //--
   // Check if a given Process
   //--
-  virtual bool CanDebug(lldb::TargetSP target_sp,
-bool plugin_specified_by_name);
-
-  virtual lldb_private::CommandObject *GetPluginCommandObject();
+  bool CanDebug(lldb::TargetSP target_sp,
+bool plugin_specified_by_name) override;
+  lldb_private::CommandObject *GetPluginCommandObject() override;
 
   //--
   // Creating a new process, or attaching to an existing one
   //--
-  virtual lldb_private::Error WillLaunch(lldb_private::Module *module);
+  lldb_private::Error WillLaunch(lldb_private::Module *module) override;
 
-  virtual lldb_private::Error
+  lldb_private::Error
   DoLaunch(lldb_private::Module *exe_module,
-   lldb_private::ProcessLaunchInfo &launch_info);
+   lldb_private::ProcessLaunchInfo &launch_info) override;
 
-  virtual lldb_private::Error WillAttachToProcessWithID(lldb::pid_t pid);
+  lldb_private::Error WillAttachToProcessWithID(lldb::pid_t pid) override;
 
-  virtual lldb_private::Error
-  WillAttachToProcessWithName(const char *process_name, bool wait_for_launch);
+  lldb_private::Error
+  WillAttachToProcessWithName(const char *process_name,
+  bool wait_for_launch) override;
 
-  virtual lldb_private::Error DoConnectRemote(lldb_private::Stream *strm,
-  const char *remote_url);
+  lldb_private::Error DoConnectRemote(lldb_private::Stream *strm,
+  llvm::StringRef remote_url) override;
 
-  virtual lldb_private::Error
-  DoAttachToProcessWithID(lldb::pid_t pid,
-  const lldb_private::ProcessAttachInfo &attach_info);
+  lldb_private::Error DoAttachToProcessWithID(
+  lldb::pid_t pid,
+  const lldb_private::ProcessAttachInfo &attach_info) override;
 
-  virtual lldb_private::Error
-  DoAttachToProcessWithName(const char *process_name,
-const lldb_private::ProcessAttachInfo 
&attach_info);
+  

[Lldb-commits] [lldb] r289000 - Fix an unannotated fallthrough that was causing a warning.

2016-12-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Dec  7 17:52:27 2016
New Revision: 289000

URL: http://llvm.org/viewvc/llvm-project?rev=289000&view=rev
Log:
Fix an unannotated fallthrough that was causing a warning.

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp?rev=289000&r1=288999&r2=289000&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
 Wed Dec  7 17:52:27 2016
@@ -55,7 +55,8 @@ bool registerRSDefaultTargetOpts(clang::
 proto.Triple = "i686--linux-android";
 proto.CPU = "atom";
 proto.Features.push_back("+long64");
-  // Fallthrough for common x86 family features
+// Fallthrough for common x86 family features
+LLVM_FALLTHROUGH;
   case llvm::Triple::ArchType::x86_64:
 proto.Features.push_back("+mmx");
 proto.Features.push_back("+sse");


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


[Lldb-commits] [lldb] r289006 - Improve crashlog.py so it can handle more iOS crashlog files.

2016-12-07 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Dec  7 18:22:45 2016
New Revision: 289006

URL: http://llvm.org/viewvc/llvm-project?rev=289006&view=rev
Log:
Improve crashlog.py so it can handle more iOS crashlog files.





Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=289006&r1=289005&r2=289006&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Wed Dec  7 18:22:45 2016
@@ -380,9 +380,15 @@ class CrashLog(symbolication.Symbolicato
 elif line.startswith('Exception Codes:'):
 self.thread_exception_data = line[16:].strip()
 continue
+elif line.startswith('Exception Subtype:'): # iOS
+self.thread_exception_data = line[18:].strip()
+continue   
   
 elif line.startswith('Crashed Thread:'):
 self.crashed_thread_idx = int(line[15:].strip().split()[0])
 continue
+elif line.startswith('Triggered by Thread:'): # iOS
+self.crashed_thread_idx = int(line[20:].strip().split()[0])
+continue
 elif line.startswith('Report Version:'):
 self.version = int(line[15:].strip())
 continue
@@ -423,6 +429,11 @@ class CrashLog(symbolication.Symbolicato
 app_specific_backtrace = True
 idx = int(app_backtrace_match.group(1))
 thread = CrashLog.Thread(idx, True)
+elif line.startswith('Last Exception Backtrace:'): # iOS
+parse_mode = PARSE_MODE_THREAD
+app_specific_backtrace = True
+idx = 1
+thread = CrashLog.Thread(idx, True)
 self.info_lines.append(line.strip())
 elif parse_mode == PARSE_MODE_THREAD:
 if line.startswith('Thread'):


___
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 11/27/2016 - 12/03/2016

2016-12-07 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the last week of 11/27/2016 -
12/03/2016.

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
+--
 clang-x86_64-linux-selfhost-modules| 68:37:04
 lldb-x86_64-ubuntu-14.04-android   | 40:16:50
 clang-x86-windows-msvc2015 | 39:42:39
 clang-x64-ninja-win7   | 39:15:46
 clang-ppc64le-linux-multistage | 30:35:02
 clang-native-aarch64-full  | 23:33:01
 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 21:03:03
 lldb-x86_64-darwin-13.4| 20:47:36
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 20:29:05
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions  | 19:54:12
 libcxx-libcxxabi-libunwind-aarch64-linux   | 19:09:04
 libcxx-libcxxabi-libunwind-arm-linux   | 19:02:55
 libcxx-libcxxabi-x86_64-linux-debian   | 18:45:40
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian| 18:41:46
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions  | 18:27:22
 clang-cmake-mipsel | 16:14:57
 clang-cmake-aarch64-lld| 07:58:49
 lldb-windows7-android  | 07:49:00
 clang-cmake-armv7-a15-selfhost-neon| 07:31:35
 clang-cmake-thumbv7-a15-full-sh| 07:30:32
 perf-x86_64-penryn-O3-polly| 06:26:44
 clang-with-thin-lto-ubuntu | 06:10:33
 clang-cmake-aarch64-full   | 06:06:22
 polly-amd64-linux  | 05:19:55
 clang-native-arm-lnt   | 05:11:05
 sanitizer-x86_64-linux-bootstrap   | 05:04:11
 clang-with-lto-ubuntu  | 04:42:13
 sanitizer-ppc64be-linux| 04:29:56
 sanitizer-ppc64le-linux| 04:14:20
 sanitizer-x86_64-linux | 03:48:19
 llvm-mips-linux| 03:31:50
 clang-cmake-mips   | 03:03:18
 sanitizer-x86_64-linux-fuzzer  | 03:01:38
 clang-ppc64be-linux-multistage | 03:01:23
 lld-x86_64-win7| 02:59:25
 clang-3stage-ubuntu| 02:35:45
 lldb-x86_64-ubuntu-14.04-buildserver   | 02:27:07
 clang-cmake-aarch64-39vma  | 02:27:00
 clang-cmake-armv7-a15  | 02:18:52
 clang-ppc64le-linux| 02:16:28
 clang-cmake-aarch64-quick  | 02:16:09
 clang-ppc64le-linux-lnt| 02:13:27
 clang-cmake-aarch64-42vma  | 02:09:12
 clang-ppc64be-linux-lnt| 02:07:40
 lldb-amd64-ninja-netbsd7   | 02:03:04
 perf-x86_64-penryn-O3-polly-parallel-fast  | 02:02:20
 clang-atom-d525-fedora-rel | 02:01:52
 clang-cmake-thumbv7-a15| 02:00:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan  | 01:55:16
 clang-s390x-linux  | 01:55:03
 clang-ppc64be-linux| 01:52:11
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 01:51:39
 clang-bpf-build| 01:45:44
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 01:45:14
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11   | 01:45:12
 perf-x86_64-penryn-O3-polly-unprofitable   | 01:42:33
 clang-x86_64-linux-abi-test| 01:41:56
 libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu | 01:39:22
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 01:38:41
 sanitizer-x86_64-linux

[Lldb-commits] Buildbot numbers for the week of 11/20/2016 - 11/26/2016

2016-12-07 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the week of 11/20/2016 - 11/26/2016.

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
---+--
 clang-native-aarch64-full | 56:34:33
 llvm-avr-linux| 38:06:26
 sanitizer-x86_64-linux-bootstrap  | 21:36:42
 sanitizer-x86_64-linux-fast   | 18:39:53
 lldb-x86_64-darwin-13.4   | 11:58:36
 lldb-x86_64-ubuntu-14.04-buildserver  | 11:19:04
 lldb-amd64-ninja-netbsd7  | 10:46:53
 lldb-x86_64-ubuntu-14.04-cmake| 10:27:01
 lldb-amd64-ninja-freebsd11| 09:50:48
 clang-cmake-mipsel| 09:06:19
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 08:20:31
 lld-x86_64-darwin13   | 08:18:44
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 08:16:25
 libcxx-libcxxabi-libunwind-arm-linux  | 06:57:26
 clang-with-thin-lto-ubuntu| 04:39:17
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 04:37:10
 clang-with-lto-ubuntu | 04:36:35
 lld-x86_64-win7   | 04:33:19
 clang-cmake-thumbv7-a15   | 04:25:44
 clang-cmake-armv7-a15 | 04:25:37
 llvm-mips-linux   | 04:18:57
 clang-ppc64le-linux-lnt   | 04:18:36
 sanitizer-x86_64-linux| 03:47:04
 clang-cmake-armv7-a15-selfhost| 03:42:54
 clang-cmake-mips  | 03:19:12
 lldb-windows7-android | 03:04:31
 clang-cmake-aarch64-full  | 02:49:22
 clang-cmake-armv7-a15-full| 02:43:36
 clang-bpf-build   | 02:36:29
 clang-x64-ninja-win7  | 02:34:04
 clang-cmake-aarch64-lld   | 02:32:16
 lld-x86_64-freebsd| 02:12:51
 sanitizer-x86_64-linux-fuzzer | 02:11:22
 clang-ppc64le-linux-multistage| 02:04:50
 clang-ppc64le-linux   | 01:49:11
 clang-x86_64-linux-abi-test   | 01:49:05
 clang-cmake-aarch64-39vma | 01:47:29
 sanitizer-ppc64le-linux   | 01:42:12
 clang-ppc64be-linux-multistage| 01:32:38
 clang-ppc64be-linux-lnt   | 01:27:09
 clang-x86-windows-msvc2015| 01:24:58
 sanitizer-x86_64-linux-autoconf   | 01:22:12
 clang-cmake-aarch64-42vma | 01:20:42
 clang-hexagon-elf | 01:19:14
 llvm-hexagon-elf  | 01:17:50
 clang-x86_64-debian-fast  | 01:15:32
 clang-ppc64be-linux   | 01:14:56
 clang-x86_64-linux-selfhost-modules   | 01:13:31
 clang-cmake-aarch64-quick | 01:12:48
 clang-s390x-linux | 01:11:50
 sanitizer-ppc64be-linux   | 00:55:32
 lldb-x86_64-ubuntu-14.04-android  | 00:54:31
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 00:16:14
 polly-amd64-linux | 00:03:21
 clang-cmake-thumbv7-a15-full-sh   | -00:53:06
(55 rows)


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

buildername | builds |
changes | status_change_ratio
++-+
 clang-native-aarch64-full  | 14
|   5 |35.7
 libcxx-libcxxabi-libunwind-arm-linux   | 12
|   2 |16.7
 sanitizer-x86_64-linux-bootstrap   | 48
|   8 |16.7
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 13
|   2 |15.4
 clang-ppc64le-linux-lnt|145 |
22

[Lldb-commits] [lldb] r289009 - Work around a bogus warning on MSVC.

2016-12-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec  7 18:54:24 2016
New Revision: 289009

URL: http://llvm.org/viewvc/llvm-project?rev=289009&view=rev
Log:
Work around a bogus warning on MSVC.

Modified:
lldb/trunk/include/lldb/Target/Target.h

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=289009&r1=289008&r2=289009&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed Dec  7 18:54:24 2016
@@ -225,7 +225,19 @@ private:
 
 class EvaluateExpressionOptions {
 public:
+// MSVC has a bug here that reports C4268: 'const' static/global data
+// initialized with compiler generated default constructor fills the object
+// with zeros.
+// Confirmed that MSVC is *not* zero-initializing, it's just a bogus warning.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4268)
+#endif
   static constexpr std::chrono::milliseconds default_timeout{500};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
   static constexpr ExecutionPolicy default_execution_policy =
   eExecutionPolicyOnlyWhenNeeded;
 


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


[Lldb-commits] [lldb] r289012 - Convert CommandObjectCommands to entry-based Args access.

2016-12-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec  7 19:31:04 2016
New Revision: 289012

URL: http://llvm.org/viewvc/llvm-project?rev=289012&view=rev
Log:
Convert CommandObjectCommands to entry-based Args access.

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

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=289012&r1=289011&r2=289012&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Dec  7 19:31:04 
2016
@@ -235,12 +235,12 @@ public:
int match_start_point, int max_return_elements,
bool &word_complete,
StringList &matches) override {
-std::string completion_str(input.GetArgumentAtIndex(cursor_index));
-completion_str.erase(cursor_char_position);
+auto completion_str = input[cursor_index].ref;
+completion_str = completion_str.take_front(cursor_char_position);
 
 CommandCompletions::InvokeCommonCompletionCallbacks(
 GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
-completion_str.c_str(), match_start_point, max_return_elements, 
nullptr,
+completion_str, match_start_point, max_return_elements, nullptr,
 word_complete, matches);
 return matches.GetSize();
   }
@@ -301,39 +301,35 @@ protected:
   };
 
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-if (command.GetArgumentCount() == 1) {
-  llvm::StringRef filename = command.GetArgumentAtIndex(0);
-
-  FileSpec cmd_file(filename, true);
-  ExecutionContext *exe_ctx = nullptr; // Just use the default context.
-
-  // If any options were set, then use them
-  if (m_options.m_stop_on_error.OptionWasSet() ||
-  m_options.m_silent_run.OptionWasSet() ||
-  m_options.m_stop_on_continue.OptionWasSet()) {
-// Use user set settings
-CommandInterpreterRunOptions options;
-options.SetStopOnContinue(
-m_options.m_stop_on_continue.GetCurrentValue());
-options.SetStopOnError(m_options.m_stop_on_error.GetCurrentValue());
-options.SetEchoCommands(!m_options.m_silent_run.GetCurrentValue());
-options.SetPrintResults(!m_options.m_silent_run.GetCurrentValue());
-
-m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options,
- result);
-  } else {
-// No options were set, inherit any settings from nested "command
-// source" commands,
-// or set to sane default settings...
-CommandInterpreterRunOptions options;
-m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options,
- result);
-  }
-} else {
+if (command.GetArgumentCount() != 1) {
   result.AppendErrorWithFormat(
   "'%s' takes exactly one executable filename argument.\n",
   GetCommandName().str().c_str());
   result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
+FileSpec cmd_file(command[0].ref, true);
+ExecutionContext *exe_ctx = nullptr; // Just use the default context.
+
+// If any options were set, then use them
+if (m_options.m_stop_on_error.OptionWasSet() ||
+m_options.m_silent_run.OptionWasSet() ||
+m_options.m_stop_on_continue.OptionWasSet()) {
+  // Use user set settings
+  CommandInterpreterRunOptions options;
+  
options.SetStopOnContinue(m_options.m_stop_on_continue.GetCurrentValue());
+  options.SetStopOnError(m_options.m_stop_on_error.GetCurrentValue());
+  options.SetEchoCommands(!m_options.m_silent_run.GetCurrentValue());
+  options.SetPrintResults(!m_options.m_silent_run.GetCurrentValue());
+
+  m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options, result);
+} else {
+  // No options were set, inherit any settings from nested "command
+  // source" commands,
+  // or set to sane default settings...
+  CommandInterpreterRunOptions options;
+  m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options, result);
 }
 return result.Succeeded();
   }
@@ -600,10 +596,8 @@ protected:
 
 // Get the alias command.
 
-// TODO: Convert this function to use StringRef.  Requires converting
-// GetCommandObjectForCommand.
-const std::string alias_command = args.GetArgumentAtIndex(0);
-if (alias_command.size() > 1 && alias_command[0] == '-') {
+auto alias_command = args[0].ref;
+if (alias_command.startswith("-")) {
   result.AppendError("aliases starting with a dash are not supported");
   if (alias_command == "--help" || alias_command == "--long-help") {
 result.AppendWarning("if trying to pass options to 'comma

[Lldb-commits] [lldb] r289015 - Convert CommandObjectFrame to entry-based Args access.

2016-12-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec  7 20:02:09 2016
New Revision: 289015

URL: http://llvm.org/viewvc/llvm-project?rev=289015&view=rev
Log:
Convert CommandObjectFrame to entry-based Args access.

In the process, discovered a bug related to the use of an
uninitialized-pointer, and fixed as suggested by Enrico
in an lldb-dev mailing list thread.

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

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=289015&r1=289014&r2=289015&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Dec  7 20:02:09 2016
@@ -372,14 +372,20 @@ protected:
 }
   }
 } else {
+  if (command.GetArgumentCount() > 1) {
+result.AppendErrorWithFormat(
+"too many arguments; expected frame-index, saw '%s'.\n",
+command.GetArgumentAtIndex(0));
+m_options.GenerateOptionUsage(
+result.GetErrorStream(), this,
+GetCommandInterpreter().GetDebugger().GetTerminalWidth());
+return false;
+  }
+
   if (command.GetArgumentCount() == 1) {
-const char *frame_idx_cstr = command.GetArgumentAtIndex(0);
-bool success = false;
-frame_idx =
-StringConvert::ToUInt32(frame_idx_cstr, UINT32_MAX, 0, &success);
-if (!success) {
+if (command[0].ref.getAsInteger(0, frame_idx)) {
   result.AppendErrorWithFormat("invalid frame index argument '%s'.",
-   frame_idx_cstr);
+   command[0].c_str());
   result.SetStatus(eReturnStatusFailed);
   return false;
 }
@@ -388,14 +394,6 @@ protected:
 if (frame_idx == UINT32_MAX) {
   frame_idx = 0;
 }
-  } else {
-result.AppendErrorWithFormat(
-"too many arguments; expected frame-index, saw '%s'.\n",
-command.GetArgumentAtIndex(0));
-m_options.GenerateOptionUsage(
-result.GetErrorStream(), this,
-GetCommandInterpreter().GetDebugger().GetTerminalWidth());
-return false;
   }
 }
 
@@ -524,9 +522,6 @@ protected:
 VariableSP var_sp;
 ValueObjectSP valobj_sp;
 
-const char *name_cstr = nullptr;
-size_t idx;
-
 TypeSummaryImplSP summary_format_sp;
 if (!m_option_variable.summary.IsCurrentValueEmpty())
   DataVisualization::NamedSummaryFormats::GetSummaryFormat(
@@ -555,11 +550,10 @@ protected:
 
 // If we have any args to the variable command, we will make
 // variable objects from them...
-for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != nullptr;
- ++idx) {
+for (auto &entry : command) {
   if (m_option_variable.use_regex) {
 const size_t regex_start_index = regex_var_list.GetSize();
-llvm::StringRef name_str(name_cstr);
+llvm::StringRef name_str = entry.ref;
 RegularExpression regex(name_str);
 if (regex.Compile(name_str)) {
   size_t num_matches = 0;
@@ -575,12 +569,6 @@ protected:
 valobj_sp = frame->GetValueObjectForFrameVariable(
 var_sp, m_varobj_options.use_dynamic);
 if (valobj_sp) {
-  //if (format
-  //!=
-  //
eFormatDefault)
-  //
valobj_sp->SetFormat
-  //
(format);
-
   std::string scope_string;
   if (m_option_variable.show_scope)
 scope_string = GetScopeString(var_sp).str();
@@ -603,7 +591,7 @@ protected:
   } else if (num_matches == 0) {
 result.GetErrorStream().Printf("error: no variables matched "
"the regular expression 
'%s'.\n",
-   name_cstr);
+   entry.c_str());
   }
 } else {
   char regex_error[1024];
@@ -612,7 +600,7 @@ protected:
   else
 result.GetErrorStream().Printf(
 "error: unknown regex error when compiling '%s'\n",
-name_cstr);
+entry.c_str());
 }
   } else // No regex, either exact variable names or variable
  // expressions.
@@ -624,7 +612,7 @@ protected:
 StackFrame::eExpressionPathOpt

[Lldb-commits] [lldb] r289016 - Set the address size based on the target's arch instead

2016-12-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Dec  7 20:02:45 2016
New Revision: 289016

URL: http://llvm.org/viewvc/llvm-project?rev=289016&view=rev
Log:
Set the address size based on the target's arch instead
of using the address of the all_image_infos struct.
 

Modified:

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=289016&r1=289015&r2=289016&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
Wed Dec  7 20:02:45 2016
@@ -430,9 +430,8 @@ bool DynamicLoaderMacOSXDYLD::ReadAllIma
   if (m_dyld_all_image_infos_addr != LLDB_INVALID_ADDRESS) {
 ByteOrder byte_order =
 m_process->GetTarget().GetArchitecture().GetByteOrder();
-uint32_t addr_size = 4;
-if (m_dyld_all_image_infos_addr > UINT32_MAX)
-  addr_size = 8;
+uint32_t addr_size =
+m_process->GetTarget().GetArchitecture().GetAddressByteSize();
 
 uint8_t buf[256];
 DataExtractor data(buf, sizeof(buf), byte_order, addr_size);


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


[Lldb-commits] [lldb] r289023 - Increase timeout for Frontboard app launch request from 9 to 20 seconds

2016-12-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Dec  7 23:12:45 2016
New Revision: 289023

URL: http://llvm.org/viewvc/llvm-project?rev=289023&view=rev
Log:
Increase timeout for Frontboard app launch request from 9 to 20 seconds
to match other timeouts.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=289023&r1=289022&r2=289023&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Wed Dec  7 
23:12:45 2016
@@ -157,7 +157,7 @@ static bool CallBoardSystemServiceOpenAp
 
   ];
 
-  const uint32_t timeout_secs = 9;
+  const uint32_t timeout_secs = 20;
 
   dispatch_time_t timeout =
   dispatch_time(DISPATCH_TIME_NOW, timeout_secs * NSEC_PER_SEC);


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


[Lldb-commits] [lldb] r289026 - When we interrupt a process, it was possible or the thread names

2016-12-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Dec  8 00:27:29 2016
New Revision: 289026

URL: http://llvm.org/viewvc/llvm-project?rev=289026&view=rev
Log:
When we interrupt a process, it was possible or the thread names
to not be set by Process::WillPublicStop() so the driver won't get
access to them.  The fix is straightforward, moving the call to
WillPublicStop above the early return for the interrupt case.  (the
interrupt case does an early return because the rest of the function
is concerned with running stop hooks etc and those are not applicable
when we've interrupted the process).

Also added a test case for it.  The test case is a little complicated
because I needed to drive lldb asynchronously to give the program
a chance to get up and running before I interrupt it.  Running to
a breakpoint was not sufficient to catch this bug.

 

Added:
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile

lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/main.c
Modified:
lldb/trunk/source/Target/Process.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile?rev=289026&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile Thu 
Dec  8 00:27:29 2016
@@ -0,0 +1,28 @@
+CC ?= clang
+ifeq "$(ARCH)" ""
+   ARCH = x86_64
+endif
+
+ifeq "$(OS)" ""
+   OS = $(shell uname -s)
+endif
+
+CFLAGS ?= -g -O0
+CWD := $(shell pwd)
+
+LIB_PREFIX := lib
+
+ifeq "$(OS)" "Darwin"
+   CFLAGS += -arch $(ARCH)
+endif
+
+all: a.out
+
+a.out: main.o
+   $(CC) $(CFLAGS) -o a.out main.o
+
+main.o: main.c
+   $(CC) $(CFLAGS) -c main.c
+
+clean:
+   rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py?rev=289026&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/TestInterruptThreadNames.py
 Thu Dec  8 00:27:29 2016
@@ -0,0 +1,116 @@
+"""Test that we get thread names when interrupting a process.""" 
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestInterruptThreadNames(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+@skipUnlessDarwin
+@add_test_categories(['pyapi'])
+def test_with_python_api(self):
+"""Test that we get thread names when interrupting a process."""
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+launch_info = lldb.SBLaunchInfo(None)
+error = lldb.SBError()
+lldb.debugger.SetAsync(True)
+process = target.Launch(launch_info, error)
+self.assertTrue(process, PROCESS_IS_VALID)
+
+listener = lldb.debugger.GetListener()
+broadcaster = process.GetBroadcaster()
+rc = broadcaster.AddListener(listener, 
lldb.SBProcess.eBroadcastBitStateChanged)
+self.assertTrue(rc != 0, "Unable to add listener to process")
+self.assertTrue(self.wait_for_running(process, listener), "Check that 
process is up and running")
+
+
+inferior_set_up = lldb.SBValue()
+retry = 5
+while retry > 0:
+time.sleep(1)
+process.SendAsyncInterrupt()
+self.assertTrue(self.wait_for_stop(process, listener), "Check that 
process is paused")
+inferior_set_up = 
target.CreateValueFromExpression("threads_up_and_running", 
"threads_up_and_running")
+if inferior_set_up.IsValid() and 
inferior_set_up.GetValueAsSigned() == 1:
+retry = 0
+else:
+process.Continue()
+retry = retry - 1
+
+self.assertTrue(inferior_set_up.IsValid() and 
inferior_set_up.GetValueAsSigned() == 1, "Check that the program was able to 
create its threads within the allotted time")
+
+self.check_number_of_threads(process)
+
+main_thread = lldb.SBThread()
+second_thread = lldb.SBThread()
+third_thread