[Lldb-commits] [lldb] r368182 - [Driver] Expand the executable path in the target create output

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 09:21:40 PDT 2019


Author: jdevlieghere
Date: Wed Aug  7 09:21:40 2019
New Revision: 368182

URL: http://llvm.org/viewvc/llvm-project?rev=368182&view=rev
Log:
[Driver] Expand the executable path in the target create output

Resolve the path in the target create output. This is nice when passing
relative paths to the lldb command line driver.

  $ lldb ./binary
  (lldb) target create "./binary"
  Current executable set to '/absolute/path/to/binary' (x86_64).

This change only affects the target create output and does not change
the debugger's behavior. It doesn't resolve symbolic links so it won't
cause confusing when debugging something like clang++ that's symlinked
to clang.

Differential revision: https://reviews.llvm.org/D65611

Added:
    lldb/trunk/lit/Driver/TestTarget.test
Modified:
    lldb/trunk/source/Commands/CommandObjectTarget.cpp

Added: lldb/trunk/lit/Driver/TestTarget.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestTarget.test?rev=368182&view=auto
==============================================================================
--- lldb/trunk/lit/Driver/TestTarget.test (added)
+++ lldb/trunk/lit/Driver/TestTarget.test Wed Aug  7 09:21:40 2019
@@ -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: Current executable set to '{{.*}}foo{{[/\\\\]+}}a.out'

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=368182&r1=368181&r2=368182&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Aug  7 09:21:40 2019
@@ -450,7 +450,8 @@ protected:
           }
         } else {
           result.AppendMessageWithFormat(
-              "Current executable set to '%s' (%s).\n", file_path,
+              "Current executable set to '%s' (%s).\n",
+              file_spec.GetPath().c_str(),
               target_sp->GetArchitecture().GetArchitectureName());
           result.SetStatus(eReturnStatusSuccessFinishNoResult);
         }




More information about the lldb-commits mailing list