[Lldb-commits] [PATCH] D67474: [Reproducer] Add `reproducer dump` command

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371909: [Reproducer] Add reproducer dump command. (authored 
by JDevlieghere, committed by ).
Herald added a subscriber: kristina.

Changed prior to commit:
  https://reviews.llvm.org/D67474?vs=219949=220194#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67474/new/

https://reviews.llvm.org/D67474

Files:
  lldb/trunk/lit/Reproducer/Inputs/FileCapture.in
  lldb/trunk/lit/Reproducer/TestDump.test
  lldb/trunk/source/Commands/CommandObjectReproducer.cpp
  lldb/trunk/source/Commands/Options.td
  llvm/trunk/include/llvm/Support/VirtualFileSystem.h
  llvm/trunk/lib/Support/VirtualFileSystem.cpp

Index: llvm/trunk/lib/Support/VirtualFileSystem.cpp
===
--- llvm/trunk/lib/Support/VirtualFileSystem.cpp
+++ llvm/trunk/lib/Support/VirtualFileSystem.cpp
@@ -1082,20 +1082,19 @@
   return ExternalContentsPrefixDir;
 }
 
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void RedirectingFileSystem::dump() const {
+void RedirectingFileSystem::dump(raw_ostream ) const {
   for (const auto  : Roots)
-dumpEntry(Root.get());
+dumpEntry(OS, Root.get());
 }
 
-LLVM_DUMP_METHOD void
-RedirectingFileSystem::dumpEntry(RedirectingFileSystem::Entry *E,
- int NumSpaces) const {
+void RedirectingFileSystem::dumpEntry(raw_ostream ,
+  RedirectingFileSystem::Entry *E,
+  int NumSpaces) const {
   StringRef Name = E->getName();
   for (int i = 0, e = NumSpaces; i < e; ++i)
-dbgs() << " ";
-  dbgs() << "'" << Name.str().c_str() << "'"
- << "\n";
+OS << " ";
+  OS << "'" << Name.str().c_str() << "'"
+ << "\n";
 
   if (E->getKind() == RedirectingFileSystem::EK_Directory) {
 auto *DE = dyn_cast(E);
@@ -1103,9 +1102,12 @@
 
 for (std::unique_ptr  :
  llvm::make_range(DE->contents_begin(), DE->contents_end()))
-  dumpEntry(SubEntry.get(), NumSpaces + 2);
+  dumpEntry(OS, SubEntry.get(), NumSpaces + 2);
   }
 }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+LLVM_DUMP_METHOD void RedirectingFileSystem::dump() const { dump(dbgs()); }
 #endif
 
 /// A helper class to hold the common YAML parsing state.
Index: llvm/trunk/include/llvm/Support/VirtualFileSystem.h
===
--- llvm/trunk/include/llvm/Support/VirtualFileSystem.h
+++ llvm/trunk/include/llvm/Support/VirtualFileSystem.h
@@ -730,9 +730,10 @@
 
   StringRef getExternalContentsPrefixDir() const;
 
+  void dump(raw_ostream ) const;
+  void dumpEntry(raw_ostream , Entry *E, int NumSpaces = 0) const;
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   LLVM_DUMP_METHOD void dump() const;
-  LLVM_DUMP_METHOD void dumpEntry(Entry *E, int NumSpaces = 0) const;
 #endif
 };
 
Index: lldb/trunk/source/Commands/Options.td
===
--- lldb/trunk/source/Commands/Options.td
+++ lldb/trunk/source/Commands/Options.td
@@ -442,6 +442,15 @@
 Desc<"Prepend the names of files and function that generate the logs.">;
 }
 
