Re: [Lldb-commits] [PATCH] D12671: [LLDB][MIPS] Added support for the debugging of N32/O32 applications on MIPS64 target.

2015-09-09 Thread Mohit Bhakkad via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247134: [LLDB][MIPS] Added support for the debugging of 
N32/O32 applications on… (authored by mohit.bhakkad).

Changed prior to commit:
  http://reviews.llvm.org/D12671?vs=34146&id=34314#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12671

Files:
  lldb/trunk/include/lldb/Core/ArchSpec.h
  lldb/trunk/source/Core/ArchSpec.cpp
  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
@@ -1517,32 +1517,42 @@
  I != section_headers.end(); ++I)
 {
 static ConstString g_sect_name_gnu_debuglink (".gnu_debuglink");
-const ELFSectionHeaderInfo &header = *I;
-const uint64_t section_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+const ELFSectionHeaderInfo &sheader = *I;
+const uint64_t section_size = sheader.sh_type == SHT_NOBITS ? 0 : sheader.sh_size;
 ConstString name(shstr_data.PeekCStr(I->sh_name));
 
 I->section_name = name;
 
 if (arch_spec.GetMachine() == llvm::Triple::mips || arch_spec.GetMachine() == llvm::Triple::mipsel
 || arch_spec.GetMachine() == llvm::Triple::mips64 || arch_spec.GetMachine() == llvm::Triple::mips64el)
 {
-if (header.sh_type == SHT_MIPS_ABIFLAGS)
+uint32_t arch_flags = arch_spec.GetFlags ();
+DataExtractor data;
+if (sheader.sh_type == SHT_MIPS_ABIFLAGS)
 {
-DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0
-uint32_t arch_flags = arch_spec.GetFlags ();
 arch_flags |= data.GetU32 (&ase_offset);
-arch_spec.SetFlags (arch_flags);
 }
 }
+// Settings appropriate ArchSpec ABI Flags
+if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
+{   
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
+}
+else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
+{
+ arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;   
+}
+arch_spec.SetFlags (arch_flags);
 }
 
 if (name == g_sect_name_gnu_debuglink)
 {
 DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t gnu_debuglink_offset = 0;
 gnu_debuglink_file = data.GetCStr (&gnu_debuglink_offset);
@@ -1552,7 +1562,7 @@
 }
 
 // Process ELF note section entries.
-bool is_note_header = (header.sh_type == SHT_NOTE);
+bool is_note_header = (sheader.sh_type == SHT_NOTE);
 
 // The section header ".note.android.ident" is stored as a
 // PROGBITS type header but it is actually a note header.
