[Lldb-commits] [PATCH] D84955: Report an error if a CLI option lacks an argument

2020-07-31 Thread Luboš Luňák via Phabricator via lldb-commits
llunak updated this revision to Diff 282208.
llunak added a comment.

Adjusted according to the comments.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84955/new/

https://reviews.llvm.org/D84955

Files:
  lldb/test/Shell/Driver/TestError.test
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -853,10 +853,11 @@
 
   // Parse arguments.
   LLDBOptTable T;
-  unsigned MAI;
-  unsigned MAC;
+  unsigned MissingArgIndex;
+  unsigned MissingArgCount;
   ArrayRef arg_arr = makeArrayRef(argv + 1, argc - 1);
-  opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
+  opt::InputArgList input_args =
+  T.ParseArgs(arg_arr, MissingArgIndex, MissingArgCount);
   llvm::StringRef argv0 = llvm::sys::path::filename(argv[0]);
 
   if (input_args.hasArg(OPT_help)) {
@@ -864,11 +865,19 @@
 return 0;
   }
 
+  // Check for missing argument error.
+  if (MissingArgCount) {
+WithColor::error() << "argument to '"
+   << input_args.getArgString(MissingArgIndex)
+   << "' is missing\n";
+  }
   // Error out on unknown options.
   if (input_args.hasArg(OPT_UNKNOWN)) {
 for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
   WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
 }
