[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-12 Thread Petr Hosek via Phabricator via lldb-commits
phosek added a comment.

In D79219#2203887 , @lxfind wrote:

> In D79219#2201415 , @phosek wrote:
>
>> This is correct. That target is provided by `find_package(ZLIB)`. In 
>> LLVMConfig.cmake, we invoke `find_package(ZLIB)` when zlib support is 
>> enabled. If you're using `LLVMExports.cmake`, you'll need to invoke 
>> `find_package(ZLIB)` yourself.
>
> @phosek, Thanks for the reply. I am not too familiar with this. Could you 
> please elaborate more on why setting it to `ZLIB::ZLIB` here is more modern? 
> And how one is expected to deal with `ZLIB::ZLIB` that shows up in 
> LLVMExports.cmake` (in the modern way)? Should one string pattern matching 
> for `ZLIB::ZLIB` and invoke `find_package(ZLIB)` again? (previously one could 
> simply concatenate `-l` with the library name in there.

@lxfind `ZLIB::ZLIB` is the name of the imported target that's defined by CMake 
when you invoke `find_dependency(ZLIB)`. Ideally, you'd just use 
`LLVMConfig.cmake` which invokes that for you if needed. 
https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ has some 
more details.

`ZLIB::ZLIB` includes the correct include and library directory, so you no 
longer have to manually append `-I` or `-l`, all you need is to include 
`ZLIB::ZLIB` in the list of your dependencies, which is one advantage. Another 
advantage is that `ZLIB::ZLIB` can expand to different things, for example some 
users may want to statically link zlib in which case they would configure their 
build accordingly and `ZLIB::ZLIB` would expand into `/path/to/libz.a` (this is 
for example what we do in our toolchain build), others may be fine using the 
default system library in which case `ZLIB::ZLIB` would typically expand to 
just `z`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219

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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-12 Thread Christian Kühnel via Phabricator via lldb-commits
kuhnel added a comment.

@phosek sorry for the late reply, the builds on master are still green, so your 
changes are working on Windows as well.

Thank you for the extra work!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219

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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-12 Thread Petr Hosek 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 rG31e5f7120bdd: [CMake] Simplify CMake handling for zlib 
(authored by phosek).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219

Files:
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/test/lit.common.configured.in
  lld/test/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/CRC.cpp
  llvm/lib/Support/Compression.cpp
  llvm/test/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/unittests/Support/CompressionTest.cpp
  llvm/utils/gn/secondary/clang/test/BUILD.gn
  llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
  llvm/utils/gn/secondary/lld/test/BUILD.gn
  llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
  llvm/utils/gn/secondary/llvm/test/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/test/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -174,9 +174,9 @@
   }
 
   if (llvm_enable_zlib) {
-extra_values += [ "HAVE_LIBZ=1" ]
+extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
   } else {
-extra_values += [ "HAVE_LIBZ=0" ]  # Must be 0.
+extra_values += [ "LLVM_ENABLE_ZLIB=0" ]  # Must be 0.
   }
 }
 
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
@@ -295,20 +295,10 @@
 values += [ "LLVM_ENABLE_DIA_SDK=" ]
   }
 
-  # FIXME: Once https://reviews.llvm.org/D79219 is in, remove the two
-  # redundant HAVE_ variables.
   if (llvm_enable_zlib) {
-values += [
-  "HAVE_LIBZ=1",
-  "HAVE_ZLIB_H=1",
-  "LLVM_ENABLE_ZLIB=1",
-]
+values += [ "LLVM_ENABLE_ZLIB=1" ]
   } else {
-values += [
-  "HAVE_LIBZ=",
-  "HAVE_ZLIB_H=",
-  "LLVM_ENABLE_ZLIB=",
-]
+values += [ "LLVM_ENABLE_ZLIB=" ]
   }
 
   if (llvm_enable_libxml2) {
Index: llvm/utils/gn/secondary/lld/test/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/test/BUILD.gn
+++ llvm/utils/gn/secondary/lld/test/BUILD.gn
@@ -49,9 +49,9 @@
   }
 
   if (llvm_enable_zlib) {
-extra_values += [ "HAVE_LIBZ=1" ]
+extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
   } else {
-extra_values += [ "HAVE_LIBZ=0" ]  # Must be 0.
+extra_values += [ "LLVM_ENABLE_ZLIB=0" ]  # Must be 0.
   }
 
   if (current_cpu == "x64" || current_cpu == "arm64" ||
Index: llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
===
--- llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
+++ llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
@@ -86,8 +86,8 @@
   }
 
   if (llvm_enable_zlib) {
-values += [ "HAVE_LIBZ=1" ]
+values += [ "LLVM_ENABLE_ZLIB=1" ]
   } else {
-values += [ "HAVE_LIBZ=0" ]
+values += [ "LLVM_ENABLE_ZLIB=0" ]
   }
 }
Index: llvm/utils/gn/secondary/clang/test/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -79,9 +79,9 @@
   }
 
   if (llvm_enable_zlib) {
-extra_values += [ "HAVE_LIBZ=1" ]
+extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
   } else {
-extra_values += [ "HAVE_LIBZ=0" ]  # Must be 0.
+extra_values += [ "LLVM_ENABLE_ZLIB=0" ]  # Must be 0.
   }
 
   if (host_cpu == "x64") {
Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -21,7 +21,7 @@
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 
 void TestZlibCompression(StringRef Input, int Level) {
   SmallString<32> Compressed;
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -33,7 +33,7 @@
 config.host_ldflags = '@HOST_LDFLAGS@'
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @HAVE_LIBZ@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_libxar = @HAVE_LIBXAR@
 config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
 config.enable_ffi = @LLVM_ENABLE_FFI@

[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-08-12 Thread Harmen Stoppels via Phabricator via lldb-commits
haampie added a comment.

Great, one benefit of this is that zlib can now be detected in non-system libs. 
Maybe we should handle ncurses / TERMINFO in a similar manner? It currently has 
similar logic as finding zlib had


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219

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


[Lldb-commits] [lldb] dd0fdf8 - [lldb] Add support for checking children in expect_expr

2020-08-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-08-12T12:11:24+02:00
New Revision: dd0fdf80301e0b875d1898e01542c43b991e1b1c

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

LOG: [lldb] Add support for checking children in expect_expr

expect_expr currently can't verify the children of the result SBValue.

This patch adds the ability to check them. The idea is to have a CheckValue
class where one can specify what attributes of a SBValue should be checked.
Beside the properties we already check for (summary, type, etc.) this also
has a list of children which is again just a list of CheckValue object (which
can also have children of their own).

The main motivation is to make checking the children no longer based
on error-prone substring checks that allow tests to pass just because
for example the error message contains the expected substrings by accident.

I also expect that we can just have a variant of `expect_expr` for LLDB's
expression paths (aka 'frame var') feature.

Reviewed By: labath

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index cc651e5b061d..ba1556794366 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -242,6 +242,77 @@ def which(program):
 return exe_file
 return None
 
+class ValueCheck:
+def __init__(self, name=None, value=None, type=None, summary=None,
+ children=None):
+"""
+:param name: The name that the SBValue should have. None if the summary
+ should not be checked.
+:param summary: The summary that the SBValue should have. None if the
+summary should not be checked.
+:param value: The value that the SBValue should have. None if the value
+  should not be checked.
+:param type: The type that the SBValue result should have. None if the
+ type should not be checked.
+:param children: A list of ValueChecks that need to match the children
+ of this SBValue. None if children shouldn't be 
checked.
+ The order of checks is the order of the checks in the
+ list. The number of checks has to match the number of
+ children.
+"""
+self.expect_name = name
+self.expect_value = value
+self.expect_type = type
+self.expect_summary = summary
+self.children = children
+
+def check_value(self, test_base, val, error_msg=None):
+"""
+Checks that the given value matches the currently set properties
+of this ValueCheck. If a match failed, the given TestBase will
+be used to emit an error. A custom error message can be specified
+that will be used to describe failed check for this SBValue (but
+not errors in the child values).
+"""
+
+this_error_msg = error_msg if error_msg else ""
+this_error_msg += "\nChecking SBValue: " + str(val)
+
+test_base.assertSuccess(val.GetError())
+
+if self.expect_name:
+test_base.assertEqual(self.expect_name, val.GetName(),
+  this_error_msg)
+if self.expect_value:
+test_base.assertEqual(self.expect_value, val.GetValue(),
+  this_error_msg)
+if self.expect_type:
+test_base.assertEqual(self.expect_type, val.GetDisplayTypeName(),
+  this_error_msg)
+if self.expect_summary:
+test_base.assertEqual(self.expect_summary, val.GetSummary(),
+  this_error_msg)
+if self.children is not None:
+self.check_value_children(test_base, val, error_msg)
+
+def check_value_children(self, test_base, val, error_msg=None):
+"""
+Checks that the children of a SBValue match a certain structure and
+have certain properties.
+
+:param test_base: The current test's TestBase object.
+:param val: The SBValue to check.
+"""
+
+this_error_msg = error_msg if error_msg else ""
+this_error_msg += "\nChecking SBValue: " + str(val)
+
+test_base.assertEqual(len(self.children), val.GetNumChildren(), 
this_error_msg)

[Lldb-commits] [PATCH] D83792: [lldb] Add support for checking children in expect_expr

2020-08-12 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdd0fdf80301e: [lldb] Add support for checking children in 
expect_expr (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83792

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
@@ -26,16 +26,15 @@
  '[6] = 1234567',
  '}'])
 
-self.expect("p " + var_name,
-substrs=['$', 'size=7',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '[4] = 12345',
- '[5] = 123456',
- '[6] = 1234567',
- '}'])
+self.expect_expr(var_name, result_summary="size=7", result_children=[
+ValueCheck(value="1"),
+ValueCheck(value="12"),
+ValueCheck(value="123"),
+ValueCheck(value="1234"),
+ValueCheck(value="12345"),
+ValueCheck(value="123456"),
+ValueCheck(value="1234567"),
+])
 
 # check access-by-index
 self.expect("frame variable " + var_name + "[0]",
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
@@ -19,6 +19,11 @@
 ns = 'ndk' if lldbplatformutil.target_is_android() else ''
 self.namespace = 'std'
 
+def check_pair(self, first_value, second_value):
+pair_children = [ValueCheck(name="first", value=first_value),
+ ValueCheck(name="second", value=second_value)]
+return ValueCheck(children=pair_children)
+
 @add_test_categories(["libc++"])
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
@@ -51,10 +56,8 @@
 self.addTearDownHook(cleanup)
 
 ns = self.namespace
-self.expect('p ii',
-substrs=['%s::map' % ns,
- 'size=0',
- '{}'])
+self.expect_expr("ii", result_summary="size=0", result_children=[])
+
 self.expect('frame var ii',
 substrs=['%s::map' % ns,
  'size=0',
@@ -62,14 +65,10 @@
 
 lldbutil.continue_to_breakpoint(self.process(), bkpt)
 
-self.expect('p ii',
-substrs=['%s::map' % ns, 'size=2',
- '[0] = ',
- 'first = 0',
- 'second = 0',
- '[1] = ',
- 'first = 1',
- 'second = 1'])
+self.expect_expr("ii", result_summary="size=2", result_children=[
+self.check_pair("0", "0"),
+self.check_pair("1", "1")
+])
 
 self.expect('frame variable ii',
 substrs=['%s::map' % ns, 'size=2',
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -242,6 +242,77 @@
 return exe_file
 return None
 
+class ValueCheck:
+def __init__(self, name=None, value=None, type=None, summary=None,
+ children=None):
+"""
+:param name: The name that the SBValue should have. None if the summary
+ should not be checked.
+:param summary: The summary that the SBValue should have. None if the
+summary should not be checked.
+:param value: The value that the SBValue should have. None if the value
+  should not be checked.
+:param type: The typ

[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-12 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG246afe0cd17f: [lldb] Display autosuggestion part in gray if 
there is one possible suggestion (authored by gedatsu217, committed by 
teemperor).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D81001?vs=283686&id=285034#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81001

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Host/Editline.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Host/common/Editline.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py

Index: lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
===
--- /dev/null
+++ lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
@@ -0,0 +1,105 @@
+"""
+Tests autosuggestion using pexpect.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+def cursor_horizontal_abs(s):
+return "\x1b[" + str(len(s) + 1) + "G"
+
+
+
+class TestCase(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfEditlineSupportMissing
+def test_autosuggestion_add_spaces(self):
+self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
+
+# Common input codes and escape sequences.
+faint_color = "\x1b[2m"
+reset = "\x1b[0m"
+
+# Check if spaces are added to hide the previous gray characters.
+self.expect("help frame var")
+self.expect("help frame info")
+self.child.send("help frame v")
+self.child.expect_exact(cursor_horizontal_abs("(lldb) help frame ") + "v" + faint_color + "ar" + reset + " ")
+
+self.quit()
+
+@skipIfAsan
+@skipIfEditlineSupportMissing
+def test_autosuggestion(self):
+self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
+
+# Common input codes and escape sequences.
+ctrl_f = "\x06"
+faint_color = "\x1b[2m"
+reset = "\x1b[0m"
+delete = chr(127)
+
+frame_output_needle = "Syntax: frame "
+# Run 'help frame' once to put it into the command history.
+self.expect("help frame", substrs=[frame_output_needle])
+
+# Check that LLDB shows the autosuggestion in gray behind the text.
+self.child.send("hel")
+self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + faint_color + "p frame" + reset)
+
+# Apply the autosuggestion and press enter. This should print the
+# 'help frame' output if everything went correctly.
+self.child.send(ctrl_f + "\n")
+self.child.expect_exact(frame_output_needle)
+
+# Check that pressing Ctrl+F directly after Ctrl+F again does nothing.
+self.child.send("hel" + ctrl_f + ctrl_f + "\n")
+self.child.expect_exact(frame_output_needle)
+
+# Try autosuggestion using tab and ^f.
+# \t makes "help" and ^f makes "help frame". If everything went
+# correct we should see the 'help frame' output again.
+self.child.send("hel\t" + ctrl_f + "\n")
+self.child.expect_exact(frame_output_needle)
+
+# Check that autosuggestion works after delete.
+self.child.send("a1234" + 5 * delete + "hel" + ctrl_f + "\n")
+self.child.expect_exact(frame_output_needle)
+
+# Check that autosuggestion works after delete.
+self.child.send("help x" + delete + ctrl_f + "\n")
+self.child.expect_exact(frame_output_needle)
+
+# Check that autosuggestion complete to the most recent one.
+self.child.send("help frame variable\n")
+self.child.send("help fr")
+self.child.expect_exact(faint_color + "ame variable" + reset)
+self.child.send("\n")
+
+# Try another command.
+apropos_output_needle = "Syntax: apropos "
+# Run 'help frame' once to put it into the command history.
+self.expect("help apropos", substrs=[apropos_output_needle])
+
+# Check that 'hel' should have an autosuggestion for 'help apropos' now.
+self.child.send("hel")
+self.child.expect_exact(cursor_horizontal_abs("(lldb) he") + "l" + faint_color + "p apropos" + reset)
+
+# Run the command and expect the 'help apropos' output.
+self.child.send(ctrl_f + "\n")
+self.child.expect_exact(apropos_output

[Lldb-commits] [lldb] 246afe0 - [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-12 Thread Raphael Isemann via lldb-commits

Author: Shu Anzai
Date: 2020-08-12T13:11:20+02:00
New Revision: 246afe0cd17fce935a01171f3cca548e02523e5c

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

LOG: [lldb] Display autosuggestion part in gray if there is one possible 
suggestion

I implemented autosuggestion if there is one possible suggestion.
I set the keybinds for every character. When a character is typed, 
Editline::TypedCharacter is called.
Then, autosuggestion part is displayed in gray, and you can actually input by 
typing C-k.
Editline::Autosuggest is a function for finding completion, and it is like 
Editline::TabCommand now, but I will add more features to it.

Testing does not work well in my environment, so I can't confirm that it goes 
well, sorry. I am dealing with it now.

Reviewed By: teemperor, JDevlieghere, #lldb

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

Added: 
lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py

Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Host/Editline.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Interpreter/CommandInterpreter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 7bea0dbae082..252380de2786 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -273,6 +273,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   bool SetUseColor(bool use_color);
 
+  bool GetUseAutosuggestion() const;
+
   bool GetUseSourceCache() const;
 
   bool SetUseSourceCache(bool use_source_cache);

diff  --git a/lldb/include/lldb/Core/IOHandler.h 
b/lldb/include/lldb/Core/IOHandler.h
index 51592afbbabe..f29482c0c97a 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -203,6 +203,9 @@ class IOHandlerDelegate {
 
   virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
 
+  virtual llvm::Optional IOHandlerSuggestion(IOHandler 
&io_handler,
+  llvm::StringRef 
line);
+
   virtual void IOHandlerComplete(IOHandler &io_handler,
  CompletionRequest &request);
 
@@ -420,6 +423,9 @@ class IOHandlerEditline : public IOHandler {
   static int FixIndentationCallback(Editline *editline, const StringList 
&lines,
 int cursor_position, void *baton);
 
+  static llvm::Optional SuggestionCallback(llvm::StringRef line,
+void *baton);
+
   static void AutoCompleteCallback(CompletionRequest &request, void *baton);
 #endif
 

diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index 356e8f734732..a37ad1b9d106 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -98,6 +98,9 @@ typedef int (*FixIndentationCallbackType)(Editline *editline,
   const StringList &lines,
   int cursor_position, void *baton);
 
+typedef llvm::Optional (*SuggestionCallbackType)(
+llvm::StringRef line, void *baton);
+
 typedef void (*CompleteCallbackType)(CompletionRequest &request, void *baton);
 
 /// Status used to decide when and how to start editing another line in
@@ -184,6 +187,9 @@ class Editline {
   /// Cancel this edit and oblitarate all trace of it
   bool Cancel();
 
+  /// Register a callback for autosuggestion.
+  void SetSuggestionCallback(SuggestionCallbackType callback, void *baton);
+
   /// Register a callback for the tab key
   void SetAutoCompleteCallback(CompleteCallbackType callback, void *baton);
 
@@ -312,6 +318,12 @@ class Editline {
   /// tab key is typed.
   unsigned char TabCommand(int ch);
 
+  /// Apply autosuggestion part in gray as editline.
+  unsigned char ApplyAutosuggestCommand(int ch);
+
+  /// Command used when a character is typed.
+  unsigned char TypedCharacter(int ch);
+
   /// Respond to normal character insertion by fixing line indentation
   unsigned char FixIndentationCommand(int ch);
 
@@ -360,7 +372,9 @@ class Editline {
   const char *m_fix_indentation_callback_chars = nullptr;
   CompleteCallbackType m_completion_callback = nullptr;
   void *m_completion_callback_baton = nullptr;
-
+  SuggestionCallbackType m_suggestion_callback = nullptr;
+  void *m_suggestion_callback_baton = nullptr;
+  std::size_t m_previous_autosuggestion_size = 0;
   std::mutex m_output_mutex;
 };
 }

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lld

[Lldb-commits] [lldb] cff880b - Revert "[lldb] Display autosuggestion part in gray if there is one possible suggestion"

2020-08-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-08-12T13:52:03+02:00
New Revision: cff880b0c9a07ff8275e91982c0d6e2293b537e7

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

LOG: Revert "[lldb] Display autosuggestion part in gray if there is one 
possible suggestion"

This reverts commit 246afe0cd17fce935a01171f3cca548e02523e5c. This broke
the following tests on Linux it seems:
  lldb-api :: 
commands/expression/multiline-completion/TestMultilineCompletion.py
  lldb-api :: iohandler/completion/TestIOHandlerCompletion.py

Added: 


Modified: 
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Host/Editline.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Interpreter/CommandInterpreter.cpp

Removed: 
lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py



diff  --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 252380de2786..7bea0dbae082 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -273,8 +273,6 @@ class Debugger : public 
std::enable_shared_from_this,
 
   bool SetUseColor(bool use_color);
 
-  bool GetUseAutosuggestion() const;
-
   bool GetUseSourceCache() const;
 
   bool SetUseSourceCache(bool use_source_cache);

diff  --git a/lldb/include/lldb/Core/IOHandler.h 
b/lldb/include/lldb/Core/IOHandler.h
index f29482c0c97a..51592afbbabe 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -203,9 +203,6 @@ class IOHandlerDelegate {
 
   virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
 
-  virtual llvm::Optional IOHandlerSuggestion(IOHandler 
&io_handler,
-  llvm::StringRef 
line);
-
   virtual void IOHandlerComplete(IOHandler &io_handler,
  CompletionRequest &request);
 
@@ -423,9 +420,6 @@ class IOHandlerEditline : public IOHandler {
   static int FixIndentationCallback(Editline *editline, const StringList 
&lines,
 int cursor_position, void *baton);
 
-  static llvm::Optional SuggestionCallback(llvm::StringRef line,
-void *baton);
-
   static void AutoCompleteCallback(CompletionRequest &request, void *baton);
 #endif
 

diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index a37ad1b9d106..356e8f734732 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -98,9 +98,6 @@ typedef int (*FixIndentationCallbackType)(Editline *editline,
   const StringList &lines,
   int cursor_position, void *baton);
 
-typedef llvm::Optional (*SuggestionCallbackType)(
-llvm::StringRef line, void *baton);
-
 typedef void (*CompleteCallbackType)(CompletionRequest &request, void *baton);
 
 /// Status used to decide when and how to start editing another line in
@@ -187,9 +184,6 @@ class Editline {
   /// Cancel this edit and oblitarate all trace of it
   bool Cancel();
 
-  /// Register a callback for autosuggestion.
-  void SetSuggestionCallback(SuggestionCallbackType callback, void *baton);
-
   /// Register a callback for the tab key
   void SetAutoCompleteCallback(CompleteCallbackType callback, void *baton);
 
@@ -318,12 +312,6 @@ class Editline {
   /// tab key is typed.
   unsigned char TabCommand(int ch);
 
-  /// Apply autosuggestion part in gray as editline.
-  unsigned char ApplyAutosuggestCommand(int ch);
-
-  /// Command used when a character is typed.
-  unsigned char TypedCharacter(int ch);
-
   /// Respond to normal character insertion by fixing line indentation
   unsigned char FixIndentationCommand(int ch);
 
@@ -372,9 +360,7 @@ class Editline {
   const char *m_fix_indentation_callback_chars = nullptr;
   CompleteCallbackType m_completion_callback = nullptr;
   void *m_completion_callback_baton = nullptr;
-  SuggestionCallbackType m_suggestion_callback = nullptr;
-  void *m_suggestion_callback_baton = nullptr;
-  std::size_t m_previous_autosuggestion_size = 0;
+
   std::mutex m_output_mutex;
 };
 }

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 36d7e5d3c118..6ef22c1a28c1 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -351,10 +351,6 @@ class CommandInterpreter : public Broadcaster,
 
   CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
 
-  /// Re

[Lldb-commits] [PATCH] D85836: [lldb/Utility] Simplify and generalize Scalar class

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

The class contains an enum listing all host integer types as well as
some non-host types. This setup is a remnant of a time when this class
was actually implemented in terms of host integer types. Now that we are
using llvm::APInt, they are mostly useless and mean that each function
needs to enumerate all of these cases even though it treats most of them
identically.

I only leave e_sint and e_uint to denote the integer signedness, but I
want to remove that in a follow-up as well.

Removing these cases simplifies most of these functions, with the only
exception being PromoteToMaxType, which can no longer rely on a simple
enum comparison to determine what needs to be promoted.

This also makes the class ready to work with arbitrary integer sizes, so
it does not need to be modified when someone needs to add a larger
integer size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85836

Files:
  lldb/include/lldb/Utility/Scalar.h
  lldb/source/Utility/Scalar.cpp
  lldb/unittests/Utility/ScalarTest.cpp

Index: lldb/unittests/Utility/ScalarTest.cpp
===
--- lldb/unittests/Utility/ScalarTest.cpp
+++ lldb/unittests/Utility/ScalarTest.cpp
@@ -289,42 +289,28 @@
 }
 
 TEST(ScalarTest, Promotion) {
-  static Scalar::Type int_types[] = {
-  Scalar::e_sint,Scalar::e_uint,  Scalar::e_slong,
-  Scalar::e_ulong,   Scalar::e_slonglong, Scalar::e_ulonglong,
-  Scalar::e_sint128, Scalar::e_uint128,   Scalar::e_sint256,
-  Scalar::e_uint256,
-  Scalar::e_void // sentinel
-  };
-
-  static Scalar::Type float_types[] = {
-  Scalar::e_float, Scalar::e_double, Scalar::e_long_double,
-  Scalar::e_void // sentinel
-  };
-
-  for (int i = 0; int_types[i] != Scalar::e_void; ++i) {
-for (int j = 0; float_types[j] != Scalar::e_void; ++j) {
-  Scalar lhs(2);
-  EXPECT_TRUE(lhs.Promote(int_types[i])) << "int promotion #" << i;
-  Scalar rhs(0.5f);
-  EXPECT_TRUE(rhs.Promote(float_types[j])) << "float promotion #" << j;
-  Scalar x(2.5f);
-  EXPECT_TRUE(x.Promote(float_types[j]));
-  EXPECT_EQ(lhs + rhs, x);
-}
-  }
+  Scalar a(47);
+  EXPECT_TRUE(a.IntegralPromote(64, true));
+  EXPECT_EQ(Scalar::e_sint, a.GetType());
+  EXPECT_EQ(APInt(64, 47), a.UInt128(APInt()));
 
-  for (int i = 0; float_types[i] != Scalar::e_void; ++i) {
-for (int j = 0; float_types[j] != Scalar::e_void; ++j) {
-  Scalar lhs(2);
-  EXPECT_TRUE(lhs.Promote(float_types[i])) << "float promotion #" << i;
-  Scalar rhs(0.5f);
-  EXPECT_TRUE(rhs.Promote(float_types[j])) << "float promotion #" << j;
-  Scalar x(2.5f);
-  EXPECT_TRUE(x.Promote(float_types[j]));
-  EXPECT_EQ(lhs + rhs, x);
-}
-  }
+  EXPECT_FALSE(a.IntegralPromote(32, true));
+  EXPECT_FALSE(a.IntegralPromote(32, false));
+  EXPECT_EQ(Scalar::e_sint, a.GetType());
+
+  EXPECT_TRUE(a.IntegralPromote(64, false));
+  EXPECT_EQ(Scalar::e_uint, a.GetType());
+  EXPECT_EQ(APInt(64, 47), a.UInt128(APInt()));
+
+  EXPECT_FALSE(a.IntegralPromote(64, true));
+
+  EXPECT_TRUE(a.FloatPromote(Scalar::e_double));
+  EXPECT_EQ(Scalar::e_double, a.GetType());
+  EXPECT_EQ(47.0, a.Double());
+
+  EXPECT_FALSE(a.FloatPromote(Scalar::e_float));
+  EXPECT_TRUE(a.FloatPromote(Scalar::e_long_double));
+  EXPECT_EQ(47.0L, a.LongDouble());
 }
 
 TEST(ScalarTest, SetValueFromCString) {
@@ -373,20 +359,11 @@
 }
 
 TEST(ScalarTest, APIntConstructor) {
-  auto width_array = {8, 16, 32};
-  for (auto &w : width_array) {
-Scalar A(APInt(w, 24));
+  for (auto &width : {8, 16, 32}) {
+Scalar A(APInt(width, 24));
 EXPECT_EQ(A.GetType(), Scalar::e_sint);
+EXPECT_EQ(APInt(width, 24), A.UInt128(APInt()));
   }
-
-  Scalar B(APInt(64, 42));
-  EXPECT_EQ(B.GetType(), Scalar::GetBestTypeForBitSize(64, true));
-  Scalar C(APInt(128, 96));
-  EXPECT_EQ(C.GetType(), Scalar::e_sint128);
-  Scalar D(APInt(256, 156));
-  EXPECT_EQ(D.GetType(), Scalar::e_sint256);
-  Scalar E(APInt(512, 456));
-  EXPECT_EQ(E.GetType(), Scalar::e_sint512);
 }
 
 TEST(ScalarTest, Scalar_512) {
@@ -396,17 +373,15 @@
   ASSERT_TRUE(Z.IsZero());
 
   Scalar S(APInt(512, 2000));
-  ASSERT_STREQ(S.GetTypeAsCString(), "int512_t");
-  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_sint512), "int512_t");
+  ASSERT_STREQ(S.GetTypeAsCString(), "signed int");
 
   ASSERT_TRUE(S.MakeUnsigned());
-  EXPECT_EQ(S.GetType(), Scalar::e_uint512);
-  ASSERT_STREQ(S.GetTypeAsCString(), "uint512_t");
-  ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
+  EXPECT_EQ(S.GetType(), Scalar::e_uint);
+  ASSERT_STREQ(S.GetTypeAsCString(), "unsigned int");
   EXPECT_EQ(S.GetByteSize(), 64U);
 
   ASSERT_TRUE(S.MakeSigned());
-  EXPECT_EQ(S.GetType(), Scalar::e_sint512);
+  EXPECT_EQ(S.GetType(), Scalar::e_sint);
   EXPECT_EQ(S.Ge

[Lldb-commits] [PATCH] D85836: [lldb/Utility] Simplify and generalize Scalar class

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



Comment at: lldb/include/lldb/Utility/Scalar.h:258
 
+  static Type PromoteToMaxType(const Scalar &lhs, const Scalar &rhs,
+   Scalar &temp_value,

I really hate this signature. How do you feel about having this return a struct 
with the Type, the temp Scalar and the two references? That doesn't have to be 
part of this patch though. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85836

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


[Lldb-commits] [lldb] d49aedd - Build a flat LLDB.framework for embedded Darwin targets

2020-08-12 Thread Vedant Kumar via lldb-commits

Author: Vedant Kumar
Date: 2020-08-12T13:34:29-07:00
New Revision: d49aedd315e35180b1df19476353ebe2558a318b

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

LOG: Build a flat LLDB.framework for embedded Darwin targets

This patch configures LLDB.framework to build as a flat unversioned
framework on non-macOS Darwin targets, which have never supported the
macOS framework layout.

This patch also renames the 'IOS' cmake variable to 'APPLE_EMBEDDED' to
reflect the fact that lldb is built for several different kinds of embedded
Darwin targets, not just iOS.

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

Added: 


Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/cmake/modules/LLDBFramework.cmake
lldb/source/Host/CMakeLists.txt
lldb/tools/debugserver/source/CMakeLists.txt
lldb/tools/lldb-server/CMakeLists.txt
lldb/unittests/debugserver/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 7e5848c800f8..ed77e188c107 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -267,7 +267,7 @@ endif()
 
 # Find Apple-specific libraries or frameworks that may be needed.
 if (APPLE)
-  if(NOT IOS)
+  if(NOT APPLE_EMBEDDED)
 find_library(CARBON_LIBRARY Carbon)
 find_library(CORE_SERVICES_LIBRARY CoreServices)
   endif()

diff  --git a/lldb/cmake/modules/LLDBFramework.cmake 
b/lldb/cmake/modules/LLDBFramework.cmake
index c52daaa4fa8b..43af71b78f24 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -3,22 +3,38 @@ message(STATUS "LLDB.framework: install path is 
'${LLDB_FRAMEWORK_INSTALL_DIR}'"
 message(STATUS "LLDB.framework: resources subdirectory is 
'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
 
 # Configure liblldb as a framework bundle
-set_target_properties(liblldb PROPERTIES
-  FRAMEWORK ON
-  FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+if(NOT APPLE_EMBEDDED)
+  set_target_properties(liblldb PROPERTIES
+FRAMEWORK ON
+FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
 
-  OUTPUT_NAME LLDB
-  VERSION ${LLDB_VERSION}
-  LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+OUTPUT_NAME LLDB
+VERSION ${LLDB_VERSION}
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
 
-  # Compatibility version
-  SOVERSION "1.0.0"
+# Compatibility version
+SOVERSION "1.0.0"
 
-  MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
-  MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
-  MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
-  MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
-)
+MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+  )
+else()
+  set_target_properties(liblldb PROPERTIES
+FRAMEWORK ON
+FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+
+# Note: iOS doesn't specify version, as the framework layout is flat.
+OUTPUT_NAME LLDB
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+
+MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+  )
+endif()
 
 # Used in llvm_add_library() to set default output directories for multi-config
 # generators. Overwrite to account for special framework output directory.
@@ -30,7 +46,7 @@ set_output_directory(liblldb
 lldb_add_post_install_steps_darwin(liblldb ${LLDB_FRAMEWORK_INSTALL_DIR})
 
 # Affects the layout of the framework bundle (default is macOS layout).
-if(IOS)
+if(APPLE_EMBEDDED)
   set_target_properties(liblldb PROPERTIES
 XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONEOS_DEPLOYMENT_TARGET}")
 else()
@@ -41,13 +57,16 @@ endif()
 # Add -Wdocumentation parameter
 set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS "YES")
 
-# Apart from this one, CMake creates all required symlinks in the framework 
bundle.
-add_custom_command(TARGET liblldb POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E create_symlink
-  Versions/Current/Headers
-  ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Headers
-  COMMENT "LLDB.framework: create Headers symlink"
-)
+# On iOS, there is no versioned framework layout. Skip this symlink step.
+if(NOT APPLE_EMBEDDED)
+  # Apart from this one, CMake creates all required symlinks in the framework 
bundle.
+  add_custom_command(TARGET liblldb POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E create_symlink
+

[Lldb-commits] [PATCH] D85770: Build a flat LLDB.framework for embedded Darwin targets

2020-08-12 Thread Vedant Kumar via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd49aedd315e3: Build a flat LLDB.framework for embedded 
Darwin targets (authored by vsk).

Changed prior to commit:
  https://reviews.llvm.org/D85770?vs=284849&id=285174#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85770

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/source/Host/CMakeLists.txt
  lldb/tools/debugserver/source/CMakeLists.txt
  lldb/tools/lldb-server/CMakeLists.txt
  lldb/unittests/debugserver/CMakeLists.txt

Index: lldb/unittests/debugserver/CMakeLists.txt
===
--- lldb/unittests/debugserver/CMakeLists.txt
+++ lldb/unittests/debugserver/CMakeLists.txt
@@ -21,7 +21,7 @@
   ${LLDB_SOURCE_DIR}/tools/debugserver/source
   ${LLDB_SOURCE_DIR}/tools/debugserver/source/MacOSX)
 
-if(IOS)
+if(APPLE_EMBEDDED)
   set_property(TARGET debugserverTests APPEND PROPERTY COMPILE_DEFINITIONS
   WITH_LOCKDOWN
   WITH_FBS
Index: lldb/tools/lldb-server/CMakeLists.txt
===
--- lldb/tools/lldb-server/CMakeLists.txt
+++ lldb/tools/lldb-server/CMakeLists.txt
@@ -16,7 +16,7 @@
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()
 
-if(IOS)
+if(APPLE_EMBEDDED)
   if(LLDB_CODESIGN_IDENTITY)
 # Use explicit LLDB identity
 set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY})
Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -99,7 +99,7 @@
   LLDB_DEBUGSERVER_CODESIGN_IDENTITY ${debugserver_codesign_identity})
 
 if(APPLE)
-  if(IOS)
+  if(APPLE_EMBEDDED)
 find_library(BACKBOARD_LIBRARY BackBoardServices
   PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
 find_library(FRONTBOARD_LIBRARY FrontBoardServices
@@ -121,7 +121,7 @@
 endif()
 
 if(LLDB_USE_ENTITLEMENTS)
-  if(IOS)
+  if(APPLE_EMBEDDED)
 set(entitlements ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
   else()
 # Same entitlements file as used for lldb-server
@@ -260,7 +260,7 @@
 
 set_target_properties(debugserver PROPERTIES FOLDER "lldb libraries/debugserver")
 
-if(IOS)
+if(APPLE_EMBEDDED)
   set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
 WITH_LOCKDOWN
 WITH_FBS
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -93,7 +93,7 @@
   macosx/cfcpp/CFCMutableSet.cpp
   macosx/cfcpp/CFCString.cpp
   )
-if(IOS)
+if(APPLE_EMBEDDED)
   set_property(SOURCE macosx/Host.mm APPEND PROPERTY
COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
 endif()
Index: lldb/cmake/modules/LLDBFramework.cmake
===
--- lldb/cmake/modules/LLDBFramework.cmake
+++ lldb/cmake/modules/LLDBFramework.cmake
@@ -3,22 +3,38 @@
 message(STATUS "LLDB.framework: resources subdirectory is 'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
 
 # Configure liblldb as a framework bundle
-set_target_properties(liblldb PROPERTIES
-  FRAMEWORK ON
-  FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+if(NOT APPLE_EMBEDDED)
+  set_target_properties(liblldb PROPERTIES
+FRAMEWORK ON
+FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
 
-  OUTPUT_NAME LLDB
-  VERSION ${LLDB_VERSION}
-  LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+OUTPUT_NAME LLDB
+VERSION ${LLDB_VERSION}
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
 
-  # Compatibility version
-  SOVERSION "1.0.0"
+# Compatibility version
+SOVERSION "1.0.0"
 
-  MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
-  MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
-  MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
-  MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
-)
+MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+  )
+else()
+  set_target_properties(liblldb PROPERTIES
+FRAMEWORK ON
+FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+
+# Note: iOS doesn't specify version, as the framework layout is flat.
+OUTPUT_NAME LLDB
+LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+
+MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB

[Lldb-commits] [PATCH] D85376: Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

2020-08-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 285176.
shafik added a comment.

Replacing python test with Shell test


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

https://reviews.llvm.org/D85376

Files:
  lldb/source/Core/ValueObjectChild.cpp
  lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s

Index: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s
@@ -0,0 +1,550 @@
+# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s
+# RUN: %lldb %t -o "target variable ug" -b | FileCheck %s
+
+# CHECK: (lldb) target variable ug
+# CHECK: (U) ug = {
+# CHECK:   raw = 1688469761
+# CHECK:= (a = 1, b = 1, c = 36, d = 2, e = 36, f = 1)
+# CHECK: }
+
+# We are testing how ValueObject deals with bit-fields when an argument is
+# passed by register. Compiling at -O1 allows us to capture this case and
+# test it.
+#
+# typedef union
+# {
+#   unsigned raw;
+#   struct
+#   {
+# unsigned a : 8;
+# unsigned b : 8;
+# unsigned c : 6;
+# unsigned d : 2;
+# unsigned e : 6;
+# unsigned f : 2;
+#   } ;
+# } U;
+#
+# static U ug= (U)(unsigned)0x0;
+#
+# void f(U u) {
+#   printf( "%d\n", u.raw);
+#   return;
+# }
+#
+# int main() {
+#   ug.raw = 0x64A40101;
+#
+#   f(ug);
+#   printf( "%d\n", ug.raw);
+# }
+#
+#
+# Compiled as follows:
+#
+#   clang -O1 -gdwarf-4 weird.c -S -o weird.s
+#
+# Then the DWARF was hand modified to get DW_AT_LOCATION for ug from:
+#
+#   DW_AT_location	(DW_OP_addr 0x12010, DW_OP_deref_size 0x1, DW_OP_constu 0x64a40101, DW_OP_mul, DW_OP_lit0, DW_OP_plus, DW_OP_stack_value)
+#
+# to this:
+#
+#   DW_AT_location	(DW_OP_constu 0x64a40101, DW_OP_stack_value)
+#
+# to work-around a seperate bug.
+#
+# clang is built from llvm.org and the last commit was:
+#
+#  86dea1f39bd127776b999e10dff212003068d30a
+#
+
+	.section	__TEXT,__text,regular,pure_instructions
+	.build_version macos, 10, 15	sdk_version 10, 15, 6
+	.file	1 "/tmp" "weird.c"
+	.globl	_f  ## -- Begin function f
+	.p2align	4, 0x90
+_f: ## @f
+Lfunc_begin0:
+	.loc	1 16 0  ## /tmp/weird.c:16:0
+	.cfi_startproc
+## %bb.0:
+	##DEBUG_VALUE: f:u <- $edi
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+	movl	%edi, %esi
+Ltmp0:
+	##DEBUG_VALUE: f:u <- $esi
+	.loc	1 17 3 prologue_end ## /tmp/weird.c:17:3
+	leaq	L_.str(%rip), %rdi
+	##DEBUG_VALUE: f:u <- $esi
+	xorl	%eax, %eax
+	callq	_printf
+Ltmp1:
+	.loc	1 18 3  ## /tmp/weird.c:18:3
+	popq	%rbp
+	retq
+Ltmp2:
+Lfunc_end0:
+	.cfi_endproc
+## -- End function
+	.globl	_main   ## -- Begin function main
+	.p2align	4, 0x90
+_main:  ## @main
+Lfunc_begin1:
+	.loc	1 20 0  ## /tmp/weird.c:20:0
+	.cfi_startproc
+## %bb.0:
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+Ltmp3:
+	pushq	%rbx
+	pushq	%rax
+	.cfi_offset %rbx, -24
+	.loc	1 22 10 prologue_end## /tmp/weird.c:22:10
+	movb	$1, _ug.0(%rip)
+	movl	$1688469761, %ebx   ## imm = 0x64A40101
+	.loc	1 26 3  ## /tmp/weird.c:26:3
+	movl	$1688469761, %edi   ## imm = 0x64A40101
+	callq	_f
+Ltmp4:
+	.loc	1 0 3 is_stmt 0 ## /tmp/weird.c:0:3
+	xorl	%eax, %eax
+	.loc	1 27 22 is_stmt 1   ## /tmp/weird.c:27:22
+	cmpb	$0, _ug.0(%rip)
+	cmovel	%eax, %ebx
+	.loc	1 27 3 is_stmt 0## /tmp/weird.c:27:3
+	leaq	L_.str(%rip), %rdi
+	movl	%ebx, %esi
+	xorl	%eax, %eax
+	callq	_printf
+Ltmp5:
+	.loc	1 28 1 is_stmt 1## /tmp/weird.c:28:1
+	xorl	%eax, %eax
+	addq	$8, %rsp
+	popq	%rbx
+	popq	%rbp
+	retq
+Ltmp6:
+Lfunc_end1:
+	.cfi_endproc
+## -- End function
+	.section	__TEXT,__cstring,cstring_literals
+L_.str: ## @.str
+	.asciz	"%d\n"
+
+.zerofill __DATA,__bss,_ug.0,1,2## @ug.0
+	.section	__DWARF,__debug_str,regular,debug
+Linfo_string:
+	.asciz	"Apple clang version 12.0.0 (clang-1200.0.31.1)" ## string offset=0
+	.asciz	"/tmp/weird.c"  ## string offset=47
+	.asciz	"/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" ## string offset=60
+	.asciz	"MacOSX10.15.sdk"   ## string offset=117
+	.asciz	"/Users/friss/dev/stash/xnu" ## string offset=133
+	.asciz	"ug"## string offset=160
+	.asciz	"U" ## string offset=163
+	.asciz	"raw"   ## string offset=165
+	.asciz	"unsigned int"  ## string offset=169
+	.asciz	"a" ## string offset=182
+	.asciz	"b" ## string offset=184
+	.asciz	"c" ## string offset=186
+	.asciz	"d" ## string offset=188
+	.asciz	"e" ## string 

[Lldb-commits] [PATCH] D85705: Add a "Trace" plug-in to LLDB to add process trace support in stages.

2020-08-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 285177.
clayborg added a comment.

Fix inline comment issues from vsk.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85705

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/lldb-forward.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectTrace.cpp
  lldb/source/Commands/CommandObjectTrace.h
  lldb/source/Commands/Options.td
  lldb/source/Core/PluginManager.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/CMakeLists.txt
  lldb/source/Plugins/Trace/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Trace.cpp
  lldb/source/Utility/StructuredData.cpp

Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -42,7 +42,12 @@
 buffer_or_error.getError().message());
 return return_sp;
   }
-  return ParseJSON(buffer_or_error.get()->getBuffer().str());
+  llvm::Expected value =
+  json::parse(buffer_or_error.get()->getBuffer().str());
+  if (value)
+return ParseJSONValue(*value);
+  error.SetErrorString(toString(value.takeError()));
+  return StructuredData::ObjectSP();
 }
 
 static StructuredData::ObjectSP ParseJSONValue(json::Value &value) {
Index: lldb/source/Target/Trace.cpp
===
--- /dev/null
+++ lldb/source/Target/Trace.cpp
@@ -0,0 +1,32 @@
+//===-- Trace.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Target/Trace.h"
+#include "lldb/Core/PluginManager.h"
+#include "llvm/Support/Format.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace llvm;
+
+llvm::Expected
+Trace::FindPlugin(StructuredData::Dictionary info) {
+  StringRef name;
+  if (!info.GetValueForKeyAsString("name", name))
+return createStringError(std::errc::invalid_argument,
+ "structured data is missing the \"name\" field "
+ "that identifies the trace plug-in");
+  ConstString plugin_name(name);
+  auto create_callback = PluginManager::GetTraceCreateCallback(plugin_name);
+  if (create_callback)
+return create_callback(std::move(info));
+  return createStringError(
+  std::errc::invalid_argument,
+  "no trace plug-in matches the specified name: \"%s\"",
+  name.str().c_str());
+}
Index: lldb/source/Target/CMakeLists.txt
===
--- lldb/source/Target/CMakeLists.txt
+++ lldb/source/Target/CMakeLists.txt
@@ -65,6 +65,7 @@
   ThreadPlanTracer.cpp
   ThreadPlanStack.cpp
   ThreadSpec.cpp
+  Trace.cpp
   UnixSignals.cpp
   UnwindAssembly.cpp
   UnwindLLDB.cpp
Index: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
===
--- /dev/null
+++ lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -0,0 +1,48 @@
+//===-- TraceIntelPT.h --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_TraceIntelPT_h_
+#define liblldb_TraceIntelPT_h_
+
+// Other libraries and framework includes
+#include 
+
+// Project includes
+#include "lldb/Target/Trace.h"
+#include "lldb/lldb-private.h"
+
+class TraceIntelPT : public lldb_private::Trace {
+public:
+  void Dump(lldb_private::Stream *s) const override;
+
+  //--
+  // Static Functions
+  //--
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb::TraceSP
+  CreateInstance(lldb_private::StructuredData::Dictionary info);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //--
+  // PluginInterface protocol
+  //--
+
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_

[Lldb-commits] [lldb] 7ddfb95 - [lldb] Fix unit test parsing to handle CR+LF as well as LF

2020-08-12 Thread Adrian McCarthy via lldb-commits

Author: Adrian McCarthy
Date: 2020-08-12T13:56:16-07:00
New Revision: 7ddfb956e1a5ee91d0d30f33ca0c84faeb471db4

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

LOG: [lldb] Fix unit test parsing to handle CR+LF as well as LF

Apparently when the strings are created, the `'\n'` is converted to the
platform's natural new line indicator, which is CR+LF on Windows.  But
upon reading back with `sscanf`, the CRs caused a matching failure.

Added: 


Modified: 
lldb/unittests/Utility/TimerTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/TimerTest.cpp 
b/lldb/unittests/Utility/TimerTest.cpp
index 2d323c0dc2a3..c6d1facdebbb 100644
--- a/lldb/unittests/Utility/TimerTest.cpp
+++ b/lldb/unittests/Utility/TimerTest.cpp
@@ -97,7 +97,7 @@ TEST(TimerTest, CategoryTimesStats) {
   int count1, count2;
   ASSERT_EQ(
   6, sscanf(ss.GetData(),
-"%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
+"%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n\r 
]"
 "%lf sec (total: %*fs; child: %*fs; count: %d) for CAT2",
 &seconds1, &total1, &child1, &count1, &seconds2, &count2))
   << "String: " << ss.GetData();



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


[Lldb-commits] [PATCH] D85376: Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

2020-08-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

I'll leave the test review to Pavel who knows that much better, but I have two 
last nits about the test.




Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:59
+#
+#  86dea1f39bd127776b999e10dff212003068d30a
+#

I think this was still generated with system clang. info_string below says this 
was compiled by `Apple clang version 12.0.0 (clang-1200.0.31.1)` and not the 
listed commit (which would create an info_string like `clang version 12.0.0 
(https://github.com/llvm/llvm-project 
86dea1f39bd127776b999e10dff212003068d30a)`.)



Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:149
+   .asciz  "MacOSX10.15.sdk"   ## string offset=117
+   .asciz  "/Users/friss/dev/stash/xnu" ## string offset=133
+   .asciz  "ug"## string offset=160

You can avoid these system-specific paths by compiling the file in /tmp with 
your cwd in /tmp and passing `-isysroot /` to the clang invocation. This way 
this section would look like this for everyone independently of their system 
username or macOS version (which will make updating this much easier):
```
lang=python
  .asciz  "clang version 12.0.0 (https://github.com/llvm/llvm-project 
6acb897dfbc0ec22007cde50b3bc9c60f4674fb2)" ## string offset=0
  .asciz  "/tmp/weird.c"  ## string offset=101  
  .asciz  "/" ## string offset=114  
  .asciz  "/tmp"  ## string offset=116  
  .asciz  "ug"## string offset=121  
  .asciz  "U" ## string offset=124  
  .asciz  "raw"   ## string offset=126  
  .asciz  "unsigned int"  ## string offset=130  
  .asciz  "a" ## string offset=143 
