[Lldb-commits] [PATCH] D99944: [LLDB] AArch64 Linux and elf-core PAC stack unwinder support

2021-05-19 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett requested changes to this revision.
DavidSpickett added a comment.
This revision now requires changes to proceed.

Realised that you've got an empty program file and no core file. I compiled 
main.c with:

  $ aarch64-unknown-linux-gnu-gcc -g -march=armv8.3-a 
-mbranch-protection=pac-ret+leaf main.c -o linux-aarch64-pac.out -nostdlib 
-static

Then generated a core dump in qemu and after fixing up the PID it works as 
expected.


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

https://reviews.llvm.org/D99944

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


[Lldb-commits] [PATCH] D102757: [lldb] Remove non address bits when looking up memory regions

2021-05-19 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added a subscriber: kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is based on https://reviews.llvm.org/D99944.

On AArch64 we have various things using the non address bits
of pointers. This means when you lookup their containing region
you won't find it if you don't remove them.

This changes Process GetMemoryRegionInfo to a non virtual method
that uses the current ABI plugin to remove those bits. Then it
calls DoGetMemoryRegionInfo.

That function does the actual work and is virtual to be overriden
by Process implementations.

A test case is added that runs on AArch64 Linux.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102757

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
  lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.h
  lldb/source/Target/Process.cpp
  lldb/test/API/linux/aarch64/tagged_memory_region/Makefile
  
lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py
  lldb/test/API/linux/aarch64/tagged_memory_region/main.c

Index: lldb/test/API/linux/aarch64/tagged_memory_region/main.c
===
--- /dev/null
+++ lldb/test/API/linux/aarch64/tagged_memory_region/main.c
@@ -0,0 +1,19 @@
+#include 
+#include 
+#include 
+#include 
+
+int main(int argc, char const *argv[]) {
+  void *the_page = mmap(0, sysconf(_SC_PAGESIZE), PROT_READ | PROT_EXEC,
+MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  if (the_page == MAP_FAILED)
+return 1;
+
+  // Put something in the top byte
+  the_page = (void *)((size_t)the_page | ((size_t)0x34 << 56));
+
+  // Then sign it
+  __asm__ __volatile__("pacdzb %0" : "=r"(the_page) : "r"(the_page));
+
+  return 0; // Set break point at this line.
+}
Index: lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py
===
--- /dev/null
+++ lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py
@@ -0,0 +1,44 @@
+"""
+Test that "memory region" lookup removes the top byte and pointer
+authentication signatures of the address given.
+"""
+
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class AArch64LinuxTaggedMemoryRegionTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@skipUnlessArch("aarch64")
+@skipUnlessPlatform(["linux"])
+def test_mte_regions(self):
+if not self.isAArch64PAuth():
+self.skipTest('Target must support pointer authentication.')
+
+self.build()
+self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(self, "main.c",
+line_number('main.c', '// Set break point at this line.'),
+num_expected_locations=1)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+if self.process().GetState() == lldb.eStateExited:
+self.fail("Test program failed to run.")
+
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# Despite the non address bits we should find a region
+self.expect("memory region the_page", patterns=[
+"\[0x[0-9A-Fa-f]+-0x[0-9A-Fa-f]+\) r-x"])
Index: lldb/test/API/linux/aarch64/tagged_memory_region/Makefile
===
--- /dev/null
+++ lldb/test/API/linux/aarch64/tagged_memory_region/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -march=armv8.3-a
+
+include Makefile.rules
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5848,6 +5848,15 @@
   return retval;
 }
 
