[Lldb-commits] [lldb] r367989 - [lldb][NFC] Remove unnecessary cast in ClangUserExpression

2019-08-06 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Aug  6 01:07:45 2019
New Revision: 367989

URL: http://llvm.org/viewvc/llvm-project?rev=367989&view=rev
Log:
[lldb][NFC] Remove unnecessary cast in ClangUserExpression

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=367989&r1=367988&r2=367989&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
Tue Aug  6 01:07:45 2019
@@ -645,12 +645,10 @@ bool ClangUserExpression::Parse(Diagnost
   register_execution_unit = true;
 }
 
-if (register_execution_unit) {
-  llvm::cast(
-  exe_ctx.GetTargetPtr()->GetPersistentExpressionStateForLanguage(
-  m_language))
+if (register_execution_unit)
+  exe_ctx.GetTargetPtr()
+  ->GetPersistentExpressionStateForLanguage(m_language)
   ->RegisterExecutionUnit(m_execution_unit_sp);
-}
   }
 
   if (generate_debug_info) {


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


[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added a reviewer: MaskRay.

While removing -z separate-code makes lld produce place the code at the
end of a segment right now, it's possible that future changes to the
linker will change that, thereby removing the coverage for the changes
in r367983. This patch adds a linker script to one of the line table
tests, which ensures that the code (and its line table) will be placed
at the very end of a module.


https://reviews.llvm.org/D65789

Files:
  lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
  lit/SymbolFile/DWARF/debug-line-basic.s


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an 
address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
.text
.globl  _start
 _start:
@@ -35,9 +39,16 @@
.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.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
.section.debug_str,"MS",@progbits,1
 .Linfo_string1:
.asciz  "a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }
+  .debug_str 0 : { *(.debug_str   ) }
+  .debug_abbrev  0 : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
 	.text
 	.globl	_start
 _start:
@@ -35,9 +39,16 @@
 	.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	.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
 	.section	.debug_str,"MS",@progbits,1
 .Linfo_string1:
 	.asciz	"a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }
+  .debug_str 0 : { *(.debug_str   ) }
+  .debug_abbrev  0 : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r367994 - SymbolVendorELF: Perform build-id lookup even without a debug link

2019-08-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug  6 01:18:39 2019
New Revision: 367994

URL: http://llvm.org/viewvc/llvm-project?rev=367994&view=rev
Log:
SymbolVendorELF: Perform build-id lookup even without a debug link

Summary:
The debug link and build-id lookups are two independent ways one can
search for a separate symbol file. However, our implementation in
SymbolVendorELF was tying the two together and refusing to look up the
symbol file based on a build id if the file did not contain a debug
link.

This patch makes it possible to search for the symbol file with
just one of the two methods available. To demonstrate, I split the
build-id-case test into two, so that we test the search using both
methods.

Reviewers: jankratochvil, mgorny, clayborg, espindola, alexshap

Subscribers: emaste, arichardson, MaskRay, lldb-commits

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

Added:
lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml
  - copied, changed from r367983, 
lldb/trunk/lit/Modules/ELF/build-id-case.yaml
Modified:
lldb/trunk/lit/Modules/ELF/build-id-case.yaml
lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/trunk/source/Symbol/LocateSymbolFile.cpp

Modified: lldb/trunk/lit/Modules/ELF/build-id-case.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/build-id-case.yaml?rev=367994&r1=367993&r2=367994&view=diff
==
--- lldb/trunk/lit/Modules/ELF/build-id-case.yaml (original)
+++ lldb/trunk/lit/Modules/ELF/build-id-case.yaml Tue Aug  6 01:18:39 2019
@@ -1,7 +1,7 @@
 # RUN: mkdir -p %t/.build-id/1b
 # RUN: yaml2obj %s > 
%t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug
 # RUN: cd %t
-# RUN: llvm-objcopy --strip-all 
--add-gnu-debuglink=.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug 
%t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out
+# RUN: llvm-objcopy --strip-all 
%t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out
 # RUN: lldb-test object-file %t/stripped.out | FileCheck %s
 
 # CHECK: Name: .debug_frame

Copied: lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml (from r367983, 
lldb/trunk/lit/Modules/ELF/build-id-case.yaml)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml?p2=lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml&p1=lldb/trunk/lit/Modules/ELF/build-id-case.yaml&r1=367983&r2=367994&rev=367994&view=diff
==
--- lldb/trunk/lit/Modules/ELF/build-id-case.yaml (original)
+++ lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml Tue Aug  6 01:18:39 2019
@@ -1,8 +1,6 @@
-# RUN: mkdir -p %t/.build-id/1b
-# RUN: yaml2obj %s > 
%t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug
-# RUN: cd %t
-# RUN: llvm-objcopy --strip-all 
--add-gnu-debuglink=.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug 
%t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out
-# RUN: lldb-test object-file %t/stripped.out | FileCheck %s
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t %t %t.stripped
+# RUN: lldb-test object-file %t.stripped | FileCheck %s
 
 # CHECK: Name: .debug_frame
 # CHECK-NEXT: Type: dwarf-frame
@@ -15,12 +13,6 @@ FileHeader:
   Machine: EM_X86_64
   Entry:   0x004003D0
 Sections:
-  - Name:.note.gnu.build-id
-Type:SHT_NOTE
-Flags:   [ SHF_ALLOC ]
-Address: 0x00400274
-AddressAlign:0x0004
-Content: 
040014000300474E55001B8A73AC238390E32A7FF4AC8EBE4D6A41ECF5C9
   - Name:.text
 Type:SHT_PROGBITS
 Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]

Modified: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp?rev=367994&r1=367993&r2=367994&view=diff
==
--- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp Tue Aug  6 
01:18:39 2019
@@ -71,16 +71,17 @@ SymbolVendorELF::CreateInstance(const ll
   if (!uuid)
 return nullptr;
 
+  // If the main object file already contains debug info, then we are done.
+  if (obj_file->GetSectionList()->FindSectionByType(
+  lldb::eSectionTypeDWARFDebugInfo, true))
+return nullptr;
+
   // If the module specified a filespec, use that.
   FileSpec fspec = module_sp->GetSymbolFileFileSpec();
   // Otherwise, try gnu_debuglink, if one exists.
   if (!fspec)
 fspec = obj_file->GetDebugLink().getValueOr(FileSpec());
 
-  // If we have no debug symbol files, then nothing to do.
-  if (!fspec)
-return nullptr;
-
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Time

[Lldb-commits] [PATCH] D65561: SymbolVendorELF: Perform build-id lookup even without a debug link

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367994: SymbolVendorELF: Perform build-id lookup even 
without a debug link (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65561?vs=213298&id=213532#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65561

Files:
  lldb/trunk/lit/Modules/ELF/build-id-case.yaml
  lldb/trunk/lit/Modules/ELF/gnu-debuglink.yaml
  lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
  lldb/trunk/source/Symbol/LocateSymbolFile.cpp

Index: lldb/trunk/source/Symbol/LocateSymbolFile.cpp
===
--- lldb/trunk/source/Symbol/LocateSymbolFile.cpp
+++ lldb/trunk/source/Symbol/LocateSymbolFile.cpp
@@ -261,107 +261,110 @@
   FileSystem::Instance().Exists(symbol_file_spec))
 return symbol_file_spec;
 
-  const char *symbol_filename = symbol_file_spec.GetFilename().AsCString();
-  if (symbol_filename && symbol_filename[0]) {
-FileSpecList debug_file_search_paths = default_search_paths;
-
-// Add module directory.
-FileSpec module_file_spec = module_spec.GetFileSpec();
-// We keep the unresolved pathname if it fails.
-FileSystem::Instance().ResolveSymbolicLink(module_file_spec,
-   module_file_spec);
+  FileSpecList debug_file_search_paths = default_search_paths;
 
-ConstString file_dir = module_file_spec.GetDirectory();
+  // Add module directory.
+  FileSpec module_file_spec = module_spec.GetFileSpec();
+  // We keep the unresolved pathname if it fails.
+  FileSystem::Instance().ResolveSymbolicLink(module_file_spec,
+ module_file_spec);
+
+  ConstString file_dir = module_file_spec.GetDirectory();
+  {
+FileSpec file_spec(file_dir.AsCString("."));
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
+
+  if (ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) {
+
+// Add current working directory.
 {
-  FileSpec file_spec(file_dir.AsCString("."));
+  FileSpec file_spec(".");
   FileSystem::Instance().Resolve(file_spec);
   debug_file_search_paths.AppendIfUnique(file_spec);
 }
 
-if (ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) {
-
-  // Add current working directory.
-  {
-FileSpec file_spec(".");
-FileSystem::Instance().Resolve(file_spec);
-debug_file_search_paths.AppendIfUnique(file_spec);
-  }
-
 #ifndef _WIN32
 #if defined(__NetBSD__)
-  // Add /usr/libdata/debug directory.
-  {
-FileSpec file_spec("/usr/libdata/debug");
-FileSystem::Instance().Resolve(file_spec);
-debug_file_search_paths.AppendIfUnique(file_spec);
-  }
+// Add /usr/libdata/debug directory.
+{
+  FileSpec file_spec("/usr/libdata/debug");
+  FileSystem::Instance().Resolve(file_spec);
+  debug_file_search_paths.AppendIfUnique(file_spec);
+}
 #else
-  // Add /usr/lib/debug directory.
-  {
-FileSpec file_spec("/usr/lib/debug");
-FileSystem::Instance().Resolve(file_spec);
-debug_file_search_paths.AppendIfUnique(file_spec);
-  }
+// Add /usr/lib/debug directory.
+{
+  FileSpec file_spec("/usr/lib/debug");
+  FileSystem::Instance().Resolve(file_spec);
+  debug_file_search_paths.AppendIfUnique(file_spec);
+}
 #endif
 #endif // _WIN32
-}
+  }
 
-std::string uuid_str;
-const UUID &module_uuid = module_spec.GetUUID();
-if (module_uuid.IsValid()) {
-  // Some debug files are stored in the .build-id directory like this:
-  //   /usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
-  uuid_str = module_uuid.GetAsString("");
-  std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
- ::tolower);
-  uuid_str.insert(2, 1, '/');
-  uuid_str = uuid_str + ".debug";
-}
+  std::string uuid_str;
+  const UUID &module_uuid = module_spec.GetUUID();
+  if (module_uuid.IsValid()) {
+// Some debug files are stored in the .build-id directory like this:
+//   /usr/lib/debug/.build-id/ff/e7fe727889ad82bb153de2ad065b2189693315.debug
+uuid_str = module_uuid.GetAsString("");
+std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
+   ::tolower);
+uuid_str.insert(2, 1, '/');
+uuid_str = uuid_str + ".debug";
+  }
 
-size_t num_directories = debug_file_search_paths.GetSize();
-for (size_t idx = 0; idx < num_directories; ++idx) {
-  FileSpec dirspec = debug_file_search_paths.GetFileSpecAtIndex(idx);
-  FileSystem::Instance().Resolve(dirspec);
-  if (!FileSystem::Instance().IsDirectory(dirspec))
-

[Lldb-commits] [lldb] r368001 - SymbolVendor: Remove passthrough methods

2019-08-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug  6 02:12:42 2019
New Revision: 368001

URL: http://llvm.org/viewvc/llvm-project?rev=368001&view=rev
Log:
SymbolVendor: Remove passthrough methods

After the recent refactorings the SymbolVendor passthrough no longer
serve any purpose. This patch removes those methods, and updates all
callsites to go to the symbol file directly -- in most cases that just
means calling GetSymbolFile()->foo() instead of
GetSymbolVendor()->foo().

Modified:
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/SearchFilter.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Symbol/Block.cpp
lldb/trunk/source/Symbol/CompileUnit.cpp
lldb/trunk/source/Symbol/Function.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp
lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=368001&r1=368000&r2=368001&view=diff
==
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Tue Aug  6 02:12:42 2019
@@ -39,89 +39,8 @@ public:
 
   void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
 
-  virtual void Dump(Stream *s);
-
-  virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit);
-
-  virtual size_t ParseFunctions(CompileUnit &comp_unit);
-
-  virtual bool ParseLineTable(CompileUnit &comp_unit);
-
-  virtual bool ParseDebugMacros(CompileUnit &comp_unit);
-
-  virtual bool ParseSupportFiles(CompileUnit &comp_unit,
- FileSpecList &support_files);
-
-  virtual bool ParseIsOptimized(CompileUnit &comp_unit);
-
-  virtual size_t ParseTypes(CompileUnit &comp_unit);
-
-  virtual bool
-  ParseImportedModules(const SymbolContext &sc,
-   std::vector &imported_modules);
-
-  virtual size_t ParseBlocksRecursive(Function &func);
-
-  virtual size_t ParseVariablesForContext(const SymbolContext &sc);
-
-  virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
-
-  virtual uint32_t ResolveSymbolContext(const Address &so_addr,
-lldb::SymbolContextItem resolve_scope,
-SymbolContext &sc);
-
-  virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
-uint32_t line, bool check_inlines,
-lldb::SymbolContextItem resolve_scope,
-SymbolContextList &sc_list);
-
-  virtual size_t FindGlobalVariables(ConstString name,
- const CompilerDeclContext 
*parent_decl_ctx,
- size_t max_matches,
- VariableList &variables);
-
-  virtual size_t FindGlobalVariables(const RegularExpression ®ex,
- size_t max_matches,
- VariableList &variables);
-
-  virtual size_t FindFunctions(ConstString name,
-   const CompilerDeclContext *parent_decl_ctx,
-   lldb::FunctionNameType name_type_mask,
-   bool include_inlines, bool append,
-   SymbolContextList &sc_list);
-
-  virtual size_t FindFunctions(const RegularExpression ®ex,
-   bool include_inlines, bool append,
-   SymbolContextList &sc_list);
-
-  virtual size_t
-  FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
-bool append, size_t max_matches,
-llvm::DenseSet &searched_symbol_files,
-TypeMap &types);
-
-  virtual size_t FindTypes(const std::vector &context,
-   bool append, TypeMap &types);
-
-  virtual CompilerDeclContext
-  FindNamespace(ConstString name,
-const CompilerDeclContext *parent_decl_ctx);
-
-  virtual size_t GetNumCompileUnits();
-
-  virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
-
-  virtual size_t GetTypes(SymbolContextScope *sc_scope,
-  lldb::TypeClass type_mask, TypeList &type_list);
-
   SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
 
