[Lldb-commits] [PATCH] D36358: [lldb] [cmake] Add explicit linkage from Core to curses

2017-08-14 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Ping.


https://reviews.llvm.org/D36358



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


[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] Set the Section's file address for ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set

2017-08-14 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain updated this revision to Diff 110924.
nitesh.jain retitled this revision from "[LLDB][MIPS] The symbol with NOTYPE 
and having section type debug doesn't contain any valid address" to 
"[LLDB][MIPS] Set the Section's file address for ELF section to 
LLDB_INVALID_ADDRESS if SHF_ALLOC is not set".
nitesh.jain edited the summary of this revision.
nitesh.jain added a comment.

Update diff as per suggestion. Thanks Greg for your suggestion.

Thanks,
Nitesh


https://reviews.llvm.org/D35784

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1987,7 +1987,9 @@
   ? m_arch_spec.GetDataByteSize()
   : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
   : 1;
-
+  const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+? header.sh_addr
+: LLDB_INVALID_ADDRESS;
   elf::elf_xword log2align =
   (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
   SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@
   SectionIndex(I), // Section ID.
   name,// Section name.
   sect_type,   // Section type.
-  header.sh_addr,  // VM address.
+  sect_file_addr,  // VM address.
   vm_size, // VM size in bytes of this section.
   header.sh_offset,// Offset of this section in the file.
   file_size,   // Size of the section as found in the file.


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1987,7 +1987,9 @@
   ? m_arch_spec.GetDataByteSize()
   : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
   : 1;
-
+  const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+? header.sh_addr
+: LLDB_INVALID_ADDRESS;
   elf::elf_xword log2align =
   (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
   SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@
   SectionIndex(I), // Section ID.
   name,// Section name.
   sect_type,   // Section type.
-  header.sh_addr,  // VM address.
+  sect_file_addr,  // VM address.
   vm_size, // VM size in bytes of this section.
   header.sh_offset,// Offset of this section in the file.
   file_size,   // Size of the section as found in the file.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] Set the Section's file address for ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set

2017-08-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Glad this worked.


https://reviews.llvm.org/D35784



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


[Lldb-commits] [lldb] r310855 - [LLDB][MIPS] Set the Section's file address for

2017-08-14 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Mon Aug 14 09:30:25 2017
New Revision: 310855

URL: http://llvm.org/viewvc/llvm-project?rev=310855&view=rev
Log:
[LLDB][MIPS] Set the Section's file address for
ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=310855&r1=310854&r2=310855&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Aug 14 
09:30:25 2017
@@ -1987,7 +1987,9 @@ void ObjectFileELF::CreateSections(Secti
   ? m_arch_spec.GetDataByteSize()
   : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
   : 1;
-
+  const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+? header.sh_addr
+: LLDB_INVALID_ADDRESS;
   elf::elf_xword log2align =
   (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
   SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@ void ObjectFileELF::CreateSections(Secti
   SectionIndex(I), // Section ID.
   name,// Section name.
   sect_type,   // Section type.
-  header.sh_addr,  // VM address.
+  sect_file_addr,  // VM address.
   vm_size, // VM size in bytes of this section.
   header.sh_offset,// Offset of this section in the file.
   file_size,   // Size of the section as found in the file.


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


[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] Set the Section's file address for ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set

2017-08-14 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310855: [LLDB][MIPS] Set the Section's file address for 
(authored by nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D35784?vs=110924&id=111006#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35784

Files:
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1987,7 +1987,9 @@
   ? m_arch_spec.GetDataByteSize()
   : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
   : 1;
-
+  const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+? header.sh_addr
+: LLDB_INVALID_ADDRESS;
   elf::elf_xword log2align =
   (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
   SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@
   SectionIndex(I), // Section ID.
   name,// Section name.
   sect_type,   // Section type.
-  header.sh_addr,  // VM address.
+  sect_file_addr,  // VM address.
   vm_size, // VM size in bytes of this section.
   header.sh_offset,// Offset of this section in the file.
   file_size,   // Size of the section as found in the file.


Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1987,7 +1987,9 @@
   ? m_arch_spec.GetDataByteSize()
   : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
   : 1;
-
+  const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+? header.sh_addr
+: LLDB_INVALID_ADDRESS;
   elf::elf_xword log2align =
   (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
   SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@
   SectionIndex(I), // Section ID.
   name,// Section name.
   sect_type,   // Section type.
-  header.sh_addr,  // VM address.
+  sect_file_addr,  // VM address.
   vm_size, // VM size in bytes of this section.
   header.sh_offset,// Offset of this section in the file.
   file_size,   // Size of the section as found in the file.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r310856 - [LLDB][MIPS] Fix process load/unload on android.

2017-08-14 Thread Nitesh Jain via lldb-commits
Author: nitesh.jain
Date: Mon Aug 14 09:39:16 2017
New Revision: 310856

URL: http://llvm.org/viewvc/llvm-project?rev=310856&view=rev
Log:
[LLDB][MIPS] Fix process load/unload on android.

To detect the correct function name based on the list of available symbols 
instead of the SDK version

Reviewers: tberghammer, clayborg

Subscribers: jaydeep, bhushan, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=310856&r1=310855&r2=310856&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Mon Aug 14 
09:39:16 2017
@@ -21,6 +21,7 @@
 #include "AdbClient.h"
 #include "PlatformAndroid.h"
 #include "PlatformAndroidRemoteGDBServer.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -366,9 +367,22 @@ bool PlatformAndroid::GetRemoteOSVersion
   return m_major_os_version != 0;
 }
 
-llvm::StringRef PlatformAndroid::GetLibdlFunctionDeclarations() {
+llvm::StringRef
+PlatformAndroid::GetLibdlFunctionDeclarations(lldb_private::Process *process) {
+  SymbolContextList matching_symbols;
+  std::vector dl_open_names = { "__dl_dlopen", "dlopen" };
+  const char *dl_open_name = nullptr;
+  Target &target = process->GetTarget();
+  for (auto name: dl_open_names) {
+if (target.GetImages().FindFunctionSymbols(ConstString(name),
+   eFunctionNameTypeFull,
+   matching_symbols)) {
+   dl_open_name = name;
+   break;
+}
+  }
   // Older platform versions have the dl function symbols mangled
-  if (GetSdkVersion() < 26)
+  if (dl_open_name == dl_open_names[0])
 return R"(
   extern "C" void* dlopen(const char*, int) asm("__dl_dlopen");
   extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym");
@@ -376,7 +390,7 @@ llvm::StringRef PlatformAndroid::GetLibd
   extern "C" char* dlerror(void) asm("__dl_dlerror");
  )";
 
-  return PlatformPOSIX::GetLibdlFunctionDeclarations();
+  return PlatformPOSIX::GetLibdlFunctionDeclarations(process);
 }
 
 AdbClient::SyncService *PlatformAndroid::GetSyncService(Status &error) {

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h?rev=310856&r1=310855&r2=310856&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h Mon Aug 14 
09:39:16 2017
@@ -76,7 +76,8 @@ protected:
   Status DownloadSymbolFile(const lldb::ModuleSP &module_sp,
 const FileSpec &dst_file_spec) override;
 
-  llvm::StringRef GetLibdlFunctionDeclarations() override;
+  llvm::StringRef
+  GetLibdlFunctionDeclarations(lldb_private::Process *process) override;
 
 private:
   AdbClient::SyncService *GetSyncService(Status &error);

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=310856&r1=310855&r2=310856&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Mon Aug 14 
09:39:16 2017
@@ -944,7 +944,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb
the_result;
   )",
   path);
-  llvm::StringRef prefix = GetLibdlFunctionDeclarations();
+  llvm::StringRef prefix = GetLibdlFunctionDeclarations(process);
   lldb::ValueObjectSP result_valobj_sp;
   error = EvaluateLibdlExpression(process, expr.GetData(), prefix,
   result_valobj_sp);
@@ -992,7 +992,7 @@ Status PlatformPOSIX::UnloadImage(lldb_p
 
   StreamString expr;
   expr.Printf("dlclose((void *)0x%" PRIx64 ")", image_addr);
-  llvm::StringRef prefix = GetLibdlFunctionDeclarations();
+  llvm::StringRef prefix = GetLibdlFunctionDeclarations(process);
   lldb::ValueObjectSP result_valobj_sp;
   Status error = EvaluateLibdlExpression(process, expr.GetData(), prefix,
  result_valobj_sp);
@@ -1024,7 +1024,8 @@ lldb::ProcessSP PlatformP