+Status Process::GetMemoryRegionInfo(lldb::addr_t load_addr,
+MemoryRegionInfo &range_info) {
+  if (auto abi = GetABI()) {
+// TODO: can we always assume data addresses here?
+load_addr = abi->FixDataAddress(load_addr);
+  }
+  return DoGetMemoryRegionInfo(load_addr, range_info);
+}
+
 Status
 Process::GetMemoryRegions(

[Lldb-commits] [PATCH] D102757: [lldb] Remove non address bits when looking up memory regions

2021-05-19 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added reviewers: omjavaid, labath, jasonmolenda, vsk.
DavidSpickett added subscribers: vsk, jasonmolenda.
DavidSpickett added a comment.

One of the main reasons the MTE commands need to handle addresses is to lookup 
memory regions, this generalises the handling of that. I'm not sure yet if the 
"GetStuff" in process and "DoGetStuff" in subclasses is viable for all the 
areas where non address bits are important. If there's a lot of instances maybe 
we'd go in the direction of handling "smart" address parameters that know what 
their address bits are but that's more involved.

I need to add a corefile test but I'm pretty sure the ABI plugin approach 
should work there. (Omair was able to use a core file in 
https://reviews.llvm.org/D99944)

Also there is the issue that in GetMemoryRegion we don't know if it's a code or 
data pointer which is relevant for PAC. (though you could apply both masks, 
assuming the VA size is the same for code and data, seems reasonable)

@jasonmolenda / @vsk You might have something downstream that tackles the same 
issue. I wonder if we're on the same track.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102757

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


[Lldb-commits] [lldb] ff95486 - [lldb][NFC] Remove sample test boilerplate from TestBreakOnCPP11Initializers

2021-05-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-05-19T15:22:11+02:00
New Revision: ff954865137cdd11165340e2c9537cfd1b3f805d

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

LOG: [lldb][NFC] Remove sample test boilerplate from 
TestBreakOnCPP11Initializers

Added: 


Modified: 
lldb/test/API/lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py
lldb/test/API/lang/cpp/break-on-initializers/main.cpp

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py 
b/lldb/test/API/lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py
index 8456a7cae96e4..46846b49bb386 100644
--- 
a/lldb/test/API/lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py
+++ 
b/lldb/test/API/lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py
@@ -13,7 +13,7 @@
 from lldbsuite.test.lldbtest import *
 
 
-class RenameThisSampleTestTestCase(TestBase):
+class TestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
@@ -24,16 +24,6 @@ def test_breakpoints_on_initializers(self):
 self.main_source_file = lldb.SBFileSpec("main.cpp")
 self.first_initializer_line = line_number("main.cpp", "Set the before 
constructor breakpoint here")
 self.second_initializer_line = line_number("main.cpp", "Set the after 
constructor breakpoint here")
-self.sample_test()
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-# Set up your test case here. If your test doesn't need any set up then
-# remove this method from your TestCase class.
-
-def sample_test(self):
-"""You might use the test implementation in several ways, say so 
here."""
 
 (target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
" Set a breakpoint here to get started", 
self.main_source_file)

diff  --git a/lldb/test/API/lang/cpp/break-on-initializers/main.cpp 
b/lldb/test/API/lang/cpp/break-on-initializers/main.cpp
index 13117a17940d5..a661b2fd69511 100644
--- a/lldb/test/API/lang/cpp/break-on-initializers/main.cpp
+++ b/lldb/test/API/lang/cpp/break-on-initializers/main.cpp
@@ -1,12 +1,8 @@
-#include 
-#include 
-
 class Trivial {
 public:
   Trivial(int input) : m_int(input) {}
 private:
   int m_int;
-
 };
 
 class Foo {
@@ -15,17 +11,14 @@ class Foo {
 
 public:
   Foo(int input) {
-printf("I have been made!\n");
+++input;
   }
 
 private:
   Trivial m_other_trivial = Trivial(200); // Set the after constructor 
breakpoint here
 };
 
-int
-main()
-{
+int main() {
   Foo myFoo(10); // Set a breakpoint here to get started
   return 0;
 }
-



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


[Lldb-commits] [lldb] 0bab7b2 - [lldb] Encode `bool` as unsigned int

2021-05-19 Thread Andy Yankovsky via lldb-commits

Author: Andy Yankovsky
Date: 2021-05-19T15:32:17+02:00
New Revision: 0bab7b26f4d9dc4cb8f6c2877ad4a2c388c41c65

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

LOG: [lldb] Encode `bool` as unsigned int

`bool` is considered to be unsigned according to 
`std::is_unsigned::value` (and `Type::GetTypeInfo`). Encoding it as 
signed int works fine for normal variables and fields, but breaks when reading 
the values of boolean bitfields. If the field is declared as `bool b : 1` and 
has a value of `0b1`, the call to `SBValue::GetValueAsSigned()` will return 
`-1`.

Reviewed By: teemperor

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

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
lldb/test/API/lang/cpp/bitfields/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 7e037a1589f16..51e53f0bab561 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4698,7 +4698,6 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::Void:
   break;
 
-case clang::BuiltinType::Bool:
 case clang::BuiltinType::Char_S:
 case clang::BuiltinType::SChar:
 case clang::BuiltinType::WChar_S:
@@ -4709,6 +4708,7 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::Int128:
   return lldb::eEncodingSint;
 
+case clang::BuiltinType::Bool:
 case clang::BuiltinType::Char_U:
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:

diff  --git a/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py 
b/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
index 0585cf60951b6..bf457d33a0bd1 100644
--- a/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ b/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -120,3 +120,36 @@ def test_and_run_command(self):
 '(uint32_t) b_a = 2',
 '(uint32_t:1) d_a = 1',
 ])
+
+self.expect(
+"frame variable --show-types bb",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+'(bool:1) a = true',
+'(bool:1) b = false',
+'(bool:2) c = true',
+'(bool:2) d = true',
+])
+
+bb = self.frame().FindVariable('bb')
+self.assertTrue(bb.IsValid())
+
+bb_a = bb.GetChildAtIndex(0)
+self.assertTrue(bb_a.IsValid())
+self.assertEqual(bb_a.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_a.GetValueAsSigned(), 1)
+
+bb_b = bb.GetChildAtIndex(1)
+self.assertTrue(bb_b.IsValid())
+self.assertEqual(bb_b.GetValueAsUnsigned(), 0)
+self.assertEqual(bb_b.GetValueAsSigned(), 0)
+
+bb_c = bb.GetChildAtIndex(2)
+self.assertTrue(bb_c.IsValid())
+self.assertEqual(bb_c.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_c.GetValueAsSigned(), 1)
+
+bb_d = bb.GetChildAtIndex(3)
+self.assertTrue(bb_d.IsValid())
+self.assertEqual(bb_d.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_d.GetValueAsSigned(), 1)

diff  --git a/lldb/test/API/lang/cpp/bitfields/main.cpp 
b/lldb/test/API/lang/cpp/bitfields/main.cpp
index f9015b758c724..a9887b5e826e9 100644
--- a/lldb/test/API/lang/cpp/bitfields/main.cpp
+++ b/lldb/test/API/lang/cpp/bitfields/main.cpp
@@ -104,5 +104,17 @@ int main(int argc, char const *argv[]) {
   uwbf.x = 0x;
   uwubf.x = 0x;
 
+  struct BoolBits {
+bool a : 1;
+bool b : 1;
+bool c : 2;
+bool d : 2;
+  } bb;
+
+  bb.a = 0b1;
+  bb.b = 0b0;
+  bb.c = 0b11;
+  bb.d = 0b01;
+
   return 0; // Set break point at this line.
 }



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


[Lldb-commits] [PATCH] D102685: [lldb] Encode `bool` as unsigned int

2021-05-19 Thread Andy Yankovsky via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
werat marked an inline comment as done.
Closed by commit rG0bab7b26f4d9: [lldb] Encode `bool` as unsigned int (authored 
by werat).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102685

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
  lldb/test/API/lang/cpp/bitfields/main.cpp


Index: lldb/test/API/lang/cpp/bitfields/main.cpp
===
--- lldb/test/API/lang/cpp/bitfields/main.cpp
+++ lldb/test/API/lang/cpp/bitfields/main.cpp
@@ -104,5 +104,17 @@
   uwbf.x = 0x;
   uwubf.x = 0x;
 
+  struct BoolBits {
+bool a : 1;
+bool b : 1;
+bool c : 2;
+bool d : 2;
+  } bb;
+
+  bb.a = 0b1;
+  bb.b = 0b0;
+  bb.c = 0b11;
+  bb.d = 0b01;
+
   return 0; // Set break point at this line.
 }
Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -120,3 +120,36 @@
 '(uint32_t) b_a = 2',
 '(uint32_t:1) d_a = 1',
 ])