-  FileSpec GetMainFileSpec() const;
-
-  /// Notify the SymbolVendor that the file addresses in the Sections
-  /// for this module

[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-06 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.



Comment at: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script:6
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }

`0` (output section address, `addrExpr` in lld) can be deleted. For 
non-SHF_ALLOC sections (`.shstrtab` `.debug_info` etc), the address expression 
is just ignored.

// lld/ELF/LinkerScript.cpp#L772
  if ((sec->flags & SHF_ALLOC) && sec->addrExpr)
setDot(sec->addrExpr, sec->location, false);


(I guess it was retrieved from `ld --verbose`)


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

https://reviews.llvm.org/D65789



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


[Lldb-commits] [PATCH] D65611: [Driver] Expand the target in the driver.

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D65611#1615161 , @JDevlieghere 
wrote:

> We definitely need the VFS change for the reproducers, no argument there. My 
> earlier comment was more about the change in general, orthogonal to the 
> reproducers.


Ah, I see. Thanks for explaining.

As for the expansion, I think a better way to handle that would be to change 
the output of the "target create" to show to resolved path, independent of the 
actual input:

  $ bin/lldb ls
  (lldb) target create "ls"
  Current executable set to 'ls' (x86_64).

We could change the last line to say "/bin/ls" without affecting the argv[0] of 
the target program. That way, you'd get the resolved path no matter how the 
user specifies the target to debug...


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

https://reviews.llvm.org/D65611



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


[Lldb-commits] [lldb] r368010 - ObjectFileELF: permit thread-local sections with overlapping file addresses

2019-08-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug  6 03:04:27 2019
New Revision: 368010

URL: http://llvm.org/viewvc/llvm-project?rev=368010&view=rev
Log:
ObjectFileELF: permit thread-local sections with overlapping file addresses

Summary:
In an attempt to make file-address-based lookups more predictable, in D55998
we started ignoring sections which would result in file address
overlaps. It turns out this was too aggressive because thread-local
sections typically will have file addresses which apear to overlap
regular data/code. This does not cause a problem at runtime because
thread-local sections are loaded into memory using special logic, but it
can cause problems for lldb when trying to lookup objects by their file
address.

This patch changes ObjectFileELF to permit thread-local sections to
overlap regular ones by essentially giving them a separate address
space. It also makes them more symmetrical to regular sections by
creating container sections from PT_TLS segments.

Simultaneously, the patch changes the regular file address lookup logic
to ignore sections with the thread-specific bit set. I believe this is
what the users looking up file addresses would typically expect, as
looking up thread-local data generally requires more complex logic (e.g.
DWARF has a special opcode for that).

Reviewers: clayborg, jingham, MaskRay

Subscribers: emaste, aprantl, arichardson, lldb-commits

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

Added:
lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml
lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml
Modified:
lldb/trunk/source/Core/Section.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Added: lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml?rev=368010&view=auto
==
--- lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml (added)
+++ lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml Tue Aug  6 03:04:27 
2019
@@ -0,0 +1,63 @@
+# Overlapping PT_LOAD and PT_TLS segments should be able to exist side by side.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+# RUN: lldb %t -o "image lookup -a 0x1000" -b | FileCheck 
--check-prefix=LOOKUP %s
+
+# CHECK:Index: 0
+# CHECK-NEXT:   ID: 0x
+# CHECK-NEXT:   Name: PT_TLS[0]
+# CHECK-NEXT:   Type: container
+# CHECK-NEXT:   Permissions: rw-
+# CHECK-NEXT:   Thread specific: yes
+# CHECK-NEXT:   VM address: 0x1000
+# CHECK-NEXT:   VM size: 16
+# CHECK-NEXT:   File size: 0
+# CHECK-NEXT:   Showing 1 subsections
+
+# CHECK:Index: 1
+# CHECK-NEXT:   ID: 0xfffe
+# CHECK-NEXT:   Name: PT_LOAD[0]
+# CHECK-NEXT:   Type: container
+# CHECK-NEXT:   Permissions: rw-
+# CHECK-NEXT:   Thread specific: no
+# CHECK-NEXT:   VM address: 0x1000
+# CHECK-NEXT:   VM size: 16
+# CHECK-NEXT:   File size: 16
+# CHECK-NEXT:   Showing 1 subsections
+
+# LOOKUP-LABEL: image lookup -a 0x1000
+# LOOKUP:   Address: {{.*}}.PT_LOAD[0]..data + 0)
+
+!ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_ARM
+Sections:
+  - Name:.tbss
+Type:SHT_NOBITS
+Flags:   [ SHF_ALLOC, SHF_WRITE, SHF_TLS ]
+Address: 0x1000
+AddressAlign:0x4
+Size:0x10
+  - Name:.data
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_WRITE ]
+Address: 0x1000
+AddressAlign:0x4
+Size:0x10
+ProgramHeaders:
+  - Type: PT_TLS
+Flags: [ PF_R, PF_W ]
+VAddr: 0x1000
+Align: 0x4
+Sections:
+  - Section: .tbss
+  - Type: PT_LOAD
+Flags: [ PF_W, PF_R ]
+VAddr: 0x1000
+Align: 0x4
+Sections:
+  - Section: .data

Added: lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml?rev=368010&view=auto
==
--- lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml (added)
+++ lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml Tue Aug  6 03:04:27 
2019
@@ -0,0 +1,63 @@
+# Overlapping PT_LOAD and PT_TLS segments should be able to exist side by side.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+# RUN: lldb %t -o "image lookup -a 0x1000" -b | FileCheck 
--check-prefix=LOOKUP %s
+
+# CHECK:Index: 0
+# CHECK-NEXT:   ID: 0x
+# CHECK-NEXT:   Name: PT_LOAD[0]
+# CHECK-NEXT:   Type: container
+# CHECK-NEXT:   Permissions: rw-
+# CHECK-NEXT:   Thread specific: no
+# CHECK-NEXT:   VM address: 0x1000
+# CHECK-NEXT:   VM size: 16
+# CHECK-NEXT:   File size: 16
+# CHECK-NEXT:   Showing 1 subsections
+
+# CHECK:Index: 1
+# CHECK-NEXT:   ID: 0xf