@@ -1564,7 +1574,7 @@
 {
 // Allow notes to refine module info.
 DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 Error error = RefineModuleDetailsFromNote (data, arch_spec, uuid);
 if (error.Fail ())
Index: lldb/trunk/source/Core/ArchSpec.cpp
===
--- lldb/trunk/source/Core/ArchSpec.cpp
+++ lldb/trunk/source/Core/ArchSpec.cpp
@@ -602,7 +602,15 @@
 {
 const CoreDefinition *core_def = FindCoreDefinition (m_core);
 if (core_def)
-return core_def->addr_byte_size;
+{ 
+   if (core_def->machine == llvm::Triple::mips64 || core_def->machine == llvm::Triple::mips64e

Re: [Lldb-commits] [PATCH] D12671: [LLDB][MIPS] Added support for the debugging of N32/O32 applications on MIPS64 target.

2015-09-07 Thread Nitesh Jain via lldb-commits
nitesh.jain updated the summary for this revision.
nitesh.jain updated this revision to Diff 34146.
nitesh.jain added a comment.

Added include/lldb/Core/ArchSpec.h diff


Repository:
  rL LLVM

http://reviews.llvm.org/D12671

Files:
  include/lldb/Core/ArchSpec.h
  source/Core/ArchSpec.cpp
  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
@@ -1517,8 +1517,8 @@
  I != section_headers.end(); ++I)
 {
 static ConstString g_sect_name_gnu_debuglink (".gnu_debuglink");
-const ELFSectionHeaderInfo &header = *I;
-const uint64_t section_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+const ELFSectionHeaderInfo &sheader = *I;
+const uint64_t section_size = sheader.sh_type == SHT_NOBITS ? 0 : sheader.sh_size;
 ConstString name(shstr_data.PeekCStr(I->sh_name));
 
 I->section_name = name;
@@ -1526,23 +1526,33 @@
 if (arch_spec.GetMachine() == llvm::Triple::mips || arch_spec.GetMachine() == llvm::Triple::mipsel
 || arch_spec.GetMachine() == llvm::Triple::mips64 || arch_spec.GetMachine() == llvm::Triple::mips64el)
 {
-if (header.sh_type == SHT_MIPS_ABIFLAGS)
+uint32_t arch_flags = arch_spec.GetFlags ();
+DataExtractor data;
+if (sheader.sh_type == SHT_MIPS_ABIFLAGS)
 {
-DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0
-uint32_t arch_flags = arch_spec.GetFlags ();
 arch_flags |= data.GetU32 (&ase_offset);
-arch_spec.SetFlags (arch_flags);
 }
 }
+// Settings appropriate ArchSpec ABI Flags
+if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
+{   
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
+}
+else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
+{
+ arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;   
+}
+arch_spec.SetFlags (arch_flags);
 }
 
 if (name == g_sect_name_gnu_debuglink)
 {
 DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t gnu_debuglink_offset = 0;
 gnu_debuglink_file = data.GetCStr (&gnu_debuglink_offset);
@@ -1552,7 +1562,7 @@
 }
 
 // Process ELF note section entries.
-bool is_note_header = (header.sh_type == SHT_NOTE);
+bool is_note_header = (sheader.sh_type == SHT_NOTE);
 
 // The section header ".note.android.ident" is stored as a
 // PROGBITS type header but it is actually a note header.
@@ -1564,7 +1574,7 @@
 {
 // Allow notes to refine module info.
 DataExtractor data;
-if (section_size && (data.SetData (object_data, header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
 {
 Error error = RefineModuleDetailsFromNote (data, arch_spec, uuid);
 if (error.Fail ())
Index: source/Core/ArchSpec.cpp
===
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -602,7 +602,15 @@
 {
 const CoreDefinition *core_def = FindCoreDefinition (m_core);
 if (core_def)
-return core_def->addr_byte_size;
+{ 
+   if (core_def->machine == llvm::Triple::mips64 || core_def->machine == llvm::Triple::mips64el)
+   {  
+  // For N32/O32 applications Address size is 4 bytes.
+  if (m_flags & (eMIPSABI_N32 | eMIPSABI_O32))
+  return 4;
+   }
+   return core_def

[Lldb-commits] [PATCH] D12671: [LLDB][MIPS] Added support for the debugging of N32/O32 applications on MIPS64 target.

2015-09-07 Thread Nitesh Jain via lldb-commits
nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, ovyalov.
nitesh.jain added subscribers: jaydeep, bhushan, sagar, mohit.bhakkad, 
lldb-commits.
nitesh.jain set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

http://reviews.llvm.org/D12671

Files:
  source/Core/ArchSpec.cpp
  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
@@ -1517,8 +1517,8 @@
  I != section_headers.end(); ++I)
 {
 static ConstString g_sect_name_gnu_debuglink 
(".gnu_debuglink");
-const ELFSectionHeaderInfo &header = *I;
-const uint64_t section_size = header.sh_type == SHT_NOBITS ? 0 
: header.sh_size;
+const ELFSectionHeaderInfo &sheader = *I;
+const uint64_t section_size = sheader.sh_type == SHT_NOBITS ? 
0 : sheader.sh_size;
 ConstString name(shstr_data.PeekCStr(I->sh_name));
 
 I->section_name = name;
@@ -1526,23 +1526,33 @@
 if (arch_spec.GetMachine() == llvm::Triple::mips || 
arch_spec.GetMachine() == llvm::Triple::mipsel
 || arch_spec.GetMachine() == llvm::Triple::mips64 || 
arch_spec.GetMachine() == llvm::Triple::mips64el)
 {
-if (header.sh_type == SHT_MIPS_ABIFLAGS)
+uint32_t arch_flags = arch_spec.GetFlags ();
+DataExtractor data;
+if (sheader.sh_type == SHT_MIPS_ABIFLAGS)
 {
-DataExtractor data;
-if (section_size && (data.SetData (object_data, 
header.sh_offset, section_size) == section_size))
+
+if (section_size && (data.SetData (object_data, 
sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t ase_offset = 12; // MIPS ABI Flags 
Version: 0
-uint32_t arch_flags = arch_spec.GetFlags ();
 arch_flags |= data.GetU32 (&ase_offset);
-arch_spec.SetFlags (arch_flags);
 }
 }
+// Settings appropriate ArchSpec ABI Flags
+if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
+{   
+arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
+}
+else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
+{
+ arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;   

+}
+arch_spec.SetFlags (arch_flags);
 }
 
 if (name == g_sect_name_gnu_debuglink)
 {
 DataExtractor data;
-if (section_size && (data.SetData (object_data, 
header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, 
sheader.sh_offset, section_size) == section_size))
 {
 lldb::offset_t gnu_debuglink_offset = 0;
 gnu_debuglink_file = data.GetCStr 
(&gnu_debuglink_offset);
@@ -1552,7 +1562,7 @@
 }
 
 // Process ELF note section entries.
-bool is_note_header = (header.sh_type == SHT_NOTE);
+bool is_note_header = (sheader.sh_type == SHT_NOTE);
 
 // The section header ".note.android.ident" is stored as a
 // PROGBITS type header but it is actually a note header.
@@ -1564,7 +1574,7 @@
 {
 // Allow notes to refine module info.
 DataExtractor data;
-if (section_size && (data.SetData (object_data, 
header.sh_offset, section_size) == section_size))
+if (section_size && (data.SetData (object_data, 
sheader.sh_offset, section_size) == section_size))
 {
 Error error = RefineModuleDetailsFromNote (data, 
arch_spec, uuid);
 if (error.Fail ())
Index: source/Core/ArchSpec.cpp
===
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -602,7 +602,15 @@
 {
 const CoreDefinition *core_def = FindCoreDefinition (m_core);
 if (core_def)
-return core_def->addr_byte_size;
+{ 
+   if (core_def->machine == llvm::Triple::mips64 || core_def->machine == 
llvm::Triple::mips64el)
+   {  
+  // For N32/O32 applications Address size is 4 bytes.
+  if (m_flags & (eMIPSABI_N32 | eMIPSABI_O32))
+