[Lldb-commits] [lldb] r361463 - Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

2019-05-23 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu May 23 01:00:49 2019
New Revision: 361463

URL: http://llvm.org/viewvc/llvm-project?rev=361463&view=rev
Log:
Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

In D61502#1503247 @clayborg suggested that DWARFUnit *+dw_offset_t can be now
replaced by DWARFDIE.

It is moved from DWARFDebugInfoEntry to DWARFDIE as noted by @clayborg.

I have also removed return type as (1) it was wrong in one case and (2) no
existing caller used the return type. I also refactored the deep nesting noted
by @JDevlieghere.

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

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp?rev=361463&r1=361462&r2=361463&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Thu May 23 01:00:49 
2019
@@ -182,6 +182,130 @@ const char *DWARFDIE::GetQualifiedName(s
 return nullptr;
 }
 
+// GetName
+//
+// Get value of the DW_AT_name attribute and place that value into the supplied
+// stream object. If the DIE is a NULL object "NULL" is placed into the stream,
+// and if no DW_AT_name attribute exists for the DIE then nothing is printed.
+void DWARFDIE::GetName(Stream &s) const {
+  if (!IsValid())
+return;
+  if (GetDIE()->IsNULL()) {
+s.PutCString("NULL");
+return;
+  }
+  const char *name = GetDIE()->GetAttributeValueAsString(GetCU(), DW_AT_name, 
nullptr, true);
+  if (!name)
+return;
+  s.PutCString(name);
+}
+
+// AppendTypeName
+//
+// Follows the type name definition down through all needed tags to end up with
+// a fully qualified type name and dump the results to the supplied stream.
+// This is used to show the name of types given a type identifier.
+void DWARFDIE::AppendTypeName(Stream &s) const {
+  if (!IsValid())
+return;
+  if (GetDIE()->IsNULL()) {
+s.PutCString("NULL");
+return;
+  }
+  if (const char *name = GetPubname()) {
+s.PutCString(name);
+return;
+  }
+  switch (Tag()) {
+  case DW_TAG_array_type:
+break; // print out a "[]" after printing the full type of the element
+   // below
+  case DW_TAG_base_type:
+s.PutCString("base ");
+break;
+  case DW_TAG_class_type:
+s.PutCString("class ");
+break;
+  case DW_TAG_const_type:
+s.PutCString("const ");
+break;
+  case DW_TAG_enumeration_type:
+s.PutCString("enum ");
+break;
+  case DW_TAG_file_type:
+s.PutCString("file ");
+break;
+  case DW_TAG_interface_type:
+s.PutCString("interface ");
+break;
+  case DW_TAG_packed_type:
+s.PutCString("packed ");
+break;
+  case DW_TAG_pointer_type:
+break; // print out a '*' after printing the full type below
+  case DW_TAG_ptr_to_member_type:
+break; // print out a '*' after printing the full type below
+  case DW_TAG_reference_type:
+break; // print out a '&' after printing the full type below
+  case DW_TAG_restrict_type:
+s.PutCString("restrict ");
+break;
+  case DW_TAG_set_type:
+s.PutCString("set ");
+break;
+  case DW_TAG_shared_type:
+s.PutCString("shared ");
+break;
+  case DW_TAG_string_type:
+s.PutCString("string ");
+break;
+  case DW_TAG_structure_type:
+s.PutCString("struct ");
+break;
+  case DW_TAG_subrange_type:
+s.PutCString("subrange ");
+break;
+  case DW_TAG_subroutine_type:
+s.PutCString("function ");
+break;
+  case DW_TAG_thrown_type:
+s.PutCString("thrown ");
+break;
+  case DW_TAG_union_type:
+s.PutCString("union ");
+break;
+  case DW_TAG_unspecified_type:
+s.PutCString("unspecified ");
+break;
+  case DW_TAG_volatile_type:
+s.PutCString("volatile ");
+break;
+  default:
+return;
+  }
+
+  // Follow the DW_AT_type if possible
+  if (DWARFDIE next_die = GetAttributeValueAsReferenceDIE(DW_AT_type))
+next_die.AppendTypeName(s);
+
+  switch (Tag()) {
+  case DW_TAG_array_type:
+s.PutCString("[]");
+break;
+  case DW_TAG_pointer_type:
+s.PutChar('*');
+break;
+  case DW_TAG_ptr_to_member_type:
+s.PutChar('*');
+break;
+  case DW_TAG_reference_type:
+s.PutChar('&');
+break;
+  default:
+break;
+  }
+}
+
 lldb_private::Type *DWARFDIE::ResolveType() const {
   if (IsValid())
 return GetDWARF()->ResolveType(*this, true);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h?rev=361463&r1=361462&r2=361463&view=diff
===

[Lldb-commits] [PATCH] D62211: Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

2019-05-23 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361463: Simplify `GetName`+`AppendTypeName` by `DWARFDIE` 
(authored by jankratochvil, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62211?vs=200769&id=200883#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62211

Files:
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -693,13 +693,13 @@
 DWARFDIE abstract_die = form_value.Reference();
 form_value.Dump(s);
 //  *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( ";
-GetName(abstract_die.GetCU(), abstract_die.GetOffset(), s);
+abstract_die.GetName(s);
   } break;
 
   case DW_AT_type: {
 DWARFDIE type_die = form_value.Reference();
 s.PutCString(" ( ");
-AppendTypeName(type_die.GetCU(), type_die.GetOffset(), s);
+type_die.AppendTypeName(s);
 s.PutCString(" )");
   } break;
 
@@ -1038,166 +1038,6 @@
   return name;
 }
 
