This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf91446aa290: [lldb] Show the DBGError if dsymForUUID 
can't find a dSYM (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D123743?vs=422688&id=422985#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123743

Files:
  lldb/include/lldb/Symbol/LocateSymbolFile.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Interpreter/CommandReturnObject.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej
  lldb/test/Shell/SymbolFile/Inputs/a.yaml
  lldb/test/Shell/SymbolFile/Inputs/dsymforuuid.sh
  lldb/test/Shell/SymbolFile/add-dsym.test
  test/Shell/SymbolFile/Inputs/a.yaml
  test/Shell/SymbolFile/Inputs/dsymforuuid.sh
  test/Shell/SymbolFile/add-dsym.test

Index: test/Shell/SymbolFile/add-dsym.test
===================================================================
--- /dev/null
+++ test/Shell/SymbolFile/add-dsym.test
@@ -0,0 +1,5 @@
+# REQUIRES: system-darwin
+
+# RUN: yaml2obj %S/Inputs/a.yaml -o %t.out
+# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s
+# CHECK: UUID information was not found
Index: test/Shell/SymbolFile/Inputs/dsymforuuid.sh
===================================================================
--- /dev/null
+++ test/Shell/SymbolFile/Inputs/dsymforuuid.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\";>"
+echo "<plist version=\"1.0\">"
+echo "<dict>"
+echo "    <key>93483F20-FD9C-30AD-A72D-94EF12837DBA</key>"
+echo "    <dict>"
+echo "        <key>DBGArchitecture</key>"
+echo "        <string>arm64</string>"
+echo "        <key>DBGError</key>"
+echo "        <string>UUID information was not found</string>"
+echo "    </dict>"
+echo "</dict>"
+echo "</plist>"
Index: test/Shell/SymbolFile/Inputs/a.yaml
===================================================================
--- /dev/null
+++ test/Shell/SymbolFile/Inputs/a.yaml
@@ -0,0 +1,225 @@
+--- !mach-o
+FileHeader:
+  magic:           0xFEEDFACF
+  cputype:         0x100000C
+  cpusubtype:      0x0
+  filetype:        0x2
+  ncmds:           16
+  sizeofcmds:      824
+  flags:           0x200085
+  reserved:        0x0
+LoadCommands:
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         72
+    segname:         __PAGEZERO
+    vmaddr:          0
+    vmsize:          4294967296
+    fileoff:         0
+    filesize:        0
+    maxprot:         0
+    initprot:        0
+    nsects:          0
+    flags:           0
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         312
+    segname:         __TEXT
+    vmaddr:          4294967296
+    vmsize:          16384
+    fileoff:         0
+    filesize:        16384
+    maxprot:         5
+    initprot:        5
+    nsects:          3
+    flags:           0
+    Sections:
+      - sectname:        __text
+        segname:         __TEXT
+        addr:            0x100003F60
+        size:            32
+        offset:          0x3F60
+        align:           2
+        reloff:          0x0
+        nreloc:          0
+        flags:           0x80000400
+        reserved1:       0x0
+        reserved2:       0x0
+        reserved3:       0x0
+        content:         FF4300D1E80300AA00008052FF0F00B9E80B00B9E10300F9FF430091C0035FD6
+      - sectname:        __unwind_info
+        segname:         __TEXT
+        addr:            0x100003F80
+        size:            72
+        offset:          0x3F80
+        align:           2
+        reloff:          0x0
+        nreloc:          0
+        flags:           0x0
+        reserved1:       0x0
+        reserved2:       0x0
+        reserved3:       0x0
+        content:         010000001C000000000000001C000000000000001C00000002000000603F00003400000034000000813F00000000000034000000030000000C000100100001000000000014000003
+      - sectname:        __eh_frame
+        segname:         __TEXT
+        addr:            0x100003FC8
+        size:            56
+        offset:          0x3FC8
+        align:           3
+        reloff:          0x0
+        nreloc:          0
+        flags:           0x0
+        reserved1:       0x0
+        reserved2:       0x0
+        reserved3:       0x0
+        content:         1000000000000000017A520001781E01100C1F0020000000180000007CFFFFFFFFFFFFFF200000000000000000440E10580E000000000000
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         72
+    segname:         __LINKEDIT
+    vmaddr:          4294983680
+    vmsize:          16384
+    fileoff:         16384
+    filesize:        658
+    maxprot:         1
+    initprot:        1
+    nsects:          0
+    flags:           0
+  - cmd:             LC_DYLD_CHAINED_FIXUPS
+    cmdsize:         16
+    dataoff:         16384
+    datasize:        56
+  - cmd:             LC_DYLD_EXPORTS_TRIE
+    cmdsize:         16
+    dataoff:         16440
+    datasize:        48
+  - cmd:             LC_SYMTAB
+    cmdsize:         24
+    symoff:          16496
+    nsyms:           10
+    stroff:          16656
+    strsize:         104
+  - cmd:             LC_DYSYMTAB
+    cmdsize:         80
+    ilocalsym:       0
+    nlocalsym:       8
+    iextdefsym:      8
+    nextdefsym:      2
+    iundefsym:       10
+    nundefsym:       0
+    tocoff:          0
+    ntoc:            0
+    modtaboff:       0
+    nmodtab:         0
+    extrefsymoff:    0
+    nextrefsyms:     0
+    indirectsymoff:  0
+    nindirectsyms:   0
+    extreloff:       0
+    nextrel:         0
+    locreloff:       0
+    nlocrel:         0
+  - cmd:             LC_LOAD_DYLINKER
+    cmdsize:         32
+    name:            12
+    Content:         '/usr/lib/dyld'
+    ZeroPadBytes:    7
+  - cmd:             LC_UUID
+    cmdsize:         24
+    uuid:            93483F20-FD9C-30AD-A72D-94EF12837DBA
+  - cmd:             LC_BUILD_VERSION
+    cmdsize:         32
+    platform:        1
+    minos:           786432
+    sdk:             787456
+    ntools:          1
+    Tools:
+      - tool:            3
+        version:         53280768
+  - cmd:             LC_SOURCE_VERSION
+    cmdsize:         16
+    version:         0
+  - cmd:             LC_MAIN
+    cmdsize:         24
+    entryoff:        16224
+    stacksize:       0
+  - cmd:             LC_LOAD_DYLIB
+    cmdsize:         56
+    dylib:
+      name:            24
+      timestamp:       2
+      current_version: 85943299
+      compatibility_version: 65536
+    Content:         '/usr/lib/libSystem.B.dylib'
+    ZeroPadBytes:    6
+  - cmd:             LC_FUNCTION_STARTS
+    cmdsize:         16
+    dataoff:         16488
+    datasize:        8
+  - cmd:             LC_DATA_IN_CODE
+    cmdsize:         16
+    dataoff:         16496
+    datasize:        0
+  - cmd:             LC_CODE_SIGNATURE
+    cmdsize:         16
+    dataoff:         16768
+    datasize:        274
+LinkEditData:
+  NameList:
+    - n_strx:          28
+      n_type:          0x64
+      n_sect:          0
+      n_desc:          0
+      n_value:         0
+    - n_strx:          34
+      n_type:          0x64
+      n_sect:          0
+      n_desc:          0
+      n_value:         0
+    - n_strx:          38
+      n_type:          0x66
+      n_sect:          0
+      n_desc:          1
+      n_value:         1649980185
+    - n_strx:          1
+      n_type:          0x2E
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983520
+    - n_strx:          98
+      n_type:          0x24
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983520
+    - n_strx:          1
+      n_type:          0x24
+      n_sect:          0
+      n_desc:          0
+      n_value:         32
+    - n_strx:          1
+      n_type:          0x4E
+      n_sect:          1
+      n_desc:          0
+      n_value:         32
+    - n_strx:          1
+      n_type:          0x64
+      n_sect:          1
+      n_desc:          0
+      n_value:         0
+    - n_strx:          2
+      n_type:          0xF
+      n_sect:          1
+      n_desc:          16
+      n_value:         4294967296
+    - n_strx:          22
+      n_type:          0xF
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983520
+  StringTable:
+    - ' '
+    - __mh_execute_header
+    - _main
+    - '/tmp/'
+    - a.c
+    - '/var/folders/km/b6tpgq_d0zb2rz40pghbdsgr0000gn/T/a-03b2c9.o'
+    - _main
+  FunctionStarts:  [ 0x3F60 ]
+...
Index: lldb/test/Shell/SymbolFile/add-dsym.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/add-dsym.test
@@ -0,0 +1,5 @@
+# REQUIRES: system-darwin
+
+# RUN: yaml2obj %S/Inputs/a.yaml -o %t.out
+# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s
+# CHECK: UUID information was not found
Index: lldb/test/Shell/SymbolFile/Inputs/dsymforuuid.sh
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/Inputs/dsymforuuid.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\";>"
+echo "<plist version=\"1.0\">"
+echo "<dict>"
+echo "    <key>41945CA4-5D9D-3CDE-82B4-37E4C09750B5</key>"
+echo "    <dict>"
+echo "        <key>DBGArchitecture</key>"
+echo "        <string>x86_64</string>"
+echo "        <key>DBGError</key>"
+echo "        <string>UUID information was not found</string>"
+echo "    </dict>"
+echo "</dict>"
+echo "</plist>"
Index: lldb/test/Shell/SymbolFile/Inputs/a.yaml
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/Inputs/a.yaml
@@ -0,0 +1,204 @@
+--- !mach-o
+FileHeader:
+  magic:           0xFEEDFACF
+  cputype:         0x100000C
+  cpusubtype:      0x0
+  filetype:        0x2
+  ncmds:           16
+  sizeofcmds:      744
+  flags:           0x200085
+  reserved:        0x0
+LoadCommands:
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         72
+    segname:         __PAGEZERO
+    vmaddr:          0
+    vmsize:          4294967296
+    fileoff:         0
+    filesize:        0
+    maxprot:         0
+    initprot:        0
+    nsects:          0
+    flags:           0
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         232
+    segname:         __TEXT
+    vmaddr:          4294967296
+    vmsize:          16384
+    fileoff:         0
+    filesize:        16384
+    maxprot:         5
+    initprot:        5
+    nsects:          2
+    flags:           0
+    Sections:
+      - sectname:        __text
+        segname:         __TEXT
+        addr:            0x100003FB0
+        size:            8
+        offset:          0x3FB0
+        align:           2
+        reloff:          0x0
+        nreloc:          0
+        flags:           0x80000400
+        reserved1:       0x0
+        reserved2:       0x0
+        reserved3:       0x0
+        content:         00008052C0035FD6
+      - sectname:        __unwind_info
+        segname:         __TEXT
+        addr:            0x100003FB8
+        size:            72
+        offset:          0x3FB8
+        align:           2
+        reloff:          0x0
+        nreloc:          0
+        flags:           0x0
+        reserved1:       0x0
+        reserved2:       0x0
+        reserved3:       0x0
+        content:         010000001C000000000000001C000000000000001C00000002000000B03F00003400000034000000B93F00000000000034000000030000000C000100100001000000000000000002
+  - cmd:             LC_SEGMENT_64
+    cmdsize:         72
+    segname:         __LINKEDIT
+    vmaddr:          4294983680
+    vmsize:          16384
+    fileoff:         16384
+    filesize:        802
+    maxprot:         1
+    initprot:        1
+    nsects:          0
+    flags:           0
+  - cmd:             LC_DYLD_CHAINED_FIXUPS
+    cmdsize:         16
+    dataoff:         16384
+    datasize:        56
+  - cmd:             LC_DYLD_EXPORTS_TRIE
+    cmdsize:         16
+    dataoff:         16440
+    datasize:        48
+  - cmd:             LC_SYMTAB
+    cmdsize:         24
+    symoff:          16496
+    nsyms:           10
+    stroff:          16656
+    strsize:         232
+  - cmd:             LC_DYSYMTAB
+    cmdsize:         80
+    ilocalsym:       0
+    nlocalsym:       8
+    iextdefsym:      8
+    nextdefsym:      2
+    iundefsym:       10
+    nundefsym:       0
+    tocoff:          0
+    ntoc:            0
+    modtaboff:       0
+    nmodtab:         0
+    extrefsymoff:    0
+    nextrefsyms:     0
+    indirectsymoff:  0
+    nindirectsyms:   0
+    extreloff:       0
+    nextrel:         0
+    locreloff:       0
+    nlocrel:         0
+  - cmd:             LC_LOAD_DYLINKER
+    cmdsize:         32
+    name:            12
+    Content:         '/usr/lib/dyld'
+    ZeroPadBytes:    7
+  - cmd:             LC_UUID
+    cmdsize:         24
+    uuid:            41945CA4-5D9D-3CDE-82B4-37E4C09750B5
+  - cmd:             LC_BUILD_VERSION
+    cmdsize:         32
+    platform:        1
+    minos:           786432
+    sdk:             787456
+    ntools:          1
+    Tools:
+      - tool:            3
+        version:         53280768
+  - cmd:             LC_SOURCE_VERSION
+    cmdsize:         16
+    version:         0
+  - cmd:             LC_MAIN
+    cmdsize:         24
+    entryoff:        16304
+    stacksize:       0
+  - cmd:             LC_LOAD_DYLIB
+    cmdsize:         56
+    dylib:
+      name:            24
+      timestamp:       2
+      current_version: 85943299
+      compatibility_version: 65536
+    Content:         '/usr/lib/libSystem.B.dylib'
+    ZeroPadBytes:    6
+  - cmd:             LC_FUNCTION_STARTS
+    cmdsize:         16
+    dataoff:         16488
+    datasize:        8
+  - cmd:             LC_DATA_IN_CODE
+    cmdsize:         16
+    dataoff:         16496
+    datasize:        0
+  - cmd:             LC_CODE_SIGNATURE
+    cmdsize:         16
+    dataoff:         16896
+    datasize:        290
+LinkEditData:
+  NameList:
+    - n_strx:          28
+      n_type:          0x64
+      n_sect:          0
+      n_desc:          0
+      n_value:         0
+    - n_strx:          94
+      n_type:          0x64
+      n_sect:          0
+      n_desc:          0
+      n_value:         0
+    - n_strx:          122
+      n_type:          0x66
+      n_sect:          0
+      n_desc:          1
+      n_value:         1649891386
+    - n_strx:          1
+      n_type:          0x2E
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983600
+    - n_strx:          223
+      n_type:          0x24
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983600
+    - n_strx:          1
+      n_type:          0x24
+      n_sect:          0
+      n_desc:          0
+      n_value:         8
+    - n_strx:          1
+      n_type:          0x4E
+      n_sect:          1
+      n_desc:          0
+      n_value:         8
+    - n_strx:          1
+      n_type:          0x64
+      n_sect:          1
+      n_desc:          0
+      n_value:         0
+    - n_strx:          2
+      n_type:          0xF
+      n_sect:          1
+      n_desc:          16
+      n_value:         4294967296
+    - n_strx:          22
+      n_type:          0xF
+      n_sect:          1
+      n_desc:          0
+      n_value:         4294983600
+  FunctionStarts:  [ 0x3FB0 ]
+...
Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej
===================================================================
--- /dev/null
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej
@@ -0,0 +1,16 @@
+***************
+*** 337,343 ****
+  
+      std::string DBGBuildSourcePath;
+      std::string DBGSourcePath;
+-     std::string DBGError;
+  
+      // If DBGVersion 1 or DBGVersion missing, ignore DBGSourcePathRemapping.
+      // If DBGVersion 2, strip last two components of path remappings from
+--- 346,351 ----
+  
+      std::string DBGBuildSourcePath;
+      std::string DBGSourcePath;
+  
+      // If DBGVersion 1 or DBGVersion missing, ignore DBGSourcePathRemapping.
+      // If DBGVersion 2, strip last two components of path remappings from
Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===================================================================
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -298,7 +298,8 @@
 }
 
 static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