+
+self.expect(
+"frame variable --show-types bb",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+'(bool:1) a = true',
+'(bool:1) b = false',
+'(bool:2) c = true',
+'(bool:2) d = true',
+])
+
+bb = self.frame().FindVariable('bb')
+self.assertTrue(bb.IsValid())
+
+bb_a = bb.GetChildAtIndex(0)
+self.assertTrue(bb_a.IsValid())
+self.assertEqual(bb_a.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_a.GetValueAsSigned(), 1)
+
+bb_b = bb.GetChildAtIndex(1)
+self.assertTrue(bb_b.IsValid())
+self.assertEqual(bb_b.GetValueAsUnsigned(), 0)
+self.assertEqual(bb_b.GetValueAsSigned(), 0)
+
+bb_c = bb.GetChildAtIndex(2)
+self.assertTrue(bb_c.IsValid())
+self.assertEqual(bb_c.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_c.GetValueAsSigned(), 1)
+
+bb_d = bb.GetChildAtIndex(3)
+self.assertTrue(bb_d.IsValid())
+self.assertEqual(bb_d.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_d.GetValueAsSigned(), 1)
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4698,7 +4698,6 @@
 case clang::BuiltinType::Void:
   break;
 
-case clang::BuiltinType::Bool:
 case clang::BuiltinType::Char_S:
 case clang::BuiltinType::SChar:
 case clang::BuiltinType::WChar_S:
@@ -4709,6 +4708,7 @@
 case clang::BuiltinType::Int128:
   return lldb::eEncodingSint;
 
+case clang::BuiltinType::Bool:
 case clang::BuiltinType::Char_U:
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:


Index: lldb/test/API/lang/cpp/bitfields/main.cpp
===
--- lldb/test/API/lang/cpp/bitfields/main.cpp
+++ lldb/test/API/lang/cpp/bitfields/main.cpp
@@ -104,5 +104,17 @@
   uwbf.x = 0x;
   uwubf.x = 0x;
 
+  struct BoolBits {
+bool a : 1;
+bool b : 1;
+bool c : 2;
+bool d : 2;
+  } bb;
+
+  bb.a = 0b1;
+  bb.b = 0b0;
+  bb.c = 0b11;
+  bb.d = 0b01;
+
   return 0; // Set break point at this line.
 }
Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -120,3 +120,36 @@
 '(uint32_t) b_a = 2',
 '(uint32_t:1) d_a = 1',
 ])
+
+self.expect(
+"frame variable --show-types bb",
+VARIABLES_DISPLAYED_CORRECTLY,
+substrs=[
+'(bool:1) a = true',
+'(bool:1) b = false',
+'(bool:2) c = true',
+'(bool:2) d = true',
+])
+
+bb = self.frame().FindVariable('bb')
+self.assertTrue(bb.IsValid())
+
+bb_a = bb.GetChildAtIndex(0)
+self.assertTrue(bb_a.IsValid())
+self.assertEqual(bb_a.GetValueAsUnsigned(), 1)
+self.assertEqual(bb_a.GetValueAsSigned(), 1)
+
+bb_b = bb.GetChildAtIndex(1)
+self.assertTrue(bb_b.IsValid())
+self.assertEqual(bb_b.GetValueAsUnsigned(), 0)
+self.assertEqual(bb_b.GetValueAsSigned(), 0)
+
+bb_c = bb.GetChildAtIndex(2)
+ 