+  }
+  if (MissingArgCount || input_args.hasArg(OPT_UNKNOWN)) {
 llvm::errs() << "Use '" << argv0
  << " --help' for a complete list of options.\n";
 return 1;
Index: lldb/test/Shell/Driver/TestError.test
===
--- /dev/null
+++ lldb/test/Shell/Driver/TestError.test
@@ -0,0 +1,2 @@
+RUN: not %lldb --arch 2>&1 | FileCheck %s
+CHECK: error: argument to '--arch' is missing


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -853,10 +853,11 @@
 
   // Parse arguments.
   LLDBOptTable T;
-  unsigned MAI;
-  unsigned MAC;
+  unsigned MissingArgIndex;
+  unsigned MissingArgCount;
   ArrayRef arg_arr = makeArrayRef(argv + 1, argc - 1);
-  opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
+  opt::InputArgList input_args =
+  T.ParseArgs(arg_arr, MissingArgIndex, MissingArgCount);
   llvm::StringRef argv0 = llvm::sys::path::filename(argv[0]);
 
   if (input_args.hasArg(OPT_help)) {
@@ -864,11 +865,19 @@
 return 0;
   }
 
+  // Check for missing argument error.
+  if (MissingArgCount) {
+WithColor::error() << "argument to '"
+   << input_args.getArgString(MissingArgIndex)
+   << "' is missing\n";
+  }
   // Error out on unknown options.
   if (input_args.hasArg(OPT_UNKNOWN)) {
 for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
   WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
 }
+  }
+  if (MissingArgCount || input_args.hasArg(OPT_UNKNOWN)) {
 llvm::errs() << "Use '" << argv0
  << " --help' for a complete list of options.\n";
 return 1;
Index: lldb/test/Shell/Driver/TestError.test
===
--- /dev/null
+++ lldb/test/Shell/Driver/TestError.test
@@ -0,0 +1,2 @@
+RUN: not %lldb --arch 2>&1 | FileCheck %s
+CHECK: error: argument to '--arch' is missing
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84955: Report an error if a CLI option lacks an argument

2020-07-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Thanks! LGTM


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84955/new/

https://reviews.llvm.org/D84955

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


[Lldb-commits] [lldb] 162e9f7 - [lldb/Test] Reduce code duplication by importing subprocess globally

2020-07-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-07-31T10:56:13-07:00
New Revision: 162e9f72ac57342a0ea12036576d6212720cc93f

URL: 
https://github.com/llvm/llvm-project/commit/162e9f72ac57342a0ea12036576d6212720cc93f
DIFF: 
https://github.com/llvm/llvm-project/commit/162e9f72ac57342a0ea12036576d6212720cc93f.diff

LOG: [lldb/Test] Reduce code duplication by importing subprocess globally

Import the subprocess module once instead of doing it inline which is
error prone and leads to needless code duplication.

Added: 


Modified: 
lldb/test/API/lit.cfg.py

Removed: 




diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index a211abe6cc41..e083e2fd9beb 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -6,6 +6,7 @@
 import platform
 import shlex
 import shutil
+import subprocess
 
 import lit.formats
 
@@ -33,7 +34,6 @@ def mkdir_p(path):
 
 
 def find_sanitizer_runtime(name):
-  import subprocess
   resource_dir = subprocess.check_output(
   [config.cmake_cxx_compiler,
'-print-resource-dir']).decode('utf-8').strip()
@@ -60,7 +60,6 @@ def find_python_interpreter():
 return copied_python
 
   # Find the "real" python binary.
-  import shutil, subprocess
   real_python = subprocess.check_output([
   config.python_executable,
   os.path.join(os.path.dirname(os.path.realpath(__file__)),



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


[Lldb-commits] [lldb] 8739445 - [lldb] force full gui redraw on Ctrl+L

2020-07-31 Thread Luboš Luňák via lldb-commits

Author: Luboš Luňák
Date: 2020-07-31T22:02:40+02:00
New Revision: 8739445e3221ea05bc71a592f4114e10510b0b34

URL: 
https://github.com/llvm/llvm-project/commit/8739445e3221ea05bc71a592f4114e10510b0b34
DIFF: 
https://github.com/llvm/llvm-project/commit/8739445e3221ea05bc71a592f4114e10510b0b34.diff

LOG: [lldb] force full gui redraw on Ctrl+L

As is common with curses apps, this allows to redraw everything
in case something corrupts the screen. Apparently key modifiers
are difficult with curses (curses FAQ it "doesn't do that"),
thankfully Ctrl+key are simply control characters, so it's
(ascii & 037) => 12.

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

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index fda3aa188679..262a19dc04b4 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1287,6 +1287,10 @@ class Application {
   update = true;
   break;
 case eKeyNotHandled:
+  if (ch == 12) { // Ctrl+L, force full redraw
+redrawwin(m_window_sp->get());
+update = true;
+  }
   break;
 case eQuitApplication:
   done = true;



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


[Lldb-commits] [PATCH] D84955: Report an error if a CLI option lacks an argument

2020-07-31 Thread Luboš Luňák via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG77d5a63c191c: [lldb] report an error if a CLI option lacks 
an argument (authored by llunak).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84955/new/

https://reviews.llvm.org/D84955

Files:
  lldb/test/Shell/Driver/TestError.test
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -853,10 +853,11 @@
 
   // Parse arguments.
   LLDBOptTable T;
-  unsigned MAI;
-  unsigned MAC;
+  unsigned MissingArgIndex;
+  unsigned MissingArgCount;
   ArrayRef arg_arr = makeArrayRef(argv + 1, argc - 1);
-  opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
+  opt::InputArgList input_args =
+  T.ParseArgs(arg_arr, MissingArgIndex, MissingArgCount);
   llvm::StringRef argv0 = llvm::sys::path::filename(argv[0]);
 
   if (input_args.hasArg(OPT_help)) {
@@ -864,11 +865,19 @@
 return 0;
   }
 
+  // Check for missing argument error.
+  if (MissingArgCount) {
+WithColor::error() << "argument to '"
+   << input_args.getArgString(MissingArgIndex)
+   << "' is missing\n";
+  }
   // Error out on unknown options.
   if (input_args.hasArg(OPT_UNKNOWN)) {
 for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
   WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
 }
+  }
+  if (MissingArgCount || input_args.hasArg(OPT_UNKNOWN)) {
 llvm::errs() << "Use '" << argv0
  << " --help' for a complete list of options.\n";
 return 1;
Index: lldb/test/Shell/Driver/TestError.test
===
--- /dev/null
+++ lldb/test/Shell/Driver/TestError.test
@@ -0,0 +1,2 @@
+RUN: not %lldb --arch 2>&1 | FileCheck %s
+CHECK: error: argument to '--arch' is missing


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -853,10 +853,11 @@
 
   // Parse arguments.
   LLDBOptTable T;
-  unsigned MAI;
-  unsigned MAC;
+  unsigned MissingArgIndex;
+  unsigned MissingArgCount;
   ArrayRef arg_arr = makeArrayRef(argv + 1, argc - 1);
-  opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
+  opt::InputArgList input_args =
+  T.ParseArgs(arg_arr, MissingArgIndex, MissingArgCount);
   llvm::StringRef argv0 = llvm::sys::path::filename(argv[0]);
 
   if (input_args.hasArg(OPT_help)) {
@@ -864,11 +865,19 @@
 return 0;
   }
 
+  // Check for missing argument error.
+  if (MissingArgCount) {
+WithColor::error() << "argument to '"
+   << input_args.getArgString(MissingArgIndex)
+   << "' is missing\n";
+  }
   // Error out on unknown options.
   if (input_args.hasArg(OPT_UNKNOWN)) {
 for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
   WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
 }
+  }
+  if (MissingArgCount || input_args.hasArg(OPT_UNKNOWN)) {
 llvm::errs() << "Use '" << argv0
  << " --help' for a complete list of options.\n";
 return 1;
Index: lldb/test/Shell/Driver/TestError.test
===
--- /dev/null
+++ lldb/test/Shell/Driver/TestError.test
@@ -0,0 +1,2 @@
+RUN: not %lldb --arch 2>&1 | FileCheck %s
+CHECK: error: argument to '--arch' is missing
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 77d5a63 - [lldb] report an error if a CLI option lacks an argument

2020-07-31 Thread Luboš Luňák via lldb-commits

Author: Luboš Luňák
Date: 2020-07-31T22:02:40+02:00
New Revision: 77d5a63c191ca791f081ff153276170bbfb10cee

URL: 
https://github.com/llvm/llvm-project/commit/77d5a63c191ca791f081ff153276170bbfb10cee
DIFF: 
https://github.com/llvm/llvm-project/commit/77d5a63c191ca791f081ff153276170bbfb10cee.diff

LOG: [lldb] report an error if a CLI option lacks an argument

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

Added: 
lldb/test/Shell/Driver/TestError.test

Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/test/Shell/Driver/TestError.test 
b/lldb/test/Shell/Driver/TestError.test
new file mode 100644
index ..3d34a72b14ab
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestError.test
@@ -0,0 +1,2 @@
+RUN: not %lldb --arch 2>&1 | FileCheck %s
+CHECK: error: argument to '--arch' is missing

diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index cea9e5a44aa8..0cd1ffc57aa7 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -853,10 +853,11 @@ int main(int argc, char const *argv[]) {
 
   // Parse arguments.
   LLDBOptTable T;
-  unsigned MAI;
-  unsigned MAC;
+  unsigned MissingArgIndex;
+  unsigned MissingArgCount;
   ArrayRef arg_arr = makeArrayRef(argv + 1, argc - 1);
-  opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
+  opt::InputArgList input_args =
+  T.ParseArgs(arg_arr, MissingArgIndex, MissingArgCount);
   llvm::StringRef argv0 = llvm::sys::path::filename(argv[0]);
 
   if (input_args.hasArg(OPT_help)) {
@@ -864,11 +865,19 @@ int main(int argc, char const *argv[]) {
 return 0;
   }
 
+  // Check for missing argument error.
+  if (MissingArgCount) {
+WithColor::error() << "argument to '"
+   << input_args.getArgString(MissingArgIndex)
+   << "' is missing\n";
+  }
   // Error out on unknown options.
   if (input_args.hasArg(OPT_UNKNOWN)) {
 for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
   WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
 }
+  }
+  if (MissingArgCount || input_args.hasArg(OPT_UNKNOWN)) {
 llvm::errs() << "Use '" << argv0
  << " --help' for a complete list of options.\n";
 return 1;



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


[Lldb-commits] [PATCH] D84972: Force full gui redraw on Ctrl+L

2020-07-31 Thread Luboš Luňák via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8739445e3221: [lldb] force full gui redraw on Ctrl+L 
(authored by llunak).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84972/new/

https://reviews.llvm.org/D84972

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1287,6 +1287,10 @@
   update = true;
   break;
 case eKeyNotHandled:
+  if (ch == 12) { // Ctrl+L, force full redraw
+redrawwin(m_window_sp->get());
+update = true;
+  }
   break;
 case eQuitApplication:
   done = true;


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1287,6 +1287,10 @@
   update = true;
   break;
 case eKeyNotHandled:
+  if (ch == 12) { // Ctrl+L, force full redraw
+redrawwin(m_window_sp->get());
+update = true;
+  }
   break;
 case eQuitApplication:
   done = true;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84576: Fix debugserver's qProcessInfo reporting of maccatalyst binaries

2020-07-31 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

ping!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84576/new/

https://reviews.llvm.org/D84576

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


[Lldb-commits] [PATCH] D84957: [lldb/Process/Windows] Attempt to kill exited/detached process in not error

2020-07-31 Thread Aaron Smith via Phabricator via lldb-commits
asmith accepted this revision.
asmith added a comment.
This revision is now accepted and ready to land.

LGTM.

Some changes for grammar to the title -- "[lldb/Process/Windows] Attempting to 
kill an exited/detached process is not an error"

A little more description would be helpful for others. Here's a suggestion --

"The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to 
kill an exited/detached process. This change makes ProcessWindows consistent 
with the other processes which only log the error. After this change a large 
number of 'CLEANUP ERROR' messages are now removed."


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84957/new/

https://reviews.llvm.org/D84957

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


[Lldb-commits] [lldb] 5110fd0 - Convert to early exit (NFC)

2020-07-31 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-07-31T14:55:09-07:00
New Revision: 5110fd0343c2d06c8ae538741fbef13ece5e68de

URL: 
https://github.com/llvm/llvm-project/commit/5110fd0343c2d06c8ae538741fbef13ece5e68de
DIFF: 
https://github.com/llvm/llvm-project/commit/5110fd0343c2d06c8ae538741fbef13ece5e68de.diff

LOG: Convert to early exit (NFC)

Added: 


Modified: 
lldb/source/Target/TargetList.cpp

Removed: 




diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index 75a022d2c463..7e243e5ed338 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -394,37 +394,38 @@ Status TargetList::CreateTargetInternal(Debugger 
&debugger,
 target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target));
   }
 
-  if (target_sp) {
-// Set argv0 with what the user typed, unless the user specified a
-// directory. If the user specified a directory, then it is probably a
-// bundle that was resolved and we need to use the resolved bundle path
-if (!user_exe_path.empty()) {
-  // Use exactly what the user typed as the first argument when we exec or
-  // posix_spawn
-  if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) {
-target_sp->SetArg0(resolved_bundle_exe_path);
-  } else {
-// Use resolved path
-target_sp->SetArg0(file.GetPath().c_str());
-  }
-}
-if (file.GetDirectory()) {
-  FileSpec file_dir;
-  file_dir.GetDirectory() = file.GetDirectory();
-  target_sp->AppendExecutableSearchPaths(file_dir);
-}
+  if (!target_sp)
+return error;
 
-// Don't put the dummy target in the target list, it's held separately.
-if (!is_dummy_target) {
-  std::lock_guard guard(m_target_list_mutex);
-  m_selected_target_idx = m_target_list.size();
-  m_target_list.push_back(target_sp);
-  // Now prime this from the dummy target:
-  target_sp->PrimeFromDummyTarget(debugger.GetDummyTarget());
+  // Set argv0 with what the user typed, unless the user specified a
+  // directory. If the user specified a directory, then it is probably a
+  // bundle that was resolved and we need to use the resolved bundle path
+  if (!user_exe_path.empty()) {
+// Use exactly what the user typed as the first argument when we exec or
+// posix_spawn
+if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) {
+  target_sp->SetArg0(resolved_bundle_exe_path);
 } else {
-  m_dummy_target_sp = target_sp;
+  // Use resolved path
+  target_sp->SetArg0(file.GetPath().c_str());
 }
   }
+  if (file.GetDirectory()) {
+FileSpec file_dir;
+file_dir.GetDirectory() = file.GetDirectory();
+target_sp->AppendExecutableSearchPaths(file_dir);
+  }
+
+  // Don't put the dummy target in the target list, it's held separately.
+  if (!is_dummy_target) {
+std::lock_guard guard(m_target_list_mutex);
+m_selected_target_idx = m_target_list.size();
+m_target_list.push_back(target_sp);
+// Now prime this from the dummy target:
+target_sp->PrimeFromDummyTarget(debugger.GetDummyTarget());
+  } else {
+m_dummy_target_sp = target_sp;
+  }
 
   return error;
 }



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


[Lldb-commits] [PATCH] D85049: Unify the code that updates the ArchSpec after finding a fat binary with how it is done for a lean binary

2020-07-31 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jasonmolenda, jingham, friss.
aprantl requested review of this revision.

In particular this affects how `target create --arch` is handled — it allowed 
us to override the deployment target (a useful feature for the expression 
evaluator), but the fat binary case didn't.

rdar://problem/66024437


https://reviews.llvm.org/D85049

Files:
  lldb/source/Target/TargetList.cpp
  lldb/test/API/macosx/universal/Makefile
  lldb/test/API/macosx/universal/TestUniversal.py

Index: lldb/test/API/macosx/universal/TestUniversal.py
===
--- lldb/test/API/macosx/universal/TestUniversal.py
+++ lldb/test/API/macosx/universal/TestUniversal.py
@@ -1,7 +1,3 @@
-"""Test aspects of lldb commands on universal binaries."""
-
-
-
 import unittest2
 import os
 import lldb
@@ -14,6 +10,7 @@
 return "AVX2" in features.split()
 
 class UniversalTestCase(TestBase):
+"""Test aspects of lldb commands on universal binaries."""
 
 NO_DEBUG_INFO_TESTCASE = True
 mydir = TestBase.compute_mydir(__file__)
@@ -39,9 +36,10 @@
 
 # Create a target by the debugger.
 target = self.dbg.CreateTargetWithFileAndTargetTriple(
-exe, "x86_64-apple-macosx")
+exe, "x86_64-apple-macosx10.10")
 self.assertTrue(target, VALID_TARGET)
-self.expect("image list -A -b", substrs=["x86_64 testit"])
+self.expect("image list -t -b", substrs=["x86_64-apple-macosx10.9.0 testit"])
+self.expect("target list", substrs=["testit", "arch=x86_64-apple-macosx10.10"])
 
 # Now launch the process, and do not stop at entry point.
 process = target.LaunchSimple(
Index: lldb/test/API/macosx/universal/Makefile
===
--- lldb/test/API/macosx/universal/Makefile
+++ lldb/test/API/macosx/universal/Makefile
@@ -8,13 +8,13 @@
 	lipo -create -o testit $^
 
 testit.x86_64h: testit.x86_64h.o
-	$(CC) -isysroot $(SDKROOT) -arch x86_64h -o testit.x86_64h $<
+	$(CC) -isysroot $(SDKROOT) -target x86_64h-apple-macosx10.9 -o testit.x86_64h $<
 
 testit.x86_64: testit.x86_64.o
-	$(CC) -isysroot $(SDKROOT) -arch x86_64 -o testit.x86_64 $<
+	$(CC) -isysroot $(SDKROOT) -target x86_64-apple-macosx10.9 -o testit.x86_64 $<
 
 testit.x86_64h.o: main.c
-	$(CC) -isysroot $(SDKROOT) -g -O0 -arch x86_64h -c -o testit.x86_64h.o $<
+	$(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64h-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9 -c -o testit.x86_64h.o $<
 
 testit.x86_64.o: main.c
-	$(CC) -isysroot $(SDKROOT) -g -O0 -arch x86_64 -c -o testit.x86_64.o $<
+	$(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64-apple-macosx10.9 -c -o testit.x86_64.o $<
Index: lldb/source/Target/TargetList.cpp
===
--- lldb/source/Target/TargetList.cpp
+++ lldb/source/Target/TargetList.cpp
@@ -104,6 +104,15 @@
   }
 
   bool prefer_platform_arch = false;
+  auto update_platform_arch = [&](const ArchSpec &module_arch) {
+// If the OS or vendor weren't specified, then adopt the module's
+// architecture so that the platform matching can be more accurate.
+if (!platform_arch.TripleOSWasSpecified() ||
+!platform_arch.TripleVendorWasSpecified()) {
+  prefer_platform_arch = true;
+  platform_arch = module_arch;
+}
+  };
 
   if (!user_exe_path.empty()) {
 ModuleSpec module_spec(FileSpec(user_exe_path, FileSpec::Style::native));
@@ -150,21 +159,18 @@
 }
   } else {
 // Only one arch and none was specified.
-prefer_platform_arch = true;
-platform_arch = matching_module_spec.GetArchitecture();
+update_platform_arch(matching_module_spec.GetArchitecture());
   }
 }
   } else if (arch.IsValid()) {
-// A (valid) architecture was specified.
+// Fat binary. A (valid) architecture was specified.
 module_spec.GetArchitecture() = arch;
 if (module_specs.FindMatchingModuleSpec(module_spec,
-matching_module_spec)) {
-  prefer_platform_arch = true;
-  platform_arch = matching_module_spec.GetArchitecture();
-}
+matching_module_spec))
+update_platform_arch(matching_module_spec.GetArchitecture());
   } else {
-// No architecture specified, check if there is only one platform for
-// all of the architectures.
+// Fat binary. No architecture specified, check if there is
+// only one platform for all of the architectures.
 PlatformSP host_platform_sp = Platform::GetHostPlatform();
 std::vector platforms;
 for (size_t i = 0; i < num_specs; ++i) {
@@ -251,7 +257,8 @@
   // If we have a valid architecture, make sure the current platform is
   // compatible with that 

[Lldb-commits] [PATCH] D84716: [lldb/ArchSpec] Always match simulator environment in IsEqualTo

2020-07-31 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.
Herald added a subscriber: JDevlieghere.



Comment at: lldb/unittests/Utility/ArchSpecTest.cpp:315
+ASSERT_FALSE(B.IsCompatibleMatch(A));
+ASSERT_FALSE(B.IsCompatibleMatch(A));
+  }

We want to be *really* sure of this? :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84716/new/

https://reviews.llvm.org/D84716

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


[Lldb-commits] [PATCH] D85068: [intel-pt] Refactor 1: rename the namespace

2020-07-31 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added a reviewer: clayborg.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
wallace requested review of this revision.
Herald added a subscriber: JDevlieghere.

Depends on D84810 .
The existing namespace name ptdecoder is really not good, as this extension 
does more things beyond decoding, and will have even more features soon.
So I'm renaming the namespace to intelpt, which is clearer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85068

Files:
  lldb/tools/intel-features/intel-pt/Decoder.cpp
  lldb/tools/intel-features/intel-pt/Decoder.h
  lldb/tools/intel-features/intel-pt/PTDecoder.cpp
  lldb/tools/intel-features/intel-pt/PTDecoder.h
  lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
  lldb/tools/intel-features/scripts/lldb-intel-features.swig

Index: lldb/tools/intel-features/scripts/lldb-intel-features.swig
===
--- lldb/tools/intel-features/scripts/lldb-intel-features.swig
+++ lldb/tools/intel-features/scripts/lldb-intel-features.swig
@@ -21,7 +21,7 @@
 %{
 #include "lldb/lldb-public.h"
 #include "intel-pt/PTDecoder.h"
-using namespace ptdecoder;
+using namespace intelpt;
 %}
 
 /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
Index: lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
===
--- lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
+++ lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
@@ -123,7 +123,7 @@
 
 class ProcessorTraceStart : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceStart(std::shared_ptr &pt_decoder)
+  ProcessorTraceStart(std::shared_ptr &pt_decoder)
   : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceStart() {}
@@ -137,7 +137,7 @@
 
 // Default initialize API's arguments
 lldb::SBTraceOptions lldb_SBTraceOptions =
-ptdecoder::PTDecoder::GetDefaultTraceOptions();
+intelpt::PTDecoder::GetDefaultTraceOptions();
 uint32_t trace_buffer_size = lldb_SBTraceOptions.getTraceBufferSize();
 lldb::tid_t thread_id;
 
@@ -186,13 +186,13 @@
   }
 
 private:
