[Lldb-commits] [PATCH] D52468: [PDB] Treat `char`, `signed char` and `unsigned char` as three different types

2018-09-28 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

Yes, sure! Thanks all!


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52468



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


[Lldb-commits] [lldb] r343298 - [PDB] Handle `char` as a builtin type

2018-09-28 Thread Aleksandr Urakov via lldb-commits
Author: aleksandr.urakov
Date: Fri Sep 28 00:59:49 2018
New Revision: 343298

URL: http://llvm.org/viewvc/llvm-project?rev=343298&view=rev
Log:
[PDB] Handle `char` as a builtin type

Summary:
`char`, `signed char` and `unsigned char` are three different types,
and they are mangled differently:

```
void __declspec(dllexport) /* ?foo@@YAXD@Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE@Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC@Z */ foo(signed char c) { }
```

This commit separates `char` from `signed char` and `unsigned char`.

Reviewers: asmith, zturner, labath

Reviewed By: asmith, zturner

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

Modified:
lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
lldb/trunk/lit/SymbolFile/PDB/typedefs.test
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Modified: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp?rev=343298&r1=343297&r2=343298&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp (original)
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp Fri Sep 28 
00:59:49 2018
@@ -35,6 +35,9 @@ EnumClass EnumClassVar;
 enum struct EnumStruct { red, blue, black };
 EnumStruct EnumStructVar;
 
+typedef signed char SCharTypedef;
+SCharTypedef SCVar;
+
 typedef char16_t WChar16Typedef;
 WChar16Typedef WC16Var;
 