[Lldb-commits] [PATCH] D102769: [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Andy Yankovsky via Phabricator via lldb-commits
werat created this revision.
werat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The tests works correctly on Windows, the linked bug has been resolved.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102769

Files:
  lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,8 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
 @skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,8 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
 @skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D102769: [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

Sorry, I meant you can just commit this without review :)

(also you probably want to actually remove the skipIf)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102769

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


[Lldb-commits] [PATCH] D102769: [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Andy Yankovsky via Phabricator via lldb-commits
werat updated this revision to Diff 346438.
werat added a comment.

remove the @skip


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102769

Files:
  lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,9 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
-@skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
 self.build()


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,9 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
-@skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
 self.build()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D102769: [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Andy Yankovsky via Phabricator via lldb-commits
werat added a comment.

Accidentally included only two out of three lines in the commit :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102769

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


[Lldb-commits] [lldb] d131081 - [lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-05-19 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-05-19T15:57:40+02:00
New Revision: d1310817194aad488c86f4fb627c33090600a4a9

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

LOG: [lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using 
DW_AT_rnglists_base (used by GCC)

DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx).
In such case DW_AT_rnglists_base does not need to be present.
DWARF-5 spec:
"If the offset_entry_count is zero, then DW_FORM_rnglistx cannot
be used to access a range list; DW_FORM_sec_offset must be used
instead. If the offset_entry_count is non-zero, then
DW_FORM_rnglistx may be used to access a range list;"

This fix is for TestTypeCompletion.py category `dwarf` using GCC with DWARF-5.

The fix just provides GetRnglist() lazy getter for `m_rnglist_table`.
The testcase is easier to review by:
diff -u lldb/test/Shell/SymbolFile/DWARF/DW_AT_low_pc-addrx.s \
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 6e233f89c714c..f47a044726f54 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -485,28 +485,37 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
 }
 
 void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
-  m_ranges_base = ranges_base;
-
-  if (GetVersion() < 5)
-return;
+  lldbassert(!m_rnglist_table_done);
 
-  if (auto table_or_error = ParseListTableHeader(
-  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-  ranges_base, DWARF32))
-m_rnglist_table = std::move(table_or_error.get());
-  else
-GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
-"Failed to extract range list table at offset 0x%" PRIx64 ": %s",
-ranges_base, toString(table_or_error.takeError()).c_str());
+  m_ranges_base = ranges_base;
 }
 
 const llvm::Optional &DWARFUnit::GetRnglist() {
+  if (GetVersion() >= 5 && !m_rnglist_table_done) {
+m_rnglist_table_done = true;
+if (auto table_or_error =
+ParseListTableHeader(
+m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
+m_ranges_base, DWARF32))
+  m_rnglist_table = std::move(table_or_error.get());
+else
+  GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
+  "Failed to extract range list table at offset 0x%" PRIx64 ": %s",
+  m_ranges_base, toString(table_or_error.takeError()).c_str());
+  }
   return m_rnglist_table;
 }
 
+// This function is called only for DW_FORM_rnglistx.
 llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) {
   if (!GetRnglist())
 return llvm::None;
+  if (!m_ranges_base) {
+GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
+"%8.8x: DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base",
+GetOffset());
+return llvm::None;
+  }
   if (llvm::Optional off = GetRnglist()->getOffsetEntry(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
 return *off + m_ranges_base;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 138012d0d922a..d9ef48d85a9b0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -325,6 +325,7 @@ class DWARFUnit : public lldb_private::UserID {
   dw_offset_t m_str_offsets_base = 0; // Value of DW_AT_str_offsets_base.
 
   llvm::Optional m_rnglist_table;
+  bool m_rnglist_table_done = false;
   llvm::Optional m_loclist_table_header;
 
   const DIERef::Section m_section;

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s 
b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
new file mode 100644
index 0..49e9e644d06ef
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -0,0 +1,138 @@
+# DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx).
+# In such case DW_AT_rnglists_base does not need to be present.
+
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit | FileCheck %s
+
+# Failure was the block range 1..2 was not printed plus:
+# error: DW_AT_range-DW_FORM_se

[Lldb-commits] [PATCH] D98289: [lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-05-19 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd1310817194a: [lldb] 2/2: Fix DW_AT_ranges 
DW_FORM_sec_offset not using DW_AT_rnglists_base… (authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98289

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -0,0 +1,138 @@
+# DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx).
+# In such case DW_AT_rnglists_base does not need to be present.
+
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit | FileCheck %s
+
+# Failure was the block range 1..2 was not printed plus:
+# error: DW_AT_range-DW_FORM_sec_offset.s.tmp {0x003f}: DIE has DW_AT_ranges(0xc) attribute, but range extraction failed (missing or invalid range list table), please file a bug and attach the file at the start of this error message
+
+# CHECK-LABEL: image lookup -v -s lookup_rnglists
+# CHECK:  Function: id = {0x0029}, name = "rnglists", range = [0x-0x0003)
+# CHECK:Blocks: id = {0x0029}, range = [0x-0x0003)
+# CHECK-NEXT:   id = {0x003f}, range = [0x0001-0x0002)
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
+# RUN:   --defsym RNGLISTX=0 %s > %t-rnglistx
+# RUN: %lldb %t-rnglistx -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTX %s
+
+# RNGLISTX-LABEL: image lookup -v -s lookup_rnglists
+# RNGLISTX: error: {{.*}} : DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
+# RUN:   --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase
+# RUN: %lldb %t-rnglistbase -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTBASE %s
+
+# RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
+# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has DW_AT_ranges(0x0) attribute, but range extraction failed (invalid range list table index 0), please file a bug and attach the file at the start of this error message
+
+.text
+rnglists:
+nop
+.Lblock1_begin:
+lookup_rnglists:
+nop
+.Lblock1_end:
+nop
+.Lrnglists_end:
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   8   # DW_FORM_string
+.byte   17  # DW_AT_low_pc
+.byte   27  # DW_FORM_addrx
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   115 # DW_AT_addr_base
+.byte   23  # DW_FORM_sec_offset
+.ifdef RNGLISTBASE
+.byte   0x74# DW_AT_rnglists_base
+.byte   23  # DW_FORM_sec_offset
+.endif
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_CHILDREN_yes
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   3   # DW_AT_name
+.byte   8   # DW_FORM_string
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   5   # Abbreviation Code
+.byte   11  # DW_TAG_lexical_block
+.byte   0   # DW_CHILDREN_no
+.byte   85  # DW_AT_ranges
+.ifndef RNGLISTX
+.byte   0x17# DW_FORM_sec_offset
+.else
+.byte   0x23# DW_FORM_rnglistx
+.endif
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   

[Lldb-commits] [lldb] 9dd861a - [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-05-19 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2021-05-19T15:57:40+02:00
New Revision: 9dd861a4f53968c732531de5d4488ace20d6d075

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

LOG: [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using 
DW_AT_rnglists_base (used by GCC)

Refactor code only for D98289.

Reviewed By: clayborg

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index ea10ba75afa84..6e233f89c714c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -500,6 +500,19 @@ void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
 ranges_base, toString(table_or_error.takeError()).c_str());
 }
 
+const llvm::Optional &DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}
+
+llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) {
+  if (!GetRnglist())
+return llvm::None;
+  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
+return *off + m_ranges_base;
+  return llvm::None;
+}
+
 void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) {
   m_str_offsets_base = str_offsets_base;
 }
@@ -941,11 +954,11 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
 return ranges;
   }
 
-  if (!m_rnglist_table)
+  if (!GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  auto range_list_or_error = m_rnglist_table->findList(
+  auto range_list_or_error = GetRnglist()->findList(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
   if (!range_list_or_error)
 return range_list_or_error.takeError();
@@ -976,7 +989,7 @@ llvm::Expected
 DWARFUnit::FindRnglistFromIndex(uint32_t index) {
   if (llvm::Optional offset = GetRnglistOffset(index))
 return FindRnglistFromOffset(*offset);
-  if (m_rnglist_table)
+  if (GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"invalid range list table index %d", index);
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 0fc8ceae81d28..138012d0d922a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@ class DWARFUnit : public lldb_private::UserID {
   /// 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.
-  llvm::Optional GetRnglistOffset(uint32_t Index) const {
-if (!m_rnglist_table)
-  return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-Index))
-  return *off + m_ranges_base;
-return llvm::None;
-  }
+  llvm::Optional GetRnglistOffset(uint32_t Index);
 
   llvm::Optional GetLoclistOffset(uint32_t Index) {
 if (!m_loclist_table_header)
@@ -291,6 +283,8 @@ class DWARFUnit : public lldb_private::UserID {
 return &m_die_array[0];
   }
 
+  const llvm::Optional &GetRnglist();
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;



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


[Lldb-commits] [PATCH] D99653: [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-05-19 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.
jankratochvil marked an inline comment as done.
Closed by commit rG9dd861a4f539: [nfc] [lldb] 1/2: Fix DW_AT_ranges 
DW_FORM_sec_offset not using… (authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99653

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@
   /// 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.
-  llvm::Optional GetRnglistOffset(uint32_t Index) const {
-if (!m_rnglist_table)
-  return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-Index))
-  return *off + m_ranges_base;
-return llvm::None;
-  }
+  llvm::Optional GetRnglistOffset(uint32_t Index);
 
   llvm::Optional GetLoclistOffset(uint32_t Index) {
 if (!m_loclist_table_header)
@@ -291,6 +283,8 @@
 return &m_die_array[0];
   }
 
+  const llvm::Optional &GetRnglist();
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -500,6 +500,19 @@
 ranges_base, toString(table_or_error.takeError()).c_str());
 }
 
+const llvm::Optional &DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}
+
+llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) {
+  if (!GetRnglist())
+return llvm::None;
+  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
+return *off + m_ranges_base;
+  return llvm::None;
+}
+
 void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) {
   m_str_offsets_base = str_offsets_base;
 }
@@ -941,11 +954,11 @@
 return ranges;
   }
 
-  if (!m_rnglist_table)
+  if (!GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  auto range_list_or_error = m_rnglist_table->findList(
+  auto range_list_or_error = GetRnglist()->findList(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
   if (!range_list_or_error)
 return range_list_or_error.takeError();
@@ -976,7 +989,7 @@
 DWARFUnit::FindRnglistFromIndex(uint32_t index) {
   if (llvm::Optional offset = GetRnglistOffset(index))
 return FindRnglistFromOffset(*offset);
-  if (m_rnglist_table)
+  if (GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"invalid range list table index %d", index);
 


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@
   /// 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.
-  llvm::Optional GetRnglistOffset(uint32_t Index) const {
-if (!m_rnglist_table)
-  return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-Index))
-  return *off + m_ranges_base;
-return llvm::None;
-  }
+  llvm::Optional GetRnglistOffset(uint32_t Index);
 
   llvm::Optional GetLoclistOffset(uint32_t Index) {
 if (!m_loclist_table_header)
@@ -291,6 +283,8 @@
 return &m_die_array[0];
   }
 
+  const llvm::Optional &GetRnglist();
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -500,6 +500,19 @@
 ranges_base, toString(table_or_error.takeError()).c_str());
 }
 
+const llvm::Optional &DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}
+
+llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) {
+  if (!GetRnglist())
+return llvm::None;
+  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+   

[Lldb-commits] [PATCH] D98289: [lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-05-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D98289#2764829 , @clayborg wrote:

> No objections from me. Anyone else?

So I have checked it in, thanks for checking it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98289

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


[Lldb-commits] [lldb] 6c83d4a - [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Andy Yankovsky via lldb-commits

Author: Andy Yankovsky
Date: 2021-05-19T17:04:19+02:00
New Revision: 6c83d4a60b7d243f0674f4381ec72b7c8ec4f2be

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

LOG: [lldb] Enable TestCppBitfields on Windows

The test works correctly on Windows, the linked bug has been resolved.

Reviewed By: teemperor

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

Added: 


Modified: 
lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py 
b/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
index bf457d33a0bd..480b680e792e 100644
--- a/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ b/lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,9 +16,6 @@ def setUp(self):
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
-@skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
 self.build()



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


[Lldb-commits] [PATCH] D102769: [lldb] Enable TestCppBitfields on Windows

2021-05-19 Thread Andy Yankovsky 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 rG6c83d4a60b7d: [lldb] Enable TestCppBitfields on Windows 
(authored by werat).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102769

Files:
  lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,9 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
-@skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
 self.build()


Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -16,9 +16,6 @@
 # Find the line number to break inside main().
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-# BitFields exhibit crashes in record layout on Windows
-# (http://llvm.org/pr21800)
-@skipIfWindows
 def test_and_run_command(self):
 """Test 'frame variable ...' on a variable with bitfields."""
 self.build()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 4b074b4 - [lldb] Fix UB in half2float and add some more tests.

2021-05-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-05-19T21:37:10+02:00
New Revision: 4b074b49be206306330076b9fa40632ef1960823

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

LOG: [lldb] Fix UB in half2float and add some more tests.

The added DumpDataExtractorTest uncovered that this is lshifting a negative
integer which upsets ubsan and breaks the sanitizer bot. This patch just
changes the variable we shift to be unsigned and adds a bunch of tests to make
sure this function does what it promises.

Added: 


Modified: 
lldb/source/Core/DumpDataExtractor.cpp
lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 




diff  --git a/lldb/source/Core/DumpDataExtractor.cpp 
b/lldb/source/Core/DumpDataExtractor.cpp
index ec44e3481c1e5..34c9353c9feaa 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -52,7 +52,9 @@ static float half2float(uint16_t half) {
 float f;
 uint32_t u;
   } u;
-  int32_t v = (int16_t)half;
+  // Sign extend to 4 byte.
+  int32_t sign_extended = static_cast(half);
+  uint32_t v = static_cast(sign_extended);
 
   if (0 == (v & 0x7c00)) {
 u.u = v & 0x80007FFFU;

diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index c4ec5f2e9a35b..05cd13add1e99 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -174,8 +174,30 @@ TEST(DumpDataExtractorTest, Formats) {
"{0x 0x}");
 
   // See half2float for format details.
+  // Test zeroes.
+  TestDump(std::vector{0x, 0x8000},
+   lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
+  // Some subnormal numbers.
+  TestDump(std::vector{0x0001, 0x8001},
+   lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 -5.96046e-08}");
+  // A full mantisse and empty expontent.
+  TestDump(std::vector{0x83ff, 0x03ff},
+   lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 6.09756e-05}");
+  // Some normal numbers.
+  TestDump(std::vector{0b011001001000},
+   lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
   TestDump(std::vector{0xabcd, 0x1234},
lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
+  // Largest and smallest normal number.
+  TestDump(std::vector{0x0400, 0x7bff},
+   lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
+  // quiet/signaling NaNs.
+  TestDump(std::vector{0x, 0xffc0, 0x7fff, 0x7fc0},
+   lldb::Format::eFormatVectorOfFloat16, "{nan nan nan nan}");
+  // +/-Inf.
+  TestDump(std::vector{0xfc00, 0x7c00},
+   lldb::Format::eFormatVectorOfFloat16, "{-inf inf}");
+
   TestDump(std::vector{std::numeric_limits::min(),
   std::numeric_limits::max()},
lldb::Format::eFormatVectorOfFloat32, "{1.17549e-38 3.40282e+38}");



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


[Lldb-commits] [lldb] 30a5dda - Revert "[lldb] Fix UB in half2float and add some more tests."

2021-05-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-05-19T22:06:53+02:00
New Revision: 30a5ddaef3e88912e10a6b1c8173b00819c722d3

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

LOG: Revert "[lldb] Fix UB in half2float and add some more tests."

This reverts commit 4b074b49be206306330076b9fa40632ef1960823.

Some of the new tests are failing on Debian.

Added: 


Modified: 
lldb/source/Core/DumpDataExtractor.cpp
lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 




diff  --git a/lldb/source/Core/DumpDataExtractor.cpp 
b/lldb/source/Core/DumpDataExtractor.cpp
index 34c9353c9feaa..ec44e3481c1e5 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -52,9 +52,7 @@ static float half2float(uint16_t half) {
 float f;
 uint32_t u;
   } u;
-  // Sign extend to 4 byte.
-  int32_t sign_extended = static_cast(half);
-  uint32_t v = static_cast(sign_extended);
+  int32_t v = (int16_t)half;
 
   if (0 == (v & 0x7c00)) {
 u.u = v & 0x80007FFFU;

diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index 05cd13add1e99..c4ec5f2e9a35b 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -174,30 +174,8 @@ TEST(DumpDataExtractorTest, Formats) {
"{0x 0x}");
 
   // See half2float for format details.
-  // Test zeroes.
-  TestDump(std::vector{0x, 0x8000},
-   lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
-  // Some subnormal numbers.
-  TestDump(std::vector{0x0001, 0x8001},
-   lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 -5.96046e-08}");
-  // A full mantisse and empty expontent.
-  TestDump(std::vector{0x83ff, 0x03ff},
-   lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 6.09756e-05}");
-  // Some normal numbers.
-  TestDump(std::vector{0b011001001000},
-   lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
   TestDump(std::vector{0xabcd, 0x1234},
lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
-  // Largest and smallest normal number.
-  TestDump(std::vector{0x0400, 0x7bff},
-   lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
-  // quiet/signaling NaNs.
-  TestDump(std::vector{0x, 0xffc0, 0x7fff, 0x7fc0},
-   lldb::Format::eFormatVectorOfFloat16, "{nan nan nan nan}");
-  // +/-Inf.
-  TestDump(std::vector{0xfc00, 0x7c00},
-   lldb::Format::eFormatVectorOfFloat16, "{-inf inf}");
-
   TestDump(std::vector{std::numeric_limits::min(),
   std::numeric_limits::max()},
lldb::Format::eFormatVectorOfFloat32, "{1.17549e-38 3.40282e+38}");



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


[Lldb-commits] [PATCH] D102811: [lldb] Move ClangModulesDeclVendor ownership to ClangPersistentVariables from Target

2021-05-19 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: teemperor, shafik, labath.
Herald added subscribers: yaxunl, mgorny.
bulbazord requested review of this revision.
Herald added a project: LLDB.

More decoupling of plugins and non-plugins. Target doesn't need to
manage ClangModulesDeclVendor and ClangPersistentVariables is always available
in situations where you need ClangModulesDeclVendor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102811

Files:
  lldb/include/lldb/Target/Target.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2546,23 +2546,6 @@
   return *m_source_manager_up;
 }
 
-ClangModulesDeclVendor *Target::GetClangModulesDeclVendor() {
-  static std::mutex s_clang_modules_decl_vendor_mutex; // If this is contended
-   // we can make it
-   // per-target
-
-  {
-std::lock_guard guard(s_clang_modules_decl_vendor_mutex);
-
-if (!m_clang_modules_decl_vendor_up) {
-  m_clang_modules_decl_vendor_up.reset(
-  ClangModulesDeclVendor::Create(*this));
-}
-  }
-
-  return m_clang_modules_decl_vendor_up.get();
-}
-
 Target::StopHookSP Target::CreateStopHook(StopHook::StopHookKind kind) {
   lldb::user_id_t new_uid = ++m_stop_hook_next_id;
   Target::StopHookSP stop_hook_sp;
Index: lldb/source/Target/CMakeLists.txt
===
--- lldb/source/Target/CMakeLists.txt
+++ lldb/source/Target/CMakeLists.txt
@@ -81,7 +81,6 @@
 lldbInterpreter
 lldbSymbol
 lldbUtility
-lldbPluginExpressionParserClang
 lldbPluginProcessUtility
 
   LINK_COMPONENTS
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -9653,7 +9653,8 @@
llvm::Triple triple)
 : TypeSystemClang("scratch ASTContext", triple), m_triple(triple),
   m_target_wp(target.shared_from_this()),
-  m_persistent_variables(new ClangPersistentVariables) {
+  m_persistent_variables(
+  new ClangPersistentVariables(target.shared_from_this())) {
   m_scratch_ast_source_up = CreateASTSource();
   m_scratch_ast_source_up->InstallASTContext(*this);
   llvm::IntrusiveRefCntPtr proxy_ast_source(
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -990,8 +990,11 @@
   bool result = false;
 
   if (auto *target = exe_scope->CalculateTarget().get()) {
-if (auto *clang_modules_decl_vendor =
-target->GetClangModulesDeclVendor()) {
+auto *persistent_vars = llvm::cast(
+target->GetPersistentExpressionStateForLanguage(
+lldb::eLanguageTypeC));
+if (std::shared_ptr clang_modules_decl_vendor =
+persistent_vars->GetClangModulesDeclVendor()) {
   ConstString key_cs(key);
   auto types = clang_modules_decl_vendor->FindTypes(
   key_cs, /*max_matches*/ UINT32_MAX);
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -352,10 +352,6 @@
 
 static void SetupDeclVendor(ExecutionContext &exe_ctx, Target *target,
 DiagnosticManager &diagnostic_manager) {
-  ClangModulesDeclVendor *decl_vendor = target->GetClangModulesDeclVendor();
-  if (!decl_vendor)
-return;
-
   if (!target->GetEnableAutoImportClangModules())
 return;
 
@@ -364,6 +360,11 @@
   if (!persistent_state)
 return;
 
+  std::shared_ptr decl_vendor =
+  persistent_state->GetClangModulesDeclVendor();
+  if (!decl_vendor)
+return;
+
   StackFrame *frame = exe_ctx

[Lldb-commits] [PATCH] D79752: [lldb] Move ClangModulesDeclVendor ownership to ClangPersistentVariables

2021-05-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor commandeered this revision.
teemperor edited reviewers, added: xiaobai; removed: teemperor.
teemperor added a comment.

Replaced by D102811  and Alex has apparently 
a new account, so closing this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79752

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


[Lldb-commits] [PATCH] D79752: [lldb] Move ClangModulesDeclVendor ownership to ClangPersistentVariables

2021-05-19 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

In D79752#2769664 , @teemperor wrote:

> Replaced by D102811  and Alex has 
> apparently a new account, so closing this.

Yes, thank you for doing that. Forgot about this one. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79752

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


[Lldb-commits] [PATCH] D102811: [lldb] Move ClangModulesDeclVendor ownership to ClangPersistentVariables from Target

2021-05-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.
Herald added a subscriber: JDevlieghere.

First and foremost: Cool new username. +1 from me.

Otherwise I think Shafik's comment in D79752  
still applies here. Could you make a short utility function for that chunk of 
code and put in ClangASTSource (ClangExpressionDeclMap inherits from this, so 
you can remove that part form both classes):

  auto persistent_vars = llvm::cast(
  m_target->GetPersistentExpressionStateForLanguage(lldb::eLanguageTypeC));
  std::shared_ptr modules_decl_vendor =
  persistent_vars->GetClangModulesDeclVendor();

Just something like `ClangModulesDeclVendor  
&ClangASTSource::GetClangModulesDeclVendor() { ... }` seems fine.

Beside that I think this is good to go.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102811

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


Re: [Lldb-commits] [lldb] 4b074b4 - [lldb] Fix UB in half2float and add some more tests.

2021-05-19 Thread Shafik Yaghmour via lldb-commits
*sigh*I wish we had std::bit_cast instead of using union based type punning, we 
do have __builtin_bit_cast but it is different enough that replacing it later 
on w/ std::bit_cast wouldn’t just be search/replace.

> On May 19, 2021, at 12:37 PM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> 
> Author: Raphael Isemann
> Date: 2021-05-19T21:37:10+02:00
> New Revision: 4b074b49be206306330076b9fa40632ef1960823
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/4b074b49be206306330076b9fa40632ef1960823
> DIFF: 
> https://github.com/llvm/llvm-project/commit/4b074b49be206306330076b9fa40632ef1960823.diff
> 
> LOG: [lldb] Fix UB in half2float and add some more tests.
> 
> The added DumpDataExtractorTest uncovered that this is lshifting a negative
> integer which upsets ubsan and breaks the sanitizer bot. This patch just
> changes the variable we shift to be unsigned and adds a bunch of tests to make
> sure this function does what it promises.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Core/DumpDataExtractor.cpp
>lldb/unittests/Core/DumpDataExtractorTest.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Core/DumpDataExtractor.cpp 
> b/lldb/source/Core/DumpDataExtractor.cpp
> index ec44e3481c1e5..34c9353c9feaa 100644
> --- a/lldb/source/Core/DumpDataExtractor.cpp
> +++ b/lldb/source/Core/DumpDataExtractor.cpp
> @@ -52,7 +52,9 @@ static float half2float(uint16_t half) {
> float f;
> uint32_t u;
>   } u;
> -  int32_t v = (int16_t)half;
> +  // Sign extend to 4 byte.
> +  int32_t sign_extended = static_cast(half);
> +  uint32_t v = static_cast(sign_extended);
> 
>   if (0 == (v & 0x7c00)) {
> u.u = v & 0x80007FFFU;
> 
> diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
> b/lldb/unittests/Core/DumpDataExtractorTest.cpp
> index c4ec5f2e9a35b..05cd13add1e99 100644
> --- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
> +++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
> @@ -174,8 +174,30 @@ TEST(DumpDataExtractorTest, Formats) {
>"{0x 0x}");
> 
>   // See half2float for format details.
> +  // Test zeroes.
> +  TestDump(std::vector{0x, 0x8000},
> +   lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
> +  // Some subnormal numbers.
> +  TestDump(std::vector{0x0001, 0x8001},
> +   lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 
> -5.96046e-08}");
> +  // A full mantisse and empty expontent.
> +  TestDump(std::vector{0x83ff, 0x03ff},
> +   lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 
> 6.09756e-05}");
> +  // Some normal numbers.
> +  TestDump(std::vector{0b011001001000},
> +   lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
>   TestDump(std::vector{0xabcd, 0x1234},
>lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
> +  // Largest and smallest normal number.
> +  TestDump(std::vector{0x0400, 0x7bff},
> +   lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
> +  // quiet/signaling NaNs.
> +  TestDump(std::vector{0x, 0xffc0, 0x7fff, 0x7fc0},
> +   lldb::Format::eFormatVectorOfFloat16, "{nan nan nan nan}");
> +  // +/-Inf.
> +  TestDump(std::vector{0xfc00, 0x7c00},
> +   lldb::Format::eFormatVectorOfFloat16, "{-inf inf}");
> +
>   TestDump(std::vector{std::numeric_limits::min(),
>   std::numeric_limits::max()},
>lldb::Format::eFormatVectorOfFloat32, "{1.17549e-38 3.40282e+38}");
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [PATCH] D102811: [lldb] Move ClangModulesDeclVendor ownership to ClangPersistentVariables from Target

2021-05-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D102811#2769686 , @teemperor wrote:

> First and foremost: Cool new username. +1 from me.

+2


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102811

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