-                                                ModuleSpec &module_spec) {
+                                                ModuleSpec &module_spec,
+                                                Status &error) {
   Log *log = GetLog(LLDBLog::Host);
   bool success = false;
   if (uuid_dict != NULL && CFGetTypeID(uuid_dict) == CFDictionaryGetTypeID()) {
@@ -306,6 +307,14 @@
     CFStringRef cf_str;
     CFDictionaryRef cf_dict;
 
+    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
+                                               CFSTR("DBGError"));
+    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
+      if (CFCString::FileSystemRepresentation(cf_str, str)) {
+        error.SetErrorString(str);
+      }
+    }
+
     cf_str = (CFStringRef)CFDictionaryGetValue(
         (CFDictionaryRef)uuid_dict, CFSTR("DBGSymbolRichExecutable"));
     if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
@@ -457,7 +466,7 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-                                          bool force_lookup) {
+                                          Status &error, bool force_lookup) {
   bool success = false;
   const UUID *uuid_ptr = module_spec.GetUUIDPtr();
   const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
@@ -577,7 +586,7 @@
             LLDB_LOGF(log, "Calling %s with file %s to find dSYM",
                       g_dsym_for_uuid_exe_path, file_path);
         }
-        Status error = Host::RunShellCommand(
+        error = Host::RunShellCommand(
             command.GetData(),
             FileSpec(),      // current working directory
             &exit_status,    // Exit status
@@ -601,8 +610,8 @@
               CFCString uuid_cfstr(uuid_str.c_str());
               CFDictionaryRef uuid_dict = (CFDictionaryRef)CFDictionaryGetValue(
                   plist.get(), uuid_cfstr.get());
-              success =
-                  GetModuleSpecInfoFromUUIDDictionary(uuid_dict, module_spec);
+              success = GetModuleSpecInfoFromUUIDDictionary(uuid_dict,
+                                                            module_spec, error);
             } else {
               const CFIndex num_values = ::CFDictionaryGetCount(plist.get());
               if (num_values > 0) {
@@ -611,14 +620,14 @@
                 ::CFDictionaryGetKeysAndValues(plist.get(), NULL,
                                                (const void **)&values[0]);
                 if (num_values == 1) {
-                  success = GetModuleSpecInfoFromUUIDDictionary(values[0],
-                                                                module_spec);
+                  success = GetModuleSpecInfoFromUUIDDictionary(
+                      values[0], module_spec, error);
                   return success;
                 } else {
                   for (CFIndex i = 0; i < num_values; ++i) {
                     ModuleSpec curr_module_spec;
-                    if (GetModuleSpecInfoFromUUIDDictionary(values[i],
-                                                            curr_module_spec)) {
+                    if (GetModuleSpecInfoFromUUIDDictionary(
+                            values[i], curr_module_spec, error)) {
                       if (module_spec.GetArchitecture().IsCompatibleMatch(
                               curr_module_spec.GetArchitecture())) {
                         module_spec = curr_module_spec;
Index: lldb/source/Symbol/LocateSymbolFile.cpp
===================================================================
--- lldb/source/Symbol/LocateSymbolFile.cpp
+++ lldb/source/Symbol/LocateSymbolFile.cpp
@@ -130,7 +130,8 @@
 
   if (FileSystem::Instance().Exists(dsym_yaa_fspec)) {
     ModuleSpec mutable_mod_spec = mod_spec;
-    if (Symbols::DownloadObjectAndSymbolFile(mutable_mod_spec, true) &&
+    Status error;
+    if (Symbols::DownloadObjectAndSymbolFile(mutable_mod_spec, error, true) &&
         FileSystem::Instance().Exists(mutable_mod_spec.GetSymbolFileSpec())) {
       dsym_fspec = mutable_mod_spec.GetSymbolFileSpec();
       return true;
@@ -390,7 +391,7 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-                                          bool force_lookup) {
+                                          Status &error, bool force_lookup) {
   // Fill in the module_spec.GetFileSpec() for the object file and/or the
   // module_spec.GetSymbolFileSpec() for the debug symbols file.
   return false;
Index: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===================================================================
--- lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -198,8 +198,10 @@
 
     if (!module_sp.get()) {
       // Force a a dsymForUUID lookup, if that tool is available.
-      if (!module_spec.GetSymbolFileSpec())
-        Symbols::DownloadObjectAndSymbolFile(module_spec, true);
+      if (!module_spec.GetSymbolFileSpec()) {
+        Status error;
+        Symbols::DownloadObjectAndSymbolFile(module_spec, error, true);
+      }
 
       if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
         module_sp = std::make_shared<Module>(module_spec);
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -591,8 +591,10 @@
 
           if (!module_sp) {
             // Force a an external lookup, if that tool is available.
-            if (!module_spec.GetSymbolFileSpec())
-              Symbols::DownloadObjectAndSymbolFile(module_spec, true);
+            if (!module_spec.GetSymbolFileSpec()) {
+              Status error;
+              Symbols::DownloadObjectAndSymbolFile(module_spec, error, true);
+            }
 
             if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
               module_sp = std::make_shared<Module>(module_spec);
Index: lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
===================================================================
--- lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -290,8 +290,11 @@
                 }
               }
               if (!module_spec.GetSymbolFileSpec() ||
-                  !module_spec.GetSymbolFileSpec())
-                Symbols::DownloadObjectAndSymbolFile(module_spec, true);
+                  !module_spec.GetSymbolFileSpec()) {
+                Status symbl_error;
+                Symbols::DownloadObjectAndSymbolFile(module_spec, symbl_error,
+                                                     true);
+              }
 
               if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
                 ModuleSP module_sp(new Module(module_spec));
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6967,7 +6967,8 @@
       module_spec.GetFileSpec() = FileSpec(image.filename.c_str());
     }
     if (image.currently_executing) {
-      Symbols::DownloadObjectAndSymbolFile(module_spec, true);
+      Status error;
+      Symbols::DownloadObjectAndSymbolFile(module_spec, error, true);
       if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
         process.GetTarget().GetOrCreateModule(module_spec, false);
       }
Index: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -790,7 +790,8 @@
       // exists, instead of depending on the DebugSymbols preferences being
       // set.
       if (IsKernel()) {
-        if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) {
+        Status error;
+        if (Symbols::DownloadObjectAndSymbolFile(module_spec, error, true)) {
           if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) {
             m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(),
                                                    target.GetArchitecture());
Index: lldb/source/Interpreter/CommandReturnObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -106,7 +106,8 @@
 
 void CommandReturnObject::SetError(const Status &error,
                                    const char *fallback_error_cstr) {
-  AppendError(error.AsCString(fallback_error_cstr));
+  if (error.Fail())
+    AppendError(error.AsCString(fallback_error_cstr));
 }
 
 void CommandReturnObject::SetError(llvm::Error error) {
Index: lldb/source/Commands/CommandObjectTarget.cpp
===================================================================
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -2464,7 +2464,8 @@
         if (m_symbol_file.GetOptionValue().OptionWasSet())
           module_spec.GetSymbolFileSpec() =
               m_symbol_file.GetOptionValue().GetCurrentValue();
-        if (Symbols::DownloadObjectAndSymbolFile(module_spec)) {
+        Status error;
+        if (Symbols::DownloadObjectAndSymbolFile(module_spec, error)) {
           ModuleSP module_sp(
               target->GetOrCreateModule(module_spec, true /* notify */));
           if (module_sp) {
@@ -2500,6 +2501,7 @@
           result.AppendErrorWithFormat(
               "Unable to locate the executable or symbol file with UUID %s",
               strm.GetData());
+          result.SetError(error);
           return false;
         }
       } else {
@@ -4165,10 +4167,13 @@
 
   bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
                                    CommandReturnObject &result, bool &flush) {
-    if (Symbols::DownloadObjectAndSymbolFile(module_spec)) {
+    Status error;
+    if (Symbols::DownloadObjectAndSymbolFile(module_spec, error)) {
       if (module_spec.GetSymbolFileSpec())
         return AddModuleSymbols(m_exe_ctx.GetTargetPtr(), module_spec, flush,
                                 result);
+    } else {
+      result.SetError(error);
     }
     return false;
   }
Index: lldb/include/lldb/Symbol/LocateSymbolFile.h
===================================================================
--- lldb/include/lldb/Symbol/LocateSymbolFile.h
+++ lldb/include/lldb/Symbol/LocateSymbolFile.h
@@ -13,6 +13,7 @@
 
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
 
 namespace lldb_private {
 
@@ -50,6 +51,7 @@
   // enabled the external program before calling.
   //
   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
+                                          Status &error,
                                           bool force_lookup = true);
 };
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to