alexshap updated this revision to Diff 80278.
alexshap added a comment.

Address comments


Repository:
  rL LLVM

https://reviews.llvm.org/D27380

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
       if (sc_list.GetSize() == original_size) {
         ArchSpec arch;
         if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-            (arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
-             arch.GetMachine() == llvm::Triple::hexagon)) {
+            arch.GetTriple().isOSBinFormatELF()) {
           SymbolContextList temp_sc_list;
           FindFunctions(name, m_function_basename_index, include_inlines,
                         temp_sc_list);
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1513,8 +1513,14 @@
     const uint32_t sub_type = subTypeFromElfHeader(header);
     arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
                               header.e_ident[EI_OSABI]);
-    //
-    // Validate if it is ok to remove GetOsFromOSABI
+    
+    // Validate if it is ok to remove GetOsFromOSABI.
+    // Note, that now the OS is determined based on EI_OSABI flag and
+    // the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+    // However in some cases that still might be not enough: for example
+    // a shared library might not have any notes at all
+    // and have EI_OSABI flag set to System V,
+    // as result the OS will be set to UnknownOS.
     GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
     spec_ostype = arch_spec.GetTriple().getOS();
     assert(spec_ostype == ostype);


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
       if (sc_list.GetSize() == original_size) {
         ArchSpec arch;
         if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-            (arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
-             arch.GetMachine() == llvm::Triple::hexagon)) {
+            arch.GetTriple().isOSBinFormatELF()) {
           SymbolContextList temp_sc_list;
           FindFunctions(name, m_function_basename_index, include_inlines,
                         temp_sc_list);
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1513,8 +1513,14 @@
     const uint32_t sub_type = subTypeFromElfHeader(header);
     arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
                               header.e_ident[EI_OSABI]);
-    //
-    // Validate if it is ok to remove GetOsFromOSABI
+    
+    // Validate if it is ok to remove GetOsFromOSABI.
+    // Note, that now the OS is determined based on EI_OSABI flag and
+    // the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+    // However in some cases that still might be not enough: for example
+    // a shared library might not have any notes at all
+    // and have EI_OSABI flag set to System V,
+    // as result the OS will be set to UnknownOS.
     GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
     spec_ostype = arch_spec.GetTriple().getOS();
     assert(spec_ostype == ostype);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to