[Lldb-commits] [PATCH] D56814: [Reproducers] Refactor reproducer info

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks much better. LGTM, just make sure to do something with the 
lower_bound search, as I don't think that's right.




Comment at: include/lldb/Utility/Reproducer.h:58-59
 
+  virtual const char *GetName() const = 0;
+  virtual const char *GetFile() const = 0;
+

return StringRef ?



Comment at: include/lldb/Utility/Reproducer.h:164
   FileSpec m_root;
+  std::vector m_files;
   bool m_loaded;

This might even be a vector of StringRefs, if you're ok with saying that the 
Provider class is responsible for these strings with sufficient lifetime. In 
the current setup it kind of already is because there's no telling who will use 
the returned c strings and when.



Comment at: source/Utility/Reproducer.cpp:218-219
   assert(m_loaded);
-
-  auto it = m_provider_info.find(name);
-  if (it == m_provider_info.end())
-return llvm::None;
-
-  return it->second;
+  auto it = std::lower_bound(m_files.begin(), m_files.end(), file.str());
+  return it != m_files.end();
 }

This doesn't seem right. This will only return false if `file` is 
lexicographically after all files in the `m_files` array. Perhaps you meant 
`return it != m_files.end() && *it == file;` ?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56814



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


[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: include/lldb/Utility/Reproducer.h:91-92
+
+const char *FileInfo::name = "files";
+const char *FileInfo::file = "files.yaml";
+

Are you sure this can be in a header? I would expect this to give you 
multiply-defined symbols errors.


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

https://reviews.llvm.org/D54617



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


[Lldb-commits] [PATCH] D56844: Breakpad: Extract parsing code into a separate file

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, lemo, zturner.
Herald added subscribers: fedor.sergeev, mgorny.

This centralizes parsing of breakpad records, which was previously
spread out over ObjectFileBreakpad and SymbolFileBreakpad.

For each record type X there is a separate breakpad::XRecord class, and
an associated parse function. The classes just store the information in
the breakpad records in a more accessible form. It is up to the users to
determine what to do with that data.

This separation also made it possible to write some targeted tests for
the parsing code, which was previously unaccessible, so I write a couple
of those too.


https://reviews.llvm.org/D56844

Files:
  source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
  source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
  source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
  source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
  source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
  unittests/ObjectFile/Breakpad/CMakeLists.txt
  unittests/ObjectFile/CMakeLists.txt

Index: unittests/ObjectFile/CMakeLists.txt
===
--- unittests/ObjectFile/CMakeLists.txt
+++ unittests/ObjectFile/CMakeLists.txt
@@ -1 +1,2 @@
+add_subdirectory(Breakpad)
 add_subdirectory(ELF)
Index: unittests/ObjectFile/Breakpad/CMakeLists.txt
===
--- /dev/null
+++ unittests/ObjectFile/Breakpad/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(ObjectFileBreakpadTests
+  BreakpadRecordsTest.cpp
+
+  LINK_LIBS
+lldbPluginObjectFileBreakpad
+  )
Index: unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
===
--- /dev/null
+++ unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
@@ -0,0 +1,64 @@
+//===-- BreakpadRecordsTest.cpp -*- C++ -*-===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Plugins/ObjectFile/Breakpad/BreakpadRecords.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace lldb_private::breakpad;
+
+TEST(Record, classify) {
+  EXPECT_EQ(Record::Module, Record::classify("MODULE"));
+  EXPECT_EQ(Record::Info, Record::classify("INFO"));
+  EXPECT_EQ(Record::File, Record::classify("FILE"));
+  EXPECT_EQ(Record::Func, Record::classify("FUNC"));
+  EXPECT_EQ(Record::Public, Record::classify("PUBLIC"));
+  EXPECT_EQ(Record::Stack, Record::classify("STACK"));
+
+  // Any line which does not start with a known keyword will be classified as a
+  // line record, as those are the only ones that start without a keyword.
+  EXPECT_EQ(Record::Line, Record::classify("deadbeef"));
+  EXPECT_EQ(Record::Line, Record::classify("12"));
+  EXPECT_EQ(Record::Line, Record::classify("CODE_ID"));
+}
+
+TEST(ModuleRecord, parse) {
+  EXPECT_EQ(ModuleRecord(llvm::Triple::Linux, llvm::Triple::x86_64,
+ UUID::fromData("@ABCDEFGHIJKLMNO", 16)),
+ModuleRecord::parse(
+"MODULE Linux x86_64 434241404544474648494a4b4c4d4e4f0 a.out"));
+
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE"));
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux"));
+  EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux x86_64"));
+  EXPECT_EQ(llvm::None,
+ModuleRecord::parse("MODULE Linux x86_64 deadbeefbaadf00d"));
+}
+
+TEST(InfoRecord, parse) {
+  EXPECT_EQ(InfoRecord(UUID::fromData("@ABCDEFGHIJKLMNO", 16)),
+InfoRecord::parse("INFO CODE_ID 404142434445464748494a4b4c4d4e4f"));
+  EXPECT_EQ(InfoRecord(UUID()), InfoRecord::parse("INFO CODE_ID 47 a.exe"));
+
+  EXPECT_EQ(llvm::None, InfoRecord::parse("INFO"));
+  EXPECT_EQ(llvm::None, InfoRecord::parse("INFO CODE_ID"));
+}
+
+TEST(PublicRecord, parse) {
+  EXPECT_EQ(PublicRecord(true, 0x47, 0x8, "foo"),
+PublicRecord::parse("PUBLIC m 47 8 foo"));
+  EXPECT_EQ(PublicRecord(false, 0x47, 0x8, "foo"),
+PublicRecord::parse("PUBLIC 47 8 foo"));
+
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47 8"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC m"));
+  EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC"));
+}
Index: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -8,6 +8,7 @@
 //===--===//
 
 #includ

[Lldb-commits] [PATCH] D56590: breakpad: Add FUNC records to the symtab

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 182254.
labath marked 7 inline comments as done.
labath added a comment.

Thanks for the review. I've refactored the code to separate (and centralize) the
breakpad parsing from the part which does presents the information to lldb.

I've done this slightly differently than suggested (the new file is called
BreakpadRecords, as that's how breakpad calls them, and there as separate class
for each record type instead of just a function), but I believe it addresses the
root problem.

The main reason I created classes for everything is because I thought I'd make
the iterator class return those. I may still do that at some point but now it
did not seem worth it now because it makes it harder to report parsing errors,
and it did not make the call sites much cleaner.


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

https://reviews.llvm.org/D56590

Files:
  lit/SymbolFile/Breakpad/Inputs/symtab.syms
  lit/SymbolFile/Breakpad/symtab.test
  source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
  source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
  source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp

Index: unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
===
--- unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
+++ unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
@@ -51,12 +51,27 @@
   EXPECT_EQ(llvm::None, InfoRecord::parse("INFO CODE_ID"));
 }
 
