[Lldb-commits] [PATCH] D25947: Merge Linux and FreeBSD arm64 register contexts

2016-11-15 Thread Pavel Labath via lldb-commits
labath added a comment.

Ed, what do you think about this one? Is there anyone with a FreeBSD arm64 
setup that could verify this?


https://reviews.llvm.org/D25947



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


[Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”

2016-11-15 Thread Howard Hellyer via lldb-commits
hhellyer created this revision.
hhellyer added a subscriber: lldb-commits.

This patch changes the way ProcessElfCore.cpp handles signal information.
The patch changes ProcessElfCore.cpp to use the signal from si_signo in SIGINFO 
notes in preference to the value of cursig in PRSTATUS notes. The value from 
SIGINFO seems to be more thread specific. The value from PRSTATUS is usually 
the same for all threads even if only one thread received a signal.
If it cannot find any SIGINFO blocks it reverts to the old behaviour and uses 
the value from cursig in PRSTATUS. If after that no thread appears to have been 
stopped it forces the status of the first thread to be SIGSTOP to prevent lldb 
hanging waiting for any thread from the core file to change state.

The order is:

- If one or more threads have a non-zero si_signo in SIGINFO that will be used.
- If no threads had a SIGINFO block with a non-zero si_signo set all threads 
signals to the value in cursig in their PRSTATUS notes.
- If no thread has a signal set to a non-zero value set the signal for only the 
first thread to SIGSTOP.

This resolves two issues. The first was identified in bug 26322, the second 
became apparent while investigating this problem and looking at the signal 
values reported for each thread via “thread list”.

Firstly lldb is able to load core dumps generated by gcore where each thread 
has a SIGINFO note containing a signal number but cursig in the PRSTATUS block 
for each thread is 0.

Secondly if a SIGINFO note was found the “thread list” command will no longer 
show the same signal number for all threads. At the moment if a process 
crashes, for example with SIGILL, all threads will show “stop reason = signal 
SIGILL”. With this patch only the thread that executed the illegal instruction 
shows that stop reason. The other threads show “stop reason = signal 0”.


https://reviews.llvm.org/D26676

Files:
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/ThreadElfCore.cpp
  source/Plugins/Process/elf-core/ThreadElfCore.h

Index: source/Plugins/Process/elf-core/ThreadElfCore.h
===
--- source/Plugins/Process/elf-core/ThreadElfCore.h
+++ source/Plugins/Process/elf-core/ThreadElfCore.h
@@ -82,6 +82,38 @@
 static_assert(sizeof(ELFLinuxPrStatus) == 112,
   "sizeof ELFLinuxPrStatus is not correct!");
 
+struct ELFLinuxSigInfo {
+  int32_t si_signo;
+  int32_t si_code;
+  int32_t si_errno;
+
+  ELFLinuxSigInfo();
+
+  lldb_private::Error Parse(lldb_private::DataExtractor &data,
+lldb_private::ArchSpec &arch);
+
+  // Return the bytesize of the structure
+  // 64 bit - just sizeof
+  // 32 bit - hardcoded because we are reusing the struct, but some of the
+  // members are smaller -
+  // so the layout is not the same
+  static size_t GetSize(lldb_private::ArchSpec &arch) {
+switch (arch.GetCore()) {
+case lldb_private::ArchSpec::eCore_x86_64_x86_64:
+  return sizeof(ELFLinuxSigInfo);
+case lldb_private::ArchSpec::eCore_s390x_generic:
+case lldb_private::ArchSpec::eCore_x86_32_i386:
+case lldb_private::ArchSpec::eCore_x86_32_i486:
+  return 12;
+default:
+  return 0;
+}
+  }
+};
+
+static_assert(sizeof(ELFLinuxSigInfo) == 12,
+  "sizeof ELFLinuxSigInfo is not correct!");
+
 // PRPSINFO structure's size differs based on architecture.
 // This is the layout in the x86-64 arch case.
 // In the i386 case we parse it manually and fill it again
@@ -133,7 +165,8 @@
   lldb_private::DataExtractor fpregset;
   lldb_private::DataExtractor vregset;
   lldb::tid_t tid;
-  int signo;
+  int signo = 0;
+  int prstatus_sig = 0;
   std::string name;
 };
 
Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp
===
--- source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -320,3 +320,45 @@
 
   return error;
 }
