[Lldb-commits] [PATCH] D82064: [ARM64] Add QEMU testing environment setup guide for SVE testing

2020-08-18 Thread Thorsten via Phabricator via lldb-commits
tschuett added a comment.

You can buy a PRIMEHPC FX700 from Fujitsu. It has a A64FX CPU with SVE.


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

https://reviews.llvm.org/D82064

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


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread James Henderson via Phabricator via lldb-commits
jhenderson added inline comments.



Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34
+private:
+  Data &DWARF;
+  std::map AbbrevID2Index;

Would it make any sense to merge the `DWARFYAML::Data` class and 
`DWARFYAML::DWARFState` class at all?



Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:35
+  Data &DWARF;
+  std::map AbbrevID2Index;
+

Can you use `std::unordered_map` here? Do we need deterministic ordering? Might 
also be worth naming it something like `AbbrevTableID2Index` to avoid confusing 
with the `AbbrevCode` values.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:92
+  for (uint64_t I = 0; I < DI.DebugAbbrev.size(); ++I) {
+// If the abbrev table's ID isn't specified, we use the index as its ID.
+uint64_t ID = I;

Maybe to avoid weird errors, it might make sense to disallow mixing the two 
methods, i.e. if one table has an explicit ID, the others all must do too. What 
do you think? It may not be worth it if the code is more complex, I don't know.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:105
+}
+AbbrevID2Index.insert({ID, I});
+  }