```


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

https://reviews.llvm.org/D85376

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


[Lldb-commits] [PATCH] D85859: [lldb] Fix relative imports and set the appropriate include dirs

2020-08-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, aprantl.
Herald added a subscriber: mgorny.
JDevlieghere requested review of this revision.

After moving python.swig and lua.swig into their respective
subdirectories, the relative paths in these files were out of date. This
fixes that and ensures the appropriate include paths are set in the SWIG
invocation.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D85859

Files:
  lldb/bindings/lua/CMakeLists.txt
  lldb/bindings/lua/lua.swig
  lldb/bindings/python/CMakeLists.txt
  lldb/bindings/python/python.swig


Index: lldb/bindings/python/python.swig
===
--- lldb/bindings/python/python.swig
+++ lldb/bindings/python/python.swig
@@ -111,9 +111,9 @@
 %}
 
 %include 
-%include "./python/python-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "python-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
@@ -123,9 +123,9 @@
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
-%include "./python/python-extensions.swig"
-%include "./python/python-wrapper.swig"
+%include "interfaces.swig"
+%include "python-extensions.swig"
+%include "python-wrapper.swig"
 
 %pythoncode%{
 _initialize = True
Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -6,6 +6,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -c++
   -shadow
   -python
Index: lldb/bindings/lua/lua.swig
===
--- lldb/bindings/lua/lua.swig
+++ lldb/bindings/lua/lua.swig
@@ -9,13 +9,13 @@
 %module lldb
 
 %include 
-%include "./lua/lua-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "lua-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 using namespace lldb_private;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
+%include "interfaces.swig"
Index: lldb/bindings/lua/CMakeLists.txt
===
--- lldb/bindings/lua/CMakeLists.txt
+++ lldb/bindings/lua/CMakeLists.txt
@@ -5,6 +5,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -lua
   -w503
   -outdir ${CMAKE_CURRENT_BINARY_DIR}


Index: lldb/bindings/python/python.swig
===
--- lldb/bindings/python/python.swig
+++ lldb/bindings/python/python.swig
@@ -111,9 +111,9 @@
 %}
 
 %include 
-%include "./python/python-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "python-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
@@ -123,9 +123,9 @@
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
-%include "./python/python-extensions.swig"
-%include "./python/python-wrapper.swig"
+%include "interfaces.swig"
+%include "python-extensions.swig"
+%include "python-wrapper.swig"
 
 %pythoncode%{
 _initialize = True
Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -6,6 +6,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -c++
   -shadow
   -python
Index: lldb/bindings/lua/lua.swig
===
--- lldb/bindings/lua/lua.swig
+++ lldb/bindings/lua/lua.swig
@@ -9,13 +9,13 @@
 %module lldb
 
 %include 
-%include "./lua/lua-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "lua-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 using namespace lldb_private;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
+%include "interfaces.swig"
Index: lldb/bindings/lua/CMakeLists.txt
===
--- lldb/bindings/lua/CMakeLists.txt
+++ lldb/bindings/lua/CMakeLists.txt
@@ -5,6 +5,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -lua
   -w503
   -outdir ${CMAKE_CURRENT_BINARY_DIR}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85376: Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

2020-08-12 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:14-40
+# typedef union
+# {
+#   unsigned raw;
+#   struct
+#   {
+# unsigned a : 8;
+# unsigned b : 8;

This gives a much more compact debug info section:
```
typedef union {
  unsigned raw;
  struct {
 unsigned a : 8;
 unsigned b : 8;
 unsigned c : 6;
 unsigned d : 2;
 unsigned e : 6;
 unsigned f : 2;
  };
} U;

