[Lldb-commits] [lldb] r320704 - Remove stderr message from GDBRemoteCommunicationServerLLGS

2017-12-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec 14 06:56:29 2017
New Revision: 320704

URL: http://llvm.org/viewvc/llvm-project?rev=320704&view=rev
Log:
Remove stderr message from GDBRemoteCommunicationServerLLGS

A similar error message is printed again in lldb-gdbserver.cpp, so the
user will see the message twice. Also, this is generic library code, we
shouldn't really be using stderr here.

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=320704&r1=320703&r2=320704&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Thu Dec 14 06:56:29 2017
@@ -244,13 +244,8 @@ Status GDBRemoteCommunicationServerLLGS:
  "process but one already exists");
 auto process_or =
 m_process_factory.Launch(m_process_launch_info, *this, m_mainloop);
-if (!process_or) {
-  Status status(process_or.takeError());
-  llvm::errs() << llvm::formatv(
-  "failed to launch executable `{0}`: {1}",
-  m_process_launch_info.GetArguments().GetArgumentAtIndex(0), status);
-  return status;
-}
+if (!process_or)
+  return Status(process_or.takeError());
 m_debugged_process_up = std::move(*process_or);
   }
 


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


[Lldb-commits] [lldb] r320705 - ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion

2017-12-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec 14 06:56:45 2017
New Revision: 320705

URL: http://llvm.org/viewvc/llvm-project?rev=320705&view=rev
Log:
ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion

Summary:
These two functions were calling each other, while handling different
branches of the if(IsInMemory()). This had a reason at some point in the
past, but right now it's just confusing.

I resolve this by removing the MemoryMapSectionData function and
inlining the !IsInMemory branch into ReadSectionData. There isn't
anything mmap-related in this function anyway, as the decision whether
to mmap is handled at a higher level.

This is a preparatory step to make ObjectFileELF be able to decompress
compressed sections (I want to make sure that all calls reading section
data are routed through a single piece of code).

Reviewers: clayborg

Subscribers: emaste, JDevlieghere, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=320705&r1=320704&r2=320705&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Thu Dec 14 06:56:45 2017
@@ -805,9 +805,6 @@ public:
   virtual size_t ReadSectionData(Section *section,
  DataExtractor §ion_data);
 
-  size_t MemoryMapSectionData(Section *section,
-  DataExtractor §ion_data);
-
   bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
 
   // Strip linker annotations (such as @@VERSION) from symbol names.

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=320705&r1=320704&r2=320705&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Dec 14 
06:56:45 2017
@@ -444,10 +444,8 @@ void SymbolFileDWARF::InitializeObject()
 Section *section =
 section_list->FindSectionByName(GetDWARFMachOSegmentName()).get();
 
-// Memory map the DWARF mach-o segment so we have everything mmap'ed
-// to keep our heap memory usage down.
 if (section)