-  std::shared_ptr pt_decoder_sp;
+  std::shared_ptr pt_decoder_sp;
   const uint32_t m_max_trace_buff_size = 0x3fff;
 };
 
 class ProcessorTraceInfo : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceInfo(std::shared_ptr &pt_decoder)
+  ProcessorTraceInfo(std::shared_ptr &pt_decoder)
   : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceInfo() {}
@@ -246,7 +246,7 @@
 thread = process.GetThreadByID(thread_id);
   thread_id = thread.GetThreadID();
 
-  ptdecoder::PTTraceOptions options;
+  intelpt::PTTraceOptions options;
   pt_decoder_sp->GetProcessorTraceInfo(process, thread_id, options, error);
   if (!error.Success()) {
 res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
@@ -285,12 +285,12 @@
   }
 
 private:
-  std::shared_ptr pt_decoder_sp;
+  std::shared_ptr pt_decoder_sp;
 };
 
 class ProcessorTraceShowInstrLog : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceShowInstrLog(std::shared_ptr &pt_decoder)
+  ProcessorTraceShowInstrLog(std::shared_ptr &pt_decoder)
   : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceShowInstrLog() {}
@@ -363,7 +363,7 @@
 offset = count - 1;
 
   // Get the instruction log
-  ptdecoder::PTInstructionList insn_list;
+  intelpt::PTInstructionList insn_list;
   pt_decoder_sp->GetInstructionLogAtOffset(process, thread_id, offset,
count, insn_list, error);
   if (!error.Success()) {
@@ -381,7 +381,7 @@
   debugger.GetCommandInterpreter());
   lldb::SBCommandReturnObject result_obj;
   for (size_t i = 0; i < insn_list.GetSize(); i++) {
-ptdecoder::PTInstruction insn = insn_list.GetInstructionAtIndex(i);
+intelpt::PTInstruction insn = insn_list.GetInstructionAtIndex(i);
 uint64_t addr = insn.GetInsnAddress();
 std::string error = insn.GetError();
 if (!error.empty()) {
@@ -424,13 +424,13 @@
   }
 
 private:
-  std::shared_ptr pt_decoder_sp;
+  std::shared_ptr pt_decoder_sp;
   const uint32_t m_default_count = 10;
 };
 
 class ProcessorTraceStop : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceStop(std::shared_ptr &pt_decoder)
+  ProcessorTraceStop(std::shared_ptr &pt_decoder)
   : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceStop() {}
@@ -477,7 +477,7 @@
   }
 
 private:
-  std::shared_ptr pt_decoder_sp;
+  std::shared_ptr pt_decoder_sp;
 };
 
 bool PTPluginInitialize(lldb::SBDebugger &debugger) {
@@ -485,8 +485,8 @@
   lldb::SBCommand proc_trace = interpreter.AddMultiwordCommand(
   "processor-trace", "Intel