-// GetName
-//
-// Get value of the DW_AT_name attribute for a debug information entry that
-// exists at offset "die_offset" and place that value into the supplied stream
-// object. If the DIE is a NULL object "NULL" is placed into the stream, and if
-// no DW_AT_name attribute exists for the DIE then nothing is printed.
-bool DWARFDebugInfoEntry::GetName(const DWARFUnit *cu,
-  const dw_offset_t die_offset, Stream &s) {
-  if (cu == NULL) {
-s.PutCString("NULL");
-return false;
-  }
-
-  DWARFDebugInfoEntry die;
-  lldb::offset_t offset = die_offset;
-  if (die.Extract(cu, &offset)) {
-if (die.IsNULL()) {
-  s.PutCString("NULL");
-  return true;
-} else {
-  const char *name =
-  die.GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
-  if (name) {
-s.PutCString(name);
-return true;
-  }
-}
-  }
-  return false;
-}
-
-// AppendTypeName
-//
-// Follows the type name definition down through all needed tags to end up with
-// a fully qualified type name and dump the results to the supplied stream.
-// This is used to show the name of types given a type identifier.
-bool DWARFDebugInfoEntry::AppendTypeName(const DWARFUnit *cu,
- const dw_offset_t die_offset,
- Stream &s) {
-  if (cu == NULL) {
-s.PutCString("NULL");
-return false;
-  }
-
-  DWARFDebugInfoEntry die;
-  lldb::offset_t offset = die_offset;
-  if (die.Extract(cu, &offset)) {
-if (die.IsNULL()) {
-  s.PutCString("NULL");
-  return true;
-} else {
-  const char *name = die.GetPubname(cu);
-  if (name)
-s.PutCString(name);
-  else {
-bool result = true;
-const DWARFAbbreviationDeclaration *abbrevDecl =
-die.GetAbbreviationDeclarationPtr(cu, offset);
-
-if (abbrevDecl == NULL)
-  return false;
-
-switch (abbrevDecl->Tag()) {
-case DW_TAG_array_type:
-  break; // print out a "[]" after printing the full type of the element
- // below
-case DW_TAG_base_type:
-  s.PutCString("base ");
-  break;
-case DW_TAG_class_type:
-  s.PutCString("class ");
-  break;
-case DW_TAG_const_type:
-  s.PutCString("const ");
-  break;
-case DW_TAG_enumeration_type:
-  s.PutCString("enum ");
-  break;
-case DW_TAG_file_type:
-  s.PutCString("file ");
-  break;
-case DW_TAG_interface_type:
-  s.PutCString("interface ");
-  break;
-case DW_TAG_packed_type:
-  s.PutCString("packed ");
-  break;
-case DW_TAG_pointer_type:
-  break; // print out a '*' after printing the full type below
-case DW_TAG_ptr_to_member_type:
-  break; // print out a '*' after printing the full type below
-case DW_TAG_reference_type:
-  break; // print out a '&' after printing the full type below
-case DW_TAG_restrict_type:
-  s.PutCString("restrict ");
-  break;
-case DW_TAG_set_type:
-  s.PutCString("set ");
-  break;
-case DW_TAG_shared_type:
-  s.PutCString("shared ");
-  break;
-case DW_TAG_string_type:
-  s.PutCString("string ");
-  break;
-case DW_TAG_structure_type:
-  s.PutCString("struct ");
-  break;
-case DW_TAG_subrange_type:
-  s.PutCS

[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py:585
+
+def g_returns_correct_data(self):
+procs = self.prep_debug_monitor_and_inferior()

guiandrade wrote:
> @labath, is it something like this you have in mind? If it is, where should 
> we add the file that contains the inferior that sets the registers?
Yes, that looks pretty much like what I had in mind. About the inferior, what I 
think we should do here is move this test into a separate subfolder. Then the 
test can have it's own Makefile, cpp file, etc..

If you need to share some code between this test and the new one, you can put 
the common stuff into `lldbgdbserverutils.py` or `gdbremote_testcase.py`. Or, 
if the only two tests using the common code are this one and the `p` test 
below, then maybe you can move the `p` test too, so that both register reading 
tests live together.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1912-1954
+  NativeRegisterContext ®_ctx = thread->GetRegisterContext();
+
+  // As the register offsets are not necessarily sorted,
+  // use a map to store all registers data.
+  std::map regs_buffer;
+  for (uint32_t reg_num = 0; reg_num < reg_ctx.GetUserRegisterCount();
+   ++reg_num) {

guiandrade wrote:
> labath wrote:
> > There's a `NativeRegisterContext::ReadAllRegisterValues` function. Can you 
> > check if that returns the data in the format that you need here?
> > 
> > Even if it doesn't, there's a good chance we could tweak it so that it 
> > does, as I believe it's now only used for implementing 
> > QSave/RestoreRegisterState, and the format we use for saving that is 
> > completely up to us.
> Apparently it is not:
> 
> [[ https://pastebin.com/raw/zFRQguQP | Reading each register individually ]] 
> [[ https://pastebin.com/raw/t8qJAJAE | Using reg_ctx.ReadAllRegisterValues(.) 
> ]].
> 
> Yeah, it would be convenient to be able to reuse that function, but then 
> wouldn't that involve modifying several ReadAllRegisterValues implementations 
> in order to do so?
Ok, I think i see what ReadAllRegisterValues is doing. Let's keep the 
implementation here then



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1916
+  // use a map to store all registers data.
+  std::map regs_buffer;
+  for (uint32_t reg_num = 0; reg_num < reg_ctx.GetUserRegisterCount();

You could just  use a `std::vector`, and memcpy data of each register 
into it (resizing as needed). Using a `std::map` for this thing seems pretty 
wasteful.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1946-1954
+  uint32_t next_pos = 0;
+  for (const auto &it : regs_buffer) {
+// Populate the gap between the last and the current position
+// with zeroes.
+while (next_pos++ < it.first)
+  response.PutHex8(0);
+

Then this would just be `response.PutBytesAsRawHex(vector.data(), 
vector.size())`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [lldb] r361465 - DWARF: Don't compute address ranges for type units

2019-05-23 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu May 23 02:07:51 2019
New Revision: 361465

URL: http://llvm.org/viewvc/llvm-project?rev=361465&view=rev
Log:
DWARF: Don't compute address ranges for type units

Summary:
Type units don't describe any code, so they should never be the result
of any address lookup queries.

Previously, we would compute the address ranges for the type units for
via the line tables they reference because the type units looked a lot
like line-tables-only compile units. However, this is not correct, as
the line tables are only referenced from type units so that other
declarations can use the file names contained in them.

In this patch I make the BuildAddressRangeTable function virtual, and
implement it only for compile units.

Testing this was a bit tricky, because the behavior depends on the order
in which we add things to the address range map. This rarely caused a
problem with DWARF v4 type units, as they are always added after all
CUs. It happened more frequently with DWARF v5, as there clang emits the
type units first. However, this is still not something that it is
required to do, so for testing I've created an assembly file where I've
deliberately sandwiched a compile unit between two type units, which
should isolate us from both changes in how the compiler emits the units
and changes in the order we process them.

Reviewers: clayborg, aprantl, JDevlieghere

Subscribers: jdoerfert, lldb-commits

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

Added:
lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Added: lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s?rev=361465&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s Thu May 23 
02:07:51 2019
@@ -0,0 +1,338 @@
+# Check address lookup works correctly in the presence of type units.
+# Specifically check that we don't use the line table pointed to by the
+# DW_AT_stmt_list of the type unit (which used only for the file names) to
+# compute address range for the type unit as type units don't describe any
+# addresses. The addresses should always resolve to the relevant compile units.
+
+# RUN: llvm-mc -dwarf-version=5 -triple x86_64-pc-linux %s -filetype=obj >%t.o
+# RUN: ld.lld %t.o -o %t -image-base=0x47000
+# RUN: %lldb %t -o "image lookup -a 0x48000 -v" -o exit | FileCheck %s
+
+# CHECK:   CompileUnit: id = {0x0001}, file = "/tmp/a.cc", language = "c++"
+# CHECK:  Function: id = {0x7fff006a}, name = "::_start({{.*}})", 
range = [0x00048000-0x0004800c)
+# CHECK: LineEntry: [0x00048000-0x0004800a): /tmp/a.cc:4
+# CHECK:Symbol: id = {0x0002}, range = 
[0x00048000-0x0004800c), name="_start"
+# CHECK:  Variable: id = {0x7fff0075}, name = "v1", {{.*}} decl = 
a.cc:4
+# CHECK:  Variable: id = {0x7fff0080}, name = "v2", {{.*}} decl = 
a.cc:4
+
+
+# Output generated via
+# clang -g -fdebug-types-section -gdwarf-5 -S
+# from
+# enum E1 { e1 };
+# enum E2 { e2 };
+# extern "C" void _start(E1 v1, E2 v2) {}
+# The output was modified to place the compile unit in between the two type
+# units.
+
+.text
+.file   "a.cc"
+.file   0 "/tmp" "a.cc"
+
+.text
+.globl  _start  # -- Begin function _start
+.p2align4, 0x90
+.type   _start,@function
+_start: # @_start
+.Lfunc_begin0:
+.loc0 4 0   # /tmp/a.cc:4:0
+.cfi_startproc
+# %bb.0:# %entry
+pushq   %rbp
+.cfi_def_cfa_offset 16
+.cfi_offset %rbp, -16
+movq%rsp, %rbp
+.cfi_def_cfa_register %rbp
+movl%edi, -4(%rbp)
+movl%esi, -8(%rbp)
+.Ltmp0:
+.loc0 4 23 prologue_end # /tmp/a.cc:4:23
+popq%rbp
+.cfi_def_cfa %rsp, 8
+retq
+.Ltmp1:
+.Lfunc_end0:
+.size   _start, .Lfunc_end0-_start
+.cfi_endproc
+# -- End function
+.section.debug_str_offsets,"",@progbits
+.long   52
+.short  5
+.short  0
+.Lstr_offsets_base0:
+.section.debug_str,"MS",@progbits,1
+.Linfo_string0:

[Lldb-commits] [PATCH] D62178: DWARF: Don't compute address ranges for type units

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361465: DWARF: Don't compute address ranges for type 
units (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/D62178/new/

https://reviews.llvm.org/D62178

Files:
  lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -7,7 +7,11 @@
 //===--===//
 
 #include "DWARFCompileUnit.h"
+#include "DWARFDebugAranges.h"
+#include "SymbolFileDWARFDebugMap.h"
 
+#include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Symbol/LineTable.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb;
@@ -20,3 +24,92 @@
 GetOffset(), GetLength(), GetVersion(), GetAbbrevOffset(),
 GetAddressByteSize(), GetNextUnitOffset());
 }
+
+void DWARFCompileUnit::BuildAddressRangeTable(
+DWARFDebugAranges *debug_aranges) {
+  // This function is usually called if there in no .debug_aranges section in
+  // order to produce a compile unit level set of address ranges that is
+  // accurate.
+
+  size_t num_debug_aranges = debug_aranges->GetNumRanges();
+
+  // First get the compile unit DIE only and check if it has a DW_AT_ranges
+  const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly();
+
+  const dw_offset_t cu_offset = GetOffset();
+  if (die) {
+DWARFRangeList ranges;
+const size_t num_ranges =
+die->GetAttributeAddressRanges(this, ranges, false);
+if (num_ranges > 0) {
+  // This compile unit has DW_AT_ranges, assume this is correct if it is
+  // present since clang no longer makes .debug_aranges by default and it
+  // emits DW_AT_ranges for DW_TAG_compile_units. GCC also does this with
+  // recent GCC builds.
+  for (size_t i = 0; i < num_ranges; ++i) {
+const DWARFRangeList::Entry &range = ranges.GetEntryRef(i);
+debug_aranges->AppendRange(cu_offset, range.GetRangeBase(),
+   range.GetRangeEnd());
+  }
+
+  return; // We got all of our ranges from the DW_AT_ranges attribute
+}
+  }
+  // We don't have a DW_AT_ranges attribute, so we need to parse the DWARF
+
+  // If the DIEs weren't parsed, then we don't want all dies for all compile
+  // units to stay loaded when they weren't needed. So we can end up parsing
+  // the DWARF and then throwing them all away to keep memory usage down.
+  ScopedExtractDIEs clear_dies(ExtractDIEsScoped());
+
+  die = DIEPtr();
+  if (die)
+die->BuildAddressRangeTable(this, debug_aranges);
+
+  if (debug_aranges->GetNumRanges() == num_debug_aranges) {
+// We got nothing from the functions, maybe we have a line tables only
+// situation. Check the line tables and build the arange table from this.
+SymbolContext sc;
+sc.comp_unit = m_dwarf->GetCompUnitForDWARFCompUnit(this);
+if (sc.comp_unit) {
+  SymbolFileDWARFDebugMap *debug_map_sym_file =
+  m_dwarf->GetDebugMapSymfile();
+  if (debug_map_sym_file == nullptr) {
+if (LineTable *line_table = sc.comp_unit->GetLineTable()) {
+  LineTable::FileAddressRanges file_ranges;
+  const bool append = true;
+  const size_t num_ranges =
+  line_table->GetContiguousFileAddressRanges(file_ranges, append);
+  for (uint32_t idx = 0; idx < num_ranges; ++idx) {
+const LineTable::FileAddressRanges::Entry &range =
+file_ranges.GetEntryRef(idx);
+debug_aranges->AppendRange(cu_offset, range.GetRangeBase(),
+   range.GetRangeEnd());
+  }
+}
+  } else
+debug_map_sym_file->AddOSOARanges(m_dwarf, debug_aranges);
+}
+  }
+
+  if (debug_aranges->GetNumRanges() == num_debug_aranges) {
+// We got nothing from the functions, maybe we have a line tables only
+// situation. Check the line tables and build the arange table from this.
+SymbolContext sc;
+sc.comp_unit = m_dwarf->GetCompUnitForDWARFCompUnit(this);
+if (sc.comp_unit) {
+  if (LineTable *line_table = sc.comp_unit->GetLineTable()) {
+LineTable::FileAddressRanges file_ra

[Lldb-commits] [lldb] r361481 - Add REQUIRES: lld to debug-types-address-ranges.s

2019-05-23 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu May 23 03:46:35 2019
New Revision: 361481

URL: http://llvm.org/viewvc/llvm-project?rev=361481&view=rev
Log:
Add REQUIRES: lld to debug-types-address-ranges.s

This should fix the green dragon bots.

Modified:
lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s

Modified: lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s?rev=361481&r1=361480&r2=361481&view=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-types-address-ranges.s Thu May 23 
03:46:35 2019
@@ -4,6 +4,8 @@
 # compute address range for the type unit as type units don't describe any
 # addresses. The addresses should always resolve to the relevant compile units.
 
+# REQUIRES: lld
+
 # RUN: llvm-mc -dwarf-version=5 -triple x86_64-pc-linux %s -filetype=obj >%t.o
 # RUN: ld.lld %t.o -o %t -image-base=0x47000
 # RUN: %lldb %t -o "image lookup -a 0x48000 -v" -o exit | FileCheck %s


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


[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

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

- implement the sugested changes (except the DenseMap part)
- fix a bug where we would enter an infinite recursion in case the type in the 
type unit ended up referring back to itself (and add a test). I do this by 
setting the DIE_IS_BEING_PARSED flag before doing the DW_AT_signature check 
(instead of at the beginning of each of the DW_TAG switch cases). This part 
changes the behavior slightly, because two of the switch cases did not set the 
DIE_IS_BEING_PARSED flag, but I believe this is actually for the better. In the 
DW_TAG_ptr_to_member case, I believe this is a bug, and could cause us to 
recurse infinitely in case of self-referring member pointer types (but I did 
not try to verify that). For the "default" case, this means that we will print 
the "unhandled type" warning only once for each DIE, which also sounds like a 
good thing.


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

https://reviews.llvm.org/D62246

Files:
  lit/SymbolFile/DWARF/Inputs/debug-types-basic.cpp
  lit/SymbolFile/DWARF/Inputs/debug-types-expressions.cpp
  lit/SymbolFile/DWARF/debug-types-basic.test
  lit/SymbolFile/DWARF/debug-types-expressions.test
  lit/SymbolFile/DWARF/debug-types-missing-signature.test
  lit/SymbolFile/DWARF/debug-types-signature-loop.s
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -41,6 +41,10 @@
   dw_offset_t m_abbr_offset = 0;
   uint8_t m_unit_type = 0;
   uint8_t m_addr_size = 0;
+
+  uint64_t m_type_hash = 0;
+  uint32_t m_type_offset = 0;
+
   uint64_t m_dwo_id = 0;
 
   DWARFUnitHeader() = default;
@@ -52,6 +56,8 @@
   dw_offset_t GetLength() const { return m_length; }
   dw_offset_t GetAbbrOffset() const { return m_abbr_offset; }
   uint8_t GetUnitType() const { return m_unit_type; }
+  uint64_t GetTypeHash() const { return m_type_hash; }
+  dw_offset_t GetTypeOffset() const { return m_type_offset; }
   bool IsTypeUnit() const {
 return m_unit_type == DW_UT_type || m_unit_type == DW_UT_split_type;
   }
@@ -205,6 +211,8 @@
 
   DIERef::Section GetDebugSection() const { return m_section; }
 
+  uint8_t GetUnitType() const { return m_header.GetUnitType(); }
+
 protected:
   DWARFUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
 const DWARFUnitHeader &header,
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -714,9 +714,16 @@
 section == DIERef::Section::DebugTypes ? DW_UT_type : DW_UT_compile;
   }
 
+  if (header.IsTypeUnit()) {
+header.m_type_hash = data.GetU64(offset_ptr);
+header.m_type_offset = data.GetDWARFOffset(offset_ptr);
+  }
+
   bool length_OK = data.ValidOffset(header.GetNextUnitOffset() - 1);
   bool version_OK = SymbolFileDWARF::SupportedVersion(header.m_version);
   bool addr_size_OK = (header.m_addr_size == 4) || (header.m_addr_size == 8);
+  bool type_offset_OK =
+  !header.IsTypeUnit() || (header.m_type_offset <= header.GetLength());
 
   if (!length_OK)
 return llvm::make_error(
@@ -727,6 +734,9 @@
   if (!addr_size_OK)
 return llvm::make_error(
 "Invalid unit address size");
+  if (!type_offset_OK)
+return llvm::make_error(
+"Type offset out of range");
 
   return header;
 }
Index: source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h
@@ -18,6 +18,14 @@
 
   void Dump(lldb_private::Stream *s) const override;
 
+  uint64_t GetTypeHash() { return m_header.GetTypeHash(); }
+
+  dw_offset_t GetTypeOffset() { return GetOffset() + m_header.GetTypeOffset(); }
+
+  static bool classof(const DWARFUnit *unit) {
+return unit->GetUnitType() == DW_UT_type;
+  }
+
 private:
   DWARFTypeUnit(SymbolFileDWARF *dwarf, lldb::user_id_t uid,
 const DWARFUnitHeader &header,
Index: source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp
@@ -14,7 +14,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-

[Lldb-commits] [PATCH] D62246: DWARF: Implement DW_AT_signature lookup for type unit support

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:255
 TypeList *type_list = dwarf->GetTypeList();
 if (type_ptr == NULL) {
+

aprantl wrote:
> Not your code, but it would be easier to follow the logic if we pulled these 
> cases up front:
> 
> ```
>   if (type_ptr == DIE_IS_BEING_PARSED)
>  return type_sp;
>   if (type_ptr)
>   return type_ptr->shared_from_this();
> ...
> ```
Done in r361471.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h:74
 
+  std::vector> m_type_hash_to_unit_index;
+

clayborg wrote:
> llvm::DenseMap?
A sorted vector is the [[ 
http://llvm.org/docs/ProgrammersManual.html#dss-sortedvectormap | recommended 
]] approach for sets and maps with an insert-then-query pattern. Also, a 
`DenseMap` would blow up if one of the type signatures happened to be 
`0xfff...f`.


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

https://reviews.llvm.org/D62246



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, aprantl, clayborg.
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:706-713
-  case DW_AT_ranges: {
-lldb::offset_t ranges_offset =
-GetRangesOffset(dwarf2Data->DebugRanges(), form_value);
-dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
-DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(),
-   &ranges_offset, base_addr);
-  } break;

This is dead dumping code, which wasn't even correct for DWARF5.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3240-3260
-if (form_value.Form() == DW_FORM_sec_offset) {
-  DWARFRangeList dwarf_scope_ranges;
-  const DWARFDebugRangesBase *debug_ranges = DebugRanges();
-  debug_ranges->FindRanges(die.GetCU(),
-   form_value.Unsigned(),
-   dwarf_scope_ranges);
-} else {

This is also effectively dead, as `scope_ranges` is not being initialized with 
anything. Furthermore, I can find no evidence of clang ever emitting the 
DW_AT_start_scope attribute.


debug_ranges got renamed to debug_rnglists in DWARF 5. Prior to this
patch lldb was just picking the first section it could find in the file,
and using that for all address ranges lookups. This is not correct in
case the file contains a mixture of compile units with various standard
versions (not a completely unlikely scenario).

In this patch I make lldb support reading from both sections
simulaneously, and decide the correct section to use based on the
version number of the compile unit. SymbolFileDWARF::DebugRanges is
split into GetDebugRanges and GetDebugRngLists (the first one is renamed
mainly so we can catch all incorrect usages).

I tried to structure the code similarly to how llvm handles this logic
(hence DWARFUnit::FindRnglistFromOffset/Index), but the implementations
are still relatively far from each other.


https://reviews.llvm.org/D62302

Files:
  lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -225,9 +225,8 @@
 
   const DWARFDebugInfo *DebugInfo() const;
 
-  DWARFDebugRangesBase *DebugRanges();
-
-  const DWARFDebugRangesBase *DebugRanges() const;
+  DWARFDebugRangesBase *GetDebugRanges();
+  DWARFDebugRangesBase *GetDebugRngLists();
 
   const lldb_private::DWARFDataExtractor &DebugLocData();
 
@@ -476,6 +475,7 @@
   typedef std::unordered_map NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;
+  std::unique_ptr m_rnglists;
   UniqueDWARFASTTypeMap m_unique_ast_type_map;
   DIEToTypePtr m_die_to_type;
   DIEToVariableSP m_die_to_variable_sp;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -359,7 +359,7 @@
   m_context(objfile->GetModule()->GetSectionList(), dwo_section_list),
   m_data_debug_loc(), m_data_debug_ranges(), m_data_debug_rnglists(),
   m_abbr(), m_info(), m_line(), m_fetched_external_modules(false),
-  m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate), m_ranges(),
+  m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate),
   m_unique_ast_type_map() {}
 
 SymbolFileDWARF::~SymbolFileDWARF() {}
@@ -619,16 +619,14 @@
   return nullptr;
 }
 
-DWARFDebugRangesBase *SymbolFileDWARF::DebugRanges() {
-  if (m_ranges == nullptr) {
+DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRanges() {
+  if (!m_ranges) {
 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
 Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
static_cast(this));
 
 if (get_debug_ranges_data().GetByteSize() > 0)
   m_ranges.reset(new DWARFDebugRanges());
-else if (get_debug_rnglists_data().GetByteSize() > 0)
-  m_ranges.reset(new DWARFDebugRngLists());
 
 if (m_ranges)
   m_ranges->Extract(this);
@@ -636,8 +634,19 @@
   return m_ranges.get();
 }
 
-const DWARFDebugRangesBase *SymbolFileDWARF::DebugRanges() const {
-  return m_ranges.get();
+DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRngLists() {
+  if (!m_rnglists) {
+static Timer::Category func_cat(LLVM_PR

[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:706-713
-  case DW_AT_ranges: {
-lldb::offset_t ranges_offset =
-GetRangesOffset(dwarf2Data->DebugRanges(), form_value);
-dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
-DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(),
-   &ranges_offset, base_addr);
-  } break;

This is dead dumping code, which wasn't even correct for DWARF5.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3240-3260
-if (form_value.Form() == DW_FORM_sec_offset) {
-  DWARFRangeList dwarf_scope_ranges;
-  const DWARFDebugRangesBase *debug_ranges = DebugRanges();
-  debug_ranges->FindRanges(die.GetCU(),
-   form_value.Unsigned(),
-   dwarf_scope_ranges);
-} else {

This is also effectively dead, as `scope_ranges` is not being initialized with 
anything. Furthermore, I can find no evidence of clang ever emitting the 
DW_AT_start_scope attribute.


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I've made this change because a windows build bot fails with this error:

  FAILED: tools/lldb/source/Core/CMakeFiles/lldbCore.dir/Debugger.cpp.obj
  
C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe
  /nologo /TP -DGTEST_HAS_RTTI=0 -DLLDB_CONFIGURATION_RELEASE 
-DLLDB_DISABLE_CURSES -DLLDB_DISABLE_LIBEDIT -DLLDB_PYTHON_HOME="\"C:/Program 
Files (x86)/Microsoft Visual Studio/Shared/Python36_64\"" -DUNICODE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS 
-D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_HAS_EXCEPTIONS=0 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools\lldb\source\Core 
-IE:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core 
-Itools\lldb\include 
-IE:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include -Iinclude 
-IE:\build_slave\lldb-x64-windows-ninja\llvm\include -I"C:\Program Files 
(x86)\Microsoft Visual Studio\Shared\Python36_64\Include" 
-IE:\build_slave\lldb-x64-windows-ninja\llvm\tools\clang\include 
-Itools\lldb\..\clang\include 
-IE:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\. /DWIN32 
/D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 -wd4141 
-wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4456 -wd4457 
-wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 
-wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 
-wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /MD /O2 
/Ob2 /DNDEBUG   -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530  
/EHs-c- /GR- /showIncludes 
/Fotools\lldb\source\Core\CMakeFiles\lldbCore.dir\Debugger.cpp.obj 
/Fdtools\lldb\source\Core\CMakeFiles\lldbCore.dir\lldbCore.pdb /FS -c 
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type

This is the failing build: 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62305

Files:
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return NULL;
 }
 
 bool Debugger::StartEventHandlerThread() {


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return NULL;
 }
 
 bool Debugger::StartEventHandlerThread() {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

returning `lldb::thread_result_t()` is probably the best thing to do here...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305



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


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 200951.
kwk added a comment.

Fixed second place where nullptr couldn't be converted


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305

Files:
  lldb/source/Core/Communication.cpp
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return NULL;
 }
 
 bool Debugger::StartEventHandlerThread() {
Index: lldb/source/Core/Communication.cpp
===
--- lldb/source/Core/Communication.cpp
+++ lldb/source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return NULL;
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return NULL;
 }
 
 bool Debugger::StartEventHandlerThread() {
Index: lldb/source/Core/Communication.cpp
===
--- lldb/source/Core/Communication.cpp
+++ lldb/source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return NULL;
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk added a comment.

In D62305#1513642 , @labath wrote:

> returning `lldb::thread_result_t()` is probably the best thing to do here...


@labath I've followed your advice. Running tests for linux now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305



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


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 200953.
kwk added a comment.

Return lldb::thread_result_t() instead of NULL


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305

Files:
  lldb/source/Core/Communication.cpp
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return lldb::thread_result_t();
 }
 
 bool Debugger::StartEventHandlerThread() {
Index: lldb/source/Core/Communication.cpp
===
--- lldb/source/Core/Communication.cpp
+++ lldb/source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return lldb::thread_result_t();
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return lldb::thread_result_t();
 }
 
 bool Debugger::StartEventHandlerThread() {
Index: lldb/source/Core/Communication.cpp
===
--- lldb/source/Core/Communication.cpp
+++ lldb/source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return lldb::thread_result_t();
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D62305#1513642 , @labath wrote:

> returning `lldb::thread_result_t()` is probably the best thing to do here...


I would say `return {};` is the best one, it has 118 uses in `lldb/`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305



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


[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62305#1513793 , @jankratochvil 
wrote:

> In D62305#1513642 , @labath wrote:
>
> > returning `lldb::thread_result_t()` is probably the best thing to do here...
>
>
> I would say `return {};` is the best one, it has 118 uses in `lldb/`.


Yeah, that works too...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Paul Robinson via Phabricator via lldb-commits
probinson added a comment.

Drive-by: For the "dead code" did you check whether gcc emits 
DW_AT_start_scope?  LLDB should support more than just what Clang emits.


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62302#1513824 , @probinson wrote:

> Drive-by: For the "dead code" did you check whether gcc emits 
> DW_AT_start_scope?  LLDB should support more than just what Clang emits.


I agree with that, but the fact that clang does not emit the attribute was not 
the reason why I called the code dead. It was the reason why I did not bother 
implementing it here. :)

The code is dead because it parses the ranges in the DW_AT_start_scope 
attribute, and then it just throws them away. What's missing is the part which 
converts this into the debug-format-agnostic form that the rest of lldb can use.


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

(and no, I didn't check whether gcc emits the attribute)


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-23 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Nice patch. See inlined comments.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:435-448
+  llvm::Expected expected_ranges =
+  (form_value.Form() == DW_FORM_rnglistx)
+  ? cu->FindRnglistFromIndex(form_value.Unsigned())
+  : cu->FindRnglistFromOffset(form_value.Unsigned());
+  if (expected_ranges)
+ranges = *expected_ranges;
   else

Seems like this code should be put into a method and used here.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:961-973
+llvm::Expected expected_ranges =
+(form_value.Form() == DW_FORM_rnglistx)
+? cu->FindRnglistFromIndex(form_value.Unsigned())
+: cu->FindRnglistFromOffset(form_value.Unsigned());
+if (expected_ranges)
+  ranges = *expected_ranges;
+else

Seems like this code should be put into a method and used here.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.h:208-216
+  /// Return a list of address ranges resulting from a (possibly encoded)
+  /// range list starting at a given offset in the appropriate ranges section.
+  llvm::Expected FindRnglistFromOffset(dw_offset_t offset) 
const;
+
+  /// Return a list of address ranges retrieved from an encoded range
+  /// list whose offset is found via a table lookup given an index (DWARF v5
+  /// and later).

Maybe just make one function here that takes a DWARFFormValue?:

```
llvm::Expected FindRnglistFromOffset(const DWARFFormValue 
&value) const;
```
Then it will clean up the code that calls it quite nicely.


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [PATCH] D62316: DWARFContext: Make loading of sections thread-safe

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: aprantl, JDevlieghere, clayborg.
Herald added a subscriber: arphaman.

SymbolFileDWARF used to load debug sections in a thread-safe manner.
When we moved to DWARFContext, we dropped the thread-safe part, because
we thought it was not necessary.

It turns out this was only mostly correct.

The "mostly" part is there because this is a problem only if we use the
manual index, as that is the only source of intra-module paralelism.
Also, this only seems to occur for extremely simple files (like the ones
I've been creating for tests lately), where we've managed to start
indexing before loading the debug_str section. Then, two threads start
to load the section simultaneously and produce wrong results.

On more complex files, something seems to be loading the debug_str section
before we start indexing, as I haven't been able to reproduce this
there, but I have not investigated what it is.

I've tried to come up with a test for this, but I haven't been able to
reproduce the problem reliably. Still, while doing so, I created a way
to generate many compile units on demand. Given that most of our tests
work with only one or two compile units, it seems like this could be
useful anyway.


https://reviews.llvm.org/D62316

Files:
  lit/SymbolFile/DWARF/parallel-indexing-stress.s
  source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
  source/Plugins/SymbolFile/DWARF/DWARFContext.h

Index: source/Plugins/SymbolFile/DWARF/DWARFContext.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFContext.h
+++ source/Plugins/SymbolFile/DWARF/DWARFContext.h
@@ -12,6 +12,7 @@
 #include "DWARFDataExtractor.h"
 #include "lldb/Core/Section.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/Support/Threading.h"
 #include 
 
 namespace lldb_private {
@@ -20,19 +21,29 @@
   SectionList *m_main_section_list;
   SectionList *m_dwo_section_list;
 
-  llvm::Optional m_data_debug_abbrev;
-  llvm::Optional m_data_debug_addr;
-  llvm::Optional m_data_debug_aranges;
-  llvm::Optional m_data_debug_info;
-  llvm::Optional m_data_debug_line;
-  llvm::Optional m_data_debug_line_str;
-  llvm::Optional m_data_debug_macro;
-  llvm::Optional m_data_debug_str;
-  llvm::Optional m_data_debug_str_offsets;
-  llvm::Optional m_data_debug_types;
+  struct SectionData {
+llvm::once_flag flag;
+DWARFDataExtractor data;
+  };
+
+  SectionData m_data_debug_abbrev;
+  SectionData m_data_debug_addr;
+  SectionData m_data_debug_aranges;
+  SectionData m_data_debug_info;
+  SectionData m_data_debug_line;
+  SectionData m_data_debug_line_str;
+  SectionData m_data_debug_macro;
+  SectionData m_data_debug_str;
+  SectionData m_data_debug_str_offsets;
+  SectionData m_data_debug_types;
 
   bool isDwo() { return m_dwo_section_list != nullptr; }
 
+  const DWARFDataExtractor &
+  LoadOrGetSection(lldb::SectionType main_section_type,
+   llvm::Optional dwo_section_type,
+   SectionData &data);
+
 public:
   explicit DWARFContext(SectionList *main_section_list,
 SectionList *dwo_section_list)
Index: source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -27,72 +27,66 @@
   return data;
 }
 
-static const DWARFDataExtractor &
-LoadOrGetSection(SectionList *section_list, SectionType section_type,
- llvm::Optional &extractor) {
-  if (!extractor)
-extractor = LoadSection(section_list, section_type);
-  return *extractor;
+const DWARFDataExtractor &
+DWARFContext::LoadOrGetSection(SectionType main_section_type,
+   llvm::Optional dwo_section_type,
+   SectionData &data) {
+  llvm::call_once(data.flag, [&] {
+if (dwo_section_type && isDwo())
+  data.data = LoadSection(m_dwo_section_list, *dwo_section_type);
+else
+  data.data = LoadSection(m_main_section_list, main_section_type);
+  });
+  return data.data;
 }
 
 const DWARFDataExtractor &DWARFContext::getOrLoadAbbrevData() {
-  if (isDwo())
-return LoadOrGetSection(m_dwo_section_list, eSectionTypeDWARFDebugAbbrevDwo,
-m_data_debug_abbrev);
-  return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAbbrev,
-  m_data_debug_abbrev);
+  return LoadOrGetSection(eSectionTypeDWARFDebugAbbrev,
+  eSectionTypeDWARFDebugAbbrevDwo, m_data_debug_abbrev);
 }
 
 const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() {
-  return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAranges,
+  return LoadOrGetSection(eSectionTypeDWARFDebugAranges, llvm::None,
   m_data_debug_aranges);
 }
 
 const DWARFDataExtractor &DWARFContext::getOrLoadAddrData() {
-  return LoadOrGetSection(m_main_section

[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 200969.
kwk added a comment.

- Return empty lldb::thread_result_t as {}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62305

Files:
  lldb/source/Core/Communication.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Host/common/TaskPool.cpp
  lldb/source/Host/windows/HostProcessWindows.cpp
  lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp


Index: lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -132,7 +132,7 @@
   else
 m_debug_delegate->OnDebuggerError(error, 0);
 
-  return 0;
+  return {};
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine(
@@ -148,7 +148,7 @@
   if (!DebugActiveProcess((DWORD)pid)) {
 Status error(::GetLastError(), eErrorTypeWin32);
 m_debug_delegate->OnDebuggerError(error, 0);
-return 0;
+return {};
   }
 
   // The attach was successful, enter the debug loop.  From here on out, this
@@ -156,7 +156,7 @@
   // in DebugLaunch should apply from this point out.
   DebugLoop();
 
-  return 0;
+  return {};
 }
 
 Status DebuggerThread::StopDebugging(bool terminate) {
Index: lldb/source/Host/windows/HostProcessWindows.cpp
===
--- lldb/source/Host/windows/HostProcessWindows.cpp
+++ lldb/source/Host/windows/HostProcessWindows.cpp
@@ -109,7 +109,7 @@
 ::CloseHandle(info->process_handle);
 delete (info);
   }
-  return 0;
+  return {};
 }
 
 void HostProcessWindows::Close() {
Index: lldb/source/Host/common/TaskPool.cpp
===
--- lldb/source/Host/common/TaskPool.cpp
+++ lldb/source/Host/common/TaskPool.cpp
@@ -73,7 +73,7 @@
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::StartEventHandlerThread() {
@@ -1661,7 +1661,7 @@
   Debugger *debugger = (Debugger *)arg;
   debugger->ExecuteIOHandlers();
   debugger->StopEventHandlerThread();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); 
}
Index: lldb/source/Core/Communication.cpp
===
--- lldb/source/Core/Communication.cpp
+++ lldb/source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return {};
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(


Index: lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -132,7 +132,7 @@
   else
 m_debug_delegate->OnDebuggerError(error, 0);
 
-  return 0;
+  return {};
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine(
@@ -148,7 +148,7 @@
   if (!DebugActiveProcess((DWORD)pid)) {
 Status error(::GetLastError(), eErrorTypeWin32);
 m_debug_delegate->OnDebuggerError(error, 0);
-return 0;
+return {};
   }
 
   // The attach was successful, enter the debug loop.  From here on out, this
@@ -156,7 +156,7 @@
   // in DebugLaunch should apply from this point out.
   DebugLoop();
 
-  return 0;
+  return {};
 }
 
 Status DebuggerThread::StopDebugging(bool terminate) {
Index: lldb/source/Host/windows/HostProcessWindows.cpp
===
--- lldb/source/Host/windows/HostProcessWindows.cpp
+++ lldb/source/Host/windows/HostProcessWindows.cpp
@@ -109,7 +109,7 @@
 ::CloseHandle(info->process_handle);
 delete (info);
   }
-  return 0;
+  return {};
 }
 
 void HostProcessWindows::Close() {
Index: lldb/source/Host/common/TaskPool.cpp
===
--- lldb/source/Host/common/TaskPool.cpp
+++ lldb/source/Host/common/TaskPool.cpp
@@ -73,7 +73,7 @@
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
Index: lldb

[Lldb-commits] [PATCH] D62316: DWARFContext: Make loading of sections thread-safe

2019-05-23 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Two other options I see are:

- initialize the sections immediately after creating the dwarf context. The 
main advantage of that would that it alings to code more with llvm (which also 
loads the sections up-front), and slighly faster subsequent accesses to the 
debug info. I don't think this should negatively impact the start up time, as 
the files are mmapped anyway, and so the "loading" will consist of some basic 
pointer arithmetic. Also, the SymbolFileDWARF object as a whole is created 
lazily, so the fact that it is being created means that somebody is going to 
access it immediately after that. And he cannot do anything with the symbol 
file without touching at least the debug_info section, which accounts for about 
80% of all debug info.
- have the manual index preload the sections it needs. it already does a bunch 
of preloading in order to speed up the access to everything, so this wouldn't 
look completely out of place there.


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

https://reviews.llvm.org/D62316



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


[Lldb-commits] [PATCH] D62316: DWARFContext: Make loading of sections thread-safe

2019-05-23 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added inline comments.
This revision is now accepted and ready to land.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFContext.h:25
+  struct SectionData {
+llvm::once_flag flag;
+DWARFDataExtractor data;

is llvm::once_flag better than std::once_flag? 


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

https://reviews.llvm.org/D62316



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


[Lldb-commits] [PATCH] D62316: DWARFContext: Make loading of sections thread-safe

2019-05-23 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D62316#1513894 , @labath wrote:

> Two other options I see are:
>
> - initialize the sections immediately after creating the dwarf context. The 
> main advantage of that would that it alings to code more with llvm (which 
> also loads the sections up-front), and slighly faster subsequent accesses to 
> the debug info. I don't think this should negatively impact the start up 
> time, as the files are mmapped anyway, and so the "loading" will consist of 
> some basic pointer arithmetic. Also, the SymbolFileDWARF object as a whole is 
> created lazily, so the fact that it is being created means that somebody is 
> going to access it immediately after that. And he cannot do anything with the 
> symbol file without touching at least the debug_info section, which accounts 
> for about 80% of all debug info.


I'd be fine with this.

> - have the manual index preload the sections it needs. it already does a 
> bunch of preloading in order to speed up the access to everything, so this 
> wouldn't look completely out of place there.

I like either your current solution or the load all on creation better that 
this,


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

https://reviews.llvm.org/D62316



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


[Lldb-commits] [lldb] r361503 - [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Thu May 23 08:17:39 2019
New Revision: 361503

URL: http://llvm.org/viewvc/llvm-project?rev=361503&view=rev
Log:
[lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

Summary:
On Windows `lldb::thread_result_t` resolves to `typedef unsigned 
thread_result_t;` and on other platforms it resolves to `typedef void 
*thread_result_t;`.
 Therefore one cannot use `nullptr` when returning from a function that returns 
`thread_result_t`.

I've made this change because a windows build bot fails with these errors:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

and

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

This is the failing build: 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio

Reviewers: JDevlieghere, teemperor, jankratochvil, labath, clayborg, RKSimon, 
courbet, jhenderson

Reviewed By: labath, clayborg

Subscribers: labath, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Host/common/TaskPool.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu May 23 08:17:39 2019
@@ -359,7 +359,7 @@ lldb::thread_result_t Communication::Rea
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return {};
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu May 23 08:17:39 2019
@@ -1616,7 +1616,7 @@ void Debugger::DefaultEventHandler() {
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::StartEventHandlerThread() {
@@ -1661,7 +1661,7 @@ lldb::thread_result_t Debugger::IOHandle
   Debugger *debugger = (Debugger *)arg;
   debugger->ExecuteIOHandlers();
   debugger->StopEventHandlerThread();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); 
}

Modified: lldb/trunk/source/Host/common/TaskPool.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TaskPool.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Host/common/TaskPool.cpp (original)
+++ lldb/trunk/source/Host/common/TaskPool.cpp Thu May 23 08:17:39 2019
@@ -73,7 +73,7 @@ void TaskPoolImpl::AddTask(std::function
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Thu May 23 08:17:39 
2019
@@ -109,7 +109,7 @@ lldb::thread_r

[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361503: [lldb] fix cannot convert from 
'nullptr' to 'lldb::thread_result_t' (authored by kwk, 
committed by ).
Herald added a subscriber: abidh.

Changed prior to commit:
  https://reviews.llvm.org/D62305?vs=200969&id=200980#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62305

Files:
  source/Core/Communication.cpp
  source/Core/Debugger.cpp
  source/Host/common/TaskPool.cpp
  source/Host/windows/HostProcessWindows.cpp
  source/Plugins/Process/Windows/Common/DebuggerThread.cpp


Index: source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===
--- source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -132,7 +132,7 @@
   else
 m_debug_delegate->OnDebuggerError(error, 0);
 
-  return 0;
+  return {};
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine(
@@ -148,7 +148,7 @@
   if (!DebugActiveProcess((DWORD)pid)) {
 Status error(::GetLastError(), eErrorTypeWin32);
 m_debug_delegate->OnDebuggerError(error, 0);
-return 0;
+return {};
   }
 
   // The attach was successful, enter the debug loop.  From here on out, this
@@ -156,7 +156,7 @@
   // in DebugLaunch should apply from this point out.
   DebugLoop();
 
-  return 0;
+  return {};
 }
 
 Status DebuggerThread::StopDebugging(bool terminate) {
Index: source/Host/windows/HostProcessWindows.cpp
===
--- source/Host/windows/HostProcessWindows.cpp
+++ source/Host/windows/HostProcessWindows.cpp
@@ -109,7 +109,7 @@
 ::CloseHandle(info->process_handle);
 delete (info);
   }
-  return 0;
+  return {};
 }
 
 void HostProcessWindows::Close() {
Index: source/Host/common/TaskPool.cpp
===
--- source/Host/common/TaskPool.cpp
+++ source/Host/common/TaskPool.cpp
@@ -73,7 +73,7 @@
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {
Index: source/Core/Debugger.cpp
===
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -1616,7 +1616,7 @@
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::StartEventHandlerThread() {
@@ -1661,7 +1661,7 @@
   Debugger *debugger = (Debugger *)arg;
   debugger->ExecuteIOHandlers();
   debugger->StopEventHandlerThread();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); 
}
Index: source/Core/Communication.cpp
===
--- source/Core/Communication.cpp
+++ source/Core/Communication.cpp
@@ -359,7 +359,7 @@
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return {};
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(


Index: source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===
--- source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -132,7 +132,7 @@
   else
 m_debug_delegate->OnDebuggerError(error, 0);
 
-  return 0;
+  return {};
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine(
@@ -148,7 +148,7 @@
   if (!DebugActiveProcess((DWORD)pid)) {
 Status error(::GetLastError(), eErrorTypeWin32);
 m_debug_delegate->OnDebuggerError(error, 0);
-return 0;
+return {};
   }
 
   // The attach was successful, enter the debug loop.  From here on out, this
@@ -156,7 +156,7 @@
   // in DebugLaunch should apply from this point out.
   DebugLoop();
 
-  return 0;
+  return {};
 }
 
 Status DebuggerThread::StopDebugging(bool terminate) {
Index: source/Host/windows/HostProcessWindows.cpp
===
--- source/Host/windows/HostProcessWindows.cpp
+++ source/Host/windows/HostProcessWindows.cpp
@@ -109,7 +109,7 @@
 ::CloseHandle(info->process_handle);
 delete (info);
   }
-  return 0;
+  return {};
 }
 
 void HostProcessWindows::Close() {
Index: source/Host/common/TaskPool.cpp
===
--- source/Host/common/TaskPool.cpp
+++ source/Host/common/TaskPool.cpp
@@ -73,7 +73,7 @@
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 

[Lldb-commits] [PATCH] D62305: [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

It looks like this was not enough and the build is still broken. Please revert 
your change or fix it and then keep an eye on the Buildbot to make sure it 
turns to green again. Once it's broken, it won't continue sending failure 
emails, so you have to monitor it to make sure your change fixed it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62305



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


Re: [Lldb-commits] [lldb] r361447 - Ack, added DWARFTypeUnit to the wrong target...

2019-05-23 Thread Jim Ingham via lldb-commits
That should have been a separate commit, I was rushing to get the build 
unbroken.

But this is a good change, we shouldn't silently fail to load the history file, 
that's pretty confusing.  Dumping to the edit line output file is not great but 
we're not running commands at this point so there's no better way to inform the 
user this happened.

Jim

> On May 22, 2019, at 9:39 PM, Davide Italiano  wrote:
> 
>> Modified: lldb/trunk/source/Host/common/Editline.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=361447&r1=361446&r2=361447&view=diff
>> ==
>> --- lldb/trunk/source/Host/common/Editline.cpp (original)
>> +++ lldb/trunk/source/Host/common/Editline.cpp Wed May 22 17:12:45 2019
>> @@ -978,7 +978,9 @@ void Editline::ConfigureEditor(bool mult
>>   TerminalSizeChanged();
>> 
>>   if (m_history_sp && m_history_sp->IsValid()) {
>> -m_history_sp->Load();
>> +if (!m_history_sp->Load()) {
>> +fputs("Could not load history file\n.", m_output_file);
>> +}
>> el_wset(m_editline, EL_HIST, history, m_history_sp->GetHistoryPtr());
>>   }
>>   el_set(m_editline, EL_CLIENTDATA, this);
>> 
>> 
> 
> Did you mean to commit this part or you just had it lying around?

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


[Lldb-commits] [lldb] r361528 - [HostNativeThreadBase] Undo nullptr changes

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 11:15:43 2019
New Revision: 361528

URL: http://llvm.org/viewvc/llvm-project?rev=361528&view=rev
Log:
[HostNativeThreadBase] Undo nullptr changes

The thread result type is an unsigned instead of a pointer on windows,
so we shouldn't replace 0 with nullptr here.

Modified:
lldb/trunk/source/Host/common/HostNativeThreadBase.cpp

Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=361528&r1=361527&r2=361528&view=diff
==
--- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Thu May 23 11:15:43 
2019
@@ -18,10 +18,10 @@ using namespace lldb;
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(nullptr) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(nullptr) {}
+: m_thread(thread), m_result(0) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@ bool HostNativeThreadBase::IsJoinable()
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = nullptr;
+  m_result = 0;
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@ bool HostNativeThreadBase::EqualsThread(
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = nullptr;
+  m_result = 0;
 
   return result;
 }


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


[Lldb-commits] [PATCH] D62334: [lldb] Make sure RegularExpression constructors always initialize member variables

2019-05-23 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe created this revision.
jgorbe added reviewers: clayborg, zturner.
Herald added a subscriber: jdoerfert.

The copy constructor of RegularExpression doesn't initialize m_comp_err. This 
causes an use-of-initialized-value error when a RegularExpression is copied: 
the copy constructor calls Compile, which calls Free to free the existing regex 
if needed, which in turn reads m_comp_err to check if there's any regex to be 
freed.

This change calls the default constructor from the other constructors to make 
sure members are always initialized with sensible values. This also avoids 
duplicating init logic, like the `RegularExpression(llvm:StringRef)` 
constructor does, which is error prone.


https://reviews.llvm.org/D62334

Files:
  lldb/source/Utility/RegularExpression.cpp


Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+  : RegularExpression() {
   Compile(rhs.GetText());
 }
 


Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+  : RegularExpression() {
   Compile(rhs.GetText());
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62334: [lldb] Make sure RegularExpression constructors always initialize member variables

2019-05-23 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe updated this revision to Diff 201029.
jgorbe added a comment.

Fixed indentation.


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

https://reviews.llvm.org/D62334

Files:
  lldb/source/Utility/RegularExpression.cpp


Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression() {
   Compile(rhs.GetText());
 }
 


Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression() {
   Compile(rhs.GetText());
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Fixing this error on windows build bot:

  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type

see 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5050/steps/build/logs/stdio


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62337

Files:
  lldb/source/Host/common/HostNativeThreadBase.cpp


Index: lldb/source/Host/common/HostNativeThreadBase.cpp
===
--- lldb/source/Host/common/HostNativeThreadBase.cpp
+++ lldb/source/Host/common/HostNativeThreadBase.cpp
@@ -18,10 +18,10 @@
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }


Index: lldb/source/Host/common/HostNativeThreadBase.cpp
===
--- lldb/source/Host/common/HostNativeThreadBase.cpp
+++ lldb/source/Host/common/HostNativeThreadBase.cpp
@@ -18,10 +18,10 @@
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
htt

[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This looks good - it is still not all though. Even after Jonas' change the 
build failed with the same error elsewhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62337



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


[Lldb-commits] [lldb] r361539 - [gdb-remote] Fix more issues with thread_result_t

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 12:32:46 2019
New Revision: 361539

URL: http://llvm.org/viewvc/llvm-project?rev=361539&view=rev
Log:
[gdb-remote] Fix more issues with thread_result_t

More fixes needed to un-break the Windows bot.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=361539&r1=361538&r2=361539&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu 
May 23 12:32:46 2019
@@ -541,7 +541,7 @@ bool GDBRemoteCommunication::DecompressP
 #if defined(HAVE_LIBCOMPRESSION)
   if (m_compression_type == CompressionType::ZlibDeflate ||
   m_compression_type == CompressionType::LZFSE ||
-  m_compression_type == CompressionType::LZ4 || 
+  m_compression_type == CompressionType::LZ4 ||
   m_compression_type == CompressionType::LZMA) {
 compression_algorithm compression_type;
 if (m_compression_type == CompressionType::LZFSE)
@@ -578,7 +578,7 @@ bool GDBRemoteCommunication::DecompressP
 if (decompressed_bufsize != ULONG_MAX && decompressed_buffer != nullptr) {
   decompressed_bytes = compression_decode_buffer(
   decompressed_buffer, decompressed_bufsize,
-  (uint8_t *)unescaped_content.data(), unescaped_content.size(), 
+  (uint8_t *)unescaped_content.data(), unescaped_content.size(),
   m_decompression_scratch, compression_type);
 }
   }
@@ -925,7 +925,7 @@ GDBRemoteCommunication::ListenThread(lld
 eConnectionStatusSuccess)
   comm->SetConnection(nullptr);
   }
-  return nullptr;
+  return {};
 }
 
 Status GDBRemoteCommunication::StartDebugserverProcess(

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=361539&r1=361538&r2=361539&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu May 
23 12:32:46 2019
@@ -3913,7 +3913,7 @@ thread_result_t ProcessGDBRemote::AsyncT
 ") thread exiting...",
 __FUNCTION__, arg, process->GetID());
 
-  return nullptr;
+  return {};
 }
 
 // uint32_t


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


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I already pushed a fix for this. There were additional errors in the gdb remote 
code. Since I don't have a Windows I'm waiting on the Windows bot to see what 
else needs to be fixed :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62337



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


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 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.

nvm my previous comment, I didn't check the left hand side...

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62337



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


[Lldb-commits] [lldb] r361544 - [Utility] Avoid a few unnecessary copies (NFC)

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 13:05:21 2019
New Revision: 361544

URL: http://llvm.org/viewvc/llvm-project?rev=361544&view=rev
Log:
[Utility] Avoid a few unnecessary copies (NFC)

Avoid unnecessary copies by either passing by const-reference or moving
the argument.

Modified:
lldb/trunk/include/lldb/Utility/Broadcaster.h
lldb/trunk/include/lldb/Utility/Listener.h
lldb/trunk/source/Utility/Broadcaster.cpp
lldb/trunk/source/Utility/Listener.cpp

Modified: lldb/trunk/include/lldb/Utility/Broadcaster.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Broadcaster.h?rev=361544&r1=361543&r2=361544&view=diff
==
--- lldb/trunk/include/lldb/Utility/Broadcaster.h (original)
+++ lldb/trunk/include/lldb/Utility/Broadcaster.h Thu May 23 13:05:21 2019
@@ -51,7 +51,7 @@ public:
   // Tell whether this BroadcastEventSpec is contained in in_spec. That is: (a)
   // the two spec's share the same broadcaster class (b) the event bits of this
   // spec are wholly contained in those of in_spec.
-  bool IsContainedIn(BroadcastEventSpec in_spec) const {
+  bool IsContainedIn(const BroadcastEventSpec &in_spec) const {
 if (m_broadcaster_class != in_spec.GetBroadcasterClass())
   return false;
 uint32_t in_bits = in_spec.GetEventBits();
@@ -90,12 +90,13 @@ public:
   ~BroadcasterManager() = default;
 
   uint32_t RegisterListenerForEvents(const lldb::ListenerSP &listener_sp,
- BroadcastEventSpec event_spec);
+ const BroadcastEventSpec &event_spec);
 
   bool UnregisterListenerForEvents(const lldb::ListenerSP &listener_sp,
-   BroadcastEventSpec event_spec);
+   const BroadcastEventSpec &event_spec);
 
-  lldb::ListenerSP GetListenerForEventSpec(BroadcastEventSpec event_spec) 
const;
+  lldb::ListenerSP
+  GetListenerForEventSpec(const BroadcastEventSpec &event_spec) const;
 
   void SignUpListenersForBroadcaster(Broadcaster &broadcaster);
 
@@ -123,7 +124,7 @@ private:
 
 ~BroadcasterClassMatches() = default;
 
-bool operator()(const event_listener_key input) const {
+bool operator()(const event_listener_key &input) const {
   return (input.first.GetBroadcasterClass() == m_broadcaster_class);
 }
 
@@ -133,12 +134,12 @@ private:
 
   class BroadcastEventSpecMatches {
   public:
-BroadcastEventSpecMatches(BroadcastEventSpec broadcaster_spec)
+BroadcastEventSpecMatches(const BroadcastEventSpec &broadcaster_spec)
 : m_broadcaster_spec(broadcaster_spec) {}
 
 ~BroadcastEventSpecMatches() = default;
 
-bool operator()(const event_listener_key input) const {
+bool operator()(const event_listener_key &input) const {
   return (input.first.IsContainedIn(m_broadcaster_spec));
 }
 
@@ -148,13 +149,14 @@ private:
 
   class ListenerMatchesAndSharedBits {
   public:
-explicit ListenerMatchesAndSharedBits(BroadcastEventSpec broadcaster_spec,
-  const lldb::ListenerSP listener_sp)
+explicit ListenerMatchesAndSharedBits(
+const BroadcastEventSpec &broadcaster_spec,
+const lldb::ListenerSP &listener_sp)
 : m_broadcaster_spec(broadcaster_spec), m_listener_sp(listener_sp) {}
 
 ~ListenerMatchesAndSharedBits() = default;
 
-bool operator()(const event_listener_key input) const {
+bool operator()(const event_listener_key &input) const {
   return (input.first.GetBroadcasterClass() ==
   m_broadcaster_spec.GetBroadcasterClass() &&
   (input.first.GetEventBits() &
@@ -169,12 +171,12 @@ private:
 
   class ListenerMatches {
   public:
-explicit ListenerMatches(const lldb::ListenerSP in_listener_sp)
+explicit ListenerMatches(const lldb::ListenerSP &in_listener_sp)
 : m_listener_sp(in_listener_sp) {}
 
 ~ListenerMatches() = default;
 
-bool operator()(const event_listener_key input) const {
+bool operator()(const event_listener_key &input) const {
   if (input.second == m_listener_sp)
 return true;
   else
@@ -192,14 +194,14 @@ private:
 
 ~ListenerMatchesPointer() = default;
 
-bool operator()(const event_listener_key input) const {
+bool operator()(const event_listener_key &input) const {
   if (input.second.get() == m_listener)
 return true;
   else
 return false;
 }
 
-bool operator()(const lldb::ListenerSP input) const {
+bool operator()(const lldb::ListenerSP &input) const {
   if (input.get() == m_listener)
 return true;
   else

Modified: lldb/trunk/include/lldb/Utility/Listener.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Listener.h?rev=361544&r1=361543&r2=361544&view=diff
==
--- lldb/trunk/include/ll

[Lldb-commits] [lldb] r361546 - [lldb] Make sure RegularExpression constructors always initialize member variables

2019-05-23 Thread Jorge Gorbe Moya via lldb-commits
Author: jgorbe
Date: Thu May 23 13:11:17 2019
New Revision: 361546

URL: http://llvm.org/viewvc/llvm-project?rev=361546&view=rev
Log:
[lldb] Make sure RegularExpression constructors always initialize member 
variables

The copy constructor of RegularExpression doesn't initialize m_comp_err. This 
causes an use-of-initialized-value error when a RegularExpression is copied: 
the copy constructor calls Compile, which calls Free to free the existing regex 
if needed, which in turn reads m_comp_err to check if there's any regex to be 
freed.

This change calls the default constructor from the other constructors to make 
sure members are always initialized with sensible values. This also avoids 
duplicating init logic, like the RegularExpression(llvm:StringRef) constructor 
does, which is error prone.

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

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

Modified: lldb/trunk/source/Utility/RegularExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/RegularExpression.cpp?rev=361546&r1=361545&r2=361546&view=diff
==
--- lldb/trunk/source/Utility/RegularExpression.cpp (original)
+++ lldb/trunk/source/Utility/RegularExpression.cpp Thu May 23 13:11:17 2019
@@ -29,13 +29,12 @@ RegularExpression::RegularExpression() :
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression() {
   Compile(rhs.GetText());
 }
 


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


[Lldb-commits] [PATCH] D62334: [lldb] Make sure RegularExpression constructors always initialize member variables

2019-05-23 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361546: [lldb] Make sure RegularExpression constructors 
always initialize member… (authored by jgorbe, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D62334?vs=201029&id=201050#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62334

Files:
  source/Utility/RegularExpression.cpp


Index: source/Utility/RegularExpression.cpp
===
--- source/Utility/RegularExpression.cpp
+++ source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression() {
   Compile(rhs.GetText());
 }
 


Index: source/Utility/RegularExpression.cpp
===
--- source/Utility/RegularExpression.cpp
+++ source/Utility/RegularExpression.cpp
@@ -29,13 +29,12 @@
 // Constructor that compiles "re" using "flags" and stores the resulting
 // compiled regular expression into this object.
 RegularExpression::RegularExpression(llvm::StringRef str)
-: m_re(), m_comp_err(1), m_preg() {
-  memset(&m_preg, 0, sizeof(m_preg));
+: RegularExpression() {
   Compile(str);
 }
 
-RegularExpression::RegularExpression(const RegularExpression &rhs) {
-  memset(&m_preg, 0, sizeof(m_preg));
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression() {
   Compile(rhs.GetText());
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r361548 - [Process] Fix another thread_result_t & nullptr incompatibility.

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 13:25:49 2019
New Revision: 361548

URL: http://llvm.org/viewvc/llvm-project?rev=361548&view=rev
Log:
[Process] Fix another thread_result_t & nullptr incompatibility.

Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=361548&r1=361547&r2=361548&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu May 23 13:25:49 2019
@@ -3638,7 +3638,7 @@ void Process::ControlPrivateStateThread(
 }
 
 if (signal == eBroadcastInternalStateControlStop) {
-  thread_result_t result = nullptr;
+  thread_result_t result = {};
   m_private_state_thread.Join(&result);
   m_private_state_thread.Reset();
 }
@@ -3913,7 +3913,7 @@ thread_result_t Process::RunPrivateState
   // it was doing yet, so don't try to change it on the way out.
   if (!is_secondary_thread)
 m_public_run_lock.SetStopped();
-  return nullptr;
+  return {};
 }
 
 // Process Event Data
@@ -4072,15 +4072,15 @@ void Process::ProcessEventData::DoOnRemo
 // public resume.
 process_sp->PrivateResume();
   } else {
-bool hijacked = 
-  process_sp->IsHijackedForEvent(eBroadcastBitStateChanged)
-  && !process_sp->StateChangedIsHijackedForSynchronousResume();
+bool hijacked =
+process_sp->IsHijackedForEvent(eBroadcastBitStateChanged) &&
+!process_sp->StateChangedIsHijackedForSynchronousResume();
 
 if (!hijacked) {
   // If we didn't restart, run the Stop Hooks here.
   // Don't do that if state changed events aren't hooked up to the
-  // public (or SyncResume) broadcasters.  StopHooks are just for 
-  // real public stops.  They might also restart the target, 
+  // public (or SyncResume) broadcasters.  StopHooks are just for
+  // real public stops.  They might also restart the target,
   // so watch for that.
   process_sp->GetTarget().RunStopHooks();
   if (process_sp->GetPrivateState() == eStateRunning)


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


[Lldb-commits] [lldb] r361555 - [NFC] Add blank line (test commit)

2019-05-23 Thread J. Ryan Stinnett via lldb-commits
Author: jryans
Date: Thu May 23 14:13:50 2019
New Revision: 361555

URL: http://llvm.org/viewvc/llvm-project?rev=361555&view=rev
Log:
[NFC] Add blank line (test commit)

Modified:
lldb/trunk/tools/debugserver/source/debugserver.cpp

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=361555&r1=361554&r2=361555&view=diff
==
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Thu May 23 14:13:50 2019
@@ -490,6 +490,7 @@ RNBRunLoopMode HandleProcessStateChange(
   // Catch all...
   return eRNBRunLoopModeExit;
 }
+
 // This function handles the case where our inferior program is stopped and
 // we are waiting for gdb remote protocol packets. When a packet occurs that
 // makes the inferior run, we need to leave this function with a new state


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


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361565: [lldb] followup fix for 
https://reviews.llvm.org/D62305 (authored by kwk, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62337?vs=201032&id=201082#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62337

Files:
  source/Host/common/HostNativeThreadBase.cpp


Index: source/Host/common/HostNativeThreadBase.cpp
===
--- source/Host/common/HostNativeThreadBase.cpp
+++ source/Host/common/HostNativeThreadBase.cpp
@@ -18,10 +18,10 @@
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }


Index: source/Host/common/HostNativeThreadBase.cpp
===
--- source/Host/common/HostNativeThreadBase.cpp
+++ source/Host/common/HostNativeThreadBase.cpp
@@ -18,10 +18,10 @@
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r361565 - [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Thu May 23 15:39:13 2019
New Revision: 361565

URL: http://llvm.org/viewvc/llvm-project?rev=361565&view=rev
Log:
[lldb] followup fix for https://reviews.llvm.org/D62305

Summary:
Fixing this error on windows build bot:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

see 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5050/steps/build/logs/stdio

Reviewers: stella.stamenova, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Host/common/HostNativeThreadBase.cpp

Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=361565&r1=361564&r2=361565&view=diff
==
--- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Thu May 23 15:39:13 
2019
@@ -18,10 +18,10 @@ using namespace lldb;
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@ bool HostNativeThreadBase::IsJoinable()
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@ bool HostNativeThreadBase::EqualsThread(
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }


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


[Lldb-commits] [PATCH] D62352: Call to HandleNameConflict in VisitRecordDecl mistakeningly using Name instead of SearchName

2019-05-23 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik created this revision.
shafik added reviewers: martong, teemperor, jasonmolenda, friss.
Herald added a subscriber: rnkovacs.

https://reviews.llvm.org/D51633 added error handling to the 
`ASTNodeImporter::VisitRecordDecl` for the conflicting names case. This could 
lead to erroneous return of an error in that case since we should have been 
using SearchName. Name may be empty in the case where we find the name via 
`D->getTypedefNameForAnonDecl()->getDeclName()`.

This fix is very similar to https://reviews.llvm.org/D59665


https://reviews.llvm.org/D62352

Files:
  lib/AST/ASTImporter.cpp


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2585,7 +2585,7 @@
 } // for
 
 if (!ConflictingDecls.empty() && SearchName) {
-  Name = Importer.HandleNameConflict(Name, DC, IDNS,
+  Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
  ConflictingDecls.data(),
  ConflictingDecls.size());
   if (!Name)


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2585,7 +2585,7 @@
 } // for
 
 if (!ConflictingDecls.empty() && SearchName) {
-  Name = Importer.HandleNameConflict(Name, DC, IDNS,
+  Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
  ConflictingDecls.data(),
  ConflictingDecls.size());
   if (!Name)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62284: Replace integer literals which are cast to bool

2019-05-23 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision as: LLDB.
davide added a comment.
Herald added a subscriber: rnkovacs.

LGTM


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62284



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


[Lldb-commits] [lldb] r361580 - Fix integer literals which are cast to bool

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 17:44:33 2019
New Revision: 361580

URL: http://llvm.org/viewvc/llvm-project?rev=361580&view=rev
Log:
Fix integer literals which are cast to bool

This change replaces built-in types that are implicitly converted to
booleans.

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

Modified:
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Host/macosx/objcxx/Host.mm
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/Function.cpp
lldb/trunk/source/Symbol/SymbolContext.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Utility/JSON.cpp
lldb/trunk/source/Utility/SelectHelper.cpp
lldb/trunk/source/Utility/StructuredData.cpp
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/JSON.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/debugserver.cpp
lldb/trunk/tools/debugserver/source/libdebugserver.cpp

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=361580&r1=361579&r2=361580&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu May 23 17:44:33 
2019
@@ -235,7 +235,7 @@ protected:
  host_platform_sp->GetDescription());
 
 uint32_t idx;
-for (idx = 0; 1; ++idx) {
+for (idx = 0; true; ++idx) {
   const char *plugin_name =
   PluginManager::GetPlatformPluginNameAtIndex(idx);
   if (plugin_name == nullptr)

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=361580&r1=361579&r2=361580&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu May 23 17:44:33 2019
@@ -3740,7 +3740,7 @@ public:
 break;
 
   case 'v':
-m_verbose = 1;
+m_verbose = true;
 break;
 
   case 'A':

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=361580&r1=361579&r2=361580&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu May 23 17:44:33 2019
@@ -482,7 +482,7 @@ public:
 
   case 'e':
 if (option_arg == "block") {
-  m_end_line_is_block_end = 1;
+  m_end_line_is_block_end = true;
   break;
 }
 if (option_arg.getAsInteger(0, m_end_line))

Modified: lldb/trunk/source/Core/Address.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=361580&r1=361579&r2=361580&view=diff
==
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Thu May 23 17:44:33 2019
@@ -161,7 +161,7 @@ static bool ReadAddress(ExecutionContext
 static bool DumpUInt(ExecutionContextScope *exe_scope, const Address &address,
  uint32_t byte_size, Stream *strm) {
   if (exe_scope == nullptr || byte_size == 0)
-return 0;
+return false;
   std::vector buf(byte_size, 0);
 
   if (ReadBytes(exe_scope, address, &buf[0], buf.size(

[Lldb-commits] [PATCH] D62284: Replace integer literals which are cast to bool

2019-05-23 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361580: Fix integer literals which are cast to bool 
(authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62284?vs=200869&id=201106#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62284

Files:
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Commands/CommandObjectThread.cpp
  source/Core/Address.cpp
  source/Host/macosx/objcxx/Host.mm
  source/Interpreter/Options.cpp
  source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Symbol/ClangASTContext.cpp
  source/Symbol/ClangASTImporter.cpp
  source/Symbol/CompilerType.cpp
  source/Symbol/Function.cpp
  source/Symbol/SymbolContext.cpp
  source/Target/Process.cpp
  source/Target/Target.cpp
  source/Target/Thread.cpp
  source/Utility/JSON.cpp
  source/Utility/SelectHelper.cpp
  source/Utility/StructuredData.cpp
  tools/debugserver/source/DNB.cpp
  tools/debugserver/source/JSON.cpp
  tools/debugserver/source/MacOSX/MachThreadList.cpp
  tools/debugserver/source/RNBRemote.cpp
  tools/debugserver/source/debugserver.cpp
  tools/debugserver/source/libdebugserver.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1856,7 +1856,7 @@
   out_str.clear();
   addr_t curr_addr = addr.GetLoadAddress(this);
   Address address(addr);
-  while (1) {
+  while (true) {
 size_t length = ReadCStringFromMemory(address, buf, sizeof(buf), error);
 if (length == 0)
   break;
Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -5350,7 +5350,7 @@
 
 event_explanation = ts.GetData();
   }
-} while (0);
+} while (false);
 
 if (event_explanation)
   log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s",
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -853,7 +853,7 @@
   // Otherwise, don't let the base plan override what the other plans say
   // to do, since presumably if there were other plans they would know what
   // to do...
-  while (1) {
+  while (true) {
 if (PlanIsBasePlan(current_plan))
   break;
 
@@ -978,7 +978,7 @@
   } else {
 Vote thread_vote = eVoteNoOpinion;
 ThreadPlan *plan_ptr = GetCurrentPlan();
-while (1) {
+while (true) {
   if (plan_ptr->PlanExplainsStop(event_ptr)) {
 thread_vote = plan_ptr->ShouldReportStop(event_ptr);
 break;
@@ -1298,7 +1298,7 @@
 return;
   }
 
-  while (1) {
+  while (true) {
 int master_plan_idx;
 bool discard = true;
 
@@ -1677,7 +1677,7 @@
 // FIXME: ValueObject::Cast doesn't currently work correctly, at least not
 // for scalars.
 // Turn that back on when that works.
-if (/* DISABLES CODE */ (0) && sc.function != nullptr) {
+if (/* DISABLES CODE */ (false) && sc.function != nullptr) {
   Type *function_type = sc.function->GetType();
   if (function_type) {
 CompilerType return_type =
Index: source/Symbol/Function.cpp
===
--- source/Symbol/Function.cpp
+++ source/Symbol/Function.cpp
@@ -546,7 +546,7 @@
 
 // Now calculate the offset to pass the subsequent line 0 entries.
 uint32_t first_non_zero_line = prologue_end_line_idx;
-while (1) {
+while (true) {
   LineEntry line_entry;
   if (line_table->GetLineEntryAtIndex(first_non_zero_line,
   line_entry)) {
Index: source/Symbol/ClangASTImporter.cpp
===
--- source/Symbol/ClangASTImporter.cpp
+++ source/Symbol/ClangASTImporter.cpp
@@ -1018,7 +1018,7 @@
 
   to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
   m_source_ctx->getObjCInterfaceT

[Lldb-commits] [lldb] r361583 - Revert "[lldb] followup fix for https://reviews.llvm.org/D62305"

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 18:08:54 2019
New Revision: 361583

URL: http://llvm.org/viewvc/llvm-project?rev=361583&view=rev
Log:
Revert "[lldb] followup fix for https://reviews.llvm.org/D62305";

This fails on the Windows bot:

cannot convert from 'initializer list' to 'lldb::thread_result_t'

Modified:
lldb/trunk/source/Host/common/HostNativeThreadBase.cpp

Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=361583&r1=361582&r2=361583&view=diff
==
--- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Thu May 23 18:08:54 
2019
@@ -18,10 +18,10 @@ using namespace lldb;
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result({}) {}
+: m_thread(thread), m_result(0) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@ bool HostNativeThreadBase::IsJoinable()
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = {};
+  m_result = 0;
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@ bool HostNativeThreadBase::EqualsThread(
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = {};
+  m_result = 0;
 
   return result;
 }


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


Re: [Lldb-commits] [lldb] r361565 - [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Richard Smith via lldb-commits
On Thu, 23 May 2019 at 15:39, Konrad Kleine via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: kwk
> Date: Thu May 23 15:39:13 2019
> New Revision: 361565
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361565&view=rev
> Log:
> [lldb] followup fix for https://reviews.llvm.org/D62305
>
> Summary:
> Fixing this error on windows build bot:
>
> ```
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
> error C2440: 'initializing': cannot convert from 'nullptr' to
> 'lldb::thread_result_t'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
> note: A native nullptr can only be converted to bool or, using
> reinterpret_cast, to an integral type
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
> error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could
> not be initialized
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
> note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
> error C2440: 'initializing': cannot convert from 'nullptr' to
> 'lldb::thread_result_t'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
> note: A native nullptr can only be converted to bool or, using
> reinterpret_cast, to an integral type
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
> error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could
> not be initialized
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
> note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
> error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
> note: A native nullptr can only be converted to bool or, using
> reinterpret_cast, to an integral type
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
> error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
> E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
> note: A native nullptr can only be converted to bool or, using
> reinterpret_cast, to an integral type
> ```
>
> see
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5050/steps/build/logs/stdio
>
> Reviewers: stella.stamenova, JDevlieghere
>
> Reviewed By: JDevlieghere
>
> Subscribers: lldb-commits
>
> Tags: #lldb
>
> Differential Revision: https://reviews.llvm.org/D62337
>
> Modified:
> lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
>
> Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=361565&r1=361564&r2=361565&view=diff
>
> ==
> --- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
> +++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Thu May 23
> 15:39:13 2019
> @@ -18,10 +18,10 @@ using namespace lldb;
>  using namespace lldb_private;
>
>  HostNativeThreadBase::HostNativeThreadBase()
> -: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
> +: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
>
>  HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
> -: m_thread(thread), m_result(0) {}
> +: m_thread(thread), m_result({}) {}
>

This change breaks the build with Clang:

third_party/llvm/llvm/tools/lldb/source/Host/common/HostNativeThreadBase.cpp:21:43:
error: cannot initialize non-class type 'lldb::thread_result_t' (aka 'void
*') with a parenthesized initializer list
: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
  ^~~


>  lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
>return m_thread;
> @@ -37,7 +37,7 @@ bool HostNativeThreadBase::IsJoinable()
>
>  void HostNativeThreadBase::Reset() {
>m_thread = LLDB_INVALID_HOST_THREAD;
> -  m_result = 0;
> +  m_result = {};
>  }
>
>  bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
> @@ -47,7 +47,7 @@ bool HostNativeThreadBase::EqualsThread(
>  lldb::thread_t HostNativeThreadBase::Release() {
>lldb::thread_t result = m_thread;
>m_thread = LLDB_INVALID_HOST_THREAD;
> -  m_result = 0;
> +  m_result = {};
>
>return result;
>  }
>
>
> ___
> lldb-commits mailing list
> lldb-commits@li

[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

Hi

This change breaks arm/aarch64 linux builds.

http://147.75.106.138:32769/builders/lldb-aarch64-ubuntu/builds/47


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62337



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


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I reverted this because it broke the Windows bot again :(

  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2440: 'initializing': cannot convert from 'initializer list' to 
'lldb::thread_result_t'
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 note: Non-class type 'lldb::thread_result_t' cannot be initialized with a 
parenthesized initializer list
  
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62337



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


[Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D62337#1515041 , @omjavaid wrote:

> Hi
>
> This change breaks arm/aarch64 linux builds.
>
> http://147.75.106.138:32769/builders/lldb-aarch64-ubuntu/builds/47


Always great to see more lldb bots! Is there any reason this bot doesn't report 
to the buildbot master on lab.llvm.org?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62337



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


Re: [Lldb-commits] [PATCH] D62337: [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Omair Javaid via lldb-commits
On Fri, 24 May 2019 at 06:15, Jonas Devlieghere via Phabricator
 wrote:
>
> JDevlieghere added a comment.
>
> In D62337#1515041 , @omjavaid wrote:
>
> > Hi
> >
> > This change breaks arm/aarch64 linux builds.
> >
> > http://147.75.106.138:32769/builders/lldb-aarch64-ubuntu/builds/47
>
>
> Always great to see more lldb bots! Is there any reason this bot doesn't 
> report to the buildbot master on lab.llvm.org?

This bot was setup just today previously running on a flaky machine
and there are still tests breakage on aarch64 and arm that I need to
look into.

I ll move it to staging master in couple of days.

>
>
> Repository:
>   rLLDB LLDB
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D62337/new/
>
> https://reviews.llvm.org/D62337
>
>
>


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


[Lldb-commits] [lldb] r361597 - [Utility] Small improvements to the Broadcaster class (NFC)

2019-05-23 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu May 23 21:41:47 2019
New Revision: 361597

URL: http://llvm.org/viewvc/llvm-project?rev=361597&view=rev
Log:
[Utility] Small improvements to the Broadcaster class (NFC)

I touched the Broadcaster class earlier today (r361544) and noticed a
few things that could be improved. This patch includes variety of small
fixes: use early returns, use LLDB_LOG macro, use doxygen comments and
finally format the class.

Modified:
lldb/trunk/include/lldb/Utility/Broadcaster.h
lldb/trunk/source/Utility/Broadcaster.cpp

Modified: lldb/trunk/include/lldb/Utility/Broadcaster.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Broadcaster.h?rev=361597&r1=361596&r2=361597&view=diff
==
--- lldb/trunk/include/lldb/Utility/Broadcaster.h (original)
+++ lldb/trunk/include/lldb/Utility/Broadcaster.h Thu May 23 21:41:47 2019
@@ -29,14 +29,14 @@ class Broadcaster;
 class EventData;
 class Listener;
 class Stream;
-}
+} // namespace lldb_private
 
 namespace lldb_private {
 
-// lldb::BroadcastEventSpec
-//
-// This class is used to specify a kind of event to register for.  The Debugger
-// maintains a list of BroadcastEventSpec's and when it is made
+/// lldb::BroadcastEventSpec
+///
+/// This class is used to specify a kind of event to register for.  The
+/// Debugger maintains a list of BroadcastEventSpec's and when it is made
 class BroadcastEventSpec {
 public:
   BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits)
@@ -48,19 +48,19 @@ public:
 
   uint32_t GetEventBits() const { return m_event_bits; }
 
-  // Tell whether this BroadcastEventSpec is contained in in_spec. That is: (a)
-  // the two spec's share the same broadcaster class (b) the event bits of this
-  // spec are wholly contained in those of in_spec.
+  /// Tell whether this BroadcastEventSpec is contained in in_spec. That is:
+  /// (a) the two spec's share the same broadcaster class (b) the event bits of
+  /// this spec are wholly contained in those of in_spec.
   bool IsContainedIn(const BroadcastEventSpec &in_spec) const {
 if (m_broadcaster_class != in_spec.GetBroadcasterClass())
   return false;
 uint32_t in_bits = in_spec.GetEventBits();
 if (in_bits == m_event_bits)
   return true;
-else {
-  if ((m_event_bits & in_bits) != 0 && (m_event_bits & ~in_bits) == 0)
-return true;
-}
+
+if ((m_event_bits & in_bits) != 0 && (m_event_bits & ~in_bits) == 0)
+  return true;
+
 return false;
   }
 
@@ -81,10 +81,9 @@ protected:
   BroadcasterManager();
 
 public:
-  // Listeners hold onto weak pointers to their broadcaster managers.  So they
-  // must be made into shared pointers, which you do with
-  // MakeBroadcasterManager.
-
+  /// Listeners hold onto weak pointers to their broadcaster managers.  So they
+  /// must be made into shared pointers, which you do with
+  /// MakeBroadcasterManager.
   static lldb::BroadcasterManagerSP MakeBroadcasterManager();
 
   ~BroadcasterManager() = default;
@@ -179,8 +178,8 @@ private:
 bool operator()(const event_listener_key &input) const {
   if (input.second == m_listener_sp)
 return true;
-  else
-return false;
+
+  return false;
 }
 
   private:
@@ -197,15 +196,15 @@ private:
 bool operator()(const event_listener_key &input) const {
   if (input.second.get() == m_listener)
 return true;
-  else
-return false;
+
+  return false;
 }
 
 bool operator()(const lldb::ListenerSP &input) const {
   if (input.get() == m_listener)
 return true;
-  else
-return false;
+
+  return false;
 }
 
   private:
@@ -413,32 +412,30 @@ public:
   }
 
   /// Restore the state of the Broadcaster from a previous hijack attempt.
-  ///
   void RestoreBroadcaster() { m_broadcaster_sp->RestoreBroadcaster(); }
 
-  // This needs to be filled in if you are going to register the broadcaster
-  // with the broadcaster manager and do broadcaster class matching.
-  // FIXME: Probably should make a ManagedBroadcaster subclass with all the 
bits
-  // needed to work
-  // with the BroadcasterManager, so that it is clearer how to add one.
+  /// This needs to be filled in if you are going to register the broadcaster
+  /// with the broadcaster manager and do broadcaster class matching.
+  /// FIXME: Probably should make a ManagedBroadcaster subclass with all the
+  /// bits needed to work with the BroadcasterManager, so that it is clearer
+  /// how to add one.
   virtual ConstString &GetBroadcasterClass() const;
 
   lldb::BroadcasterManagerSP GetManager();
 
 protected:
-  // BroadcasterImpl contains the actual Broadcaster implementation.  The
-  // Broadcaster makes a BroadcasterImpl which lives as long as it does.  The
-  // Listeners & the Events hold a weak pointer to the BroadcasterImpl, so that
-  // they can survive if a Broadcaster they