-  m_obj_file->MemoryMapSectionData(section, m_dwarf_data);
+  m_obj_file->ReadSectionData(section, m_dwarf_data);
   }
 
   get_apple_names_data();

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=320705&r1=320704&r2=320705&view=diff
==
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Thu Dec 14 06:56:45 2017
@@ -561,25 +561,9 @@ size_t ObjectFile::ReadSectionData(Secti
   } else {
 // The object file now contains a full mmap'ed copy of the object file 
data,
 // so just use this
-return MemoryMapSectionData(section, section_data);
-  }
-}
-
-size_t ObjectFile::MemoryMapSectionData(Section *section,
-DataExtractor §ion_data) {
-  // If some other objectfile owns this data, pass this to them.
-  if (section->GetObjectFile() != this)
-return section->GetObjectFile()->MemoryMapSectionData(section,
-  section_data);
-
-  if (IsInMemory()) {
-return ReadSectionData(section, section_data);
-  } else {
 if (!section->IsRelocated())
   RelocateSection(section);
 
-// The object file now contains a full mmap'ed copy of the object file 
data,
-// so just use this
 return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
   }


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


[Lldb-commits] [PATCH] D41169: ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion

2017-12-14 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320705: ObjectFile: remove 
ReadSectionData/MemoryMapSectionData mutual recursion (authored by labath, 
committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41169?vs=126723&id=126949#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41169

Files:
  lldb/trunk/include/lldb/Symbol/ObjectFile.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Symbol/ObjectFile.cpp


Index: lldb/trunk/source/Symbol/ObjectFile.cpp
===
--- lldb/trunk/source/Symbol/ObjectFile.cpp
+++ lldb/trunk/source/Symbol/ObjectFile.cpp
@@ -561,25 +561,9 @@
   } else {
 // The object file now contains a full mmap'ed copy of the object file 
data,
 // so just use this
-return MemoryMapSectionData(section, section_data);
-  }
-}
-
-size_t ObjectFile::MemoryMapSectionData(Section *section,
-DataExtractor §ion_data) {
-  // If some other objectfile owns this data, pass this to them.
-  if (section->GetObjectFile() != this)
-return section->GetObjectFile()->MemoryMapSectionData(section,
-  section_data);
-
-  if (IsInMemory()) {
-return ReadSectionData(section, section_data);
-  } else {
 if (!section->IsRelocated())
   RelocateSection(section);
 
-// The object file now contains a full mmap'ed copy of the object file 
data,
-// so just use this
 return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
   }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -444,10 +444,8 @@
 Section *section =
 section_list->FindSectionByName(GetDWARFMachOSegmentName()).get();
 
-// Memory map the DWARF mach-o segment so we have everything mmap'ed
-// to keep our heap memory usage down.
 if (section)
-  m_obj_file->MemoryMapSectionData(section, m_dwarf_data);
+  m_obj_file->ReadSectionData(section, m_dwarf_data);
   }
 
   get_apple_names_data();
Index: lldb/trunk/include/lldb/Symbol/ObjectFile.h
===
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h
@@ -805,9 +805,6 @@
   virtual size_t ReadSectionData(Section *section,
  DataExtractor §ion_data);
 
-  size_t MemoryMapSectionData(Section *section,
-  DataExtractor §ion_data);
-
   bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
 
   // Strip linker annotations (such as @@VERSION) from symbol names.


Index: lldb/trunk/source/Symbol/ObjectFile.cpp
===
--- lldb/trunk/source/Symbol/ObjectFile.cpp
+++ lldb/trunk/source/Symbol/ObjectFile.cpp
@@ -561,25 +561,9 @@
   } else {
 // The object file now contains a full mmap'ed copy of the object file data,
 // so just use this
-return MemoryMapSectionData(section, section_data);
-  }
-}
-
-size_t ObjectFile::MemoryMapSectionData(Section *section,
-DataExtractor §ion_data) {
-  // If some other objectfile owns this data, pass this to them.
-  if (section->GetObjectFile() != this)
-return section->GetObjectFile()->MemoryMapSectionData(section,
-  section_data);
-
-  if (IsInMemory()) {
-return ReadSectionData(section, section_data);
-  } else {
 if (!section->IsRelocated())
   RelocateSection(section);
 
-// The object file now contains a full mmap'ed copy of the object file data,
-// so just use this
 return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
   }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -444,10 +444,8 @@
 Section *section =
 section_list->FindSectionByName(GetDWARFMachOSegmentName()).get();
 
-// Memory map the DWARF mach-o segment so we have everything mmap'ed
-// to keep our heap memory usage down.
 if (section)
-  m_obj_file->MemoryMapSectionData(section, m_dwarf_data);
+  m_obj_file->ReadSectionData(section, m_dwarf_data);
   }
 
   get_apple_names_data();
Index: lldb/trunk/include/lldb/Symbol/ObjectFile.h
===
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h
+++ lldb

[Lldb-commits] [PATCH] D40616: ObjectFileELF: Add support for compressed sections

2017-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 126975.
labath added a comment.