[Lldb-commits] [PATCH] D65282: ObjectFileELF: permit thread-local sections with overlapping file addresses

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368010: ObjectFileELF: permit thread-local sections with 
overlapping file addresses (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65282

Files:
  lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_TLS.yaml
  lldb/trunk/lit/Modules/ELF/PT_TLS-overlap-PT_LOAD.yaml
  lldb/trunk/source/Core/Section.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1712,6 +1712,8 @@
   VMMap Segments = VMMap(Alloc);
   VMMap Sections = VMMap(Alloc);
   lldb_private::Log *Log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
+  size_t SegmentCount = 0;
+  std::string SegmentName;
 
   VMRange GetVMRange(const ELFSectionHeader &H) {
 addr_t Address = H.sh_addr;
@@ -1726,18 +1728,23 @@
   }
 
 public:
-  VMAddressProvider(ObjectFile::Type Type) : ObjectType(Type) {}
+  VMAddressProvider(ObjectFile::Type Type, llvm::StringRef SegmentName)
+  : ObjectType(Type), SegmentName(SegmentName) {}
+
+  std::string GetNextSegmentName() const {
+return llvm::formatv("{0}[{1}]", SegmentName, SegmentCount).str();
+  }
 
   llvm::Optional GetAddressInfo(const ELFProgramHeader &H) {
 if (H.p_memsz == 0) {
-  LLDB_LOG(Log,
-   "Ignoring zero-sized PT_LOAD segment. Corrupt object file?");
+  LLDB_LOG(Log, "Ignoring zero-sized {0} segment. Corrupt object file?",
+   SegmentName);
   return llvm::None;
 }
 
 if (Segments.overlaps(H.p_vaddr, H.p_vaddr + H.p_memsz)) {
-  LLDB_LOG(Log,
-   "Ignoring overlapping PT_LOAD segment. Corrupt object file?");
+  LLDB_LOG(Log, "Ignoring overlapping {0} segment. Corrupt object file?",
+   SegmentName);
   return llvm::None;
 }
 return VMRange(H.p_vaddr, H.p_memsz);
@@ -1772,6 +1779,7 @@
 
   void AddSegment(const VMRange &Range, SectionSP Seg) {
 Segments.insert(Range.GetRangeBase(), Range.GetRangeEnd(), std::move(Seg));
+++SegmentCount;
   }
 
   void AddSection(SectionAddressInfo Info, SectionSP Sect) {
@@ -1790,28 +1798,31 @@
 return;
 
   m_sections_up = llvm::make_unique();
-  VMAddressProvider address_provider(GetType());
+  VMAddressProvider regular_provider(GetType(), "PT_LOAD");
+  VMAddressProvider tls_provider(GetType(), "PT_TLS");
 
-  size_t LoadID = 0;
   for (const auto &EnumPHdr : llvm::enumerate(ProgramHeaders())) {
 const ELFProgramHeader &PHdr = EnumPHdr.value();
-if (PHdr.p_type != PT_LOAD)
+if (PHdr.p_type != PT_LOAD && PHdr.p_type != PT_TLS)
   continue;
 
-auto InfoOr = address_provider.GetAddressInfo(PHdr);
+VMAddressProvider &provider =
+PHdr.p_type == PT_TLS ? tls_provider : regular_provider;
+auto InfoOr = provider.GetAddressInfo(PHdr);
 if (!InfoOr)
   continue;
 
-ConstString Name(("PT_LOAD[" + llvm::Twine(LoadID++) + "]").str());
 uint32_t Log2Align = llvm::Log2_64(std::max(PHdr.p_align, 1));
 SectionSP Segment = std::make_shared(
-GetModule(), this, SegmentID(EnumPHdr.index()), Name,
-eSectionTypeContainer, InfoOr->GetRangeBase(), InfoOr->GetByteSize(),
-PHdr.p_offset, PHdr.p_filesz, Log2Align, /*flags*/ 0);
+GetModule(), this, SegmentID(EnumPHdr.index()),
+ConstString(provider.GetNextSegmentName()), eSectionTypeContainer,
+InfoOr->GetRangeBase(), InfoOr->GetByteSize(), PHdr.p_offset,
+PHdr.p_filesz, Log2Align, /*flags*/ 0);
 Segment->SetPermissions(GetPermissions(PHdr));
+Segment->SetIsThreadSpecific(PHdr.p_type == PT_TLS);
 m_sections_up->AddSection(Segment);
 
-address_provider.AddSegment(*InfoOr, std::move(Segment));
+provider.AddSegment(*InfoOr, std::move(Segment));
   }
 
   ParseSectionHeaders();
@@ -1826,7 +1837,9 @@
 const uint64_t file_size =
 header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
 
-auto InfoOr = address_provider.GetAddressInfo(header);
+VMAddressProvider &provider =
+header.sh_flags & SHF_TLS ? tls_provider : regular_provider;
+auto InfoOr = provider.GetAddressInfo(header);
 if (!InfoOr)
   continue;
 
@@ -1857,7 +1870,7 @@
 section_sp->SetIsThreadSpecific(header.sh_flags & SHF_TLS);
 (InfoOr->Segment ? InfoOr->Segment->GetChildren() : *m_sections_up)
 .AddSection(section_sp);
-address_provider.AddSection(std::move(*InfoOr), std::move(section_sp));
+provider.AddSection(std::move(*InfoOr), std::move(section_sp));
   }
 
   // For eTypeDebugInfo files, the Symbol Vendor will take care of updating the
Index: lldb/trunk/

[Lldb-commits] [PATCH] D65797: [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: JDevlieghere, jingham, clayborg.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

Print a warning if the wrong cache script is used when generating a Xcode 
project, because it's too easy to confuse with Apple-lldb-macOS.cmake

  CMake Warning at cmake/modules/LLDBConfig.cmake:76 (message):
When building with Xcode, please use the corresponding cache script.  Clean
your build directory and re-run CMake with:
  
  -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake
  
See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject

Also set the generator inside the cache script.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65797

Files:
  lldb/cmake/caches/Apple-lldb-Xcode.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries 
(Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, please use the corresponding cache script. "
+  "Clean your build directory and re-run CMake with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: 
https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, please use the corresponding cache script. "
+  "Clean your build directory and re-run CMake with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# buil

[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: JDevlieghere, jingham, xiaobai, compnerd, labath.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

This shrinks standalone configuration lines by one more parameter. In the 
provided build-tree, the default structure of CMake module directories is:

  /path/to/build-llvm/lib/cmake/llvm
  /paht/to/build-llvm/lib/cmake/clang


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65798

Files:
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -323,7 +323,6 @@
   > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
-  -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
   llvm-project/lldb
   > open lldb.xcodeproj
   > cmake --build /path/to/lldb-build --target check-lldb
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,5 +1,12 @@
 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 
'install' target." OFF)
 
+if(NOT Clang_DIR)
+  # ClangConfig.cmake is usually found in the clang directory
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")
+endif()
+
 find_package(LLVM REQUIRED CONFIG HINTS "${LLVM_DIR}" NO_CMAKE_FIND_ROOT_PATH)
 find_package(Clang REQUIRED CONFIG HINTS "${Clang_DIR}" 
NO_CMAKE_FIND_ROOT_PATH)
 


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -323,7 +323,6 @@
   > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
-  -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
   llvm-project/lldb
   > open lldb.xcodeproj
   > cmake --build /path/to/lldb-build --target check-lldb
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,5 +1,12 @@
 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
 
+if(NOT Clang_DIR)
+  # ClangConfig.cmake is usually found in the clang directory
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")
+endif()
+
 find_package(LLVM REQUIRED CONFIG HINTS "${LLVM_DIR}" NO_CMAKE_FIND_ROOT_PATH)
 find_package(Clang REQUIRED CONFIG HINTS "${Clang_DIR}" NO_CMAKE_FIND_ROOT_PATH)
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65677: [VirtualFileSystem] Support encoding a current working directory in a VFS mapping.

2019-08-06 Thread Sam McCall via Phabricator via lldb-commits
sammccall added a comment.

> I'd like to know if you tried other approaches and why they failed.

+1. In particular, what goes wrong if you try to make the working directory a 
sibling of VFS (within the reproducer container) rather than a child of it 
(within shared infrastructure)?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65677



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


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 213587.
teemperor edited the summary of this revision.
teemperor added a comment.

- We now enumerate the fake expression files. E.g. ``.


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

https://reviews.llvm.org/D65646

Files:
  clang/include/clang/Basic/DiagnosticOptions.def
  clang/lib/Frontend/TextDiagnostic.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/TestExprDiagnostics.py
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/main.cpp
  lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -15,6 +15,7 @@
 #include "ASTStructExtractor.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
+#include "ClangExpressionSourceCode.h"
 #include "ClangExpressionVariable.h"
 #include "IRForTarget.h"
 
@@ -213,6 +214,10 @@
   /// were not able to calculate this position.
   llvm::Optional m_user_expression_start_pos;
   ResultDelegate m_result_delegate;
+  ClangPersistentVariables *m_clang_state;
+  std::unique_ptr m_source_code;
+  /// File name used for the expression.
+  std::string m_filename;
 
   /// The object (if any) in which context the expression is evaluated.
   /// See the comment to `UserExpression::Evaluate` for details.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -21,7 +21,6 @@
 #include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
-#include "ClangExpressionSourceCode.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
 
@@ -330,6 +329,7 @@
 if (PersistentExpressionState *persistent_state =
 target->GetPersistentExpressionStateForLanguage(
 lldb::eLanguageTypeC)) {
+  m_clang_state = llvm::cast(persistent_state);
   m_result_delegate.RegisterPersistentState(persistent_state);
 } else {
   diagnostic_manager.PutString(
@@ -394,18 +394,18 @@
 DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
 std::vector modules_to_import, bool for_completion) {
 
+  m_filename = m_clang_state->GetNextExprFileName();
   std::string prefix = m_expr_prefix;
 
   if (m_options.GetExecutionPolicy() == eExecutionPolicyTopLevel) {
 m_transformed_text = m_expr_text;
   } else {
-std::unique_ptr source_code(
-ClangExpressionSourceCode::CreateWrapped(prefix.c_str(),
- m_expr_text.c_str()));
+m_source_code.reset(ClangExpressionSourceCode::CreateWrapped(
+m_filename, prefix.c_str(), m_expr_text.c_str()));
 
-if (!source_code->GetText(m_transformed_text, m_expr_lang,
-  m_in_static_method, exe_ctx, !m_ctx_obj,
-  for_completion, modules_to_import)) {
+if (!m_source_code->GetText(m_transformed_text, m_expr_lang,
+m_in_static_method, exe_ctx, !m_ctx_obj,
+for_completion, modules_to_import)) {
   diagnostic_manager.PutString(eDiagnosticSeverityError,
"couldn't construct expression body");
   return;
@@ -415,7 +415,7 @@
 // transformed code. We need this later for the code completion.
 std::size_t original_start;
 std::size_t original_end;
-bool found_bounds = source_code->GetOriginalBodyBounds(
+bool found_bounds = m_source_code->GetOriginalBodyBounds(
 m_transformed_text, m_expr_lang, original_start, original_end);
 if (found_bounds)
   m_user_expression_start_pos = original_start;
@@ -570,7 +570,7 @@
   // parser_sp will never be empty.
 
   ClangExpressionParser parser(exe_scope, *this, generate_debug_info,
-   m_include_directories);
+   m_include_directories, m_fil

[Lldb-commits] [PATCH] D65640: Update LLDB to follow changes in llvm::DWARFDebugNames::NameIndex (4/5)

2019-08-06 Thread Igor Kudrin via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368033: Update LLDB to follow changes in 
llvm::DWARFDebugNames::NameIndex (4/5) (authored by ikudrin, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65640?vs=212996&id=213596#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65640

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -105,7 +105,7 @@
   if (!regex.Execute(nte.getString()))
 continue;
 
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 if (entry_or->tag() != DW_TAG_variable)
@@ -125,7 +125,7 @@
   uint64_t cu_offset = cu.GetOffset();
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
 for (DebugNames::NameTableEntry nte: ni) {
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 if (entry_or->tag() != DW_TAG_variable)
@@ -248,7 +248,7 @@
   if (!regex.Execute(nte.getString()))
 continue;
 
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 Tag tag = entry_or->tag();


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -105,7 +105,7 @@
   if (!regex.Execute(nte.getString()))
 continue;
 
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 if (entry_or->tag() != DW_TAG_variable)
@@ -125,7 +125,7 @@
   uint64_t cu_offset = cu.GetOffset();
   for (const DebugNames::NameIndex &ni: *m_debug_names_up) {
 for (DebugNames::NameTableEntry nte: ni) {
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 if (entry_or->tag() != DW_TAG_variable)
@@ -248,7 +248,7 @@
   if (!regex.Execute(nte.getString()))
 continue;
 
-  uint32_t entry_offset = nte.getEntryOffset();
+  uint64_t entry_offset = nte.getEntryOffset();
   llvm::Expected entry_or = ni.getEntry(&entry_offset);
   for (; entry_or; entry_or = ni.getEntry(&entry_offset)) {
 Tag tag = entry_or->tag();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-08-06 Thread Aaron Smith via Phabricator via lldb-commits
asmith added a comment.

Do you need some help fixing the build?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd added inline comments.



Comment at: lldb/cmake/modules/LLDBStandalone.cmake:6
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")

What happens in the standalone clang build scenario?  Can I ask what is the 
motivation for this change?  I think it is better to require that the user pass 
the path, as that is an explicit dependency of LLDB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65798



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


[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added inline comments.



Comment at: lldb/cmake/modules/LLDBStandalone.cmake:6
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")

compnerd wrote:
> What happens in the standalone clang build scenario?  Can I ask what is the 
> motivation for this change?  I think it is better to require that the user 
> pass the path, as that is an explicit dependency of LLDB.
I don't think there's any side-effects on Clang standalone builds. Is that what 
you mean with "standalone clang build scenario"?

I would like top prevent people from writing custom build scripts on top of 
CMake. Passing a number of very similar paths to CMake, e.g. each time we want 
to generate a Xcode project for development, this option seems to become 
compelling quickly. This patch makes standalone configurations simpler. 
Basically, it provides a default value. I doesn't cut down functionality.

You can still explicitly pass any path you want. This branch will then not be 
taken.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65798



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


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:267
 : ExpressionParser(exe_scope, expr, generate_debug_info), m_compiler(),
-  m_pp_callbacks(nullptr),
+  m_pp_callbacks(nullptr), m_filename(filename),
   m_include_directories(std::move(include_directories)) {

`std::move(filename)`



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h:29
+  static ClangExpressionSourceCode *
+  CreateWrapped(std::string filename, const char *prefix, const char *body) {
+return new ClangExpressionSourceCode(filename, "$__lldb_expr", prefix, 
body,

Can we use StringRefs for prefix and body?



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h:31
+return new ClangExpressionSourceCode(filename, "$__lldb_expr", prefix, 
body,
+ true);
   }

Can you use an enum to name the boolean parameter? 

```
enum Wrapping : bool {
Wrap = true,
NoWrap = false,
  };
```



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h:88
 private:
+  // The counter used by GetNextExprFileName.
+  uint32_t m_next_user_file_id = 0;

`///`


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

https://reviews.llvm.org/D65646



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


[Lldb-commits] [PATCH] D65797: [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Small comment about the working, but the change itself LGTM.




Comment at: lldb/cmake/modules/LLDBConfig.cmake:77
+message(WARNING
+  "When building with Xcode, please use the corresponding cache script. "
+  "Clean your build directory and re-run CMake with:\n"

[bikeshedding] I think we should say something like:

> When building with Xcode, we recommend using the corresponding cache script. 
> If this was a mistake, clean your lean your build directory and re-run CMake 
> with:




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65797



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


[Lldb-commits] [PATCH] D65797: [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 213637.
sgraenitz marked an inline comment as done.
sgraenitz added a comment.

Improve warning message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65797

Files:
  lldb/cmake/caches/Apple-lldb-Xcode.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries 
(Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, we recommend using the corresponding cache 
script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake 
with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: 
https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, we recommend using the corresponding cache script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65611: [Driver] Expand the executable path in the target create output

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 213640.
JDevlieghere retitled this revision from "[Driver] Expand the target in the 
driver." to "[Driver] Expand the executable path in the target create output".
JDevlieghere edited the summary of this revision.

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

https://reviews.llvm.org/D65611

Files:
  lldb/lit/Driver/TestTarget.test
  lldb/source/Commands/CommandObjectTarget.cpp


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -450,7 +450,8 @@
   }
 } else {
   result.AppendMessageWithFormat(
-  "Current executable set to '%s' (%s).\n", file_path,
+  "Current executable set to '%s' (%s).\n",
+  file_spec.GetPath().c_str(),
   target_sp->GetArchitecture().GetArchitectureName());
   result.SetStatus(eReturnStatusSuccessFinishNoResult);
 }
@@ -2631,7 +2632,7 @@
 if (!module_spec.GetArchitecture().IsValid())
   module_spec.GetArchitecture() = target->GetArchitecture();
 Status error;
-ModuleSP module_sp(target->GetOrCreateModule(module_spec, 
+ModuleSP module_sp(target->GetOrCreateModule(module_spec,
 true /* notify */, &error));
 if (!module_sp) {
   const char *error_cstr = error.AsCString();
@@ -4747,7 +4748,7 @@
 
 new_hook_sp->SetThreadSpecifier(thread_spec);
   }
-  
+
   new_hook_sp->SetAutoContinue(m_options.m_auto_continue);
   if (m_options.m_use_one_liner) {
 // Use one-liners.
Index: lldb/lit/Driver/TestTarget.test
===
--- /dev/null
+++ lldb/lit/Driver/TestTarget.test
@@ -0,0 +1,7 @@
+# Make sure lldb resolves the target path.
+# RUN: mkdir -p %t/foo
+# RUN: cd %t/foo
+# RUN: %clang %p/Inputs/hello.c -g -o a.out
+# RUN: %lldb -b a.out | FileCheck %s
+
+# CHECK: Current executable set to '{{.*}}foo{{[/]+}}a.out'


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -450,7 +450,8 @@
   }
 } else {
   result.AppendMessageWithFormat(
-  "Current executable set to '%s' (%s).\n", file_path,
+  "Current executable set to '%s' (%s).\n",
+  file_spec.GetPath().c_str(),
   target_sp->GetArchitecture().GetArchitectureName());
   result.SetStatus(eReturnStatusSuccessFinishNoResult);
 }
@@ -2631,7 +2632,7 @@
 if (!module_spec.GetArchitecture().IsValid())
   module_spec.GetArchitecture() = target->GetArchitecture();
 Status error;
-ModuleSP module_sp(target->GetOrCreateModule(module_spec, 
+ModuleSP module_sp(target->GetOrCreateModule(module_spec,
 true /* notify */, &error));
 if (!module_sp) {
   const char *error_cstr = error.AsCString();
@@ -4747,7 +4748,7 @@
 
 new_hook_sp->SetThreadSpecifier(thread_spec);
   }
-  
+
   new_hook_sp->SetAutoContinue(m_options.m_auto_continue);
   if (m_options.m_use_one_liner) {
 // Use one-liners.
Index: lldb/lit/Driver/TestTarget.test
===
--- /dev/null
+++ lldb/lit/Driver/TestTarget.test
@@ -0,0 +1,7 @@
+# Make sure lldb resolves the target path.
+# RUN: mkdir -p %t/foo
+# RUN: cd %t/foo
+# RUN: %clang %p/Inputs/hello.c -g -o a.out
+# RUN: %lldb -b a.out | FileCheck %s
+
+# CHECK: Current executable set to '{{.*}}foo{{[/]+}}a.out'
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65797: [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Thanks for doing this.  Looks okay to me just one typo...  But I don't know 
CMake well enough to comment on substance...




Comment at: lldb/cmake/modules/LLDBConfig.cmake:78
+  "When building with Xcode, we recommend using the corresponding cache 
script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake 
with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"

This should work not just for Jack Spratt but also his wife! "LEAN build 
directory"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65797



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


[Lldb-commits] [PATCH] D65691: Various build fixes for lldb on MinGW

2019-08-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:55
 #define PATH_MAX MAX_PATH
+#endif
 typedef int socklen_t;

labath wrote:
> amccarth wrote:
> > hhb wrote:
> > > amccarth wrote:
> > > > Nothing in the rest of this .cpp file uses PATH_MAX, so just delete the 
> > > > `#define` instead of executing it conditionally.
> > > PATH_MAX is used in SendProcessEvent (line 283)
> > Got it.  When I asked Phabricator to show me all the lines, it didn't show 
> > me _all_ the lines.
> > 
> > That said, it seems unfortunate that it's yet another fixed-length filename 
> > buffer instead of getting a ConstString from the FileSpec.  But that's 
> > outside the scope of this change.
> The problem is that you're dealing with the SBFileSpec here, and that makes 
> things slightly complicated (stable api, not being able to return c++ objects 
> through it, etc...).
There's no reason we couldn't add an SBString class to vend non-fixed length 
strings.  There haven't been enough instances where we really needed it to 
motivate that, but we have SBStringList to wrap vectors of strings, so it 
wouldn't be out of place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65691



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


[Lldb-commits] [PATCH] D65566: [lldb][CMake] Workaround debugserver code-signing issue in generated Xcode project

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

Solutions are clearly favorable over workarounds like this, but I couldn't find 
one. Xcode has a mechanism called `sign on copy` which seems to be the native 
way to avoid this problem, but I couldn't get it to work with LLDB, because I 
want to copy the build output of a target and this caused a cyclic dependency. 
I didn't find more information about it and there seems to be no way to 
generate this behavior with CMake. The only way around seems to be a custom 
script, but that is no better than the workaround here.

Given the situation, that the problem is a symptom (1) of a workaround (2) that 
avoids a misbehavior of xcodebuild (3), I think the given fix is acceptable.

(1) copied debugserver not signed
(2) Xcode-specific signing process that avoid double-signing
(3) xcodebuild runs post-build steps even though the target was not built


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65566



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


[Lldb-commits] [lldb] r368066 - [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Aug  6 10:21:34 2019
New Revision: 368066

URL: http://llvm.org/viewvc/llvm-project?rev=368066&view=rev
Log:
[lldb][CMake] Generating Xcode projects

Summary:
Print a warning if the wrong cache script is used when generating a Xcode 
project, because it's too easy to confuse with Apple-lldb-macOS.cmake

```
  When building with Xcode, we recommend using the corresponding cache
  script.  If this was a mistake, clean your build directory and re-run
  CMake with:

-C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake

  See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject
```

Also set the generator inside the cache script.

Reviewers: JDevlieghere, jingham, clayborg

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

Modified:
lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/docs/resources/build.rst

Modified: lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake?rev=368066&r1=368065&r2=368066&view=diff
==
--- lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake (original)
+++ lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake Tue Aug  6 10:21:34 2019
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=368066&r1=368065&r2=368066&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Aug  6 10:21:34 2019
@@ -71,6 +71,16 @@ if(LLDB_BUILD_FRAMEWORK)
   "Directory to emit dSYM files stripped from executables and libraries 
(Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, we recommend using the corresponding cache 
script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake 
with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: 
https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")

Modified: lldb/trunk/docs/resources/build.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=368066&r1=368065&r2=368066&view=diff
==
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Tue Aug  6 10:21:34 2019
@@ -320,7 +320,7 @@ Build LLDB standalone for development wi
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \


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


[Lldb-commits] [PATCH] D65797: [lldb][CMake] Generating Xcode projects

2019-08-06 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368066: [lldb][CMake] Generating Xcode projects (authored by 
stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65797?vs=213637&id=213658#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65797

Files:
  lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
  lldb/trunk/cmake/modules/LLDBConfig.cmake
  lldb/trunk/docs/resources/build.rst


Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries 
(Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, we recommend using the corresponding cache 
script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake 
with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: 
https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")
Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \


Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -71,6 +71,16 @@
   "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+message(WARNING
+  "When building with Xcode, we recommend using the corresponding cache script. "
+  "If this was a mistake, clean your lean build directory and re-run CMake with:\n"
+  "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+  "See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n";)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
Index: lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
===
--- lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
+++ lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")
Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -320,7 +320,7 @@
   llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > cmake -B /path/to/lldb-build \
   -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
   -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
   -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
_

[Lldb-commits] [PATCH] D65611: [Driver] Expand the executable path in the target create output

2019-08-06 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.

I don't know if anyone has strong opinions on how we should print this, but I 
think I slightly prefer the seeing the full path.


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

https://reviews.llvm.org/D65611



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


[Lldb-commits] [PATCH] D65611: [Driver] Expand the executable path in the target create output

2019-08-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Given that we do some work to find executables (like search along the path for 
"ls" -> /bin/ls") which work might not end up with the result you expected, 
printing the full path seems useful.


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

https://reviews.llvm.org/D65611



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


[Lldb-commits] [PATCH] D65691: Various build fixes for lldb on MinGW

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368069: Various build fixes for lldb on MinGW (authored by 
hhb, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65691?vs=213505&id=213662#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65691

Files:
  lldb/trunk/include/lldb/Host/windows/PosixApi.h
  lldb/trunk/source/Host/windows/FileSystem.cpp
  lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
  lldb/trunk/tools/driver/Platform.h
  lldb/trunk/tools/lldb-vscode/VSCode.cpp
  lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/trunk/source/Host/windows/FileSystem.cpp
===
--- lldb/trunk/source/Host/windows/FileSystem.cpp
+++ lldb/trunk/source/Host/windows/FileSystem.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Host/windows/windows.h"
 
+#include 
 #include 
 #include 
 #include 
Index: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
===
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
@@ -25,6 +25,7 @@
 #if defined(_WIN32)
 #include "Plugins/Process/Windows/Common/ProcessWindowsLog.h"
 #include "lldb/Host/windows/windows.h"
+#include 
 #endif
 
 #include "llvm/Support/TargetSelect.h"
Index: lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp
@@ -50,7 +50,9 @@
 #include "VSCode.h"
 
 #if defined(_WIN32)
+#ifndef PATH_MAX
 #define PATH_MAX MAX_PATH
+#endif
 typedef int socklen_t;
 constexpr const char *dev_null_path = "nul";
 
Index: lldb/trunk/tools/lldb-vscode/VSCode.cpp
===
--- lldb/trunk/tools/lldb-vscode/VSCode.cpp
+++ lldb/trunk/tools/lldb-vscode/VSCode.cpp
@@ -15,8 +15,10 @@
 #include "llvm/Support/FormatVariadic.h"
 
 #if defined(_WIN32)
+#ifndef __MINGW32__
 #define NOMINMAX
 #include 
+#endif // __MINGW32__
 #include 
 #include 
 #endif
Index: lldb/trunk/tools/driver/Platform.h
===
--- lldb/trunk/tools/driver/Platform.h
+++ lldb/trunk/tools/driver/Platform.h
@@ -15,6 +15,9 @@
 #if defined(_MSC_VER)
 #include 
 #endif
+#if HAVE_SYS_TYPES_H
+#include 
+#endif
 #include "lldb/Host/windows/windows.h"
 #include 
 
Index: lldb/trunk/include/lldb/Host/windows/PosixApi.h
===
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h
@@ -45,6 +45,15 @@
 #define S_IRWXG 0
 #define S_IRWXO 0
 
+#ifdef __MINGW32__
+// pyconfig.h typedefs this.  We require python headers to be included before
+// any LLDB headers, but there's no way to prevent python's pid_t definition
+// from leaking, so this is the best option.
+#ifndef NO_PID_T
+#include 
+#endif
+#endif // __MINGW32__
+
 #ifdef _MSC_VER
 
 // PRIxxx format macros for printf()
@@ -80,12 +89,16 @@
 char *strcasestr(const char *s, const char *find);
 char *realpath(const char *name, char *resolved);
 
+#ifdef _MSC_VER
+
 char *basename(char *path);
 char *dirname(char *path);
 
 int strcasecmp(const char *s1, const char *s2);
 int strncasecmp(const char *s1, const char *s2, size_t n);
 
+#endif // _MSC_VER
+
 // empty functions
 inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
hhb added a reviewer: labath.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.

After rL368069  I noticed that 
HAVE_SYS_TYPES_H is not defined in
Platform.h, or anywhere else in lldb. This change fixes that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65822

Files:
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/tools/driver/Platform.h

Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
@@ -14,6 +16,8 @@
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,9 +6,13 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -6,9 +6,13 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -6,9 +6,13 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 #include 
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb added a comment.

I'm not really know how this works before, given no one includes Config.h. Or 
maybe sys/types.h is never needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822



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


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 213688.
hhb added a comment.

Remove test code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822

Files:
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/tools/driver/Platform.h


Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 
//===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,6 +6,8 @@
 //
 
//===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 
//===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
 //
 
//===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)


Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--

[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 213687.
hhb added a comment.

Remove a test code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822

Files:
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/tools/driver/Platform.h

Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
@@ -14,6 +16,8 @@
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,9 +6,13 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -6,9 +6,13 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
+#else
+static_assert(false, "");
 #endif
 
 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 213689.
hhb added a comment.
Herald added a subscriber: mstorsjo.

Add one more place


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822

Files:
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/include/lldb/Host/windows/PosixApi.h
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/tools/driver/Platform.h

Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/include/lldb/Host/windows/PosixApi.h
===
--- lldb/include/lldb/Host/windows/PosixApi.h
+++ lldb/include/lldb/Host/windows/PosixApi.h
@@ -9,6 +9,7 @@
 #ifndef liblldb_Host_windows_PosixApi_h
 #define liblldb_Host_windows_PosixApi_h
 
+#include "lldb/Host/Config.h"
 #include "llvm/Support/Compiler.h"
 #if !defined(_WIN32)
 #error "windows/PosixApi.h being #included on non Windows system!"
@@ -45,7 +46,7 @@
 #define S_IRWXG 0
 #define S_IRWXO 0
 
-#ifdef __MINGW32__
+#if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before
 // any LLDB headers, but there's no way to prevent python's pid_t definition
 // from leaking, so this is the best option.
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Stephen Hines via Phabricator via lldb-commits
srhines added inline comments.



Comment at: lldb/include/lldb/Host/windows/PosixApi.h:56
 #endif
 #endif // __MINGW32__
 

Update comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822



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


[Lldb-commits] [lldb] r368075 - [SymbolFile] Remove commented out method

2019-08-06 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Aug  6 12:47:08 2019
New Revision: 368075

URL: http://llvm.org/viewvc/llvm-project?rev=368075&view=rev
Log:
[SymbolFile] Remove commented out method

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=368075&r1=368074&r2=368075&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Tue Aug  6 
12:47:08 2019
@@ -835,204 +835,3 @@ void DWARFDebugLine::State::Finalize(dw_
 callback(offset, *this, callbackUserData);
 }
 
-// void
-// DWARFDebugLine::AppendLineTableData
-//(
-//  const DWARFDebugLine::Prologue* prologue,
-//  const DWARFDebugLine::Row::collection& state_coll,
-//  const uint32_t addr_size,
-//  BinaryStreamBuf &debug_line_data
-//)
-//{
-//  if (state_coll.empty())
-//  {
-//  // We have no entries, just make an empty line table
-//  debug_line_data.Append8(0);
-//  debug_line_data.Append8(1);
-//  debug_line_data.Append8(DW_LNE_end_sequence);
-//  }
-//  else
-//  {
-//  DWARFDebugLine::Row::const_iterator pos;
-//  Row::const_iterator end = state_coll.end();
-//  bool default_is_stmt = prologue->default_is_stmt;
-//  const DWARFDebugLine::Row reset_state(default_is_stmt);
-//  const DWARFDebugLine::Row* prev_state = &reset_state;
-//  const int32_t max_line_increment_for_special_opcode =
-//  prologue->MaxLineIncrementForSpecialOpcode();
-//  for (pos = state_coll.begin(); pos != end; ++pos)
-//  {
-//  const DWARFDebugLine::Row& curr_state = *pos;
-//  int32_t line_increment  = 0;
-//  dw_addr_t addr_offset   = curr_state.address - prev_state->address;
-//  dw_addr_t addr_advance  = (addr_offset) / 
prologue->min_inst_length;
-//  line_increment = (int32_t)(curr_state.line - prev_state->line);
-//
-//  // If our previous state was the reset state, then let's emit the
-//  // address to keep GDB's DWARF parser happy. If we don't start each
-//  // sequence with a DW_LNE_set_address opcode, the line table won't
-//  // get slid properly in GDB.
-//
-//  if (prev_state == &reset_state)
-//  {
-//  debug_line_data.Append8(0); // Extended opcode
-//  debug_line_data.Append32_as_ULEB128(addr_size + 1); // Length 
of
-//  opcode bytes
-//  debug_line_data.Append8(DW_LNE_set_address);
-//  debug_line_data.AppendMax64(curr_state.address, addr_size);
-//  addr_advance = 0;
-//  }
-//
-//  if (prev_state->file != curr_state.file)
-//  {
-//  debug_line_data.Append8(DW_LNS_set_file);
-//  debug_line_data.Append32_as_ULEB128(curr_state.file);
-//  }
-//
-//  if (prev_state->column != curr_state.column)
-//  {
-//  debug_line_data.Append8(DW_LNS_set_column);
-//  debug_line_data.Append32_as_ULEB128(curr_state.column);
-//  }
-//
-//  // Don't do anything fancy if we are at the end of a sequence
-//  // as we don't want to push any extra rows since the
-//  DW_LNE_end_sequence
-//  // will push a row itself!
-//  if (curr_state.end_sequence)
-//  {
-//  if (line_increment != 0)
-//  {
-//  debug_line_data.Append8(DW_LNS_advance_line);
-//  debug_line_data.Append32_as_SLEB128(line_increment);
-//  }
-//
-//  if (addr_advance > 0)
-//  {
-//  debug_line_data.Append8(DW_LNS_advance_pc);
-//  debug_line_data.Append32_as_ULEB128(addr_advance);
-//  }
-//
-//  // Now push the end sequence on!
-//  debug_line_data.Append8(0);
-//  debug_line_data.Append8(1);
-//  debug_line_data.Append8(DW_LNE_end_sequence);
-//
-//  prev_state = &reset_state;
-//  }
-//  else
-//  {
-//  if (line_increment || addr_advance)
-//  {
-//  if (line_increment > max_line_increment_for_special_opcode)
-//  {
-//  debug_line_data.Append8(DW_LNS_advance_line);
-//  debug_line_data.Append32_as_SLEB128(line_increment);
-//  line_increment = 0;
-//  }
-//
-//  uint32_t special_opcode = (line_increment >=
-//  prologue->line_base) ? ((line_increment -
-//  prologue->line_base) + (prologue->line_range * 
addr_advance)
-//

[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd added inline comments.



Comment at: lldb/cmake/modules/LLDBStandalone.cmake:6
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")

sgraenitz wrote:
> compnerd wrote:
> > What happens in the standalone clang build scenario?  Can I ask what is the 
> > motivation for this change?  I think it is better to require that the user 
> > pass the path, as that is an explicit dependency of LLDB.
> I don't think there's any side-effects on Clang standalone builds. Is that 
> what you mean with "standalone clang build scenario"?
> 
> I would like top prevent people from writing custom build scripts on top of 
> CMake. Passing a number of very similar paths to CMake, e.g. each time we 
> want to generate a Xcode project for development, this option seems to become 
> compelling quickly. This patch makes standalone configurations simpler. 
> Basically, it provides a default value. I doesn't cut down functionality.
> 
> You can still explicitly pass any path you want. This branch will then not be 
> taken.
I think that the build fragmentation has caused a larger problem, and I would 
like to avoid that.  The standalone build scenario is:

build/llvm
build/clang
build/lldb

In this case, `../clang` does not exist (`../../clang/lib/cmake/clang` does).  
I think what I would suggest instead is adding a cache file that has the 
configuration parameters setup already.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65798



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


[Lldb-commits] [PATCH] D65611: [Driver] Expand the executable path in the target create output

2019-08-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I am fine with full path as long as argv[0] still behaves correctly.


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

https://reviews.llvm.org/D65611



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


[Lldb-commits] [lldb] r368082 - [lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode

2019-08-06 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Aug  6 13:25:02 2019
New Revision: 368082

URL: http://llvm.org/viewvc/llvm-project?rev=368082&view=rev
Log:
[lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode

Modified:
lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h

Modified: lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h?rev=368082&r1=368081&r2=368082&view=diff
==
--- lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h Tue Aug  6 
13:25:02 2019
@@ -17,20 +17,27 @@
 namespace lldb_private {
 
 class ExpressionSourceCode {
+protected:
+  enum Wrapping : bool {
+Wrap = true,
+NoWrap = false,
+  };
+
 public:
-  bool NeedsWrapping() const { return m_wrap; }
+  bool NeedsWrapping() const { return m_wrap == Wrap; }
 
   const char *GetName() const { return m_name.c_str(); }
 
 protected:
-  ExpressionSourceCode(const char *name, const char *prefix, const char *body,
-   bool wrap)
-  : m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
+  ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
+   llvm::StringRef body, Wrapping wrap)
+  : m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
+m_wrap(wrap) {}
 
   std::string m_name;
   std::string m_prefix;
   std::string m_body;
-  bool m_wrap;
+  Wrapping m_wrap;
 };
 
 } // namespace lldb_private

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h?rev=368082&r1=368081&r2=368082&view=diff
==
--- 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h 
(original)
+++ 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h 
Tue Aug  6 13:25:02 2019
@@ -25,9 +25,9 @@ class ClangExpressionSourceCode : public
 public:
   static const char *g_expression_prefix;
 
-  static ClangExpressionSourceCode *CreateWrapped(const char *prefix,
- const char *body) {
-return new ClangExpressionSourceCode("$__lldb_expr", prefix, body, true);
+  static ClangExpressionSourceCode *CreateWrapped(llvm::StringRef prefix,
+  llvm::StringRef body) {
+return new ClangExpressionSourceCode("$__lldb_expr", prefix, body, Wrap);
   }
 
   /// Generates the source code that will evaluate the expression.
@@ -59,9 +59,9 @@ public:
 size_t &start_loc, size_t &end_loc);
 
 protected:
-  ClangExpressionSourceCode(const char *name, const char *prefix, const char 
*body,
-   bool wrap) :
-  ExpressionSourceCode(name, prefix, body, wrap) {}
+  ClangExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
+llvm::StringRef body, Wrapping wrap)
+  : ExpressionSourceCode(name, prefix, body, wrap) {}
 };
 
 } // namespace lldb_private


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


[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries to lldb.

2019-08-06 Thread Erik Chen via Phabricator via lldb-commits
erikchen created this revision.
erikchen added a reviewer: rnk.
Herald added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, abidh, mgrang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLDB.

When ld64 links a binary deterministically using the flag ZERO_AR_DATE, it sets

  a timestamp of 0 for N_OSO members in the symtab section, rather than the 
usual
  last modified date of the object file. Prior to this patch, lldb would compare
  the timestamp from the N_OSO member against the last modified date of the 
object
  file, and skip loading the object file if there was a mismatch. This patch
  updates the logic to ignore the timestamp check if the N_OSO member has
  timestamp 0.
  
  The original logic was added in https://reviews.llvm.org/rL181631 as a safety
  check to avoid problems when debugging if the object file was out of date. 
This
  was prior to the introduction of deterministic build in ld64. lld still 
doesn't
  support deterministic build.
  
  Other code in llvm already relies on and uses the assumption that a timestamp 
of
  0 means deterministic build. For example, commit
  9ccfddc39d4d27f9b16fcc72ab30d483151d6d08 adds similar timestamp checking logic
  to dsymutil, but special cases timestamp 0. Likewise, commit
  0d1bb79a0413f221432a7b1d0d2d10c84c4bbb99 adds a long comment describing
  deterministic archive, which mostly uses timestamp 0 for determinism.
  
  To test this code, run:
  ```
  // example.cc
  int main() { return 0; }
  
  clang -c -g example.cc -o example.o
  ZERO_AR_DATE=1 clang -g example.o -o example
  lldb example
  break main
  run
  ```
  
  This should correctly load the object file symbols.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65826

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -420,7 +420,11 @@
 // than the one from the CU.
 auto oso_mod_time = std::chrono::time_point_cast(
 FileSystem::Instance().GetModificationTime(oso_file));
-if (oso_mod_time != comp_unit_info->oso_mod_time) {
+// A timestamp of 0 means that the linker was in deterministic mode. In
+// that case, we should skip the check against the filesystem last
+// modification timestamp, since it will never match.
+if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
+oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
   "%s, debug map time is %s"


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -420,7 +420,11 @@
 // than the one from the CU.
 auto oso_mod_time = std::chrono::time_point_cast(
 FileSystem::Instance().GetModificationTime(oso_file));
-if (oso_mod_time != comp_unit_info->oso_mod_time) {
+// A timestamp of 0 means that the linker was in deterministic mode. In
+// that case, we should skip the check against the filesystem last
+// modification timestamp, since it will never match.
+if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
+oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
   "%s, debug map time is %s"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 213703.
teemperor added a comment.

- Addressed feedback.


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

https://reviews.llvm.org/D65646

Files:
  clang/include/clang/Basic/DiagnosticOptions.def
  clang/lib/Frontend/TextDiagnostic.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/TestExprDiagnostics.py
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/main.cpp
  lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -15,6 +15,7 @@
 #include "ASTStructExtractor.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
+#include "ClangExpressionSourceCode.h"
 #include "ClangExpressionVariable.h"
 #include "IRForTarget.h"
 
@@ -213,6 +214,10 @@
   /// were not able to calculate this position.
   llvm::Optional m_user_expression_start_pos;
   ResultDelegate m_result_delegate;
+  ClangPersistentVariables *m_clang_state;
+  std::unique_ptr m_source_code;
+  /// File name used for the expression.
+  std::string m_filename;
 
   /// The object (if any) in which context the expression is evaluated.
   /// See the comment to `UserExpression::Evaluate` for details.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -21,7 +21,6 @@
 #include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
-#include "ClangExpressionSourceCode.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
 
@@ -330,6 +329,7 @@
 if (PersistentExpressionState *persistent_state =
 target->GetPersistentExpressionStateForLanguage(
 lldb::eLanguageTypeC)) {
+  m_clang_state = llvm::cast(persistent_state);
   m_result_delegate.RegisterPersistentState(persistent_state);
 } else {
   diagnostic_manager.PutString(
@@ -394,18 +394,18 @@
 DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
 std::vector modules_to_import, bool for_completion) {
 
+  m_filename = m_clang_state->GetNextExprFileName();
   std::string prefix = m_expr_prefix;
 
   if (m_options.GetExecutionPolicy() == eExecutionPolicyTopLevel) {
 m_transformed_text = m_expr_text;
   } else {
-std::unique_ptr source_code(
-ClangExpressionSourceCode::CreateWrapped(prefix.c_str(),
- m_expr_text.c_str()));
+m_source_code.reset(ClangExpressionSourceCode::CreateWrapped(
+m_filename, prefix.c_str(), m_expr_text.c_str()));
 
-if (!source_code->GetText(m_transformed_text, m_expr_lang,
-  m_in_static_method, exe_ctx, !m_ctx_obj,
-  for_completion, modules_to_import)) {
+if (!m_source_code->GetText(m_transformed_text, m_expr_lang,
+m_in_static_method, exe_ctx, !m_ctx_obj,
+for_completion, modules_to_import)) {
   diagnostic_manager.PutString(eDiagnosticSeverityError,
"couldn't construct expression body");
   return;
@@ -415,7 +415,7 @@
 // transformed code. We need this later for the code completion.
 std::size_t original_start;
 std::size_t original_end;
-bool found_bounds = source_code->GetOriginalBodyBounds(
+bool found_bounds = m_source_code->GetOriginalBodyBounds(
 m_transformed_text, m_expr_lang, original_start, original_end);
 if (found_bounds)
   m_user_expression_start_pos = original_start;
@@ -570,7 +570,7 @@
   // parser_sp will never be empty.
 
   ClangExpressionParser parser(exe_scope, *this, generate_debug_info,
-   m_include_directories);
+   m_include_directories, m_filename);
 
   unsigned num_errors = parser.Parse(diagnostic_manager);
 
@@ -583,8

[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

2019-08-06 Thread Reid Kleckner via Phabricator via lldb-commits
rnk added a comment.

Code seems fine, I think this is probably the right fix, but this probably 
deserves a test along the lines of what's in the commit message. I'm not 
familiar with LLDB's test suite, so I can't give much guidance there.

Let's see if @JDevlieghere has input.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65826



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


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor marked 4 inline comments as done.
teemperor added a comment.

Fixed some of the unrelated comments in a separate commit (that is already 
upstreamed).


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

https://reviews.llvm.org/D65646



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


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 213705.
teemperor added a comment.

- Addressed some feedback I forgot.


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

https://reviews.llvm.org/D65646

Files:
  clang/include/clang/Basic/DiagnosticOptions.def
  clang/lib/Frontend/TextDiagnostic.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/Makefile
  
lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/TestExprDiagnostics.py
  lldb/packages/Python/lldbsuite/test/expression_command/diagnostics/main.cpp
  lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -15,6 +15,7 @@
 #include "ASTStructExtractor.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
+#include "ClangExpressionSourceCode.h"
 #include "ClangExpressionVariable.h"
 #include "IRForTarget.h"
 
@@ -213,6 +214,10 @@
   /// were not able to calculate this position.
   llvm::Optional m_user_expression_start_pos;
   ResultDelegate m_result_delegate;
+  ClangPersistentVariables *m_clang_state;
+  std::unique_ptr m_source_code;
+  /// File name used for the expression.
+  std::string m_filename;
 
   /// The object (if any) in which context the expression is evaluated.
   /// See the comment to `UserExpression::Evaluate` for details.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -21,7 +21,6 @@
 #include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
-#include "ClangExpressionSourceCode.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
 
@@ -330,6 +329,7 @@
 if (PersistentExpressionState *persistent_state =
 target->GetPersistentExpressionStateForLanguage(
 lldb::eLanguageTypeC)) {
+  m_clang_state = llvm::cast(persistent_state);
   m_result_delegate.RegisterPersistentState(persistent_state);
 } else {
   diagnostic_manager.PutString(
@@ -394,18 +394,18 @@
 DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
 std::vector modules_to_import, bool for_completion) {
 
+  m_filename = m_clang_state->GetNextExprFileName();
   std::string prefix = m_expr_prefix;
 
   if (m_options.GetExecutionPolicy() == eExecutionPolicyTopLevel) {
 m_transformed_text = m_expr_text;
   } else {
-std::unique_ptr source_code(
-ClangExpressionSourceCode::CreateWrapped(prefix.c_str(),
- m_expr_text.c_str()));
+m_source_code.reset(ClangExpressionSourceCode::CreateWrapped(
+m_filename, prefix.c_str(), m_expr_text.c_str()));
 
-if (!source_code->GetText(m_transformed_text, m_expr_lang,
-  m_in_static_method, exe_ctx, !m_ctx_obj,
-  for_completion, modules_to_import)) {
+if (!m_source_code->GetText(m_transformed_text, m_expr_lang,
+m_in_static_method, exe_ctx, !m_ctx_obj,
+for_completion, modules_to_import)) {
   diagnostic_manager.PutString(eDiagnosticSeverityError,
"couldn't construct expression body");
   return;
@@ -415,7 +415,7 @@
 // transformed code. We need this later for the code completion.
 std::size_t original_start;
 std::size_t original_end;
-bool found_bounds = source_code->GetOriginalBodyBounds(
+bool found_bounds = m_source_code->GetOriginalBodyBounds(
 m_transformed_text, m_expr_lang, original_start, original_end);
 if (found_bounds)
   m_user_expression_start_pos = original_start;
@@ -570,7 +570,7 @@
   // parser_sp will never be empty.
 
   ClangExpressionParser parser(exe_scope, *this, generate_debug_info,
-   m_include_directories);
+   m_include_directories, m_filename);
 
   unsigned num_errors = parser.Parse(diagnostic_manager

[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

I agree with Reid, change looks fine but this definitely needs a test.

The Python-style tests in `packages/Python/lldbsuite/test` give you the most 
freedom as they use makefiles to build inferiors, but a lit test might be 
easier and less boilerplate.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D65826



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


[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added inline comments.



Comment at: lldb/cmake/modules/LLDBStandalone.cmake:6
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")

compnerd wrote:
> sgraenitz wrote:
> > compnerd wrote:
> > > What happens in the standalone clang build scenario?  Can I ask what is 
> > > the motivation for this change?  I think it is better to require that the 
> > > user pass the path, as that is an explicit dependency of LLDB.
> > I don't think there's any side-effects on Clang standalone builds. Is that 
> > what you mean with "standalone clang build scenario"?
> > 
> > I would like top prevent people from writing custom build scripts on top of 
> > CMake. Passing a number of very similar paths to CMake, e.g. each time we 
> > want to generate a Xcode project for development, this option seems to 
> > become compelling quickly. This patch makes standalone configurations 
> > simpler. Basically, it provides a default value. I doesn't cut down 
> > functionality.
> > 
> > You can still explicitly pass any path you want. This branch will then not 
> > be taken.
> I think that the build fragmentation has caused a larger problem, and I would 
> like to avoid that.  The standalone build scenario is:
> 
> build/llvm
> build/clang
> build/lldb
> 
> In this case, `../clang` does not exist (`../../clang/lib/cmake/clang` does). 
>  I think what I would suggest instead is adding a cache file that has the 
> configuration parameters setup already.
For the scenario you describe, can you point me to any documentation that 
describes it or a bot that builds it?

> I think what I would suggest instead is adding a cache file that has the 
> configuration parameters setup already.

How would your cache file look like?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65798



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


[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

LGTM, but you might want to have someone with more functional knowledge give 
the go-ahead.


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

https://reviews.llvm.org/D65646



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


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 213726.
hhb added a comment.

Fix comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822

Files:
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/include/lldb/Host/Config.h.cmake
  lldb/include/lldb/Host/windows/PosixApi.h
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/tools/driver/Platform.h

Index: lldb/tools/driver/Platform.h
===
--- lldb/tools/driver/Platform.h
+++ lldb/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UtilityFunction.cpp
===
--- lldb/source/Expression/UtilityFunction.cpp
+++ lldb/source/Expression/UtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/source/Expression/UserExpression.cpp
===
--- lldb/source/Expression/UserExpression.cpp
+++ lldb/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/include/lldb/Host/windows/PosixApi.h
===
--- lldb/include/lldb/Host/windows/PosixApi.h
+++ lldb/include/lldb/Host/windows/PosixApi.h
@@ -9,6 +9,7 @@
 #ifndef liblldb_Host_windows_PosixApi_h
 #define liblldb_Host_windows_PosixApi_h
 
+#include "lldb/Host/Config.h"
 #include "llvm/Support/Compiler.h"
 #if !defined(_WIN32)
 #error "windows/PosixApi.h being #included on non Windows system!"
@@ -45,14 +46,14 @@
 #define S_IRWXG 0
 #define S_IRWXO 0
 
-#ifdef __MINGW32__
+#if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before
 // any LLDB headers, but there's no way to prevent python's pid_t definition
 // from leaking, so this is the best option.
 #ifndef NO_PID_T
 #include 
 #endif
-#endif // __MINGW32__
+#endif // HAVE_SYS_TYPES_H
 
 #ifdef _MSC_VER
 
Index: lldb/include/lldb/Host/Config.h.cmake
===
--- lldb/include/lldb/Host/Config.h.cmake
+++ lldb/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65566: [lldb][CMake] Workaround debugserver code-signing issue in generated Xcode project

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Okay, sounds like the best possible solution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65566



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


[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

2019-08-06 Thread Erik Chen via Phabricator via lldb-commits
erikchen added a comment.

Okay, this is ready for another round of review when you have time. Thanks :)


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

https://reviews.llvm.org/D65826



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


[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

2019-08-06 Thread Erik Chen via Phabricator via lldb-commits
erikchen updated this revision to Diff 213758.
erikchen added a comment.

Added a test.


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

https://reviews.llvm.org/D65826

Files:
  lldb/lit/SymbolFile/DWARF/Inputs/deterministic-build.lldbinit
  lldb/lit/SymbolFile/DWARF/deterministic-build.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -420,7 +420,11 @@
 // than the one from the CU.
 auto oso_mod_time = std::chrono::time_point_cast(
 FileSystem::Instance().GetModificationTime(oso_file));
-if (oso_mod_time != comp_unit_info->oso_mod_time) {
+// A timestamp of 0 means that the linker was in deterministic mode. In
+// that case, we should skip the check against the filesystem last
+// modification timestamp, since it will never match.
+if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
+oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
   "%s, debug map time is %s"
Index: lldb/lit/SymbolFile/DWARF/deterministic-build.cpp
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/deterministic-build.cpp
@@ -0,0 +1,10 @@
+// Test that binaries linked deterministically (N_OSO has timestamp 0) can 
still
+// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE
+// requires the ld64 linker, which clang invokes by default.
+// RUN: %clang %s -g -c -o %t.o
+// RUN: ZERO_AR_DATE=1 %clang %t.o -g -o %t
+// RUN: %lldb %t -s %S/Inputs/deterministic-build.lldbinit -o exit | FileCheck 
%s
+// CHECK: int main() { return 0; }
+
+
+int main() { return 0; }
Index: lldb/lit/SymbolFile/DWARF/Inputs/deterministic-build.lldbinit
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/Inputs/deterministic-build.lldbinit
@@ -0,0 +1,7 @@
+# We intentionally don't want to pick up too many lines of context, since the
+# test file is also the source file, and that will pick up comments from the
+# test file.
+settings set stop-line-count-before 0
+settings set stop-line-count-after 1
+breakpoint set -name main
+run


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -420,7 +420,11 @@
 // than the one from the CU.
 auto oso_mod_time = std::chrono::time_point_cast(
 FileSystem::Instance().GetModificationTime(oso_file));
-if (oso_mod_time != comp_unit_info->oso_mod_time) {
+// A timestamp of 0 means that the linker was in deterministic mode. In
+// that case, we should skip the check against the filesystem last
+// modification timestamp, since it will never match.
+if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
+oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
   "%s, debug map time is %s"
Index: lldb/lit/SymbolFile/DWARF/deterministic-build.cpp
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/deterministic-build.cpp
@@ -0,0 +1,10 @@
+// Test that binaries linked deterministically (N_OSO has timestamp 0) can still
+// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE
+// requires the ld64 linker, which clang invokes by default.
+// RUN: %clang %s -g -c -o %t.o
+// RUN: ZERO_AR_DATE=1 %clang %t.o -g -o %t
+// RUN: %lldb %t -s %S/Inputs/deterministic-build.lldbinit -o exit | FileCheck %s
+// CHECK: int main() { return 0; }
+
+
+int main() { return 0; }
Index: lldb/lit/SymbolFile/DWARF/Inputs/deterministic-build.lldbinit
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/Inputs/deterministic-build.lldbinit
@@ -0,0 +1,7 @@
+# We intentionally don't want to pick up too many lines of context, since the
+# test file is also the source file, and that will pick up comments from the
+# test file.
+settings set stop-line-count-before 0
+settings set stop-line-count-after 1
+breakpoint set -name main
+run
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/lit/SymbolFile/DWARF/deterministic-build.cpp:1
+// Test that binaries linked deterministically (N_OSO has timestamp 0) can 
still
+// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE

You'll want a `REQUIRES: system-darwin` here.



Comment at: lldb/lit/SymbolFile/DWARF/deterministic-build.cpp:6
+// RUN: ZERO_AR_DATE=1 %clang %t.o -g -o %t
+// RUN: %lldb %t -s %S/Inputs/deterministic-build.lldbinit -o exit | FileCheck 
%s
+// CHECK: int main() { return 0; }

If you check for `stop reason = breakpoint` instead of the source line, you 
don't have to work around the comments getting printed. You wouldn't even need 
an  input file anymore either.  

```
// RUN: %lldb %t -o "breakpoint set -name main" -o "run"  -o "exit" | FileCheck 
%s
// CHECK: stop reason = breakpoint
```


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

https://reviews.llvm.org/D65826



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


[Lldb-commits] [lldb] r368116 - [Gardening] Remove more dead code from IOHandler

2019-08-06 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug  6 18:50:03 2019
New Revision: 368116

URL: http://llvm.org/viewvc/llvm-project?rev=368116&view=rev
Log:
[Gardening] Remove more dead code from IOHandler

Remove more dead code and reformat the file.

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

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=368116&r1=368115&r2=368116&view=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Tue Aug  6 18:50:03 2019
@@ -382,7 +382,7 @@ bool IOHandlerEditline::GetLine(std::str
   if (GetLastError() == ERROR_OPERATION_ABORTED)
 continue;
 #else
-if (fgets(buffer, sizeof(buffer), in) == nullptr) {
+  if (fgets(buffer, sizeof(buffer), in) == nullptr) {
 #endif
   const int saved_errno = errno;
   if (feof(in))
@@ -949,11 +949,6 @@ public:
   }
   void PutChar(int ch) { ::waddch(m_window, ch); }
   void PutCString(const char *s, int len = -1) { ::waddnstr(m_window, s, len); 
}
-  void Refresh() { ::wrefresh(m_window); }
-  void DeferredRefresh() {
-// We are using panels, so we don't need to call this...
-//::wnoutrefresh(m_window);
-  }
   void SetBackground(int color_pair_idx) {
 ::wbkgd(m_window, COLOR_PAIR(color_pair_idx));
   }
@@ -1239,8 +1234,6 @@ public:
 
   void SetCanBeActive(bool b) { m_can_activate = b; }
 
-  const WindowDelegateSP &GetDelegate() const { return m_delegate_sp; }
-
   void SetDelegate(const WindowDelegateSP &delegate_sp) {
 m_delegate_sp = delegate_sp;
   }
@@ -1394,8 +1387,6 @@ public:
 
   std::string &GetName() { return m_name; }
 
-  std::string &GetKeyName() { return m_key_name; }
-
   int GetDrawWidth() const {
 return m_max_submenu_name_length + m_max_submenu_key_name_length + 8;
   }
@@ -1549,7 +1540,6 @@ bool Menu::WindowDelegateDraw(Window &wi
   menu->DrawMenuTitle(window, false);
 }
 window.PutCString(" |");
-window.DeferredRefresh();
   } break;
 
   case Menu::Type::Item: {
@@ -1572,7 +1562,6 @@ bool Menu::WindowDelegateDraw(Window &wi
   submenus[i]->DrawMenuTitle(window, is_selected);
 }
 window.MoveCursor(cursor_x, cursor_y);
-window.DeferredRefresh();
   } break;
 
   default:
@@ -1878,8 +1867,6 @@ public:
 return m_window_sp;
   }
 
-  WindowDelegates &GetWindowDelegates() { return m_window_delegates; }
-
 protected:
   WindowSP m_window_sp;
   WindowDelegates m_window_delegates;
@@ -1916,9 +1903,7 @@ struct Row {
 return 0;
   }
 
-  void Expand() {
-expanded = true;
-  }
+  void Expand() { expanded = true; }
 
   std::vector &GetChildren() {
 ProcessSP process_sp = value.GetProcessSP();
@@ -2273,8 +2258,6 @@ public:
   m_selected_item = nullptr;
 }
 
-window.DeferredRefresh();
-
 return true; // Drawing handled
   }
 
@@ -2624,14 +2607,12 @@ protected:
 class ValueObjectListDelegate : public WindowDelegate {
 public:
   ValueObjectListDelegate()
-  : m_rows(), m_selected_row(nullptr),
-m_selected_row_idx(0), m_first_visible_row(0), m_num_rows(0),
-m_max_x(0), m_max_y(0) {}
+  : m_rows(), m_selected_row(nullptr), m_selected_row_idx(0),
+m_first_visible_row(0), m_num_rows(0), m_max_x(0), m_max_y(0) {}
 
   ValueObjectListDelegate(ValueObjectList &valobj_list)
-  : m_rows(), m_selected_row(nullptr),
-m_selected_row_idx(0), m_first_visible_row(0), m_num_rows(0),
-m_max_x(0), m_max_y(0) {
+  : m_rows(), m_selected_row(nullptr), m_selected_row_idx(0),
+m_first_visible_row(0), m_num_rows(0), m_max_x(0), m_max_y(0) {
 SetValues(valobj_list);
   }
 
@@ -2674,8 +2655,6 @@ public:
 
 DisplayRows(window, m_rows, g_options);
 
-window.DeferredRefresh();
-
 // Get the selected row
 m_selected_row = GetRowForRowIndex(m_selected_row_idx);
 // Keep the cursor on the selected row so the highlight and the cursor are
@@ -3780,7 +3759,6 @@ public:
   window.Printf(" with status = %i", exit_status);
   }
 }
-window.DeferredRefresh();
 return true;
   }
 
@@ -4238,7 +4216,6 @@ public:
 }
   }
 }
-window.DeferredRefresh();
 return true; // Drawing handled
   }
 


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


[Lldb-commits] [lldb] r368118 - Upstream a few small Apple changes to debugserver - arm64_32, Catalyst

2019-08-06 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Aug  6 19:06:06 2019
New Revision: 368118

URL: http://llvm.org/viewvc/llvm-project?rev=368118&view=rev
Log:
Upstream a few small Apple changes to debugserver - arm64_32, Catalyst

Adrian's changes to support Catalyst processes and my
changes to support debugserver running on an arm64_32
device (Apple Watch Series 4, which uses an IPL32 model
on arm64 cpus).


Modified:
lldb/trunk/source/Target/TargetProperties.td
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/DNBDefs.h
lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/source/Target/TargetProperties.td
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetProperties.td?rev=368118&r1=368117&r2=368118&view=diff
==
--- lldb/trunk/source/Target/TargetProperties.td (original)
+++ lldb/trunk/source/Target/TargetProperties.td Tue Aug  6 19:06:06 2019
@@ -162,7 +162,7 @@ let Definition = "process" in {
 Desc<"Disable reading and caching of memory in fixed-size units.">;
   def ExtraStartCommand: Property<"extra-startup-command", "Array">,
 DefaultUnsignedValue<16>,
-Desc<"A list containing extra commands understood by the particular 
process plugin used.  For instance, to turn on debugserver logging set this to 
'QSetLogging:bitmask=LOG_DEFAULT;">;
+Desc<"A list containing extra commands understood by the particular 
process plugin used.  For instance, to turn on debugserver logging set this to 
'QSetLogging:bitmask=LOG_DEFAULT;'">;
   def IgnoreBreakpointsInExpressions: 
Property<"ignore-breakpoints-in-expressions", "Boolean">,
 Global,
 DefaultTrue,

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=368118&r1=368117&r2=368118&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Tue Aug  6 19:06:06 2019
@@ -1695,6 +1695,10 @@ bool DNBGetOSVersionNumbers(uint64_t *ma
   return MachProcess::GetOSVersionNumbers(major, minor, patch);
 }
 
+std::string DNBGetMacCatalystVersionString() {
+  return MachProcess::GetMacCatalystVersionString();
+}
+
 void DNBInitialize() {
   DNBLogThreadedIf(LOG_PROCESS, "DNBInitialize ()");
 #if defined(__i386__) || defined(__x86_64__)
@@ -1715,6 +1719,8 @@ nub_bool_t DNBSetArchitecture(const char
 else if ((strcasecmp(arch, "x86_64") == 0) ||
  (strcasecmp(arch, "x86_64h") == 0))
   return DNBArchProtocol::SetArchitecture(CPU_TYPE_X86_64);
+else if (strstr(arch, "arm64_32") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64_32);
 else if (strstr(arch, "arm64") == arch || strstr(arch, "armv8") == arch ||
  strstr(arch, "aarch64") == arch)
   return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64);

Modified: lldb/trunk/tools/debugserver/source/DNB.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.h?rev=368118&r1=368117&r2=368118&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.h (original)
+++ lldb/trunk/tools/debugserver/source/DNB.h Tue Aug  6 19:06:06 2019
@@ -20,6 +20,8 @@
 #include "MacOSX/ThreadInfo.h"
 #include 
 #include 
+#include 
+#include 
 
 #define DNB_EXPORT __attribute__((visibility("default")))
 
@@ -27,6 +29,10 @@
 #define CPU_TYPE_ARM64 ((cpu_type_t)12 | 0x0100)
 #endif
 
+#ifndef CPU_TYPE_ARM64_32
+#define CPU_TYPE_ARM64_32 ((cpu_type_t)12 | 0x0200)
+#endif
+
 typedef bool (*DNBShouldCancelCallback)(void *);
 
 void DNBInitialize();
@@ -226,5 +232,6 @@ const char *DNBStateAsString(nub_state_t
 nub_bool_t DNBResolveExecutablePath(const char *path, char *resolved_path,
 size_t resolved_path_size);
 bool DNBGetOSVersionNumbers(uint64_t *major, uint64_t *minor, uint64_t *patch);
-
+/// \return the iOSSupportVersion of the host OS.
+std::string DNBGetMacCatalystVersionString();
 #endif

Modified: lldb/trunk/tools/debugserver/source/DNBDefs.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBDefs.h?rev=368118&r1=368117&r2=368118&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNBDefs.h (original)
+++ lldb/trunk/tools/debugserver/source/DNBDefs.h Tue Aug  6 19:06:06 2019
@@ -341,6 

[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/cmake/modules/LLDBStandalone.cmake:6
+  # next to LLVM's module directory.
+  set(Clang_DIR ${LLVM_DIR}/../clang)
+  message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")

sgraenitz wrote:
> compnerd wrote:
> > sgraenitz wrote:
> > > compnerd wrote:
> > > > What happens in the standalone clang build scenario?  Can I ask what is 
> > > > the motivation for this change?  I think it is better to require that 
> > > > the user pass the path, as that is an explicit dependency of LLDB.
> > > I don't think there's any side-effects on Clang standalone builds. Is 
> > > that what you mean with "standalone clang build scenario"?
> > > 
> > > I would like top prevent people from writing custom build scripts on top 
> > > of CMake. Passing a number of very similar paths to CMake, e.g. each time 
> > > we want to generate a Xcode project for development, this option seems to 
> > > become compelling quickly. This patch makes standalone configurations 
> > > simpler. Basically, it provides a default value. I doesn't cut down 
> > > functionality.
> > > 
> > > You can still explicitly pass any path you want. This branch will then 
> > > not be taken.
> > I think that the build fragmentation has caused a larger problem, and I 
> > would like to avoid that.  The standalone build scenario is:
> > 
> > build/llvm
> > build/clang
> > build/lldb
> > 
> > In this case, `../clang` does not exist (`../../clang/lib/cmake/clang` 
> > does).  I think what I would suggest instead is adding a cache file that 
> > has the configuration parameters setup already.
> For the scenario you describe, can you point me to any documentation that 
> describes it or a bot that builds it?
> 
> > I think what I would suggest instead is adding a cache file that has the 
> > configuration parameters setup already.
> 
> How would your cache file look like?
> For the scenario you describe, can you point me to any documentation that 
> describes it or a bot that builds it?

I think a lot of linux distributions which want to provide llvm,clang,etc. as 
separate packages build in this way. And those that don't, they'd probably want 
to build it that way, but they can't do it because it doesn't work for them for 
one reason or another (the standalone builds are always a bit behind, because 
the devs usually just build everything monolithically). I know at least gentoo 
builds llvm, clang and lldb standalone. Maybe @mgorny has a better overview of 
what other distros do...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65798



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


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 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.

Woops, this is quite embarrassing. :/

One day we should audit these to check which of these files really needs to 
include this header, but since there are at least some files that definitely 
need it, adding the cmake check is the right way to go...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65822



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


[Lldb-commits] [PATCH] D65822: Detect HAVE_SYS_TYPES_H in lldb

2019-08-06 Thread Haibo Huang via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368125: Detect HAVE_SYS_TYPES_H in lldb (authored by hhb, 
committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65822?vs=213726&id=213796#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65822

Files:
  lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
  lldb/trunk/include/lldb/Host/Config.h.cmake
  lldb/trunk/include/lldb/Host/windows/PosixApi.h
  lldb/trunk/source/Expression/UserExpression.cpp
  lldb/trunk/source/Expression/UtilityFunction.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/trunk/tools/driver/Platform.h

Index: lldb/trunk/include/lldb/Host/windows/PosixApi.h
===
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h
@@ -9,6 +9,7 @@
 #ifndef liblldb_Host_windows_PosixApi_h
 #define liblldb_Host_windows_PosixApi_h
 
+#include "lldb/Host/Config.h"
 #include "llvm/Support/Compiler.h"
 #if !defined(_WIN32)
 #error "windows/PosixApi.h being #included on non Windows system!"
@@ -45,14 +46,14 @@
 #define S_IRWXG 0
 #define S_IRWXO 0
 
-#ifdef __MINGW32__
+#if HAVE_SYS_TYPES_H
 // pyconfig.h typedefs this.  We require python headers to be included before
 // any LLDB headers, but there's no way to prevent python's pid_t definition
 // from leaking, so this is the best option.
 #ifndef NO_PID_T
 #include 
 #endif
-#endif // __MINGW32__
+#endif // HAVE_SYS_TYPES_H
 
 #ifdef _MSC_VER
 
Index: lldb/trunk/include/lldb/Host/Config.h.cmake
===
--- lldb/trunk/include/lldb/Host/Config.h.cmake
+++ lldb/trunk/include/lldb/Host/Config.h.cmake
@@ -19,6 +19,8 @@
 
 #define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
 
+#cmakedefine01 HAVE_SYS_TYPES_H
+
 #cmakedefine01 HAVE_SYS_EVENT_H
 
 #cmakedefine01 HAVE_PPOLL
Index: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,7 @@
 check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
 
 check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
 check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include "ClangUtilityFunction.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/trunk/source/Expression/UtilityFunction.cpp
===
--- lldb/trunk/source/Expression/UtilityFunction.cpp
+++ lldb/trunk/source/Expression/UtilityFunction.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/trunk/source/Expression/UserExpression.cpp
===
--- lldb/trunk/source/Expression/UserExpression.cpp
+++ lldb/trunk/source/Expression/UserExpression.cpp
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+#include "lldb/Host/Config.h"
+
 #include 
 #if HAVE_SYS_TYPES_H
 #include 
Index: lldb/trunk/tools/driver/Platform.h
===
--- lldb/trunk/tools/driver/Platform.h
+++ lldb/trunk/tools/driver/Platform.h
@@ -9,6 +9,8 @@
 #ifndef lldb_Platform_h_
 #define lldb_Platform_h_
 
+#include "lldb/Host/Config.h"
+
 #if defined(_WIN32)
 
 #include 
___
lldb-commits mailing list
lldb-commits@lis

[Lldb-commits] [PATCH] D48704: [LLDB] Fix for "Bug 37950: ExecutionContext::GetByteOrder() always returns endian::InlHostByteOrder()"

2019-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 213797.
JDevlieghere added a comment.
Herald added a subscriber: mgorny.

Add unit test


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D48704

Files:
  lldb/source/Target/ExecutionContext.cpp
  lldb/unittests/Target/CMakeLists.txt
  lldb/unittests/Target/ExecutionContextTest.cpp

Index: lldb/unittests/Target/ExecutionContextTest.cpp
===
--- /dev/null
+++ lldb/unittests/Target/ExecutionContextTest.cpp
@@ -0,0 +1,125 @@
+//===-- ExecutionContextTest.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Target/ExecutionContext.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Platform.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/Reproducer.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-private.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+using namespace lldb_private::repro;
+using namespace lldb;
+
+class ExecutionContextTest : public ::testing::Test {
+public:
+  void SetUp() override {
+llvm::cantFail(Reproducer::Initialize(ReproducerMode::Off, llvm::None));
+FileSystem::Initialize();
+HostInfo::Initialize();
+platform_linux::PlatformLinux::Initialize();
+  }
+  void TearDown() override {
+HostInfo::Terminate();
+FileSystem::Terminate();
+Reproducer::Terminate();
+platform_linux::PlatformLinux::Terminate();
+  }
+};
+
+class DummyProcess : public Process {
+public:
+  using Process::Process;
+
+  virtual bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) {
+return true;
+  }
+  virtual Status DoDestroy() { return {}; }
+  virtual void RefreshStateAfterStop() {}
+
+  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+  Status &error) {
+return 0;
+  }
+
+  virtual bool UpdateThreadList(ThreadList &old_thread_list,
+ThreadList &new_thread_list) {
+return false;
+  }
+
+  virtual ConstString GetPluginName() { return ConstString("Dummy"); }
+  virtual uint32_t GetPluginVersion() { return 0; }
+};
+
+TEST_F(ExecutionContextTest, GetByteOrder) {
+  ExecutionContext exe_ctx(nullptr, nullptr, nullptr);
+  EXPECT_EQ(endian::InlHostByteOrder(), exe_ctx.GetByteOrder());
+}
+
+TEST_F(ExecutionContextTest, GetByteOrderTarget) {
+  ArchSpec arch = Target::GetDefaultArchitecture();
+  arch.SetTriple("armv7-pc-apple");
+
+  PlatformSP platform =
+  platform_linux::PlatformLinux::CreateInstance(true, &arch);
+  Platform::SetHostPlatform(platform);
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  EXPECT_TRUE(debugger_sp);
+
+  TargetSP target_sp;
+  PlatformSP platform_sp;
+  Status error = debugger_sp->GetTargetList().CreateTarget(
+  *debugger_sp, "", arch, eLoadDependentsNo, platform_sp, target_sp);
+  EXPECT_TRUE(target_sp);
+  EXPECT_TRUE(target_sp->GetArchitecture().IsValid());
+  EXPECT_TRUE(platform_sp);
+
+  ExecutionContext target_ctx(target_sp, false);
+  EXPECT_EQ(target_sp->GetArchitecture().GetByteOrder(),
+target_ctx.GetByteOrder());
+}
+
+TEST_F(ExecutionContextTest, GetByteOrderProcess) {
+  ArchSpec arch = Target::GetDefaultArchitecture();
+  arch.SetTriple("armv7-pc-apple");
+
+  PlatformSP platform =
+  platform_linux::PlatformLinux::CreateInstance(true, &arch);
+  Platform::SetHostPlatform(platform);
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  EXPECT_TRUE(debugger_sp);
+
+  TargetSP target_sp;
+  PlatformSP platform_sp;
+  Status error = debugger_sp->GetTargetList().CreateTarget(
+  *debugger_sp, "", arch, eLoadDependentsNo, platform_sp, target_sp);
+  EXPECT_TRUE(target_sp);
+  EXPECT_TRUE(target_sp->GetArchitecture().IsValid());
+  EXPECT_TRUE(platform_sp);
+
+  ListenerSP listener_sp(Listener::MakeListener("dummy"));
+  ProcessSP process_sp = std::make_shared(target_sp, listener_sp);
+  EXPECT_TRUE(process_sp);
+
+  ExecutionContext process_ctx(process_sp);
+  EXPECT_EQ(process_sp->GetByteOrder(), process_ctx.GetByteOrder());
+}
Index: lldb/unittests/Target/CMakeLists.txt
===
--- lldb/unittests/Target/CMakeLists.txt
+++ lldb/unittests/Target/CMakeLists.txt
@@ -1,4 +1,5 @

[Lldb-commits] [PATCH] D48704: [ExecutionContext] Return the target/process byte order.

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

Thanks for setting this up. The infrastructure is a bit overkill for a simple 
test like this, but hopefully this can be useful for other tests too. I have a 
bunch of comments, but hopefully none of them are major, so if you agree with 
all of them, just fire away..




Comment at: lldb/unittests/Target/ExecutionContextTest.cpp:40-43
+HostInfo::Terminate();
+FileSystem::Terminate();
+Reproducer::Terminate();
+platform_linux::PlatformLinux::Terminate();

call terminate in reverse order?



Comment at: lldb/unittests/Target/ExecutionContextTest.cpp:77
+TEST_F(ExecutionContextTest, GetByteOrderTarget) {
+  ArchSpec arch = Target::GetDefaultArchitecture();
+  arch.SetTriple("armv7-pc-apple");

I don't understand this.. Why do you fetch the ArchSpec via 
`Target::GetDefaultArchitecture()` and then immediately overwrite it on the 
next line? Can this line just be deleted?



Comment at: lldb/unittests/Target/ExecutionContextTest.cpp:78
+  ArchSpec arch = Target::GetDefaultArchitecture();
+  arch.SetTriple("armv7-pc-apple");
+

It looks weird to have an apple triple with a linux platform. I am assuming you 
use the linux platform because it can be compiled everywhere, but in that case, 
maybe you could use a linux triple too? Maybe also use a big-endian triple in 
one of the tests to catch regressions regardless of the endianness of the host?



Comment at: lldb/unittests/Target/ExecutionContextTest.cpp:85
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  EXPECT_TRUE(debugger_sp);
+

change EXPECT_TRUE to ASSERT_TRUE. There's no point in continuing the test if 
this is false, as it will just crash anyway...



Comment at: lldb/unittests/Target/ExecutionContextTest.cpp:124
+  ExecutionContext process_ctx(process_sp);
+  EXPECT_EQ(process_sp->GetByteOrder(), process_ctx.GetByteOrder());
+}

It doesn't look like the presence of a process will change what 
ExecutionContext::GetByteOrder returns, as it checks the target first. OTOH, I 
don't know why would the byte order of a process be ever different from the 
byte order of its target...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D48704



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