Modified: lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/ast-restore.test?rev=343298&r1=343297&r2=343298&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/ast-restore.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/ast-restore.test Fri Sep 28 00:59:49 2018
@@ -58,7 +58,7 @@ INNER: namespace N0 {
 INNER: namespace N1 {
 INNER: class Class : public N0::N1::Base {
 INNER: struct Inner {
-INNER: signed char x;
+INNER: char x;
 INNER: short y;
 INNER: int z;
 INNER: };

Modified: lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/func-symbols.test?rev=343298&r1=343297&r2=343298&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/func-symbols.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/func-symbols.test Fri Sep 28 00:59:49 2018
@@ -14,7 +14,7 @@ CHECK-ONE-DAG: [[TY0:.*]]:   Type{[[UID0
 CHECK-ONE-DAG: [[TY1:.*]]:   Type{[[UID1:.*]]} , name = "Func_arg_void", decl 
= FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void)
 CHECK-ONE-DAG: [[TY2:.*]]:   Type{[[UID2:.*]]} , name = "Func_arg_none", decl 
= FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void)
 CHECK-ONE-DAG: [[TY3:.*]]:   Type{[[UID3:.*]]} , name = "Func_varargs", decl = 
FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...)
-CHECK-ONE-DAG: [[TY4:.*]]:   Type{[[UID4:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (signed char, int)
+CHECK-ONE-DAG: [[TY4:.*]]:   Type{[[UID4:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (char, int)
 CHECK-ONE-DAG: [[TY5:.*]]:   Type{[[UID5:.*]]} , name = "main", decl = 
FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void)
 CHECK-ONE-DAG: [[TY6:.*]]:   Type{[[UID6:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, 
volatile _Bool, ...)
 CHECK-ONE-DAG: [[TY7:.*]]:   Type{[[UID7:.*]]} , name = "StaticFunction", decl 
= FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int)

Modified: lldb/trunk/lit/SymbolFile/PDB/typedefs.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/typedefs.test?rev=343298&r1=343297&r2=343298&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/typedefs.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/typedefs.test Fri Sep 28 00:59:49 2018
@@ -46,9 +46,10 @@ CHECK-DAG: Type{{.*}} , size = 4, compil
 CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long
 CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = 
{{.*}} unsigned short
 CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = 
{{.*}} unsigned int
+CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = {{.*}} char
 CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} 
signed char
-CHECK-DAG: Type

[Lldb-commits] [PATCH] D52468: [PDB] Treat `char`, `signed char` and `unsigned char` as three different types

2018-09-28 Thread Aleksandr Urakov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343298: [PDB] Handle `char` as a builtin type (authored by 
aleksandr.urakov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52468?vs=166876&id=167433#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52468

Files:
  lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
  lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
  lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
  lldb/trunk/lit/SymbolFile/PDB/typedefs.test
  lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp


Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -113,6 +113,8 @@
 return CompilerType();
   case PDB_BuiltinType::Void:
 return clang_ast.GetBasicType(eBasicTypeVoid);
+  case PDB_BuiltinType::Char:
+return clang_ast.GetBasicType(eBasicTypeChar);
   case PDB_BuiltinType::Bool:
 return clang_ast.GetBasicType(eBasicTypeBool);
   case PDB_BuiltinType::Long:
Index: lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
===
--- lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
+++ lldb/trunk/lit/SymbolFile/PDB/ast-restore.test
@@ -58,7 +58,7 @@
 INNER: namespace N1 {
 INNER: class Class : public N0::N1::Base {
 INNER: struct Inner {
-INNER: signed char x;
+INNER: char x;
 INNER: short y;
 INNER: int z;
 INNER: };
Index: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
===
--- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
+++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
@@ -35,6 +35,9 @@
 enum struct EnumStruct { red, blue, black };
 EnumStruct EnumStructVar;
 
+typedef signed char SCharTypedef;
+SCharTypedef SCVar;
+
 typedef char16_t WChar16Typedef;
 WChar16Typedef WC16Var;
 
Index: lldb/trunk/lit/SymbolFile/PDB/typedefs.test
===
--- lldb/trunk/lit/SymbolFile/PDB/typedefs.test
+++ lldb/trunk/lit/SymbolFile/PDB/typedefs.test
@@ -46,9 +46,10 @@
 CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long
 CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = 
{{.*}} unsigned short
 CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = 
{{.*}} unsigned int
+CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = {{.*}} char
 CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} 
signed char
-CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} signed char (void *, long, 
unsigned short, unsigned int, ...)
-CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} signed char (*)(void 
*, long, unsigned short, unsigned int, ...)
+CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} char (void *, long, unsigned 
short, unsigned int, ...)
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} char (*)(void *, 
long, unsigned short, unsigned int, ...)
 CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedef", compiler_type = {{.*}} 
typedef VarArgsFuncTypedef
 
 CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float
Index: lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
===
--- lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
+++ lldb/trunk/lit/SymbolFile/PDB/func-symbols.test
@@ -14,7 +14,7 @@
 CHECK-ONE-DAG: [[TY1:.*]]:   Type{[[UID1:.*]]} , name = "Func_arg_void", decl 
= FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void)
 CHECK-ONE-DAG: [[TY2:.*]]:   Type{[[UID2:.*]]} , name = "Func_arg_none", decl 
= FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void)
 CHECK-ONE-DAG: [[TY3:.*]]:   Type{[[UID3:.*]]} , name = "Func_varargs", decl = 
FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...)
-CHECK-ONE-DAG: [[TY4:.*]]:   Type{[[UID4:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (signed char, int)
+CHECK-ONE-DAG: [[TY4:.*]]:   Type{[[UID4:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (char, int)
 CHECK-ONE-DAG: [[TY5:.*]]:   Type{[[UID5:.*]]} , name = "main", decl = 
FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void)
 CHECK-ONE-DAG: [[TY6:.*]]:   Type{[[UID6:.*]]} , name = "Func", decl = 
FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, 
volatile _Bool, ...)
 CHECK-ONE-DAG: [[TY7:.*]]:   Type{[[UID7:.*]]} , name = "StaticFunction", decl 
= FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int)


Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTPar

[Lldb-commits] [PATCH] D52403: [LLDB] - Support the single file split DWARF.

2018-09-28 Thread George Rimar via Phabricator via lldb-commits
grimar added inline comments.



Comment at: include/lldb/lldb-enumerations.h:643-660
+  eSectionTypeDWARFDebugAbbrevDwo,
   eSectionTypeDWARFDebugAddr,
   eSectionTypeDWARFDebugAranges,
   eSectionTypeDWARFDebugCuIndex,
   eSectionTypeDWARFDebugFrame,
   eSectionTypeDWARFDebugInfo,
+  eSectionTypeDWARFDebugInfoDwo,

clayborg wrote:
> Add all of these to the end of this enum for API stability since this is a 
> public header used in the API. If an older binary runs against a newer 
> liblldb.so, all of these enums will be off.
Done.



Comment at: source/Symbol/ObjectFile.cpp:347
   case eSectionTypeDWARFDebugAbbrev:
+  case eSectionTypeDWARFDebugAbbrevDwo:
   case eSectionTypeDWARFDebugAddr:

clayborg wrote:
> Check for other ObjectFile subclasses that override this function. I believe 
> ObjectFileMachO does.
Yes, and my patch already has the change for ObjectFileMachO :)
All other classes are fine too I think.


https://reviews.llvm.org/D52403



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


[Lldb-commits] [PATCH] D52403: [LLDB] - Support the single file split DWARF.

2018-09-28 Thread George Rimar via Phabricator via lldb-commits
grimar updated this revision to Diff 167440.
grimar marked an inline comment as done.
grimar added a comment.

- Addressed review comments.


https://reviews.llvm.org/D52403

Files:
  include/lldb/lldb-enumerations.h
  lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml
  lit/Breakpoint/Inputs/single-file-split-dwarf.yaml
  lit/Breakpoint/single-file-split-dwarf.test
  source/Core/Section.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  source/Symbol/ObjectFile.cpp

Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -344,11 +344,13 @@
 return AddressClass::eData;
   case eSectionTypeDebug:
   case eSectionTypeDWARFDebugAbbrev:
+  case eSectionTypeDWARFDebugAbbrevDwo:
   case eSectionTypeDWARFDebugAddr:
   case eSectionTypeDWARFDebugAranges:
   case eSectionTypeDWARFDebugCuIndex:
   case eSectionTypeDWARFDebugFrame:
   case eSectionTypeDWARFDebugInfo:
+  case eSectionTypeDWARFDebugInfoDwo:
   case eSectionTypeDWARFDebugLine:
   case eSectionTypeDWARFDebugLineStr:
   case eSectionTypeDWARFDebugLoc:
@@ -359,7 +361,9 @@
   case eSectionTypeDWARFDebugPubTypes:
   case eSectionTypeDWARFDebugRanges:
   case eSectionTypeDWARFDebugStr:
+  case eSectionTypeDWARFDebugStrDwo:
   case eSectionTypeDWARFDebugStrOffsets:
+  case eSectionTypeDWARFDebugStrOffsetsDwo:
   case eSectionTypeDWARFDebugTypes:
   case eSectionTypeDWARFAppleNames:
   case eSectionTypeDWARFAppleTypes:
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -50,6 +50,12 @@
 
   DWARFUnit *GetBaseCompileUnit() override;
 
+  const lldb_private::DWARFDataExtractor &get_debug_abbrev_data() override;
+  const lldb_private::DWARFDataExtractor &get_debug_addr_data() override;
+  const lldb_private::DWARFDataExtractor &get_debug_info_data() override;
+  const lldb_private::DWARFDataExtractor &get_debug_str_data() override;
+  const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data() override;
+
 protected:
   void LoadSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data) override;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -61,14 +61,6 @@
 }
 
 DWARFUnit *SymbolFileDWARFDwo::GetCompileUnit() {
-  // A clang module is found via a skeleton CU, but is not a proper DWO.
-  // Clang modules have a .debug_info section instead of the *_dwo variant.
-  if (auto *section_list = m_obj_file->GetSectionList(false))
-if (auto section_sp =
-section_list->FindSectionByType(eSectionTypeDWARFDebugInfo, true))
-  if (!section_sp->GetName().GetStringRef().endswith("dwo"))
-return nullptr;
-
   // Only dwo files with 1 compile unit is supported
   if (GetNumCompileUnits() == 1)
 return DebugInfo()->GetCompileUnitAtIndex(0);
@@ -126,6 +118,37 @@
   return m_base_dwarf_cu;
 }
 
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_abbrev_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugAbbrevDwo,
+  m_data_debug_abbrev);
+}
+
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_addr_data() {
+  // For single file split dwarf case (when we have .dwo sections in a .o),
+  // we do not want to use the .debug_addr section from .o file,
+  // but want to get one from the final executable.
+  // For regular split debug case, .dwo file does not contain the
+  // .debug_addr, so we would always fall back to such lookup anyways.
+  llvm::call_once(m_data_debug_addr.m_flag, [this] {
+SymbolFileDWARF::LoadSectionData(eSectionTypeDWARFDebugAddr,
+ std::ref(m_data_debug_addr.m_data));
+  });
+  return m_data_debug_addr.m_data;
+}
+
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_info_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo, m_data_debug_info);
+}
+
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugStrDwo, m_data_debug_str);
+}
+
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_offsets_data() {
+  return GetCachedSectionData(eSectionTypeDWARFDebugStrOffsetsDwo,
+  

[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-09-28 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

Thanks for explanations!

Unfortunately I can't promise that I'll begin porting `lldb-server` on Windows 
in the nearest future. I've looked at my working copy, and there are only two 
small changes related to `ProcessWindows` plugin (but they are not related to 
the current review), may be we'll continue with the plugin for now? To proceed 
with other things that need some implementation of a such functionality 
(whether in `ProcessWindows` or `lldb-server`). How about this?


https://reviews.llvm.org/D52618



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


[Lldb-commits] [PATCH] D52604: Clean-up usage of OptionDefinition arrays

2018-09-28 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 167475.
tatyana-krasnukha added a comment.

Modifies Driver::ParseArgs checks


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52604

Files:
  include/lldb/Target/Platform.h
  source/Commands/CommandObjectDisassemble.h
  source/Commands/CommandObjectExpression.h
  tools/driver/Driver.cpp
  tools/driver/Driver.h

Index: tools/driver/Driver.h
===
--- tools/driver/Driver.h
+++ tools/driver/Driver.h
@@ -68,8 +68,6 @@
 void AddInitialCommand(const char *command, CommandPlacement placement,
bool is_file, lldb::SBError &error);
 
-// static OptionDefinition m_cmd_option_table[];
-
 struct InitialCmdEntry {
   InitialCmdEntry(const char *in_contents, bool in_is_file,
   bool is_cwd_lldbinit_file_read, bool in_quiet = false)
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -9,6 +9,7 @@
 
 #include "Driver.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include 
+#include 
 
 #if !defined(__APPLE__)
 #include "llvm/Support/DataTypes.h"
@@ -87,7 +89,7 @@
 #define LLDB_3_TO_5 LLDB_OPT_SET_3 | LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 #define LLDB_4_TO_5 LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 
-static OptionDefinition g_options[] = {
+static constexpr OptionDefinition g_options[] = {
 {LLDB_OPT_SET_1, true, "help", 'h', no_argument, 0, eArgTypeNone,
  "Prints out the usage information for the LLDB debugger."},
 {LLDB_OPT_SET_2, true, "version", 'v', no_argument, 0, eArgTypeNone,
@@ -159,8 +161,9 @@
 {LLDB_OPT_SET_7, true, "repl", 'r', optional_argument, 0, eArgTypeNone,
  "Runs lldb in REPL mode with a stub process."},
 {LLDB_OPT_SET_7, true, "repl-language", 'R', required_argument, 0,
- eArgTypeNone, "Chooses the language for the REPL."},
-{0, false, NULL, 0, 0, 0, eArgTypeNone, NULL}};
+ eArgTypeNone, "Chooses the language for the REPL."}};
+
+static constexpr auto g_num_options = sizeof(g_options)/sizeof(OptionDefinition);
 
 static const uint32_t last_option_set_with_args = 2;
 
@@ -229,8 +232,7 @@
   }
 }
 
-void ShowUsage(FILE *out, OptionDefinition *option_table,
-   Driver::OptionData data) {
+static void ShowUsage(FILE *out, Driver::OptionData data) {
   uint32_t screen_width = 80;
   uint32_t indent_level = 0;
   const char *name = "lldb";
@@ -245,12 +247,10 @@
   //   [options-for-level-1]
   //   etc.
 
-  uint32_t num_options;
   uint32_t num_option_sets = 0;
 
-  for (num_options = 0; option_table[num_options].long_option != NULL;
-   ++num_options) {
-uint32_t this_usage_mask = option_table[num_options].usage_mask;
+  for (const auto &opt : g_options) {
+uint32_t this_usage_mask = opt.usage_mask;
 if (this_usage_mask == LLDB_OPT_SET_ALL) {
   if (num_option_sets == 0)
 num_option_sets = 1;
@@ -274,32 +274,32 @@
 fprintf(out, "%*s%s", indent_level, "", name);
 bool is_help_line = false;
 
-for (uint32_t i = 0; i < num_options; ++i) {
-  if (option_table[i].usage_mask & opt_set_mask) {
-CommandArgumentType arg_type = option_table[i].argument_type;
+for (const auto &opt : g_options) {
+  if (opt.usage_mask & opt_set_mask) {
+CommandArgumentType arg_type = opt.argument_type;
 const char *arg_name =
 SBCommandInterpreter::GetArgumentTypeAsCString(arg_type);
 // This is a bit of a hack, but there's no way to say certain options
 // don't have arguments yet...
 // so we do it by hand here.
-if (option_table[i].short_option == 'h')
+if (opt.short_option == 'h')
   is_help_line = true;
 
-if (option_table[i].required) {
-  if (option_table[i].option_has_arg == required_argument)
-fprintf(out, " -%c <%s>", option_table[i].short_option, arg_name);
-  else if (option_table[i].option_has_arg == optional_argument)
-fprintf(out, " -%c [<%s>]", option_table[i].short_option, arg_name);
+if (opt.required) {
+  if (opt.option_has_arg == required_argument)
+fprintf(out, " -%c <%s>", opt.short_option, arg_name);
+  else if (opt.option_has_arg == optional_argument)
+fprintf(out, " -%c [<%s>]", opt.short_option, arg_name);
   else
-fprintf(out, " -%c", option_table[i].short_option);
+fprintf(out, " -%c", opt.short_option);
 } else {
-  if (option_table[i].option_has_arg == required_argument)
-fprintf(out, " [-%c <%s>]", option_table[i].short_option, arg_name);
-  else if (option_table[i].option_has_arg == optional_argument)

[Lldb-commits] [PATCH] D52604: Clean-up usage of OptionDefinition arrays

2018-09-28 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: tools/driver/Driver.cpp:581-585
+  if (g_num_options == 0) {
 if (argc > 1)
   error.SetErrorStringWithFormat("invalid number of options");
 return error;
   }

clayborg wrote:
> Do we even need this if statement and its contents? maybe 
> lldbassert(g_num_options > 0);?
I replaced it with static_assert since this expression can be checked at 
compile time. And added `if (argc <= 1)` to skip build of long_options_vector 
if there is no arguments to parse.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52604



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


[Lldb-commits] [PATCH] D52651: Add functionality to export settings

2018-09-28 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: clayborg, jingham, teemperor.
JDevlieghere added a project: LLDB.

For the reproducer feature I need to be able to export and import the current 
LLDB configuration. To realize this I've extended the existing functionality to 
print settings. With the help of a new formatting option, we can now write the 
settings and their values to a file structured as regular commands.

Concretely the functionality works as follows:

  (lldb) settings export /path/to/file

This file contains a bunch of `settings set` commands, followed by the 
setting's name and value.

  settings set use-external-editor false
  settings set use-color true
  settings set auto-one-line-summaries true
  settings set auto-indent true

Loading the settings again is as simple as sourcing the newly created file:

  (lldb) command source /path/to/file

I had to make a few small changes here to make this work:

- When a value is not set `settings set ` is equal to `settings clear 
`. This is because not all settings have a meaningful default For 
example for `settings set` we used to print `unknown` which is not a value the 
user can set.
- I introduced a new printing option and group for printing options as 
commands. This relates to printing everything on a single line for things like 
arrays and dicts.

There's one setting that is proving to be a pain: the disassembly format value. 
Currently we don't accept our own default value. I don't know what the problem 
is but I managed to work around this by escaping the back ticks.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52651

Files:
  include/lldb/Interpreter/OptionValue.h
  lit/Settings/TestExport.test
  source/Commands/CommandObjectSettings.cpp
  source/Core/Debugger.cpp
  source/Interpreter/OptionValueArray.cpp
  source/Interpreter/OptionValueDictionary.cpp
  source/Interpreter/OptionValueFileSpecLIst.cpp
  source/Interpreter/OptionValueFormatEntity.cpp
  source/Interpreter/OptionValueLanguage.cpp
  source/Interpreter/Property.cpp

Index: source/Interpreter/Property.cpp
===
--- source/Interpreter/Property.cpp
+++ source/Interpreter/Property.cpp
@@ -233,7 +233,10 @@
 uint32_t dump_mask) const {
   if (m_value_sp) {
 const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription;
+const bool dump_cmd = dump_mask & OptionValue::eDumpOptionCommand;
 const bool transparent = m_value_sp->ValueIsTransparent();
+if (dump_cmd && !transparent)
+  strm << "settings set ";
 if (dump_desc || !transparent) {
   if ((dump_mask & OptionValue::eDumpOptionName) && m_name) {
 DumpQualifiedName(strm);
Index: source/Interpreter/OptionValueLanguage.cpp
===
--- source/Interpreter/OptionValueLanguage.cpp
+++ source/Interpreter/OptionValueLanguage.cpp
@@ -28,7 +28,8 @@
   if (dump_mask & eDumpOptionValue) {
 if (dump_mask & eDumpOptionType)
   strm.PutCString(" = ");
-strm.PutCString(Language::GetNameForLanguageType(m_current_value));
+if (m_current_value != eLanguageTypeUnknown)
+  strm.PutCString(Language::GetNameForLanguageType(m_current_value));
   }
 }
 
Index: source/Interpreter/OptionValueFormatEntity.cpp
===
--- source/Interpreter/OptionValueFormatEntity.cpp
+++ source/Interpreter/OptionValueFormatEntity.cpp
@@ -47,8 +47,8 @@
 strm.Printf("(%s)", GetTypeAsCString());
   if (dump_mask & eDumpOptionValue) {
 if (dump_mask & eDumpOptionType)
-  strm.PutCString(" = \"");
-strm << m_current_format.c_str() << '"';
+  strm.PutCString(" = ");
+strm << '"' << m_current_format.c_str() << '"';
   }
 }
 
Index: source/Interpreter/OptionValueFileSpecLIst.cpp
===
--- source/Interpreter/OptionValueFileSpecLIst.cpp
+++ source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -25,16 +25,24 @@
   if (dump_mask & eDumpOptionType)
 strm.Printf("(%s)", GetTypeAsCString());
   if (dump_mask & eDumpOptionValue) {
-if (dump_mask & eDumpOptionType)
-  strm.Printf(" =%s", m_current_value.GetSize() > 0 ? "\n" : "");
-strm.IndentMore();
+const bool one_line = dump_mask & eDumpOptionCommand;
 const uint32_t size = m_current_value.GetSize();
+if (dump_mask & eDumpOptionType)
+  strm.Printf(" =%s",
+  (m_current_value.GetSize() > 0 && !one_line) ? "\n" : "");
+if (!one_line)
+  strm.IndentMore();
 for (uint32_t i = 0; i < size; ++i) {
-  strm.Indent();
-  strm.Printf("[%u]: ", i);
+  if (!one_line) {
+strm.Indent();
+strm.Printf("[%u]: ", i);
+  }
   m_current_value.GetFileSpecAtIndex(i).Dump(&strm);
+  if (one_line)
+strm << ' ';
 }
-strm.IndentLess();
+if (!one_line)
+  strm.IndentLess();

[Lldb-commits] [PATCH] D52461: [PDB] Introduce `PDBNameParser`

2018-09-28 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a reviewer: clayborg.
aleksandr.urakov added a comment.

In https://reviews.llvm.org/D52461#1245058, @clayborg wrote:

> Try to use and extend CPlusPlusLanguage::MethodName as needed. I believe it 
> was recently backed by a new clang parser that knows how to chop up C++ 
> demangled names


It seems that `CPlusPlusLanguage::MethodName` is backed by LLDB 
`CPlusPlusNameParser`, which can't parse demangled names... Can you tell me, 
please, how is called a new Clang parser you have mentioned? May be I'll use it 
directly instead of `PDBNameParser`, or will back `PDBNameParser` by it (if the 
interface will be not very convenient)?


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52461



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


[Lldb-commits] [PATCH] D52403: [LLDB] - Support the single file split DWARF.

2018-09-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good!


https://reviews.llvm.org/D52403



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


[Lldb-commits] [PATCH] D52403: [LLDB] - Support the single file split DWARF.

2018-09-28 Thread George Rimar via Phabricator via lldb-commits
grimar added a comment.

Thanks for the review! It still depends on -gsingle-file-split-dwarf 
(https://reviews.llvm.org/D52403), I'll wait for it some time.
It should be possible to rewrite the comment in the test case to avoid 
mentioning the flag, but I would prefer to use it.


https://reviews.llvm.org/D52403



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


Re: [Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-09-28 Thread Zachary Turner via lldb-commits
I think it’s fine. Eventually when you are ready to support remote
debugging hopefully we can convert it over to using lldb-server
On Fri, Sep 28, 2018 at 4:44 AM Aleksandr Urakov via Phabricator <
revi...@reviews.llvm.org> wrote:

> aleksandr.urakov added a comment.
>
> Thanks for explanations!
>
> Unfortunately I can't promise that I'll begin porting `lldb-server` on
> Windows in the nearest future. I've looked at my working copy, and there
> are only two small changes related to `ProcessWindows` plugin (but they are
> not related to the current review), may be we'll continue with the plugin
> for now? To proceed with other things that need some implementation of a
> such functionality (whether in `ProcessWindows` or `lldb-server`). How
> about this?
>
>
> https://reviews.llvm.org/D52618
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-09-28 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

I think it’s fine. Eventually when you are ready to support remote
debugging hopefully we can convert it over to using lldb-server


https://reviews.llvm.org/D52618



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


[Lldb-commits] [lldb] r343348 - Clean-up usage of OptionDefinition arrays

2018-09-28 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 28 10:58:16 2018
New Revision: 343348

URL: http://llvm.org/viewvc/llvm-project?rev=343348&view=rev
Log:
Clean-up usage of OptionDefinition arrays

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

Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Commands/CommandObjectDisassemble.h
lldb/trunk/source/Commands/CommandObjectExpression.h
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri Sep 28 10:58:16 2018
@@ -1131,10 +1131,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_rsync;
@@ -1160,10 +1156,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_ssh;
@@ -1187,10 +1179,6 @@ public:
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   std::string m_cache_dir;

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Fri Sep 28 10:58:16 
2018
@@ -65,7 +65,6 @@ public:
   // "at_pc".  This should be set
 // in SetOptionValue if anything the selects a location is set.
 lldb::addr_t symbol_containing_addr;
-static OptionDefinition g_option_table[];
   };
 
   CommandObjectDisassemble(CommandInterpreter &interpreter);

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Sep 28 10:58:16 
2018
@@ -39,9 +39,6 @@ public:
 
 void OptionParsingStarting(ExecutionContext *execution_context) override;
 
-// Options table: Required for subclasses of Options.
-
-static OptionDefinition g_option_table[];
 bool top_level;
 bool unwind_on_error;
 bool ignore_breakpoints;

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=343348&r1=343347&r2=343348&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 28 10:58:16 2018
@@ -9,6 +9,7 @@
 
 #include "Driver.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include 
+#include 
 
 #if !defined(__APPLE__)
 #include "llvm/Support/DataTypes.h"
@@ -87,7 +89,7 @@ typedef struct {
 #define LLDB_3_TO_5 LLDB_OPT_SET_3 | LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 #define LLDB_4_TO_5 LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 
-static OptionDefinition g_options[] = {
+static constexpr OptionDefinition g_options[] = {
 {LLDB_OPT_SET_1, true, "help", 'h', no_argument, 0, eArgTypeNone,
  "Prints out the usage information for the LLDB debugger."},
 {LLDB_OPT_SET_2, true, "version", 'v', no_argument, 0, eArgTypeNone,
@@ -159,8 +161,9 @@ static OptionDefinition g_options[] = {
 {LLDB_OPT_SET_7, true, "repl", 'r', optional_argument, 0, eArgTypeNone,
  "Runs lldb in REPL mode with a stub process."},
 {LLDB_OPT_SET_7, true, "repl-language", 'R', required_argument, 0,
- eArgTypeNone, "Chooses the language for the REPL."},
-{0, false, NULL, 0, 0, 0, eArgTypeNone, NULL}};
+ eArgTypeNone, "Chooses the language for the REPL."}};
+
+static constexpr auto g_num_options = 
sizeof(g_options)/sizeof(OptionDefinition);
 
 static const uint32_t last_option_set_with_args = 2;
 
@@ -229,8 +232,7 @@ void OutputFormattedUsageText(FILE *out,
   }
 }
 
-void ShowUsage(FILE *out, OptionDefinition *option

[Lldb-commits] [PATCH] D52604: Clean-up usage of OptionDefinition arrays

2018-09-28 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB343348: Clean-up usage of OptionDefinition arrays 
(authored by tkrasnukha, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52604?vs=167475&id=167515#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52604

Files:
  include/lldb/Target/Platform.h
  source/Commands/CommandObjectDisassemble.h
  source/Commands/CommandObjectExpression.h
  tools/driver/Driver.cpp
  tools/driver/Driver.h

Index: include/lldb/Target/Platform.h
===
--- include/lldb/Target/Platform.h
+++ include/lldb/Target/Platform.h
@@ -1131,10 +1131,6 @@
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_rsync;
@@ -1160,10 +1156,6 @@
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   bool m_ssh;
@@ -1187,10 +1179,6 @@
 
   llvm::ArrayRef GetDefinitions() override;
 
-  // Options table: Required for subclasses of Options.
-
-  static lldb_private::OptionDefinition g_option_table[];
-
   // Instance variables to hold the values for command options.
 
   std::string m_cache_dir;
Index: tools/driver/Driver.h
===
--- tools/driver/Driver.h
+++ tools/driver/Driver.h
@@ -68,8 +68,6 @@
 void AddInitialCommand(const char *command, CommandPlacement placement,
bool is_file, lldb::SBError &error);
 
-// static OptionDefinition m_cmd_option_table[];
-
 struct InitialCmdEntry {
   InitialCmdEntry(const char *in_contents, bool in_is_file,
   bool is_cwd_lldbinit_file_read, bool in_quiet = false)
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -9,6 +9,7 @@
 
 #include "Driver.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include 
+#include 
 
 #if !defined(__APPLE__)
 #include "llvm/Support/DataTypes.h"
@@ -87,7 +89,7 @@
 #define LLDB_3_TO_5 LLDB_OPT_SET_3 | LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 #define LLDB_4_TO_5 LLDB_OPT_SET_4 | LLDB_OPT_SET_5
 
-static OptionDefinition g_options[] = {
+static constexpr OptionDefinition g_options[] = {
 {LLDB_OPT_SET_1, true, "help", 'h', no_argument, 0, eArgTypeNone,
  "Prints out the usage information for the LLDB debugger."},
 {LLDB_OPT_SET_2, true, "version", 'v', no_argument, 0, eArgTypeNone,
@@ -159,8 +161,9 @@
 {LLDB_OPT_SET_7, true, "repl", 'r', optional_argument, 0, eArgTypeNone,
  "Runs lldb in REPL mode with a stub process."},
 {LLDB_OPT_SET_7, true, "repl-language", 'R', required_argument, 0,
- eArgTypeNone, "Chooses the language for the REPL."},
-{0, false, NULL, 0, 0, 0, eArgTypeNone, NULL}};
+ eArgTypeNone, "Chooses the language for the REPL."}};
+
+static constexpr auto g_num_options = sizeof(g_options)/sizeof(OptionDefinition);
 
 static const uint32_t last_option_set_with_args = 2;
 
@@ -229,8 +232,7 @@
   }
 }
 
-void ShowUsage(FILE *out, OptionDefinition *option_table,
-   Driver::OptionData data) {
+static void ShowUsage(FILE *out, Driver::OptionData data) {
   uint32_t screen_width = 80;
   uint32_t indent_level = 0;
   const char *name = "lldb";
@@ -245,12 +247,10 @@
   //   [options-for-level-1]
   //   etc.
 
-  uint32_t num_options;
   uint32_t num_option_sets = 0;
 
-  for (num_options = 0; option_table[num_options].long_option != NULL;
-   ++num_options) {
-uint32_t this_usage_mask = option_table[num_options].usage_mask;
+  for (const auto &opt : g_options) {
+uint32_t this_usage_mask = opt.usage_mask;
 if (this_usage_mask == LLDB_OPT_SET_ALL) {
   if (num_option_sets == 0)
 num_option_sets = 1;
@@ -274,32 +274,32 @@
 fprintf(out, "%*s%s", indent_level, "", name);
 bool is_help_line = false;
 
-for (uint32_t i = 0; i < num_options; ++i) {
-  if (option_table[i].usage_mask & opt_set_mask) {
-CommandArgumentType arg_type = option_table[i].argument_type;
+for (const auto &opt : g_options) {
+  if (opt.usage_mask & opt_set_mask) {
+CommandArgumentType arg_type = opt.argument_type;
 const char *arg_name =
 SBCommandInterpreter::GetArgumentTypeAsCString(arg_type);
 // This is a bit of a hack, but there's no way to say certain options
 // don't have arguments yet...

[Lldb-commits] [lldb] r343357 - [Driver] Remove unused declarations and "include" directives

2018-09-28 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Sep 28 12:58:03 2018
New Revision: 343357

URL: http://llvm.org/viewvc/llvm-project?rev=343357&view=rev
Log:
[Driver] Remove unused declarations and "include" directives

Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=343357&r1=343356&r2=343357&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 28 12:58:03 2018
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: lldb/trunk/tools/driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.h?rev=343357&r1=343356&r2=343357&view=diff
==
--- lldb/trunk/tools/driver/Driver.h (original)
+++ lldb/trunk/tools/driver/Driver.h Fri Sep 28 12:58:03 2018
@@ -11,9 +11,7 @@
 #define lldb_Driver_h_
 
 #include "Platform.h"
-#include "lldb/Host/PseudoTerminal.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -23,8 +21,6 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBError.h"
 
-class IOChannel;
-
 class Driver : public lldb::SBBroadcaster {
 public:
   typedef enum CommandPlacement {
@@ -107,9 +103,6 @@ public:
 OptionSet m_seen_options;
   };
 
-  static lldb::SBError SetOptionValue(int option_idx, const char *option_arg,
-  Driver::OptionData &data);
-
   lldb::SBDebugger &GetDebugger() { return m_debugger; }
 
   void ResizeWindow(unsigned short col);
@@ -119,8 +112,6 @@ private:
   OptionData m_option_data;
 
   void ResetOptionValues();
-
-  void ReadyForCommand();
 };
 
 #endif // lldb_Driver_h_


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


[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process

2018-09-28 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I agree with Zachary, converting to NativeProcess is enough of a project that 
we should not block useful fixes to the current ProcessWindows plugin on it.  
OTOH, it is a good project - somebody should add it to the Projects page.


https://reviews.llvm.org/D52618



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


[Lldb-commits] [lldb] r343368 - [SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().

2018-09-28 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri Sep 28 16:27:54 2018
New Revision: 343368

URL: http://llvm.org/viewvc/llvm-project?rev=343368&view=rev
Log:
[SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().



Modified:
lldb/trunk/include/lldb/API/SBTarget.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
lldb/trunk/scripts/interface/SBTarget.i
lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=343368&r1=343367&r2=343368&view=diff
==
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Fri Sep 28 16:27:54 2018
@@ -75,6 +75,31 @@ public:
 
   lldb::SBProcess GetProcess();
 
+  //--
+  /// Sets whether we should collect statistics on lldb or not.
+  ///
+  /// @param[in] v
+  /// A boolean to control the collection.
+  /// @return
+  /// void
+  //--
+  void SetCollectingStats(bool v);
+
+  //--
+  /// Returns whether statistics collection are enabled.
+  ///
+  /// @return
+  /// true if statistics are currently being collected, false
+  /// otherwise.
+  //--
+  bool GetCollectingStats();
+
+  //--
+  /// Returns a dump of the collected statistics.
+  ///
+  /// @return
+  /// A SBStructuredData with the statistics collected.
+  //--
   lldb::SBStructuredData GetStatistics();
 
   //--

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py?rev=343368&r1=343367&r2=343368&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
 Fri Sep 28 16:27:54 2018
@@ -17,6 +17,15 @@ class TestStatsAPI(TestBase):
 self.build()
 exe = self.getBuildArtifact("a.out")
 target = self.dbg.CreateTarget(exe)
+
+# Test enabling/disabling stats
+self.assertFalse(target.GetCollectingStats())
+target.SetCollectingStats(True)
+self.assertTrue(target.GetCollectingStats())
+target.SetCollectingStats(False)
+self.assertFalse(target.GetCollectingStats())
+
+# Test the function to get the statistics in JSON'ish.
 stats = target.GetStatistics()
 stream = lldb.SBStream()
 res = stats.GetAsJSON(stream)

Modified: lldb/trunk/scripts/interface/SBTarget.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=343368&r1=343367&r2=343368&view=diff
==
--- lldb/trunk/scripts/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/interface/SBTarget.i Fri Sep 28 16:27:54 2018
@@ -1019,6 +1019,10 @@ public:
 void
 SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
 
+void SetCollectingStats(bool v);
+
+bool GetCollectingStats();
+
 lldb::SBStructuredData GetStatistics();
 
 bool

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=343368&r1=343367&r2=343368&view=diff
==
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Sep 28 16:27:54 2018
@@ -202,6 +202,21 @@ SBStructuredData SBTarget::GetStatistics
   return data;
 }
 
+void SBTarget::SetCollectingStats(bool v) {
+  TargetSP target_sp(GetSP());
+  if (!target_sp)
+return;
+  return target_sp->SetCollectingStats(v);
+}
+
+bool SBTarget::GetCollectingStats() {
+  TargetSP target_sp(GetSP());
+  if (!target_sp)
+return false;
+  return target_sp->GetCollectingStats();
+}
+
+
 SBProcess SBTarget::LoadCore(const char *core_file) {
   lldb::SBError error; // Ignored
   return LoadCore(core_file, error);


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