The version where Section::GetFileSize reports the on-disk (compressed) size. I
also like the idea of renaming Section::GetByteSize to something more
descriptive, and I'll make a follow-up patch to do that.


https://reviews.llvm.org/D40616

Files:
  include/lldb/Symbol/ObjectFile.h
  lit/CMakeLists.txt
  lit/Modules/compressed-sections.yaml
  lit/Modules/lit.local.cfg
  lit/lit.cfg
  lit/lit.site.cfg.in
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  tools/lldb-test/lldb-test.cpp
  unittests/ObjectFile/ELF/TestObjectFileELF.cpp

Index: unittests/ObjectFile/ELF/TestObjectFileELF.cpp
===
--- unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -10,12 +10,13 @@
 
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
 #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "TestingSupport/TestUtilities.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Host/HostInfo.h"
-#include "TestingSupport/TestUtilities.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/Support/Compression.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -89,7 +89,8 @@
   assert(S);
   Printer.formatLine("Index: {0}", I);
   Printer.formatLine("Name: {0}", S->GetName().GetStringRef());
-  Printer.formatLine("Length: {0}", S->GetByteSize());
+  Printer.formatLine("VM size: {0}", S->GetByteSize());
+  Printer.formatLine("File size: {0}", S->GetFileSize());
 
   if (opts::module::SectionContents) {
 DataExtractor Data;
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.h
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -21,6 +21,7 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/UUID.h"
 #include "lldb/lldb-private.h"
+#include "llvm/Object/Decompressor.h"
 
 #include "ELFHeader.h"
 
@@ -140,6 +141,13 @@
 
   ObjectFile::Strata CalculateStrata() override;
 
+  size_t ReadSectionData(lldb_private::Section *section,
+ lldb::offset_t section_offset, void *dst,
+ size_t dst_len) override;
+
+  size_t ReadSectionData(lldb_private::Section *section,
+ lldb_private::DataExtractor §ion_data) override;
+
   // Returns number of program headers found in the ELF file.
   size_t GetProgramHeaderCount();
 
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
@@ -3460,3 +3461,56 @@
   }
   return eStrataUnknown;
 }