+TEST(FuncRecord, parse) {
+  EXPECT_EQ(FuncRecord(true, 0x47, 0x7, 0x8, "foo"),
+FuncRecord::parse("FUNC m 47 7 8 foo"));
+  EXPECT_EQ(FuncRecord(false, 0x47, 0x7, 0x8, "foo"),
+FuncRecord::parse("FUNC 47 7 8 foo"));
+
+  EXPECT_EQ(llvm::None, FuncRecord::parse("PUBLIC 47 7 8 foo"));
+  EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47 7 8"));
+  EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47 7"));
+  EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47"));
+  EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC m"));
+  EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC"));
+}
+
 TEST(PublicRecord, parse) {
   EXPECT_EQ(PublicRecord(true, 0x47, 0x8, "foo"),
 PublicRecord::parse("PUBLIC m 47 8 foo"));
   EXPECT_EQ(PublicRecord(false, 0x47, 0x8, "foo"),
 PublicRecord::parse("PUBLIC 47 8 foo"));
 
+  EXPECT_EQ(llvm::None, PublicRecord::parse("FUNC 47 8 foo"));
   EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47 8"));
   EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47"));
   EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC m"));
Index: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -27,8 +27,9 @@
 class LineIterator {
 public:
   // begin iterator for sections of given type
-  LineIterator(ObjectFile &obj, ConstString section_type)
-  : m_obj(&obj), m_section_type(section_type), m_next_section_idx(0) {
+  LineIterator(ObjectFile &obj, Record::Kind section_type)
+  : m_obj(&obj), m_section_type(toString(section_type)),
+m_next_section_idx(0) {
 ++*this;
   }
 
@@ -78,7 +79,7 @@
 }
 
 static llvm::iterator_range lines(ObjectFile &obj,
-ConstString section_type) {
+Record::Kind section_type) {
   return llvm::make_range(LineIterator(obj, section_type), LineIterator(obj));
 }
 
@@ -181,35 +182,40 @@
   }
 
   const SectionList &list = *module.GetSectionList();
-  for (llvm::StringRef line : lines(*m_obj_file, ConstString("PUBLIC"))) {
-auto record = PublicRecord::parse(line);
-if (!record) {
-  LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
-  continue;
-}
-addr_t file_address = base + record->getAddress();
-
-SectionSP section_sp = list.FindSectionContainingFileAddress(file_address);
+  llvm::DenseMap symbols;
+  auto add_symbol = [&](addr_t address, llvm::Optional size,
+llvm::StringRef name) {
+address += base;
+SectionSP section_sp = list.FindSectionContainingFileAddress(address);
 if (!section_sp) {
   LLDB_LOG(log,
"Ignoring symbol {0}, whose address ({1}) is outside of the "
"object file. Mismatched symbol file?",
-   record->getName(), file_address);
-  continue;
+   name, address);
+  return;
 }
-
-symtab.AddSymbol(Symbol(
-/*symID*/ 0, Mangled(record->getName(), /*is_mangled*/ false),
-eSymbolTypeCode,
-/*is_global*/ true, /*is_debug*/ false, /*is_trampoline*/ false,
-/*is_artificial*/ false,
-AddressRange(section_sp, file_address - section_sp->GetFileAddress(),
- 0),
-/*size_is_valid*/ 0, /*contain

[Lldb-commits] [PATCH] D56590: breakpad: Add FUNC records to the symtab

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:26
 namespace {
 class LineIterator {
 public:

clayborg wrote:
> Move this functionality into llvm::breakpad::Line?
I haven't moved this part to the new file because (unlike everything else in 
that file) this depends on the ObjectFile class. Theoretically it can be moved 
to ObjectFileBreapad.h (or a new file) if needed, but ideally I'd like to avoid 
anyone else needing to parse the breakpad file contents. If the minidump 
process plugin for instance needed to access some of this information, I would 
have it go through the SymbolFile interface, which can present it in a nicer 
fashion.



Comment at: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:232
+  };
+  for (llvm::StringRef line: lines(*m_obj_file, Token::Func)) {
+// Here we can get either FUNC records (starting with FUNC), or line 
records

clayborg wrote:
> Should the iterator for Token::Func just return "FUNC" objects only? Maybe we 
> add a Token::Line to the Token enumeration and then add an optional second 
> parameter to the iterator? So any code that would want a "FUNC" and its 
> lines, would do:
> 
> ```
> for (llvm::StringRef line: lines(*m_obj_file, Token::Func, Token::Line)) {
> }
> ```
With the new parse functions this should not be necessary as you can just say 
"try to parse this line as a FUNC record", and that will automatically reject 
LINE record as well as any other malformed lines. I think that would make sense 
if I made the iterator perform the parsing internally and return already parsed 
records.

I didn't do that (for now) because returning parse errors from an iterator gets 
weird, and it didn't seem worth the small amount of code it would save.


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

https://reviews.llvm.org/D56590



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


[Lldb-commits] [PATCH] D56595: SymbolFileBreakpad: Add line table support

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath planned changes to this revision.
labath added a comment.

I think I understand what you mean. I'll try to refactor this to create a 
compile unit for each function.


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

https://reviews.llvm.org/D56595



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


[Lldb-commits] [lldb] r351435 - Recommit "Add a verbose mode to "image dump line-table" and use it to write a .debug_line test"

2019-01-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Jan 17 05:11:04 2019
New Revision: 351435

URL: http://llvm.org/viewvc/llvm-project?rev=351435&view=rev
Log:
Recommit "Add a verbose mode to "image dump line-table" and use it to write a 
.debug_line test"

This reapplies r350802, which was reverted because of issues with
parsing posix-style paths on windows hosts (and vice-versa). These have
since been fixed in r351328, and lldb should now recognise the path
style used in a dwarf compile unit correctly.

Added:
lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Added: lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s?rev=351435&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s Thu Jan 17 05:11:04 2019
@@ -0,0 +1,75 @@
+# REQUIRES: lld
+
+# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
+
+
+   .text
+   .globl  _start
+_start:
+# CHECK: Line table for /tmp/a.c
+   .file   1 "/tmp/b.c"
+   .loc1 0 0
+nop
+# CHECK-NEXT: 0x00201000: /tmp/b.c, is_start_of_statement = TRUE{{$}}
+   .loc1 1 0
+nop
+# CHECK-NEXT: 0x00201001: /tmp/b.c:1, is_start_of_statement = TRUE{{$}}
+.loc   1 1 1
+nop
+# CHECK-NEXT: 0x00201002: /tmp/b.c:1:1, is_start_of_statement = 
TRUE{{$}}
+.loc   1 2 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201003: /tmp/b.c:2{{$}}
+.loc   1 2 0 is_stmt 0 basic_block
+nop
+# CHECK-NEXT: 0x00201004: /tmp/b.c:2, is_start_of_basic_block = 
TRUE{{$}}
+.loc   1 2 0 is_stmt 0 prologue_end
+nop
+# CHECK-NEXT: 0x00201005: /tmp/b.c:2, is_prologue_end = TRUE{{$}}
+.loc   1 2 0 is_stmt 0 epilogue_begin
+nop
+# CHECK-NEXT: 0x00201006: /tmp/b.c:2, is_epilogue_begin = TRUE{{$}}
+   .file  2 "/tmp/c.c"
+   .loc   2 1 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
+
+# CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
+
+   .section.debug_str,"MS",@progbits,1
+.Linfo_string1:
+   .asciz  "a.c"
+.Linfo_string2:
+   .asciz  "/tmp"
+   .section.debug_abbrev,"",@progbits
+   .byte   1   # Abbreviation Code
+   .byte   17  # DW_TAG_compile_unit
+   .byte   0   # DW_CHILDREN_no
+   .byte   19  # DW_AT_language
+   .byte   5   # DW_FORM_data2
+   .byte   3   # DW_AT_name
+   .byte   14  # DW_FORM_strp
+   .byte   16  # DW_AT_stmt_list
+   .byte   23  # DW_FORM_sec_offset
+   .byte   27  # DW_AT_comp_dir
+   .byte   14  # DW_FORM_strp
+   .byte   0   # EOM(1)
+   .byte   0   # EOM(2)
+   .byte   0   # EOM(3)
+   .section.debug_info,"",@progbits
+.Lcu_begin0:
+   .long   .Lcu_end0-.Lcu_start0   # Length of Unit
+.Lcu_start0:
+   .short  4   # DWARF version number
+   .long   .debug_abbrev   # Offset Into Abbrev. Section
+   .byte   8   # Address Size (in bytes)
+   .byte   1   # Abbrev [1] 0xb:0x1f 
DW_TAG_compile_unit
+   .short  12  # DW_AT_language
+   .long   .Linfo_string1  # DW_AT_name
+   .long   .Lline_table_start0 # DW_AT_stmt_list
+   .long   .Linfo_string2  # DW_AT_comp_dir
+.Lcu_end0:
+   .section.debug_line,"",@progbits
+.Lline_table_start0:

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=351435&r1=351434&r2=351435&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Jan 17 05:11:04 2019
@@ -1348,7 +1348,7 @@ static void DumpModuleUUID(Stream &strm,
 static uint32_t DumpCompileUnitLineTable(CommandInterpreter &interpreter,
  Stream &strm, Module *module,
  const FileSpec &file_spec,
- bool load_addresses) {
+ lldb::DescriptionLevel desc_level) {
   uint32_t num_matches = 0;
   if (module) {
 SymbolContextList sc_list;
@@ -1367,7 +1

[Lldb-commits] [lldb] r351447 - Recommit "Teach the default symbol vendor to respect module.GetSymbolFileFileSpec()"

2019-01-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Jan 17 07:07:35 2019
New Revision: 351447

URL: http://llvm.org/viewvc/llvm-project?rev=351447&view=rev
Log:
Recommit "Teach the default symbol vendor to respect 
module.GetSymbolFileFileSpec()"

This reapplies commit r351330, which was reverted due to a failing test on
macos. The failure was because the SymbolVendor used on MacOS was stricter than
the default (or ELF) symbol vendor, and rejected the symbol file because it's
UUID did not match the object file.

This version of the patch adds a uuid load command to the test macho file to
make sure the UUIDs match.

Added:
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/basic-macho.yaml
lldb/trunk/lit/SymbolFile/Breakpad/Inputs/symtab-macho.syms
lldb/trunk/lit/SymbolFile/Breakpad/symtab-macho.test
Modified:
lldb/trunk/source/Symbol/SymbolVendor.cpp

Added: lldb/trunk/lit/SymbolFile/Breakpad/Inputs/basic-macho.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/Inputs/basic-macho.yaml?rev=351447&view=auto
==
--- lldb/trunk/lit/SymbolFile/Breakpad/Inputs/basic-macho.yaml (added)
+++ lldb/trunk/lit/SymbolFile/Breakpad/Inputs/basic-macho.yaml Thu Jan 17 
07:07:35 2019
@@ -0,0 +1,50 @@
+--- !mach-o
+FileHeader:  
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x0002
+  ncmds:   9
+  sizeofcmds:  520
+  flags:   0x0085
+  reserved:0x
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __PAGEZERO
+vmaddr:  0
+vmsize:  4294967296
+fileoff: 0
+filesize:0
+maxprot: 0
+initprot:0
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 152
+segname: __TEXT
+vmaddr:  4294967296
+vmsize:  4096
+fileoff: 0
+filesize:4096
+maxprot: 7
+initprot:5
+nsects:  1
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x00010FF0
+size:6
+offset:  0x0FF0
+align:   4
+reloff:  0x
+nreloc:  0
+flags:   0x8400
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - cmd: LC_UUID
+cmdsize: 24
+uuid:B3051760-22B1-7D7B-39F9-240E077D625B
+...

Added: lldb/trunk/lit/SymbolFile/Breakpad/Inputs/symtab-macho.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/Inputs/symtab-macho.syms?rev=351447&view=auto
==
--- lldb/trunk/lit/SymbolFile/Breakpad/Inputs/symtab-macho.syms (added)
+++ lldb/trunk/lit/SymbolFile/Breakpad/Inputs/symtab-macho.syms Thu Jan 17 
07:07:35 2019
@@ -0,0 +1,2 @@
+MODULE mac x86_64 601705B3B1227B7D39F9240E077D625B0 mac.out
+PUBLIC ff0 0 _start

Added: lldb/trunk/lit/SymbolFile/Breakpad/symtab-macho.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/Breakpad/symtab-macho.test?rev=351447&view=auto
==
--- lldb/trunk/lit/SymbolFile/Breakpad/symtab-macho.test (added)
+++ lldb/trunk/lit/SymbolFile/Breakpad/symtab-macho.test Thu Jan 17 07:07:35 
2019
@@ -0,0 +1,21 @@
+# RUN: yaml2obj %S/Inputs/basic-macho.yaml > %T/symtab-macho.out
+# RUN: %lldb %T/symtab-macho.out -o "target symbols add -s symtab-macho.out 
%S/Inputs/symtab-macho.syms" \
+# RUN:   -s %s | FileCheck %s
+
+image dump symtab symtab-macho.out
+# CHECK-LABEL: (lldb) image dump symtab symtab-macho.out
+# CHECK: Symtab, file = {{.*}}symtab-macho.out, num_symbols = 1:
+# CHECK: Index   UserID DSX TypeFile Address/Value Load Address
   Size   Flags  Name
+# CHECK: [0]  0   X Code0x00010ff0 
   0x0006 0x _start
+
+# CHECK-LABEL: (lldb) image lookup -a 0x10ff0 -v
+# CHECK: Address: symtab-macho.out[0x00010ff0] 
(symtab-macho.out.__TEXT.__text + 0)
+# CHECK: Symbol: id = {0x}, range = 
[0x00010ff0-0x00010ff6), name="_start"
+
+# CHECK-LABEL: (lldb) image lookup -n _start -v
+# CHECK: Address: symtab-macho.out[0x00010ff0] 
(symtab-macho.out.__TEXT.__text + 0)
+# CHECK: Symbol: id = {0x}, range = 
[0x00010ff0-0x00010ff6), name="_start"
+
+image lookup -a 0x10ff0 -v
+image lookup -n _start -v
+exit

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=351447&r1=35

[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D56230#1358356 , @zturner wrote:

> I've always disliked this argument and hoped that someday someone would 
> remove it entirely.  My recollection (which may be wrong) is that the only 
> actual use of it is so that if someone types a command, and we later need to 
> print the command back, we will print it with the same quote char.  It almost 
> seems like we could just delete the argument and use a standardized quote 
> char when flattening a command string.


+100

BTW, today I've tried to switch ProcessLauncherWindows to 
`flattenWindowsCommandLine` and this change alone was enough to fix 
`TestQuoting`, which has some tests XFAILed for windows due to quoting 
problems. I haven't sent out a patch yet because that has also broken `platform 
shell dir c:\` for some reason, and I haven't gotten around to investigating 
that.  If you (for any value of you) have some time, I'd encourage you to look 
into that. Otherwise, I'll get to that eventually.


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

https://reviews.llvm.org/D56230



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


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4707
+else
+  // The register info is incorrect, just clear it.
+  m_register_info.Clear();

tatyana-krasnukha wrote:
> clayborg wrote:
> > Is this a GDB server that you can modify? Or is the code fixed? Seems weird 
> > to ask for registers, and get something back that doesn't work, and then 
> > have to fix it up. Why even tell us the registers then?
> None of 3 gdb-servers we use provides us with "dwarf" field (including 
> Ashling gdb-server and OpenOCD). It's not their business to be aware of 
> DWARF. 
> 
> I'm going to hardcode necessary registers in SysVABI_arc, then 
> AugmentRegisterInfoViaABI will solve the problem.
BTW, I was looking at how we generate unwind plans last week (I need that for 
breakpad symbols), and was surprised to see that we need a running target to 
generate any kind of an unwind plan. After some examination, it turned out that 
all we use from that target is the list of registers. This is suboptimal for 
two reasons:
- you cannot test even the most basic unwind functionality (like parsing 
eh_frame) without having a live process (or a faithful mock) somewhere
- perhaps more importantly: the unwind info that does get parsed is cached in 
the object file, which can be shared between multiple targets. So if another 
target tries to use that info, and this target's stub sends us different 
register numbers than the previous one, then it's unwinding will be all wrong.

Anyway, my point here is that I would be supportive of transitioning to a 
different source of dwarf register numbers than the remote stub.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-01-17 Thread Hui Huang via Phabricator via lldb-commits
Hui added a comment.

In D56230#1361634 , @labath wrote:

> In D56230#1358356 , @zturner wrote:
>
> > I've always disliked this argument and hoped that someday someone would 
> > remove it entirely.  My recollection (which may be wrong) is that the only 
> > actual use of it is so that if someone types a command, and we later need 
> > to print the command back, we will print it with the same quote char.  It 
> > almost seems like we could just delete the argument and use a standardized 
> > quote char when flattening a command string.
>
>
> +100
>
> BTW, today I've tried to switch ProcessLauncherWindows to 
> `flattenWindowsCommandLine` and this change alone was enough to fix 
> `TestQuoting`, which has some tests XFAILed for windows due to quoting 
> problems. I haven't sent out a patch yet because that has also broken 
> `platform shell dir c:\` for some reason, and I haven't gotten around to 
> investigating that.  If you (for any value of you) have some time, I'd 
> encourage you to look into that. Otherwise, I'll get to that eventually.


Yes. I myself added a patch to test quoting also launch gdbserver by 
lldb-server.exe. Ran well so far. Also lldb/unittests/Utility tests.

Haven't tried other regression tests yet.

+#if defined(_WIN32)
+TEST(ArgsTest, GetFlattenWindowsCommandString) {
+  Args args;
+  args.AppendArgument("D:\\launcher.exe");
+  args.AppendArgument("--log=abc def");
+
+  std::string stdstr;
+  ASSERT_TRUE(args.GetFlattenWindowsCommandString(stdstr));
+  EXPECT_EQ(stdstr, "\"D:\\launcher.exe\" \"--log=abc def\"");
+}
+#endif


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

https://reviews.llvm.org/D56230



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


[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D56230#1361650 , @Hui wrote:

> +#if defined(_WIN32)
>  +TEST(ArgsTest, GetFlattenWindowsCommandString) {
>  +  Args args;
>  +  args.AppendArgument("D:\\launcher.exe");
>  +  args.AppendArgument("--log=abc def");
>  +
>  +  std::string stdstr;
>  +  ASSERT_TRUE(args.GetFlattenWindowsCommandString(stdstr));
>  +  EXPECT_EQ(stdstr, "\"D:\\launcher.exe\" \"--log=abc def\"");
>  +}
>  +#endif


BTW, if this is going to end up `#ifdef`ed (I know you need to do that because 
`flattenWindowsCommandLine` is `#ifdef _WIN32`), then I believe it should go 
somewhere under `Host/windows`. It's not used outside of windows code anyway...

We  could put it in `Args.h`, but then we'd need to un-ifdef the llvm function 
(which I believe we could do, but we'd need to get that ok'd by the llvm folks).


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

https://reviews.llvm.org/D56230



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


[Lldb-commits] [PATCH] D56618: [SymbolFile] Remove the SymbolContext parameter from FindTypes

2019-01-17 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This makes sense to me.


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

https://reviews.llvm.org/D56618



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


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-17 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha marked an inline comment as not done.
tatyana-krasnukha added inline comments.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4707
+else
+  // The register info is incorrect, just clear it.
+  m_register_info.Clear();

labath wrote:
> tatyana-krasnukha wrote:
> > clayborg wrote:
> > > Is this a GDB server that you can modify? Or is the code fixed? Seems 
> > > weird to ask for registers, and get something back that doesn't work, and 
> > > then have to fix it up. Why even tell us the registers then?
> > None of 3 gdb-servers we use provides us with "dwarf" field (including 
> > Ashling gdb-server and OpenOCD). It's not their business to be aware of 
> > DWARF. 
> > 
> > I'm going to hardcode necessary registers in SysVABI_arc, then 
> > AugmentRegisterInfoViaABI will solve the problem.
> BTW, I was looking at how we generate unwind plans last week (I need that for 
> breakpad symbols), and was surprised to see that we need a running target to 
> generate any kind of an unwind plan. After some examination, it turned out 
> that all we use from that target is the list of registers. This is suboptimal 
> for two reasons:
> - you cannot test even the most basic unwind functionality (like parsing 
> eh_frame) without having a live process (or a faithful mock) somewhere
> - perhaps more importantly: the unwind info that does get parsed is cached in 
> the object file, which can be shared between multiple targets. So if another 
> target tries to use that info, and this target's stub sends us different 
> register numbers than the previous one, then it's unwinding will be all wrong.
> 
> Anyway, my point here is that I would be supportive of transitioning to a 
> different source of dwarf register numbers than the remote stub.
I would move these lists of registers from an ABI to according Architecture 
plugin, as well as trap opcodes from the Platform (as Greg has mentioned 
above). But for now, I'm trying to introduce ARC target with the minimally 
invasive way for common code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-01-17 Thread Hui Huang via Phabricator via lldb-commits
Hui added a comment.

It could be the llvm::sys::flattenWindowsCommandLine issue to flatten the 
command “dir c:\" for Windows Command Terminal.
However it is not an issue for PS or MingGW.

It is observed the flattened one is

  "\"C:\\WINDOWS\\system32\\cmd.exe\" /C \" dir c:\" "

which will be interpreted as the following that is not accepted by CMD.exe. 
However it is accepted by PS and MingGW.

  "C:\\WINDOWS\\system32\\cmd.exe" /C " dir c:\\"


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

https://reviews.llvm.org/D56230



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


[Lldb-commits] [PATCH] D55724: [ARC] Add SystemV ABI

2019-01-17 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 182323.
tatyana-krasnukha added a comment.

Added a list of registers with correct dwarf numbers


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55724

Files:
  source/API/SystemInitializerFull.cpp
  source/Plugins/ABI/CMakeLists.txt
  source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
  source/Plugins/ABI/SysV-arc/ABISysV_arc.h
  source/Plugins/ABI/SysV-arc/CMakeLists.txt

Index: source/Plugins/ABI/SysV-arc/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-arc/CMakeLists.txt
+++ source/Plugins/ABI/SysV-arc/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_lldb_library(lldbPluginABISysV_arc PLUGIN
+  ABISysV_arc.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+  )
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.h
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.h
+++ source/Plugins/ABI/SysV-arc/ABISysV_arc.h
@@ -0,0 +1,103 @@
+//===-- ABISysV_arc.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_arc_h_
+#define liblldb_ABISysV_arc_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_arc : public lldb_private::ABI {
+public:
+  ~ABISysV_arc() override = default;
+
+  size_t GetRedZoneSize() const override;
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   llvm::Type &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// Stack call frame address must be 4 byte aligned.
+return (cfa & 0x3ull) == 0;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Code addresse must be 2 byte aligned.
+return (pc & 1ull) == 0;
+  }
+
+  const lldb_private::RegisterInfo *
+  GetRegisterInfoArray(uint32_t &count) override;
+
+  //--
+  // Static Functions
+  //--
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp,
+const lldb_private::ArchSpec &arch);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //--
+  // PluginInterface protocol
+  //--
+
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+protected:
+  lldb::ValueObjectSP
+  GetReturnValueObjectSimple(lldb_private::Thread &thread,
+ lldb_private::CompilerType &ast_type) const;
+
+private:
+  using lldb_private::ABI::ABI; // Call CreateInstance instead.
+};
+
+#endif // liblldb_ABISysV_arc_h_
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
+++ source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
@@ -0,0 +1,604 @@
+//===-- ABISysV_arc.cpp 

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-17 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 182325.
tatyana-krasnukha added a comment.

Removed registers adjustment, dwarf numbers are corrected by 
AugmentRegisterInfoViaABI now.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718

Files:
  include/lldb/Utility/ArchSpec.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Target.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -221,7 +221,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -458,7 +459,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2061,6 +2061,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1529,7 +1529,7 @@
   os_changed, os_ver_changed, env_changed);
 
 if (!arch_changed && !vendor_changed && !os_changed && !env_changed)
-  replace_local_arch = false;
+  replace_local_arch = arch_spec.GetFlags() != m_arch.GetSpec().GetFlags();
   }
 }
   }
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1869,6 +1869,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4525,6 +4525,36 @@
 
 } // namespace
 
+namespace arc {
+// Adjust architecture according to ARC build configuration registers.
+bool ConfigureArchitecture(ProcessGDBRemote &process,
+   const GDBRemoteDynamicRegisterInfo &dyn_reg_info,
+   ArchSpec& arch_to_use) {
+  // Obtain register file size from the RF_BUILD register.
+  static ConstString reg_name("rf_build");
+  const bool case_sensitive = false;
+  auto rf_build_info = dyn_reg_info.GetRegisterInfo(reg_name, case_sensitive);
+  if(nullptr == rf_build_info)
+return false;
+
+  const auto tid = LLDB_INVALID_THREAD_ID; // BCRs are not context-dependent.
+  // Cannot use GDBRemoteRegisterContext here, it is not created yet.
+  DataBufferSP buffer_sp = process.GetGDBRemote().ReadRegister(tid,
+  rf_build_info->kinds[eRegisterKindProcessPlugin]);
+  if (!buffer_sp || buffer_sp->GetByteSize() < rf_build_info->byte_size)
+return false;
+
+  if (0 != (buffer_sp->GetData()[1] & ArchSpec::eARC_rf16)) {
+// The target is configured to use reduced register file.
+arch_to_use.SetFlags(ArchSpec::eARC_rf16);
+// ABI uses this information to determine how many registers it may
+// use to pass arguments in a function.
+process.GetTarget().SetArchitecture(arch_to_use);
+  }
+  return true;
+}
+} // namespace arc
+
 // query the target of gdb-remote for extende

[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider

2019-01-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: include/lldb/Utility/Reproducer.h:91-92
+
+const char *FileInfo::name = "files";
+const char *FileInfo::file = "files.yaml";
+

labath wrote:
> Are you sure this can be in a header? I would expect this to give you 
> multiply-defined symbols errors.
You are correct, should be in the implementation. 


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

https://reviews.llvm.org/D54617



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


[Lldb-commits] [PATCH] D55724: [ARC] Add SystemV ABI

2019-01-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp:43
+
+namespace dwarf {
+enum regnums {

add "namespace {" around all of this



Comment at: source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp:52
+};
+} // namespace dwarf
+

Don't end this namespace here? It starts up again on line 70. I would move the 
#define statements above the dwarf namespace


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55724



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


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2019-01-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4707
   if (comm.GetQXferLibrariesSVR4ReadSupported()) {
 list.clear();
 

My two cents: I fully support a stub being able to provide the register info 
for DWARF, but it doesn't need to if there are well defined ABI plug-ins or 
architecture plug-ins that can assist. Why? It allows people to use a different 
lldb-server and test out new compiler changes without having to modify LLDB 
itself. There are kernel debugging tools that provide GDB server connections, 
and it is great to be able to let them iterate on their compilers and debugger 
connections without having to change LLDB. So yes, I am all for not requiring a 
stub to provide them as long as we can put the functionality in a good place.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D56844: Breakpad: Extract parsing code into a separate file

2019-01-17 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Are we missing parsing of FUNC and line entry lines in this patch?


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

https://reviews.llvm.org/D56844



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


[Lldb-commits] [PATCH] D56844: Breakpad: Extract parsing code into a separate file

2019-01-17 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.

Never mind, just read the update to your other patch. Would be nice to identify 
line records in toToken, but that will probably cost more CPU cycles that it is 
worth, so I think this is a good start.


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

https://reviews.llvm.org/D56844



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


[Lldb-commits] [PATCH] D56590: breakpad: Add FUNC records to the symtab

2019-01-17 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.

Much cleaner! Thanks


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

https://reviews.llvm.org/D56590



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


[Lldb-commits] [PATCH] D55724: [ARC] Add SystemV ABI

2019-01-17 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 182352.
tatyana-krasnukha added a comment.

Addressed the comment


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55724

Files:
  source/API/SystemInitializerFull.cpp
  source/Plugins/ABI/CMakeLists.txt
  source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
  source/Plugins/ABI/SysV-arc/ABISysV_arc.h
  source/Plugins/ABI/SysV-arc/CMakeLists.txt

Index: source/Plugins/ABI/SysV-arc/CMakeLists.txt
===
--- source/Plugins/ABI/SysV-arc/CMakeLists.txt
+++ source/Plugins/ABI/SysV-arc/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_lldb_library(lldbPluginABISysV_arc PLUGIN
+  ABISysV_arc.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+  )
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.h
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.h
+++ source/Plugins/ABI/SysV-arc/ABISysV_arc.h
@@ -0,0 +1,103 @@
+//===-- ABISysV_arc.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_arc_h_
+#define liblldb_ABISysV_arc_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_arc : public lldb_private::ABI {
+public:
+  ~ABISysV_arc() override = default;
+
+  size_t GetRedZoneSize() const override;
+
+  bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread &thread,
+ lldb_private::ValueList &values) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP &frame_sp,
+   lldb::ValueObjectSP &new_value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   lldb_private::CompilerType &type) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread,
+   llvm::Type &type) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// Stack call frame address must be 4 byte aligned.
+return (cfa & 0x3ull) == 0;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Code addresse must be 2 byte aligned.
+return (pc & 1ull) == 0;
+  }
+
+  const lldb_private::RegisterInfo *
+  GetRegisterInfoArray(uint32_t &count) override;
+
+  //--
+  // Static Functions
+  //--
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp,
+const lldb_private::ArchSpec &arch);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //--
+  // PluginInterface protocol
+  //--
+
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+protected:
+  lldb::ValueObjectSP
+  GetReturnValueObjectSimple(lldb_private::Thread &thread,
+ lldb_private::CompilerType &ast_type) const;
+
+private:
+  using lldb_private::ABI::ABI; // Call CreateInstance instead.
+};
+
+#endif // liblldb_ABISysV_arc_h_
Index: source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
===
--- source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
+++ source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
@@ -0,0 +1,605 @@
+//===-- ABISysV_arc.cpp ---*- C++ -

[Lldb-commits] [lldb] r351486 - [lit] Make sure tests are actually skipped on darwin and windows.

2019-01-17 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Jan 17 13:57:33 2019
New Revision: 351486

URL: http://llvm.org/viewvc/llvm-project?rev=351486&view=rev
Log:
[lit] Make sure tests are actually skipped on darwin and windows.

Modified:
lldb/trunk/lit/Expr/TestIRMemoryMap.test
lldb/trunk/lit/Quit/TestQuitExitCode-30.test
lldb/trunk/lit/Quit/TestQuitExitCode0.test
lldb/trunk/lit/Quit/TestQuitExitCode30.test
lldb/trunk/lit/Quit/TestQuitExitCodeHex0.test
lldb/trunk/lit/Quit/TestQuitExitCodeHexA.test
lldb/trunk/lit/Quit/TestQuitExitCodeImplicit0.test
lldb/trunk/lit/Quit/TestQuitExitCodeNonInt.test
lldb/trunk/lit/Quit/TestQuitExitCodeTooManyArgs.test
lldb/trunk/lit/tools/lldb-mi/target/target-select-so-path.test

Modified: lldb/trunk/lit/Expr/TestIRMemoryMap.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestIRMemoryMap.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Expr/TestIRMemoryMap.test (original)
+++ lldb/trunk/lit/Expr/TestIRMemoryMap.test Thu Jan 17 13:57:33 2019
@@ -1,4 +1,4 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 
 # RUN: %clangxx %p/Inputs/call-function.cpp -g -o %t
 

Modified: lldb/trunk/lit/Quit/TestQuitExitCode-30.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCode-30.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCode-30.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCode-30.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %python %S/expect_exit_code.py 226 %lldb -b -s %s
 q -30

Modified: lldb/trunk/lit/Quit/TestQuitExitCode0.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCode0.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCode0.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCode0.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %lldb -b -s %s
 q 0

Modified: lldb/trunk/lit/Quit/TestQuitExitCode30.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCode30.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCode30.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCode30.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %python %S/expect_exit_code.py 30  %lldb -b -s %s
 q 30

Modified: lldb/trunk/lit/Quit/TestQuitExitCodeHex0.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCodeHex0.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCodeHex0.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCodeHex0.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %lldb -b -s %s
 q 0x0

Modified: lldb/trunk/lit/Quit/TestQuitExitCodeHexA.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCodeHexA.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCodeHexA.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCodeHexA.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %python %S/expect_exit_code.py 10 %lldb -b -s %s
 q 0xA

Modified: lldb/trunk/lit/Quit/TestQuitExitCodeImplicit0.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCodeImplicit0.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCodeImplicit0.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCodeImplicit0.test Thu Jan 17 13:57:33 2019
@@ -1,3 +1,3 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %lldb -b -s %s
 q

Modified: lldb/trunk/lit/Quit/TestQuitExitCodeNonInt.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/TestQuitExitCodeNonInt.test?rev=351486&r1=351485&r2=351486&view=diff
==
--- lldb/trunk/lit/Quit/TestQuitExitCodeNonInt.test (original)
+++ lldb/trunk/lit/Quit/TestQuitExitCodeNonInt.test Thu Jan 17 13:57:33 2019
@@ -1,4 +1,4 @@
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
 # RUN: %lldb -b -s %s 2>&1 | FileCheck %s
 q str
 // CHECK: Couldn't parse 'str'

Modified: lldb/trunk/lit/Quit/TestQuitExitCodeTooManyArgs.test
URL: 
http://llvm.org/viewv

[Lldb-commits] [lldb] r351489 - [CMake] Fix lldb-test-depends target

2019-01-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jan 17 14:25:20 2019
New Revision: 351489

URL: http://llvm.org/viewvc/llvm-project?rev=351489&view=rev
Log:
[CMake] Fix lldb-test-depends target

The lldb-test-depends target was using the old CMake variable name
LLDB_TEST_DEPENDS instead of LLDB_TEST_DEPS. This patch moves the target
definition and makes it use the correct one.

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=351489&r1=351488&r2=351489&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Jan 17 14:25:20 2019
@@ -120,6 +120,8 @@ if(LLDB_INCLUDE_TESTS)
 list(APPEND LLDB_TEST_DEPS dsymutil)
   endif()
 
+  add_custom_target(lldb-test-depends DEPENDS ${LLDB_TEST_DEPS})
+
   add_subdirectory(test)
   add_subdirectory(unittests)
   add_subdirectory(lit)

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=351489&r1=351488&r2=351489&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu Jan 17 14:25:20 2019
@@ -133,7 +133,6 @@ endif ()
 # Run the lit-style tests and the unittests as part of the check-lldb target.
 add_dependencies(check-lldb check-lldb-lit)
 
-add_custom_target(lldb-test-depends DEPENDS ${LLDB_TEST_DEPENDS})
 # This will add LLDB's test dependencies to the dependencies for check-all and
 # include them in the test-depends target.
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})


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


[Lldb-commits] [lldb] r351490 - Don't run TestBreakpointThumbCodesection.py on darwin systems;

2019-01-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Jan 17 14:26:25 2019
New Revision: 351490

URL: http://llvm.org/viewvc/llvm-project?rev=351490&view=rev
Log:
Don't run TestBreakpointThumbCodesection.py on darwin systems;
we don't use a thumb code section.

Don't run Test128BitsInteger.py on armv7k; it's not a supported
type on that target.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py?rev=351490&r1=351489&r2=351490&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
 Thu Jan 17 14:26:25 2019
@@ -18,6 +18,7 @@ class TestBreakpointThumbCodesection(Tes
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIf(archs=no_match(["arm"]))
+@skipIfDarwinEmbedded   # codegen on darwin always defaults to thumb for 
armv7/armv7k targets
 def test_breakpoint(self):
 self.build()
 exe = self.getBuildArtifact("a.out")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py?rev=351490&r1=351489&r2=351490&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 Thu Jan 17 14:26:25 2019
@@ -1,4 +1,6 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals())
+lldbinline.MakeInlineTest(__file__, globals(),
+decorators.skipIf(archs=["armv7k"]))
+


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


[Lldb-commits] [lldb] r351496 - [CMake] Prevent lldbDebugserverCommon from building if you disable debugserver builds

2019-01-17 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jan 17 15:14:04 2019
New Revision: 351496

URL: http://llvm.org/viewvc/llvm-project?rev=351496&view=rev
Log:
[CMake] Prevent lldbDebugserverCommon from building if you disable debugserver 
builds

Summary:
The flags `LLDB_USE_SYSTEM_DEBUGSERVER` and `LLDB_NO_DEBUGSERVER` were
introduced to the debugserver build. If one of these two flags are set, then we
do not build and sign debugserver. However I noticed that we were still building
the lldbDebugserverCommon and lldbDebugserverCommon_NonUI libraries regardless
of whether or not these flags were set. I don't believe we should be building
these libraries unless we are building and signing debugserver.

Reviewers: sgraenitz, davide, JDevlieghere, beanz, vsk, aprantl, labath

Subscribers: mgorny, jfb, lldb-commits

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

Modified:
lldb/trunk/tools/debugserver/source/CMakeLists.txt
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=351496&r1=351495&r2=351496&view=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Thu Jan 17 15:14:04 2019
@@ -30,69 +30,6 @@ check_library_exists(compression compres
 
 add_subdirectory(MacOSX)
 
-set(generated_mach_interfaces
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
-  )
-add_custom_command(OUTPUT ${generated_mach_interfaces}
-  COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
-  )
-
-set(DEBUGSERVER_VERS_GENERATED_FILE 
${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
-set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES 
GENERATED 1)
-
-add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver
-  > ${DEBUGSERVER_VERS_GENERATED_FILE}
-  DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
-  )
-
-set(lldbDebugserverCommonSources
-  DNBArch.cpp
-  DNBBreakpoint.cpp
-  DNB.cpp
-  DNBDataRef.cpp
-  DNBError.cpp
-  DNBLog.cpp
-  DNBRegisterInfo.cpp
-  DNBThreadResumeActions.cpp
-  JSON.cpp
-  StdStringExtractor.cpp
-  # JSON reader depends on the following LLDB-common files
-  ${LLDB_SOURCE_DIR}/source/Host/common/StringConvert.cpp
-  ${LLDB_SOURCE_DIR}/source/Host/common/SocketAddress.cpp
-  # end JSON reader dependencies
-  libdebugserver.cpp
-  PseudoTerminal.cpp
-  PThreadEvent.cpp
-  PThreadMutex.cpp
-  RNBContext.cpp
-  RNBRemote.cpp
-  RNBServices.cpp
-  RNBSocket.cpp
-  SysSignal.cpp
-  TTYState.cpp
-
-  MacOSX/CFBundle.cpp
-  MacOSX/CFString.cpp
-  MacOSX/Genealogy.cpp
-  MacOSX/MachException.cpp
-  MacOSX/MachProcess.mm
-  MacOSX/MachTask.mm
-  MacOSX/MachThread.cpp
-  MacOSX/MachThreadList.cpp
-  MacOSX/MachVMMemory.cpp
-  MacOSX/MachVMRegion.cpp
-  MacOSX/OsLogger.cpp
-  ${generated_mach_interfaces}
-  ${DEBUGSERVER_VERS_GENERATED_FILE})
-
-add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
-
 # LLDB-specific identity, currently used for code signing debugserver.
 set(LLDB_CODESIGN_IDENTITY "" CACHE STRING
 "Override code sign identity for debugserver and for use in tests; falls 
back to LLVM_CODESIGNING_IDENTITY if set or lldb_codesign otherwise (Darwin 
only)")
@@ -241,6 +178,69 @@ if(LLDB_USE_ENTITLEMENTS)
 endif()
 
 if(build_and_sign_debugserver)
+  set(generated_mach_interfaces
+${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h
+${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c
+${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
+)
+  add_custom_command(OUTPUT ${generated_mach_interfaces}
+COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
+DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
+)
+
+  set(DEBUGSERVER_VERS_GENERATED_FILE 
${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
+  set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES 
GENERATED 1)
+
+  add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
+COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver
+> ${DEBUGSERVER_VERS_GENERATED_FILE}
+DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
+)
+
+  set(lldbDebugserverCommonSources
+DNBArch.cpp
+DNBBreakpoint.cpp
+DNB.cpp
+DNBDataRef.cpp
+DNBError.cpp
+DNBLog.cpp
+DNBRegisterInfo.cpp
+DNBThreadResumeActions.cpp
+JSON.cpp
+StdStringExtractor.cpp
+# JSON reader depends on the fol

[Lldb-commits] [PATCH] D56763: [CMake] Prevent lldbDebugserverCommon from building if you disable debugserver builds

2019-01-17 Thread Alex Langford via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB351496: [CMake] Prevent lldbDebugserverCommon from 
building if you disable debugserver… (authored by xiaobai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56763?vs=182131&id=182407#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D56763

Files:
  tools/debugserver/source/CMakeLists.txt
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -78,6 +78,6 @@
 add_subdirectory(UnwindAssembly)
 add_subdirectory(Utility)
 
-if(LLDB_CAN_USE_DEBUGSERVER)
+if(NOT SKIP_TEST_DEBUGSERVER)
   add_subdirectory(debugserver)
 endif()
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -30,69 +30,6 @@
 
 add_subdirectory(MacOSX)
 
-set(generated_mach_interfaces
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c
-  ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
-  )
-add_custom_command(OUTPUT ${generated_mach_interfaces}
-  COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
-  )
-
-set(DEBUGSERVER_VERS_GENERATED_FILE ${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
-set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
-
-add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver
-  > ${DEBUGSERVER_VERS_GENERATED_FILE}
-  DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-  ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
-  )
-
-set(lldbDebugserverCommonSources
-  DNBArch.cpp
-  DNBBreakpoint.cpp
-  DNB.cpp
-  DNBDataRef.cpp
-  DNBError.cpp
-  DNBLog.cpp
-  DNBRegisterInfo.cpp
-  DNBThreadResumeActions.cpp
-  JSON.cpp
-  StdStringExtractor.cpp
-  # JSON reader depends on the following LLDB-common files
-  ${LLDB_SOURCE_DIR}/source/Host/common/StringConvert.cpp
-  ${LLDB_SOURCE_DIR}/source/Host/common/SocketAddress.cpp
-  # end JSON reader dependencies
-  libdebugserver.cpp
-  PseudoTerminal.cpp
-  PThreadEvent.cpp
-  PThreadMutex.cpp
-  RNBContext.cpp
-  RNBRemote.cpp
-  RNBServices.cpp
-  RNBSocket.cpp
-  SysSignal.cpp
-  TTYState.cpp
-
-  MacOSX/CFBundle.cpp
-  MacOSX/CFString.cpp
-  MacOSX/Genealogy.cpp
-  MacOSX/MachException.cpp
-  MacOSX/MachProcess.mm
-  MacOSX/MachTask.mm
-  MacOSX/MachThread.cpp
-  MacOSX/MachThreadList.cpp
-  MacOSX/MachVMMemory.cpp
-  MacOSX/MachVMRegion.cpp
-  MacOSX/OsLogger.cpp
-  ${generated_mach_interfaces}
-  ${DEBUGSERVER_VERS_GENERATED_FILE})
-
-add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
-
 # LLDB-specific identity, currently used for code signing debugserver.
 set(LLDB_CODESIGN_IDENTITY "" CACHE STRING
 "Override code sign identity for debugserver and for use in tests; falls back to LLVM_CODESIGNING_IDENTITY if set or lldb_codesign otherwise (Darwin only)")
@@ -241,6 +178,69 @@
 endif()
 
 if(build_and_sign_debugserver)
+  set(generated_mach_interfaces
+${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h
+${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c
+${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
+)
+  add_custom_command(OUTPUT ${generated_mach_interfaces}
+COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
+DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
+)
+
+  set(DEBUGSERVER_VERS_GENERATED_FILE ${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
+  set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
+
+  add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
+COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver
+> ${DEBUGSERVER_VERS_GENERATED_FILE}
+DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
+)
+
+  set(lldbDebugserverCommonSources
+DNBArch.cpp
+DNBBreakpoint.cpp
+DNB.cpp
+DNBDataRef.cpp
+DNBError.cpp
+DNBLog.cpp
+DNBRegisterInfo.cpp
+DNBThreadResumeActions.cpp
+JSON.cpp
+StdStringExtractor.cpp
+# JSON reader depends on the following LLDB-common files
+${LLDB_SOURCE_DIR}/source/Host/common/StringConvert.cpp
+${LLDB_SOURCE_DIR}/source/Host/common/SocketAddress.cpp
+# end JSON reader dependencies
+libdebugserver.cpp
+PseudoTerminal.cpp
+PThreadEvent.cpp
+PThreadMutex.cpp
+RNBContext.cpp
+RNBRemote.cpp
+ 

[Lldb-commits] [lldb] r351497 - [lit] Fix lldbtest format

2019-01-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jan 17 15:30:06 2019
New Revision: 351497

URL: http://llvm.org/viewvc/llvm-project?rev=351497&view=rev
Log:
[lit] Fix lldbtest format

The lldbtest format was incorrectly detecting XFAIL as FAIL because it
was looking for the `FAIL:` substring in the dotest output.

Modified:
lldb/trunk/lit/Suite/lldbtest.py

Modified: lldb/trunk/lit/Suite/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=351497&r1=351496&r2=351497&view=diff
==
--- lldb/trunk/lit/Suite/lldbtest.py (original)
+++ lldb/trunk/lit/Suite/lldbtest.py Thu Jan 17 15:30:06 2019
@@ -94,8 +94,11 @@ class LLDBTest(TestFormat):
 litConfig.maxIndividualTestTime))
 
 if exitCode:
-if 'FAIL:' in out or 'FAIL:' in err:
-return lit.Test.FAIL, out + err
+# Match FAIL but not XFAIL.
+for line in out.splitlines() + err.splitlines():
+if line.startswith('FAIL:'):
+return lit.Test.FAIL, out + err
+
 if 'XPASS:' in out or 'XPASS:' in err:
 return lit.Test.XPASS, out + err
 


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


[Lldb-commits] [lldb] r351498 - [CMake] Only test debugserver if platform can use debugserver

2019-01-17 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jan 17 16:05:25 2019
New Revision: 351498

URL: http://llvm.org/viewvc/llvm-project?rev=351498&view=rev
Log:
[CMake] Only test debugserver if platform can use debugserver

In commit svn r351496 I changed this condition from
`if(LLDB_CAN_USE_DEBUGSERVER)` to `if(NOT SKIP_TEST_DEBUGSERVER)`.
This causes debugserver tests to run on windows, which shouldn't happen.
SKIP_TEST_DEBUGSERVER is set either by the user (it shouldn't be set on
windows builds) or in the debugserver CMake logic (which doesn't get
included when building on windows). Therefore, I changed the condition
to be `if(LLDB_CAN_USE_DEBUGSERVER AND NOT SKIP_TEST_DEBUGSERVER)`.

Modified:
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/unittests/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=351498&r1=351497&r2=351498&view=diff
==
--- lldb/trunk/unittests/CMakeLists.txt (original)
+++ lldb/trunk/unittests/CMakeLists.txt Thu Jan 17 16:05:25 2019
@@ -78,6 +78,6 @@ add_subdirectory(tools)
 add_subdirectory(UnwindAssembly)
 add_subdirectory(Utility)
 
-if(NOT SKIP_TEST_DEBUGSERVER)
+if(LLDB_CAN_USE_DEBUGSERVER AND NOT SKIP_TEST_DEBUGSERVER)
   add_subdirectory(debugserver)
 endif()


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


[Lldb-commits] [lldb] r351501 - [Reproducers] Refactor reproducer info

2019-01-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jan 17 17:04:59 2019
New Revision: 351501

URL: http://llvm.org/viewvc/llvm-project?rev=351501&view=rev
Log:
[Reproducers] Refactor reproducer info

In the original reproducer design, I expected providers to be more
dynamic than they turned out. For example, we don't have any instances
where one provider has multiple files. Additionally, I expected there to
be less locality between capture and replay, with the provider being
defined in one place and the replay code to live in another. Both
contributed to the design of the provider info.

This patch refactors the reproducer info to be something static. This
means less magic strings and better type checking. The new design still
allows for the capture and replay code to live in different places as
long as they both have access to the new statically defined info class.

I didn't completely get rid of the index, because it is useful for (1)
sanity checking and (2) knowing what files are used by the reproducer.

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

Modified:
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Utility/Reproducer.cpp

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=351501&r1=351500&r2=351501&view=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Thu Jan 17 17:04:59 2019
@@ -31,24 +31,14 @@ enum class ReproducerMode {
   Off,
 };
 
-/// Abstraction for information associated with a provider. This information
-/// is serialized into an index which is used by the loader.
-struct ProviderInfo {
-  std::string name;
-  std::vector files;
-};
-
 /// The provider defines an interface for generating files needed for
-/// reproducing. The provider must populate its ProviderInfo to communicate
-/// its name and files to the index, before registering with the generator,
-/// i.e. in the constructor.
+/// reproducing.
 ///
 /// Different components will implement different providers.
 class ProviderBase {
 public:
   virtual ~ProviderBase() = default;
 
-  const ProviderInfo &GetInfo() const { return m_info; }
   const FileSpec &GetRoot() const { return m_root; }
 
   /// The Keep method is called when it is decided that we need to keep the
@@ -65,11 +55,12 @@ public:
   // Returns the class ID for the dynamic type of this Provider instance.
   virtual const void *DynamicClassID() const = 0;
 
+  virtual llvm::StringRef GetName() const = 0;
+  virtual llvm::StringRef GetFile() const = 0;
+
 protected:
   ProviderBase(const FileSpec &root) : m_root(root) {}
 
-  /// Every provider keeps track of its own files.
-  ProviderInfo m_info;
 private:
   /// Every provider knows where to dump its potential files.
   FileSpec m_root;
@@ -84,6 +75,9 @@ public:
 
   const void *DynamicClassID() const override { return &ThisProviderT::ID; }
 
+  llvm::StringRef GetName() const override { return ThisProviderT::info::name; 
}
+  llvm::StringRef GetFile() const override { return ThisProviderT::info::file; 
}
+
 protected:
   using ProviderBase::ProviderBase; // Inherit constructor.
 };
@@ -152,14 +146,22 @@ class Loader final {
 public:
   Loader(const FileSpec &root);
 
-  llvm::Optional GetProviderInfo(llvm::StringRef name);
+  template  FileSpec GetFile() {
+if (!HasFile(T::file))
+  return {};
+
+return GetRoot().CopyByAppendingPathComponent(T::file);
+  }
+
   llvm::Error LoadIndex();
 
   const FileSpec &GetRoot() const { return m_root; }
 
 private:
-  llvm::StringMap m_provider_info;
+  bool HasFile(llvm::StringRef file);
+
   FileSpec m_root;
+  std::vector m_files;
   bool m_loaded;
 };
 
@@ -198,18 +200,4 @@ private:
 } // namespace repro
 } // namespace lldb_private
 
-LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(lldb_private::repro::ProviderInfo)
-
-namespace llvm {
-namespace yaml {
-
-template <> struct MappingTraits {
-  static void mapping(IO &io, lldb_private::repro::ProviderInfo &info) {
-io.mapRequired("name", info.name);
-io.mapOptional("files", info.files);
-  }
-};
-} // namespace yaml
-} // namespace llvm
-
 #endif // LLDB_UTILITY_REPRODUCER_H

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=351501&r1=351500&r2=351501&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jan 
17 17:04:59 2019
@@ -157,17 +157,24 @@ static const ProcessKDPPropertiesSP &Get
   return g_settings_sp;
 }
 
+struct ProcessGDBRemoteInfo {
+  static const char *name;
+  

[Lldb-commits] [PATCH] D56814: [Reproducers] Refactor reproducer info

2019-01-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked 2 inline comments as done.
Closed by commit rL351501: [Reproducers] Refactor reproducer info (authored by 
JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56814?vs=182159&id=182420#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56814

Files:
  lldb/trunk/include/lldb/Utility/Reproducer.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Utility/Reproducer.cpp

Index: lldb/trunk/source/Utility/Reproducer.cpp
===
--- lldb/trunk/source/Utility/Reproducer.cpp
+++ lldb/trunk/source/Utility/Reproducer.cpp
@@ -178,10 +178,13 @@
 sys::fs::OpenFlags::F_None);
   yaml::Output yout(*strm);
 
+  std::vector files;
+  files.reserve(m_providers.size());
   for (auto &provider : m_providers) {
-auto &provider_info = provider.second->GetInfo();
-yout << const_cast(provider_info);
+files.emplace_back(provider.second->GetFile());
   }
+
+  yout << files;
 }
 
 Loader::Loader(const FileSpec &root) : m_root(root), m_loaded(false) {}
@@ -196,29 +199,24 @@
   if (auto err = error_or_file.getError())
 return make_error("unable to load reproducer index", err);
 
-  std::vector provider_info;
   yaml::Input yin((*error_or_file)->getBuffer());
-  yin >> provider_info;
-
+  yin >> m_files;
   if (auto err = yin.error())
 return make_error("unable to read reproducer index", err);
 
-  for (auto &info : provider_info)
-m_provider_info[info.name] = info;
+  // Sort files to speed up search.
+  llvm::sort(m_files);
 
+  // Remember that we've loaded the index.
   m_loaded = true;
 
   return llvm::Error::success();
 }
 
-llvm::Optional Loader::GetProviderInfo(StringRef name) {
+bool Loader::HasFile(StringRef file) {
   assert(m_loaded);
-
-  auto it = m_provider_info.find(name);
-  if (it == m_provider_info.end())
-return llvm::None;
-
-  return it->second;
+  auto it = std::lower_bound(m_files.begin(), m_files.end(), file.str());
+  return (it != m_files.end()) && (*it == file);
 }
 
 void ProviderBase::anchor() {}
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -157,17 +157,24 @@
   return g_settings_sp;
 }
 
+struct ProcessGDBRemoteInfo {
+  static const char *name;
+  static const char *file;
+};
+
+const char *ProcessGDBRemoteInfo::name = "gdb-remote";
+const char *ProcessGDBRemoteInfo::file = "gdb-remote.yaml";
+
 class ProcessGDBRemoteProvider
 : public repro::Provider {
 public:
+  typedef ProcessGDBRemoteInfo info;
+
   ProcessGDBRemoteProvider(const FileSpec &directory) : Provider(directory) {
-m_info.name = "gdb-remote";
-m_info.files.push_back("gdb-remote.yaml");
   }
 
   raw_ostream *GetHistoryStream() {
-FileSpec history_file =
-GetRoot().CopyByAppendingPathComponent("gdb-remote.yaml");
+FileSpec history_file = GetRoot().CopyByAppendingPathComponent(info::file);
 
 std::error_code EC;
 m_stream_up = llvm::make_unique(history_file.GetPath(), EC,
@@ -3432,16 +3439,10 @@
   if (!loader)
 return Status("No loader provided.");
 
-  auto provider_info = loader->GetProviderInfo("gdb-remote");
-  if (!provider_info)
-return Status("No provider for gdb-remote.");
-
-  if (provider_info->files.empty())
-return Status("Provider for  gdb-remote contains no files.");
-
   // Construct replay history path.
-  FileSpec history_file = loader->GetRoot().CopyByAppendingPathComponent(
-  provider_info->files.front());
+  FileSpec history_file = loader->GetFile();
+  if (!history_file)
+return Status("No provider for gdb-remote.");
 
   // Enable replay mode.
   m_replay_mode = true;
Index: lldb/trunk/include/lldb/Utility/Reproducer.h
===
--- lldb/trunk/include/lldb/Utility/Reproducer.h
+++ lldb/trunk/include/lldb/Utility/Reproducer.h
@@ -31,24 +31,14 @@
   Off,
 };
 
-/// Abstraction for information associated with a provider. This information
-/// is serialized into an index which is used by the loader.
-struct ProviderInfo {
-  std::string name;
-  std::vector files;
-};
-
 /// The provider defines an interface for generating files needed for
-/// reproducing. The provider must populate its ProviderInfo to communicate
-/// its name and files to the index, before registering with the generator,
-/// i.e. in the constructor.
+/// reproducing.
 ///
 /// Different components will implement differen

[Lldb-commits] [lldb] r351524 - [Reproducers] Fix reproducers unittest.

2019-01-17 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jan 17 23:17:05 2019
New Revision: 351524

URL: http://llvm.org/viewvc/llvm-project?rev=351524&view=rev
Log:
[Reproducers] Fix reproducers unittest.

Fix fallout from r351501 in the reproducer unittest.

Modified:
lldb/trunk/unittests/Utility/ReproducerTest.cpp

Modified: lldb/trunk/unittests/Utility/ReproducerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ReproducerTest.cpp?rev=351524&r1=351523&r2=351524&view=diff
==
--- lldb/trunk/unittests/Utility/ReproducerTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ReproducerTest.cpp Thu Jan 17 23:17:05 2019
@@ -20,14 +20,19 @@ using namespace llvm;
 using namespace lldb_private;
 using namespace lldb_private::repro;
 
+struct DummyInfo {
+  static const char *name;
+  static const char *file;
+};
+
+const char *DummyInfo::name = "dummy";
+const char *DummyInfo::file = "dummy.yaml";
+
 class DummyProvider : public repro::Provider {
 public:
-  static constexpr const char *NAME = "dummy";
+  typedef DummyInfo info;
 
-  DummyProvider(const FileSpec &directory) : Provider(directory) {
-m_info.name = "dummy";
-m_info.files.push_back("dummy.yaml");
-  }
+  DummyProvider(const FileSpec &directory) : Provider(directory) {}
 
   static char ID;
 };
@@ -97,9 +102,6 @@ TEST(GeneratorTest, Create) {
   auto *provider = generator.Create();
   EXPECT_NE(nullptr, provider);
   EXPECT_EQ(FileSpec("/bogus/path"), provider->GetRoot());
-  EXPECT_EQ(std::string("dummy"), provider->GetInfo().name);
-  EXPECT_EQ((size_t)1, provider->GetInfo().files.size());
-  EXPECT_EQ(std::string("dummy.yaml"), provider->GetInfo().files.front());
 }
 
 TEST(GeneratorTest, Get) {
@@ -125,9 +127,6 @@ TEST(GeneratorTest, GetOrCreate) {
 
   auto &provider = generator.GetOrCreate();
   EXPECT_EQ(FileSpec("/bogus/path"), provider.GetRoot());
-  EXPECT_EQ(std::string("dummy"), provider.GetInfo().name);
-  EXPECT_EQ((size_t)1, provider.GetInfo().files.size());
-  EXPECT_EQ(std::string("dummy.yaml"), provider.GetInfo().files.front());
 
   auto &provider_alt = generator.GetOrCreate();
   EXPECT_EQ(&provider, &provider_alt);


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