Could you use the return value of `insert` to identify whether the key already 
exists in the map? That way, you don't need the explicit count call.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:306-313
+  Optional AbbrevTableIndex =
+  DS.getAbbrevTableIndexByID(AbbrevTableID);
+  if (!AbbrevTableIndex)
+return createStringError(errc::invalid_argument,
+ "cannot find abbrev table whose ID is " +
+ utostr(AbbrevTableID));
+  ArrayRef AbbrevDecls(

It might make more sense to do this work in the caller of this function, and to 
maintain this function's interface.



Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:271
+  // There might be DWARF sections and they might be interlinked. We use
+  // DWARFState to get them interlinked.
+  Optional DWARFState;





Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:679-681
+## c) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID' and 
obj2yaml
+## is able to convert it back.

Is there any particular reason you don't have something equivalent to this in 
the ELF testing, to show you can have tables out-of-order etc.



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:711
+# MULTI-TABLES-NEXT:   Form:  DW_FORM_udata
+# MULTI-TABLES-NEXT:   debug_info:
+# MULTI-TABLES-NEXT: - Length:0x000C

Something's not right here - the YAML below has four debug_info tables, but 
only three have check lines. What happened to the one that should be 
referencing abbrev table 2?



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:873-884
+  - sectname:  __debug_abbrev
+segname:   __DWARF
+addr:  0x00
+size:  24
+offset:528
+align: 0
+reloff:0x

Can you omit the abbrev section entirely?



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:906-911
+## e) Test that yaml2obj emits an error message when multiple abbrev tables 
are assigned
+## the same ID.
+
+# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s 
--check-prefix=ID-COLLISION
+
+# ID-COLLISION: yaml2obj: error: the ID (1) of abbrev table with index 1 has 
been used

This feels like it belongs in a debug_abbrev dedicated test?



Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:924-925
+
+## o) Test that yaml2obj emits an error message when multiple abbrev tables 
are assigned
+## the same ID.
+

Same as Mach-O, this really is a debug_abbrev test, not a debug_info test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

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


[Lldb-commits] [lldb] dcd4589 - [lldb][gui] use left/right in the source view to scroll

2020-08-18 Thread Luboš Luňák via lldb-commits

Author: Luboš Luňák
Date: 2020-08-18T13:25:01+02:00
New Revision: dcd4589a0d68032076f6951190ab170fef9c3cf5

URL: 
https://github.com/llvm/llvm-project/commit/dcd4589a0d68032076f6951190ab170fef9c3cf5
DIFF: 
https://github.com/llvm/llvm-project/commit/dcd4589a0d68032076f6951190ab170fef9c3cf5.diff

LOG: [lldb][gui] use left/right in the source view to scroll

I intentionally decided not to reset the column automatically
anywhere, because I don't know where and if at all that should happen.
There should be always an indication of being scrolled (too much)
to the right, so I'll leave this to whoever has an opinion.

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

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 6a24625fc7eb..10aff7a6c217 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -480,23 +480,40 @@ class Window {
 
   // Curses doesn't allow direct output of color escape sequences, but that's
   // how we get source lines from the Highligher class. Read the line and
-  // convert color escape sequences to curses color attributes.
-  void OutputColoredStringTruncated(int right_pad, StringRef string,
+  // convert color escape sequences to curses color attributes. Use
+  // first_skip_count to skip leading visible characters. Returns false if all
+  // visible characters were skipped due to first_skip_count.
+  bool OutputColoredStringTruncated(int right_pad, StringRef string,
+size_t skip_first_count,
 bool use_blue_background) {
 attr_t saved_attr;
 short saved_pair;
+bool result = false;
 wattr_get(m_window, &saved_attr, &saved_pair, nullptr);
 if (use_blue_background)
   ::wattron(m_window, COLOR_PAIR(WhiteOnBlue));
 while (!string.empty()) {
   size_t esc_pos = string.find('\x1b');
   if (esc_pos == StringRef::npos) {
-PutCStringTruncated(right_pad, string.data(), string.size());
+string = string.substr(skip_first_count);
+if (!string.empty()) {
+  PutCStringTruncated(right_pad, string.data(), string.size());
+  result = true;
+}
 break;
   }
   if (esc_pos > 0) {
-PutCStringTruncated(right_pad, string.data(), esc_pos);
-string = string.drop_front(esc_pos);
+if (skip_first_count > 0) {
+  int skip = std::min(esc_pos, skip_first_count);
+  string = string.substr(skip);
+  skip_first_count -= skip;
+  esc_pos -= skip;
+}
+if (esc_pos > 0) {
+  PutCStringTruncated(right_pad, string.data(), esc_pos);
+  result = true;
+  string = string.drop_front(esc_pos);
+}
   }
   bool consumed = string.consume_front("\x1b");
   assert(consumed);
@@ -531,6 +548,7 @@ class Window {
   }
 }
 wattr_set(m_window, saved_attr, saved_pair, nullptr);
+return result;
   }
 
   void Touch() {
@@ -3379,7 +3397,8 @@ class SourceFileWindowDelegate : public WindowDelegate {
 m_disassembly_scope(nullptr), m_disassembly_sp(), 
m_disassembly_range(),
 m_title(), m_line_width(4), m_selected_line(0), m_pc_line(0),
 m_stop_id(0), m_frame_idx(UINT32_MAX), m_first_visible_line(0),
-m_min_x(0), m_min_y(0), m_max_x(0), m_max_y(0) {}
+m_first_visible_column(0), m_min_x(0), m_min_y(0), m_max_x(0),
+m_max_y(0) {}
 
   ~SourceFileWindowDelegate() override = default;
 
@@ -3396,6 +3415,8 @@ class SourceFileWindowDelegate : public WindowDelegate {
 {KEY_RETURN, "Run to selected line with one shot breakpoint"},
 {KEY_UP, "Select previous source line"},
 {KEY_DOWN, "Select next source line"},
+{KEY_LEFT, "Scroll to the left"},
+{KEY_RIGHT, "Scroll to the right"},
 {KEY_PPAGE, "Page up"},
 {KEY_NPAGE, "Page down"},
 {'b', "Set breakpoint on selected source/disassembly line"},
@@ -3650,7 +3671,15 @@ class SourceFileWindowDelegate : public WindowDelegate {
   StringRef line = lineStream.GetString();
   if (line.endswith("\n"))
 line = line.drop_back();
-  window.OutputColoredStringTruncated(1, line, is_pc_line);
+  bool wasWritten = window.OutputColoredStringTruncated(
+  1, line, m_first_visible_column, line_is_selected);
+  if (line_is_selected && !wasWritten) {
+// Draw an empty space to show the selected line if empty,
+// or draw '<' if nothing is visible because of scrolling too much
+// to the right.
+window.PutCStringTruncated(
+1, line.empty() && m_first_visible_column == 

[Lldb-commits] [PATCH] D85290: [lldb][gui] use left/right in the source view to scroll

2020-08-18 Thread Luboš Luňák via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdcd4589a0d68: [lldb][gui] use left/right in the source view 
to scroll (authored by llunak).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D85290?vs=283192&id=286246#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85290

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py

Index: lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
===
--- lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
+++ lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
@@ -25,6 +25,9 @@
 self.expect("run", substrs=["stop reason ="])
 
 escape_key = chr(27).encode()
+left_key = chr(27)+'OD' # for vt100 terminal (lldbexpect sets TERM=vt100)
+right_key = chr(27)+'OC'
+ctrl_l = chr(12)
 
 # Start the GUI and close the welcome window.
 self.child.sendline("gui")
@@ -45,6 +48,20 @@
 self.child.expect_exact("(int) a_variable_with_a_very_looo"+chr(27))
 self.child.expect_exact("(int) shortvar = 1"+chr(27))
 
+# Scroll the sources view twice to the right.
+self.child.send(right_key)
+self.child.send(right_key)
+# Force a redraw, otherwise curses will optimize the drawing to not draw all 'o'.
+self.child.send(ctrl_l)
+# The source code is indented by two spaces, so there'll be just two extra 'o' on the right.
+self.child.expect_exact("int a_variable_with_a_very_lo"+chr(27))
+
+# And scroll back to the left.
+self.child.send(left_key)
+self.child.send(left_key)
+self.child.send(ctrl_l)
+self.child.expect_exact("int a_variable_with_a_very_looo"+chr(27))
+
 # Press escape to quit the gui
 self.child.send(escape_key)
 
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -480,23 +480,40 @@
 
   // Curses doesn't allow direct output of color escape sequences, but that's
   // how we get source lines from the Highligher class. Read the line and
-  // convert color escape sequences to curses color attributes.
-  void OutputColoredStringTruncated(int right_pad, StringRef string,
+  // convert color escape sequences to curses color attributes. Use
+  // first_skip_count to skip leading visible characters. Returns false if all
+  // visible characters were skipped due to first_skip_count.
+  bool OutputColoredStringTruncated(int right_pad, StringRef string,
+size_t skip_first_count,
 bool use_blue_background) {
 attr_t saved_attr;
 short saved_pair;
+bool result = false;
 wattr_get(m_window, &saved_attr, &saved_pair, nullptr);
 if (use_blue_background)
   ::wattron(m_window, COLOR_PAIR(WhiteOnBlue));
 while (!string.empty()) {
   size_t esc_pos = string.find('\x1b');
   if (esc_pos == StringRef::npos) {
-PutCStringTruncated(right_pad, string.data(), string.size());
+string = string.substr(skip_first_count);
+if (!string.empty()) {
+  PutCStringTruncated(right_pad, string.data(), string.size());
+  result = true;
+}
 break;
   }
   if (esc_pos > 0) {
-PutCStringTruncated(right_pad, string.data(), esc_pos);
-string = string.drop_front(esc_pos);
+if (skip_first_count > 0) {
+  int skip = std::min(esc_pos, skip_first_count);
+  string = string.substr(skip);
+  skip_first_count -= skip;
+  esc_pos -= skip;
+}
+if (esc_pos > 0) {
+  PutCStringTruncated(right_pad, string.data(), esc_pos);
+  result = true;
+  string = string.drop_front(esc_pos);
+}
   }
   bool consumed = string.consume_front("\x1b");
   assert(consumed);
@@ -531,6 +548,7 @@
   }
 }
 wattr_set(m_window, saved_attr, saved_pair, nullptr);
+return result;
   }
 
   void Touch() {
@@ -3379,7 +3397,8 @@
 m_disassembly_scope(nullptr), m_disassembly_sp(), m_disassembly_range(),
 m_title(), m_line_width(4), m_selected_line(0), m_pc_line(0),
 m_stop_id(0), m_frame_idx(UINT32_MAX), m_first_visible_line(0),
-m_min_x(0), m_min_y(0), m_max_x(0), m_max_y(0) {}
+m_first_visible_column(0), m_min_x(0), m_min_y(0), m_max_x(0),
+m_max_y(0) {}
 
   ~SourceFileWindowDelegate() override = default;
 
@@ -3396,6 +3415,8 @@
 {KEY_RETURN, "Run to selected line with one shot breakpoint"},
 {KEY_UP, "S

[Lldb-commits] [PATCH] D85820: Use find_library for ncurses

2020-08-18 Thread Simon Pilgrim via Phabricator via lldb-commits
RKSimon added a comment.

@haampie @JDevlieghere This is failing on several buildbots please can you take 
a look : 
http://lab.llvm.org:8011/builders/clang-x86_64-debian-new-pass-manager-fast/builds/13553


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85820

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


[Lldb-commits] [PATCH] D85820: Use find_library for ncurses

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa52173a3e565: Use find_library for ncurses (authored by 
haampie, committed by JDevlieghere).
Herald added projects: Sanitizers, LLDB.
Herald added subscribers: lldb-commits, Sanitizers.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85820

Files:
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/xray/tests/CMakeLists.txt
  lldb/source/Core/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/Unix/Process.inc
  llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -284,9 +284,9 @@
   }
 
   if (llvm_enable_terminfo) {
-values += [ "HAVE_TERMINFO=1" ]
+values += [ "LLVM_ENABLE_TERMINFO=1" ]
   } else {
-values += [ "HAVE_TERMINFO=" ]
+values += [ "LLVM_ENABLE_TERMINFO=" ]
   }
 
   if (llvm_enable_dia_sdk) {
Index: llvm/lib/Support/Unix/Process.inc
===
--- llvm/lib/Support/Unix/Process.inc
+++ llvm/lib/Support/Unix/Process.inc
@@ -313,7 +313,7 @@
   return getColumns();
 }
 
-#ifdef HAVE_TERMINFO
+#ifdef LLVM_ENABLE_TERMINFO
 // We manually declare these extern functions because finding the correct
 // headers from various terminfo, curses, or other sources is harder than
 // writing their specs down.
@@ -323,12 +323,12 @@
 extern "C" int tigetnum(char *capname);
 #endif
 
-#ifdef HAVE_TERMINFO
+#ifdef LLVM_ENABLE_TERMINFO
 static ManagedStatic TermColorMutex;
 #endif
 
 static bool terminalHasColors(int fd) {
-#ifdef HAVE_TERMINFO
+#ifdef LLVM_ENABLE_TERMINFO
   // First, acquire a global lock because these C routines are thread hostile.
   std::lock_guard G(*TermColorMutex);
 
Index: llvm/lib/Support/CMakeLists.txt
===
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -21,10 +21,8 @@
 STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE})
 set(system_libs ${system_libs} ${Backtrace_LIBFILE})
   endif()
-  if(LLVM_ENABLE_TERMINFO)
-if(HAVE_TERMINFO)
-  set(system_libs ${system_libs} ${TERMINFO_LIBS})
-endif()
+  if( LLVM_ENABLE_TERMINFO )
+set(system_libs ${system_libs} ${TERMINFO_LIB})
   endif()
   if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) )
 set(system_libs ${system_libs} atomic)
Index: llvm/include/llvm/Config/config.h.cmake
===
--- llvm/include/llvm/Config/config.h.cmake
+++ llvm/include/llvm/Config/config.h.cmake
@@ -209,7 +209,7 @@
 #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
 
 /* Define if the setupterm() function is supported this platform. */
-#cmakedefine HAVE_TERMINFO ${HAVE_TERMINFO}
+#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO}
 
 /* Define if the xar_open() function is supported this platform. */
 #cmakedefine HAVE_LIBXAR ${HAVE_LIBXAR}
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -147,19 +147,16 @@
 else()
   set(HAVE_LIBEDIT 0)
 endif()
-if(LLVM_ENABLE_TERMINFO)
-  set(HAVE_TERMINFO 0)
-  foreach(library terminfo tinfo curses ncurses ncursesw)
-string(TOUPPER ${library} library_suffix)
-check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
-if(HAVE_TERMINFO_${library_suffix})
-  set(HAVE_TERMINFO 1)
-  set(TERMINFO_LIBS "${library}")
-  break()
-endif()
-  endforeach()
+if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
+  set(MAYBE_REQUIRED REQUIRED)
+else()
+  set(MAYBE_REQUIRED)
+endif()
+find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED})
+if(TERMINFO_LIB)
+  set(LLVM_ENABLE_TERMINFO 1)
 else()
-  set(HAVE_TERMINFO 0)
+  set(LLVM_ENABLE_TERMINFO 0)
 endif()
 
 find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -11,8 +11,8 @@
 
 if (LLDB_ENABLE_CURSES)
   list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES} ${PANEL_LIBRARIES})
-  if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
-list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS})
+  if(LLVM_ENABLE_TERMINFO)
+list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIB})
   endif()
   if (LLVM_BUILD_STATIC)
 list(AP

[Lldb-commits] [PATCH] D86140: [lldb] Add typedefs to the DeclContext they are created in

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: teemperor, shafik.
Herald added a project: LLDB.
labath requested review of this revision.
Herald added a subscriber: JDevlieghere.

TypeSystemClang::CreateTypedef was creating a typedef in the right
DeclContext, but it was not actually adding it as a child of the
context. The resulting inconsistent state meant that we would be unable
to reference the typedef from an expression directly, but we could use
them if they end up being pulled in by some previous subexpression
(because the ASTImporter will set up the correct links in the expression
ast).

This patch adds the typedef to the decl context it is created in.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86140

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
  lldb/test/API/lang/cpp/typedef/main.cpp


Index: lldb/test/API/lang/cpp/typedef/main.cpp
===
--- lldb/test/API/lang/cpp/typedef/main.cpp
+++ lldb/test/API/lang/cpp/typedef/main.cpp
@@ -7,7 +7,16 @@
 
 typedef S SF;
 
+namespace ns {
+typedef S SF;
+}
+struct ST {
+  typedef S SF;
+};
+
 int main (int argc, char const *argv[]) {
   SF s{ .5 };
+  ns::SF in_ns;
+  ST::SF in_struct;
   return 0; // Set a breakpoint here
 }
Index: lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
===
--- lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
+++ lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
@@ -29,8 +29,16 @@
 
 # First of all, check that we can get a typedefed type correctly in a 
simple case
 
-expr_result = frame.EvaluateExpression("(SF)s")
-self.assertTrue(expr_result.IsValid(), "Expression failed with: " + 
str(expr_result.GetError()))
+expr_result = self.expect_expr("(SF)s", 
result_children=[ValueCheck(value="0.5")])
+self.expect_expr("(ns::SF)s", 
result_children=[ValueCheck(value="0.5")])
+self.expect_expr("(ST::SF)s", 
result_children=[ValueCheck(value="0.5")])
+
+self.filecheck("image dump ast a.out", __file__, "--strict-whitespace")
+# CHECK:  {{^}}|-TypedefDecl {{.*}} SF 'S'
+# CHECK:  {{^}}|-NamespaceDecl {{.*}} ns
+# CHECK-NEXT: {{^}}| `-TypedefDecl {{.*}} SF 'S'
+# CHECK:  {{^}}`-CXXRecordDecl {{.*}} struct ST definition
+# CHECK:  {{^}}  `-TypedefDecl {{.*}} SF 'S'
 
 typedef_type = expr_result.GetType();
 self.assertTrue(typedef_type.IsValid(), "Can't get `SF` type of 
evaluated expression")
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4498,6 +4498,7 @@
 clang_ast, decl_ctx, clang::SourceLocation(), clang::SourceLocation(),
 &clang_ast.Idents.get(typedef_name),
 clang_ast.getTrivialTypeSourceInfo(qual_type));
+decl_ctx->addDecl(decl);
 SetOwningModule(decl, TypePayloadClang(payload).GetOwningModule());
 
 clang::TagDecl *tdecl = nullptr;
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2538,6 +2538,7 @@
 value_check = ValueCheck(type=result_type, value=result_value,
  summary=result_summary, 
children=result_children)
 value_check.check_value(self, eval_result, str(eval_result))
+return eval_result
 
 def invoke(self, obj, name, trace=False):
 """Use reflection to call a method dynamically with no argument."""


Index: lldb/test/API/lang/cpp/typedef/main.cpp
===
--- lldb/test/API/lang/cpp/typedef/main.cpp
+++ lldb/test/API/lang/cpp/typedef/main.cpp
@@ -7,7 +7,16 @@
 
 typedef S SF;
 
+namespace ns {
+typedef S SF;
+}
+struct ST {
+  typedef S SF;
+};
+
 int main (int argc, char const *argv[]) {
   SF s{ .5 };
+  ns::SF in_ns;
+  ST::SF in_struct;
   return 0; // Set a breakpoint here
 }
Index: lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
===
--- lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
+++ lldb/test/API/lang/cpp/typedef/TestCppTypedef.py
@@ -29,8 +29,16 @@
 
 # First of all, check that we can get a typedefed type correctly in a simple case
 
-expr_result = frame.EvaluateExpression("(SF)s")
-self.assertTrue(expr_result.IsValid(), "Expression failed with: " + str(expr_result.GetError()))
+expr_result = self.expect_expr("(SF)s", result_children=[ValueCheck(value="0.5")])
+self.expect_expr("(ns::SF)s", result_children=[Val

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This seems fairly straight-forward to me, though I didn't dive into all the 
details.

Given the amount of changed tests, it may be nice to separate the format change 
from the linking patch (so in the interim state, one could generate multiple 
abbrev tables, but there would be no (reasonable) way to reference any table 
except the first one).




Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34
+private:
+  Data &DWARF;
+  std::map AbbrevID2Index;

jhenderson wrote:
> Would it make any sense to merge the `DWARFYAML::Data` class and 
> `DWARFYAML::DWARFState` class at all?
That would definitely be nice.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:89
+DWARFYAML::DWARFState::DWARFState(DWARFYAML::Data &DI, Error &Err) : DWARF(DI) 
{
+  ErrorAsOutParameter EAO(&Err);
+

If you'd do all this work in the factory function and then just pass in a 
finished map to the constructor, there'd be no need for the 
`ErrorAsOutParameter` thingy.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:91
+
+  for (uint64_t I = 0; I < DI.DebugAbbrev.size(); ++I) {
+// If the abbrev table's ID isn't specified, we use the index as its ID.

consider: `for (auto &Abbr : enumerate(DI.DebugAbbrev))`



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:93-95
+uint64_t ID = I;
+if (DI.DebugAbbrev[I].ID)
+  ID = *DI.DebugAbbrev[I].ID;

`ID = DI.DebugAbbrev[I].ID.getValueOr(I)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

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


[Lldb-commits] [PATCH] D82064: [ARM64] Add QEMU testing environment setup guide for SVE testing

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like this. Apart from the inline comments (which are mostly about removing 
excessive mentions of arm(64) -- I want to make that text feel generic, since 
the file is in a generic place), I have one high-level comment. Given the 
current layout of the repo, it seems like these scripts would be better placed 
under `lldb/scripts` than `lldb/tools`. E.g., this scripts are fairly similar 
to the `macos-setup-codesign.sh` script, which also lives in that folder.




Comment at: lldb/tools/lldb-test-qemu/README.txt:2
+--
+  LLDB testing on Arm/AArch64 Linux using QEMU system mode emulation
+--





Comment at: lldb/tools/lldb-test-qemu/README.txt:9-14
+Main motivation for writing this guide is to test AArch64 features like SVE,
+MTE, Pointer Authentication etc. These scripts can be used as reference to set
+up similar testing environment for other architectures supported by QEMU.
+
+We have written helper scripts under llvm-project/lldb/tools/lldb-test-qemu
+which can help quickly setup a Arm or AArch64 testing environment using QEMU.





Comment at: lldb/tools/lldb-test-qemu/README.txt:16
+
+* setup.sh is used to build AArch64 and Arm Linux kernel image and QEMU
+  system emulation executable(s) from source.





Comment at: lldb/tools/lldb-test-qemu/README.txt:20
+* rootfs.sh is used to generate Ubuntu root file system images to be used for
+  QEMU Arm and AArch64 system emulation.
+





Comment at: lldb/tools/lldb-test-qemu/README.txt:22
+
+* run-qemu.sh utilizes QEMU to boot an Arm or AArch64 Linux kernel image with
+  a given root file system image.





Comment at: lldb/tools/lldb-test-qemu/rootfs.sh:57-65
+if [[ "$rfs_arch" != "arm64" && "$rfs_arch" != "armhf" ]]; then
+  echo "Invalid architecture: $rfs_arch"
+  print_usage 1
+fi
+
+if [[ "$rfs_distro" != "focal" && "$rfs_distro" != "bionic" ]]; then
+  echo "Invalid distribution: $rfs_distro"

You're only passing these to `qemu-debootstrap`. It sounds like things could 
"just work" for a bunch of other distro/arch combinations if we just removed 
these checks.



Comment at: lldb/tools/lldb-test-qemu/run-qemu.sh:83-87
+  if [[ "$ARCH" == "arm" ]]; then
+QEMU_BIN=$(pwd)/qemu.git/arm-softmmu/qemu-system-arm
+  elif [[ "$ARCH" == "arm64" ]]; then
+QEMU_BIN=$(pwd)/qemu.git/aarch64-softmmu/qemu-system-aarch64
+  fi

It would be nice if this searched for the qemu binary on the PATH if it was not 
explicitly provided. Something like:
```
if [ -d qemu.git ]; then
  QEMU_BIN=$(pwd)/qemu.git/arm-softmmu/qemu-system-arm
else
  QEMU_BIN=qemu-system-arm
fi
```



Comment at: lldb/tools/lldb-test-qemu/run-qemu.sh:99-101
+  if [[ $SVE ]]; then
+invalid_arg "--sve"
+  fi

How about we check for this in the parsing while loop? That would mean the 
--arch argument has to come before --sve, but that does not seem like a bad 
thing


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

https://reviews.llvm.org/D82064

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


[Lldb-commits] [PATCH] D86144: [lldb] [testsuite] Add split-file for check-lldb dependencies

2020-08-18 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added reviewers: labath, MaskRay.
jankratochvil added a project: LLDB.
Herald added subscribers: JDevlieghere, aprantl, mgorny.
jankratochvil requested review of this revision.

D85968  started to use `split-file` and while 
buildbots run fine while doing `make check-lldb` by hand I get:

  
.../llvm-monorepo-clangassert/tools/lldb/test/SymbolFile/DWARF/Output/DW_AT_declaration-with-children.s.script:
 line 2: split-file: command not found
  failed:
lldb-shell :: SymbolFile/DWARF/DW_AT_declaration-with-children.s


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86144

Files:
  lldb/test/CMakeLists.txt


Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -78,6 +78,7 @@
 llvm-strip
 not
 yaml2obj
+split-file
   )
 endif()
 


Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -78,6 +78,7 @@
 llvm-strip
 not
 yaml2obj
+split-file
   )
 endif()
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86110: [WIP][DebugInfo] Lazily parse debug_loclist offsets

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This sounds perfectly reasonable to me. The offsets are present in memory 
already so there's no point in storing them in a vector as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86110

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


[Lldb-commits] [PATCH] D86144: [lldb] [testsuite] Add split-file for check-lldb dependencies

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Thanks for catching that.




Comment at: lldb/test/CMakeLists.txt:81
 yaml2obj
+split-file
   )

Please keep this list sorted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86144

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


[Lldb-commits] [PATCH] D86144: [lldb] [testsuite] Add split-file for check-lldb dependencies

2020-08-18 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7baed769c7ea: [lldb] [testsuite] Add split-file for 
check-lldb dependencies (authored by jankratochvil).

Changed prior to commit:
  https://reviews.llvm.org/D86144?vs=286291&id=286304#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86144

Files:
  lldb/test/CMakeLists.txt


Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -77,6 +77,7 @@
 dsymutil
 llvm-strip
 not
+split-file
 yaml2obj
   )
 endif()


Index: lldb/test/CMakeLists.txt
===
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -77,6 +77,7 @@
 dsymutil
 llvm-strip
 not
+split-file
 yaml2obj
   )
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 7baed76 - [lldb] [testsuite] Add split-file for check-lldb dependencies

2020-08-18 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-08-18T18:10:55+02:00
New Revision: 7baed769c7ea8de27a1c077c7ff30f4e19988ade

URL: 
https://github.com/llvm/llvm-project/commit/7baed769c7ea8de27a1c077c7ff30f4e19988ade
DIFF: 
https://github.com/llvm/llvm-project/commit/7baed769c7ea8de27a1c077c7ff30f4e19988ade.diff

LOG: [lldb] [testsuite] Add split-file for check-lldb dependencies

D85968 started to use `split-file` and while buildbots run fine while
doing `make check-lldb` by hand I get:

.../llvm-monorepo-clangassert/tools/lldb/test/SymbolFile/DWARF/Output/DW_AT_declaration-with-children.s.script:
 line 2: split-file: command not found
failed:
  lldb-shell :: SymbolFile/DWARF/DW_AT_declaration-with-children.s

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

Added: 


Modified: 
lldb/test/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index c0249180253a..21d8c61f11ed 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -77,6 +77,7 @@ if(NOT LLDB_BUILT_STANDALONE)
 dsymutil
 llvm-strip
 not
+split-file
 yaml2obj
   )
 endif()



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


[Lldb-commits] [PATCH] D82064: [ARM64] Add QEMU testing environment setup guide for SVE testing

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I didn't look at the scripts in detail but I have a few general (high level) 
comments:

- I also feel this should go under `lldb/scripts`.
- Can we put the documentations as RST under `lldb/docs` so it's rendered on 
the website? We already have bunch of developer resources there. That will 
certainly help with discovery.
- LLVM generally encourages scripts to be written in Python. While it doesn't 
look like this will work out of the box on Windows, I can imagine someone might 
be interested in that down the line. I also think the bar is lower for new 
contributors to write Python than bash. I'm kind of on the fence here because 
there's a reasonable balance between just running commands and control flow, 
but then I've been scarred by the `build-script-impl` disaster in Swift so I 
lean towards better safe than sorry.


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

https://reviews.llvm.org/D82064

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


[Lldb-commits] [PATCH] D79699: Add ptrace register access for AArch64 SVE registers

2020-08-18 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks good, just the cpuinfo detection function could use a bit of improvement.

Thanks for your patience.




Comment at: 
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py:22
+if configuration.lldb_platform_name:
+self.runCmd('platform get-file "/proc/cpuinfo" "cpuinfo"')
+cpuinfo_path = "cpuinfo"

This will put the file into the CWD, which is in the source tree. This should 
be `self.getBuildArtifact(cpuinfo)`, and then you don't need the tear down hook.

Also, "platform get-file" (or SBPlatform::Get) should also work on local setups.


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

https://reviews.llvm.org/D79699

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


[Lldb-commits] [PATCH] D85968: [lldb] Forcefully complete a type when adding nested classes

2020-08-18 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s:7
 
-# RUN: llvm-mc --triple x86_64-pc-linux %s --filetype=obj > %t
-# RUN: %lldb %t -o "expr a" -o exit 2>&1 | FileCheck %s --check-prefix=EXPR
-# RUN: %lldb %t -o "target var a" -o exit 2>&1 | FileCheck %s 
--check-prefix=VAR
-
-# EXPR: incomplete type 'A' where a complete type is required
+# RUN: rm -rf %t
+# RUN: split-file %s %t

In many cases `rm -rf %t` is not needed. `split-file` will unlink the output if 
it was originally a file.



Comment at: lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s:9
+# RUN: split-file %s %t
+# RUN: llvm-mc --triple x86_64-pc-linux %t/asm --filetype=obj > %t.o
+# RUN: %lldb -o "settings set interpreter.stop-command-source-on-error false" \

No need to change now: `-o` is recommended (I think the arguments are (1) for 
aesthetic value (2) when llvm-mc fails, don't leave an empty file)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85968

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


[Lldb-commits] [PATCH] D86110: [WIP][DebugInfo] Lazily parse debug_loclist offsets

2020-08-18 Thread David Blaikie via Phabricator via lldb-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

In D86110#2223905 , @labath wrote:

> This sounds perfectly reasonable to me. The offsets are present in memory 
> already so there's no point in storing them in a vector as well.

Thanks for taking a look! I'll take this as approval and commit soon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86110

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


[Lldb-commits] [PATCH] D86140: [lldb] Add typedefs to the DeclContext they are created in

2020-08-18 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

This is nice catch! LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86140

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


[Lldb-commits] [lldb] f7a49d2 - [WIP][DebugInfo] Lazily parse debug_loclist offsets

2020-08-18 Thread David Blaikie via lldb-commits

Author: David Blaikie
Date: 2020-08-18T10:49:39-07:00
New Revision: f7a49d2aa691266497c4baa35f29ba0167b39d23

URL: 
https://github.com/llvm/llvm-project/commit/f7a49d2aa691266497c4baa35f29ba0167b39d23
DIFF: 
https://github.com/llvm/llvm-project/commit/f7a49d2aa691266497c4baa35f29ba0167b39d23.diff

LOG: [WIP][DebugInfo] Lazily parse debug_loclist offsets

Parsing DWARFv5 debug_loclist offsets when a CU is parsed is weighing
down memory usage of symbolizers that don't need to parse this data at
all. There's not much benefit to caching these anyway - since they are
O(1) lookup and reading once you know where the offset list starts (and
can do bounds checking with the offset list size too).

In general, I think it might be time to start paying down some of the
technical debt of loc/loclist/range/rnglist parsing to try to unify it a
bit more.

eg:

* Currently DWARFUnit has: RangeSection, RangeSectionBase, LocSection,
  LocSectionBase, LocTable, RngListTable, LoclistTableHeader (be nice if
  these were all wrapped up in two variables - one for loclists, one for
  rnglists)

* rnglists and loclists are handled differently (see:
  LoclistTableHeader, but no RnglistTableHeader)

* maybe all these types could be less stateful - lazily parse what they
  need to, even reparsing rather than caching because it doesn't seem
  too expensive, for instance. (though admittedly so long as it's
  constantcost/overead per compilatiton that's probably adequate)

* Maybe implementing and using a DWARFDataExtractor that can be
  sub-ranged (so we could slice it up to just the single contribution) -
  though maybe that's not so useful because loc/ranges need to refer to
  it by absolute, not contribution-relative mechanisms

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index affad286a490..1d8236c4ed42 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -237,7 +237,9 @@ class DWARFUnit : public lldb_private::UserID {
   llvm::Optional GetRnglistOffset(uint32_t Index) const {
 if (!m_rnglist_table)
   return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(Index))
+if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
+m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
+Index))
   return *off + m_ranges_base;
 return llvm::None;
   }
@@ -246,7 +248,8 @@ class DWARFUnit : public lldb_private::UserID {
 if (!m_loclist_table_header)
   return llvm::None;
 
-llvm::Optional Offset =  
m_loclist_table_header->getOffsetEntry(Index);
+llvm::Optional Offset = m_loclist_table_header->getOffsetEntry(
+m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVM(), Index);
 if (!Offset)
   return llvm::None;
 return *Offset + m_loclists_base;

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s 
b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s
index ca32e9930a76..6ff35f8c6596 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s
@@ -5,7 +5,7 @@
 
 # CHECK-LABEL: image lookup -v -s lookup_loclists
 # CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg0 
RAX,
-# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = ,
+# CHECK-NOT: Variable:
 
 loclists:
 nop
@@ -28,7 +28,7 @@ lookup_loclists:
 .short  5   # Version
 .byte   8   # Address size
 .byte   0   # Segment selector size
-.long   1   # Offset entry count
+.long   2   # Offset entry count
 .Lloclists_table_base:
 .long   .Ldebug_loc0-.Lloclists_table_base
 .long   .Ldebug_loc1-.Lloclists_table_base

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
index 3b141304f85f..dbc11c51a789 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
@@ -72,6 +72,8 @@ class DWARFLocationTable {
   std::function(uint32_t)> LookupAddr,
   function_ref)> Callback) const;
 
+  const DWARFDataExtractor &getData() { return Data; }
+
 protected:
   DWARFDat

[Lldb-commits] [PATCH] D86110: [WIP][DebugInfo] Lazily parse debug_loclist offsets

2020-08-18 Thread David Blaikie via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7a49d2aa691: [WIP][DebugInfo] Lazily parse debug_loclist 
offsets (authored by dblaikie).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86110

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_loclists_base.s
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Index: llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
===
--- llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -548,17 +548,13 @@
 
   uint64_t HeaderSize = DWARFListTableHeader::getHeaderSize(Header.getFormat());
   uint64_t Offset = getLocSectionBase();
-  DWARFDataExtractor Data(Context.getDWARFObj(), *LocSection,
-  isLittleEndian, getAddressByteSize());
+  const DWARFDataExtractor &Data = LocTable->getData();
   if (Offset < HeaderSize)
 return createStringError(errc::invalid_argument,
  "did not detect a valid"
  " list table with base = 0x%" PRIx64 "\n",
  Offset);
   Offset -= HeaderSize;
-  if (auto *IndexEntry = Header.getIndexEntry())
-if (const auto *Contrib = IndexEntry->getContribution(DW_SECT_LOCLISTS))
-  Offset += Contrib->Offset;
   if (Error E = LoclistTableHeader->extract(Data, &Offset))
 return createStringError(errc::invalid_argument,
  "parsing a loclist table: " +
@@ -1009,3 +1005,13 @@
 return DescOrError.takeError();
   return *DescOrError;
 }
+
+Optional DWARFUnit::getRnglistOffset(uint32_t Index) {
+  if (!RngListTable)
+return None;
+  DataExtractor RangesData(RangeSection->Data, isLittleEndian,
+   getAddressByteSize());
+  if (Optional Off = RngListTable->getOffsetEntry(RangesData, Index))
+return *Off + RangeSectionBase;
+  return None;
+}
Index: llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
===
--- llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
@@ -71,12 +71,12 @@
 ") than there is space for",
 SectionName.data(), HeaderOffset, HeaderData.OffsetEntryCount);
   Data.setAddressSize(HeaderData.AddrSize);
-  for (uint32_t I = 0; I < HeaderData.OffsetEntryCount; ++I)
-Offsets.push_back(Data.getRelocatedValue(OffsetByteSize, OffsetPtr));
+  *OffsetPtr += HeaderData.OffsetEntryCount * OffsetByteSize;
   return Error::success();
 }
 
-void DWARFListTableHeader::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
+void DWARFListTableHeader::dump(DataExtractor Data, raw_ostream &OS,
+DIDumpOptions DumpOpts) const {
   if (DumpOpts.Verbose)
 OS << format("0x%8.8" PRIx64 ": ", HeaderOffset);
   int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(Format);
@@ -91,7 +91,8 @@
 
   if (HeaderData.OffsetEntryCount > 0) {
 OS << "offsets: [";
-for (const auto &Off : Offsets) {
+for (uint32_t I = 0; I < HeaderData.OffsetEntryCount; ++I) {
+  auto Off = *getOffsetEntry(Data, I);
   OS << format("\n0x%0*" PRIx64, OffsetDumpWidth, Off);
   if (DumpOpts.Verbose)
 OS << format(" => 0x%08" PRIx64,
Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
===
--- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -255,7 +255,7 @@
 break;
   Offset = TableOffset + Length;
 } else {
-  Rnglists.dump(OS, LookupPooledAddress, DumpOpts);
+  Rnglists.dump(rnglistData, OS, LookupPooledAddress, DumpOpts);
 }
   }
 }
@@ -316,7 +316,7 @@
   return;
 }
 
-Header.dump(OS, DumpOpts);
+Header.dump(Data, OS, DumpOpts);
 
 uint64_t EndOffset = Header.length() + Header.getHeaderOffset();
 Data.setAddressSize(Header.getAddrSize());
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
===
--- llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -412,18 +412,13 @@
   /// Return a rangelist's offset based on an index. The index designates
   /// an entry in the rangelist table's offset array and is supplied by
   /// DW_FORM_rnglistx.
-  Optional getRnglistOffset(uint32_t Index) {
-if (!RngListTable)
-  return None;
-if (Optional Off = RngListTable->getOf

[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal

2020-08-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/tools/lldb-vscode/VSCode.h:173
+
+  void RegisterRequestCallback(std::string request, RequestCallback callback);
 };

I thought this was the contents of a "lldb::SBTarget 
CreateTargetFromArguments(const llvm::json::Object &arguments, lldb::SBError 
&error);" function! 

Ignore this bad comment!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84974

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


[Lldb-commits] [lldb] 08748d1 - Fix a check that was attempting to see if an object file was in memory.

2020-08-18 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2020-08-18T13:24:22-07:00
New Revision: 08748d15b8d696db9f894db38d74a212b8ab43e6

URL: 
https://github.com/llvm/llvm-project/commit/08748d15b8d696db9f894db38d74a212b8ab43e6
DIFF: 
https://github.com/llvm/llvm-project/commit/08748d15b8d696db9f894db38d74a212b8ab43e6.diff

LOG: Fix a check that was attempting to see if an object file was in memory.

Checking if an object file is in memory should use the 
ObjectFile::IsInMemory(), not test ObjectFile::BaseAddress(). 
ObjectFile::BaseAddress() is designed to be overridden by all classes and is 
for mach-o, ELF and COFF plug-ins. They find the header base adddress and 
return that as a section offset address. The default implementation of 
ObjectFile::BaseAddress() does try and make an Address() from the 
ObjectFile::m_memory_addr, but I switched it to a correct function call.

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e7701c350ff5..babe5a384727 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1628,7 +1628,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const 
load_command &load_cmd_,
   } else if (unified_section_sp) {
 if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
   // Check to see if the module was read from memory?
-  if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
+  if (module_sp->GetObjectFile()->IsInMemory()) {
 // We have a module that is in memory and needs to have its file
 // address adjusted. We need to do this because when we load a file
 // from memory, its addresses will be slid already, yet the addresses



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


[Lldb-commits] [PATCH] D86122: Fix a check that was attempting to see if an object file was in memory.

2020-08-18 Thread Greg Clayton via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08748d15b8d6: Fix a check that was attempting to see if an 
object file was in memory. (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86122

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1628,7 +1628,7 @@
   } else if (unified_section_sp) {
 if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
   // Check to see if the module was read from memory?
-  if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
+  if (module_sp->GetObjectFile()->IsInMemory()) {
 // We have a module that is in memory and needs to have its file
 // address adjusted. We need to do this because when we load a file
 // from memory, its addresses will be slid already, yet the addresses


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1628,7 +1628,7 @@
   } else if (unified_section_sp) {
 if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
   // Check to see if the module was read from memory?
-  if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
+  if (module_sp->GetObjectFile()->IsInMemory()) {
 // We have a module that is in memory and needs to have its file
 // address adjusted. We need to do this because when we load a file
 // from memory, its addresses will be slid already, yet the addresses
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal

2020-08-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/tools/lldb-vscode/VSCode.cpp:410
+
+VSCode::PacketStatus VSCode::SendReverseRequest(llvm::json::Object &request,
+llvm::json::Object &response) {

clayborg wrote:
> add "const" to before "llvm::json::Object &request"
I see we are modifying "request" below, so we can't make it "const". There are 
two ways to fix this:
1 - change it to be "llvm::json::Object request" and then use std::move() when 
calling SendReverseRequest. 
2 - just leave as a reference and modify the original object.

I think I prefer option #1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84974

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


[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal

2020-08-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/tools/lldb-vscode/VSCode.cpp:410
+
+VSCode::PacketStatus VSCode::SendReverseRequest(llvm::json::Object &request,
+llvm::json::Object &response) {

clayborg wrote:
> clayborg wrote:
> > add "const" to before "llvm::json::Object &request"
> I see we are modifying "request" below, so we can't make it "const". There 
> are two ways to fix this:
> 1 - change it to be "llvm::json::Object request" and then use std::move() 
> when calling SendReverseRequest. 
> 2 - just leave as a reference and modify the original object.
> 
> I think I prefer option #1.
Or we can leave this as "const" as originally suggested and add a function to 
VSCode:

```
llvm::json::Object VSCode::CreateReverseRequest(std::string command) {
  llvm::json::Object request;
  request.try_emplace("type", "request");
  request.try_emplace("command", command);
  request.try_emplace("seq", ++reverse_request_seq);
  return request;
}

```
And call that in request_runInTerminal when creating the reverse request 
packet. See other inline comment for details.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1453-1455
+  llvm::json::Object reverseRequest;
+  reverseRequest.try_emplace("type", "request");
+  reverseRequest.try_emplace("command", "runInTerminal");

This could become:

```
llvm::json::Object reverseRequest = g_vsc.CreateReverseRequest("runInTerminal");
```
And then we wouldn't need to add the "seq" key/value pair in SendReverseRequest


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84974

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


[Lldb-commits] [PATCH] D86174: [lldb] Convert builders to classes so we can use inheritance to override platform specific methods

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, labath.
Herald added subscribers: teemperor, emaste.
JDevlieghere requested review of this revision.

Use inheritance and a factory method to hand out builders instead of importing 
the desired module. This has the advantage that the platform specific 
implementations can override methods as they desire.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D86174

Files:
  lldb/packages/Python/lldbsuite/builders/__init__.py
  lldb/packages/Python/lldbsuite/builders/builder.py
  lldb/packages/Python/lldbsuite/builders/darwin.py
  lldb/packages/Python/lldbsuite/builders/freebsd.py
  lldb/packages/Python/lldbsuite/builders/linux.py
  lldb/packages/Python/lldbsuite/builders/netbsd.py
  lldb/packages/Python/lldbsuite/builders/openbsd.py
  lldb/packages/Python/lldbsuite/builders/win32.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py

Index: lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
+++ /dev/null
@@ -1,28 +0,0 @@
-
-import lldbsuite.test.lldbtest as lldbtest
-
-from builder_base import *
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None,
-testname=None):
-"""Build the binaries with dsym debug info."""
-commands = []
-commands.append(getMake(testdir, testname) +
-["MAKE_DSYM=YES",
- getArchSpec(architecture),
- getCCSpec(compiler),
- getDsymutilSpec(),
- getSDKRootSpec(),
- getModuleCacheSpec(),
- "all",
- getCmdLine(dictionary)])
-
-runBuildCommands(commands, sender=sender)
-
-# True signifies that we can handle building dsym.
-return True
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ /dev/null
@@ -1,263 +0,0 @@
-"""
-If the build* function is passed the compiler argument, for example, 'llvm-gcc',
-it is passed as a make variable to the make command.  Otherwise, we check the
-LLDB_CC 

[Lldb-commits] [lldb] 514bcb3 - [lldb] Remove unused function getArchFlag (NFC)

2020-08-18 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-08-18T15:20:57-07:00
New Revision: 514bcb325dc9584f378be982ce102d8d5a531d5c

URL: 
https://github.com/llvm/llvm-project/commit/514bcb325dc9584f378be982ce102d8d5a531d5c
DIFF: 
https://github.com/llvm/llvm-project/commit/514bcb325dc9584f378be982ce102d8d5a531d5c.diff

LOG: [lldb] Remove unused function getArchFlag (NFC)

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/plugins/builder_base.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py 
b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
index 4d355d9d8805..a14b0de7d097 100644
--- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -37,20 +37,6 @@ def getCompiler():
 return os.path.abspath(compiler)
 
 
-def getArchFlag():
-"""Returns the flag required to specify the arch"""
-compiler = getCompiler()
-if compiler is None:
-return ""
-elif "gcc" in compiler:
-archflag = "-m"
-elif "clang" in compiler:
-archflag = "-arch"
-else:
-archflag = None
-
-return ("ARCHFLAG=" + archflag) if archflag else ""
-
 def getMake(test_subdir, test_name):
 """Returns the invocation for GNU make.
The first argument is a tuple of the relative path to the testcase



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


[Lldb-commits] [PATCH] D85539: [lldb] Extend builder to pass the TRIPLE spec to Make

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 286431.
JDevlieghere added a comment.

Reimplement based on passing the ARCH_CFLAGS to Make


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85539

Files:
  lldb/packages/Python/lldbsuite/builders/builder.py
  lldb/packages/Python/lldbsuite/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -94,65 +94,6 @@
 # from the triple alone
 #--
 ARCH_CFLAGS :=
-ifneq "$(TRIPLE)" ""
-	triple_space = $(subst -, ,$(TRIPLE))
-	ARCH =$(word 1, $(triple_space))
-	TRIPLE_VENDOR =$(word 2, $(triple_space))
-	triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed 's/\([a-z]*\)\(.*\)/\1 \2/')
-	TRIPLE_OS =$(word 1, $(triple_os_and_version))
-	TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
-	TRIPLE_ENV =$(word 4, $(triple_space))
-	ifeq "$(TRIPLE_VENDOR)" "apple"
-		ifeq "$(TRIPLE_OS)" "ios"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := iphonesimulator
-			else
-			ifeq "$(TRIPLE_ENV)" "macabi"
-SDK_NAME := macosx
-			else
-SDK_NAME := iphoneos
-			endif
-			endif
-		endif
-		ifeq "$(TRIPLE_OS)" "tvos"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := appletvsimulator
-			else
-SDK_NAME := appletvos
-			endif
-		endif
-		ifeq "$(TRIPLE_OS)" "watchos"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := watchsimulator
-			else
-SDK_NAME := watchos
-			endif
-		endif
-		ifneq "$(TRIPLE_OS)" "macosx"
-			ifeq "$(TRIPLE_ENV)" ""
-CODESIGN := codesign
-			endif
-		endif
-
-		ifeq "$(SDKROOT)" ""
-			SDKROOT := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-path)
-		endif
-		ifeq "$(TRIPLE_VERSION)" ""
-			ifeq "$(SDK_NAME)" ""
-   $(error "SDK_NAME is empty")
-			endif
-			TRIPLE_VERSION := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-version)
-		endif
-		ifeq "$(TRIPLE_ENV)" "simulator"
-			ARCH_CFLAGS := -m$(TRIPLE_OS)-simulator-version-min=$(TRIPLE_VERSION)
-		else
-		ifneq "$(TRIPLE_OS)" "macosx"
-			ARCH_CFLAGS := -m$(TRIPLE_OS)-version-min=$(TRIPLE_VERSION)
-		endif
-		endif
-	endif
-	ARCH_CFLAGS += -target $(TRIPLE)
-endif
 ifeq "$(OS)" "Android"
 	include $(THIS_FILE_DIR)/Android.rules
 endif
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -766,15 +766,6 @@
 return ver
 
 
-def setDefaultTripleForPlatform():
-if configuration.lldb_platform_name == 'ios-simulator':
-triple_str = 'x86_64-apple-ios%s' % (
-getVersionForSDK('iphonesimulator'))
-os.environ['TRIPLE'] = triple_str
-return {'TRIPLE': triple_str}
-return {}
-
-
 def checkCompiler():
 # Add some intervention here to sanity check that the compiler requested is sane.
 # If found not to be an executable program, we abort.
@@ -947,14 +938,6 @@
 else:
 configuration.lldb_platform_url = None
 
-platform_changes = setDefaultTripleForPlatform()
-first = True
-for key in platform_changes:
-if first:
-print("Environment variables setup for platform support:")
-first = False
-print("%s = %s" % (key, platform_changes[key]))
-
 if configuration.lldb_platform_working_dir:
 print("Setting remote platform working directory to '%s'..." %
   (configuration.lldb_platform_working_dir))
Index: lldb/packages/Python/lldbsuite/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/builders/darwin.py
@@ -1,7 +1,105 @@
+import re
+
 from .builder import Builder
+from lldbsuite.test import configuration
+
+REMOTE_PLATFORM_NAME_RE = re.compile(r"^remote-(.+)$")
+SIMULATOR_PLATFORM_RE = re.compile(r"^(.+)-simulator$")
+
+
+def get_sdk(os, env):
+if os == "ios":
+if env == "simulator":
+return "iphonesimulator"
+if env == "macabi":
+return "macosx"
+return "iphoneos"
+elif os == "tvos":
+if env == "simulator":
+return "appletvsimulator"
+return "appletvos"
+elif os == "watchos":
+if env == "simulator":
+return "watchsimulator"
+return "watchos"
+return os
+
+
+def get_os_env_from_platform(platform):
+match = REMOTE_PLATFORM_NAME_RE.match(platform)
+if match:
+return match.group(1), ""
+match = SIMULATOR_PLATFORM_RE.match(platform)
+if match

[Lldb-commits] [PATCH] D85539: [lldb] Extend builder to pass the TRIPLE spec to Make

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/packages/Python/lldbsuite/builders/builder.py:224
 "MAKE_DSYM=NO", "MAKE_DWO=YES",
-getArchSpec(architecture),
-getCCSpec(compiler),
-getDsymutilSpec(),
-getSDKRootSpec(),
-getModuleCacheSpec(),
-getCmdLine(dictionary)
+self.getArchCFlags(architecture),
+self.getArchSpec(architecture),

This should've been part of D86174, I'll fix that before updating the 
patch/landing. 


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85539

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


[Lldb-commits] [PATCH] D86174: [lldb] Convert builders to classes so we can use inheritance to override platform specific methods (NFC)

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 286454.

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

https://reviews.llvm.org/D86174

Files:
  lldb/packages/Python/lldbsuite/builders/__init__.py
  lldb/packages/Python/lldbsuite/builders/builder.py
  lldb/packages/Python/lldbsuite/builders/darwin.py
  lldb/packages/Python/lldbsuite/builders/freebsd.py
  lldb/packages/Python/lldbsuite/builders/linux.py
  lldb/packages/Python/lldbsuite/builders/netbsd.py
  lldb/packages/Python/lldbsuite/builders/openbsd.py
  lldb/packages/Python/lldbsuite/builders/win32.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
  lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py

Index: lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_openbsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from builder_base import *
-
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None):
-return False
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py
+++ /dev/null
@@ -1,28 +0,0 @@
-
-import lldbsuite.test.lldbtest as lldbtest
-
-from builder_base import *
-
-def buildDsym(
-sender=None,
-architecture=None,
-compiler=None,
-dictionary=None,
-testdir=None,
-testname=None):
-"""Build the binaries with dsym debug info."""
-commands = []
-commands.append(getMake(testdir, testname) +
-["MAKE_DSYM=YES",
- getArchSpec(architecture),
- getCCSpec(compiler),
- getDsymutilSpec(),
- getSDKRootSpec(),
- getModuleCacheSpec(),
- "all",
- getCmdLine(dictionary)])
-
-runBuildCommands(commands, sender=sender)
-
-# True signifies that we can handle building dsym.
-return True
Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
===
--- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ /dev/null
@@ -1,249 +0,0 @@
-"""
-If the build* function is passed the compiler argument, for example, 'llvm-gcc',
-it is passed as a make variable to the make command.  Otherwise, we check the
-LLDB_CC environment variable; if it is defined, it is passed as a make variable
-to the make command.
-
-If neither the compiler keyword argument nor the LLDB_CC environment variable is
-specified, no CC make variable is passed to the make command.  The Makefile gets
-to define the default CC be

[Lldb-commits] [PATCH] D85539: [lldb] Extend builder to pass the TRIPLE spec to Make

2020-08-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 286455.

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

https://reviews.llvm.org/D85539

Files:
  lldb/packages/Python/lldbsuite/builders/builder.py
  lldb/packages/Python/lldbsuite/builders/darwin.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -94,65 +94,6 @@
 # from the triple alone
 #--
 ARCH_CFLAGS :=
-ifneq "$(TRIPLE)" ""
-	triple_space = $(subst -, ,$(TRIPLE))
-	ARCH =$(word 1, $(triple_space))
-	TRIPLE_VENDOR =$(word 2, $(triple_space))
-	triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed 's/\([a-z]*\)\(.*\)/\1 \2/')
-	TRIPLE_OS =$(word 1, $(triple_os_and_version))
-	TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
-	TRIPLE_ENV =$(word 4, $(triple_space))
-	ifeq "$(TRIPLE_VENDOR)" "apple"
-		ifeq "$(TRIPLE_OS)" "ios"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := iphonesimulator
-			else
-			ifeq "$(TRIPLE_ENV)" "macabi"
-SDK_NAME := macosx
-			else
-SDK_NAME := iphoneos
-			endif
-			endif
-		endif
-		ifeq "$(TRIPLE_OS)" "tvos"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := appletvsimulator
-			else
-SDK_NAME := appletvos
-			endif
-		endif
-		ifeq "$(TRIPLE_OS)" "watchos"
-			ifeq "$(TRIPLE_ENV)" "simulator"
-SDK_NAME := watchsimulator
-			else
-SDK_NAME := watchos
-			endif
-		endif
-		ifneq "$(TRIPLE_OS)" "macosx"
-			ifeq "$(TRIPLE_ENV)" ""
-CODESIGN := codesign
-			endif
-		endif
-
-		ifeq "$(SDKROOT)" ""
-			SDKROOT := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-path)
-		endif
-		ifeq "$(TRIPLE_VERSION)" ""
-			ifeq "$(SDK_NAME)" ""
-   $(error "SDK_NAME is empty")
-			endif
-			TRIPLE_VERSION := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-version)
-		endif
-		ifeq "$(TRIPLE_ENV)" "simulator"
-			ARCH_CFLAGS := -m$(TRIPLE_OS)-simulator-version-min=$(TRIPLE_VERSION)
-		else
-		ifneq "$(TRIPLE_OS)" "macosx"
-			ARCH_CFLAGS := -m$(TRIPLE_OS)-version-min=$(TRIPLE_VERSION)
-		endif
-		endif
-	endif
-	ARCH_CFLAGS += -target $(TRIPLE)
-endif
 ifeq "$(OS)" "Android"
 	include $(THIS_FILE_DIR)/Android.rules
 endif
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -766,15 +766,6 @@
 return ver
 
 
-def setDefaultTripleForPlatform():
-if configuration.lldb_platform_name == 'ios-simulator':
-triple_str = 'x86_64-apple-ios%s' % (
-getVersionForSDK('iphonesimulator'))
-os.environ['TRIPLE'] = triple_str
-return {'TRIPLE': triple_str}
-return {}
-
-
 def checkCompiler():
 # Add some intervention here to sanity check that the compiler requested is sane.
 # If found not to be an executable program, we abort.
@@ -947,14 +938,6 @@
 else:
 configuration.lldb_platform_url = None
 
-platform_changes = setDefaultTripleForPlatform()
-first = True
-for key in platform_changes:
-if first:
-print("Environment variables setup for platform support:")
-first = False
-print("%s = %s" % (key, platform_changes[key]))
-
 if configuration.lldb_platform_working_dir:
 print("Setting remote platform working directory to '%s'..." %
   (configuration.lldb_platform_working_dir))
Index: lldb/packages/Python/lldbsuite/builders/darwin.py
===
--- lldb/packages/Python/lldbsuite/builders/darwin.py
+++ lldb/packages/Python/lldbsuite/builders/darwin.py
@@ -1,7 +1,106 @@
+import re
+import subprocess
+
 from .builder import Builder
+from lldbsuite.test import configuration
+
+REMOTE_PLATFORM_NAME_RE = re.compile(r"^remote-(.+)$")
+SIMULATOR_PLATFORM_RE = re.compile(r"^(.+)-simulator$")
+
+
+def get_sdk(os, env):
+if os == "ios":
+if env == "simulator":
+return "iphonesimulator"
+if env == "macabi":
+return "macosx"
+return "iphoneos"
+elif os == "tvos":
+if env == "simulator":
+return "appletvsimulator"
+return "appletvos"
+elif os == "watchos":
+if env == "simulator":
+return "watchsimulator"
+return "watchos"
+return os
+
+
+def get_os_env_from_platform(platform):
+match = REMOTE_PLATFORM_NAME_RE.match(platform)
+if match:
+return match.group(1), ""
+match = SIMULATOR_PLATFORM_RE.match(platform)
+if match:
+return match.group(1), "simulator"
+return None, None
+
+
+def get_os_from_sd

[Lldb-commits] [PATCH] D86194: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

Modified tests:

test/tools/yaml2obj/ELF/debug-abbrev.yaml: Add one more abbrev table in test 
case (a).
test/tools/yaml2obj/ELF/debug-info.yaml: Add test case (n). Test that yaml2obj 
emits an error message when a compilation unit has values but there is no 
associated abbrev tables.

The generated abbrev tables are verified using llvm-dwarfdump.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86194

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


[Lldb-commits] [PATCH] D86194: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:259-265
+  if (AbbrevTable.empty())
+return createStringError(
+errc::invalid_argument,
+"non-empty compilation unit should have an associated abbrev table");
+
+  ArrayRef AbbrevDecls(AbbrevTable[0].Table);
+

>>! Comments from [D83116](https://reviews.llvm.org/D83116#inline-795444)
> @jhenderson : It might make more sense to do this work in the caller of this 
> function, and to maintain this function's interface.

Some DIEs only have abbrev codes and do not have values. If we do this work in 
the caller of this function, yaml2obj will reject empty DIEs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86194

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