// This appears first in the debug info and pulls the type definition in...
static U __attribute__((used)) _type_anchor;
// ... then our useful variable appears last in the debug info and we can
// tweak the assembly without needing to edit a lot of offsets by hand.
static U ug;

extern void f(U);

// Omit debug info for main.
__attribute__((nodebug))
int main() {
  ug.raw = 0x64A40101;
  f(ug);
  f((U)ug.raw);
}
```

You can easily edit out the TEXT section, the line table and the accelerator 
tables and patch the location expression to give you a minimal binary.



Comment at: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s:62-63
+
+   .section__TEXT,__text,regular,pure_instructions
+   .build_version macos, 10, 15sdk_version 10, 15, 6
+   .file   1 "/tmp" "weird.c"

I don't think you need the TEXT segment at all, or at least you can make it 
empty.


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

https://reviews.llvm.org/D85376

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


[Lldb-commits] [PATCH] D85859: [lldb] Fix relative imports and set the appropriate include dirs

2020-08-12 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Looks plausible!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85859

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


[Lldb-commits] [PATCH] D85705: Add a "Trace" plug-in to LLDB to add process trace support in stages.

2020-08-12 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I only added a few non-substantial inline comments.




Comment at: lldb/include/lldb/Target/Trace.h:39
+public:
+  ~Trace() override = default;
+

I'm just curious: What's the purpose of this? Is the destructor = 0 in the base 
class and we want to not have to write this line in Trace implementations?



Comment at: lldb/source/Commands/CommandObjectTrace.cpp:88
+Status error;
+if (command.size() != 1) {
+  error.SetErrorString("a single path to a JSON file containing trace "

Would it be possible to early-exit-ify this function? Perhaps by using a lambda 
for the `result.AppendErrorWithFormat` error return part?



Comment at: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h:25
+  // Static Functions
+  //--
+

FYI: The Doxygen way of writing this is
```
/// Static Functions.
/// \{
  static void Initialize();
  static void Terminate();
