[Lldb-commits] [PATCH] D65611: [Driver] Expand the target in the driver.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 1 16:16:33 PDT 2019


JDevlieghere updated this revision to Diff 212924.

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

https://reviews.llvm.org/D65611

Files:
  lldb/lit/Driver/TestTarget.test
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===================================================================
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -533,14 +533,19 @@
   if (!m_option_data.m_repl) {
     const size_t num_args = m_option_data.m_args.size();
     if (num_args > 0) {
+      char target_path[256];
+      SBFileSpec::ResolvePath(m_option_data.m_args[0].c_str(), target_path,
+                              sizeof(target_path));
+
       char arch_name[64];
       if (lldb::SBDebugger::GetDefaultArchitecture(arch_name,
-                                                   sizeof(arch_name)))
+                                                   sizeof(arch_name))) {
         commands_stream.Printf("target create --arch=%s %s", arch_name,
-                               EscapeString(m_option_data.m_args[0]).c_str());
-      else
+                               EscapeString(target_path).c_str());
+      } else {
         commands_stream.Printf("target create %s",
-                               EscapeString(m_option_data.m_args[0]).c_str());
+                               EscapeString(target_path).c_str());
+      }
 
       if (!m_option_data.m_core_file.empty()) {
         commands_stream.Printf(" --core %s",
Index: lldb/lit/Driver/TestTarget.test
===================================================================
--- /dev/null
+++ lldb/lit/Driver/TestTarget.test
@@ -0,0 +1,7 @@
+# Make sure lldb resolves the target path.
+# RUN: mkdir -p %t/foo
+# RUN: cd %t/foo
+# RUN: %clang %p/Inputs/hello.c -g -o a.out
+# RUN: %lldb -b a.out | FileCheck %s
+
+# CHECK: target create "{{.*}}foo{{[/\\\\]+}}a.out"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65611.212924.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190801/b8161452/attachment.bin>


More information about the lldb-commits mailing list