+
+//
+// Parse SIGINFO from NOTE entry
+//
+ELFLinuxSigInfo::ELFLinuxSigInfo() {
+  memset(this, 0, sizeof(ELFLinuxSigInfo));
+}
+
+Error ELFLinuxSigInfo::Parse(DataExtractor &data, ArchSpec &arch) {
+  Error error;
+  ByteOrder byteorder = data.GetByteOrder();
+  if (GetSize(arch) > data.GetByteSize()) {
+error.SetErrorStringWithFormat(
+"NT_SIGINFO size should be %zu, but the remaining bytes are: %" PRIu64,
+GetSize(arch), data.GetByteSize());
+return error;
+  }
+
+  switch (arch.GetCore()) {
+  case ArchSpec::eCore_x86_64_x86_64:
+data.ExtractBytes(0, sizeof(ELFLinuxPrStatus), byteorder, this);
+break;
+  case ArchSpec::eCore_s390x_generic:
+  case ArchSpec::eCore_x86_32_i386:
+  case ArchSpec::eCore_x86_32_i486: {
+// Parsing from a 32 bit ELF core file, and populating/reusing the

[Lldb-commits] [PATCH] D25947: Merge Linux and FreeBSD arm64 register contexts

2016-11-15 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as all register contexts are the same between these targets.


https://reviews.llvm.org/D25947



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


[Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”

2016-11-15 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Just a few quick changes.




Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:208-209
+  // Check we found a signal in a SIGINFO note.
+  for (std::vector::iterator it = m_thread_data.begin();
+  it != m_thread_data.end(); ++it) {
+if (it->signo != 0)

If you are just iterating (not also wanting indexes, or keeping any iterators 
in the for loop) then use:

```
for (const auto &thread_data: m_thread_data) {
  if (thread_data.signo != 0)
siginfo_signal_found = true;
  if (thread_data.prstatus_sig != 0)
prstatus_signal_found = true;
}
```



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:219-220
+if( prstatus_signal_found == true) {
+  for (std::vector::iterator it = m_thread_data.begin();
+  it != m_thread_data.end(); ++it)
+it->signo = it->prstatus_sig;

```
for (const auto &thread_data: m_thread_data) {
```



Comment at: source/Plugins/Process/elf-core/ThreadElfCore.h:93
+  lldb_private::Error Parse(lldb_private::DataExtractor &data,
+lldb_private::ArchSpec &arch);
+

add const to "arch":
```
const lldb_private::ArchSpec &arch
```



Comment at: source/Plugins/Process/elf-core/ThreadElfCore.h:100
+  // so the layout is not the same
+  static size_t GetSize(lldb_private::ArchSpec &arch) {
+switch (arch.GetCore()) {

Add const:

```const lldb_private::ArchSpec &arch```


https://reviews.llvm.org/D26676



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


[Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”

2016-11-15 Thread Pavel Labath via lldb-commits
labath added a comment.

Thank you for looking into this. This has been a long standing issue that we 
haven't got time to address.

Could you also add some tests to cover the new functionality? It sounds like it 
would be easy to generate tiny core files which trigger this. You can look at 
tests in TestLinuxCore.py for examples. If you run into trouble there, let me 
know.


https://reviews.llvm.org/D26676



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


[Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”

2016-11-15 Thread Jim Ingham via lldb-commits
jingham added a comment.

Besides Greg's comments, this looks reasonable to me.


https://reviews.llvm.org/D26676



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


[Lldb-commits] [lldb] r286947 - Fix uninitialized members.

2016-11-15 Thread Sam McCall via lldb-commits
Author: sammccall
Date: Tue Nov 15 04:58:16 2016
New Revision: 286947

URL: http://llvm.org/viewvc/llvm-project?rev=286947&view=rev
Log:
Fix uninitialized members.

Summary: Fix uninitialized members.

Reviewers: jingham

Subscribers: jingham, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=286947&r1=286946&r2=286947&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Tue Nov 15 04:58:16 2016
@@ -745,9 +745,9 @@ protected:
   //--
   // Member variables
   //--
-  ConstString m_directory;///< The uniqued directory path
-  ConstString m_filename; ///< The uniqued filename path
-  mutable bool m_is_resolved; ///< True if this path has been resolved.
+  ConstString m_directory;///< The uniqued directory path
+  ConstString m_filename; ///< The uniqued filename path
+  mutable bool m_is_resolved = false; ///< True if this path has been resolved.
   PathSyntax
   m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix)
 };

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=286947&r1=286946&r2=286947&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Tue Nov 15 04:58:16 2016
@@ -277,16 +277,14 @@ void FileSpec::Resolve(llvm::SmallVector
   }
 }
 
-FileSpec::FileSpec()
-: m_directory(), m_filename(), m_syntax(FileSystem::GetNativePathSyntax()) 
{
-}
+FileSpec::FileSpec() : m_syntax(FileSystem::GetNativePathSyntax()) {}
 
 //--
 // Default constructor that can take an optional full path to a
 // file on disk.
 //--
 FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax)
-: m_directory(), m_filename(), m_is_resolved(false), m_syntax(syntax) {
+: m_syntax(syntax) {
   SetFile(path, resolve_path, syntax);
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=286947&r1=286946&r2=286947&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Nov 15 04:58:16 2016
@@ -4577,8 +4577,7 @@ public:
   IOHandlerProcessSTDIO(Process *process, int write_fd)
   : IOHandler(process->GetTarget().GetDebugger(),
   IOHandler::Type::ProcessIO),
-m_process(process), m_read_file(), m_write_file(write_fd, false),
-m_pipe() {
+m_process(process), m_write_file(write_fd, false) {
 m_pipe.CreateNew(false);
 m_read_file.SetDescriptor(GetInputFD(), false);
   }
@@ -4710,7 +4709,7 @@ protected:
   File m_write_file; // Write to this file (usually the master pty for getting
  // io to debuggee)
   Pipe m_pipe;
-  std::atomic m_is_running;
+  std::atomic m_is_running{false};
 };
 
 void Process::SetSTDIOFileDescriptor(int fd) {


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


[Lldb-commits] [PATCH] D25947: Merge Linux and FreeBSD arm64 register contexts

2016-11-15 Thread Stephane Sezer via lldb-commits
sas accepted this revision.
sas added a reviewer: sas.
sas added a comment.

Cool stuff.

Are you planning on doing a similar change for other architectures?


https://reviews.llvm.org/D25947



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


[Lldb-commits] [PATCH] D26676: Patch for lldb bug 26322 “core load hangs”

2016-11-15 Thread Stephane Sezer via lldb-commits
sas added a comment.

Just a couple nits inline. Also, did you run `clang-format` on your change? I 
see some issues with `if`s and the associated parentheses.




Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:215
+  }
+  if (siginfo_signal_found == false) {
+// If we don't have signal from SIGINFO use the signal from each threads

Nit: `if (!siginfo_signal_found)`.



Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:218
+// PRSTATUS note.
+if( prstatus_signal_found == true) {
+  for (std::vector::iterator it = m_thread_data.begin();

Similar nit: `if (prstatus_signal_found)`.


https://reviews.llvm.org/D26676



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


[Lldb-commits] [lldb] r287016 - One more fix for Printf. Apparently I fail at incremental builds.

2016-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Nov 15 14:11:01 2016
New Revision: 287016

URL: http://llvm.org/viewvc/llvm-project?rev=287016&view=rev
Log:
One more fix for Printf.  Apparently I fail at incremental builds.

Modified:
lldb/trunk/source/Commands/CommandObjectSyntax.cpp

Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=287016&r1=287015&r2=287016&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Tue Nov 15 14:11:01 2016
@@ -76,13 +76,13 @@ bool CommandObjectSyntax::DoExecute(Args
 if (all_okay && (cmd_obj != nullptr)) {
   Stream &output_strm = result.GetOutputStream();
   if (cmd_obj->GetOptions() != nullptr) {
-output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax());
+output_strm.Printf("\nSyntax: %s\n", 
cmd_obj->GetSyntax().str().c_str());
 output_strm.Printf(
 "(Try 'help %s' for more information on command options 
syntax.)\n",
 cmd_obj->GetCommandName().str().c_str());
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
   } else {
-output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax());
+output_strm.Printf("\nSyntax: %s\n", 
cmd_obj->GetSyntax().str().c_str());
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
   }
 } else {


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


[Lldb-commits] [lldb] r287017 - Make some code not manipulate the underlying string of a StreamString.

2016-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Nov 15 14:13:14 2016
New Revision: 287017

URL: http://llvm.org/viewvc/llvm-project?rev=287017&view=rev
Log:
Make some code not manipulate the underlying string of a StreamString.

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

Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=287017&r1=287016&r2=287017&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Nov 15 14:13:14 2016
@@ -559,42 +559,44 @@ bool lldb_private::formatters::NSURLSumm
   if (!valobj_addr)
 return false;
 
-  const char *class_name = descriptor->GetClassName().GetCString();
+  llvm::StringRef class_name = descriptor->GetClassName().GetStringRef();
 
-  if (!class_name || !*class_name)
+  if (!class_name.equals("NSURL"))
 return false;
 
-  if (strcmp(class_name, "NSURL") == 0) {
-uint64_t offset_text = ptr_size + ptr_size +
-   8; // ISA + pointer + 8 bytes of data (even on 
32bit)
-uint64_t offset_base = offset_text + ptr_size;
-CompilerType type(valobj.GetCompilerType());
-ValueObjectSP text(
-valobj.GetSyntheticChildAtOffset(offset_text, type, true));
-ValueObjectSP base(
-valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-if (!text)
-  return false;
-if (text->GetValueAsUnsigned(0) == 0)
-  return false;
-StreamString summary;
-if (!NSStringSummaryProvider(*text, summary, options))
-  return false;
-if (base && base->GetValueAsUnsigned(0)) {
-  if (summary.GetSize() > 0)
-summary.GetString().resize(summary.GetSize() - 1);
-  summary.Printf(" -- ");
-  StreamString base_summary;
-  if (NSURLSummaryProvider(*base, base_summary, options) &&
-  base_summary.GetSize() > 0)
-summary.Printf("%s", base_summary.GetSize() > 2
- ? base_summary.GetData() + 2
- : base_summary.GetData());
-}
-if (summary.GetSize()) {
-  stream.Printf("%s", summary.GetData());
-  return true;
+  uint64_t offset_text = ptr_size + ptr_size +
+ 8; // ISA + pointer + 8 bytes of data (even on 32bit)
+  uint64_t offset_base = offset_text + ptr_size;
+  CompilerType type(valobj.GetCompilerType());
+  ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, 
true));
+  ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, 
true));
+  if (!text)
+return false;
+  if (text->GetValueAsUnsigned(0) == 0)
+return false;
+  StreamString summary;
+  if (!NSStringSummaryProvider(*text, summary, options))
+return false;
+  if (base && base->GetValueAsUnsigned(0)) {
+std::string summary_str = summary.GetString();
+
+if (!summary_str.empty())
+  summary_str.pop_back();
+summary_str += " -- ";
+StreamString base_summary;
+if (NSURLSummaryProvider(*base, base_summary, options) &&
+!base_summary.Empty()) {
+  llvm::StringRef base_str = base_summary.GetString();
+  if (base_str.size() > 2)
+base_str = base_str.drop_front(2);
+  summary_str += base_str;
 }
+summary.Clear();
+summary.PutCString(summary_str);
+  }
+  if (!summary.Empty()) {
+stream.PutCString(summary.GetString());
+return true;
   }
 
   return false;


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


[Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString

2016-11-15 Thread Zachary Turner via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287017: Make some code not manipulate the underlying string 
of a StreamString. (authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D26618?vs=77830&id=78050#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26618

Files:
  lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp


Index: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -559,42 +559,44 @@
   if (!valobj_addr)
 return false;
 
-  const char *class_name = descriptor->GetClassName().GetCString();
+  llvm::StringRef class_name = descriptor->GetClassName().GetStringRef();
 
-  if (!class_name || !*class_name)
+  if (!class_name.equals("NSURL"))
 return false;
 
-  if (strcmp(class_name, "NSURL") == 0) {
-uint64_t offset_text = ptr_size + ptr_size +
-   8; // ISA + pointer + 8 bytes of data (even on 
32bit)
-uint64_t offset_base = offset_text + ptr_size;
-CompilerType type(valobj.GetCompilerType());
-ValueObjectSP text(
-valobj.GetSyntheticChildAtOffset(offset_text, type, true));
-ValueObjectSP base(
-valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-if (!text)
-  return false;
-if (text->GetValueAsUnsigned(0) == 0)
-  return false;
-StreamString summary;
-if (!NSStringSummaryProvider(*text, summary, options))
-  return false;
-if (base && base->GetValueAsUnsigned(0)) {
-  if (summary.GetSize() > 0)
-summary.GetString().resize(summary.GetSize() - 1);
-  summary.Printf(" -- ");
-  StreamString base_summary;
-  if (NSURLSummaryProvider(*base, base_summary, options) &&
-  base_summary.GetSize() > 0)
-summary.Printf("%s", base_summary.GetSize() > 2
- ? base_summary.GetData() + 2
- : base_summary.GetData());
-}
-if (summary.GetSize()) {
-  stream.Printf("%s", summary.GetData());
-  return true;
+  uint64_t offset_text = ptr_size + ptr_size +
+ 8; // ISA + pointer + 8 bytes of data (even on 32bit)
+  uint64_t offset_base = offset_text + ptr_size;
+  CompilerType type(valobj.GetCompilerType());
+  ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, 
true));
+  ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, 
true));
+  if (!text)
+return false;
+  if (text->GetValueAsUnsigned(0) == 0)
+return false;
+  StreamString summary;
+  if (!NSStringSummaryProvider(*text, summary, options))
+return false;
+  if (base && base->GetValueAsUnsigned(0)) {
+std::string summary_str = summary.GetString();
+
+if (!summary_str.empty())
+  summary_str.pop_back();
+summary_str += " -- ";
+StreamString base_summary;
+if (NSURLSummaryProvider(*base, base_summary, options) &&
+!base_summary.Empty()) {
+  llvm::StringRef base_str = base_summary.GetString();
+  if (base_str.size() > 2)
+base_str = base_str.drop_front(2);
+  summary_str += base_str;
 }
+summary.Clear();
+summary.PutCString(summary_str);
+  }
+  if (!summary.Empty()) {
+stream.PutCString(summary.GetString());
+return true;
   }
 
   return false;


Index: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -559,42 +559,44 @@
   if (!valobj_addr)
 return false;
 
-  const char *class_name = descriptor->GetClassName().GetCString();
+  llvm::StringRef class_name = descriptor->GetClassName().GetStringRef();
 
-  if (!class_name || !*class_name)
+  if (!class_name.equals("NSURL"))
 return false;
 
-  if (strcmp(class_name, "NSURL") == 0) {
-uint64_t offset_text = ptr_size + ptr_size +
-   8; // ISA + pointer + 8 bytes of data (even on 32bit)
-uint64_t offset_base = offset_text + ptr_size;
-CompilerType type(valobj.GetCompilerType());
-ValueObjectSP text(
-valobj.GetSyntheticChildAtOffset(offset_text, type, true));
-ValueObjectSP base(
-valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-if (!text)
-  return false;
-if (text->GetValueAsUnsigned(0) == 0)
-  return false;
-StreamString summary;
-if (!NSStringSummaryProvider(*text, summary, options))
-  return false;
-if (base && base->GetValueAsUnsigned(0)) {
-  if (summary.GetSize() > 0)
-summary.GetString().resize(summary.GetSize() - 1);
-  summary.Printf(" -- ");
-  StreamString base_summary;
-  if (NSURLSummaryProvider(*base, base_summary, options) &&
-  base_summary.GetSize() > 0)
-summ

[Lldb-commits] [PATCH] D26697: Remove Windows-specific minidump plugin

2016-11-15 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added reviewers: labath, zturner.
amccarth added a subscriber: lldb-commits.
Herald added subscribers: modocache, mgorny.

With the cross-platform minidump plugin working, the Windows-specific one is no 
longer needed.  This eliminates the unnecessary code.

This does not eliminate the Windows-specific tests, as they hit a few cases the 
general tests don't.  (The Windows-specific tests are currently passing.)  I'll 
look into a separate patch to make sure we're not doing too much duplicate 
testing.

After that I might do a little re-org in the Windows plugin, as there was some 
factoring there (Common & Live) that probably isn't necessary anymore.


https://reviews.llvm.org/D26697

Files:
  cmake/LLDBDependencies.cmake
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/Windows/MiniDump/CMakeLists.txt
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h
  source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.cpp
  source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.h
  
source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.cpp
  
source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h
  
source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp
  
source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h

Index: source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h
===
--- source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//===-- RegisterContextWindowsMiniDump_x86.h *- C++
-//-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef liblldb_RegisterContextWindowsMiniDump_x86_H_
-#define liblldb_RegisterContextWindowsMiniDump_x86_H_
-
-#include "Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h"
-#include "lldb/lldb-forward.h"
-
-namespace lldb_private {
-
-class Thread;
-
-class RegisterContextWindowsMiniDump_x86 : public RegisterContextWindows_x86 {
-public:
-  RegisterContextWindowsMiniDump_x86(Thread &thread,
- uint32_t concrete_frame_idx,
- const CONTEXT *context);
-
-  virtual ~RegisterContextWindowsMiniDump_x86();
-
-  bool WriteRegister(const RegisterInfo *reg_info,
- const RegisterValue ®_value) override;
-
-protected:
-  bool CacheAllRegisterValues() override;
-};
-}
-
-#endif // #ifndef liblldb_RegisterContextWindowsMiniDump_x86_H_
Index: source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp
===
--- source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//===-- RegisterContextWindowsMiniDump_x86.cpp --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "lldb/Host/windows/windows.h"
-#include "lldb/lldb-private-types.h"
-
-#include "RegisterContextWindowsMiniDump_x86.h"
-
-using namespace lldb;
-
-namespace lldb_private {
-
-RegisterContextWindowsMiniDump_x86::RegisterContextWindowsMiniDump_x86(
-Thread &thread, uint32_t concrete_frame_idx, const CONTEXT *context)
-: RegisterContextWindows_x86(thread, concrete_frame_idx) {
-  if (context) {
-m_context = *context;
-m_context_stale = false;
-  }
-}
-
-RegisterContextWindowsMiniDump_x86::~RegisterContextWindowsMiniDump_x86() {}
-
-bool RegisterContextWindowsMiniDump_x86::WriteRegister(
-const RegisterInfo * /* reg_info */,
-const RegisterValue & /* reg_value */) {
-  return false;
-}
-
-bool RegisterContextWindowsMiniDump_x86::CacheAllRegisterValues() {
-  // Since this is post-mortem debugging, we either have the context or we
-  // don't.
-  return !m_context_stale;
-}
-
-} // namespace lldb_private
Index: source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h
===
--- source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===-- RegisterContextWindowsMiniDump_x64.h *- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source

[Lldb-commits] [PATCH] D25947: Merge Linux and FreeBSD arm64 register contexts

2016-11-15 Thread Ed Maste via lldb-commits
emaste added a comment.

> Ed, what do you think about this one? Is there anyone with a FreeBSD arm64 
> setup that could verify this?

We have an arm64 reference machine in the FreeBSD cluster and I will test after 
I return from travel later this week, although perhaps @andrew can try it 
before then.


https://reviews.llvm.org/D25947



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


[Lldb-commits] [lldb] r287055 - Change Property::GetName() and GetDescription() to return StringRef.

2016-11-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Nov 15 17:36:43 2016
New Revision: 287055

URL: http://llvm.org/viewvc/llvm-project?rev=287055&view=rev
Log:
Change Property::GetName() and GetDescription() to return StringRef.

Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
lldb/trunk/include/lldb/Interpreter/Property.h
lldb/trunk/source/Interpreter/OptionValueProperties.cpp
lldb/trunk/source/Interpreter/Property.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=287055&r1=287054&r2=287055&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Tue Nov 15 
17:36:43 2016
@@ -76,10 +76,6 @@ public:
 
   virtual size_t GetNumProperties() const;
 
-  virtual ConstString GetPropertyNameAtIndex(uint32_t idx) const;
-
-  virtual const char *GetPropertyDescriptionAtIndex(uint32_t idx) const;
-
   //-
   // Get the index of a property given its exact name in this property
   // collection, "name" can't be a path to a property path that refers

Modified: lldb/trunk/include/lldb/Interpreter/Property.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Property.h?rev=287055&r1=287054&r2=287055&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/Property.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Property.h Tue Nov 15 17:36:43 2016
@@ -42,9 +42,10 @@ public:
   Property(const ConstString &name, const ConstString &desc, bool is_global,
const lldb::OptionValueSP &value_sp);
 
-  const ConstString &GetName() const { return m_name; }
-
-  const char *GetDescription() const { return m_description.GetCString(); }
+  llvm::StringRef GetName() const { return m_name.GetStringRef(); }
+  llvm::StringRef GetDescription() const {
+return m_description.GetStringRef();
+  }
 
   const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
 

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=287055&r1=287054&r2=287055&view=diff
==
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Tue Nov 15 17:36:43 
2016
@@ -59,8 +59,7 @@ void OptionValueProperties::Initialize(c
   for (size_t i = 0; defs[i].name; ++i) {
 Property property(defs[i]);
 assert(property.IsValid());
-m_name_to_index.Append(property.GetName().GetStringRef(),
-   m_properties.size());
+m_name_to_index.Append(property.GetName(), m_properties.size());
 property.GetValue()->SetParent(shared_from_this());
 m_properties.push_back(property);
   }
@@ -217,21 +216,6 @@ Error OptionValueProperties::SetSubValue
   return error;
 }
 
-ConstString OptionValueProperties::GetPropertyNameAtIndex(uint32_t idx) const {
-  const Property *property = GetPropertyAtIndex(nullptr, false, idx);
-  if (property)
-return property->GetName();
-  return ConstString();
-}
-
-const char *
-OptionValueProperties::GetPropertyDescriptionAtIndex(uint32_t idx) const {
-  const Property *property = GetPropertyAtIndex(nullptr, false, idx);
-  if (property)
-return property->GetDescription();
-  return nullptr;
-}
-
 uint32_t
 OptionValueProperties::GetPropertyIndex(const ConstString &name) const {
   return m_name_to_index.Find(name.GetStringRef(), SIZE_MAX);
@@ -641,8 +625,7 @@ void OptionValueProperties::DumpAllDescr
   for (size_t i = 0; i < num_properties; ++i) {
 const Property *property = ProtectedGetPropertyAtIndex(i);
 if (property)
-  max_name_len =
-  std::max(property->GetName().GetLength(), max_name_len);
+  max_name_len = std::max(property->GetName().size(), 
max_name_len);
   }
   for (size_t i = 0; i < num_properties; ++i) {
 const Property *property = ProtectedGetPropertyAtIndex(i);
@@ -665,12 +648,12 @@ void OptionValueProperties::Apropos(
 properties->Apropos(keyword, matching_properties);
   } else {
 bool match = false;
-const char *name = property->GetName().GetCString();
-if (name && ::strcasestr(name, keyword))
+llvm::StringRef name = property->GetName();
+if (name.contains_lower(keyword))
   match = true;
 else {
-  const char *desc = property->GetDescription();
-  if (desc && ::strcasestr(desc, keyword))
+  llvm::StringRef desc = property->GetDescription();
+  if (desc.contains_lower(keyword))
 match = true;
 

[Lldb-commits] LLVM buildmaster will be restarted tonight

2016-11-15 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 7 PM Pacific time
today.

Thanks

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


[Lldb-commits] [PATCH] D26721: Make AutoComplete code use StringRef

2016-11-15 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: beanz, tfiala.
zturner added a subscriber: lldb-commits.

As per the title.  beanz@, could you specifically look over my usage of 
`llvm::Twine`?  This is the first time I've used this class, and I'm not sure 
if I'm using it correctly / efficiently.


https://reviews.llvm.org/D26721

Files:
  include/lldb/Core/ArchSpec.h
  include/lldb/Core/PluginManager.h
  include/lldb/Core/StringList.h
  include/lldb/Interpreter/CommandCompletions.h
  include/lldb/Symbol/Variable.h
  include/lldb/Utility/NameMatches.h
  source/Commands/CommandCompletions.cpp
  source/Core/ArchSpec.cpp
  source/Core/PluginManager.cpp
  source/Core/StringList.cpp
  source/Interpreter/CommandObject.cpp
  source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  source/Symbol/Variable.cpp
  source/Utility/NameMatches.cpp

Index: source/Utility/NameMatches.cpp
===
--- source/Utility/NameMatches.cpp
+++ source/Utility/NameMatches.cpp
@@ -13,33 +13,32 @@
 
 using namespace lldb_private;
 
-bool lldb_private::NameMatches(const char *name, NameMatchType match_type,
-   const char *match) {
+bool lldb_private::NameMatches(llvm::StringRef name, NameMatchType match_type,
+   llvm::StringRef match) {
   if (match_type == eNameMatchIgnore)
 return true;
 
   if (name == match)
 return true;
 
-  if (name && match) {
-llvm::StringRef name_sref(name);
-llvm::StringRef match_sref(match);
-switch (match_type) {
-case eNameMatchIgnore: // This case cannot occur: tested before
-  return true;
-case eNameMatchEquals:
-  return name_sref == match_sref;
-case eNameMatchContains:
-  return name_sref.find(match_sref) != llvm::StringRef::npos;
-case eNameMatchStartsWith:
-  return name_sref.startswith(match_sref);
-case eNameMatchEndsWith:
-  return name_sref.endswith(match_sref);
-case eNameMatchRegularExpression: {
-  RegularExpression regex(match_sref);
-  return regex.Execute(name_sref);
-} break;
-}
+  if (name.empty() || match.empty())
+return false;
+
+  switch (match_type) {
+  case eNameMatchIgnore: // This case cannot occur: tested before
+return true;
+  case eNameMatchEquals:
+return name == match;
+  case eNameMatchContains:
+return name.contains(match);
+  case eNameMatchStartsWith:
+return name.startswith(match);
+  case eNameMatchEndsWith:
+return name.endswith(match);
+  case eNameMatchRegularExpression: {
+RegularExpression regex(match);
+return regex.Execute(name);
+  } break;
   }
   return false;
 }
Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -31,6 +31,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "llvm/ADT/Twine.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -483,24 +485,24 @@
 }
 
 static void PrivateAutoComplete(
-StackFrame *frame, const std::string &partial_path,
-const std::string
+StackFrame *frame, llvm::StringRef partial_path,
+const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in here
 const CompilerType &compiler_type,
 StringList &matches, bool &word_complete);
 
 static void PrivateAutoCompleteMembers(
 StackFrame *frame, const std::string &partial_member_name,
-const std::string &partial_path,
-const std::string
+llvm::StringRef partial_path,
+const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in here
 const CompilerType &compiler_type,
 StringList &matches, bool &word_complete);
 
 static void PrivateAutoCompleteMembers(
 StackFrame *frame, const std::string &partial_member_name,
-const std::string &partial_path,
-const std::string
+llvm::StringRef partial_path,
+const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in here
 const CompilerType &compiler_type,
 StringList &matches, bool &word_complete) {
@@ -551,16 +553,16 @@
  // already will be in here
   member_compiler_type.GetCanonicalType(), matches, word_complete);
 } else {
-  matches.AppendString(prefix_path + member_name);
+  matches.AppendString((prefix_path + member_name).str());
 }
   }
 }
   }
 }
 
 static void PrivateAutoComplete(
-StackFrame *frame, const std::string &partial_path,
-const std::string
+StackFrame *frame, llvm::StringRef partial_path,
+const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in here
 const CompilerType &compiler_type,
 StringList &matches, bool &word_complete) {
@@ -584,15 +586,15 @@
   case eTypeClassReference:
   c

[Lldb-commits] [PATCH] D26698: Remove SBStream accessor that lets you manipulate the internal buffer.

2016-11-15 Thread Todd Fiala via lldb-commits
tfiala added a comment.

I can run this through in the morning on macOS.


https://reviews.llvm.org/D26698



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


[Lldb-commits] [PATCH] D26721: Make AutoComplete code use StringRef

2016-11-15 Thread Todd Fiala via lldb-commits
tfiala added a comment.

I can give this one a run though on macOS in the morning.


https://reviews.llvm.org/D26721



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