+let Command = "reproducer" in {
+  def reproducer_provider : Option<"provider", "p">, Group<1>,
+EnumArg<"None", "ReproducerProviderType()">,
+Required, Desc<"The reproducer provider to dump.">;
+  def reproducer_file : Option<"file", "f">, Group<1>, Arg<"Filename">,
+Desc<"The reproducer path. If a reproducer is replayed and no path is "
+"provided, that reproducer is dumped.">;
+}
+
 let Command = "memory read" in {
   def memory_read_num_per_line : Option<"num-per-line", "l">, Group<1>,
 Arg<"NumberPerLine">, Desc<"The number of items per line to display.">;
Index: lldb/trunk/source/Commands/CommandObjectReproducer.cpp
===
--- lldb/trunk/source/Commands/CommandObjectReproducer.cpp
+++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp
@@ -8,6 +8,7 @@
 
 #include "CommandObjectReproducer.h"
 
+#include "lldb/Host/OptionParser.h"
 #include "lldb/Utility/Reproducer.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -16,7 +17,52 @@
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 
 using namespace lldb;
+using namespace llvm;
 using namespace lldb_private;
+using namespace lldb_private::repro;
+
+enum ReproducerProvider {
+  eReproducerProviderCommands,
+  eReproducerProviderFiles,
+  eReproducerProviderGDB,
+  eReproducerProviderVersion,
+  eReproducerProviderNone
+};
+
+static constexpr OptionEnumValueElement g_reproducer_provider_type[] = {
+{
+eReproducerProviderCommands,
+"commands",
+"Command Interpreter Commands",
+},
+{
+eReproducerProviderFiles,
+"files",
+"Files",
+},
+{
+eReproducerProviderGDB,
+"gdb",
+"GDB 

[Lldb-commits] [lldb] r371909 - [Reproducer] Add reproducer dump command.

2019-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 13 16:27:31 2019
New Revision: 371909

URL: http://llvm.org/viewvc/llvm-project?rev=371909=rev
Log:
[Reproducer] Add reproducer dump command.

This adds a reproducer dump commands which makes it possible to inspect
a reproducer from inside LLDB. Currently it supports the Files, Commands
and Version providers. I'm planning to add support for the GDB Remote
provider in a follow-up patch.

Differential revision: https://reviews.llvm.org/D67474

Added:
lldb/trunk/lit/Reproducer/TestDump.test
Modified:
lldb/trunk/lit/Reproducer/Inputs/FileCapture.in
lldb/trunk/source/Commands/CommandObjectReproducer.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/lit/Reproducer/Inputs/FileCapture.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Inputs/FileCapture.in?rev=371909=371908=371909=diff
==
--- lldb/trunk/lit/Reproducer/Inputs/FileCapture.in (original)
+++ lldb/trunk/lit/Reproducer/Inputs/FileCapture.in Fri Sep 13 16:27:31 2019
@@ -1,3 +1,4 @@
 run
 reproducer status
+reproducer dump -p files
 reproducer generate

Added: lldb/trunk/lit/Reproducer/TestDump.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestDump.test?rev=371909=auto
==
--- lldb/trunk/lit/Reproducer/TestDump.test (added)
+++ lldb/trunk/lit/Reproducer/TestDump.test Fri Sep 13 16:27:31 2019
@@ -0,0 +1,21 @@
+# This tests the reproducer dump functionality.
+
+# Generate a reproducer.
+# RUN: mkdir -p %t
+# RUN: rm -rf %t.repro
+# RUN: %clang %S/Inputs/simple.c -g -o %t/reproducer.out
+# RUN: %lldb -x -b -s %S/Inputs/FileCapture.in -o 'reproducer dump -p files' 
--capture --capture-path %t.repro %t/reproducer.out
+
+# RUN: %lldb -b -o 'reproducer dump -p files -f %t.repro' | FileCheck %s 
--check-prefix FILES
+# FILES: 'reproducer.out'
+# FILES: 'FileCapture.in'
+
+# RUN: %lldb -b -o 'reproducer dump -p version -f %t.repro' | FileCheck %s 
--check-prefix VERSION
+# VERSION: lldb version
+
+# RUN: %lldb -b -o 'reproducer dump -p commands -f %t.repro' | FileCheck %s 
--check-prefix COMMANDS
+# COMMANDS: command source
+# COMMANDS: target create
+# COMMANDS: command source
+
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix FILES

Modified: lldb/trunk/source/Commands/CommandObjectReproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectReproducer.cpp?rev=371909=371908=371909=diff
==
--- lldb/trunk/source/Commands/CommandObjectReproducer.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp Fri Sep 13 16:27:31 
2019
@@ -8,6 +8,7 @@
 
 #include "CommandObjectReproducer.h"
 
+#include "lldb/Host/OptionParser.h"
 #include "lldb/Utility/Reproducer.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -16,7 +17,52 @@
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 
 using namespace lldb;
+using namespace llvm;
 using namespace lldb_private;
+using namespace lldb_private::repro;
+
+enum ReproducerProvider {
+  eReproducerProviderCommands,
+  eReproducerProviderFiles,
+  eReproducerProviderGDB,
+  eReproducerProviderVersion,
+  eReproducerProviderNone
+};
+
+static constexpr OptionEnumValueElement g_reproducer_provider_type[] = {
+{
+eReproducerProviderCommands,
+"commands",
+"Command Interpreter Commands",
+},
+{
+eReproducerProviderFiles,
+"files",
+"Files",
+},
+{
+eReproducerProviderGDB,
+"gdb",
+"GDB Remote Packets",
+},
+{
+eReproducerProviderVersion,
+"version",
+"Version",
+},
+{
+eReproducerProviderNone,
+"none",
+"None",
+},
+};
+
+static constexpr OptionEnumValues ReproducerProviderType() {
+  return OptionEnumValues(g_reproducer_provider_type);
+}
+
+#define LLDB_OPTIONS_reproducer
+#include "CommandOptions.inc"
 
 class CommandObjectReproducerGenerate : public CommandObjectParsed {
 public:
@@ -38,7 +84,7 @@ protected:
   return false;
 }
 
-auto  = repro::Reproducer::Instance();
+auto  = Reproducer::Instance();
 if (auto generator = r.GetGenerator()) {
   generator->Keep();
 } else if (r.GetLoader()) {
@@ -84,7 +130,7 @@ protected:
   return false;
 }
 
-auto  = repro::Reproducer::Instance();
+auto  = Reproducer::Instance();
 if (r.GetGenerator()) {
   result.GetOutputStream() << "Reproducer is in capture mode.\n";
 } else if (r.GetLoader()) {
@@ -98,6 +144,191 @@ protected:
   }
 };
 
+static void SetError(CommandReturnObject , Error err) {
+  result.GetErrorStream().Printf("error: %s\n",
+ toString(std::move(err)).c_str());
+  result.SetStatus(eReturnStatusFailed);
+}
+
+class 

[Lldb-commits] [PATCH] D67523: [Reproducer] Move GDB Remote Packet into Utility. (NFC)

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371907: [Reproducer] Move GDB Remote Packet into Utility. 
(NFC) (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67523?vs=220019=220191#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67523/new/

https://reviews.llvm.org/D67523

Files:
  lldb/trunk/include/lldb/Utility/GDBRemote.h
  lldb/trunk/include/lldb/Utility/Reproducer.h
  lldb/trunk/include/lldb/Utility/StreamGDBRemote.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/trunk/source/Utility/CMakeLists.txt
  lldb/trunk/source/Utility/GDBRemote.cpp
  lldb/trunk/source/Utility/StreamGDBRemote.cpp
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp

Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
@@ -12,7 +12,7 @@
 #include "Plugins/Process/Utility/LinuxSignals.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteClientBase.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h"
-#include "lldb/Utility/StreamGDBRemote.h"
+#include "lldb/Utility/GDBRemote.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Testing/Support/Error.h"
 
Index: lldb/trunk/source/Utility/CMakeLists.txt
===
--- lldb/trunk/source/Utility/CMakeLists.txt
+++ lldb/trunk/source/Utility/CMakeLists.txt
@@ -25,6 +25,7 @@
   Environment.cpp
   Event.cpp
   FileSpec.cpp
+  GDBRemote.cpp
   IOObject.cpp
   JSON.cpp
   LLDBAssert.cpp
@@ -44,7 +45,6 @@
   Status.cpp
   Stream.cpp
   StreamCallback.cpp
-  StreamGDBRemote.cpp
   StreamString.cpp
   StringExtractor.cpp
   StringExtractorGDBRemote.cpp
Index: lldb/trunk/source/Utility/GDBRemote.cpp
===
--- lldb/trunk/source/Utility/GDBRemote.cpp
+++ lldb/trunk/source/Utility/GDBRemote.cpp
@@ -0,0 +1,88 @@
+//===-- GDBRemote.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Utility/GDBRemote.h"
+
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/Stream.h"
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace llvm;
+
+StreamGDBRemote::StreamGDBRemote() : StreamString() {}
+
+StreamGDBRemote::StreamGDBRemote(uint32_t flags, uint32_t addr_size,
+ ByteOrder byte_order)
+: StreamString(flags, addr_size, byte_order) {}
+
+StreamGDBRemote::~StreamGDBRemote() {}
+
+int StreamGDBRemote::PutEscapedBytes(const void *s, size_t src_len) {
+  int bytes_written = 0;
+  const uint8_t *src = static_cast(s);
+  bool binary_is_set = m_flags.Test(eBinary);
+  m_flags.Clear(eBinary);
+  while (src_len) {
+uint8_t byte = *src;
+src++;
+src_len--;
+if (byte == 0x23 || byte == 0x24 || byte == 0x7d || byte == 0x2a) {
+  bytes_written += PutChar(0x7d);
+  byte ^= 0x20;
+}
+bytes_written += PutChar(byte);
+  };
+  if (binary_is_set)
+m_flags.Set(eBinary);
+  return bytes_written;
+}
+
+void GDBRemotePacket::Serialize(raw_ostream ) const {
+  yaml::Output yout(strm);
+  yout << const_cast(*this);
+  strm.flush();
+}
+
+void yaml::ScalarEnumerationTraits::enumeration(
+IO , GDBRemotePacket::Type ) {
+  io.enumCase(value, "Invalid", GDBRemotePacket::ePacketTypeInvalid);
+  io.enumCase(value, "Send", GDBRemotePacket::ePacketTypeSend);
+  io.enumCase(value, "Recv", GDBRemotePacket::ePacketTypeRecv);
+}
+
+void yaml::ScalarTraits::output(
+const GDBRemotePacket::BinaryData , void *, raw_ostream ) {
+  Out << toHex(Val.data);
+}
+
+StringRef 

[Lldb-commits] [lldb] r371907 - [Reproducer] Move GDB Remote Packet into Utility. (NFC)

2019-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 13 16:14:10 2019
New Revision: 371907

URL: http://llvm.org/viewvc/llvm-project?rev=371907=rev
Log:
[Reproducer] Move GDB Remote Packet into Utility. (NFC)

To support dumping the reproducer's GDB remote packets, we need the
(de)serialization logic to live in Utility rather than the GDB remote
plugin. This patch renames StreamGDBRemote to GDBRemote and moves the
relevant packet code there.

Its uses in the GDBRemoteCommunicationHistory and the
GDBRemoteCommunicationReplayServer are updated as well.

Differential revision: https://reviews.llvm.org/D67523

Added:
lldb/trunk/include/lldb/Utility/GDBRemote.h
lldb/trunk/source/Utility/GDBRemote.cpp
Removed:
lldb/trunk/include/lldb/Utility/StreamGDBRemote.h
lldb/trunk/source/Utility/StreamGDBRemote.cpp
Modified:
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h

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

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp

Added: lldb/trunk/include/lldb/Utility/GDBRemote.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/GDBRemote.h?rev=371907=auto
==
--- lldb/trunk/include/lldb/Utility/GDBRemote.h (added)
+++ lldb/trunk/include/lldb/Utility/GDBRemote.h Fri Sep 13 16:14:10 2019
@@ -0,0 +1,113 @@
+//===-- GDBRemote.h --*- 
C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_GDBRemote_h_
+#define liblldb_GDBRemote_h_
+
+#include "lldb/Utility/StreamString.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+#include "llvm/Support/YAMLTraits.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+class StreamGDBRemote : public StreamString {
+public:
+  StreamGDBRemote();
+
+  StreamGDBRemote(uint32_t flags, uint32_t addr_size,
+  lldb::ByteOrder byte_order);
+
+  ~StreamGDBRemote() override;
+
+  /// Output a block of data to the stream performing GDB-remote escaping.
+  ///
+  /// \param[in] s
+  /// A block of data.
+  ///
+  /// \param[in] src_len
+  /// The amount of data to write.
+  ///
+  /// \return
+  /// Number of bytes written.
+  // TODO: Convert this function to take ArrayRef
+  int PutEscapedBytes(const void *s, size_t src_len);
+};
+
+/// GDB remote packet as used by the reproducer and the GDB remote
+/// communication history. Packets can be serialized to file.
+struct GDBRemotePacket {
+
+  friend llvm::yaml::MappingTraits;
+
+  enum Type { ePacketTypeInvalid = 0, ePacketTypeSend, ePacketTypeRecv };
+
+  GDBRemotePacket()
+  : packet(), type(ePacketTypeInvalid), bytes_transmitted(0), 
packet_idx(0),
+tid(LLDB_INVALID_THREAD_ID) {}
+
+  void Clear() {
+packet.data.clear();
+type = ePacketTypeInvalid;
+bytes_transmitted = 0;
+packet_idx = 0;
+tid = LLDB_INVALID_THREAD_ID;
+  }
+
+  struct BinaryData {
+std::string data;
+  };
+
+  void Serialize(llvm::raw_ostream ) const;
+
+  BinaryData packet;
+  Type type;
+  uint32_t bytes_transmitted;
+  uint32_t packet_idx;
+  lldb::tid_t tid;
+};
+
+} // namespace lldb_private
+
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(lldb_private::GDBRemotePacket)
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(std::vector)
+
+namespace llvm {
+namespace yaml {
+
+template <>
+struct ScalarEnumerationTraits {
+  static void enumeration(IO , lldb_private::GDBRemotePacket::Type );
+};
+
+template <> struct ScalarTraits {
+  static void output(const lldb_private::GDBRemotePacket::BinaryData &, void *,
+ raw_ostream &);
+
+  static StringRef input(StringRef, void *,
+ lldb_private::GDBRemotePacket::BinaryData &);
+
+  static QuotingType mustQuote(StringRef S) { return QuotingType::None; }
+};
+
+template <> struct MappingTraits {

[Lldb-commits] [PATCH] D67474: [Reproducer] Add `reproducer dump` command

2019-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Approved with that addition.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67474/new/

https://reviews.llvm.org/D67474



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


[Lldb-commits] [PATCH] D67474: [Reproducer] Add `reproducer dump` command

2019-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The help for -f should say what happens if this option isn't provided.  
Otherwise this looks fine.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67474/new/

https://reviews.llvm.org/D67474



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


[Lldb-commits] [PATCH] D67523: [Reproducer] Move GDB Remote Packet into Utility. (NFC)

2019-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.

Looks right.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67523/new/

https://reviews.llvm.org/D67523



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


[Lldb-commits] [PATCH] D67540: [lldb] Remove SetCount/ClearCount from Flags

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

Thanks!


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67540/new/

https://reviews.llvm.org/D67540



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


[Lldb-commits] [lldb] r371905 - [test] Update TestAPILog to pass on Windows.

2019-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 13 15:14:59 2019
New Revision: 371905

URL: http://llvm.org/viewvc/llvm-project?rev=371905=rev
Log:
[test] Update TestAPILog to pass on Windows.

The pretty function macro is including __cdecl on Windows, which was
causing the pattern matching to fail. This should fix that.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py?rev=371905=371904=371905=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py Fri Sep 13 
15:14:59 2019
@@ -39,9 +39,9 @@ class APILogTestCase(TestBase):
 r"lldb::SBDebugger::GetScriptingLanguage\(const char \*\) 
\(0x([0-9a-fA-F]+),",
 log)[0]
 
-get_scripting_language = 'lldb::ScriptLanguage 
lldb::SBDebugger::GetScriptingLanguage(const char *) (0x{}, "")'.format(
+get_scripting_language = 'lldb::SBDebugger::GetScriptingLanguage(const 
char *) (0x{}, "")'.format(
 debugger_addr)
-create_target = 'lldb::SBTarget lldb::SBDebugger::CreateTarget(const 
char *) (0x{}, "")'.format(
+create_target = 'lldb::SBDebugger::CreateTarget(const char *) (0x{}, 
"")'.format(
 debugger_addr)
 
 self.assertTrue(get_scripting_language in log, log)


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


[Lldb-commits] [lldb] r371902 - [LLDB] Add missing breaks for switch statement

2019-09-13 Thread Tim Shen via lldb-commits
Author: timshen
Date: Fri Sep 13 15:00:03 2019
New Revision: 371902

URL: http://llvm.org/viewvc/llvm-project?rev=371902=rev
Log:
[LLDB] Add missing breaks for switch statement

Modified:
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=371902=371901=371902=diff
==
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Fri Sep 13 15:00:03 2019
@@ -119,13 +119,16 @@ static Status save_socket_id_to_file(con
  case atomic_write_error::failed_to_create_uniq_file:
status = Status("Failed to create temp file: %s",
ErrorMsgBuffer.c_str());
+   break;
  case atomic_write_error::output_stream_error:
status = Status("Failed to write to port file.");
+   break;
  case atomic_write_error::failed_to_rename_temp_file:
status = Status("Failed to rename file %s to %s: 
%s",
ErrorMsgBuffer.c_str(),
file_spec.GetPath().c_str(),
ErrorMsgBuffer.c_str());
+   break;
  }
})) {
 return Status("Failed to atomically write file %s",


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


[Lldb-commits] [lldb] r371899 - [test] Print the log output on failure.

2019-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 13 14:15:03 2019
New Revision: 371899

URL: http://llvm.org/viewvc/llvm-project?rev=371899=rev
Log:
[test] Print the log output on failure.

This ensures that if the assertion fails we dump the log content. This
should help me investigate what the output looks like on Windows, where
the test is failing.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py?rev=371899=371898=371899=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py Fri Sep 13 
14:15:03 2019
@@ -44,5 +44,5 @@ class APILogTestCase(TestBase):
 create_target = 'lldb::SBTarget lldb::SBDebugger::CreateTarget(const 
char *) (0x{}, "")'.format(
 debugger_addr)
 
-self.assertTrue(get_scripting_language in log)
-self.assertTrue(create_target in log)
+self.assertTrue(get_scripting_language in log, log)
+self.assertTrue(create_target in log, log)


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


[Lldb-commits] [PATCH] D65677: [VirtualFileSystem] Make the RedirectingFileSystem hold on to its own working directory.

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65677/new/

https://reviews.llvm.org/D65677



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


[Lldb-commits] [PATCH] D67347: [Windows] Use information from the PE32 exceptions directory to construct unwind plans

2019-09-13 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov marked 4 inline comments as done.
aleksandr.urakov added a comment.

Hi Jason, thanks for the review!

Initially, the reason of these changes was to reuse the code that works with 
`eh_frame`, because on Windows we have a very similar compiler generated info 
designed to help with unwinding stacks during exception handling. That's why I 
have chosen `DWARFCallFrameInfo` and have extracted its interface (`I` in 
`ICallFrameInfo` stands for `Interface`, but I've renamed it to `CallFrameInfo` 
in the last patch, because this notation doesn't look common in LLVM).

But there is one more reason that makes it very difficult to just create 
`PECallFrameInfo` in `UnwindTable` like we do with `DWARFCallFrameInfo`: 
`PECallFrameInfo` is coupled very tight with `ObjectFilePECOFF` and can't work 
over plain `ObjectFile`. First of all, it uses several functions for work with 
relative virtual addresses (RVA), and they are implemented with the use of 
`ObjectFilePECOFF`'s private variable `m_image_base` (however, may be it is 
possible to implement these methods over the `ObjectFile` interface, I'm not 
sure about that). The second, it requires information about exception directory 
location, but it is an inner mechanics of `ObjectFilePECOFF`. So its relations 
with `ObjectFilePECOFF` are not the same as between `DWARFCallFrameInfo` and 
ELF or Mach-O.

To resolve the situation we can:

- use something like a `dynamic_cast` to `ObjectFilePECOFF` in `UnwindTable` 
and create `PECallFrameInfo` with it. But in this case `lldbSymbol` becomes 
dependent on `lldbPluginObjectFilePECOFF` (and we get a circular dependency);
- extend `ObjectFile`'s interface to make it possible for `PECallFrameInfo` to 
work with required PE abstractions. In this case we can just create 
`PECallFrameInfo` in `UnwindTable` like we do with `DWARFCallFrameInfo`, but it 
adds weird operations to `ObjectFile`'s interface, which are not related to 
other object file formats;
- allow `ObjectFile` to create its own unwind infos by himself.

I've found the last idea good, and decided to redo things in this way (because 
`DWARFCallFrameInfo` etc. are working over object files too). But you are 
right, it also has a negative impact on `ObjectFile`: it becomes knowing of the 
things it shouldn't. So in the last patch I have left only a most abstract 
method, which only allows to get some unwind info from an object file, and 
introduced corresponding entities in `UnwindTable` and `FuncUnwinders`. I think 
it can be a good start for moving in the direction that Greg suggests.

What do you think of this?




Comment at: lldb/include/lldb/Symbol/DWARFCallFrameInfo.h:74
 
-  void ForEachFDEEntries(
-  const std::function 
);
+  void ForEachEntries(const std::function 
) override;
 

amccarth wrote:
> I find the name `ForEachEntries` confusing.  I know this is a leftover from 
> the original code that you're modifying, but I wonder if it can get a better 
> name.  In particular, I don't know why it's plural, so I'd expect 
> `ForEachEntry`, but even that is pretty vague.  I realize `FDE` is 
> DWARF-specific, but at least it gives a clue as to what type of entries are 
> involved.
I just have removed it from the new version.



Comment at: lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp:541
+const RuntimeFunction *PECallFrameInfo::FindRuntimeFunctionItersectsWithRange(
+const AddressRange ) const {
+  uint32_t rva = m_object_file.GetRVA(range.GetBaseAddress());

amccarth wrote:
> Isn't it possible for more than one RuntimeFunction to intersect with an 
> address range?  In normal use, it might not happen because it's being called 
> with constrained ranges, so maybe it's nothing to worry about.  I suppose if 
> the range were too large and it encompassed several functions, returning any 
> one of them is acceptable.
Yes, it is possible. The problem here is that `FuncUnwinders` requests the plan 
with an `AddressRange`, not with an `Address`, and the information about  the 
original requested address is lost to that moment. The required `AddressRange` 
is calculated in `UnwindTable::GetAddressRange`, that's why the order of 
querying unwind infos is important in that function. I think that this logic 
requires some rework, but it seems that it is not a good idea to do it in this 
patch.



Comment at: lldb/source/Symbol/ObjectFile.cpp:687
+  return std::make_unique(*this, sect,
+  DWARFCallFrameInfo::EH);
+}

amccarth wrote:
> It seems a bit weird for DWARF-specific code to be here, when there are 
> ObjectFile plugins for PECOFF, ELF, and Mach-O.  Obviously the 
> PECOFFCallFrameInfo is instantiated in the PECOFF plugin.  The ELF and Mach-O 
> versions instantiate DWARFCallFrameInfos.  Does the generic ObjectFile need 
> to do the same?
I just have made a default implementation to avoid 

[Lldb-commits] [PATCH] D67538: [Reproducer] Include the this pointer in the API log.

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371885: [Reproducer] Include the this pointer in the API 
log. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67538?vs=220044=220151#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67538/new/

https://reviews.llvm.org/D67538

Files:
  lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
  lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py

Index: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
===
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
@@ -40,7 +40,7 @@
 template <>
 inline void stringify_append(llvm::raw_string_ostream ,
const char *t) {
-  ss << t;
+  ss << '\"' << t << '\"';
 }
 
 template 
@@ -105,8 +105,8 @@
   }
 
 #define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...)  \
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
-stringify_args(__VA_ARGS__));  \
+  lldb_private::repro::Recorder sb_recorder(   \
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   \
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(\
@@ -117,8 +117,8 @@
   }
 
 #define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...)\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
-stringify_args(__VA_ARGS__));  \
+  lldb_private::repro::Recorder sb_recorder(   \
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   \
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(\
@@ -129,7 +129,8 @@
   }
 
 #define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)  \
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
+stringify_args(*this));\
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(data.GetSerializer(), data.GetRegistry(),   \
@@ -139,7 +140,8 @@
   }
 
 #define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
+stringify_args(*this));\
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(\
@@ -542,9 +544,7 @@
 SerializeAll(tail...);
   }
 
-  void SerializeAll() {
-m_stream.flush();
-  }
+  void SerializeAll() { m_stream.flush(); }
 
 private:
   /// Serialize pointers. We need to differentiate between pointers to
Index: lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
+++ lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
@@ -0,0 +1,48 @@
+"""
+Test API logging.
+"""
+
+import re
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class APILogTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_api_log(self):
+"""Test API logging"""
+logfile = os.path.join(self.getBuildDir(), "api-log.txt")
+
+def cleanup():
+if os.path.exists(logfile):
+os.unlink(logfile)
+
+self.addTearDownHook(cleanup)
+self.expect("log enable lldb api -f {}".format(logfile))
+
+self.dbg.SetDefaultArchitecture(None)
+self.dbg.GetScriptingLanguage(None)
+target = self.dbg.CreateTarget(None)
+
+print(logfile)
+with open(logfile, 'r') as f:
+log = 

[Lldb-commits] [lldb] r371885 - [Reproducer] Include the this pointer in the API log.

2019-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Sep 13 12:08:10 2019
New Revision: 371885

URL: http://llvm.org/viewvc/llvm-project?rev=371885=rev
Log:
[Reproducer] Include the this pointer in the API log.

The new centralized way of doing API logging through the reproducer
macros is lacking a way to easily correlate instances of API objects.
Logging the this pointer makes that significantly easier. For methods
this is now always passed as the first argument, similar to the self
argument in Python.

This patch also adds a test case for API logging, which uncovered that
we were not quoting strings.

Differential revision: https://reviews.llvm.org/D67538

Added:
lldb/trunk/packages/Python/lldbsuite/test/api/log/
lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
Modified:
lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=371885=371884=371885=diff
==
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Fri Sep 13 
12:08:10 2019
@@ -40,7 +40,7 @@ inline void stringify_append(llvm::raw_s
 template <>
 inline void stringify_append(llvm::raw_string_ostream ,
const char *t) {
-  ss << t;
+  ss << '\"' << t << '\"';
 }
 
 template 
@@ -105,8 +105,8 @@ template  inline std::st
   }
 
 #define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...)  
\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  
\
-stringify_args(__VA_ARGS__));  
\
+  lldb_private::repro::Recorder sb_recorder(   
\
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   
\
   if (lldb_private::repro::InstrumentationData data =  
\
   LLDB_GET_INSTRUMENTATION_DATA()) {   
\
 sb_recorder.Record(
\
@@ -117,8 +117,8 @@ template  inline std::st
   }
 
 #define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...)
\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  
\
-stringify_args(__VA_ARGS__));  
\
+  lldb_private::repro::Recorder sb_recorder(   
\
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   
\
   if (lldb_private::repro::InstrumentationData data =  
\
   LLDB_GET_INSTRUMENTATION_DATA()) {   
\
 sb_recorder.Record(
\
@@ -129,7 +129,8 @@ template  inline std::st
   }
 
 #define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)  
\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); 
\
+  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  
\
+stringify_args(*this));
\
   if (lldb_private::repro::InstrumentationData data =  
\
   LLDB_GET_INSTRUMENTATION_DATA()) {   
\
 sb_recorder.Record(data.GetSerializer(), data.GetRegistry(),   
\
@@ -139,7 +140,8 @@ template  inline std::st
   }
 
 #define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); 
\
+  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  
\
+stringify_args(*this));
\
   if (lldb_private::repro::InstrumentationData data =  
\
   LLDB_GET_INSTRUMENTATION_DATA()) {   
\
 sb_recorder.Record(
\
@@ -542,9 +544,7 @@ public:
 SerializeAll(tail...);
   }
 
-  void SerializeAll() {
-m_stream.flush();
-  }
+  void SerializeAll() { m_stream.flush(); }
 
 private:
   /// Serialize pointers. We need to differentiate between pointers to

Added: lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py?rev=371885=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/log/TestAPILog.py Fri Sep 13 
12:08:10 2019
@@ -0,0 +1,48 @@
+"""
+Test API logging.
+"""
+
+import re
+
+import lldb

[Lldb-commits] [lldb] r371882 - Fix error in ProcessLauncherWindows.cpp

2019-09-13 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Fri Sep 13 11:50:39 2019
New Revision: 371882

URL: http://llvm.org/viewvc/llvm-project?rev=371882=rev
Log:
Fix error in ProcessLauncherWindows.cpp

Restored missing parens on a function call.

Modified:
lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp

Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=371882=371881=371882=diff
==
--- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Fri Sep 13 
11:50:39 2019
@@ -46,7 +46,7 @@ bool GetFlattenedWindowsCommandString(Ar
 
   std::vector args_ref;
   for (auto  : args.entries())
-args_ref.push_back(entry.ref);
+args_ref.push_back(entry.ref());
 
   command = llvm::sys::flattenWindowsCommandLine(args_ref);
   return true;


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


[Lldb-commits] [PATCH] D67347: [Windows] Use information from the PE32 exceptions directory to construct unwind plans

2019-09-13 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov updated this revision to Diff 220144.
aleksandr.urakov edited the summary of this revision.
aleksandr.urakov added a comment.

Update due to the requests.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67347/new/

https://reviews.llvm.org/D67347

Files:
  lldb/include/lldb/Symbol/CallFrameInfo.h
  lldb/include/lldb/Symbol/FuncUnwinders.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Symbol/UnwindTable.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.h
  lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  lldb/source/Symbol/FuncUnwinders.cpp
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Symbol/UnwindTable.cpp
  lldb/unittests/ObjectFile/CMakeLists.txt
  lldb/unittests/ObjectFile/PECOFF/CMakeLists.txt
  lldb/unittests/ObjectFile/PECOFF/TestPECallFrameInfo.cpp
  llvm/include/llvm/Support/Win64EH.h

Index: llvm/include/llvm/Support/Win64EH.h
===
--- llvm/include/llvm/Support/Win64EH.h
+++ llvm/include/llvm/Support/Win64EH.h
@@ -30,7 +30,9 @@
   UOP_SetFPReg,
   UOP_SaveNonVol,
   UOP_SaveNonVolBig,
-  UOP_SaveXMM128 = 8,
+  UOP_Epilog,
+  UOP_SpareCode,
+  UOP_SaveXMM128,
   UOP_SaveXMM128Big,
   UOP_PushMachFrame,
   // The following set of unwind opcodes is for ARM64.  They are documented at
Index: lldb/unittests/ObjectFile/PECOFF/TestPECallFrameInfo.cpp
===
--- /dev/null
+++ lldb/unittests/ObjectFile/PECOFF/TestPECallFrameInfo.cpp
@@ -0,0 +1,336 @@
+//===-- TestPECallFrameInfo.cpp --*- C++ -*-===//
+//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
+#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
+#include "TestingSupport/TestUtilities.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Symbol/CallFrameInfo.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "llvm/Testing/Support/Error.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+class PECallFrameInfoTest : public testing::Test {
+public:
+  void SetUp() override {
+FileSystem::Initialize();
+ObjectFilePECOFF::Initialize();
+  }
+
+  void TearDown() override {
+ObjectFilePECOFF::Terminate();
+FileSystem::Terminate();
+  }
+
+protected:
+  void GetUnwindPlan(addr_t file_addr, UnwindPlan ) const;
+};
+
+void PECallFrameInfoTest::GetUnwindPlan(addr_t file_addr, UnwindPlan ) const {
+  llvm::Expected ExpectedFile = TestFile::fromYaml(
+  R"(
+--- !COFF
+OptionalHeader:  
+  AddressOfEntryPoint: 0
+  ImageBase:   16777216
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable: 
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable: 
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:   
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:  
+RelativeVirtualAddress: 12288
+Size:60
+  CertificateTable: 
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable: 
+RelativeVirtualAddress: 0
+Size:0
+  Debug:   
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:   
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable: 
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport: 
+RelativeVirtualAddress: 0
+Size:0
+  IAT: 
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor: 
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader: 
+RelativeVirtualAddress: 0
+Size:0
+header:  
+  Machine: 

[Lldb-commits] [PATCH] D67538: [Reproducer] Include the this pointer in the API log.

2019-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67538/new/

https://reviews.llvm.org/D67538



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


[Lldb-commits] [PATCH] D67540: [lldb] Remove SetCount/ClearCount from Flags

2019-09-13 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Sure. If anything something like this should live in llvm/Support, but given 
it's not used, it should live nowhere.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67540/new/

https://reviews.llvm.org/D67540



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


[Lldb-commits] [lldb] r371866 - [lldb] - Update unit tests after lib/ObjectYAML change.

2019-09-13 Thread George Rimar via lldb-commits
Author: grimar
Date: Fri Sep 13 09:00:28 2019
New Revision: 371866

URL: http://llvm.org/viewvc/llvm-project?rev=371866=rev
Log:
[lldb] - Update unit tests after lib/ObjectYAML change.

An update after r371865

Modified:
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
lldb/trunk/unittests/TestingSupport/TestUtilities.cpp

Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=371866=371865=371866=diff
==
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Fri Sep 13 
09:00:28 2019
@@ -56,8 +56,9 @@ public:
 std::string data;
 llvm::raw_string_ostream os(data);
 llvm::yaml::Input YIn(yaml);
-if (llvm::Error E = llvm::yaml::convertYAML(YIn, os))
-  return E;
+if (!llvm::yaml::convertYAML(YIn, os, [](const llvm::Twine ) {}))
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "convertYAML() failed");
 
 os.flush();
 auto data_buffer_sp =
@@ -83,7 +84,8 @@ Streams:
   - Type:LinuxAuxv
 Content: DEADBEEFBAADF00D
   )");
-  ASSERT_THAT_ERROR(llvm::yaml::convertYAML(YIn, os), llvm::Succeeded());
+
+  ASSERT_TRUE(llvm::yaml::convertYAML(YIn, os, [](const llvm::Twine ){}));
   os.flush();
   auto data_buffer_sp = std::make_shared(
   duplicate_streams.data(), duplicate_streams.size());

Modified: lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/TestUtilities.cpp?rev=371866=371865=371866=diff
==
--- lldb/trunk/unittests/TestingSupport/TestUtilities.cpp (original)
+++ lldb/trunk/unittests/TestingSupport/TestUtilities.cpp Fri Sep 13 09:00:28 
2019
@@ -39,8 +39,9 @@ llvm::Expected TestFile::fromY
   {
 llvm::raw_fd_ostream OS(FD, /*shouldClose*/ true);
 llvm::yaml::Input YIn(Yaml);
-if (llvm::Error E = llvm::yaml::convertYAML(YIn, OS))
-  return std::move(E);
+if (!llvm::yaml::convertYAML(YIn, OS, [](const llvm::Twine ) {}))
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "convertYAML() failed");
   }
   return TestFile(Name, std::move(Remover));
 }


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


[Lldb-commits] [PATCH] D67022: Enhance SymbolFileDWARF::ParseDeclsForContext performance

2019-09-13 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

In D67022#1665800 , @labath wrote:

> looks fine to me


Thank you, guys! Could you please submit it for me?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67022/new/

https://reviews.llvm.org/D67022



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


[Lldb-commits] [lldb] r371842 - [lldb][NFC] Remove ArgEntry::ref member

2019-09-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 13 04:26:48 2019
New Revision: 371842

URL: http://llvm.org/viewvc/llvm-project?rev=371842=rev
Log:
[lldb][NFC] Remove ArgEntry::ref member

The StringRef should always be identical to the C string, so we
might as well just create the StringRef from the C-string. This
might be slightly slower until we implement the storage of ArgEntry
with a string instead of a std::unique_ptr. Until then we
have to do the additional strlen on the C string to construct the
StringRef.

Modified:
lldb/trunk/include/lldb/Utility/Args.h
lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectHelp.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Interpreter/CommandAlias.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
lldb/trunk/source/Interpreter/Options.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Utility/Args.cpp
lldb/trunk/unittests/Utility/ArgsTest.cpp

Modified: lldb/trunk/include/lldb/Utility/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Args.h?rev=371842=371841=371842=diff
==
--- lldb/trunk/include/lldb/Utility/Args.h (original)
+++ lldb/trunk/include/lldb/Utility/Args.h Fri Sep 13 04:26:48 2019
@@ -43,7 +43,7 @@ public:
 ArgEntry() = default;
 ArgEntry(llvm::StringRef str, char quote);
 
-llvm::StringRef ref;
+llvm::StringRef ref() const { return c_str(); }
 const char *c_str() const { return ptr.get(); }
 
 /// Returns true if this argument was quoted in any way.

Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=371842=371841=371842=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Fri Sep 13 04:26:48 2019
@@ -122,7 +122,7 @@ void BreakpointIDList::FindAndReplaceIDR
   for (size_t i = 0; i < old_args.size(); ++i) {
 bool is_range = false;
 
-current_arg = old_args[i].ref;
+current_arg = old_args[i].ref();
 if (!allow_locations && current_arg.contains('.')) {
   result.AppendErrorWithFormat(
   "Breakpoint locations not allowed, saw location: %s.",
@@ -146,16 +146,16 @@ void BreakpointIDList::FindAndReplaceIDR
   } else
 names_found.insert(current_arg);
 } else if ((i + 2 < old_args.size()) &&
-   BreakpointID::IsRangeIdentifier(old_args[i + 1].ref) &&
+   BreakpointID::IsRangeIdentifier(old_args[i + 1].ref()) &&
BreakpointID::IsValidIDExpression(current_arg) &&
-   BreakpointID::IsValidIDExpression(old_args[i + 2].ref)) {
+   BreakpointID::IsValidIDExpression(old_args[i + 2].ref())) {
   range_from = current_arg;
-  range_to = old_args[i + 2].ref;
+  range_to = old_args[i + 2].ref();
   is_range = true;
   i = i + 2;
 } else {
   // See if user has specified id.*
-  llvm::StringRef tmp_str = old_args[i].ref;
+  llvm::StringRef tmp_str = old_args[i].ref();
   size_t pos = tmp_str.find('.');
   if (pos != llvm::StringRef::npos) {
 llvm::StringRef bp_id_str = tmp_str.substr(0, pos);

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=371842=371841=371842=diff
==
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Fri Sep 13 04:26:48 2019
@@ -44,7 +44,7 @@ bool CommandObjectApropos::DoExecute(Arg
   const size_t argc = 

[Lldb-commits] [lldb] r371836 - [lldb][NFC] Simplify Args::ReplaceArgumentAtIndex

2019-09-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 13 03:41:29 2019
New Revision: 371836

URL: http://llvm.org/viewvc/llvm-project?rev=371836=rev
Log:
[lldb][NFC] Simplify Args::ReplaceArgumentAtIndex

This code is not on any performance critical path that would
justify this shortening optimization. It also makes it possible
to turn 'ref' into a function (as this is the only place where
we modify this ArgEntry member).

Modified:
lldb/trunk/source/Utility/Args.cpp

Modified: lldb/trunk/source/Utility/Args.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Args.cpp?rev=371836=371835=371836=diff
==
--- lldb/trunk/source/Utility/Args.cpp (original)
+++ lldb/trunk/source/Utility/Args.cpp Fri Sep 13 03:41:29 2019
@@ -336,15 +336,8 @@ void Args::ReplaceArgumentAtIndex(size_t
   if (idx >= m_entries.size())
 return;
 
-  if (arg_str.size() > m_entries[idx].ref.size()) {
-m_entries[idx] = ArgEntry(arg_str, quote_char);
-m_argv[idx] = m_entries[idx].data();
-  } else {
-const char *src_data = arg_str.data() ? arg_str.data() : "";
-::memcpy(m_entries[idx].data(), src_data, arg_str.size());
-m_entries[idx].ptr[arg_str.size()] = 0;
-m_entries[idx].ref = m_entries[idx].ref.take_front(arg_str.size());
-  }
+  m_entries[idx] = ArgEntry(arg_str, quote_char);
+  m_argv[idx] = m_entries[idx].data();
 }
 
 void Args::DeleteArgumentAtIndex(size_t idx) {


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


[Lldb-commits] [PATCH] D67540: [lldb] Remove SetCount/ClearCount from Flags

2019-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: davide.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
Herald added a project: LLDB.

These functions are only used in tests where we should test the actual flag 
values instead of counting all bits for an approximate check.
Also these popcount implementation aren't very efficient and doesn't seem to be 
optimised to anything fast.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67540

Files:
  lldb/include/lldb/Utility/Flags.h
  lldb/unittests/Utility/FlagsTest.cpp

Index: lldb/unittests/Utility/FlagsTest.cpp
===
--- lldb/unittests/Utility/FlagsTest.cpp
+++ lldb/unittests/Utility/FlagsTest.cpp
@@ -30,19 +30,18 @@
   Flags f;
   f.Reset(0x3);
   EXPECT_EQ(0x3U, f.Get());
-  EXPECT_EQ(2U, f.SetCount());
 }
 
 TEST(Flags, Clear) {
   Flags f;
   f.Reset(0x3);
-  EXPECT_EQ(2U, f.SetCount());
+  EXPECT_EQ(0x3U, f.Get());
 
   f.Clear(0x5);
-  EXPECT_EQ(1U, f.SetCount());
+  EXPECT_EQ(0x2U, f.Get());
 
   f.Clear();
-  EXPECT_EQ(0U, f.SetCount());
+  EXPECT_EQ(0x0U, f.Get());
 }
 
 TEST(Flags, AllSet) {
@@ -162,37 +161,3 @@
   EXPECT_TRUE(f.IsClear(eFlag0));
   EXPECT_TRUE(f.IsClear(eFlag1));
 }
-
-TEST(Flags, ClearCount) {
-  Flags f;
-  EXPECT_EQ(32U, f.ClearCount());
-
-  f.Set(eFlag0);
-  EXPECT_EQ(31U, f.ClearCount());
-
-  f.Set(eFlag0);
-  EXPECT_EQ(31U, f.ClearCount());
-
-  f.Set(eFlag1);
-  EXPECT_EQ(30U, f.ClearCount());
-
-  f.Set(eAllFlags);
-  EXPECT_EQ(29U, f.ClearCount());
-}
-
-TEST(Flags, SetCount) {
-  Flags f;
-  EXPECT_EQ(0U, f.SetCount());
-
-  f.Set(eFlag0);
-  EXPECT_EQ(1U, f.SetCount());
-
-  f.Set(eFlag0);
-  EXPECT_EQ(1U, f.SetCount());
-
-  f.Set(eFlag1);
-  EXPECT_EQ(2U, f.SetCount());
-
-  f.Set(eAllFlags);
-  EXPECT_EQ(3U, f.SetCount());
-}
Index: lldb/include/lldb/Utility/Flags.h
===
--- lldb/include/lldb/Utility/Flags.h
+++ lldb/include/lldb/Utility/Flags.h
@@ -121,32 +121,6 @@
   /// \b true if \a bit is 0, \b false otherwise.
   bool IsClear(ValueType bit) const { return (m_flags & bit) == 0; }
 
-  /// Get the number of zero bits in \a m_flags.
-  ///
-  /// \return
-  /// The number of bits that are set to 0 in the current flags.
-  size_t ClearCount() const {
-size_t count = 0;
-for (ValueType shift = 0; shift < sizeof(ValueType) * 8; ++shift) {
-  if ((m_flags & (1u << shift)) == 0)
-++count;
-}
-return count;
-  }
-
-  /// Get the number of one bits in \a m_flags.
-  ///
-  /// \return
-  /// The number of bits that are set to 1 in the current flags.
-  size_t SetCount() const {
-size_t count = 0;
-for (ValueType mask = m_flags; mask; mask >>= 1) {
-  if (mask & 1u)
-++count;
-}
-return count;
-  }
-
 protected:
   ValueType m_flags; ///< The flags.
 };
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r371823 - [lldb][NFC] Make ArgEntry::quote private and provide a getter

2019-09-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Sep 13 01:26:00 2019
New Revision: 371823

URL: http://llvm.org/viewvc/llvm-project?rev=371823=rev
Log:
[lldb][NFC] Make ArgEntry::quote private and provide a getter

Modified:
lldb/trunk/include/lldb/Utility/Args.h
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Interpreter/Options.cpp

Modified: lldb/trunk/include/lldb/Utility/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Args.h?rev=371823=371822=371823=diff
==
--- lldb/trunk/include/lldb/Utility/Args.h (original)
+++ lldb/trunk/include/lldb/Utility/Args.h Fri Sep 13 01:26:00 2019
@@ -35,6 +35,7 @@ public:
   private:
 friend class Args;
 std::unique_ptr ptr;
+char quote;
 
 char *data() { return ptr.get(); }
 
@@ -43,11 +44,11 @@ public:
 ArgEntry(llvm::StringRef str, char quote);
 
 llvm::StringRef ref;
-char quote;
 const char *c_str() const { return ptr.get(); }
 
 /// Returns true if this argument was quoted in any way.
 bool IsQuoted() const { return quote != '\0'; }
+char GetQuoteChar() const { return quote; }
   };
 
   /// Construct with an option command string.

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=371823=371822=371823=diff
==
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Sep 13 01:26:00 2019
@@ -394,7 +394,7 @@ int SBCommandInterpreter::HandleCompleti
 // If we matched a unique single command, add a space... Only do this if
 // the completer told us this was a complete word, however...
 if (lldb_matches.GetSize() == 1) {
-  char quote_char = request.GetParsedArg().quote;
+  char quote_char = request.GetParsedArg().GetQuoteChar();
   common_prefix =
   Args::EscapeLLDBCommandArgument(common_prefix, quote_char);
   if (request.GetParsedArg().IsQuoted())

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=371823=371822=371823=diff
==
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Fri Sep 13 01:26:00 2019
@@ -949,7 +949,7 @@ unsigned char Editline::TabCommand(int c
   std::string to_add = completion.GetCompletion();
   to_add = to_add.substr(request.GetCursorArgumentPrefix().size());
   if (request.GetParsedArg().IsQuoted())
-to_add.push_back(request.GetParsedArg().quote);
+to_add.push_back(request.GetParsedArg().GetQuoteChar());
   to_add.push_back(' ');
   el_insertstr(m_editline, to_add.c_str());
   break;

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=371823=371822=371823=diff
==
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Fri Sep 13 01:26:00 2019
@@ -937,7 +937,7 @@ static Args ReconstituteArgsAfterParsing
   for (const char *arg : parsed) {
 auto pos = FindOriginalIter(arg, original);
 assert(pos != original.end());
-result.AppendArgument(pos->ref, pos->quote);
+result.AppendArgument(pos->ref, pos->GetQuoteChar());
   }
   return result;
 }


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


[Lldb-commits] [PATCH] D67538: [Reproducer] Include the this pointer in the API log.

2019-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jingham.
Herald added a subscriber: abidh.
Herald added a project: LLDB.

The new centralized way of doing API logging through the reproducer
macros is lacking a way to easily correlate instances of API objects.
Logging the this pointer makes that significantly easier. For methods
this is now always passed as the first argument, similar to the self
argument in Python.

This patch also adds a test case for API logging, which uncovered that
we were not quoting strings.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67538

Files:
  lldb/include/lldb/Utility/ReproducerInstrumentation.h
  lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py

Index: lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
@@ -0,0 +1,48 @@
+"""
+Test API logging.
+"""
+
+import re
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class APILogTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_api_log(self):
+"""Test API logging"""
+logfile = os.path.join(self.getBuildDir(), "api-log.txt")
+
+def cleanup():
+if os.path.exists(logfile):
+os.unlink(logfile)
+
+self.addTearDownHook(cleanup)
+self.expect("log enable lldb api -f {}".format(logfile))
+
+self.dbg.SetDefaultArchitecture(None)
+self.dbg.GetScriptingLanguage(None)
+target = self.dbg.CreateTarget(None)
+
+print(logfile)
+with open(logfile, 'r') as f:
+log = f.read()
+
+# Find the debugger addr.
+debugger_addr = re.findall(
+r"lldb::SBDebugger::GetScriptingLanguage\(const char \*\) \(0x([0-9a-fA-F]+),",
+log)[0]
+
+get_scripting_language = 'lldb::ScriptLanguage lldb::SBDebugger::GetScriptingLanguage(const char *) (0x{}, "")'.format(
+debugger_addr)
+create_target = 'lldb::SBTarget lldb::SBDebugger::CreateTarget(const char *) (0x{}, "")'.format(
+debugger_addr)
+
+self.assertTrue(get_scripting_language in log)
+self.assertTrue(create_target in log)
Index: lldb/include/lldb/Utility/ReproducerInstrumentation.h
===
--- lldb/include/lldb/Utility/ReproducerInstrumentation.h
+++ lldb/include/lldb/Utility/ReproducerInstrumentation.h
@@ -40,7 +40,7 @@
 template <>
 inline void stringify_append(llvm::raw_string_ostream ,
const char *t) {
-  ss << t;
+  ss << '\"' << t << '\"';
 }
 
 template 
@@ -105,8 +105,8 @@
   }
 
 #define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...)  \
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
-stringify_args(__VA_ARGS__));  \
+  lldb_private::repro::Recorder sb_recorder(   \
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   \
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(\
@@ -117,8 +117,8 @@
   }
 
 #define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...)\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
-stringify_args(__VA_ARGS__));  \
+  lldb_private::repro::Recorder sb_recorder(   \
+  LLVM_PRETTY_FUNCTION, stringify_args(*this, __VA_ARGS__));   \
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(\
@@ -129,7 +129,8 @@
   }
 
 #define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)  \
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION,  \
+stringify_args(*this));\
   if (lldb_private::repro::InstrumentationData data =  \
   LLDB_GET_INSTRUMENTATION_DATA()) {   \
 sb_recorder.Record(data.GetSerializer(), data.GetRegistry(),   \
@@ -139,7 +140,8 @@
   }
 
 #define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)\
-  lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+  

[Lldb-commits] [lldb] r371817 - For PR17164: split -fno-lax-vector-conversion into three different

2019-09-13 Thread Richard Smith via lldb-commits
Author: rsmith
Date: Thu Sep 12 23:02:15 2019
New Revision: 371817

URL: http://llvm.org/viewvc/llvm-project?rev=371817=rev
Log:
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

This reinstates r371805, reverted in r371813, with an additional fix for
lldb.

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=371817=371816=371817=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Sep 12 23:02:15 2019
@@ -494,7 +494,7 @@ static void ParseLangArgs(LangOptions 
 Opts.OpenCL = 1;
 Opts.AltiVec = 1;
 Opts.CXXOperatorNames = 1;
-Opts.LaxVectorConversions = 1;
+Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::All);
   }
 
   // OpenCL and C++ both have bool, true, false keywords.


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