/// \}

```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85705

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


[Lldb-commits] [PATCH] D85859: [lldb] Fix relative imports and set the appropriate include dirs

2020-08-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfbfd831ddac2: [lldb] Fix relative imports and set the 
appropriate include dirs (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85859

Files:
  lldb/bindings/lua/CMakeLists.txt
  lldb/bindings/lua/lua.swig
  lldb/bindings/python/CMakeLists.txt
  lldb/bindings/python/python.swig


Index: lldb/bindings/python/python.swig
===
--- lldb/bindings/python/python.swig
+++ lldb/bindings/python/python.swig
@@ -111,9 +111,9 @@
 %}
 
 %include 
-%include "./python/python-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "python-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
@@ -123,9 +123,9 @@
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
-%include "./python/python-extensions.swig"
-%include "./python/python-wrapper.swig"
+%include "interfaces.swig"
+%include "python-extensions.swig"
+%include "python-wrapper.swig"
 
 %pythoncode%{
 _initialize = True
Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -6,6 +6,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -c++
   -shadow
   -python
Index: lldb/bindings/lua/lua.swig
===
--- lldb/bindings/lua/lua.swig
+++ lldb/bindings/lua/lua.swig
@@ -9,13 +9,13 @@
 %module lldb
 
 %include 
-%include "./lua/lua-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "lua-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 using namespace lldb_private;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
+%include "interfaces.swig"
Index: lldb/bindings/lua/CMakeLists.txt
===
--- lldb/bindings/lua/CMakeLists.txt
+++ lldb/bindings/lua/CMakeLists.txt
@@ -5,6 +5,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -lua
   -w503
   -outdir ${CMAKE_CURRENT_BINARY_DIR}


Index: lldb/bindings/python/python.swig
===
--- lldb/bindings/python/python.swig
+++ lldb/bindings/python/python.swig
@@ -111,9 +111,9 @@
 %}
 
 %include 
-%include "./python/python-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "python-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
@@ -123,9 +123,9 @@
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
-%include "./python/python-extensions.swig"
-%include "./python/python-wrapper.swig"
+%include "interfaces.swig"
+%include "python-extensions.swig"
+%include "python-wrapper.swig"
 
 %pythoncode%{
 _initialize = True
Index: lldb/bindings/python/CMakeLists.txt
===
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -6,6 +6,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -c++
   -shadow
   -python
Index: lldb/bindings/lua/lua.swig
===
--- lldb/bindings/lua/lua.swig
+++ lldb/bindings/lua/lua.swig
@@ -9,13 +9,13 @@
 %module lldb
 
 %include 
-%include "./lua/lua-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "lua-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 using namespace lldb_private;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
+%include "interfaces.swig"
Index: lldb/bindings/lua/CMakeLists.txt
===
--- lldb/bindings/lua/CMakeLists.txt
+++ lldb/bindings/lua/CMakeLists.txt
@@ -5,6 +5,7 @@
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -lua
   -w503
   -outdir ${CMAKE_CURRENT_BINARY_DIR}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] fbfd831 - [lldb] Fix relative imports and set the appropriate include dirs

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

Author: Jonas Devlieghere
Date: 2020-08-12T16:28:46-07:00
New Revision: fbfd831ddac2a9dd2e7bcdf179c88de7c9c5f5ae

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

LOG: [lldb] Fix relative imports and set the appropriate include dirs

After moving python.swig and lua.swig into their respective
subdirectories, the relative paths in these files were out of date. This
fixes that and ensures the appropriate include paths are set in the SWIG
invocation.

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

Added: 


Modified: 
lldb/bindings/lua/CMakeLists.txt
lldb/bindings/lua/lua.swig
lldb/bindings/python/CMakeLists.txt
lldb/bindings/python/python.swig

Removed: 




diff  --git a/lldb/bindings/lua/CMakeLists.txt 
b/lldb/bindings/lua/CMakeLists.txt
index 84ff918d9376..7148f1370456 100644
--- a/lldb/bindings/lua/CMakeLists.txt
+++ b/lldb/bindings/lua/CMakeLists.txt
@@ -5,6 +5,7 @@ add_custom_command(
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -lua
   -w503
   -outdir ${CMAKE_CURRENT_BINARY_DIR}

diff  --git a/lldb/bindings/lua/lua.swig b/lldb/bindings/lua/lua.swig
index 9bfc49b359bc..524d1b5a8036 100644
--- a/lldb/bindings/lua/lua.swig
+++ b/lldb/bindings/lua/lua.swig
@@ -9,13 +9,13 @@
 %module lldb
 
 %include 
-%include "./lua/lua-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "lua-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 using namespace lldb_private;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
+%include "interfaces.swig"

diff  --git a/lldb/bindings/python/CMakeLists.txt 
b/lldb/bindings/python/CMakeLists.txt
index b8ed1fa8dc8a..dc097cbe0468 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -6,6 +6,7 @@ add_custom_command(
   DEPENDS ${SWIG_HEADERS}
   COMMAND ${SWIG_EXECUTABLE}
   ${SWIG_COMMON_FLAGS}
+  -I${CMAKE_CURRENT_SOURCE_DIR}
   -c++
   -shadow
   -python

diff  --git a/lldb/bindings/python/python.swig 
b/lldb/bindings/python/python.swig
index 5b1269878dac..66a75328d1e7 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -111,9 +111,9 @@ def lldb_iter(obj, getsize, getelem):
 %}
 
 %include 
-%include "./python/python-typemaps.swig"
-%include "./macros.swig"
-%include "./headers.swig"
+%include "python-typemaps.swig"
+%include "macros.swig"
+%include "headers.swig"
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
@@ -123,9 +123,9 @@ using namespace lldb_private::python;
 using namespace lldb;
 %}
 
-%include "./interfaces.swig"
-%include "./python/python-extensions.swig"
-%include "./python/python-wrapper.swig"
+%include "interfaces.swig"
+%include "python-extensions.swig"
+%include "python-wrapper.swig"
 
 %pythoncode%{
 _initialize = True



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


[Lldb-commits] [PATCH] D85705: Add a "Trace" plug-in to LLDB to add process trace support in stages.

2020-08-12 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

Thanks for doing this. There are some basic bits to make this that I was 
unaware of, so this saves a lot of time for me :) 
I'll take over this patch next week and fill it with intel-pt stuff, I already 
have a good amount of code that is quite mergeable with this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85705

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


[Lldb-commits] [PATCH] D85376: Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

2020-08-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 285233.
shafik marked 4 inline comments as done.
shafik added a comment.

Updated test using more compact code from Fred.


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

https://reviews.llvm.org/D85376

Files:
  lldb/source/Core/ValueObjectChild.cpp
  lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s

Index: lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/valueobject-pass-by-reg.s
@@ -0,0 +1,312 @@
+# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s
+# RUN: %lldb %t -o "target variable ug" -b | FileCheck %s
+
+# CHECK: (lldb) target variable ug
+# CHECK: (U) ug = {
+# CHECK:   raw = 1688469761
+# CHECK:= (a = 1, b = 1, c = 36, d = 2, e = 36, f = 1)
+# CHECK: }
+
+# We are testing how ValueObject deals with bit-fields when an argument is
+# passed by register. Compiling at -O1 allows us to capture this case and
+# test it.
+#
+# typedef union {
+#   unsigned raw;
+#   struct {
+#  unsigned a : 8;
+#  unsigned b : 8;
+#  unsigned c : 6;
+#  unsigned d : 2;
+#  unsigned e : 6;
+#  unsigned f : 2;
+#   };
+# } U;
+#
+# // This appears first in the debug info and pulls the type definition in...
+# static U __attribute__((used)) _type_anchor;
+# // ... then our useful variable appears last in the debug info and we can
+# // tweak the assembly without needing to edit a lot of offsets by hand.
+# static U ug;
+#
+# extern void f(U);
+#
+# // Omit debug info for main.
+# __attribute__((nodebug))
+# int main() {
+#   ug.raw = 0x64A40101;
+#   f(ug);
+#   f((U)ug.raw);
+# }
+#
+# Compiled as follows:
+#
+#   clang -O1 -gdwarf-4 weird.c -S -o weird.s
+#
+# Then the DWARF was hand modified to get DW_AT_LOCATION for ug from:
+#
+#   DW_AT_location	(DW_OP_addr 0x3f8, DW_OP_deref, DW_OP_constu 0x64a40101, DW_OP_mul, DW_OP_lit0, DW_OP_plus, DW_OP_stack_value)
+#
+# to this:
+#
+#   DW_AT_location	(DW_OP_constu 0x64a40101, DW_OP_stack_value)
+#
+# to work-around a seperate bug.
+
+.zerofill __DATA,__bss,__type_anchor,4,2 ## @_type_anchor
+.zerofill __DATA,__bss,_ug.0,1,2## @ug.0
+	.no_dead_strip	__type_anchor
+	.section	__DWARF,__debug_str,regular,debug
+Linfo_string:
+	.zero 138
+	.asciz	"_type_anchor"  ## string offset=138
+	.asciz	"U" ## string offset=151
+	.asciz	"raw"   ## string offset=153
+	.asciz	"unsigned int"  ## string offset=157
+	.asciz	"a" ## string offset=170
+	.asciz	"b" ## string offset=172
+	.asciz	"c" ## string offset=174
+	.asciz	"d" ## string offset=176
+	.asciz	"e" ## string offset=178
+	.asciz	"f" ## string offset=180
+	.asciz	"ug"## string offset=182
+	.section	__DWARF,__debug_abbrev,regular,debug
+Lsection_abbrev:
+	.byte	1   ## Abbreviation Code
+	.byte	17  ## DW_TAG_compile_unit
+	.byte	1   ## DW_CHILDREN_yes
+	.byte	37  ## DW_AT_producer
+	.byte	14  ## DW_FORM_strp
+	.byte	19  ## DW_AT_language
+	.byte	5   ## DW_FORM_data2
+	.byte	3   ## DW_AT_name
+	.byte	14  ## DW_FORM_strp
+	.ascii	"\202|" ## DW_AT_LLVM_sysroot
+	.byte	14  ## DW_FORM_strp
+	.ascii	"\357\177"  ## DW_AT_APPLE_sdk
+	.byte	14  ## DW_FORM_strp
+	.byte	16  ## DW_AT_stmt_list
+	.byte	23  ## DW_FORM_sec_offset
+	.byte	27  ## DW_AT_comp_dir
+	.byte	14  ## DW_FORM_strp
+	.ascii	"\341\177"  ## DW_AT_APPLE_optimized
+	.byte	25  ## DW_FORM_flag_present
+	.byte	0   ## EOM(1)
+	.byte	0   ## EOM(2)
+	.byte	2   ## Abbreviation Code
+	.byte	52  ## DW_TAG_variable
+	.byte	0   ## DW_CHILDREN_no
+	.byte	3   ## DW_AT_name
+	.byte	14  ## DW_FORM_strp
+	.byte	73  ## DW_AT_type
+	.byte	19  ## DW_FORM_ref4
+	.byte	58  ## DW_AT_decl_file
+	.byte	11  ## DW_FORM_data1
+	.byte	59  ## DW_AT_decl_line
+	.byte	11  ## DW_FORM_data1
+	.byte	2   ## DW_AT_location
+	.byte	24  ## DW_FORM_exprloc
+	.byte	0   ## EOM(1)
+	.byte	0   ## EOM(2)
+	.byte	3   ## Abbreviation Code
+	.byte	22  ## DW_TAG_typedef
+	.byte	0   ## DW_CHILDREN_no
+	.byte	73  ## DW_AT_type
+	.byt