[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2021-01-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.
Herald added a subscriber: omjavaid.

Is there a specific reason you've only covered x0..x7 in the test?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67954

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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2021-01-22 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D67954#2515028 , @mgorny wrote:

> Is there a specific reason you've only covered x0..x7 in the test?

No, only for keeping the test short and cohesive.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67954

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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2019-10-15 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1f6ba2a2ecd: [LLDB] [Windows] Initial support for ARM64 
register contexts (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67954

Files:
  lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
  
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.h
  lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.h
  lldb/test/Shell/Register/Inputs/aarch64-fp-read.cpp
  lldb/test/Shell/Register/Inputs/aarch64-gp-read.cpp
  lldb/test/Shell/Register/aarch64-fp-read.test
  lldb/test/Shell/Register/aarch64-gp-read.test
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -97,6 +97,8 @@
 features.add('target-x86')
 elif re.match(r'^x86_64.*', target_triple):
 features.add('target-x86_64')
+elif re.match(r'^aarch64.*', target_triple):
+features.add('target-aarch64')
 
 use_gmalloc = lit_config.params.get('use_gmalloc', None)
 if lit.util.pythonize_bool(use_gmalloc):
Index: lldb/test/Shell/Register/aarch64-gp-read.test
===
--- /dev/null
+++ lldb/test/Shell/Register/aarch64-gp-read.test
@@ -0,0 +1,24 @@
+# REQUIRES: native && target-aarch64
+# RUN: %clangxx -fomit-frame-pointer %p/Inputs/aarch64-gp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: x0 = 0x0001020304050607
+# CHECK-DAG: x1 = 0x1011121314151617
+# CHECK-DAG: x2 = 0x2021222324252627
+# CHECK-DAG: x3 = 0x3031323334353637
+# CHECK-DAG: x4 = 0x4041424344454647
+# CHECK-DAG: x5 = 0x5051525354555657
+# CHECK-DAG: x6 = 0x6061626364656667
+# CHECK-DAG: x7 = 0x7071727374757677
+# CHECK-DAG: w0 = 0x04050607
+
+# CHECK-DAG: v0 = {0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17}
+# CHECK-DAG: v1 = {0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18}
+# CHECK-DAG: v2 = {0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19}
+# CHECK-DAG: v3 = {0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a}
+# CHECK-DAG: v4 = {0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b}
+# CHECK-DAG: v5 = {0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c}
+# CHECK-DAG: v6 = {0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d}
+# CHECK-DAG: v7 = {0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e}
Index: lldb/test/Shell/Register/aarch64-fp-read.test
===
--- /dev/null
+++ lldb/test/Shell/Register/aarch64-fp-read.test
@@ -0,0 +1,21 @@
+# REQUIRES: native && target-aarch64
+# RUN: %clangxx -fomit-frame-pointer %p/Inputs/aarch64-fp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read d0
+register read d1
+register read d2
+register read d3
+register read s4
+register read s5
+register read s6
+register read s7
+# CHECK-DAG: d0 = 0.5
+# CHECK-DAG: d1 = 1.5
+# CHECK-DAG: d2 = 2.5
+# CHECK-DAG: d3 = 3.5
+# CHECK-DAG: s4 = 4.5
+# CHECK-DAG: s5 = 5.5
+# CHECK-DAG: s6 = 6.5
+# CHECK-DAG: s7 = 7.5
Index: lldb/test/Shell/Register/Inputs/aarch64-gp-read.cpp
===
--- /dev/null
+++ lldb/test/Shell/Register/Inputs/aarch64-gp-read.cpp
@@ -0,0 +1,47 @@
+#include 
+
+struct alignas(16) vec_t {
+  uint64_t a, b;
+};
+
+int main() {
+  constexpr uint64_t gprs[] = {
+0x0001020304050607,
+0x1011121314151617,
+0x2021222324252627,
+0x3031323334353637,
+0x4041424344454647,
+0x5051525354555657,
+0x6061626364656667,
+0x7071727374757677,
+  };
+
+  constexpr vec_t vecs[] = {
+{ 0x0F0E0D0C0B0A0908, 0x1716151413121110, },
+{ 0x100F0E0D0C0B0A09, 0x1817161514131211, },
+{ 0x11100F0E0D0C0B0A, 0x1918171615141312, },
+{ 0x1211100F0E0D0C0B, 0x1A19181716151413, },
+{ 0x131211100F0E0D0C, 0x1B1A191817161514, },
+{ 0x14131211100F0E0D, 0x1C1B1A1918171615, },
+{ 0x1514131211100F0E, 0x1D1C1B1A19181716, },
+{ 0x161514131211100F, 0x1E1D1C1B1A191817, },
+  };
+
+  asm volatile(
+"ldp  x0,  x1,  [%0]\n\t"
+"ldp  x2,  x3,  [%0, #16]\n\t"
+"ldp  x4,  x5,  [%0, #32]\n\t"
+"ldp  x6,  x7,  [%0, 

[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2019-10-14 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D67954#1707791 , @labath wrote:

> Hard to say off-hand, but the first thing I'd check is whether the 
> information about loaded modules and their addresses is making its way into 
> lldb. You can use the "image list" command to inspect that. Then there's the 
> "image show-unwind" command which can show you how lldb will try to unwind 
> for a given function/address. Also, if you enable the "unwind" log channel 
> (log enable lldb unwind), you'll get a trace of what lldb did while 
> attempting to unwind.


Thanks for the debugging pointers. I managed to track this down, with a fix 
suggestion in D68939 . I guess that indicates 
another issue elsewhere, but it's pretty much out of scope for me to dig 
further into that issue now. I guess it should be possible to reproduce the 
same issue on x86_64 by changing the triple similarly there as well.


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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2019-10-14 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D67954#1707791 , @labath wrote:

> Thank you _very_ much for those tests. +@mgorny, in case he has any comments 
> on those.
>
> In D67954#1707292 , @mstorsjo wrote:
>
> > The tests pass both with and without use of lldb-server. However, when 
> > using lldb-server with NativeRegisterContext, while the register values are 
> > correct, I don't get a correct working backtrace with it. Without 
> > lldb-server, I get a perfect backtrace. (The tested binary uses SEH unwind 
> > tables, but DWARF debug info.) Any clues about what might be going wrong 
> > there?
>
>
> Hard to say off-hand, but the first thing I'd check is whether the 
> information about loaded modules and their addresses is making its way into 
> lldb. You can use the "image list" command to inspect that. Then there's the 
> "image show-unwind" command which can show you how lldb will try to unwind 
> for a given function/address. Also, if you enable the "unwind" log channel 
> (log enable lldb unwind), you'll get a trace of what lldb did while 
> attempting to unwind.


Thanks for the debugging tips. When I run `image list` I get `error: the target 
has no associated executable images`, so that pretty clearly shows that 
something's missing. On x86_64, `image list` shows only the debugged exe 
itself, when run with `LLDB_USE_LLDB_SERVER=1`, while it shows the exe and a 
few system dlls (ntdll, kernel32, kernelbase and ucrtbase) when run without 
lldb-server.


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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2019-10-14 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a reviewer: mgorny.
labath added a comment.
This revision is now accepted and ready to land.

Thank you _very_ much for those tests. +@mgorny, in case he has any comments on 
those.

In D67954#1707292 , @mstorsjo wrote:

> The tests pass both with and without use of lldb-server. However, when using 
> lldb-server with NativeRegisterContext, while the register values are 
> correct, I don't get a correct working backtrace with it. Without 
> lldb-server, I get a perfect backtrace. (The tested binary uses SEH unwind 
> tables, but DWARF debug info.) Any clues about what might be going wrong 
> there?


Hard to say off-hand, but the first thing I'd check is whether the information 
about loaded modules and their addresses is making its way into lldb. You can 
use the "image list" command to inspect that. Then there's the "image 
show-unwind" command which can show you how lldb will try to unwind for a given 
function/address. Also, if you enable the "unwind" log channel (log enable lldb 
unwind), you'll get a trace of what lldb did while attempting to unwind.


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

https://reviews.llvm.org/D67954



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


[Lldb-commits] [PATCH] D67954: [LLDB] [Windows] Initial support for ARM64 register contexts

2019-10-12 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 224757.
mstorsjo retitled this revision from "[LLDB] [Windows] Initial support for 
ARM64 debugging" to "[LLDB] [Windows] Initial support for ARM64 register 
contexts".
mstorsjo edited the summary of this revision.
mstorsjo added a reviewer: aleksandr.urakov.
mstorsjo added a comment.
Herald added subscribers: llvm-commits, delcypher.
Herald added a project: LLVM.

Added two lit/shell based tests that pass on both linux/arm64 and 
windows/arm64. I've managed to set up some sort of hacked up environment where 
I can run lit/shell based tests (even though the main python test driver runs 
in WSL, but executing native windows binaries for the tests).

I also added a NativeRegisterContext for arm64, for lldb-server. For the 
RegisterInfoInterface for NativeRegisterContext, I reused 
RegisterInfoPOSIX_arm64 instead of creating a new copy similar to it, since I 
didn't really see anything OS specific in there.

The tests pass both with and without use of lldb-server. However, when using 
lldb-server with NativeRegisterContext, while the register values are correct, 
I don't get a correct working backtrace with it. Without lldb-server, I get a 
perfect backtrace. (The tested binary uses SEH unwind tables, but DWARF debug 
info.) Any clues about what might be going wrong there?


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

https://reviews.llvm.org/D67954

Files:
  lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
  
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.h
  lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.h
  lldb/test/Shell/Register/Inputs/aarch64-fp-read.cpp
  lldb/test/Shell/Register/Inputs/aarch64-gp-read.cpp
  lldb/test/Shell/Register/aarch64-fp-read.test
  lldb/test/Shell/Register/aarch64-gp-read.test
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -97,6 +97,8 @@
 features.add('target-x86')
 elif re.match(r'^x86_64.*', target_triple):
 features.add('target-x86_64')
+elif re.match(r'^aarch64.*', target_triple):
+features.add('target-aarch64')
 
 use_gmalloc = lit_config.params.get('use_gmalloc', None)
 if lit.util.pythonize_bool(use_gmalloc):
Index: lldb/test/Shell/Register/aarch64-gp-read.test
===
--- /dev/null
+++ lldb/test/Shell/Register/aarch64-gp-read.test
@@ -0,0 +1,24 @@
+# REQUIRES: native && target-aarch64
+# RUN: %clangxx -fomit-frame-pointer %p/Inputs/aarch64-gp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: x0 = 0x0001020304050607
+# CHECK-DAG: x1 = 0x1011121314151617
+# CHECK-DAG: x2 = 0x2021222324252627
+# CHECK-DAG: x3 = 0x3031323334353637
+# CHECK-DAG: x4 = 0x4041424344454647
+# CHECK-DAG: x5 = 0x5051525354555657
+# CHECK-DAG: x6 = 0x6061626364656667
+# CHECK-DAG: x7 = 0x7071727374757677
+# CHECK-DAG: w0 = 0x04050607
+
+# CHECK-DAG: v0 = {0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17}
+# CHECK-DAG: v1 = {0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18}
+# CHECK-DAG: v2 = {0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19}
+# CHECK-DAG: v3 = {0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a}
+# CHECK-DAG: v4 = {0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b}
+# CHECK-DAG: v5 = {0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c}
+# CHECK-DAG: v6 = {0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d}
+# CHECK-DAG: v7 = {0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e}
Index: lldb/test/Shell/Register/aarch64-fp-read.test
===
--- /dev/null
+++ lldb/test/Shell/Register/aarch64-fp-read.test
@@ -0,0 +1,21 @@
+# REQUIRES: native && target-aarch64
+# RUN: %clangxx -fomit-frame-pointer %p/Inputs/aarch64-fp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read d0
+register read d1
+register read d2
+register read d3
+register read s4
+register read s5
+register read s6
+register read s7
+# CHECK-DAG: d0 = 0.5
+# CHECK-DAG: d1 = 1.5
+# CHECK-DAG: d2 = 2.5
+# CHECK-DAG: d3 = 3.5
+# CHECK-DAG: s4 = 4.5
+# CHECK-DAG: s5 = 5.5
+# CHECK-DAG: s6 = 6.5
+# CHECK-DAG: s7 = 7.5
Index: