Re: [Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID

2018-07-13 Thread Ramana via lldb-commits
Jim,

I do not have the commit access to LLDB. Could you please commit this patch?

- Venkata Ramanaiah

On Thu, Jul 12, 2018 at 10:46 PM, Jim Ingham via Phabricator <
revi...@reviews.llvm.org> wrote:

> jingham accepted this revision.
> jingham added a comment.
> This revision is now accepted and ready to land.
>
> Thanks.
>
>
> https://reviews.llvm.org/D48865
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r336988 - Convert a location information from PDB to a DWARF expression

2018-07-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jul 13 03:29:27 2018
New Revision: 336988

URL: http://llvm.org/viewvc/llvm-project?rev=336988&view=rev
Log:
Convert a location information from PDB to a DWARF expression

The current version of SymbolFilePDB::ParseVariableForPDBData function
always initializes variables with an empty location. This patch adds the
converter of a location information from PDB to a DWARF expression, so
it becomes possible to watch values of variables of primitive data
types. At the moment the converter supports only Static, TLS, RegRel,
Enregistered and Constant PDB location types, but it seems that it's
enough for most cases. There are still some problems with retrieving
values of variables (e.g. we can't watch variables of composite types),
but they look not relevant to the conversion to DWARF.

Patch by: Aleksandr Urakov

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

Added:
lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
lldb/trunk/lit/SymbolFile/PDB/variables-locations.test
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Added: lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp?rev=336988&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp (added)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp Fri Jul 13 
03:29:27 2018
@@ -0,0 +1,15 @@
+int g_var = ;
+
+void __fastcall foo(short arg_0, float arg_1) {
+  char loc_0 = 'x';
+  double loc_1 = 0.5678;
+}
+
+int main(int argc, char *argv[]) {
+  bool loc_0 = true;
+  int loc_1 = ;
+
+  foo(, 0.1234);
+
+  return 0;
+}

Added: lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script?rev=336988&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script (added)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script Fri Jul 
13 03:29:27 2018
@@ -0,0 +1,16 @@
+breakpoint set --file VariablesLocationsTest.cpp --line 6
+
+run
+
+target variable g_var
+
+frame variable arg_0
+frame variable arg_1
+
+frame variable loc_0
+frame variable loc_1
+
+frame select 1
+
+frame variable loc_0
+frame variable loc_1

Added: lldb/trunk/lit/SymbolFile/PDB/variables-locations.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/variables-locations.test?rev=336988&view=auto
==
--- lldb/trunk/lit/SymbolFile/PDB/variables-locations.test (added)
+++ lldb/trunk/lit/SymbolFile/PDB/variables-locations.test Fri Jul 13 03:29:27 
2018
@@ -0,0 +1,14 @@
+REQUIRES: windows
+RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe
+RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck 
%s
+
+CHECK: g_var = 
+
+CHECK: arg_0 = 
+CHECK: arg_1 = 0.123
+
+CHECK: loc_0 = 'x'
+CHECK: loc_1 = 0.567
+
+CHECK: loc_0 = true
+CHECK: loc_1 = 

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt?rev=336988&r1=336987&r2=336988&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt Fri Jul 13 03:29:27 
2018
@@ -1,5 +1,6 @@
 add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
   PDBASTParser.cpp
+  PDBLocationToDWARFExpression.cpp
   SymbolFilePDB.cpp
 
   LINK_LIBS

Added: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp?rev=336988&view=auto
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp 
(added)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp 
Fri Jul 13 03:29:27 2018
@@ -0,0 +1,585 @@
+//===-- PDBLocationToDWARFExpression.cpp *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===

[Lldb-commits] [PATCH] D49018: Convert a location information from PDB to a DWARF expression

2018-07-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336988: Convert a location information from PDB to a DWARF 
expression (authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49018?vs=155154&id=155341#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49018

Files:
  lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
  lldb/trunk/lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
  lldb/trunk/lit/SymbolFile/PDB/variables-locations.test
  lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
  lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
@@ -0,0 +1,585 @@
+//===-- PDBLocationToDWARFExpression.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "PDBLocationToDWARFExpression.h"
+
+#include "lldb/Core/Section.h"
+#include "lldb/Core/StreamBuffer.h"
+#include "lldb/Core/dwarf.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Utility/DataBufferHeap.h"
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+
+#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace llvm::pdb;
+
+namespace {
+const uint32_t g_code_view_to_lldb_registers_x86[] = {
+LLDB_INVALID_REGNUM, // CVRegNONE
+lldb_al_i386,// CVRegAL
+lldb_cl_i386,// CVRegCL
+lldb_dl_i386,// CVRegDL
+lldb_bl_i386,// CVRegBL
+lldb_ah_i386,// CVRegAH
+lldb_ch_i386,// CVRegCH
+lldb_dh_i386,// CVRegDH
+lldb_bh_i386,// CVRegBH
+lldb_ax_i386,// CVRegAX
+lldb_cx_i386,// CVRegCX
+lldb_dx_i386,// CVRegDX
+lldb_bx_i386,// CVRegBX
+lldb_sp_i386,// CVRegSP
+lldb_bp_i386,// CVRegBP
+lldb_si_i386,// CVRegSI
+lldb_di_i386,// CVRegDI
+lldb_eax_i386,   // CVRegEAX
+lldb_ecx_i386,   // CVRegECX
+lldb_edx_i386,   // CVRegEDX
+lldb_ebx_i386,   // CVRegEBX
+lldb_esp_i386,   // CVRegESP
+lldb_ebp_i386,   // CVRegEBP
+lldb_esi_i386,   // CVRegESI
+lldb_edi_i386,   // CVRegEDI
+lldb_es_i386,// CVRegES
+lldb_cs_i386,// CVRegCS
+lldb_ss_i386,// CVRegSS
+lldb_ds_i386,// CVRegDS
+lldb_fs_i386,// CVRegFS
+lldb_gs_i386,// CVRegGS
+LLDB_INVALID_REGNUM, // CVRegIP
+LLDB_INVALID_REGNUM, // CVRegFLAGS
+lldb_eip_i386,   // CVRegEIP
+lldb_eflags_i386,// CVRegEFLAGS
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, // CVRegTEMP
+LLDB_INVALID_REGNUM, // CVRegTEMPH
+LLDB_INVALID_REGNUM, // CVRegQUOTE
+LLDB_INVALID_REGNUM, // CVRegPCDR3
+LLDB_INVALID_REGNUM, // CVRegPCDR4
+LLDB_INVALID_REGNUM, // CVRegPCDR5
+LLDB_INVALID_REGNUM, // CVRegPCDR6
+LLDB_INVALID_REGNUM, // CVRegPCDR7
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, // CVRegCR0
+LLDB_INVALID_REGNUM, // CVRegCR1
+LLDB_INVALID_REGNUM, // CVRegCR2
+LLDB_INVALID_REGNUM, // CVRegCR3
+LLDB_INVALID_REGNUM, // CVRegCR4
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+lldb_dr0_i386, // CVRegDR0
+lldb_dr1_i386, // CVRegDR1
+lldb_dr2_i386, // CVRegDR2
+lldb_dr3_i386, // CVRegDR3
+lldb_dr4

[Lldb-commits] [PATCH] D49018: Convert a location information from PDB to a DWARF expression

2018-07-13 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D49018



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


[Lldb-commits] [lldb] r336991 - Add abbreviated name for Debugger::EventHandlerThread.

2018-07-13 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jul 13 04:21:06 2018
New Revision: 336991

URL: http://llvm.org/viewvc/llvm-project?rev=336991&view=rev
Log:
Add abbreviated name for Debugger::EventHandlerThread.

On OS's where thread names are limited to 16 bytes, the full name was truncated 
to not very meaningful "r.event-handler".

Modified:
lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=336991&r1=336990&r2=336991&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Jul 13 04:21:06 2018
@@ -1586,15 +1586,18 @@ bool Debugger::StartEventHandlerThread()
 // is up and running and listening to events before we return from this
 // function. We do this by listening to events for the
 // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster
-ListenerSP listener_sp(
-Listener::MakeListener("lldb.debugger.event-handler"));
+ConstString full_name("lldb.debugger.event-handler");
+ListenerSP listener_sp(Listener::MakeListener(full_name.AsCString()));
 listener_sp->StartListeningForEvents(&m_sync_broadcaster,
  eBroadcastBitEventThreadIsListening);
 
+auto thread_name =
+full_name.GetLength() < llvm::get_max_thread_name_length() ?
+full_name.AsCString() : "dbg.evt-handler";
+
 // Use larger 8MB stack for this thread
-m_event_handler_thread = ThreadLauncher::LaunchThread(
-"lldb.debugger.event-handler", EventHandlerThread, this, nullptr,
-g_debugger_event_thread_stack_bytes);
+m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
+EventHandlerThread, this, nullptr, 
g_debugger_event_thread_stack_bytes);
 
 // Make sure DefaultEventHandler() is running and listening to events
 // before we return from this function. We are only listening for events of


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


[Lldb-commits] [lldb] r336993 - Adjust thread name column width depending on real name length.

2018-07-13 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Jul 13 04:49:28 2018
New Revision: 336993

URL: http://llvm.org/viewvc/llvm-project?rev=336993&view=rev
Log:
Adjust thread name column width depending on real name length.

Make 16-byte aligned field instead of truncating a name to 16 byte.

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

Modified: lldb/trunk/source/Utility/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=336993&r1=336992&r2=336993&view=diff
==
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Fri Jul 13 04:49:28 2018
@@ -286,7 +286,11 @@ void Log::WriteHeader(llvm::raw_ostream
   if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
 llvm::SmallString<32> thread_name;
 llvm::get_thread_name(thread_name);
-OS << llvm::formatv("{0,-16} ", thread_name);
+
+llvm::SmallString<12> format_str;
+llvm::raw_svector_ostream format_os(format_str);
+format_os << "{0,-" << llvm::alignTo<16>(thread_name.size()) << "} ";
+OS << llvm::formatv(format_str.c_str(), thread_name);
   }
 
   if (options.Test(LLDB_LOG_OPTION_BACKTRACE))


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


[Lldb-commits] [PATCH] D49018: Convert a location information from PDB to a DWARF expression

2018-07-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

I am not 100% sure that this is the cause yet, but the test variables.test is 
now failing on Windows. @aleksandr.urakov and @JDevlieghere, which tests did 
you run on Windows? Did they all pass?


Repository:
  rL LLVM

https://reviews.llvm.org/D49018



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


[Lldb-commits] [PATCH] D48976: Replaced more boilerplate code with CompletionRequest (NFC)

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

ping


https://reviews.llvm.org/D48976



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


[Lldb-commits] [PATCH] D49307: Fix some crashes and deadlocks in FormatAnsiTerminalCodes

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: davide.
Herald added a subscriber: mgorny.

This patch fixes a few problems with the FormatAnsiTerminalCodes function:

- It does an infinite loop on an unknown color value.
- It crashes when the color value is at the end of the string.
- It deletes the first character behind the color token.

Also added a few tests that reproduce those problems (and test some other 
corner cases).


https://reviews.llvm.org/D49307

Files:
  include/lldb/Utility/AnsiTerminal.h
  unittests/Utility/AnsiTerminalTest.cpp
  unittests/Utility/CMakeLists.txt

Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(UtilityTests
+  AnsiTerminalTest.cpp
   ArgsTest.cpp
   OptionsWithRawTest.cpp
   ArchSpecTest.cpp
Index: unittests/Utility/AnsiTerminalTest.cpp
===
--- /dev/null
+++ unittests/Utility/AnsiTerminalTest.cpp
@@ -0,0 +1,61 @@
+//===-- AnsiTerminalTest.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Utility/AnsiTerminal.h"
+
+using namespace lldb_utility;
+
+TEST(AnsiTerminal, Empty) {
+  std::string format = ansi::FormatAnsiTerminalCodes("");
+  EXPECT_STREQ("", format.c_str());
+}
+
+TEST(AnsiTerminal, WhiteSpace) {
+  std::string format = ansi::FormatAnsiTerminalCodes(" ");
+  EXPECT_STREQ(" ", format.c_str());
+}
+
+TEST(AnsiTerminal, AtEnd) {
+  std::string format = ansi::FormatAnsiTerminalCodes("abc${ansi.fg.black}");
+  EXPECT_STREQ("abc\x1B[30m", format.c_str());
+}
+
+TEST(AnsiTerminal, AtStart) {
+  std::string format = ansi::FormatAnsiTerminalCodes("${ansi.fg.black}abc");
+  EXPECT_STREQ("\x1B[30mabc", format.c_str());
+}
+
+TEST(AnsiTerminal, KnownPrefix) {
+  std::string format = ansi::FormatAnsiTerminalCodes("${ansi.fg.redish}abc");
+  EXPECT_STREQ("${ansi.fg.redish}abc", format.c_str());
+}
+
+TEST(AnsiTerminal, Unknown) {
+  std::string format = ansi::FormatAnsiTerminalCodes("${ansi.fg.foo}abc");
+  EXPECT_STREQ("${ansi.fg.foo}abc", format.c_str());
+}
+
+TEST(AnsiTerminal, Incomplete) {
+  std::string format = ansi::FormatAnsiTerminalCodes("abc${ansi.");
+  EXPECT_STREQ("abc${ansi.", format.c_str());
+}
+
+TEST(AnsiTerminal, Twice) {
+  std::string format =
+  ansi::FormatAnsiTerminalCodes("${ansi.fg.black}${ansi.fg.red}abc");
+  EXPECT_STREQ("\x1B[30m\x1B[31mabc", format.c_str());
+}
+
+TEST(AnsiTerminal, Basic) {
+  std::string format =
+  ansi::FormatAnsiTerminalCodes("abc${ansi.fg.red}abc${ansi.normal}abc");
+  EXPECT_STREQ("abc\x1B[31mabc\x1B[0mabc", format.c_str());
+}
Index: include/lldb/Utility/AnsiTerminal.h
===
--- include/lldb/Utility/AnsiTerminal.h
+++ include/lldb/Utility/AnsiTerminal.h
@@ -119,17 +119,21 @@
   break;
 }
 
+bool found_code = false;
 for (const auto &code : codes) {
   if (!right.consume_front(code.name))
 continue;
 
   if (do_color)
 fmt.append(code.value);
-  format = right;
+  found_code = true;
   break;
 }
-
-format = format.drop_front();
+format = right;
+// If we haven't found a valid replacement value, we just copy the string
+// to the result without any modifications.
+if (!found_code)
+  fmt.append(tok_hdr);
   }
   return fmt;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49207: Get rid of the C-string parameter in DoExecute

2018-07-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

I am debugging through it right now, but I believe this change caused several 
tests on Windows with Python 3 to fail. The failures are all related to UTF-8. 
For example:

  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: 
invalid start byte


Repository:
  rL LLVM

https://reviews.llvm.org/D49207



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


Re: [Lldb-commits] [lldb] r336991 - Add abbreviated name for Debugger::EventHandlerThread.

2018-07-13 Thread Jim Ingham via lldb-commits
There's code in the ThreadHandler to handle systems with short thread names.  
If that isn't producing readable names, we should fix it there.  A better 
algorithm might be to drop the leading "lldb" and then instead of truncating 
drop vowels (maybe leaving the first vowel after a .)  So you'd get 
"dbggr.evnt-hndlr" which isn't too bad.  Could drop duplicated consonants too.  
It seems a shame for every caller to have to worry about this.

Jim


> On Jul 13, 2018, at 4:21 AM, Tatyana Krasnukha via lldb-commits 
>  wrote:
> 
> Author: tkrasnukha
> Date: Fri Jul 13 04:21:06 2018
> New Revision: 336991
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=336991&view=rev
> Log:
> Add abbreviated name for Debugger::EventHandlerThread.
> 
> On OS's where thread names are limited to 16 bytes, the full name was 
> truncated to not very meaningful "r.event-handler".
> 
> Modified:
>lldb/trunk/source/Core/Debugger.cpp
> 
> Modified: lldb/trunk/source/Core/Debugger.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=336991&r1=336990&r2=336991&view=diff
> ==
> --- lldb/trunk/source/Core/Debugger.cpp (original)
> +++ lldb/trunk/source/Core/Debugger.cpp Fri Jul 13 04:21:06 2018
> @@ -1586,15 +1586,18 @@ bool Debugger::StartEventHandlerThread()
> // is up and running and listening to events before we return from this
> // function. We do this by listening to events for the
> // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster
> -ListenerSP listener_sp(
> -Listener::MakeListener("lldb.debugger.event-handler"));
> +ConstString full_name("lldb.debugger.event-handler");
> +ListenerSP listener_sp(Listener::MakeListener(full_name.AsCString()));
> listener_sp->StartListeningForEvents(&m_sync_broadcaster,
>  eBroadcastBitEventThreadIsListening);
> 
> +auto thread_name =
> +full_name.GetLength() < llvm::get_max_thread_name_length() ?
> +full_name.AsCString() : "dbg.evt-handler";
> +
> // Use larger 8MB stack for this thread
> -m_event_handler_thread = ThreadLauncher::LaunchThread(
> -"lldb.debugger.event-handler", EventHandlerThread, this, nullptr,
> -g_debugger_event_thread_stack_bytes);
> +m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
> +EventHandlerThread, this, nullptr, 
> g_debugger_event_thread_stack_bytes);
> 
> // Make sure DefaultEventHandler() is running and listening to events
> // before we return from this function. We are only listening for events 
> of
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.

2018-07-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

@apolyakov Perhaps we can mark the test as XFAIL on Windows while you 
investigate. Any objections?


Repository:
  rL LLVM

https://reviews.llvm.org/D48802



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


[Lldb-commits] [PATCH] D49207: Get rid of the C-string parameter in DoExecute

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Sorry, I think I know why this is happening. Give me a bit to make a patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D49207



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


[Lldb-commits] [lldb] r337029 - Fix TestAttachDenied on macOS Mojave

2018-07-13 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Jul 13 10:45:43 2018
New Revision: 337029

URL: http://llvm.org/viewvc/llvm-project?rev=337029&view=rev
Log:
Fix TestAttachDenied on macOS Mojave

TestAttachDenied tries to attach to a process that is ptracing itself and
verifies that we error out. Starting with macOS Mojave, processes need
an entitlement to be able to ptrace. This commit adds the entitlement for
the test binary when building on Darwin.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile?rev=337029&r1=337028&r2=337029&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
 Fri Jul 13 10:45:43 2018
@@ -4,4 +4,11 @@ CXX_SOURCES := main.cpp
 
 EXE := AttachDenied
 
+all: AttachDenied sign
+
 include $(LEVEL)/Makefile.rules
+
+sign: entitlements.plist AttachDenied
+ifeq ($(OS),Darwin)
+   codesign -s - -f --entitlements $^
+endif

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist?rev=337029&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
 Fri Jul 13 10:45:43 2018
@@ -0,0 +1,8 @@
+
+http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+
+
+com.apple.security.cs.debugger
+
+
+


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


[Lldb-commits] [PATCH] D49309: No longer pass a StringRef to the Python API

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: stella.stamenova.

The refactoring patch for DoExecute missed this case of a variadic function 
that just silently
accepts a StringRef which it then tries to reinterpret as a C-string.

This should fix the Windows builds.


https://reviews.llvm.org/D49309

Files:
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
 bool ScriptInterpreterPython::ExecuteOneLine(
 llvm::StringRef command, CommandReturnObject *result,
 const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
 return false;
 
@@ -855,7 +857,7 @@
   if (PyCallable_Check(m_run_one_line_function.get())) {
 PythonObject pargs(
 PyRefType::Owned,
-Py_BuildValue("(Os)", session_dict.get(), command));
+Py_BuildValue("(Os)", session_dict.get(), 
command_str.c_str()));
 if (pargs.IsValid()) {
   PythonObject return_value(
   PyRefType::Owned,
@@ -895,7 +897,6 @@
 
 // The one-liner failed.  Append the error message.
 if (result) {
-  std::string command_str = command.str();
   result->AppendErrorWithFormat(
   "python failed attempting to evaluate '%s'\n", command_str.c_str());
 }


Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
 bool ScriptInterpreterPython::ExecuteOneLine(
 llvm::StringRef command, CommandReturnObject *result,
 const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
 return false;
 
@@ -855,7 +857,7 @@
   if (PyCallable_Check(m_run_one_line_function.get())) {
 PythonObject pargs(
 PyRefType::Owned,
-Py_BuildValue("(Os)", session_dict.get(), command));
+Py_BuildValue("(Os)", session_dict.get(), command_str.c_str()));
 if (pargs.IsValid()) {
   PythonObject return_value(
   PyRefType::Owned,
@@ -895,7 +897,6 @@
 
 // The one-liner failed.  Append the error message.
 if (result) {
-  std::string command_str = command.str();
   result->AppendErrorWithFormat(
   "python failed attempting to evaluate '%s'\n", command_str.c_str());
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49309: No longer pass a StringRef to the Python API

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

@stella.stamenova I believe this fixes the issue. Thanks for finding this!


https://reviews.llvm.org/D49309



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


[Lldb-commits] [PATCH] D48976: Replaced more boilerplate code with CompletionRequest (NFC)

2018-07-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.

Oops, sorry for the delay.  This is so much easier to read.  Thanks for 
cleaning this up!


https://reviews.llvm.org/D48976



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


[Lldb-commits] [lldb] r337030 - No longer pass a StringRef to the Python API

2018-07-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 13 11:13:46 2018
New Revision: 337030

URL: http://llvm.org/viewvc/llvm-project?rev=337030&view=rev
Log:
No longer pass a StringRef to the Python API

Summary:
The refactoring patch for DoExecute missed this case of a variadic function 
that just silently
accepts a StringRef which it then tries to reinterpret as a C-string.

This should fix the Windows builds.

Reviewers: stella.stamenova

Reviewed By: stella.stamenova

Subscribers: lldb-commits

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

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=337030&r1=337029&r2=337030&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Fri Jul 13 11:13:46 2018
@@ -753,6 +753,8 @@ static void ReadThreadBytesReceived(void
 bool ScriptInterpreterPython::ExecuteOneLine(
 llvm::StringRef command, CommandReturnObject *result,
 const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
 return false;
 
@@ -855,7 +857,7 @@ bool ScriptInterpreterPython::ExecuteOne
   if (PyCallable_Check(m_run_one_line_function.get())) {
 PythonObject pargs(
 PyRefType::Owned,
-Py_BuildValue("(Os)", session_dict.get(), command));
+Py_BuildValue("(Os)", session_dict.get(), 
command_str.c_str()));
 if (pargs.IsValid()) {
   PythonObject return_value(
   PyRefType::Owned,
@@ -895,7 +897,6 @@ bool ScriptInterpreterPython::ExecuteOne
 
 // The one-liner failed.  Append the error message.
 if (result) {
-  std::string command_str = command.str();
   result->AppendErrorWithFormat(
   "python failed attempting to evaluate '%s'\n", command_str.c_str());
 }


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


[Lldb-commits] [PATCH] D49309: No longer pass a StringRef to the Python API

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337030: No longer pass a StringRef to the Python API 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49309?vs=155434&id=155440#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49309

Files:
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
 bool ScriptInterpreterPython::ExecuteOneLine(
 llvm::StringRef command, CommandReturnObject *result,
 const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
 return false;
 
@@ -855,7 +857,7 @@
   if (PyCallable_Check(m_run_one_line_function.get())) {
 PythonObject pargs(
 PyRefType::Owned,
-Py_BuildValue("(Os)", session_dict.get(), command));
+Py_BuildValue("(Os)", session_dict.get(), 
command_str.c_str()));
 if (pargs.IsValid()) {
   PythonObject return_value(
   PyRefType::Owned,
@@ -895,7 +897,6 @@
 
 // The one-liner failed.  Append the error message.
 if (result) {
-  std::string command_str = command.str();
   result->AppendErrorWithFormat(
   "python failed attempting to evaluate '%s'\n", command_str.c_str());
 }


Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -753,6 +753,8 @@
 bool ScriptInterpreterPython::ExecuteOneLine(
 llvm::StringRef command, CommandReturnObject *result,
 const ExecuteScriptOptions &options) {
+  std::string command_str = command.str();
+
   if (!m_valid_session)
 return false;
 
@@ -855,7 +857,7 @@
   if (PyCallable_Check(m_run_one_line_function.get())) {
 PythonObject pargs(
 PyRefType::Owned,
-Py_BuildValue("(Os)", session_dict.get(), command));
+Py_BuildValue("(Os)", session_dict.get(), command_str.c_str()));
 if (pargs.IsValid()) {
   PythonObject return_value(
   PyRefType::Owned,
@@ -895,7 +897,6 @@
 
 // The one-liner failed.  Append the error message.
 if (result) {
-  std::string command_str = command.str();
   result->AppendErrorWithFormat(
   "python failed attempting to evaluate '%s'\n", command_str.c_str());
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r337031 - Replaced more boilerplate code with CompletionRequest (NFC)

2018-07-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 13 11:28:14 2018
New Revision: 337031

URL: http://llvm.org/viewvc/llvm-project?rev=337031&view=rev
Log:
Replaced more boilerplate code with CompletionRequest (NFC)

Summary:
As suggested in D48796, this patch replaces even more internal calls that were 
using the old
completion API style with a single CompletionRequest. In some cases we also 
pass an option
vector/index, but as we don't always have this information, it currently is not 
part of the
CompletionRequest class.

The constructor of the CompletionRequest is now also more sensible. You only 
pass the
user input, cursor position and your list of matches to the request and the 
rest will be
inferred (using the same code we used before to calculate this). You also have 
to pass these
match window parameters to it, even though they are unused right now.

The patch shouldn't change any behavior.

Reviewers: jingham

Reviewed By: jingham

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Core/FormatEntity.h
lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
lldb/trunk/include/lldb/Interpreter/OptionValue.h
lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
lldb/trunk/include/lldb/Interpreter/Options.h
lldb/trunk/include/lldb/Symbol/Variable.h
lldb/trunk/include/lldb/Utility/ArchSpec.h
lldb/trunk/include/lldb/Utility/CompletionRequest.h
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
lldb/trunk/source/Interpreter/OptionValue.cpp
lldb/trunk/source/Interpreter/OptionValueArch.cpp
lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
lldb/trunk/source/Interpreter/OptionValueUUID.cpp
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Utility/ArchSpec.cpp
lldb/trunk/source/Utility/CompletionRequest.cpp
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/Core/FormatEntity.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatEntity.h?rev=337031&r1=337030&r2=337031&view=diff
==
--- lldb/trunk/include/lldb/Core/FormatEntity.h (original)
+++ lldb/trunk/include/lldb/Core/FormatEntity.h Fri Jul 13 11:28:14 2018
@@ -10,6 +10,7 @@
 #ifndef liblldb_FormatEntity_h_
 #define liblldb_FormatEntity_h_
 
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/FileSpec.h" // for FileSpec
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format
@@ -211,9 +212,7 @@ public:
 llvm::StringRef &variable_name,
 llvm::StringRef &variable_format);
 
-  static size_t AutoComplete(llvm::StringRef s, int match_start_point,
- int max_return_elements, bool &word_complete,
- StringList &matches);
+  static size_t AutoComplete(lldb_private::CompletionRequest &request);
 
   //--
   // Format the current elements into the stream \a s.

Modified: lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandCompletions.h?rev=337031&r1=337030&r2=337031&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandCompletions.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandCompletions.h Fri Jul 13 
11:28:14 2018
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Regu

[Lldb-commits] [PATCH] D48976: Replaced more boilerplate code with CompletionRequest (NFC)

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337031: Replaced more boilerplate code with 
CompletionRequest (NFC) (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48976?vs=154247&id=155441#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48976

Files:
  lldb/trunk/include/lldb/Core/FormatEntity.h
  lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
  lldb/trunk/include/lldb/Interpreter/OptionValue.h
  lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
  lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
  lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
  lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
  lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
  lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
  lldb/trunk/include/lldb/Interpreter/Options.h
  lldb/trunk/include/lldb/Symbol/Variable.h
  lldb/trunk/include/lldb/Utility/ArchSpec.h
  lldb/trunk/include/lldb/Utility/CompletionRequest.h
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Commands/CommandObjectCommands.cpp
  lldb/trunk/source/Commands/CommandObjectFrame.cpp
  lldb/trunk/source/Commands/CommandObjectPlatform.cpp
  lldb/trunk/source/Commands/CommandObjectPlugin.cpp
  lldb/trunk/source/Commands/CommandObjectProcess.cpp
  lldb/trunk/source/Commands/CommandObjectSettings.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/FormatEntity.cpp
  lldb/trunk/source/Core/IOHandler.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Interpreter/CommandObject.cpp
  lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/trunk/source/Interpreter/OptionValue.cpp
  lldb/trunk/source/Interpreter/OptionValueArch.cpp
  lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
  lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
  lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
  lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
  lldb/trunk/source/Interpreter/OptionValueUUID.cpp
  lldb/trunk/source/Interpreter/Options.cpp
  lldb/trunk/source/Symbol/Variable.cpp
  lldb/trunk/source/Utility/ArchSpec.cpp
  lldb/trunk/source/Utility/CompletionRequest.cpp
  lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Index: lldb/trunk/include/lldb/Core/FormatEntity.h
===
--- lldb/trunk/include/lldb/Core/FormatEntity.h
+++ lldb/trunk/include/lldb/Core/FormatEntity.h
@@ -10,6 +10,7 @@
 #ifndef liblldb_FormatEntity_h_
 #define liblldb_FormatEntity_h_
 
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/FileSpec.h" // for FileSpec
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format
@@ -211,9 +212,7 @@
 llvm::StringRef &variable_name,
 llvm::StringRef &variable_format);
 
-  static size_t AutoComplete(llvm::StringRef s, int match_start_point,
- int max_return_elements, bool &word_complete,
- StringList &matches);
+  static size_t AutoComplete(lldb_private::CompletionRequest &request);
 
   //--
   // Format the current elements into the stream \a s.
Index: lldb/trunk/include/lldb/Symbol/Variable.h
===
--- lldb/trunk/include/lldb/Symbol/Variable.h
+++ lldb/trunk/include/lldb/Symbol/Variable.h
@@ -103,8 +103,7 @@
   ValueObjectList &valobj_list);
 
   static size_t AutoComplete(const ExecutionContext &exe_ctx,
- llvm::StringRef name, StringList &matches,
- bool &word_complete);
+ CompletionRequest &request);
 
   CompilerDeclContext GetDeclContext();
 
Index: lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
===
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
@@ -45,9 +45,8 @@
 
   lldb::OptionValueSP DeepCopy() const override;
 
-  size_t AutoComplete(CommandInterpreter &interpreter, llvm::StringRef s,
-  int match_start_point, int max_return_elements,
-  bool &word_complete, StringList &matches) override;
+  size_t AutoComplete(CommandInterpreter &interpreter,
+  CompletionRequest &request) override;
 
   //-
   // Subclass specific functions
Index: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
===
--- lldb/trunk/include/lldb/Interpreter/OptionVal

[Lldb-commits] [PATCH] D49311: Add includes for CompletionRequest to every file that uses it

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.

Should fix the builds (and prevent future builds from failing when people try 
to reduce includes).


https://reviews.llvm.org/D49311

Files:
  include/lldb/Interpreter/CommandAlias.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/Interpreter/CommandObject.h
  include/lldb/Interpreter/CommandObjectMultiword.h
  include/lldb/Interpreter/CommandObjectRegexCommand.h
  include/lldb/Interpreter/OptionValueArch.h
  include/lldb/Interpreter/Options.h
  include/lldb/Symbol/Variable.h

Index: include/lldb/Symbol/Variable.h
===
--- include/lldb/Symbol/Variable.h
+++ include/lldb/Symbol/Variable.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/Declaration.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private.h"
Index: include/lldb/Interpreter/Options.h
===
--- include/lldb/Interpreter/Options.h
+++ include/lldb/Interpreter/Options.h
@@ -18,6 +18,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-private.h"
Index: include/lldb/Interpreter/OptionValueArch.h
===
--- include/lldb/Interpreter/OptionValueArch.h
+++ include/lldb/Interpreter/OptionValueArch.h
@@ -12,6 +12,7 @@
 
 #include "lldb/Interpreter/OptionValue.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/CompletionRequest.h"
 
 namespace lldb_private {
 
Index: include/lldb/Interpreter/CommandObjectRegexCommand.h
===
--- include/lldb/Interpreter/CommandObjectRegexCommand.h
+++ include/lldb/Interpreter/CommandObjectRegexCommand.h
@@ -17,6 +17,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/RegularExpression.h"
 
 namespace lldb_private {
Index: include/lldb/Interpreter/CommandObjectMultiword.h
===
--- include/lldb/Interpreter/CommandObjectMultiword.h
+++ include/lldb/Interpreter/CommandObjectMultiword.h
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 
 namespace lldb_private {
 
Index: include/lldb/Interpreter/CommandObject.h
===
--- include/lldb/Interpreter/CommandObject.h
+++ include/lldb/Interpreter/CommandObject.h
@@ -16,16 +16,15 @@
 #include 
 #include 
 
-#include "lldb/Utility/CompletionRequest.h"
-
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/Flags.h"
 
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-private.h"
 
Index: include/lldb/Interpreter/CommandInterpreter.h
===
--- include/lldb/Interpreter/CommandInterpreter.h
+++ include/lldb/Interpreter/CommandInterpreter.h
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-forward.h"
Index: include/lldb/Interpreter/CommandAlias.h
===
--- include/lldb/Interpreter/CommandAlias.h
+++ include/lldb/Interpreter/CommandAlias.h
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/lldb-forward.h"
 
 namespace lldb_private {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49311: Add includes for CompletionRequest to every file that uses it

2018-07-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.

That works for me, thanks for fixing this.


https://reviews.llvm.org/D49311



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


[Lldb-commits] [lldb] r337032 - Add includes for CompletionRequest to every file that uses it

2018-07-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 13 11:54:55 2018
New Revision: 337032

URL: http://llvm.org/viewvc/llvm-project?rev=337032&view=rev
Log:
Add includes for CompletionRequest to every file that uses it

Summary: Should fix the builds (and prevent future builds from failing when 
people try to reduce includes).

Reviewers: jingham

Reviewed By: jingham

Subscribers: jingham, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Interpreter/CommandAlias.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
lldb/trunk/include/lldb/Interpreter/Options.h
lldb/trunk/include/lldb/Symbol/Variable.h

Modified: lldb/trunk/include/lldb/Interpreter/CommandAlias.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandAlias.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandAlias.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandAlias.h Fri Jul 13 11:54:55 2018
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/lldb-forward.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Jul 13 
11:54:55 2018
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-forward.h"

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Fri Jul 13 11:54:55 2018
@@ -16,8 +16,6 @@
 #include 
 #include 
 
-#include "lldb/Utility/CompletionRequest.h"
-
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/Flags.h"
@@ -26,6 +24,7 @@
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-private.h"
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Fri Jul 13 
11:54:55 2018
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h Fri Jul 13 
11:54:55 2018
@@ -17,6 +17,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/RegularExpression.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArch.h?rev=337032&r1=337031&r2=337032&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueArch.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArch.h Fri Jul 13 11:54:55 
2018
@@ -12,6 +12,7 @@
 
 #include "

[Lldb-commits] [PATCH] D49311: Add includes for CompletionRequest to every file that uses it

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337032: Add includes for CompletionRequest to every file 
that uses it (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49311?vs=155444&id=155448#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49311

Files:
  lldb/trunk/include/lldb/Interpreter/CommandAlias.h
  lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
  lldb/trunk/include/lldb/Interpreter/CommandObject.h
  lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
  lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
  lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
  lldb/trunk/include/lldb/Interpreter/Options.h
  lldb/trunk/include/lldb/Symbol/Variable.h

Index: lldb/trunk/include/lldb/Symbol/Variable.h
===
--- lldb/trunk/include/lldb/Symbol/Variable.h
+++ lldb/trunk/include/lldb/Symbol/Variable.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/Declaration.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private.h"
Index: lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
@@ -17,6 +17,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/RegularExpression.h"
 
 namespace lldb_private {
Index: lldb/trunk/include/lldb/Interpreter/CommandAlias.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandAlias.h
+++ lldb/trunk/include/lldb/Interpreter/CommandAlias.h
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/lldb-forward.h"
 
 namespace lldb_private {
Index: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
 
 namespace lldb_private {
 
Index: lldb/trunk/include/lldb/Interpreter/CommandObject.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h
@@ -16,16 +16,15 @@
 #include 
 #include 
 
-#include "lldb/Utility/CompletionRequest.h"
-
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/Flags.h"
 
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-private.h"
 
Index: lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
===
--- lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
@@ -12,6 +12,7 @@
 
 #include "lldb/Interpreter/OptionValue.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/CompletionRequest.h"
 
 namespace lldb_private {
 
Index: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-forward.h"
Index: lldb/trunk/include/lldb/Interpreter/Options.h
===
--- lldb/trunk/include/lldb/Interpreter/Options.h
+++ lldb/trunk/include/lldb/Interpreter/Options.h
@@ -18,6 +18,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-private.h"
___
lldb-commits mailing list

[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).

2018-07-13 Thread Puyan Lotfi via Phabricator via lldb-commits
plotfi updated this revision to Diff 155452.

https://reviews.llvm.org/D48782

Files:
  packages/Python/lldbsuite/test/make/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -235,6 +235,22 @@
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) 
$(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
 endif
 
+ifneq (,$(wildcard $(DWP)))
+  MAKE_DWP=YES
+  VALID_DWP_BIN=YES
+endif
+
+ifeq "$(MAKE_DWP)" "YES"
+  MAKE_DWO=YES
+  ifndef DWP
+$(error dwp not found, please set DWP.)
+  endif
+  ifneq "$(VALID_DWP_BIN)" "YES"
+$(error Invalid dwp, please set DWP to a path that exists.)
+  endif
+endif
+
+
 ifeq "$(MAKE_DWO)" "YES"
CFLAGS += -gsplit-dwarf
 endif
@@ -508,6 +524,10 @@
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
$(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
+ifeq "$(MAKE_DWP)" "YES"
+   $(DWP) -e "$(EXE)" -o "$(EXE).dwp"
+   rm -f $(OBJECTS:.o=.dwo)
+endif
 endif
 
 #--


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -235,6 +235,22 @@
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
 endif
 
+ifneq (,$(wildcard $(DWP)))
+  MAKE_DWP=YES
+  VALID_DWP_BIN=YES
+endif
+
+ifeq "$(MAKE_DWP)" "YES"
+  MAKE_DWO=YES
+  ifndef DWP
+$(error dwp not found, please set DWP.)
+  endif
+  ifneq "$(VALID_DWP_BIN)" "YES"
+$(error Invalid dwp, please set DWP to a path that exists.)
+  endif
+endif
+
+
 ifeq "$(MAKE_DWO)" "YES"
CFLAGS += -gsplit-dwarf
 endif
@@ -508,6 +524,10 @@
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
$(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
+ifeq "$(MAKE_DWP)" "YES"
+   $(DWP) -e "$(EXE)" -o "$(EXE).dwp"
+   rm -f $(OBJECTS:.o=.dwo)
+endif
 endif
 
 #--
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).

2018-07-13 Thread Puyan Lotfi via Phabricator via lldb-commits
plotfi added a comment.



> What's the medium-to-long term solution?

Havn't fully fleshed that out yet.




Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:520
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME)
$(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o 
"$(EXE)"
 else

jankratochvil wrote:
> Shouldn't be $(LLVM_DWP) even here? DWZ mode has its command even here.
Ah, I can add it. I wasn't sure if dwp was something that works with dylibs or 
not. Thought there was something like dsym for those. 



Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:546
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
 endif

jankratochvil wrote:
> Shouldn't be $(LLVM_DWP) even here? DWZ mode has its command even here.
I'm not sure about this one. 


https://reviews.llvm.org/D48782



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


[Lldb-commits] [lldb] r337034 - Add the new PDBLocationToDWARFExpression.{cpp, h} to the Xcode project.

2018-07-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Jul 13 12:24:26 2018
New Revision: 337034

URL: http://llvm.org/viewvc/llvm-project?rev=337034&view=rev
Log:
Add the new PDBLocationToDWARFExpression.{cpp,h} to the Xcode project.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=337034&r1=337033&r2=337034&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jul 13 12:24:26 2018
@@ -570,6 +570,7 @@
260CC65415D0440D002BF2E0 /* OptionValueUUID.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 260CC64715D0440D002BF2E0 /* OptionValueUUID.cpp 
*/; };
2689008613353E2200698AC0 /* Options.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E8610F1B85900F91463 /* Options.cpp */; };
4C562CC71CC07DF700C52EAC /* PDBASTParser.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */; 
};
+   4CA0C6CC20F929C700CFE6BB /* PDBLocationToDWARFExpression.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CA0C6CA20F929C600CFE6BB /* 
PDBLocationToDWARFExpression.cpp */; };
268900EE13353E6F00698AC0 /* PathMappingList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 495BBACB119A0DBE00418BEA /* PathMappingList.cpp 
*/; };
2668A2EE20AF417D00D94111 /* PathMappingListTest.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 2668A2ED20AF417D00D94111 /* 
PathMappingListTest.cpp */; };
25420ED21A649D88009ADBCB /* PipeBase.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 25420ED11A649D88009ADBCB /* PipeBase.cpp */; };
@@ -2355,6 +2356,8 @@
26BC7D6D10F1B77400F91463 /* Options.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Options.h; path = include/lldb/Interpreter/Options.h; sourceTree = ""; };
4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PDBASTParser.cpp; path = PDB/PDBASTParser.cpp; sourceTree = ""; };
4C562CC31CC07DDD00C52EAC /* PDBASTParser.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
PDBASTParser.h; path = PDB/PDBASTParser.h; sourceTree = ""; };
+   4CA0C6CA20F929C600CFE6BB /* PDBLocationToDWARFExpression.cpp */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = PDBLocationToDWARFExpression.cpp; path = 
PDB/PDBLocationToDWARFExpression.cpp; sourceTree = ""; };
+   4CA0C6CB20F929C700CFE6BB /* PDBLocationToDWARFExpression.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
name = PDBLocationToDWARFExpression.h; path = 
PDB/PDBLocationToDWARFExpression.h; sourceTree = ""; };
AF3F54B21B3BA5D500186E73 /* POSIXStopInfo.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = POSIXStopInfo.cpp; sourceTree = ""; };
AF3F54B31B3BA5D500186E73 /* POSIXStopInfo.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
POSIXStopInfo.h; sourceTree = ""; };
495BBACB119A0DBE00418BEA /* PathMappingList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = PathMappingList.cpp; path = source/Target/PathMappingList.cpp; 
sourceTree = ""; };
@@ -6717,6 +6720,8 @@
children = (
4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */,
4C562CC31CC07DDD00C52EAC /* PDBASTParser.h */,
+   4CA0C6CA20F929C600CFE6BB /* 
PDBLocationToDWARFExpression.cpp */,
+   4CA0C6CB20F929C700CFE6BB /* 
PDBLocationToDWARFExpression.h */,
AF6335E01C87B21E00F7D554 /* SymbolFilePDB.cpp 
*/,
AF6335E11C87B21E00F7D554 /* SymbolFilePDB.h */,
);
@@ -8191,6 +8196,7 @@
94CB255E16B069770059775D /* FormatManager.cpp 
in Sources */,
94CB256616B096F10059775D /* TypeCategory.cpp in 
Sources */,
945261C81B9A14D300BF138D /* 
CXXFunctionPointer.cpp in Sources */,
+   4CA0C6CC20F929C700CFE6BB /* 
PDBLocationToDWARFExpression.cpp in Sources */,
94CB256716B096F10059775D /* TypeCategoryMap.cpp 
in Sources */,
94CB257016B0A4270059775D /* TypeFormat.cpp in 
Sources */,
238F2B9E1D2C82D0001FF92A /* 
StructuredDataPlugin.cpp in Sources *

[Lldb-commits] [lldb] r337035 - Fix the libcxx set, multiset, vector and bitset formatters to work on references.

2018-07-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Jul 13 12:28:32 2018
New Revision: 337035

URL: http://llvm.org/viewvc/llvm-project?rev=337035&view=rev
Log:
Fix the libcxx set, multiset, vector and bitset formatters to work on 
references.

The synthetic child providers for these classes had a type expression that 
matched
pointers & references to the type, but the Front End only worked on the actual 
object.

I fixed this by adding a way for the Synthetic Child FrontEnd provider to 
request dereference,
and then had these formatters use that mode.



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

Modified:
lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
lldb/trunk/include/lldb/lldb-enumerations.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h?rev=337035&r1=337034&r2=337035&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h Fri Jul 13 12:28:32 
2018
@@ -207,6 +207,19 @@ public:
   return *this;
 }
 
+bool GetFrontEndWantsDereference() const {
+  return (m_flags & lldb::eTypeOptionFrontEndWantsDereference) ==
+ lldb::eTypeOptionFrontEndWantsDereference;
+}
+
+Flags &SetFrontEndWantsDereference(bool value = true) {
+  if (value)
+m_flags |= lldb::eTypeOptionFrontEndWantsDereference;
+  else
+m_flags &= ~lldb::eTypeOptionFrontEndWantsDereference;
+  return *this;
+}
+
 uint32_t GetValue() { return m_flags; }
 
 void SetValue(uint32_t value) { m_flags = value; }
@@ -226,6 +239,8 @@ public:
   bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
 
   bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+  
+  bool WantsDereference() const { return 
m_flags.GetFrontEndWantsDereference();} 
 
   void SetCascades(bool value) { m_flags.SetCascades(value); }
 

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=337035&r1=337034&r2=337035&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Jul 13 12:28:32 2018
@@ -789,7 +789,9 @@ FLAGS_ENUM(TypeOptions){eTypeOptionNone
 eTypeOptionShowOneLiner = (1u << 5),
 eTypeOptionHideNames = (1u << 6),
 eTypeOptionNonCacheable = (1u << 7),
-eTypeOptionHideEmptyAggregates = (1u << 8)};
+eTypeOptionHideEmptyAggregates = (1u << 8),
+eTypeOptionFrontEndWantsDereference = (1u << 9)
+};
 
 //--
 // This is the return value for frame comparisons.  If you are comparing frame

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py?rev=337035&r1=337034&r2=337035&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxx

[Lldb-commits] [PATCH] D49282: [cmake] Add option to skip building lldb-server

2018-07-13 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 155459.
xiaobai added a comment.

Update unittest logic.


https://reviews.llvm.org/D49282

Files:
  cmake/modules/LLDBConfig.cmake
  tools/CMakeLists.txt
  unittests/tools/CMakeLists.txt


Index: unittests/tools/CMakeLists.txt
===
--- unittests/tools/CMakeLists.txt
+++ unittests/tools/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
-  if (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_DEBUGSERVER)
+  if ((CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_DEBUGSERVER) OR (NOT 
CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_LLDB_SERVER_BUILD))
 # These tests are meant to test lldb-server/debugserver in isolation, and
 # don't provide any value if run against a server copied from somewhere.
   else()
Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -5,7 +5,7 @@
 add_subdirectory(argdumper)
 add_subdirectory(driver)
 add_subdirectory(lldb-mi)
-if (LLDB_CAN_USE_LLDB_SERVER)
+if (LLDB_CAN_USE_LLDB_SERVER AND NOT SKIP_LLDB_SERVER_BUILD)
   add_subdirectory(lldb-server)
 endif()
 add_subdirectory(intel-features)
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -358,6 +358,8 @@
 
 list(APPEND system_libs ${CMAKE_DL_LIBS})
 
+SET(SKIP_LLDB_SERVER_BUILD OFF CACHE BOOL "Skip building lldb-server")
+
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")


Index: unittests/tools/CMakeLists.txt
===
--- unittests/tools/CMakeLists.txt
+++ unittests/tools/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
-  if (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_DEBUGSERVER)
+  if ((CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_DEBUGSERVER) OR (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_LLDB_SERVER_BUILD))
 # These tests are meant to test lldb-server/debugserver in isolation, and
 # don't provide any value if run against a server copied from somewhere.
   else()
Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -5,7 +5,7 @@
 add_subdirectory(argdumper)
 add_subdirectory(driver)
 add_subdirectory(lldb-mi)
-if (LLDB_CAN_USE_LLDB_SERVER)
+if (LLDB_CAN_USE_LLDB_SERVER AND NOT SKIP_LLDB_SERVER_BUILD)
   add_subdirectory(lldb-server)
 endif()
 add_subdirectory(intel-features)
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -358,6 +358,8 @@
 
 list(APPEND system_libs ${CMAKE_DL_LIBS})
 
+SET(SKIP_LLDB_SERVER_BUILD OFF CACHE BOOL "Skip building lldb-server")
+
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49309: No longer pass a StringRef to the Python API

2018-07-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

All better now! Tests are passing.


Repository:
  rL LLVM

https://reviews.llvm.org/D49309



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


[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.

2018-07-13 Thread Alexander Polyakov via Phabricator via lldb-commits
apolyakov added a comment.

In https://reviews.llvm.org/D48802#1161904, @stella.stamenova wrote:

> @apolyakov Perhaps we can mark the test as XFAIL on Windows while you 
> investigate. Any objections?


Sure, I'll do it.


Repository:
  rL LLVM

https://reviews.llvm.org/D48802



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


[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: jingham.

We currently allow any completion handler to read and manipulate the list of 
matches we
calculated so far. This leads to a few problems:

Firstly, a completion handler's logic can now depend on previously calculated 
results
by another handlers. No completion handler should have such an implicit 
dependency,
but the current API makes it likely that this could happen (or already 
happens). Especially
the fact that some completion handler deleted all previously calculated results 
can mess
things up right now.

Secondly, all completion handlers have knowledge about our internal data 
structures with
this API. This makes refactoring this internal data structure much harder than 
it should be.
Especially planned changes like the support of descriptions for completions are 
currently
giant patches because we have to refactor every single completion handler.

This patch narrows the contract the CompletionRequest has with the different 
handlers to:

1. A handler can suggest a completion.
2. A handler can ask how many suggestions we already have.

Point 2 obviously means we still have a  dependency left between the different 
handlers, but
getting rid of this is too large to just append it to this patch.

Otherwise this patch just completely hides the internal StringList to the 
different handlers.

The CompletionRequest API now also ensures that the list of completions is 
unique and we
don't suggest the same value multiple times to the user. This property has been 
so far only
been ensured by the `Option` handler, but is now applied globally. This is part 
of this patch
as the OptionHandler is no longer able to implement this functionality itself.


https://reviews.llvm.org/D49322

Files:
  include/lldb/Utility/CompletionRequest.h
  source/Commands/CommandCompletions.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectMultiword.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectPlugin.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSettings.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/FormatEntity.cpp
  source/Core/IOHandler.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectRegexCommand.cpp
  source/Interpreter/OptionValue.cpp
  source/Interpreter/OptionValueArch.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueEnumeration.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Interpreter/OptionValueUUID.cpp
  source/Interpreter/Options.cpp
  source/Symbol/Variable.cpp
  source/Utility/ArchSpec.cpp
  source/Utility/CompletionRequest.cpp
  unittests/Utility/CompletionRequestTest.cpp

Index: unittests/Utility/CompletionRequestTest.cpp
===
--- unittests/Utility/CompletionRequestTest.cpp
+++ unittests/Utility/CompletionRequestTest.cpp
@@ -34,7 +34,70 @@
 
   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
+}
+
+TEST(CompletionRequest, DuplicateFiltering) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  // Add bar twice
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add foo again.
+  request.AddCompletion("foo");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add something with an existing prefix
+  request.AddCompletion("foobar");
+  EXPECT_EQ(3U, request.GetNumberOfMatches());
+  EXPECT_EQ(3U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+  EXPECT_STREQ("foobar", matches.GetStringAtIndex(2));
+}
+
+TEST(CompletionRequest, TestCompletionOwnership) {
+  std::string command = "a bad c";
+  cons

[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-13 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 155508.
shafik marked 7 inline comments as done.
shafik edited the summary of this revision.
shafik added a comment.

Address comments

- Applying clang-formt
- Refactoring OptionalFrontEnd to produce out that makes the underlying data 
look like an array
- Removing commented out code and left in debugging
- Using StringRef instead of const char *


https://reviews.llvm.org/D49271

Files:
  lldb.xcodeproj/project.pbxproj
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/TestDataFormatterLibcxxOptional.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/LibCxx.cpp
  source/Plugins/Language/CPlusPlus/LibCxx.h
  source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp

Index: source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
@@ -0,0 +1,78 @@
+//===-- LibCxxOptional.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibCxx.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+class OptionalFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  OptionalFrontEnd(ValueObject &valobj) : SyntheticChildrenFrontEnd(valobj) {
+Update();
+  }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+return formatters::ExtractIndexFromString(name.GetCString());
+  }
+
+  bool MightHaveChildren() override { return true; }
+  bool Update() override;
+  size_t CalculateNumChildren() override { return m_size; }
+  ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+private:
+  size_t m_size = 0;
+  ValueObjectSP m_base_sp;
+};
+} // namespace
+
+bool OptionalFrontEnd::Update() {
+  ValueObjectSP engaged_sp(
+  m_backend.GetChildMemberWithName(ConstString("__engaged_"), true));
+
+  if (!engaged_sp)
+return false;
+
+  m_size = engaged_sp->GetValueAsSigned(0);
+
+  return false;
+}
+
+ValueObjectSP OptionalFrontEnd::GetChildAtIndex(size_t idx) {
+  if (idx >= m_size)
+return ValueObjectSP();
+
+  ValueObjectSP val_sp(
+  m_backend.GetChildMemberWithName(ConstString("__engaged_"), true)
+  ->GetParent()
+  ->GetChildAtIndex(0, true)
+  ->GetChildMemberWithName(ConstString("__val_"), true));
+
+  if (!val_sp)
+return ValueObjectSP();
+
+  CompilerType holder_type = val_sp->GetCompilerType();
+
+  if (!holder_type)
+return ValueObjectSP();
+
+  return val_sp->Clone(ConstString(llvm::formatv("Value").str()));
+}
+
+SyntheticChildrenFrontEnd *
+formatters::LibcxxOptionalFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP valobj_sp) {
+  if (valobj_sp)
+return new OptionalFrontEnd(*valobj_sp);
+  return nullptr;
+}
Index: source/Plugins/Language/CPlusPlus/LibCxx.h
===
--- source/Plugins/Language/CPlusPlus/LibCxx.h
+++ source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -27,6 +27,10 @@
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // libc++ std::wstring
 
+bool LibcxxOptionalSummaryProvider(
+ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // libc++ std::optional<>
+
 bool LibcxxSmartPointerSummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions
@@ -133,6 +137,10 @@
 SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *,
   lldb::ValueObjectSP);
 
+SyntheticChildrenFrontEnd *
+LibcxxOptionalFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP valobj_sp);
+
 } // namespace formatters
 } // namespace lldb_private
 
Index: source/Plugins/Language/CPlusPlus/LibCxx.cpp
===
--- source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -33,6 +33,26 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+bool lldb_private::formatters::LibcxxOptionalSummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ValueObjectSP valobj_sp(valobj.GetNonSyntheticValue());
+  if (!valobj_sp)
+return f

[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-13 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@davide @jingham Thank you for the review, those were good catches and comments.

I have addressed them except for refactoring the test to use lldbInline which I 
will be working on now.




Comment at: 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/optional/main.cpp:14-38
+optional_int number ;
+
+printf( "%d\n", number.has_value() ) ; // break here
+
+number = 42 ;
+
+printf( "%d\n", *number ) ; // break here

davide wrote:
> You don't really need to se all these breakpoints.
> You just need set one on the return and print all the types.
> Also, an `lldbInline` python test here should suffice and it's probably more 
> readable (grep for lldbInline).
This looks like a good idea, I will try it out and let you know.



Comment at: source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp:63
+  if (!val_sp) {
+  fprintf( stderr, "no __val_!\n" ) ;
+return ValueObjectSP();

davide wrote:
> jingham wrote:
> > If you want to log this, get the formatters log channel and put the text 
> > there.  Then somebody will see this when they turn on the log.  An fprintf 
> > like this won't help anybody.
> if you want to log diagnostics, you might consider using the `LOG` facility 
> and then add these to the `data formatters` channel.
Thank you for catching, I meant to remove this.


https://reviews.llvm.org/D49271



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


[Lldb-commits] [PATCH] D49271: Adding libc++ formattors for std::optional

2018-07-13 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

This is getting really close. Please try the `lldbInline` test format and 
revert the unrelated bits and I'll take another look.
 Thanks!




Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:971-972
 g_formatters.push_back([](lldb_private::ValueObject &valobj,
-  lldb::DynamicValueType,
-  FormatManager &
-  fmt_mgr) -> SyntheticChildren::SharedPointer 
{
+  lldb::DynamicValueType, FormatManager &fmt_mgr)
+   -> SyntheticChildren::SharedPointer {
   static CXXSyntheticChildren::SharedPointer formatter_sp(

this looks unrelated?



Comment at: source/Plugins/Language/CPlusPlus/LibCxx.cpp:179-223
+  CompilerType pair_type(
+  __i_->GetCompilerType().GetTypeTemplateArgument(0));
+  std::string name;
+  uint64_t bit_offset_ptr;
+  uint32_t bitfield_bit_size_ptr;
+  bool is_bitfield_ptr;
+  pair_type = pair_type.GetFieldAtIndex(

this looks like .. unrelated?


https://reviews.llvm.org/D49271



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


[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 155515.
teemperor added a comment.

- Removed some small string allocations.


https://reviews.llvm.org/D49322

Files:
  include/lldb/Utility/CompletionRequest.h
  source/Commands/CommandCompletions.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectMultiword.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectPlugin.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSettings.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/FormatEntity.cpp
  source/Core/IOHandler.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectRegexCommand.cpp
  source/Interpreter/OptionValue.cpp
  source/Interpreter/OptionValueArch.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueEnumeration.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Interpreter/OptionValueUUID.cpp
  source/Interpreter/Options.cpp
  source/Symbol/Variable.cpp
  source/Utility/ArchSpec.cpp
  source/Utility/CompletionRequest.cpp
  unittests/Utility/CompletionRequestTest.cpp

Index: unittests/Utility/CompletionRequestTest.cpp
===
--- unittests/Utility/CompletionRequestTest.cpp
+++ unittests/Utility/CompletionRequestTest.cpp
@@ -34,7 +34,70 @@
 
   EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
   EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
+}
+
+TEST(CompletionRequest, DuplicateFiltering) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  request.AddCompletion("foo");
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+
+  // Add bar twice
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  request.AddCompletion("bar");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add foo again.
+  request.AddCompletion("foo");
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+
+  // Add something with an existing prefix
+  request.AddCompletion("foobar");
+  EXPECT_EQ(3U, request.GetNumberOfMatches());
+  EXPECT_EQ(3U, matches.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
+  EXPECT_STREQ("foobar", matches.GetStringAtIndex(2));
+}
+
+TEST(CompletionRequest, TestCompletionOwnership) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches;
+
+  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+
+  std::string Temporary = "bar";
+  request.AddCompletion(Temporary);
+  // Manipulate our completion. The request should have taken a copy, so that
+  // shouldn't influence anything.
+  Temporary[0] = 'f';
 
-  // This is the generated matches should be equal to our passed string list.
-  EXPECT_EQ(&request.GetMatches(), &matches);
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_STREQ("bar", matches.GetStringAtIndex(0));
 }
Index: source/Utility/CompletionRequest.cpp
===
--- source/Utility/CompletionRequest.cpp
+++ source/Utility/CompletionRequest.cpp
@@ -20,6 +20,7 @@
 : m_command(command_line), m_raw_cursor_pos(raw_cursor_pos),
   m_match_start_point(match_start_point),
   m_max_return_elements(max_return_elements), m_matches(&matches) {
+  matches.Clear();
 
   // We parse the argument up to the cursor, so the last argument in
   // parsed_line is the one containing the cursor, and the cursor is after the
Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -255,12 +255,14 @@
 for (uint32_t i = 0; i < llvm::array_lengthof(g_core_definitions); ++i) {
   if (NameMatches(g_core_definitions[i].name, NameMatch::StartsWith,
   request.GetCursorArgumentPrefix()))
-request.GetMatches().AppendString(g_core_definitions[i].name);
+request.AddCo

[Lldb-commits] [lldb] r337058 - Make these tests c++ tests so they can be skipped on systems that don't support those tests.

2018-07-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Jul 13 15:31:59 2018
New Revision: 337058

URL: http://llvm.org/viewvc/llvm-project?rev=337058&view=rev
Log:
Make these tests c++ tests so they can be skipped on systems that don't support 
those tests.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py?rev=337058&r1=337057&r2=337058&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
 Fri Jul 13 15:31:59 2018
@@ -45,6 +45,7 @@ class TestDataFormatterLibcxxBitset(Test
 self.check("small", 13)
 self.check("large", 200)
 
+@add_test_categories(["libc++"])
 def test_ptr_and_ref(self):
 """Test that ref and ptr to std::bitset is displayed correctly"""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py?rev=337058&r1=337057&r2=337058&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
 Fri Jul 13 15:31:59 2018
@@ -17,10 +17,6 @@ class LibcxxVectorDataFormatterTestCase(
 
 mydir = TestBase.compute_mydir(__file__)
 
-@add_test_categories(["libc++"])
-@skipIf(debug_info="gmodules",
-bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048";)
-
 def check_numbers(self, var_name):
 self.expect("frame variable " + var_name,
 substrs=[var_name + ' = size=7',
@@ -54,6 +50,9 @@ class LibcxxVectorDataFormatterTestCase(
 self.expect("frame variable " + var_name + "[3]",
 substrs=['1234'])
 
+@add_test_categories(["libc++"])
+@skipIf(debug_info="gmodules",
+bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048";)
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
 self.build()
@@ -180,6 +179,9 @@ class LibcxxVectorDataFormatterTestCase(
 self.expect("frame variable strings",
 substrs=['vector has 0 items'])
 
+@add_test_categories(["libc++"])
+@skipIf(debug_info="gmodules",
+bugnumber="https://bugs.llvm.org/show_bug.cgi?id=36048";)
 def test_ref_and_ptr(self):
 """Test that that file and class static variables display correctly."""
 self.build()


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


[Lldb-commits] [lldb] r337063 - Fix -Wswitch after introduction of clang; :Type::DependentVector in r337036

2018-07-13 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Fri Jul 13 15:40:40 2018
New Revision: 337063

URL: http://llvm.org/viewvc/llvm-project?rev=337063&view=rev
Log:
Fix -Wswitch after introduction of clang;:Type::DependentVector in r337036

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=337063&r1=337062&r2=337063&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jul 13 15:40:40 2018
@@ -4166,6 +4166,8 @@ ClangASTContext::GetTypeClass(lldb::opaq
 return lldb::eTypeClassArray;
   case clang::Type::DependentSizedExtVector:
 return lldb::eTypeClassVector;
+  case clang::Type::DependentVector:
+return lldb::eTypeClassVector;
   case clang::Type::ExtVector:
 return lldb::eTypeClassVector;
   case clang::Type::Vector:
@@ -4900,6 +4902,7 @@ lldb::Encoding ClangASTContext::GetEncod
   case clang::Type::ConstantArray:
 break;
 
+  case clang::Type::DependentVector:
   case clang::Type::ExtVector:
   case clang::Type::Vector:
 // TODO: Set this to more than one???
@@ -5154,6 +5157,7 @@ lldb::Format ClangASTContext::GetFormat(
   case clang::Type::ConstantArray:
 return lldb::eFormatVoid; // no value
 
+  case clang::Type::DependentVector:
   case clang::Type::ExtVector:
   case clang::Type::Vector:
 break;


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


[Lldb-commits] [lldb] r337064 - [lldb-mi] Make symbol-list-lines.test XFAIL on Windows

2018-07-13 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Fri Jul 13 15:41:16 2018
New Revision: 337064

URL: http://llvm.org/viewvc/llvm-project?rev=337064&view=rev
Log:
[lldb-mi] Make symbol-list-lines.test XFAIL on Windows

It's a temporary decision until we reach out what causes
a failure.

Modified:
lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test

Modified: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test?rev=337064&r1=337063&r2=337064&view=diff
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test (original)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Fri Jul 13 
15:41:16 2018
@@ -1,3 +1,6 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
 # RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c 
%p/inputs/list-lines-helper.c -g
 # RUN: %lldbmi %t < %s | FileCheck %s
 


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


[Lldb-commits] [PATCH] D49062: [lldb-mi] Re-implement data-info-line command.

2018-07-13 Thread Alexander Polyakov via Phabricator via lldb-commits
apolyakov added a comment.

It would be good to convert to LIT as more tests as we can. I'll do this in one 
of a next patches. Let's continue with this one?


https://reviews.llvm.org/D49062



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


[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.

2018-07-13 Thread Alexander Polyakov via Phabricator via lldb-commits
apolyakov added a comment.

@stella.stamenova Done in r337064.


Repository:
  rL LLVM

https://reviews.llvm.org/D48802



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


[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.

2018-07-13 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D48802



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


[Lldb-commits] [PATCH] D49334: Added syntax highlighting support

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
Herald added a subscriber: mgorny.

This patch adds syntax highlighting support to LLDB. When enabled (and lldb is 
allowed
to use colors), printed source code is annotated with the ANSI color escape 
sequences.

So far we have only one highlighter which is based on Clang and is responsible 
for all
languages that are supported by Clang. It essentially just runs the raw lexer 
over the input
and then surrounds the specific tokens with the configured escape sequences.


https://reviews.llvm.org/D49334

Files:
  include/lldb/Core/Debugger.h
  include/lldb/Core/Highlighter.h
  source/Core/CMakeLists.txt
  source/Core/Debugger.cpp
  source/Core/Highlighter.cpp
  source/Core/SourceManager.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/HighlighterTest.cpp

Index: unittests/Core/HighlighterTest.cpp
===
--- /dev/null
+++ unittests/Core/HighlighterTest.cpp
@@ -0,0 +1,204 @@
+//===-- HighlighterTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/Highlighter.h"
+
+using namespace lldb_private;
+using namespace llvm;
+
+static std::string getName(lldb::LanguageType type) {
+  HighlighterManager mgr;
+  return mgr.getHighlighterFor(type, "").GetName().str();
+}
+
+static std::string getName(llvm::StringRef path) {
+  HighlighterManager mgr;
+  return mgr.getHighlighterFor(lldb::eLanguageTypeUnknown, path)
+  .GetName()
+  .str();
+}
+
+TEST(HighlighterTest, HighlighterSelectionType) {
+  ASSERT_EQ(getName(lldb::eLanguageTypeC), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC11), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC89), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC99), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC_plus_plus), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC_plus_plus_03), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC_plus_plus_11), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeC_plus_plus_14), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeObjC), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeObjC_plus_plus), "clang");
+  ASSERT_EQ(getName(lldb::eLanguageTypeOpenCL), "clang");
+
+  ASSERT_NE(getName(lldb::eLanguageTypeJulia), "clang");
+  ASSERT_NE(getName(lldb::eLanguageTypeJava), "clang");
+  ASSERT_NE(getName(lldb::eLanguageTypeHaskell), "clang");
+}
+
+TEST(HighlighterTest, HighlighterSelectionPath) {
+  ASSERT_EQ(getName("myfile.cc"), "clang");
+  ASSERT_EQ(getName("moo.cpp"), "clang");
+  ASSERT_EQ(getName("mar.cxx"), "clang");
+  ASSERT_EQ(getName("foo.C"), "clang");
+  ASSERT_EQ(getName("bar.CC"), "clang");
+  ASSERT_EQ(getName("a/dir.CC"), "clang");
+  ASSERT_EQ(getName("/a/dir.hpp"), "clang");
+  ASSERT_EQ(getName("header.h"), "clang");
+
+  ASSERT_NE(getName("/dev/null"), "clang");
+  ASSERT_NE(getName("Factory.java"), "clang");
+  ASSERT_NE(getName("poll.py"), "clang");
+  ASSERT_NE(getName("reducer.hs"), "clang");
+}
+
+TEST(HighlighterTest, FallbackHighlighter) {
+  HighlighterManager mgr;
+  const Highlighter &h =
+  mgr.getHighlighterFor(lldb::eLanguageTypePascal83, "foo.pas");
+
+  HighlightStyle style;
+  style.identifier.Set("[", "]");
+  style.semicolons.Set("<", ">");
+
+  const char *code = "program Hello;";
+  std::string output = h.Highlight(style, code);
+
+  ASSERT_STREQ(output.c_str(), code);
+}
+
+TEST(HighlighterTest, DefaultHighlighter) {
+  HighlighterManager mgr;
+  const Highlighter &h = mgr.getHighlighterFor(lldb::eLanguageTypeC, "main.c");
+
+  HighlightStyle style;
+
+  const char *code = "int my_main() { return 22; } \n";
+  std::string output = h.Highlight(style, code);
+
+  ASSERT_STREQ(output.c_str(), code);
+}
+
+//--
+// Tests highlighting with the Clang highlighter.
+//--
+
+static std::string highlightC(llvm::StringRef code, HighlightStyle style) {
+  HighlighterManager mgr;
+  const Highlighter &h = mgr.getHighlighterFor(lldb::eLanguageTypeC, "main.c");
+  return h.Highlight(style, code);
+}
+
+TEST(HighlighterTest, ClangEmptyInput) {
+  HighlightStyle s;
+
+  std::string output = highlightC("", s);
+  ASSERT_STREQ("", output.c_str());
+}
+
+TEST(HighlighterTest, ClangScalarLiterals) {
+  HighlightStyle s;
+  s.scalar_literal.Set("", "");
+
+  std::string output = highlightC(" int i = 22;", s);
+  ASSERT_STREQ(" int i = 22;", output.c_str());
+}
+
+TEST(HighlighterTest, ClangStringLiterals) {
+  HighlightStyle s;
+  s.string_literal.Set("", "");
+
+  std::string output = highlightC("const char *f = 22 + \"foo\";", s);
+  ASSER

[Lldb-commits] [PATCH] D49334: Added syntax highlighting support

2018-07-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Also: This patch doesn't answer the question how the user will be able to 
configure the specific colors used for each token (i.e. there is only one style 
available at the moment). The reason for this is that there seems to be a lot 
of opinions about whether we want to flood the settings with 
highlighting-specific fields or if we just provide a fixed set of common 
styles. So I would prefer if we could defer the discussion about this to 
another patch that will address this (Unless we somehow magically achieve 
consensus on this one).


https://reviews.llvm.org/D49334



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