+
+size_t ObjectFileELF::ReadSectionData(Section *section,
+   lldb::offset_t section_offset, void *dst,
+   size_t dst_len) {
+  // If some other objectfile owns this data, pass this to them.
+  if (section->GetObjectFile() != this)
+return section->GetObjectFile()->ReadSectionData(section, section_offset,
+ dst, dst_len);
+
+  if (!section->Test(SHF_COMPRESSED))
+return ObjectFile::ReadSectionData(section, section_offset, dst, dst_len);
+
+  // For compressed sections we need to read to full data to be able to
+  // decompress.
+  DataExtractor data;
+  ReadSectionData(section, data);
+  return data.CopyData(section_offset, dst_len, dst);
+}
+
+size_t ObjectFileELF::ReadSectionData(Section *section,
+  DataExtractor §ion_data) {
+  // If some other objectfile owns this data, pass this to them.
+  if (section->GetObjectFile() != this)
+return section->GetObjectFile()->ReadSectionData(section, section_data);
+
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
+
+  size_t result = ObjectFile::ReadSectionData(section, section_data);
+  if (result == 0 || !section->Test(SHF_COMPRESSED))
+return result;
+
+  auto Decompressor = llvm::object::Decompressor::create(
+  section->GetName().GetStringRef(),
+  {reinterpret_cast(section_data.GetDataStart()),
+   section_data.GetByteSize()},
+  GetByteOrder() == eByteOrderLittle, GetAddressByteSize() == 8);
+ 

[Lldb-commits] [PATCH] D41245: Reduce x86 register context boilerplate.

2017-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, krytarowski.
Herald added a subscriber: emaste.

The x86 FPR struct (which does not store just floating point registers)
was defined as a struct containing a union between two members: XSAVE
and FXSAVE. The initial layout of these two structs is identical, which
is recognised by the fact that XSAVE has FXSAVE as its first member.

This fact means that the whole union is not necessary and we can just
use XSAVE as our "fpr" struct. This reduced the amount of typing when
accessing the struct members and (I hope) makes code a bit cleaner.


https://reviews.llvm.org/D41245

Files:
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
  source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
  source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
  source/Plugins/Process/Utility/RegisterContext_x86.h
  source/Plugins/Process/Utility/RegisterInfos_i386.h
  source/Plugins/Process/Utility/RegisterInfos_x86_64.h

Index: source/Plugins/Process/Utility/RegisterInfos_x86_64.h
===
--- source/Plugins/Process/Utility/RegisterInfos_x86_64.h
+++ source/Plugins/Process/Utility/RegisterInfos_x86_64.h
@@ -16,25 +16,22 @@
 // Computes the offset of the given FPR in the extended data area.
 #define FPR_OFFSET(regname)\
   (LLVM_EXTENSION offsetof(UserArea, fpr) +\
-   LLVM_EXTENSION offsetof(FPR, xstate) +  \
+   LLVM_EXTENSION offsetof(XSAVE, i387) +  \
LLVM_EXTENSION offsetof(FXSAVE, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
 // Based on DNBArchImplX86_64.cpp from debugserver
 #define YMM_OFFSET(reg_index)  \
   (LLVM_EXTENSION offsetof(UserArea, fpr) +\
-   LLVM_EXTENSION offsetof(FPR, xstate) +  \
LLVM_EXTENSION offsetof(XSAVE, ymmh[0]) + (32 * reg_index))
 
-#define BNDR_OFFSET(reg_index) \
-(LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
+#define BNDR_OFFSET(reg_index) \
+  (LLVM_EXTENSION offsetof(UserArea, fpr) +\
+   LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
 
-#define BNDC_OFFSET(reg_index) \
-(LLVM_EXTENSION offsetof(UserArea, fpr) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
+#define BNDC_OFFSET(reg_index) \
+  (LLVM_EXTENSION offsetof(UserArea, fpr) +\
+   LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
 
 #ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT
 
Index: source/Plugins/Process/Utility/RegisterInfos_i386.h
===
--- source/Plugins/Process/Utility/RegisterInfos_i386.h
+++ source/Plugins/Process/Utility/RegisterInfos_i386.h
@@ -27,19 +27,17 @@
 // Based on DNBArchImplI386.cpp from debugserver
 #define YMM_OFFSET(reg_index)  \
   (LLVM_EXTENSION offsetof(UserArea, i387) +   \
-   LLVM_EXTENSION offsetof(FPR, xstate) +  \
+   LLVM_EXTENSION offsetof(XSAVE, i387) +  \
LLVM_EXTENSION offsetof(FXSAVE, xmm[7]) + sizeof(XMMReg) +  \
(32 * reg_index))
 
-#define BNDR_OFFSET(reg_index) \
-(LLVM_EXTENSION offsetof(UserArea, i387) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
+#define BNDR_OFFSET(reg_index) \
+  (LLVM_EXTENSION offsetof(UserArea, i387) +   \
+   LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
 
-#define BNDC_OFFSET(reg_index) \
-(LLVM_EXTENSION offsetof(UserArea, i387) + \
- LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
+#define BNDC_OFFSET(reg_index) \
+  (LLVM_EXTENSION offsetof(UserArea, i387) +   \
+   LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
 
 // Number of bytes needed to represent a FPR.
 #if !defined(FPR_SIZE)
Index: source/Plugins/Process/Utility/RegisterContext_x86.h

[Lldb-commits] [PATCH] D41245: Reduce x86 register context boilerplate.

2017-12-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Personally I prefer the original code as it looks easier to implement FSAVE.


https://reviews.llvm.org/D41245



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


[Lldb-commits] [PATCH] D41245: Reduce x86 register context boilerplate.

2017-12-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D41245#955462, @krytarowski wrote:

> Personally I prefer the original code as it looks easier to implement FSAVE.


Also naming FPR is more logical, reusing the XSAVE name for 32-bit x86 looks 
wrong to me.


https://reviews.llvm.org/D41245



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


[Lldb-commits] [PATCH] D40616: ObjectFileELF: Add support for compressed sections

2017-12-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Move #include of "llvm/Object/Decompressor.h" into CPP file and this is good to 
go.




Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.h:24
 #include "lldb/lldb-private.h"
+#include "llvm/Object/Decompressor.h"
 

Move to .cpp file? Nothing in header file seems like it is needed.


https://reviews.llvm.org/D40616



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


[Lldb-commits] [PATCH] D41245: Reduce x86 register context boilerplate.

2017-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D41245#955462, @krytarowski wrote:

> Personally I prefer the original code as it looks easier to implement FSAVE.


Maybe we could delete at least one layer then (make FPR a union which contains 
fxsave and xsave members)?

Also, I am curious: is your remark about FSAVE hypothetical or do you have 
plans about that? Is there an OS that vends registers in the FSAVE layout?

My feeling is that if you really wanted to implement the FSAVE layout you would 
run into a class of problems anyway, precisely because the layout is not the 
same as these two structures.  (e.g. right now the way that the offset of the 
xmm registers is defined does not take into account whether you are using XSAVE 
or FXSAVE -- the only reason this works is because the two offsets are the 
same).


https://reviews.llvm.org/D41245



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


[Lldb-commits] [PATCH] D41245: Reduce x86 register context boilerplate.

2017-12-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I want to support x86 CPUs in 32-bit mode starting from 486. At least to read 
core dumps.
This is the current bare minimum and tested setup by the releng team in NetBSD.

OpenBSD used to support 80386 with MMU, but not sure if this is still true 
after migration to Clang.

I've already implemented FPU checks in the existing code:

- fpu_present (currently always on)
- osfxsr
- sse
- sse2
- fpu_save (fsave, fxsave, xsave, xsaveopt)
- fpu_save_sze
- xsave_features

Maybe reuse FPR for FXSAVE/FSAVE and add next to it XSAVE/XSAVE_OPT.

On NetBSD/i386 FPR registers are for FSAVE through GET_FPREGS/SET_FPREGS.


https://reviews.llvm.org/D41245



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


[Lldb-commits] [lldb] r320759 - [ClangASTContext] Remove dead stuff found fixing something else.

2017-12-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Dec 14 15:03:35 2017
New Revision: 320759

URL: http://llvm.org/viewvc/llvm-project?rev=320759&view=rev
Log:
[ClangASTContext] Remove dead stuff found fixing something else.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=320759&r1=320758&r2=320759&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Dec 14 15:03:35 2017
@@ -435,75 +435,12 @@ static void ParseLangArgs(LangOptions &O
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
-  //if (Opts.CPlusPlus)
-  //Opts.CXXOperatorNames = !Args.hasArg(OPT_fno_operator_names);
-  //
-  //if (Args.hasArg(OPT_fobjc_gc_only))
-  //Opts.setGCMode(LangOptions::GCOnly);
-  //else if (Args.hasArg(OPT_fobjc_gc))
-  //Opts.setGCMode(LangOptions::HybridGC);
-  //
-  //if (Args.hasArg(OPT_print_ivar_layout))
-  //Opts.ObjCGCBitmapPrint = 1;
-  //
-  //if (Args.hasArg(OPT_faltivec))
-  //Opts.AltiVec = 1;
-  //
-  //if (Args.hasArg(OPT_pthread))
-  //Opts.POSIXThreads = 1;
-  //
-  //llvm::StringRef Vis = getLastArgValue(Args, OPT_fvisibility,
-  //  "default");
-  //if (Vis == "default")
   Opts.setValueVisibilityMode(DefaultVisibility);
-  //else if (Vis == "hidden")
-  //Opts.setVisibilityMode(LangOptions::Hidden);
-  //else if (Vis == "protected")
-  //Opts.setVisibilityMode(LangOptions::Protected);
-  //else
-  //Diags.Report(diag::err_drv_invalid_value)
-  //<< Args.getLastArg(OPT_fvisibility)->getAsString(Args) << Vis;
-
-  //Opts.OverflowChecking = Args.hasArg(OPT_ftrapv);
 
   // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
   // is specified, or -std is set to a conforming mode.
   Opts.Trigraphs = !Opts.GNUMode;
-  //if (Args.hasArg(OPT_trigraphs))
-  //Opts.Trigraphs = 1;
-  //
-  //Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
-  // OPT_fno_dollars_in_identifiers,
-  // !Opts.AsmPreprocessor);
-  //Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
-  //Opts.Microsoft = Args.hasArg(OPT_fms_extensions);
-  //Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
-  //if (Args.hasArg(OPT_fno_lax_vector_conversions))
-  //Opts.LaxVectorConversions = 0;
-  //Opts.Exceptions = Args.hasArg(OPT_fexceptions);
-  //Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
-  //Opts.Blocks = Args.hasArg(OPT_fblocks);
   Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault();
-  //Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar);
-  //Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
-  //Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
-  //Opts.AssumeSaneOperatorNew =
-  //!Args.hasArg(OPT_fno_assume_sane_operator_new);
-  //Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
-  //Opts.AccessControl = Args.hasArg(OPT_faccess_control);
-  //Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
-  //Opts.MathErrno = !Args.hasArg(OPT_fno_math_errno);
-  //Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth,
-  //99,
-  // Diags);
-  //Opts.NeXTRuntime = !Args.hasArg(OPT_fgnu_runtime);
-  //Opts.ObjCConstantStringClass = getLastArgValue(Args,
-  //   
OPT_fconstant_string_class);
-  //Opts.ObjCNonFragileABI = Args.hasArg(OPT_fobjc_nonfragile_abi);
-  //Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
-  //Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
-  //Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
-  //Opts.Static = Args.hasArg(OPT_static_define);
   Opts.OptimizeSize = 0;
 
   // FIXME: Eliminate this dependency.
@@ -518,18 +455,6 @@ static void ParseLangArgs(LangOptions &O
   //
   // FIXME: This is affected by other options (-fno-inline).
   Opts.NoInlineDefine = !Opt;
-
-  //unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
-  //switch (SSP) {
-  //default:
-  //Diags.Report(diag::err_drv_invalid_value)
-  //<< Args.getLastArg(OPT_stack_protector)->getAsString(Args) <<
-  //SSP;
-  //break;
-  //case 0: Opts.setStackProtectorMode(LangOptions::SSPOff); break;
-  //case 1: Opts.setStackProtectorMode(LangOptions::SSPOn);  break;
-  //case 2: Opts.setStackProtectorMode(LangOptions::SSP

[Lldb-commits] [lldb] r320761 - [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.

2017-12-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Dec 14 15:11:15 2017
New Revision: 320761

URL: http://llvm.org/viewvc/llvm-project?rev=320761&view=rev
Log:
[ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.

Clang recently switched to C++14 (with GNU extensions) as the default
dialect, but LLDB didn't catch up. This causes failures as LLDB still
evaluates ObjectiveC expressions as Objective C++ using C++98 as standard.

There are things not available in C++98, including, e.g. nullptr.
In some cases Objective-C `nil` is defined as `nullptr` so this causes
an evaluation failure. Switch the default to overcome this issue
(actually, currently lldb evaluates both C++11 and C++14 as C++11,
but that seems a larger change and definitely could be re-evaluated
in the future).

No test as this is currently failing on the LLDB bots after the clang
switch (so, de facto, there's a test already for it).



Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=320761&r1=320760&r2=320761&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Dec 14 15:11:15 2017
@@ -381,7 +381,15 @@ ClangExpressionParser::ClangExpressionPa
 // For now, the expression parser must use C++ anytime the
 // language is a C family language, because the expression parser
 // uses features of C++ to capture values.
+
+// Clang now sets as default C++14 as the default standard (with
+// GNU extensions), so we do the same here to avoid mismatches that
+// cause compiler error when evaluating expressions (e.g. nullptr
+// not found as it's a C++11 feature). Currently lldb evaluates
+// C++14 as C++11 (see two lines below) so we decide to be consistent
+// with that, but this could be re-evaluated in the future.
 m_compiler->getLangOpts().CPlusPlus = true;
+m_compiler->getLangOpts().CPlusPlus11 = true;
 break;
   case lldb::eLanguageTypeObjC:
 m_compiler->getLangOpts().ObjC1 = true;


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


[Lldb-commits] [lldb] r320769 - [ExpressionParser] Rollback C++98 as the standard for evaluating.

2017-12-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Dec 14 16:00:17 2017
New Revision: 320769

URL: http://llvm.org/viewvc/llvm-project?rev=320769&view=rev
Log:
[ExpressionParser] Rollback C++98 as the standard for evaluating.

Some ubuntu bots are failing with this patch in, let me unblock
while I investigate.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=320769&r1=320768&r2=320769&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Dec 14 16:00:17 2017
@@ -381,15 +381,7 @@ ClangExpressionParser::ClangExpressionPa
 // For now, the expression parser must use C++ anytime the
 // language is a C family language, because the expression parser
 // uses features of C++ to capture values.
-
-// Clang now sets as default C++14 as the default standard (with
-// GNU extensions), so we do the same here to avoid mismatches that
-// cause compiler error when evaluating expressions (e.g. nullptr
-// not found as it's a C++11 feature). Currently lldb evaluates
-// C++14 as C++11 (see two lines below) so we decide to be consistent
-// with that, but this could be re-evaluated in the future.
 m_compiler->getLangOpts().CPlusPlus = true;
-m_compiler->getLangOpts().CPlusPlus11 = true;
 break;
   case lldb::eLanguageTypeObjC:
 m_compiler->getLangOpts().ObjC1 = true;


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


[Lldb-commits] [lldb] r320778 - [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.

2017-12-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Dec 14 16:50:43 2017
New Revision: 320778

URL: http://llvm.org/viewvc/llvm-project?rev=320778&view=rev
Log:
[ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.

Clang recently switched to C++14 (with GNU extensions) as the default
dialect, but LLDB didn't catch up. This causes failures as LLDB still
evaluates ObjectiveC expressions as Objective C++ using C++98 as standard.

There are things not available in C++98, including, e.g. nullptr.
In some cases Objective-C `nil` is defined as `nullptr` so this causes
an evaluation failure. Switch the default to overcome this issue
(actually, currently lldb evaluates both C++11 and C++14 as C++11,
but that seems a larger change and definitely could be re-evaluated
in the future).

No test as this is currently failing on the LLDB bots after the clang
switch (so, de facto, there's a test already for it).

This is a recommit, with a thinko fixed (the code was previously
placed incorrectly).



Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=320778&r1=320777&r2=320778&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Dec 14 16:50:43 2017
@@ -389,6 +389,14 @@ ClangExpressionParser::ClangExpressionPa
 // FIXME: the following language option is a temporary workaround,
 // to "ask for ObjC, get ObjC++" (see comment above).
 m_compiler->getLangOpts().CPlusPlus = true;
+
+// Clang now sets as default C++14 as the default standard (with
+// GNU extensions), so we do the same here to avoid mismatches that
+// cause compiler error when evaluating expressions (e.g. nullptr
+// not found as it's a C++11 feature). Currently lldb evaluates
+// C++14 as C++11 (see two lines below) so we decide to be consistent
+// with that, but this could be re-evaluated in the future.
+m_compiler->getLangOpts().CPlusPlus11 = true;
 break;
   case lldb::eLanguageTypeC_plus_plus:
   case lldb::eLanguageTypeC_plus_plus_11:


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