[Lldb-commits] [PATCH] D128678: [LLDB] Add PDB/calling-conventions.test for Arm/Windows

2022-06-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D128678#3616685 , @mstorsjo wrote:

> Thanks, this looks more complete and consistent to me now!
>
> In D128678#3615531 , @labath wrote:
>
>> It seems like this is not actually running the code. Can we make it such 
>> that these tests are conditional on the appropriate llvm targets being 
>> enabled (instead of the host being of a specific type)?
>
> Well it does need being able to link executables for these targets, which you 
> generally can't rely on I think? (I don't think the `%build` macro in general 
> works as a cross compiler?)

What Omair said. And, generally speaking, I'm not convinced of the usefulness 
of the %build script. It lacked sufficient buy-in from the start is now pretty 
much exclusively used for windows tests. It supports both cross-compilation and 
host-compilation modes, but it's very inconsistent about which one it uses for 
a particular combination of flags and compilers.
Overall, I don't think we need any kind of scripts for cross-compilation -- we 
can just issue appropriate clang and lld commands ourselves. There /might/ be a 
use case for host-compilation, but I suspect that could also be achieved with 
more conventional means (a couple of well-placed substitutions).

In D128678#3616753 , @omjavaid wrote:

> However its MS DIA SDK based PDB test which is only available on system 
> windows. NATIVE PDB reader tests are already being run independently.

Ok, that makes sense. Thanks.


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

https://reviews.llvm.org/D128678

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


[Lldb-commits] [PATCH] D128221: [LLDB] Add Arm64 CodeView to LLDB regnum mapping

2022-06-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett accepted this revision.
DavidSpickett added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D128221

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


[Lldb-commits] [PATCH] D128678: [LLDB] Add PDB/calling-conventions.test for Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

@labath @mstorsjo ok to land?


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

https://reviews.llvm.org/D128678

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


[Lldb-commits] [PATCH] D128776: Handle a stop when another thread has hit a breakpoint with a failed condition

2022-06-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

(Other than the inline comment, this seems fine to me)




Comment at: 
lldb/test/API/functionalities/breakpoint/two_hits_one_actual/main.cpp:6
+void usleep_helper(useconds_t usec) {
+  usleep(usec); // Break here in the helper
+}

usleep doesn't exist on windows. Use std::this_thread::sleep_for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128776

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


[Lldb-commits] [PATCH] D128638: [lldb] [llgs] Add base nonstop fork/vfork tests

2022-06-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks like a genuine problem, see 
https://lab.llvm.org/buildbot/#/builders/68/builds/34903. If I had to guess, 
I'd say the problem is you're overwriting the context object holding the first 
pid (here: 
https://github.com/llvm/llvm-project/blob/main/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py#L87)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128638

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


[Lldb-commits] [PATCH] D128780: [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

2022-06-29 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py:155
 parent_expect = [
-"T05thread:p{}.{};.*".format(parent_pid, parent_tid),
+"T13thread:p{}.{};.*".format(parent_pid, parent_tid),
 "W00;process:{}#.*".format(parent_pid),

SIGSTOP is 17 (0x11) on macos. Maybe you could check for "reason:signal" 
instead?


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

https://reviews.llvm.org/D128780

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


[Lldb-commits] [lldb] 695c22c - [LLDB] Fix PDB/pointers.test for 32bit Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-06-29T12:47:02+04:00
New Revision: 695c22c84a36daf0ed12b212c2ac9772f45c61f3

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

LOG: [LLDB] Fix PDB/pointers.test for 32bit Arm/Windows

PDB/pointers.test was orignally written for 32bit x86 keeping in mind
__cdecl and __stdcall calling conventions which does name mangling for
example like adding "_" underscore before function name.
This is only x86 specific but purpose of pointers.test is NOT to test
calling convention.
I am have made a few minor changes to this test which will make it pass
when run on Windows/Arm platform.

Reviewed By: mstorsjo

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

Added: 


Modified: 
lldb/test/Shell/SymbolFile/PDB/pointers.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/PDB/pointers.test 
b/lldb/test/Shell/SymbolFile/PDB/pointers.test
index a8f84f14783de..841fe8804b44c 100644
--- a/lldb/test/Shell/SymbolFile/PDB/pointers.test
+++ b/lldb/test/Shell/SymbolFile/PDB/pointers.test
@@ -19,7 +19,7 @@ MAIN-ST-NEXT: int a;
 MAIN-ST-NEXT: int {{.*}}f(int);
 MAIN-ST-NEXT:}
 
-MAIN:   Function{[[FID1:.*]]}, mangled = _main
+MAIN:   Function{[[FID1:.*]]}, mangled = {{_?}}main
 MAIN-NEXT:  Block{[[FID1]]}
 MAIN: Variable{{.*}}, name = "array_pointer"
 MAIN-SAME:(int (*)[2][4]), scope = local
@@ -28,11 +28,11 @@ MAIN-SAME:(int *), scope = local
 MAIN: Variable{{.*}}, name = "p_member_field"
 MAIN-SAME:(int ST::*), scope = local
 MAIN: Variable{{.*}}, name = "p_member_method"
-MAIN-SAME:(int (ST::*)(int) __attribute__((thiscall))), scope = local
+MAIN-SAME:(int (ST::*)(int){{( __attribute__\(\(thiscall\)\))?}}), scope = 
local
 
 F:   Function{[[FID2:.*]]}, demangled = {{.*}}f(int)
 F-NEXT:  Block{[[FID2]]}
 F: Variable{{.*}}, name = "this"
-F-SAME:(ST *), scope = parameter, location = {{.*}}, artificial
+F-SAME:(ST *), scope = parameter,{{( location = DW_OP.*,)?}} artificial
 F: Variable{{.*}}, name = "x"
 F-SAME:(int), scope = parameter, decl = PointerTypeTest.cpp:8



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


[Lldb-commits] [PATCH] D128668: [LLDB] Fix PDB/pointers.test for 32bit Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG695c22c84a36: [LLDB] Fix PDB/pointers.test for 32bit 
Arm/Windows (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128668

Files:
  lldb/test/Shell/SymbolFile/PDB/pointers.test


Index: lldb/test/Shell/SymbolFile/PDB/pointers.test
===
--- lldb/test/Shell/SymbolFile/PDB/pointers.test
+++ lldb/test/Shell/SymbolFile/PDB/pointers.test
@@ -19,7 +19,7 @@
 MAIN-ST-NEXT: int {{.*}}f(int);
 MAIN-ST-NEXT:}
 
-MAIN:   Function{[[FID1:.*]]}, mangled = _main
+MAIN:   Function{[[FID1:.*]]}, mangled = {{_?}}main
 MAIN-NEXT:  Block{[[FID1]]}
 MAIN: Variable{{.*}}, name = "array_pointer"
 MAIN-SAME:(int (*)[2][4]), scope = local
@@ -28,11 +28,11 @@
 MAIN: Variable{{.*}}, name = "p_member_field"
 MAIN-SAME:(int ST::*), scope = local
 MAIN: Variable{{.*}}, name = "p_member_method"
-MAIN-SAME:(int (ST::*)(int) __attribute__((thiscall))), scope = local
+MAIN-SAME:(int (ST::*)(int){{( __attribute__\(\(thiscall\)\))?}}), scope = 
local
 
 F:   Function{[[FID2:.*]]}, demangled = {{.*}}f(int)
 F-NEXT:  Block{[[FID2]]}
 F: Variable{{.*}}, name = "this"
-F-SAME:(ST *), scope = parameter, location = {{.*}}, artificial
+F-SAME:(ST *), scope = parameter,{{( location = DW_OP.*,)?}} artificial
 F: Variable{{.*}}, name = "x"
 F-SAME:(int), scope = parameter, decl = PointerTypeTest.cpp:8


Index: lldb/test/Shell/SymbolFile/PDB/pointers.test
===
--- lldb/test/Shell/SymbolFile/PDB/pointers.test
+++ lldb/test/Shell/SymbolFile/PDB/pointers.test
@@ -19,7 +19,7 @@
 MAIN-ST-NEXT: int {{.*}}f(int);
 MAIN-ST-NEXT:}
 
-MAIN:   Function{[[FID1:.*]]}, mangled = _main
+MAIN:   Function{[[FID1:.*]]}, mangled = {{_?}}main
 MAIN-NEXT:  Block{[[FID1]]}
 MAIN: Variable{{.*}}, name = "array_pointer"
 MAIN-SAME:(int (*)[2][4]), scope = local
@@ -28,11 +28,11 @@
 MAIN: Variable{{.*}}, name = "p_member_field"
 MAIN-SAME:(int ST::*), scope = local
 MAIN: Variable{{.*}}, name = "p_member_method"
-MAIN-SAME:(int (ST::*)(int) __attribute__((thiscall))), scope = local
+MAIN-SAME:(int (ST::*)(int){{( __attribute__\(\(thiscall\)\))?}}), scope = local
 
 F:   Function{[[FID2:.*]]}, demangled = {{.*}}f(int)
 F-NEXT:  Block{[[FID2]]}
 F: Variable{{.*}}, name = "this"
-F-SAME:(ST *), scope = parameter, location = {{.*}}, artificial
+F-SAME:(ST *), scope = parameter,{{( location = DW_OP.*,)?}} artificial
 F: Variable{{.*}}, name = "x"
 F-SAME:(int), scope = parameter, decl = PointerTypeTest.cpp:8
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a18baf1 - [LLDB] Add Arm64 CodeView to LLDB regnum mapping

2022-06-29 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-06-29T12:50:57+04:00
New Revision: a18baf16c665aab5631faace24a9d0fdc6b071bf

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

LOG: [LLDB] Add Arm64 CodeView to LLDB regnum mapping

This patch writes a mapping structure for converting  CodeView Arm64 register 
numbers to LLDB Arm64 regnums.

This fixes various symbols and variable location test failures on 
AArch64/Windows.

Reviewed By: DavidSpickett

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
index ca9ddcec287fc..3d8030916c84f 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
@@ -10,10 +10,196 @@
 
 #include "lldb/lldb-defines.h"
 
+#include "Plugins/Process/Utility/lldb-arm64-register-enums.h"
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
 
 using namespace lldb_private;
 
+static const uint32_t g_code_view_to_lldb_registers_arm64[] = {
+LLDB_INVALID_REGNUM, // NONE
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_w0_arm64,  // ARM64_W0, 10)
+gpr_w1_arm64,  // ARM64_W1, 11)
+gpr_w2_arm64,  // ARM64_W2, 12)
+gpr_w3_arm64,  // ARM64_W3, 13)
+gpr_w4_arm64,  // ARM64_W4, 14)
+gpr_w5_arm64,  // ARM64_W5, 15)
+gpr_w6_arm64,  // ARM64_W6, 16)
+gpr_w7_arm64,  // ARM64_W7, 17)
+gpr_w8_arm64,  // ARM64_W8, 18)
+gpr_w9_arm64,  // ARM64_W9, 19)
+gpr_w10_arm64, // ARM64_W10, 20)
+gpr_w11_arm64, // ARM64_W11, 21)
+gpr_w12_arm64, // ARM64_W12, 22)
+gpr_w13_arm64, // ARM64_W13, 23)
+gpr_w14_arm64, // ARM64_W14, 24)
+gpr_w15_arm64, // ARM64_W15, 25)
+gpr_w16_arm64, // ARM64_W16, 26)
+gpr_w17_arm64, // ARM64_W17, 27)
+gpr_w18_arm64, // ARM64_W18, 28)
+gpr_w19_arm64, // ARM64_W19, 29)
+gpr_w20_arm64, // ARM64_W20, 30)
+gpr_w21_arm64, // ARM64_W21, 31)
+gpr_w22_arm64, // ARM64_W22, 32)
+gpr_w23_arm64, // ARM64_W23, 33)
+gpr_w24_arm64, // ARM64_W24, 34)
+gpr_w25_arm64, // ARM64_W25, 35)
+gpr_w26_arm64, // ARM64_W26, 36)
+gpr_w27_arm64, // ARM64_W27, 37)
+gpr_w28_arm64, // ARM64_W28, 38)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_x0_arm64,  // ARM64_X0, 50)
+gpr_x1_arm64,  // ARM64_X1, 51)
+gpr_x2_arm64,  // ARM64_X2, 52)
+gpr_x3_arm64,  // ARM64_X3, 53)
+gpr_x4_arm64,  // ARM64_X4, 54)
+gpr_x5_arm64,  // ARM64_X5, 55)
+gpr_x6_arm64,  // ARM64_X6, 56)
+gpr_x7_arm64,  // ARM64_X7, 57)
+gpr_x8_arm64,  // ARM64_X8, 58)
+gpr_x9_arm64,  // ARM64_X9, 59)
+gpr_x10_arm64, // ARM64_X10, 60)
+gpr_x11_arm64, // ARM64_X11, 61)
+gpr_x12_arm64, // ARM64_X12, 62)
+gpr_x13_arm64, // ARM64_X13, 63)
+gpr_x14_arm64, // ARM64_X14, 64)
+gpr_x15_arm64, // ARM64_X15, 65)
+gpr_x16_arm64, // ARM64_X16, 66)
+gpr_x17_arm64, // ARM64_X17, 67)
+gpr_x18_arm64, // ARM64_X18, 68)
+gpr_x19_arm64, // ARM64_X19, 69)
+gpr_x20_arm64, // ARM64_X20, 70)
+gpr_x21_arm64, // ARM64_X21, 71)
+gpr_x22_arm64, // ARM64_X22, 72)
+gpr_x23_arm64, // ARM64_X23, 73)
+gpr_x24_arm64, // ARM64_X24, 74)
+gpr_x25_arm64, // ARM64_X25, 75)
+gpr_x26_arm64, // ARM64_X26, 76)
+gpr_x27_arm64, // ARM64_X27, 77)
+gpr_x28_arm64, // ARM64_X28, 78)
+gpr_fp_arm64,  // ARM64_FP, 79)
+gpr_lr_arm64,  // ARM64_LR, 80)
+gpr_sp_arm64,  // ARM64_SP, 81)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_cpsr_arm64, // ARM64_NZCV, 90)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+fpu_s0_arm64,  // (ARM64_S0, 100)
+fpu_s1_arm64,  // (ARM64_S1, 101)
+fpu_s2_arm64,  // (ARM64_S2, 102)
+fpu_s3_arm64,  // (ARM64_S3, 103)
+fpu_s4_arm64,  // (ARM64_S4, 104)
+fpu_s5_arm64,  // (ARM64_S5, 105)
+fpu_s6_arm64,  // (ARM64_S6, 106)
+fpu_s7_arm64,  // (ARM64_S7, 107)
+   

[Lldb-commits] [PATCH] D128221: [LLDB] Add Arm64 CodeView to LLDB regnum mapping

2022-06-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa18baf16c665: [LLDB] Add Arm64 CodeView to LLDB regnum 
mapping (authored by omjavaid).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128221

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp

Index: lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
@@ -10,10 +10,196 @@
 
 #include "lldb/lldb-defines.h"
 
+#include "Plugins/Process/Utility/lldb-arm64-register-enums.h"
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
 
 using namespace lldb_private;
 
+static const uint32_t g_code_view_to_lldb_registers_arm64[] = {
+LLDB_INVALID_REGNUM, // NONE
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_w0_arm64,  // ARM64_W0, 10)
+gpr_w1_arm64,  // ARM64_W1, 11)
+gpr_w2_arm64,  // ARM64_W2, 12)
+gpr_w3_arm64,  // ARM64_W3, 13)
+gpr_w4_arm64,  // ARM64_W4, 14)
+gpr_w5_arm64,  // ARM64_W5, 15)
+gpr_w6_arm64,  // ARM64_W6, 16)
+gpr_w7_arm64,  // ARM64_W7, 17)
+gpr_w8_arm64,  // ARM64_W8, 18)
+gpr_w9_arm64,  // ARM64_W9, 19)
+gpr_w10_arm64, // ARM64_W10, 20)
+gpr_w11_arm64, // ARM64_W11, 21)
+gpr_w12_arm64, // ARM64_W12, 22)
+gpr_w13_arm64, // ARM64_W13, 23)
+gpr_w14_arm64, // ARM64_W14, 24)
+gpr_w15_arm64, // ARM64_W15, 25)
+gpr_w16_arm64, // ARM64_W16, 26)
+gpr_w17_arm64, // ARM64_W17, 27)
+gpr_w18_arm64, // ARM64_W18, 28)
+gpr_w19_arm64, // ARM64_W19, 29)
+gpr_w20_arm64, // ARM64_W20, 30)
+gpr_w21_arm64, // ARM64_W21, 31)
+gpr_w22_arm64, // ARM64_W22, 32)
+gpr_w23_arm64, // ARM64_W23, 33)
+gpr_w24_arm64, // ARM64_W24, 34)
+gpr_w25_arm64, // ARM64_W25, 35)
+gpr_w26_arm64, // ARM64_W26, 36)
+gpr_w27_arm64, // ARM64_W27, 37)
+gpr_w28_arm64, // ARM64_W28, 38)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_x0_arm64,  // ARM64_X0, 50)
+gpr_x1_arm64,  // ARM64_X1, 51)
+gpr_x2_arm64,  // ARM64_X2, 52)
+gpr_x3_arm64,  // ARM64_X3, 53)
+gpr_x4_arm64,  // ARM64_X4, 54)
+gpr_x5_arm64,  // ARM64_X5, 55)
+gpr_x6_arm64,  // ARM64_X6, 56)
+gpr_x7_arm64,  // ARM64_X7, 57)
+gpr_x8_arm64,  // ARM64_X8, 58)
+gpr_x9_arm64,  // ARM64_X9, 59)
+gpr_x10_arm64, // ARM64_X10, 60)
+gpr_x11_arm64, // ARM64_X11, 61)
+gpr_x12_arm64, // ARM64_X12, 62)
+gpr_x13_arm64, // ARM64_X13, 63)
+gpr_x14_arm64, // ARM64_X14, 64)
+gpr_x15_arm64, // ARM64_X15, 65)
+gpr_x16_arm64, // ARM64_X16, 66)
+gpr_x17_arm64, // ARM64_X17, 67)
+gpr_x18_arm64, // ARM64_X18, 68)
+gpr_x19_arm64, // ARM64_X19, 69)
+gpr_x20_arm64, // ARM64_X20, 70)
+gpr_x21_arm64, // ARM64_X21, 71)
+gpr_x22_arm64, // ARM64_X22, 72)
+gpr_x23_arm64, // ARM64_X23, 73)
+gpr_x24_arm64, // ARM64_X24, 74)
+gpr_x25_arm64, // ARM64_X25, 75)
+gpr_x26_arm64, // ARM64_X26, 76)
+gpr_x27_arm64, // ARM64_X27, 77)
+gpr_x28_arm64, // ARM64_X28, 78)
+gpr_fp_arm64,  // ARM64_FP, 79)
+gpr_lr_arm64,  // ARM64_LR, 80)
+gpr_sp_arm64,  // ARM64_SP, 81)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+gpr_cpsr_arm64, // ARM64_NZCV, 90)
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
+fpu_s0_arm64,  // (ARM64_S0, 100)
+fpu_s1_arm64,  // (ARM64_S1, 101)
+fpu_s2_arm64,  // (ARM64_S2, 102)
+fpu_s3_arm64,  // (ARM64_S3, 103)
+fpu_s4_arm64,  // (ARM64_S4, 104)
+fpu_s5_arm64,  // (ARM64_S5, 105)
+fpu_s6_arm64,  // (ARM64_S6, 106)
+fpu_s7_arm64,  // (ARM64_S7, 107)
+fpu_s8_arm64,  // (ARM64_S8, 108)
+fpu_s9_arm64,  // (ARM64_S9, 109)
+fpu_s10_arm64, // (ARM64_S10, 110)
+fpu_s11_arm64, // (ARM64_S11, 111)
+fpu_s12_arm64, // (ARM64_S12, 112)
+fpu_s13_arm64, // (ARM64_S13, 113)
+fpu_s14_arm64, // (ARM64_S14, 114)
+fpu_s15_arm64, // (ARM64_S15, 115)
+fpu_s16_arm64, // (ARM64_S16, 116)
+fpu_s17_arm64, // (ARM64_S17, 117)
+fpu_s18_arm64, // (ARM64_S18, 118)
+fpu_s19_arm64, // (ARM64_S19, 119)
+fpu_s20_arm64, // (

[Lldb-commits] [lldb] 01bc838 - [LLDB] Add PDB/calling-conventions.test for Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-06-29T12:58:16+04:00
New Revision: 01bc838e4512ad645f72afd1d6b613d12c929aa4

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

LOG: [LLDB] Add PDB/calling-conventions.test for Arm/Windows

This patch renames PDB/calling-conventions.test to calling-conventions-x86.test.
Also restrict it to run only for target-x86*.
This patch also adds a arm specific test PDB/calling-conventions-arm.test which
tests that x86 specifc calling convention decorators are ignored by Arm 
compiler.

Reviewed By: labath

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

Added: 
lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test

Modified: 


Removed: 
lldb/test/Shell/SymbolFile/PDB/calling-conventions.test



diff  --git a/lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test 
b/lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
new file mode 100644
index 0..07dc89d460293
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
@@ -0,0 +1,11 @@
+REQUIRES: system-windows, lld, (target-arm || target-aarch64) 
+RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
+RUN: %build --compiler=clang-cl --arch=64 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
+RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
+
+CHECK: Module: {{.*}}
+CHECK-DAG: int (*FuncCCallPtr)();
+CHECK-DAG: int (*FuncStdCallPtr)();
+CHECK-DAG: int (*FuncFastCallPtr)();
+CHECK-DAG: int (*FuncVectorCallPtr)();
+CHECK-DAG: int (S::*FuncThisCallPtr)();

diff  --git a/lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test 
b/lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
new file mode 100644
index 0..065c8b69b06dd
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
@@ -0,0 +1,19 @@
+REQUIRES: system-windows, lld, (target-x86 || target-x86_64) 
+RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 
32BIT-CHECK %s
+RUN: %build --compiler=clang-cl --arch=64 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 
64BIT-CHECK %s
+
+64BIT-CHECK: Module: {{.*}}
+64BIT-CHECK-DAG: int (*FuncCCallPtr)();
+64BIT-CHECK-DAG: int (*FuncStdCallPtr)();
+64BIT-CHECK-DAG: int (*FuncFastCallPtr)();
+64BIT-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
+64BIT-CHECK-DAG: int (S::*FuncThisCallPtr)();
+
+32BIT-CHECK: Module: {{.*}}
+32BIT-CHECK-DAG: int (*FuncCCallPtr)();
+32BIT-CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall));
+32BIT-CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall));
+32BIT-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
+32BIT-CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall));

diff  --git a/lldb/test/Shell/SymbolFile/PDB/calling-conventions.test 
b/lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
deleted file mode 100644
index a85dc65ff04dd..0
--- a/lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
+++ /dev/null
@@ -1,10 +0,0 @@
-REQUIRES: system-windows, lld
-RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
-RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
-
-CHECK: Module: {{.*}}
-CHECK-DAG: int (*FuncCCallPtr)();
-CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall));
-CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall));
-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
-CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall));



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


[Lldb-commits] [PATCH] D128678: [LLDB] Add PDB/calling-conventions.test for Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG01bc838e4512: [LLDB] Add PDB/calling-conventions.test for 
Arm/Windows (authored by omjavaid).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128678

Files:
  lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
  lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
  lldb/test/Shell/SymbolFile/PDB/calling-conventions.test


Index: lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
===
--- lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
+++ /dev/null
@@ -1,10 +0,0 @@
-REQUIRES: system-windows, lld
-RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
-RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
-
-CHECK: Module: {{.*}}
-CHECK-DAG: int (*FuncCCallPtr)();
-CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall));
-CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall));
-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
-CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall));
Index: lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
@@ -0,0 +1,19 @@
+REQUIRES: system-windows, lld, (target-x86 || target-x86_64) 
+RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 
32BIT-CHECK %s
+RUN: %build --compiler=clang-cl --arch=64 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 
64BIT-CHECK %s
+
+64BIT-CHECK: Module: {{.*}}
+64BIT-CHECK-DAG: int (*FuncCCallPtr)();
+64BIT-CHECK-DAG: int (*FuncStdCallPtr)();
+64BIT-CHECK-DAG: int (*FuncFastCallPtr)();
+64BIT-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
+64BIT-CHECK-DAG: int (S::*FuncThisCallPtr)();
+
+32BIT-CHECK: Module: {{.*}}
+32BIT-CHECK-DAG: int (*FuncCCallPtr)();
+32BIT-CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall));
+32BIT-CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall));
+32BIT-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
+32BIT-CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall));
Index: lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
@@ -0,0 +1,11 @@
+REQUIRES: system-windows, lld, (target-arm || target-aarch64) 
+RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
+RUN: %build --compiler=clang-cl --arch=64 --nodefaultlib --output=%t.exe 
%S/Inputs/CallingConventionsTest.cpp
+RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
+
+CHECK: Module: {{.*}}
+CHECK-DAG: int (*FuncCCallPtr)();
+CHECK-DAG: int (*FuncStdCallPtr)();
+CHECK-DAG: int (*FuncFastCallPtr)();
+CHECK-DAG: int (*FuncVectorCallPtr)();
+CHECK-DAG: int (S::*FuncThisCallPtr)();


Index: lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
===
--- lldb/test/Shell/SymbolFile/PDB/calling-conventions.test
+++ /dev/null
@@ -1,10 +0,0 @@
-REQUIRES: system-windows, lld
-RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe %S/Inputs/CallingConventionsTest.cpp
-RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
-
-CHECK: Module: {{.*}}
-CHECK-DAG: int (*FuncCCallPtr)();
-CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall));
-CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall));
-CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall));
-CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall));
Index: lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
@@ -0,0 +1,19 @@
+REQUIRES: system-windows, lld, (target-x86 || target-x86_64) 
+RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe %S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 32BIT-CHECK %s
+RUN: %build --compiler=clang-cl --arch=64 --nodefaultlib --output=%t.exe %S/Inputs/CallingConventionsTest.cpp \
+RUN:  && lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix 64BIT-CHECK %s
+
+64BIT-CHECK: Module: {{.*}}
+64BIT-CHECK-DAG: int (*FuncCCallPtr)();
+64BIT-CHECK-DAG: int (*FuncStdCallPtr)();
+64BIT-CHECK-DAG: int (*FuncFastCallPtr)();
+64BIT-CHECK-DAG: 

[Lldb-commits] [lldb] d8ad018 - [lldb] fix stepping through POSIX trampolines

2022-06-29 Thread Pavel Labath via lldb-commits

Author: Michael Daniels
Date: 2022-06-29T11:06:29+02:00
New Revision: d8ad018869aeb1ffe40e94ee4d6d377121581083

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

LOG: [lldb] fix stepping through POSIX trampolines

The DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan() function was
doing the symbol lookup using the demangled name. This stopped working
with https://reviews.llvm.org/D118814. To get things working again, just
use the mangled name for the lookup instead.

Reviewed By: labath

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

Added: 
lldb/test/API/lang/cpp/step-through-trampoline/Makefile
lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
lldb/test/API/lang/cpp/step-through-trampoline/foo.h
lldb/test/API/lang/cpp/step-through-trampoline/main.cpp

Modified: 
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index b3360dbf6158a..64bc5323fc4e6 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -488,7 +488,7 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread 
&thread,
   if (sym == nullptr || !sym->IsTrampoline())
 return thread_plan_sp;
 
-  ConstString sym_name = sym->GetName();
+  ConstString sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
   if (!sym_name)
 return thread_plan_sp;
 

diff  --git a/lldb/test/API/lang/cpp/step-through-trampoline/Makefile 
b/lldb/test/API/lang/cpp/step-through-trampoline/Makefile
new file mode 100644
index 0..624021fbe98d6
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/Makefile
@@ -0,0 +1,6 @@
+DYLIB_NAME := foo
+DYLIB_CXX_SOURCES := foo.cpp
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
+

diff  --git 
a/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py 
b/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
new file mode 100644
index 0..b6384c73306ab
--- /dev/null
+++ 
b/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class StepThroughTrampoline(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+   "// Set a breakpoint here",
+   lldb.SBFileSpec("main.cpp"),
+   extra_images=["foo"])
+thread.StepInto()
+
+foo_line = line_number("foo.cpp", '// End up here')
+self.expect("frame info", substrs=["foo.cpp:{}:".format(foo_line)])

diff  --git a/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp 
b/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
new file mode 100644
index 0..8faa4b65c8068
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo() { } // End up here
+

diff  --git a/lldb/test/API/lang/cpp/step-through-trampoline/foo.h 
b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
new file mode 100644
index 0..edfeae5a215f3
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -0,0 +1,2 @@
+extern void foo();
+

diff  --git a/lldb/test/API/lang/cpp/step-through-trampoline/main.cpp 
b/lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
new file mode 100644
index 0..3896e71f860a9
--- /dev/null
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(void) {
+foo(); // Set a breakpoint here
+}
+



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


[Lldb-commits] [PATCH] D127999: [lldb] fix stepping through POSIX trampolines

2022-06-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd8ad018869ae: [lldb] fix stepping through POSIX trampolines 
(authored by mdaniels, committed by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127999

Files:
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/test/API/lang/cpp/step-through-trampoline/Makefile
  lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
  lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
  lldb/test/API/lang/cpp/step-through-trampoline/foo.h
  lldb/test/API/lang/cpp/step-through-trampoline/main.cpp


Index: lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(void) {
+foo(); // Set a breakpoint here
+}
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.h
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -0,0 +1,2 @@
+extern void foo();
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo() { } // End up here
+
Index: 
lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class StepThroughTrampoline(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+   "// Set a breakpoint here",
+   lldb.SBFileSpec("main.cpp"),
+   extra_images=["foo"])
+thread.StepInto()
+
+foo_line = line_number("foo.cpp", '// End up here')
+self.expect("frame info", substrs=["foo.cpp:{}:".format(foo_line)])
Index: lldb/test/API/lang/cpp/step-through-trampoline/Makefile
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/Makefile
@@ -0,0 +1,6 @@
+DYLIB_NAME := foo
+DYLIB_CXX_SOURCES := foo.cpp
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
+
Index: lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
===
--- lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -488,7 +488,7 @@
   if (sym == nullptr || !sym->IsTrampoline())
 return thread_plan_sp;
 
-  ConstString sym_name = sym->GetName();
+  ConstString sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
   if (!sym_name)
 return thread_plan_sp;
 


Index: lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/main.cpp
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int main(void) {
+foo(); // Set a breakpoint here
+}
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.h
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -0,0 +1,2 @@
+extern void foo();
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+void foo() { } // End up here
+
Index: lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class StepThroughTrampoline(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
+   "// Set a breakpoint here",
+   lldb.SBFileSpec("main.cpp"),
+   extra_images=["foo"])
+thread.StepInto()
+
+foo_line = line_number("foo.cpp"

[Lldb-commits] [PATCH] D128638: [lldb] [llgs] Add base nonstop fork/vfork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D128638#3618039 , @labath wrote:

> This looks like a genuine problem, see 
> https://lab.llvm.org/buildbot/#/builders/68/builds/34903. If I had to guess, 
> I'd say the problem is you're overwriting the context object holding the 
> first pid (here: 
> https://github.com/llvm/llvm-project/blob/main/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py#L87)

Good catch, I obviously meant to use `pid1` and `pid2` vars there. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128638

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


[Lldb-commits] [lldb] 3c16fb3 - [lldb] [test] Fix variable overwrite in non-stop fork tests

2022-06-29 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-06-29T13:34:50+02:00
New Revision: 3c16fb3ab34d51c0df9512c38093d1c5c8dd6e79

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

LOG: [lldb] [test] Fix variable overwrite in non-stop fork tests

Thanks to Pavel Labath for noticing the mistake in:
https://reviews.llvm.org/D128638#3618039

Sponsored by: The FreeBSD Foundation

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
index 6b5010da9b19..bd9484ff0903 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -92,8 +92,7 @@ def test_kill_all_nonstop(self):
 "send packet: $OK#00",
 ], True)
 self.expect_gdbremote_sequence()
-self.assertEqual(set([ret["pid1"], ret["pid2"]]),
- set([parent_pid, child_pid]))
+self.assertEqual(set([pid1, pid2]), set([parent_pid, child_pid]))
 
 @add_test_categories(["fork"])
 def test_vkill_both_nonstop(self):



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


[Lldb-commits] [lldb] 5e39198 - [lldb] Replace linux/uio.h with sys/uio.h in NativeRegisterContextLinux_s390x

2022-06-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-06-29T14:50:06+02:00
New Revision: 5e391985709f0ab585d46ad534b4f3b48c6a68f9

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

LOG: [lldb] Replace linux/uio.h with sys/uio.h in 
NativeRegisterContextLinux_s390x

Fixes PR56280.

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
index 0c3afd66ee256..121f405e546ed 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
@@ -10,16 +10,14 @@
 
 #include "NativeRegisterContextLinux_s390x.h"
 #include "Plugins/Process/Linux/NativeProcessLinux.h"
+#include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/Status.h"
-
-#include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
-
-#include 
 #include 
+#include 
 
 using namespace lldb_private;
 using namespace lldb_private::process_linux;



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


[Lldb-commits] [PATCH] D128780: [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py:155
 parent_expect = [
-"T05thread:p{}.{};.*".format(parent_pid, parent_tid),
+"T13thread:p{}.{};.*".format(parent_pid, parent_tid),
 "W00;process:{}#.*".format(parent_pid),

labath wrote:
> SIGSTOP is 17 (0x11) on macos. Maybe you could check for "reason:signal" 
> instead?
I don't think macos is really relevant but you're right. I've forgotten that we 
haven't changed lldb-server to use normalized signos. I'll fix all the tests 
not to rely on specific signos.


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

https://reviews.llvm.org/D128780

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


[Lldb-commits] [PATCH] D128638: [lldb] [llgs] Add base nonstop fork/vfork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Ok, it seems that all the relevant bots are green now. Thanks again!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128638

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


[Lldb-commits] [PATCH] D128576: [trace] Make events first class items in the trace cursor and rework errors

2022-06-29 Thread Jakob Johnson via Phabricator via lldb-commits
jj10306 accepted this revision.
jj10306 added a comment.
This revision is now accepted and ready to land.

This is awesome work - the code is much more understandable, so thanks for 
doing this!

lgtm overall, just left a couple final minor comments. I think we can continue 
to iterate/improve this design, so we can discuss those improvements for future 
diffs. 
Also, let me know what you think about how to support the two different types 
of disable events - this doesn't need to be done in this diff but it would be 
extremely useful as we begin to explore kernel tracing since this will most 
likely require us to understand any differences between user only, kernel only, 
or user + kernel tracing.




Comment at: lldb/include/lldb/lldb-enumerations.h:1162-1167
+// Enum used to identify which kind of item a \a TraceCursor is pointing at
+enum TraceItemKind {
+  eTraceItemKindError = 0,
+  eTraceItemKindEvent,
+  eTraceItemKindInstruction,
 };

nice



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp:51-52
 
-lldb::addr_t DecodedThread::GetInstructionLoadAddress(size_t insn_index) const 
{
-  return m_instruction_ips[insn_index];
+lldb::addr_t DecodedThread::GetInstructionLoadAddress(size_t item_index) const 
{
+  return m_items[item_index].data.instruction.load_address;
 }

with this current implementation, it's the caller's responsibility to check the 
Item's type before calling this otherwise they will get a garbage load address 
if the item is actually an event for example.
Would it be better to enforce the validity of the Get call at this lowest level 
of storage by checking that the type matches what is expected and return None 
or something like LLDB_INVALID_ADDRESS if there's a mismatch?
same idea applies below for the other getters



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp:84-86
+  m_items.emplace_back();
+  size_t index = m_items.size() - 1;
+  m_items[index].kind = kind;

nit: consider using `emplace` since this returns a ref to the item. or just 
create a constructor for the TraceItemKind that you can pass the kind to so you 
can set the kind in the emplace call and then there's no need for a reference 
to the newly inserted object

another suggestion would be to just make this method return a reference to the 
newly created TraceItemStorage since all the callers end up using the index to 
get access to the newly added item, so returning the ref would remove the need 
for those "redundant" lookups



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:245
+/// The TraceItemKind for each trace item encoded as uint8_t.
+uint8_t kind;
+union {

why not use the enum as the type?



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:264
+
+  /// Most of the trace data is stored here.
+  std::vector m_items;

why is this "most"?



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:265
+  /// Most of the trace data is stored here.
+  std::vector m_items;
 

nice, this is much more clear now (:



Comment at: lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp:159-165
   case ptev_disabled:
 // The CPU paused tracing the program, e.g. due to ip filtering.
   case ptev_async_disabled:
 // The kernel or user code paused tracing the program, e.g.
 // a breakpoint or a ioctl invocation pausing the trace, or a
 // context switch happened.
+m_decoded_thread.AppendEvent(lldb::eTraceEventDisabled);

oooh, having a separate event for these two disabled cases would be provide 
great insight for us when trying to understand how tracing is enabled/disabled 
for user vs kernel mode (ie is it disabled by the hardware due to CPL filtering 
(ptev_disabled) or by the kernel/user (ptev_asyn_disabled)) - this is super 
cool and will be very useful!

not sure how we could cleanly expose this though since these different types of 
disables are pretty intelpt specific, but the notion of the traceevent is 
exposed at the top-level trace-agnostic tracecursor, right?
wdyt?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128576

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


[Lldb-commits] [PATCH] D128780: [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: lldb/test/API/tools/lldb-server/main.cpp:357
+#if !defined(_WIN32)
+} else if (consume_front(arg, "stop")) {
+  raise(SIGSTOP);

Changing this to `arg == "stop"`, as right now it unintentionally matches stuff 
like `"stop-me-now"` that other tests use as output.


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

https://reviews.llvm.org/D128780

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


[Lldb-commits] [lldb] 251165b - [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

2022-06-29 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-06-29T15:37:26+02:00
New Revision: 251165b2e48216f8fbeef1960711219afac406f4

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

LOG: [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

Replace the use of "trap" with a new "stop" command in fork tests,
that maps to `raise(SIGSTOP)`.  Since traps do not increment PC on some
architectures (notably ARM), using traps would require special logic
to increment it while testing.  Using SIGSTOP avoids the problem
and is probably more logical, given that the purpose of the "trap"s
was to simply stop the inferior at a synchronization point.  This fixes
tests on AArch64 (and possibly ARM, I'll update XFAILs when it is
confirmed by the buildbot).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128780

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
lldb/test/API/tools/lldb-server/main.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
index 42833a15318f2..bd9c3843ddfe1 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
@@ -8,6 +8,8 @@ class 
GdbRemoteForkTestBase(gdbremote_testcase.GdbRemoteTestCaseBase):
   "{}:p([0-9a-f]+)[.]([0-9a-f]+).*")
 fork_capture = {1: "parent_pid", 2: "parent_tid",
 3: "child_pid", 4: "child_tid"}
+stop_regex_base = "T[0-9a-fA-F]{{2}}thread:p{}.{};.*reason:signal.*"
+stop_regex = "^[$]" + stop_regex_base
 
 def start_fork_test(self, args, variant="fork", nonstop=False):
 self.build()
@@ -149,14 +151,14 @@ def vkill_test(self, kill_parent=False, kill_child=False, 
nonstop=False):
 
 def resume_one_test(self, run_order, use_vCont=False, nonstop=False):
 parent_pid, parent_tid, child_pid, child_tid = (
-self.start_fork_test(["fork", "trap"], nonstop=nonstop))
+self.start_fork_test(["fork", "stop"], nonstop=nonstop))
 
 parent_expect = [
-"T05thread:p{}.{};.*".format(parent_pid, parent_tid),
+self.stop_regex_base.format(parent_pid, parent_tid),
 "W00;process:{}#.*".format(parent_pid),
 ]
 child_expect = [
-"T05thread:p{}.{};.*".format(child_pid, child_tid),
+self.stop_regex_base.format(child_pid, child_tid),
 "W00;process:{}#.*".format(child_pid),
 ]
 

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index 81be3c67399e3..fa5b116438c51 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -154,73 +154,53 @@ def test_vkill_both(self):
 self.vkill_test(kill_parent=True, kill_child=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-
bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_parent(self):
 self.resume_one_test(run_order=["parent", "parent"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-
bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_child(self):
 self.resume_one_test(run_order=["child", "child"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-
bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_parent_then_child(self):
 self.resume_one_test(run_order=["parent", "parent", "child", "child"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-
bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_child_then_parent(self):
 self.resume_one_test(run_order=["child", "child", "parent", "parent"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-
bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_interspersed(self):
 self.resume_one_test(run_order=["parent", "child", "parent", 

[Lldb-commits] [PATCH] D128780: [lldb] [test] Use raise(SIGSTOP) instead of trap in fork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG251165b2e482: [lldb] [test] Use raise(SIGSTOP) instead of 
trap in fork tests (authored by mgorny).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D128780?vs=440852&id=440989#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128780

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
  lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
  lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
  lldb/test/API/tools/lldb-server/main.cpp

Index: lldb/test/API/tools/lldb-server/main.cpp
===
--- lldb/test/API/tools/lldb-server/main.cpp
+++ lldb/test/API/tools/lldb-server/main.cpp
@@ -353,6 +353,10 @@
   printf("%s\n", value ? value : "__unset__");
 } else if (consume_front(arg, "trap")) {
   trap();
+#if !defined(_WIN32)
+} else if (arg == "stop") {
+  raise(SIGSTOP);
+#endif
 } else {
   // Treat the argument as text for stdout.
   printf("%s\n", argv[i]);
Index: lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
===
--- lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -99,16 +99,12 @@
 self.vkill_test(kill_parent=True, kill_child=True, nonstop=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_interspersed_nonstop(self):
 self.resume_one_test(run_order=["parent", "child", "parent", "child"],
  nonstop=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_vCont_interspersed_nonstop(self):
 self.resume_one_test(run_order=["parent", "child", "parent", "child"],
Index: lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
===
--- lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -154,73 +154,53 @@
 self.vkill_test(kill_parent=True, kill_child=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_parent(self):
 self.resume_one_test(run_order=["parent", "parent"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_child(self):
 self.resume_one_test(run_order=["child", "child"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_parent_then_child(self):
 self.resume_one_test(run_order=["parent", "parent", "child", "child"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_child_then_parent(self):
 self.resume_one_test(run_order=["child", "child", "parent", "parent"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_c_interspersed(self):
 self.resume_one_test(run_order=["parent", "child", "parent", "child"])
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_vCont_parent(self):
 self.resume_one_test(run_order=["parent", "parent"], use_vCont=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs=["aarch64"],
-bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
 @add_test_categories(["fork"])
 def test_vCont_child(self):
 self.resume_one_test(run_order=["child", "child"], use_vCont=True)
 
 @expectedFailureAll(archs=["arm"])  # TODO
-@expectedFailureAll(archs

[Lldb-commits] [lldb] e60ed24 - [lldb] [test] Un-XFAIL fork tests on arm as well

2022-06-29 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-06-29T16:05:12+02:00
New Revision: e60ed2401b22074e02779081ca16fa93bd4cf244

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

LOG: [lldb] [test] Un-XFAIL fork tests on arm as well

Sponsored by: The FreeBSD Foundation

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index fa5b116438c5..3b0338075a05 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -153,54 +153,44 @@ def test_vkill_parent(self):
 def test_vkill_both(self):
 self.vkill_test(kill_parent=True, kill_child=True)
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_c_parent(self):
 self.resume_one_test(run_order=["parent", "parent"])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_c_child(self):
 self.resume_one_test(run_order=["child", "child"])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_c_parent_then_child(self):
 self.resume_one_test(run_order=["parent", "parent", "child", "child"])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_c_child_then_parent(self):
 self.resume_one_test(run_order=["child", "child", "parent", "parent"])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_c_interspersed(self):
 self.resume_one_test(run_order=["parent", "child", "parent", "child"])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_vCont_parent(self):
 self.resume_one_test(run_order=["parent", "parent"], use_vCont=True)
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_vCont_child(self):
 self.resume_one_test(run_order=["child", "child"], use_vCont=True)
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_vCont_parent_then_child(self):
 self.resume_one_test(run_order=["parent", "parent", "child", "child"],
  use_vCont=True)
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_vCont_child_then_parent(self):
 self.resume_one_test(run_order=["child", "child", "parent", "parent"],
  use_vCont=True)
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_vCont_interspersed(self):
 self.resume_one_test(run_order=["parent", "child", "parent", "child"],
@@ -241,7 +231,6 @@ def test_vCont_all_processes_implicit(self):
 ], True)
 self.expect_gdbremote_sequence()
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_threadinfo(self):
 parent_pid, parent_tid, child_pid, child_tid = (
@@ -287,7 +276,6 @@ def test_threadinfo(self):
  ], True)
 self.expect_gdbremote_sequence()
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_memory_read_write(self):
 self.build()
@@ -375,7 +363,6 @@ def test_memory_read_write(self):
 self.assertEqual(data, name + "\0")
 self.reset_test_sequence()
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_register_read_write(self):
 parent_pid, parent_tid, child_pid, child_tid = (
@@ -472,7 +459,6 @@ def test_register_read_write(self):
 self.assertIsNotNone(data)
 self.assertEqual(data, old_val[1])
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_qC(self):
 parent_pid, parent_tid, child_pid, child_tid = (
@@ -507,7 +493,6 @@ def test_qC(self):
  ], True)
 self.expect_gdbremote_sequence()
 
-@expectedFailureAll(archs=["arm"])  # TODO
 @add_test_categories(["fork"])
 def test_T(self):
 parent_pid, parent_tid, child_pid, child_tid = (

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
index 38f695956170..5b1a35408d3e 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -98,13 +98,11 @@ def test_kill_all_nonstop(self):
 def test_

[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

The fix looks good but I'm torn about the added logging. On the one hand it'll 
make finding issues like this easier in the future, but on the other hand, 
while this code isn't "hot", it is something where performance matters. My 
concern is that this will potentially cause progress events to get queued. If 
the progress updates aren't real time they are pretty much useless.

If it were up to me I'd probably remove the logging altogether, but maybe 
there's a middle ground where we have one log message that we only print in 
verbose mode? Then the (default) penalty is just checking if the log is enabled 
and verbose.

What do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128768

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


[Lldb-commits] [PATCH] D128541: [WIP][lldb][windows] Handle OutputDebugString from debuggee

2022-06-29 Thread Alvin Wong via Phabricator via lldb-commits
alvinhochun created this revision.
Herald added a project: All.
alvinhochun added reviewers: mstorsjo, DavidSpickett, labath, omjavaid.
alvinhochun added a comment.
alvinhochun updated this revision to Diff 439961.
alvinhochun updated this revision to Diff 441032.
alvinhochun edited the summary of this revision.
alvinhochun published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

WIP. To test this, first compile a test program (not needed if you already have 
programs that does OutputDebugString):

  #include 
  
  int main() {
  OutputDebugStringW(L"Hello debug string");
  return 0;
  }

Debug the program in lldb. Before running the program, you need to run the 
command `log enable windows dbgprint`. When you run the program, you should see 
"DEBUG: Hello debug string" output in lldb.

I think this should be enabled by default, but none of the logging categories 
for `LLDB_LOG` has default active. Is there a better way to do this? The log 
output can also get mixed with command output.


alvinhochun added a comment.

Add size check


mstorsjo added a comment.

For context - does gdb handle this too, and is it printed out to the gdb 
console?

Did you test this both with and without lldb-server? (See `ShouldUseLLDBServer` 
in `ProcessWindows.cpp`.)


alvinhochun added a comment.

In D128541#3611052 , @mstorsjo wrote:

> For context - does gdb handle this too, and is it printed out to the gdb 
> console?

Yes, gdb prints them to the console with a `warning: ` prefix.

> Did you test this both with and without lldb-server? (See 
> `ShouldUseLLDBServer` in `ProcessWindows.cpp`.)

It works without lldb-server. I tested lldb-server just now and found that none 
of the log output is printed -- I tried enabling all windows logging categories 
but got nothing. (I rebased the change onto 
0aa6df65756d3ec7769e55424a41c7074849fe12 
 before 
testing.)


alvinhochun added a comment.

Added test for Windows


This implements handling of OUTPUT_DEBUG_STRING_EVENT which prints the
debug strings using LLDB_LOG (channel "windows", category "dbgprint").

- TODO: see if there is a better way to output the debug strings...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128541

Files:
  lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
  lldb/source/Plugins/Process/Windows/Common/IDebugDelegate.h
  lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.cpp
  lldb/source/Plugins/Process/Windows/Common/LocalDebugDelegate.h
  lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
  lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
  lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.h
  lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
  lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
  lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
  lldb/test/Shell/Process/Windows/outputdebugstring.cpp

Index: lldb/test/Shell/Process/Windows/outputdebugstring.cpp
===
--- /dev/null
+++ lldb/test/Shell/Process/Windows/outputdebugstring.cpp
@@ -0,0 +1,14 @@
+// clang-format off
+
+// REQUIRES: system-windows
+// RUN: %clangxx_host -o %t.exe -lntdll -- %s
+// RUN: %lldb -f %t.exe -o "log enable windows dbgprint" -o "run" | FileCheck %s
+
+// CHECK: DEBUG: Hello debug string
+
+#include 
+
+int main(int argc, char *argv[]) {
+OutputDebugStringW(L"Hello debug string\r\n");
+return 0;
+}
Index: lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
===
--- lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
+++ lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
@@ -23,7 +23,8 @@
   Registers = Log::ChannelFlag<5>,   // Log register operations
   Step = Log::ChannelFlag<6>,// Log step operations
   Thread = Log::ChannelFlag<7>,  // Log thread operations
-  LLVM_MARK_AS_BITMASK_ENUM(Thread)
+  DbgPrint = Log::ChannelFlag<8>,// Log OutputDebugString messages
+  LLVM_MARK_AS_BITMASK_ENUM(DbgPrint)
 };
 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
 
Index: lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
+++ lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
@@ -19,9 +19,11 @@
 {{"registers"}, {"log register read/writes"}, WindowsLog::Registers},
 {{"step"}, {"log step related activities"}, WindowsLog::Step},
 {{"thread"}, {"log thread events and activities"}, WindowsLog::Thread},
+{{"dbgprint"}, {"log OutputDebugString messages"}, WindowsLog::DbgPrint},
 };
 

[Lldb-commits] [lldb] 4a95861 - [lldb] [test] Avoid relying on signos in other fork tests

2022-06-29 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-06-29T17:48:36+02:00
New Revision: 4a95861d7394da7e7f33ff325c3b28159cb6aa77

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

LOG: [lldb] [test] Avoid relying on signos in other fork tests

Sponsored by: The FreeBSD Foundation

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
index bd9c3843ddfe..1a3cc4a0350f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
@@ -2,9 +2,10 @@
 
 
 class GdbRemoteForkTestBase(gdbremote_testcase.GdbRemoteTestCaseBase):
-fork_regex = ("[$]T05thread:p([0-9a-f]+)[.]([0-9a-f]+);.*"
+fork_regex = ("[$]T[0-9a-fA-F]{{2}}thread:p([0-9a-f]+)[.]([0-9a-f]+);.*"
   "{}:p([0-9a-f]+)[.]([0-9a-f]+).*")
-fork_regex_nonstop = ("%Stop:T05thread:p([0-9a-f]+)[.]([0-9a-f]+);.*"
+fork_regex_nonstop = ("%Stop:T[0-9a-fA-F]{{2}}"
+  "thread:p([0-9a-f]+)[.]([0-9a-f]+);.*"
   "{}:p([0-9a-f]+)[.]([0-9a-f]+).*")
 fork_capture = {1: "parent_pid", 2: "parent_tid",
 3: "child_pid", 4: "child_tid"}

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index 3b0338075a05..0c169de3f4d0 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -38,8 +38,8 @@ def test_vfork(self):
 self.test_sequence.add_log_lines([
 "read packet: $c#00",
 {"direction": "send",
- "regex": r"[$]T05thread:p{}[.]{}.*vforkdone.*".format(parent_pid,
-   parent_tid),
+ "regex": r"[$]T[0-9a-fA-F]{{2}}thread:p{}[.]{}.*vforkdone.*"
+  .format(parent_pid, parent_tid),
  },
 "read packet: $c#00",
 "send packet: $W00;process:{}#00".format(parent_pid),

diff  --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
index 5b1a35408d3e..764f238a51ee 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -15,8 +15,8 @@ def test_vfork_nonstop(self):
 "read packet: $c#00",
 "send packet: $OK#00",
 {"direction": "send",
- "regex": r"%Stop:T05thread:p{}[.]{}.*vforkdone.*".format(
- parent_pid, parent_tid),
+ "regex": r"%Stop:T[0-9a-fA-F]{{2}}thread:p{}[.]{}.*vforkdone.*"
+  .format(parent_pid, parent_tid),
  },
 "read packet: $vStopped#00",
 "send packet: $OK#00",



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


[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-29 Thread Emre Kultursay via Phabricator via lldb-commits
emrekultursay created this revision.
Herald added a project: All.
emrekultursay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128832

Files:
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
  lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
  lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -378,15 +378,15 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x0, 0x1}, no, no, no, no, ConstString(),
+  MemoryRegionInfo({0x0, 0x1}, no, no, no, unknown, no, ConstString(),
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
+  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   true));
 }
@@ -412,9 +412,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -428,9 +428,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -460,17 +460,17 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
+  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes, linker,
+  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, no, yes, linker,
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes, liblog,
+  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, no, yes, liblog,
unknown, 0, unknown, unknown)),
   true));
 }
@@ -491,7 +491,7 @@
   EXPECT_THAT(
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(MemoryRegionInfo(

[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: DavidSpickett.
DavidSpickett added inline comments.



Comment at: lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp:278
   check_regions(params);
 }

I don't see a test for a mapping with "s" for the sharing char, did I miss it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128832

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


[Lldb-commits] [PATCH] D127999: [lldb] fix stepping through POSIX trampolines

2022-06-29 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Looks like this broke the windows lldb bot: 
https://lab.llvm.org/buildbot/#/builders/83/builds/20566


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127999

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


[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-29 Thread Emre Kultursay via Phabricator via lldb-commits
emrekultursay updated this revision to Diff 441058.
emrekultursay added a comment.

Added test that covers shared (s) input


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128832

Files:
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
  lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
  lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -378,15 +378,15 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x0, 0x1}, no, no, no, no, ConstString(),
+  MemoryRegionInfo({0x0, 0x1}, no, no, no, unknown, no, ConstString(),
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
+  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   true));
 }
@@ -412,9 +412,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -428,9 +428,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -460,17 +460,17 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
+  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes, linker,
+  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, no, yes, linker,
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes, liblog,
+  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, no, yes, liblog,
unknown, 0, unknown, unknown)),
   true));
 }
@@ -491,7 +491,7 @@
   EXPECT_THAT(
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(MemoryRegio

[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-29 Thread Emre Kultursay via Phabricator via lldb-commits
emrekultursay updated this revision to Diff 441060.
emrekultursay added a comment.

Removed redundant comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128832

Files:
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
  lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
  lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -378,15 +378,15 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x0, 0x1}, no, no, no, no, ConstString(),
+  MemoryRegionInfo({0x0, 0x1}, no, no, no, unknown, no, ConstString(),
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
+  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   true));
 }
@@ -412,9 +412,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -428,9 +428,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -460,17 +460,17 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
+  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes, linker,
+  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, no, yes, linker,
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes, liblog,
+  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, no, yes, liblog,
unknown, 0, unknown, unknown)),
   true));
 }
@@ -491,7 +491,7 @@
   EXPECT_THAT(
   parser->BuildMemoryRegions(),
   testing::Pair(testing::ElementsAre(MemoryRegionInfo(
-  

[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-29 Thread Emre Kultursay via Phabricator via lldb-commits
emrekultursay marked an inline comment as done.
emrekultursay added a comment.

PTAL.




Comment at: lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp:278
   check_regions(params);
 }

DavidSpickett wrote:
> I don't see a test for a mapping with "s" for the sharing char, did I miss it?
I added tests to cover shared (s). Thanks for noticing the missing test.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128832

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


[Lldb-commits] [PATCH] D128775: [trace] Fix errors when handling command arguments

2022-06-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Thanks for doing this.  The test suite was clean after my original changes, 
which means whatever is using CommandObjectMultipleThreads must not have had 
any tests where arguments were passed to it?  Ditto for the trace command.  
Might be good to add those as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128775

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


[Lldb-commits] [PATCH] D128775: [trace] Fix errors when handling command arguments

2022-06-29 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

what happens is that the specific failures are triggered by tests that require 
the cmake flag LIBIPT_INCLUDE_PATH to be configured, but all good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128775

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


[Lldb-commits] [PATCH] D128069: [lldb] add SBSection.alignment to python bindings

2022-06-29 Thread David M. Lary via Phabricator via lldb-commits
dmlary updated this revision to Diff 441073.
dmlary added a comment.

updated to include test cases for `SBSection.GetAlignment()` and 
`SBSection.alignment` property.

@labath Thanks for the yaml2obj pointer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128069

Files:
  lldb/bindings/interface/SBSection.i
  lldb/include/lldb/API/SBSection.h
  lldb/source/API/SBSection.cpp
  lldb/test/API/python_api/section/TestSectionAPI.py
  lldb/test/API/python_api/section/aligned.yml

Index: lldb/test/API/python_api/section/aligned.yml
===
--- /dev/null
+++ lldb/test/API/python_api/section/aligned.yml
@@ -0,0 +1,14 @@
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x0040
+Sections:
+  - Name:.text1
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x0040
+AddressAlign:0x1000
+Size:0xb0
Index: lldb/test/API/python_api/section/TestSectionAPI.py
===
--- lldb/test/API/python_api/section/TestSectionAPI.py
+++ lldb/test/API/python_api/section/TestSectionAPI.py
@@ -39,3 +39,23 @@
 
 self.assertIsNotNone(data_section)
 self.assertEqual(data_section.target_byte_size, 1)
+
+def test_get_alignment(self):
+exe = self.getBuildArtifact("aligned.out")
+self.yaml2obj("aligned.yml", exe)
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# exe contains a single section aligned to 0x1000
+section = target.modules[0].sections[0]
+self.assertEqual(section.GetAlignment(), 0x1000)
+
+def test_alignment_prop(self):
+exe = self.getBuildArtifact("aligned.out")
+self.yaml2obj("aligned.yml", exe)
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# exe contains a single section aligned to 0x1000
+section = target.modules[0].sections[0]
+self.assertEqual(section.alignment, 0x1000)
Index: lldb/source/API/SBSection.cpp
===
--- lldb/source/API/SBSection.cpp
+++ lldb/source/API/SBSection.cpp
@@ -242,6 +242,15 @@
   return 0;
 }
 
+uint32_t SBSection::GetAlignment() {
+  LLDB_INSTRUMENT_VA(this);
+
+  SectionSP section_sp(GetSP());
+  if (section_sp.get())
+return (1 << section_sp->GetLog2Align());
+  return 0;
+}
+
 bool SBSection::operator==(const SBSection &rhs) {
   LLDB_INSTRUMENT_VA(this, rhs);
 
Index: lldb/include/lldb/API/SBSection.h
===
--- lldb/include/lldb/API/SBSection.h
+++ lldb/include/lldb/API/SBSection.h
@@ -76,6 +76,12 @@
   /// The number of host (8-bit) bytes needed to hold a target byte
   uint32_t GetTargetByteSize();
 
+  /// Return the alignment of the section in bytes
+  ///
+  /// \return
+  /// The alignment of the section in bytes
+  uint32_t GetAlignment();
+
   bool operator==(const lldb::SBSection &rhs);
 
   bool operator!=(const lldb::SBSection &rhs);
Index: lldb/bindings/interface/SBSection.i
===
--- lldb/bindings/interface/SBSection.i
+++ lldb/bindings/interface/SBSection.i
@@ -105,6 +105,9 @@
 uint32_t
 GetTargetByteSize ();
 
+uint32_t
+GetAlignment ();
+
 bool
 GetDescription (lldb::SBStream &description);
 
@@ -138,6 +141,7 @@
 data = property(GetSectionData, None, doc='''A read only property that returns an lldb object that represents the bytes for this section (lldb.SBData) for this section.''')
 type = property(GetSectionType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSectionType") that represents the type of this section (code, data, etc.).''')
 target_byte_size = property(GetTargetByteSize, None, doc='''A read only property that returns the size of a target byte represented by this section as a number of host bytes.''')
+alignment = property(GetAlignment, None, doc='''A read only property that returns the alignment of this section as a number of host bytes.''')
 %}
 #endif
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D128768#3619349 , @JDevlieghere 
wrote:

> The fix looks good but I'm torn about the added logging. On the one hand 
> it'll make finding issues like this easier in the future, but on the other 
> hand, while this code isn't "hot", it is something where performance matters. 
> My concern is that this will potentially cause progress events to get queued. 
> If the progress updates aren't real time they are pretty much useless.
>
> If it were up to me I'd probably remove the logging altogether, but maybe 
> there's a middle ground where we have one log message that we only print in 
> verbose mode? Then the (default) penalty is just checking if the log is 
> enabled and verbose.
>
> What do you think?

Sounds good to me


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128768

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


[Lldb-commits] [lldb] 079c8cc - [lldb] Attempt to fix TestStepThroughTrampoline on windows

2022-06-29 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-06-29T19:59:24+02:00
New Revision: 079c8ccb33e8f134e1e6751b2ccf21e1f1c37650

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

LOG: [lldb] Attempt to fix TestStepThroughTrampoline on windows

Added: 


Modified: 
lldb/test/API/lang/cpp/step-through-trampoline/foo.h

Removed: 




diff  --git a/lldb/test/API/lang/cpp/step-through-trampoline/foo.h 
b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
index edfeae5a215f3..4ae6e7c13c4b9 100644
--- a/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
+++ b/lldb/test/API/lang/cpp/step-through-trampoline/foo.h
@@ -1,2 +1,2 @@
-extern void foo();
+LLDB_TEST_API extern void foo();
 



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


[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 441110.
mib added a comment.

Log only when verbose mode is enabled


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

https://reviews.llvm.org/D128768

Files:
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1835,10 +1835,26 @@
   // going to show the progress.
   const uint64_t id = data->GetID();
   if (m_current_event_id) {
+Log *log = GetLog(LLDBLog::Events);
+if (log && log->GetVerbose()) {
+  if (data->IsFinite())
+LLDB_LOGF(log,
+  "%p Debugger('%llu')::HandleProgressEvent "
+  "(m_current_event_id = {%llu}, data = {id = %llu, message = "
+  "%s, completed = %llu, total = %llu})",
+  static_cast(this), m_uid, *m_current_event_id, id,
+  data->GetMessage().data(), data->GetCompleted(),
+  data->GetTotal());
+  else
+LLDB_LOGF(
+log,
+"%p Debugger('%llu')::HandleProgressEvent (m_current_event_id = "
+"{%llu}, data = {id = %llu, message = %s, infinite = true})",
+static_cast(this), m_uid, *m_current_event_id, id,
+data->GetMessage().data());
+}
 if (id != *m_current_event_id)
   return;
-if (data->GetCompleted())
-  m_current_event_id.reset();
   } else {
 m_current_event_id = id;
   }
@@ -1860,8 +1876,9 @@
   // Print over previous line, if any.
   output->Printf("\r");
 
-  if (data->GetCompleted()) {
+  if (data->GetCompleted() == data->GetTotal()) {
 // Clear the current line.
+m_current_event_id.reset();
 output->Printf("\x1B[2K");
 output->Flush();
 return;


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1835,10 +1835,26 @@
   // going to show the progress.
   const uint64_t id = data->GetID();
   if (m_current_event_id) {
+Log *log = GetLog(LLDBLog::Events);
+if (log && log->GetVerbose()) {
+  if (data->IsFinite())
+LLDB_LOGF(log,
+  "%p Debugger('%llu')::HandleProgressEvent "
+  "(m_current_event_id = {%llu}, data = {id = %llu, message = "
+  "%s, completed = %llu, total = %llu})",
+  static_cast(this), m_uid, *m_current_event_id, id,
+  data->GetMessage().data(), data->GetCompleted(),
+  data->GetTotal());
+  else
+LLDB_LOGF(
+log,
+"%p Debugger('%llu')::HandleProgressEvent (m_current_event_id = "
+"{%llu}, data = {id = %llu, message = %s, infinite = true})",
+static_cast(this), m_uid, *m_current_event_id, id,
+data->GetMessage().data());
+}
 if (id != *m_current_event_id)
   return;
-if (data->GetCompleted())
-  m_current_event_id.reset();
   } else {
 m_current_event_id = id;
   }
@@ -1860,8 +1876,9 @@
   // Print over previous line, if any.
   output->Printf("\r");
 
-  if (data->GetCompleted()) {
+  if (data->GetCompleted() == data->GetTotal()) {
 // Clear the current line.
+m_current_event_id.reset();
 output->Printf("\x1B[2K");
 output->Flush();
 return;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f5ba0a3 - Fix inline-record.test for Arm/Windows

2022-06-29 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-06-29T23:21:02+04:00
New Revision: f5ba0a3d059380c62dd06cc8091e6aee53f3401f

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

LOG: Fix inline-record.test for Arm/Windows

This patch fixes inline-record.test to run on multiple platforms
including Arm/Windows. Test is fixed to expect any value for id
fields of functions and blocks returned by 'image lookup' command.
This field can be any value as it is internally generated id.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/Breakpad/inline-record.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/Breakpad/inline-record.test 
b/lldb/test/Shell/SymbolFile/Breakpad/inline-record.test
index ebf777657f883..280fc96130a51 100644
--- a/lldb/test/Shell/SymbolFile/Breakpad/inline-record.test
+++ b/lldb/test/Shell/SymbolFile/Breakpad/inline-record.test
@@ -5,46 +5,46 @@
 # CHECK-LABEL: (lldb) image lookup -a 0x400010 -v
 # CHECK:   Summary: inline-record.out`f1 [inlined] inlined_f1 at a.c:3
 # CHECK-NEXT:   inline-record.out`f1 at a.c:8
-# CHECK:  Function: id = {0x}, name = "f1", range = 
[0x00400010-0x00400020)
-# CHECK-NEXT:   Blocks: id = {0x}, range = [0x00400010-0x00400020)
-# CHECK-NEXT:   id = {0x0010}, ranges = 
[0x00400010-0x00400015)[0x00400017-0x0040001b), name = "inlined_f1"
+# CHECK:  Function: id = {{.*}}, name = "f1", range = 
[0x00400010-0x00400020)
+# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400010-0x00400020)
+# CHECK-NEXT:   id = {{.*}}, ranges = 
[0x00400010-0x00400015)[0x00400017-0x0040001b), name = "inlined_f1"
 
 # CHECK-LABEL: (lldb) image lookup -a 0x400016 -v
 # CHECK:   Summary: inline-record.out`f1 + 6 at a.c:3
 # CHECK-NOT:inline-record.out`f1
-# CHECK:  Function: id = {0x}, name = "f1", range = 
[0x00400010-0x00400020)
-# CHECK-NEXT:   Blocks: id = {0x}, range = [0x00400010-0x00400020)
+# CHECK:  Function: id = {{.*}}, name = "f1", range = 
[0x00400010-0x00400020)
+# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400010-0x00400020)
 
 # CHECK-LABEL: (lldb) image lookup -a 0x400023 -v
 # CHECK:  Summary: inline-record.out`f2 + 3 [inlined] inlined_f2 at b.c:2
 # CHECK-NEXT:  inline-record.out`f2 + 3 [inlined] inlined_f1 at b.c:4
 # CHECK-NEXT:  inline-record.out`f2 + 3 at a.c:3
-# CHECK:  Function: id = {0x0001}, name = "f2", range = 
[0x00400020-0x00400030)
-# CHECK-NEXT:   Blocks: id = {0x0001}, range = [0x00400020-0x00400030)
-# CHECK-NEXT:   id = {0x0043}, range = [0x00400023-0x0040002d), 
name = "inlined_f1"
-# CHECK-NEXT:   id = {0x0057}, range = [0x00400023-0x00400028), 
name = "inlined_f2"
+# CHECK:  Function: id = {{.*}}, name = "f2", range = 
[0x00400020-0x00400030)
+# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400020-0x00400030)
+# CHECK-NEXT:   id = {{.*}}, range = [0x00400023-0x0040002d), name = 
"inlined_f1"
+# CHECK-NEXT:   id = {{.*}}, range = [0x00400023-0x00400028), name = 
"inlined_f2"
 
 # CHECK-LABEL: (lldb) image lookup -a 0x400029 -v
 # CHECK:  Summary: inline-record.out`f2 + 9 [inlined] inlined_f1 + 6 at 
b.c:2
 # CHECK-NEXT:  inline-record.out`f2 + 3 at a.c:3
-# CHECK:  Function: id = {0x0001}, name = "f2", range = 
[0x00400020-0x00400030)
-# CHECK-NEXT:   Blocks: id = {0x0001}, range = [0x00400020-0x00400030)
-# CHECK-NEXT:   id = {0x0043}, range = [0x00400023-0x0040002d), 
name = "inlined_f1"
+# CHECK:  Function: id = {{.*}}, name = "f2", range = 
[0x00400020-0x00400030)
+# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400020-0x00400030)
+# CHECK-NEXT:   id = {{.*}}, range = [0x00400023-0x0040002d), name = 
"inlined_f1"
 
 # CHECK-LABEL: (lldb) image lookup -a 0x400030 -v
 # CHECK:   Summary: inline-record.out`f3 [inlined] inlined_f1 at b.c:3
 # CHECK-NEXT:   inline-record.out`f3 at 3
-# CHECK:  Function: id = {0x0002}, name = "f3", range = 
[0x00400030-0x00400040)
-# CHECK-NEXT:   Blocks: id = {0x0002}, range = [0x00400030-0x00400040)
-# CHECK-NEXT:   id = {0x0085}, range = [0x00400030-0x00400035), 
name = "inlined_f1"
+# CHECK:  Function: id = {{.*}}, name = "f3", range = 
[0x00400030-0x00400040)
+# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400030-0x00400040)
+# CHECK-NEXT:   id = {{.*}}, range = [0x00400030-0x00400035), name = 
"inlined_f1"
 
 
 # CHECK-LABEL: (lldb) image lookup -a 0x400035 -v
 # CHECK:  Summary: inline-record.out`f3 + 5 [inlined]  at b.c:3
 # CHECK-NEXT:  inlin

[Lldb-commits] [lldb] 9c6e043 - [LLDB] Allow API tests to override -gdwarf on Windows

2022-06-29 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-06-29T23:24:18+04:00
New Revision: 9c6e04359282e9051f7b2744b99266ece32db001

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

LOG: [LLDB] Allow API tests to override -gdwarf on Windows

This patch fixes LLDB API tests MakeFile.rules to allow overriding of
debug symbol flags when compiling tests for Windows.
Previously windows tests were forced to emit only dwarf debug symbols
as majority of the tests rely on dwarf debug info. After this patch
any test can override debug symbol flag by setting DEBUG_INFO_FLAG
variable in its make file.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 9023128067f5e..b065a43cb1934 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -212,6 +212,12 @@ ifneq (,$(findstring clang,$(CC)))
MODULE_DEBUG_INFO_FLAGS += -gmodules
 endif
 
+# If the OS is Windows, we need to pass -gdwarf to clang, otherwise it will 
build
+# with codeview by default but all the tests rely on dwarf.
+ifeq "$(OS)" "Windows_NT"
+   DEBUG_INFO_FLAG ?= -gdwarf
+endif
+
 DEBUG_INFO_FLAG ?= -g
 
 CFLAGS ?= $(DEBUG_INFO_FLAG) -O0
@@ -236,12 +242,6 @@ endif
 
 CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS)
 
-# If the OS is Windows, we need to pass -gdwarf to clang, otherwise it will 
build
-# with codeview by default but all the tests rely on dwarf.
-ifeq "$(OS)" "Windows_NT"
-   CFLAGS += -gdwarf
-endif
-
 # Use this one if you want to build one part of the result without debug 
information:
 ifeq "$(OS)" "Darwin"
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) 
$(ARCH_CFLAGS) $(CFLAGS_EXTRAS) -isysroot "$(SDKROOT)"



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


[Lldb-commits] [PATCH] D128849: [lldb] [llgs] Send process output asynchronously in non-stop mode

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste, jingham.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Introduce a new %Stdio notification category and use it to send process
output asynchronously when running in non-stop mode.  This is an LLDB
extension since GDB does not use the 'O' packet for process output,
just for replies to 'qRcmd' packets.

Using the async notification mechanism implies that only the first
output packet is sent immediately to the client.  The client needs
to request subsequent notifications (if any) using the new vStdio packet
(that works pretty much like vStopped for the Stop notification queue).

The packet handler in lldb-server tests is updated to handle the async
stdio packets in addition to the regular O packets.  However, due
to the implications noted above, it can only handle the first output
packet sent by the server.  Subsequent packets need to be explicitly
requested via vStdio.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D128849

Files:
  lldb/include/lldb/Utility/StringExtractorGDBRemote.h
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/source/Utility/StringExtractorGDBRemote.cpp
  lldb/test/API/tools/lldb-server/TestNonStop.py

Index: lldb/test/API/tools/lldb-server/TestNonStop.py
===
--- lldb/test/API/tools/lldb-server/TestNonStop.py
+++ lldb/test/API/tools/lldb-server/TestNonStop.py
@@ -304,3 +304,47 @@
 @add_test_categories(["llgs"])
 def test_vCont_then_partial_stop_run_both(self):
 self.vCont_then_partial_stop_test(True)
+
+@add_test_categories(["llgs"])
+def test_stdio(self):
+self.build()
+self.set_inferior_startup_launch()
+# Since we can't easily ensure that lldb will send output in two parts,
+# just put a stop in the middle.  Since we don't clear vStdio,
+# the second message won't be delivered immediately.
+self.prep_debug_monitor_and_inferior(
+inferior_args=["message 1", "stop", "message 2"])
+self.test_sequence.add_log_lines(
+["read packet: $QNonStop:1#00",
+ "send packet: $OK#00",
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ {"direction": "send", "regex": r"^%Stop:T.*"},
+ "read packet: $vStopped#00",
+ "send packet: $OK#00",
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ "send packet: %Stop:W00#00",
+ ], True)
+ret = self.expect_gdbremote_sequence()
+self.assertIn(ret["O_content"], b"message 1\r\n")
+
+# Now, this is somewhat messy.  expect_gdbremote_sequence() will
+# automatically consume output packets, so we just send vStdio,
+# assume the first reply was consumed, send another one and expect
+# a non-consumable "OK" reply.
+self.reset_test_sequence()
+self.test_sequence.add_log_lines(
+["read packet: $vStdio#00",
+ "read packet: $vStdio#00",
+ "send packet: $OK#00",
+ ], True)
+ret = self.expect_gdbremote_sequence()
+self.assertIn(ret["O_content"], b"message 2\r\n")
+
+self.reset_test_sequence()
+self.test_sequence.add_log_lines(
+["read packet: $vStopped#00",
+ "send packet: $OK#00",
+ ], True)
+self.expect_gdbremote_sequence()
Index: lldb/source/Utility/StringExtractorGDBRemote.cpp
===
--- lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -380,6 +380,8 @@
 return eServerPacketType_vStopped;
   if (PACKET_MATCHES("vCtrlC"))
 return eServerPacketType_vCtrlC;
+  if (PACKET_MATCHES("vStdio"))
+return eServerPacketType_vStdio;
   break;
 
 }
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -109,6 +109,7 @@
   bool m_thread_suffix_supported = false;
   bool m_list_threads_in_stop_reply = false;
   bool m_non_stop = false;
+  std::deque m_stdio_notification_queue;
   std::deque m_stop_notification_queue;
 
   NativeProcessProtocol::Extension m_extensions_supported = {};
@@ -236,6 +237,10 @@
 
   PacketResult Handle_QNonStop(StringExtractorGDBRemote &packet);
 
+  PacketResult HandleNotificationAck(std::deque &queue);
+
+  PacketResult Handle_vStdio(StringEx

[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Core/Debugger.cpp:1839-1855
+if (log && log->GetVerbose()) {
+  if (data->IsFinite())
+LLDB_LOGF(log,
+  "%p Debugger('%llu')::HandleProgressEvent "
+  "(m_current_event_id = {%llu}, data = {id = %llu, message = "
+  "%s, completed = %llu, total = %llu})",
+  static_cast(this), m_uid, *m_current_event_id, id,

What's `m_uid`?

I would either fold these two log statements into one, and use 
`LLDB_LOGV(GetLog(LLDBLog::Events), ...` or I would use the event's dump method:

```
if (log && log->GetVerbose()) {
  StreamString log_stream;
  log_stream << "Debugger::HandleProgressEvent" ... 
  data->dump(log_stream);
  log->PutString(log_stream.GetString());
}
```


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

https://reviews.llvm.org/D128768

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


[Lldb-commits] [lldb] 65a7ebf - [lldb] XFAIL TestVSCode_breakpointEvents.py on Ventura

2022-06-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-06-29T15:00:57-07:00
New Revision: 65a7ebff33428f1b9941e23fd79167d30d642b7b

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

LOG: [lldb] XFAIL TestVSCode_breakpointEvents.py on Ventura

TestVSCode_breakpointEvents.py is failing on macOS Ventura because we
receive 3 breakpoint events instead of one. This is likely the result of
dyld moving into the shared cache.

Added: 


Modified: 

lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
index 483684e562ef7..13c14024a15df 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint-events/TestVSCode_breakpointEvents.py
@@ -16,6 +16,7 @@ class 
TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
 
 @skipIfWindows
 @skipUnlessDarwin
+@expectedFailureAll(macos_version=[">=", "10.16"])
 def test_breakpoint_events(self):
 '''
 This test sets a breakpoint in a shared library and runs and stops



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


[Lldb-commits] [lldb] 3944780 - [lldb] Skip TestAppleSimulatorOSType is simulator isn't available

2022-06-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-06-29T15:10:16-07:00
New Revision: 3944780dd89018e7e12bf45bb835ac7f54c40181

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

LOG: [lldb] Skip TestAppleSimulatorOSType is simulator isn't available

Skip TestAppleSimulatorOSType is simulator isn't available for the given
platform.

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py 
b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
index 149902e3bb5c1..1f3afb1d404ce 100644
--- a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
+++ b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
@@ -46,9 +46,10 @@ def check_simulator_ostype(self, sdk, platform_name, 
arch=platform.machine()):
 # Stop searching in this runtime
 break
 
-# Launch the process using simctl
-self.assertIsNotNone(deviceUDID, 'Could not find a simulator for {} 
({})'.format(platform_name, arch))
+if not deviceUDID:
+self.skipTest('Could not find a simulator for {} 
({})'.format(platform_name, arch))
 
+# Launch the process using simctl
 exe_name = 'test_simulator_platform_{}'.format(platform_name)
 sdkroot = lldbutil.get_xcode_sdk_root(sdk)
 vers = lldbutil.get_xcode_sdk_version(sdk)



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


[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: lldb/source/Core/Debugger.cpp:1839-1855
+if (log && log->GetVerbose()) {
+  if (data->IsFinite())
+LLDB_LOGF(log,
+  "%p Debugger('%llu')::HandleProgressEvent "
+  "(m_current_event_id = {%llu}, data = {id = %llu, message = "
+  "%s, completed = %llu, total = %llu})",
+  static_cast(this), m_uid, *m_current_event_id, id,

JDevlieghere wrote:
> What's `m_uid`?
> 
> I would either fold these two log statements into one, and use 
> `LLDB_LOGV(GetLog(LLDBLog::Events), ...` or I would use the event's dump 
> method:
> 
> ```
> if (log && log->GetVerbose()) {
>   StreamString log_stream;
>   log_stream << "Debugger::HandleProgressEvent" ... 
>   data->dump(log_stream);
>   log->PutString(log_stream.GetString());
> }
> ```
Since some progress events can be broadcasted to a specific debugger instance, 
`m_uid` tells use which debugger id is handling this


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

https://reviews.llvm.org/D128768

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


[Lldb-commits] [PATCH] D128768: [lldb/Core] Fix finite progress event reporting

2022-06-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 441195.
mib marked an inline comment as done.
mib added a comment.

Refactor logging code


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

https://reviews.llvm.org/D128768

Files:
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1835,10 +1835,19 @@
   // going to show the progress.
   const uint64_t id = data->GetID();
   if (m_current_event_id) {
+Log *log = GetLog(LLDBLog::Events);
+if (log && log->GetVerbose()) {
+  StreamString log_stream;
+  log_stream.AsRawOstream()
+  << static_cast(this) << " Debugger(" << GetID()
+  << ")::HandleProgressEvent( m_current_event_id = "
+  << *m_current_event_id << ", data = { ";
+  data->Dump(&log_stream);
+  log_stream << " } )";
+  log->PutString(log_stream.GetString());
+}
 if (id != *m_current_event_id)
   return;
-if (data->GetCompleted())
-  m_current_event_id.reset();
   } else {
 m_current_event_id = id;
   }
@@ -1860,8 +1869,9 @@
   // Print over previous line, if any.
   output->Printf("\r");
 
-  if (data->GetCompleted()) {
+  if (data->GetCompleted() == data->GetTotal()) {
 // Clear the current line.
+m_current_event_id.reset();
 output->Printf("\x1B[2K");
 output->Flush();
 return;


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1835,10 +1835,19 @@
   // going to show the progress.
   const uint64_t id = data->GetID();
   if (m_current_event_id) {
+Log *log = GetLog(LLDBLog::Events);
+if (log && log->GetVerbose()) {
+  StreamString log_stream;
+  log_stream.AsRawOstream()
+  << static_cast(this) << " Debugger(" << GetID()
+  << ")::HandleProgressEvent( m_current_event_id = "
+  << *m_current_event_id << ", data = { ";
+  data->Dump(&log_stream);
+  log_stream << " } )";
+  log->PutString(log_stream.GetString());
+}
 if (id != *m_current_event_id)
   return;
-if (data->GetCompleted())
-  m_current_event_id.reset();
   } else {
 m_current_event_id = id;
   }
@@ -1860,8 +1869,9 @@
   // Print over previous line, if any.
   output->Printf("\r");
 
-  if (data->GetCompleted()) {
+  if (data->GetCompleted() == data->GetTotal()) {
 // Clear the current line.
+m_current_event_id.reset();
 output->Printf("\x1B[2K");
 output->Flush();
 return;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D128638: [lldb] [llgs] Add base nonstop fork/vfork tests

2022-06-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

Not sure if this is related to this patch but `TestGdbRemote_vContThreads.py` 
is still timing out on the macOS bot:

https://green.lab.llvm.org/green/job/lldb-cmake/44958/console


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128638

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


[Lldb-commits] [lldb] dee672e - [lldb] Skip instead of XFAIL TestGdbRemote_vContThreads on Darwin

2022-06-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-06-29T16:34:34-07:00
New Revision: dee672ee8505ccf64f0ca38600ef9efb001cf4d1

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

LOG: [lldb] Skip instead of XFAIL TestGdbRemote_vContThreads on Darwin

The two XFAILed tests started timing out after D126983. Given that they
were XFAILed anyway I didn't investigate and just skipped them.

Added: 


Modified: 
lldb/test/API/tools/lldb-server/vCont-threads/TestGdbRemote_vContThreads.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-server/vCont-threads/TestGdbRemote_vContThreads.py 
b/lldb/test/API/tools/lldb-server/vCont-threads/TestGdbRemote_vContThreads.py
index fd3deecd2fab4..606875ed56213 100644
--- 
a/lldb/test/API/tools/lldb-server/vCont-threads/TestGdbRemote_vContThreads.py
+++ 
b/lldb/test/API/tools/lldb-server/vCont-threads/TestGdbRemote_vContThreads.py
@@ -54,8 +54,8 @@ def get_pid(self):
 return int(procinfo['pid'], 16)
 
 @skipIfWindows
+@skipIfDarwin
 @expectedFailureNetBSD
-@expectedFailureDarwin # No signals delivered
 @expectedFailureAll(oslist=["freebsd"],
 bugnumber="github.com/llvm/llvm-project/issues/56086")
 @skipIfAsan # Times out under asan
@@ -84,10 +84,10 @@ def test_signal_one_thread(self):
 threads[:1])
 
 @skipIfWindows
+@skipIfDarwin
 @expectedFailureNetBSD
 @expectedFailureAll(oslist=["freebsd"],
 bugnumber="github.com/llvm/llvm-project/issues/56086")
-@expectedFailureDarwin # Only one signal delivered
 @skipIfAsan # Times out under asan
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) # Randomly fails on 
buildbot
 def test_signal_all_threads(self):



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


[Lldb-commits] [lldb] 1b8c735 - [lldb] Use assertState in even more tests (NFC)

2022-06-29 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-06-29T17:05:58-07:00
New Revision: 1b8c73522ebf5b937912ef91c297a5b77ddc95ec

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

LOG: [lldb] Use assertState in even more tests (NFC)

Followup to D127355 and D127378, converting more instances of
assertEqual to assertState.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/test/API/android/platform/TestDefaultCacheLineSize.py
lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py

lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py
lldb/test/API/commands/process/handle/TestProcessHandle.py
lldb/test/API/commands/process/launch/TestProcessLaunch.py

lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/list/loop/TestDataFormatterGenericListLoop.py
lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py

lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
lldb/test/API/functionalities/signal/handle-abrt/TestHandleAbort.py
lldb/test/API/functionalities/signal/handle-segv/TestHandleSegv.py
lldb/test/API/functionalities/signal/raise/TestRaise.py
lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
lldb/test/API/functionalities/thread/state/TestThreadStates.py
lldb/test/API/functionalities/thread/thread_exit/TestThreadExit.py
lldb/test/API/functionalities/tty/TestTerminal.py
lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py

lldb/test/API/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py
lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
lldb/test/API/python_api/process/io/TestProcessIO.py
lldb/test/API/python_api/target/TestTargetAPI.py
lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py
lldb/test/API/qemu/TestQemuLaunch.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index e3e81a7f59358..74ca7dd060e3b 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -945,7 +945,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, 
launch_info = None,
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 
-test.assertEqual(process.GetState(), lldb.eStateStopped)
+test.assertState(process.GetState(), lldb.eStateStopped)
 
 # Frame #0 should be at our breakpoint.
 threads = get_threads_stopped_at_breakpoint(

diff  --git a/lldb/test/API/android/platform/TestDefaultCacheLineSize.py 
b/lldb/test/API/android/platform/TestDefaultCacheLineSize.py
index 7e8f88e77c5a8..0a07766640d4c 100644
--- a/lldb/test/API/android/platform/TestDefaultCacheLineSize.py
+++ b/lldb/test/API/android/platform/TestDefaultCacheLineSize.py
@@ -40,4 +40,4 @@ def test_cache_line_size(self):
 
 # Run to completion.
 process.Continue()
-self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

diff  --git a/lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py 
b/lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py
index 7d8da022b75ec..a2164e744537c 100644
--- a/lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py
+++ b/lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py
@@ -24,7 +24,7 @@ def test_false(self):
 extra_options="--skip-prologue 0")
 
 self.runCmd("run")
-self.assertEqual(self.process().GetState(), lldb.eStateExited,
+self.assertState(self.process().GetState(), lldb.eStateExited,
 "Breakpoint does not get hit")
 
 @skipIf(archs=no_match(["arm"]))

diff  --git 
a/lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
 
b/lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
index c318f741e9fbe..a340dcb6920e3 100644
--- 
a/lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
+++ 
b/lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
@@ -29,4 +29,4 @@ def test_breakpoint(self):
   

[Lldb-commits] [lldb] bd2044c - [CodeView] Call llvm::codeview::visitMemberRecordStream with the deserialized CVType whose kind is FieldListRecord.

2022-06-29 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-06-29T17:18:56-07:00
New Revision: bd2044c108655dc6409e2c724349219d3971b151

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

LOG: [CodeView] Call llvm::codeview::visitMemberRecordStream with the 
deserialized CVType whose kind is FieldListRecord.

llvm::codeview::visitMemberRecordStream expects to receive an array ref that's 
FieldListRecord's Data not a CVType's data which has 4 more bytes preceeding. 
The first 2 bytes indicate the size of the FieldListRecord, and following 2 
bytes is always 0x1203. Inside llvm::codeview::visitMemberRecordStream, it 
iterates to the data to check if first two bytes matching some type record 
kinds. If the size coincidentally matches one type kind, it will start parsing 
from there and causing crash.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index daca3988f7646..6dcce738b79f5 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -401,10 +401,13 @@ void PdbAstBuilder::BuildParentMap() {
   }
 };
 
-CVType field_list = m_index.tpi().getType(tag.asTag().FieldList);
+CVType field_list_cvt = m_index.tpi().getType(tag.asTag().FieldList);
 ProcessTpiStream process(m_index, *ti, tag, m_parent_types);
-llvm::Error error = visitMemberRecordStream(field_list.data(), process);
-if (error)
+FieldListRecord field_list;
+if (llvm::Error error = TypeDeserializer::deserializeAs(
+field_list_cvt, field_list))
+  llvm::consumeError(std::move(error));
+if (llvm::Error error = visitMemberRecordStream(field_list.Data, process))
   llvm::consumeError(std::move(error));
   }
 
@@ -757,22 +760,26 @@ bool PdbAstBuilder::CompleteTagDecl(clang::TagDecl &tag) {
   CVType field_list_cvt = m_index.tpi().getType(field_list_ti);
   if (field_list_cvt.kind() != LF_FIELDLIST)
 return false;
+  FieldListRecord field_list;
+  if (llvm::Error error = TypeDeserializer::deserializeAs(
+  field_list_cvt, field_list))
+llvm::consumeError(std::move(error));
 
   // Visit all members of this class, then perform any finalization necessary
   // to complete the class.
   CompilerType ct = ToCompilerType(tag_qt);
   UdtRecordCompleter completer(best_ti, ct, tag, *this, m_index,
m_cxx_record_map);
-  auto error =
-  llvm::codeview::visitMemberRecordStream(field_list_cvt.data(), 
completer);
+  llvm::Error error =
+  llvm::codeview::visitMemberRecordStream(field_list.Data, completer);
   completer.complete();
 
   status.resolved = true;
-  if (!error)
-return true;
-
-  llvm::consumeError(std::move(error));
-  return false;
+  if (error) {
+llvm::consumeError(std::move(error));
+return false;
+  }
+  return true;
 }
 
 clang::QualType PdbAstBuilder::CreateSimpleType(TypeIndex ti) {
@@ -1118,10 +1125,14 @@ PdbAstBuilder::CreateFunctionDecl(PdbCompilandSymId 
func_id,
   }
 }
 if (!tag_record.FieldList.isSimple()) {
-  CVType field_list = m_index.tpi().getType(tag_record.FieldList);
+  CVType field_list_cvt = m_index.tpi().getType(tag_record.FieldList);
+  FieldListRecord field_list;
+  if (llvm::Error error = TypeDeserializer::deserializeAs(
+  field_list_cvt, field_list))
+llvm::consumeError(std::move(error));
   CreateMethodDecl process(m_index, m_clang, func_ti, function_decl,
parent_opaque_ty, func_name, func_ct);
-  if (llvm::Error err = visitMemberRecordStream(field_list.data(), 
process))
+  if (llvm::Error err = visitMemberRecordStream(field_list.Data, process))
 llvm::consumeError(std::move(err));
 }
 

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
index 10e8cbd11482d..ee1de24383d6a 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
@@ -733,9 +733,14 @@ VariableInfo lldb_private::npdb::GetVariableLocationInfo(
 }
 if (IsTagRecord(class_cvt)) {
   TagRecord tag_record = CVTagRecord::create(class_cvt).asTag();
-  CVType field_list = index.tpi().getType(tag_record.FieldList);
+  CVType field_list_cvt = index.tpi().getType(tag_record.FieldList);
+  FieldListRecord field_list;
+  if (llvm::Error error =

[Lldb-commits] [PATCH] D128776: Handle a stop when another thread has hit a breakpoint with a failed condition

2022-06-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham updated this revision to Diff 441217.
jingham added a comment.

Use sleep_for instead of usleep.  Man, that API isn't winning any beauty 
contests!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128776

Files:
  lldb/source/Target/StopInfo.cpp
  lldb/test/API/functionalities/breakpoint/two_hits_one_actual/Makefile
  
lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
  lldb/test/API/functionalities/breakpoint/two_hits_one_actual/main.cpp

Index: lldb/test/API/functionalities/breakpoint/two_hits_one_actual/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/two_hits_one_actual/main.cpp
@@ -0,0 +1,22 @@
+#include 
+#include 
+
+void usleep_helper(unsigned int usec) {
+  // Break here in the helper
+  std::this_thread::sleep_for(std::chrono::duration(usec));
+}
+
+void *background_thread(void *arg) {
+(void) arg;
+for (;;) {
+usleep_helper(2);
+}
+}
+
+int main(void) {
+  unsigned int main_usec = 1;
+  std::thread main_thread(background_thread, nullptr); // Set bkpt here to get started
+  for (;;) {
+usleep_helper(main_usec);
+  }
+}
Index: lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py
@@ -0,0 +1,62 @@
+"""
+Test that if we hit a breakpoint on two threads at the 
+same time, one of which passes the condition, one not,
+we only have a breakpoint stop reason for the one that
+passed the condition.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class TestTwoHitsOneActual(TestBase):
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_two_hits_one_actual(self):
+"""There can be many tests in a test case - describe this test here."""
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.cpp")
+self.sample_test()
+
+def sample_test(self):
+"""You might use the test implementation in several ways, say so here."""
+
+(target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(self,
+   "Set bkpt here to get started", self.main_source_file)
+# This is working around a separate bug.  If you hit a breakpoint and
+# run an expression and it is the first expression you've ever run, on
+# Darwin that will involve running the ObjC runtime parsing code, and we'll
+# be in the middle of that when we do PerformAction on the other thread,
+# which will cause the condition expression to fail.  Calling another
+# expression first works around this.
+val_obj = main_thread.frame[0].EvaluateExpression("main_usec==1")
+self.assertSuccess(val_obj.GetError(), "Ran our expression successfully")
+self.assertEqual(val_obj.value, "true", "Value was true.")
+# Set two breakpoints just to test the multiple location logic:
+bkpt1 = target.BreakpointCreateBySourceRegex("Break here in the helper", self.main_source_file);
+bkpt2 = target.BreakpointCreateBySourceRegex("Break here in the helper", self.main_source_file);
+
+# This one will never be hit:
+bkpt1.SetCondition("usec == 100")
+# This one will only be hit on the main thread:
+bkpt2.SetCondition("usec == 1")
+
+# This is hard to test definitively, becuase it requires hitting
+# a breakpoint on multiple threads at the same time.  On Darwin, this
+# will happen pretty much ever time we continue.  What we are really
+# asserting is that we only ever stop on one thread, so we approximate that
+# by continuing 20 times and assert we only ever hit the first thread.  Either
+# this is a platform that only reports one hit at a time, in which case all
+# this code is unused, or we actually didn't hit the other thread.
+
+for idx in range(0, 20):
+process.Continue()
+for thread in process.threads:
+if thread.id == main_thread.id:
+self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint)
+else:
+self.assertEqual(thread.stop_reason, lldb.eStopReasonNone)
+
+
Index: lldb/test/API/functionalities/breakpoint/two_hits_one_actual/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/breakpoint/two_hits_one_actual/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: lldb/source/Target/StopInfo.cpp
===
--- lldb/source/Target/StopInfo.cpp
+++ 

[Lldb-commits] [PATCH] D128477: [trace] Add a flag to the decoder to output the instruction type

2022-06-29 Thread Sujin Park via Phabricator via lldb-commits
persona0220 updated this revision to Diff 441226.
persona0220 marked 26 inline comments as done.
persona0220 added a comment.

- Modify function name `instruction_decode` into `DecodeInstructionOpcode`
- explicit naming for flag `show_kind` -> `show_control_flow_kind`
- Convert `InstructionControlFlowType` FLAG_ENUM into simple enum
- Create x86 namespace in `Disassembler.cpp` to decode instruction.


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

https://reviews.llvm.org/D128477

Files:
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Target/TraceDumper.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBInstruction.cpp
  lldb/source/API/SBInstructionList.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/source/Target/TraceDumper.cpp

Index: lldb/source/Target/TraceDumper.cpp
===
--- lldb/source/Target/TraceDumper.cpp
+++ lldb/source/Target/TraceDumper.cpp
@@ -147,14 +147,14 @@
   m_s.Format("{0:x+16}", item.load_address);
   if (item.symbol_info) {
 m_s << "";
-item.symbol_info->instruction->Dump(&m_s, /*max_opcode_byte_size=*/0,
-/*show_address=*/false,
-/*show_bytes=*/false,
-&item.symbol_info->exe_ctx,
-&item.symbol_info->sc,
-/*prev_sym_ctx=*/nullptr,
-/*disassembly_addr_format=*/nullptr,
-/*max_address_text_size=*/0);
+item.symbol_info->instruction->Dump(
+&m_s, /*max_opcode_byte_size=*/0,
+/*show_address=*/false,
+/*show_bytes=*/false, m_options.show_control_flow_kind,
+&item.symbol_info->exe_ctx, &item.symbol_info->sc,
+/*prev_sym_ctx=*/nullptr,
+/*disassembly_addr_format=*/nullptr,
+/*max_address_text_size=*/0);
   }
 }
 
Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -170,13 +170,14 @@
   if (instruction_list.GetSize()) {
 const bool show_bytes = true;
 const bool show_address = true;
+const bool show_control_flow_kind = true;
 Instruction *instruction =
 instruction_list.GetInstructionAtIndex(0).get();
 const FormatEntity::Entry *disassemble_format =
 m_process.GetTarget().GetDebugger().GetDisassemblyFormat();
 instruction->Dump(stream, max_opcode_byte_size, show_address,
-  show_bytes, nullptr, nullptr, nullptr,
-  disassemble_format, 0);
+  show_bytes, show_control_flow_kind, nullptr, nullptr,
+  nullptr, disassemble_format, 0);
   }
 }
   }
Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -558,8 +558,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -440,8 +440,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
=

[Lldb-commits] [PATCH] D128477: [trace] Add a flag to the decoder to output the instruction type

2022-06-29 Thread Sujin Park via Phabricator via lldb-commits
persona0220 updated this revision to Diff 441229.

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

https://reviews.llvm.org/D128477

Files:
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Target/TraceDumper.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBInstruction.cpp
  lldb/source/API/SBInstructionList.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/source/Target/TraceDumper.cpp

Index: lldb/source/Target/TraceDumper.cpp
===
--- lldb/source/Target/TraceDumper.cpp
+++ lldb/source/Target/TraceDumper.cpp
@@ -147,14 +147,14 @@
   m_s.Format("{0:x+16}", item.load_address);
   if (item.symbol_info) {
 m_s << "";
-item.symbol_info->instruction->Dump(&m_s, /*max_opcode_byte_size=*/0,
-/*show_address=*/false,
-/*show_bytes=*/false,
-&item.symbol_info->exe_ctx,
-&item.symbol_info->sc,
-/*prev_sym_ctx=*/nullptr,
-/*disassembly_addr_format=*/nullptr,
-/*max_address_text_size=*/0);
+item.symbol_info->instruction->Dump(
+&m_s, /*max_opcode_byte_size=*/0,
+/*show_address=*/false,
+/*show_bytes=*/false, m_options.show_control_flow_kind,
+&item.symbol_info->exe_ctx, &item.symbol_info->sc,
+/*prev_sym_ctx=*/nullptr,
+/*disassembly_addr_format=*/nullptr,
+/*max_address_text_size=*/0);
   }
 }
 
Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -170,13 +170,14 @@
   if (instruction_list.GetSize()) {
 const bool show_bytes = true;
 const bool show_address = true;
+const bool show_control_flow_kind = true;
 Instruction *instruction =
 instruction_list.GetInstructionAtIndex(0).get();
 const FormatEntity::Entry *disassemble_format =
 m_process.GetTarget().GetDebugger().GetDisassemblyFormat();
 instruction->Dump(stream, max_opcode_byte_size, show_address,
-  show_bytes, nullptr, nullptr, nullptr,
-  disassemble_format, 0);
+  show_bytes, show_control_flow_kind, nullptr, nullptr,
+  nullptr, disassemble_format, 0);
   }
 }
   }
Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -558,8 +558,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -440,8 +440,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
===
--- lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -83,6 +83,7 @@
   const uint32_t addr_byte_size = m_arch.GetAddressByteSize();
   const bool show_address = true;
   const boo

[Lldb-commits] [PATCH] D128477: [trace] Add a flag to the decoder to output the instruction type

2022-06-29 Thread Sujin Park via Phabricator via lldb-commits
persona0220 updated this revision to Diff 441230.
persona0220 added a comment.

nit


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

https://reviews.llvm.org/D128477

Files:
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Target/TraceDumper.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBInstruction.cpp
  lldb/source/API/SBInstructionList.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/source/Target/TraceDumper.cpp

Index: lldb/source/Target/TraceDumper.cpp
===
--- lldb/source/Target/TraceDumper.cpp
+++ lldb/source/Target/TraceDumper.cpp
@@ -147,14 +147,14 @@
   m_s.Format("{0:x+16}", item.load_address);
   if (item.symbol_info) {
 m_s << "";
-item.symbol_info->instruction->Dump(&m_s, /*max_opcode_byte_size=*/0,
-/*show_address=*/false,
-/*show_bytes=*/false,
-&item.symbol_info->exe_ctx,
-&item.symbol_info->sc,
-/*prev_sym_ctx=*/nullptr,
-/*disassembly_addr_format=*/nullptr,
-/*max_address_text_size=*/0);
+item.symbol_info->instruction->Dump(
+&m_s, /*max_opcode_byte_size=*/0,
+/*show_address=*/false,
+/*show_bytes=*/false, m_options.show_control_flow_kind,
+&item.symbol_info->exe_ctx, &item.symbol_info->sc,
+/*prev_sym_ctx=*/nullptr,
+/*disassembly_addr_format=*/nullptr,
+/*max_address_text_size=*/0);
   }
 }
 
Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -170,13 +170,14 @@
   if (instruction_list.GetSize()) {
 const bool show_bytes = true;
 const bool show_address = true;
+const bool show_control_flow_kind = true;
 Instruction *instruction =
 instruction_list.GetInstructionAtIndex(0).get();
 const FormatEntity::Entry *disassemble_format =
 m_process.GetTarget().GetDebugger().GetDisassemblyFormat();
 instruction->Dump(stream, max_opcode_byte_size, show_address,
-  show_bytes, nullptr, nullptr, nullptr,
-  disassemble_format, 0);
+  show_bytes, show_control_flow_kind, nullptr, nullptr,
+  nullptr, disassemble_format, 0);
   }
 }
   }
Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -558,8 +558,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -440,8 +440,9 @@
   if (disassembler_sp) {
 const bool show_address = true;
 const bool show_bytes = false;
-disassembler_sp->GetInstructionList().Dump(&strm, show_address, show_bytes,
-   &exe_ctx);
+const bool show_control_flow_kind = false;
+disassembler_sp->GetInstructionList().Dump(
+&strm, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
 return true;
   }
   return false;
Index: lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
===
--- lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -83,6 +83,7 @@
   const uint32_t addr_byte_size = m_arch.GetAddressByteSize();
   const bool sh

[Lldb-commits] [PATCH] D128694: [lldb/Dataformatters] Adapt C++ std::string dataformatter for D128285

2022-06-29 Thread Brooks Moses via Phabricator via lldb-commits
brooksmoses added a comment.

We're seeing a number of LLDB test failures from this change.  If I'm 
understanding correctly, that's working by design because we're building the 
test code with a version of LLVM that's from a revision that's not quite as 
recent as the LLDB code we're testing.

This seems like a substantial problem.  If I release this LLDB as my company's 
internal build, and one of my users wants to debug a failing application that 
happens to have been built before the corresponding internal LLVM release -- or 
they happen to build their application on a release branch pinned to an older 
LLVM build -- they won't have a working string data-formatter, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128694

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


[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread Kevin Cadieux via Phabricator via lldb-commits
kevcadieux created this revision.
Herald added a project: All.
kevcadieux requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

A warning was recently introduced in D128576  
due to now unused lambda `function_name_from_load_address`. This warning causes 
build failures when treating warnings as errors. This change expands the 
comment to also include the definition of this lambda, fixing the warning.

Error:

  [3809/6000] Building CXX object 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
  FAILED: 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
  /usr/bin/clang++ -DHAVE_ROUND -DLLDB_CONFIGURATION_DEBUG -D_DEBUG 
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
-D__STDC_LIMIT_MACROS 
-I/__w/1/b/llvm/Debug/tools/lldb/source/Plugins/TraceExporter/common 
-I/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common 
-I/__w/1/llvm-project/lldb/include -I/__w/1/b/llvm/Debug/tools/lldb/include 
-I/__w/1/b/llvm/Debug/include -I/__w/1/llvm-project/llvm/include 
-I/__w/1/llvm-project/llvm/../clang/include 
-I/__w/1/b/llvm/Debug/tools/lldb/../clang/include 
-I/__w/1/llvm-project/lldb/source -I/__w/1/b/llvm/Debug/tools/lldb/source 
-isystem /usr/include/libxml2 -fPIC -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -fdiagnostics-color -Wno-deprecated-declarations 
-Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register 
-Wno-vla-extension -g  -fno-exceptions -gsplit-dwarf -std=c++14 -MD -MT 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
 -MF 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o.d
 -o 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
 -c /__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  
/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp:136:8:
 error: unused variable 'function_name_from_load_address' 
[-Werror,-Wunused-variable]
auto function_name_from_load_address =


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128874

Files:
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@
   cursor.SetForwards(true);
   cursor.Seek(0, TraceCursor::SeekType::Beginning);
 
+  // TODO: fix after persona0220's patch on a new way to access instruction
+  // kinds
+  /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
   [&](lldb::addr_t load_address) -> llvm::Optional {
@@ -146,8 +149,7 @@
   return llvm::None;
   };
 
-  /* TODO: fix after persona0220's patch on a new way to access instruction
-  kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+  while (cursor.HasValue()) { if (cursor.IsError()) {
   // Append a load address of 0 for all instructions that an error occured
   // while decoding.
   // TODO: Make distinction between errors by storing the error messages.


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@
   cursor.SetForwards(true);
   cursor.Seek(0, TraceCursor::SeekType::Beginning);
 
+  // TODO: fix after persona0220's patch on a new way to access instruction
+  // kinds
+  /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
   [&](lldb::addr_t load_address) -> llvm::Optional {
@@ -146,8 +149,7 @@
   return llvm::None;
   };
 
-  /* TODO: fix after persona0220's patch on a new way to access instruction
-  kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+  while (cursor.HasValue()) { if (cursor.IsError()) {
   // Append a load address of 0 for all instructions that an error occured
   // while decoding.
   // TODO: Make distinction between errors by storing the error messages.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128874

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


[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread Kevin Cadieux via Phabricator via lldb-commits
kevcadieux added a comment.

In D128874#3621115 , @wallace wrote:

> thanks!

You're welcome! Do you happen to have commit privileges to complete this patch? 
If not, no worries, I can find someone else tomorrow.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128874

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


[Lldb-commits] [PATCH] D128638: [lldb] [llgs] Add base nonstop fork/vfork tests

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D128638#3620751 , @mib wrote:

> Not sure if this is related to this patch but `TestGdbRemote_vContThreads.py` 
> is still timing out on the macOS bot:
>
> https://green.lab.llvm.org/green/job/lldb-cmake/44958/console

I see Jonas has already marked them "skip". Since I don't really have an 
environment to investigate this, I suppose this is as far as it gets.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128638

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


[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

i can do it right now


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128874

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


[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa3ec54c66075: [lldb] Fix unused variable warning in TraceHTR 
(NFC) (authored by kevcadieux, committed by Walter Erquinigo 
).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128874

Files:
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@
   cursor.SetForwards(true);
   cursor.Seek(0, TraceCursor::SeekType::Beginning);
 
+  // TODO: fix after persona0220's patch on a new way to access instruction
+  // kinds
+  /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
   [&](lldb::addr_t load_address) -> llvm::Optional {
@@ -146,8 +149,7 @@
   return llvm::None;
   };
 
-  /* TODO: fix after persona0220's patch on a new way to access instruction
-  kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+  while (cursor.HasValue()) { if (cursor.IsError()) {
   // Append a load address of 0 for all instructions that an error occured
   // while decoding.
   // TODO: Make distinction between errors by storing the error messages.


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@
   cursor.SetForwards(true);
   cursor.Seek(0, TraceCursor::SeekType::Beginning);
 
+  // TODO: fix after persona0220's patch on a new way to access instruction
+  // kinds
+  /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
   [&](lldb::addr_t load_address) -> llvm::Optional {
@@ -146,8 +149,7 @@
   return llvm::None;
   };
 
-  /* TODO: fix after persona0220's patch on a new way to access instruction
-  kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+  while (cursor.HasValue()) { if (cursor.IsError()) {
   // Append a load address of 0 for all instructions that an error occured
   // while decoding.
   // TODO: Make distinction between errors by storing the error messages.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a3ec54c - [lldb] Fix unused variable warning in TraceHTR (NFC)

2022-06-29 Thread Walter Erquinigo via lldb-commits

Author: Kevin Cadieux
Date: 2022-06-29T21:29:50-07:00
New Revision: a3ec54c660755f9aae5eeb10e662e79f98437670

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

LOG: [lldb] Fix unused variable warning in TraceHTR (NFC)

A warning was recently introduced in 
[D128576](https://reviews.llvm.org/D128576) due to now unused lambda 
`function_name_from_load_address`. This warning causes build failures when 
treating warnings as errors. This change expands the comment to also include 
the definition of this lambda, fixing the warning.

Error:
```
[3809/6000] Building CXX object 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
FAILED: 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
/usr/bin/clang++ -DHAVE_ROUND -DLLDB_CONFIGURATION_DEBUG -D_DEBUG -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/__w/1/b/llvm/Debug/tools/lldb/source/Plugins/TraceExporter/common 
-I/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common 
-I/__w/1/llvm-project/lldb/include -I/__w/1/b/llvm/Debug/tools/lldb/include 
-I/__w/1/b/llvm/Debug/include -I/__w/1/llvm-project/llvm/include 
-I/__w/1/llvm-project/llvm/../clang/include 
-I/__w/1/b/llvm/Debug/tools/lldb/../clang/include 
-I/__w/1/llvm-project/lldb/source -I/__w/1/b/llvm/Debug/tools/lldb/source 
-isystem /usr/include/libxml2 -fPIC -fvisibility-inlines-hidden -Werror 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -fdiagnostics-color -Wno-deprecated-declarations 
-Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register 
-Wno-vla-extension -g  -fno-exceptions -gsplit-dwarf -std=c++14 -MD -MT 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
 -MF 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o.d
 -o 
tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
 -c /__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp:136:8:
 error: unused variable 'function_name_from_load_address' 
[-Werror,-Wunused-variable]
  auto function_name_from_load_address =
```

Reviewed By: wallace

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

Added: 


Modified: 
lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp 
b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
index 9225ba44a1463..7deeaf2bf10f9 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@ TraceHTR::TraceHTR(Thread &thread, TraceCursor &cursor)
   cursor.SetForwards(true);
   cursor.Seek(0, TraceCursor::SeekType::Beginning);
 
+  // TODO: fix after persona0220's patch on a new way to access instruction
+  // kinds
+  /*
   Target &target = thread.GetProcess()->GetTarget();
   auto function_name_from_load_address =
   [&](lldb::addr_t load_address) -> llvm::Optional {
@@ -146,8 +149,7 @@ TraceHTR::TraceHTR(Thread &thread, TraceCursor &cursor)
   return llvm::None;
   };
 
-  /* TODO: fix after persona0220's patch on a new way to access instruction
-  kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+  while (cursor.HasValue()) { if (cursor.IsError()) {
   // Append a load address of 0 for all instructions that an error occured
   // while decoding.
   // TODO: Make distinction between errors by storing the error messages.



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


[Lldb-commits] [lldb] 67854f9 - Use value_or instead of getValueOr. NFC

2022-06-29 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-06-29T21:55:02-07:00
New Revision: 67854f9ed0cd512f59736730f4c05de25501ae54

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

LOG: Use value_or instead of getValueOr. NFC

Added: 


Modified: 
clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
clang-tools-extra/clangd/xpc/XPCTransport.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
llvm/lib/Support/Windows/Threading.inc
llvm/unittests/Support/UnicodeTest.cpp
mlir/lib/TableGen/AttrOrTypeDef.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp 
b/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
index 1f554806def08..8d2bc4d15d7b9 100644
--- a/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
@@ -42,7 +42,7 @@ class TestCache : public FileCache {
 FS, FreshTime,
 [&](llvm::Optional Data) {
   GotParse = true;
-  Value = Data.getValueOr("").str();
+  Value = Data.value_or("").str();
 },
 [&]() {
   GotRead = true;

diff  --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp 
b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
index 4c6308b3acae7..9c43647c3c767 100644
--- a/clang-tools-extra/clangd/xpc/XPCTransport.cpp
+++ b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
@@ -38,7 +38,7 @@ json::Object encodeError(Error E) {
 
 Error decodeError(const json::Object &O) {
   std::string Msg =
-  std::string(O.getString("message").getValueOr("Unspecified error"));
+  std::string(O.getString("message").value_or("Unspecified error"));
   if (auto Code = O.getInteger("code"))
 return make_error(std::move(Msg), ErrorCode(*Code));
   return error("{0}", Msg);

diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp 
b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index 3620be6f274d9..a9c7af145338e 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -154,7 +154,7 @@ bool ABISysV_arc::IsRegisterFileReduced(RegisterContext 
®_ctx) const {
 m_is_reg_file_reduced = (reg_value | rf_entries_bit) != 0;
   }
 
-  return m_is_reg_file_reduced.getValueOr(false);
+  return m_is_reg_file_reduced.value_or(false);
 }
 
 //--
@@ -458,7 +458,7 @@ ABISysV_arc::GetReturnValueObjectSimple(Thread &thread,
   const uint32_t type_flags = compiler_type.GetTypeInfo();
   // Integer return type.
   if (type_flags & eTypeIsInteger) {
-const size_t byte_size = compiler_type.GetByteSize(&thread).getValueOr(0);
+const size_t byte_size = compiler_type.GetByteSize(&thread).value_or(0);
 auto raw_value = ReadRawValue(reg_ctx, byte_size);
 
 const bool is_signed = (type_flags & eTypeIsSigned) != 0;
@@ -482,7 +482,7 @@ ABISysV_arc::GetReturnValueObjectSimple(Thread &thread,
 
 if (compiler_type.IsFloatingPointType(float_count, is_complex) &&
 1 == float_count && !is_complex) {
-  const size_t byte_size = 
compiler_type.GetByteSize(&thread).getValueOr(0);
+  const size_t byte_size = compiler_type.GetByteSize(&thread).value_or(0);
   auto raw_value = ReadRawValue(reg_ctx, byte_size);
 
   if (!SetSizedFloat(value.GetScalar(), raw_value, byte_size))

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 7962302aeb327..3715e46c659cf 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -92,7 +92,7 @@ Expected
 TraceIntelPTBundleLoader::ParseProcess(const JSONProcess &process) {
   TargetSP target_sp;
   Status error = m_debugger.GetTargetList().CreateTarget(
-  m_debugger, /*user_exe_path*/ StringRef(), process.triple.getValueOr(""),
+  m_debugger, /*user_exe_path*/ StringRef(), process.triple.value_or(""),
   eLoadDependentsNo,
   /*platform_options*/ nullptr, target_sp);
 

diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 5e5ca96aeb552..93b07fc0db302 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3144,11 +3144,10 @@ Error BitcodeReader::parseConstants() {
 return error("Explicit gep operator type does not match pointee type "
  "of pointer operand");
 
-  V = BitcodeConstant::create(
-  Alloc, CurTy,
-  {Instruction::Ge

[Lldb-commits] [PATCH] D128878: [lldb] [llgs] Remove not-really-used m_inferior_prev_state

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste, jingham.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Remove m_inferior_prev_state that's not suitable for multiprocess
debugging and that does not seem to be really used at all.

The only use of the variable right now is to "prevent" sending the stop
reason after attach/launch.  However, this code is never actually run
since none of the process plugins actually use eStateLaunching or
eStateAttaching.  Through adding an assert, I've confirmed that it's
never hit in any of the LLDB tests or while attaching/launching debugged
process via lldb-server and via lldb CLI.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D128878

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h


Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -101,7 +101,6 @@
   Communication m_stdio_communication;
   MainLoop::ReadHandleUP m_stdio_handle_up;
 
-  lldb::StateType m_inferior_prev_state = lldb::StateType::eStateInvalid;
   llvm::StringMap> m_xfer_buffer_map;
   std::mutex m_saved_registers_mutex;
   std::unordered_map m_saved_registers_map;
Index: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1074,23 +1074,13 @@
   Log *log = GetLog(LLDBLog::Process);
   LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
-  // Send the stop reason unless this is the stop after the launch or attach.
-  switch (m_inferior_prev_state) {
-  case eStateLaunching:
-  case eStateAttaching:
-// Don't send anything per debugserver behavior.
-break;
-  default:
-// In all other cases, send the stop reason.
-PacketResult result = SendStopReasonForState(
-*process, StateType::eStateStopped, /*force_synchronous=*/false);
-if (result != PacketResult::Success) {
-  LLDB_LOGF(log,
-"GDBRemoteCommunicationServerLLGS::%s failed to send stop "
-"notification for PID %" PRIu64 ", state: eStateExited",
-__FUNCTION__, process->GetID());
-}
-break;
+  PacketResult result = SendStopReasonForState(
+  *process, StateType::eStateStopped, /*force_synchronous=*/false);
+  if (result != PacketResult::Success) {
+LLDB_LOGF(log,
+  "GDBRemoteCommunicationServerLLGS::%s failed to send stop "
+  "notification for PID %" PRIu64 ", state: eStateExited",
+  __FUNCTION__, process->GetID());
   }
 }
 
@@ -1135,9 +1125,6 @@
 }
 break;
   }
-
-  // Remember the previous state reported to us.
-  m_inferior_prev_state = state;
 }
 
 void GDBRemoteCommunicationServerLLGS::DidExec(NativeProcessProtocol *process) 
{


Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -101,7 +101,6 @@
   Communication m_stdio_communication;
   MainLoop::ReadHandleUP m_stdio_handle_up;
 
-  lldb::StateType m_inferior_prev_state = lldb::StateType::eStateInvalid;
   llvm::StringMap> m_xfer_buffer_map;
   std::mutex m_saved_registers_mutex;
   std::unordered_map m_saved_registers_map;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1074,23 +1074,13 @@
   Log *log = GetLog(LLDBLog::Process);
   LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
-  // Send the stop reason unless this is the stop after the launch or attach.
-  switch (m_inferior_prev_state) {
-  case eStateLaunching:
-  case eStateAttaching:
-// Don't send anything per debugserver behavior.
-break;
-  default:
-// In all other cases, send the stop reason.
-PacketResult result = SendStopReasonForState(
-*process, StateType::eStateStopped, /*force_synchronous=*/false);
-if (result != PacketResult::Success) {
-  LLDB_LOGF(log,
-"GDBRemoteCommunicationServerLLGS::%s failed to send stop "
-"notificat

[Lldb-commits] [PATCH] D128879: [lldb] [llgs] Fix `?` packet response for running threads

2022-06-29 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste, jingham.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Fix the response to `?` packet for threads that are running at the time
(in non-stop mode).  The previous code would wrongly send or queue
an empty response for them.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D128879

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/test/API/tools/lldb-server/TestNonStop.py


Index: lldb/test/API/tools/lldb-server/TestNonStop.py
===
--- lldb/test/API/tools/lldb-server/TestNonStop.py
+++ lldb/test/API/tools/lldb-server/TestNonStop.py
@@ -348,3 +348,23 @@
  "send packet: $OK#00",
  ], True)
 self.expect_gdbremote_sequence()
+
+@add_test_categories(["llgs"])
+def test_stop_reason_while_running(self):
+self.build()
+self.set_inferior_startup_launch()
+procs = self.prep_debug_monitor_and_inferior(
+inferior_args=["thread:new", "thread:new", "stop", "sleep:15"])
+self.test_sequence.add_log_lines(
+["read packet: $QNonStop:1#00",
+ "send packet: $OK#00",
+ # stop is used to synchronize starting threads
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ {"direction": "send", "regex": "%Stop:T.*"},
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ "read packet: $?#00",
+ "send packet: $OK#00",
+ ], True)
+self.expect_gdbremote_sequence()
Index: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1019,9 +1019,11 @@
 return;
 
   for (NativeThreadProtocol &listed_thread : m_current_process->Threads()) {
-if (listed_thread.GetID() != thread_to_skip)
-  m_stop_notification_queue.push_back(
-  PrepareStopReplyPacketForThread(listed_thread).GetString().str());
+if (listed_thread.GetID() != thread_to_skip) {
+  StreamString stop_reply = PrepareStopReplyPacketForThread(listed_thread);
+  if (!stop_reply.Empty())
+m_stop_notification_queue.push_back(stop_reply.GetString().str());
+}
   }
 }
 
@@ -1876,9 +1878,11 @@
   // the current thread (for clients that don't actually support multiple
   // stop reasons).
   NativeThreadProtocol *thread = m_current_process->GetCurrentThread();
-  if (thread)
-m_stop_notification_queue.push_back(
-PrepareStopReplyPacketForThread(*thread).GetString().str());
+  if (thread) {
+StreamString stop_reply = PrepareStopReplyPacketForThread(*thread);
+if (!stop_reply.Empty())
+  m_stop_notification_queue.push_back(stop_reply.GetString().str());
+  }
   EnqueueStopReplyPackets(thread ? thread->GetID()
  : LLDB_INVALID_THREAD_ID);
 }


Index: lldb/test/API/tools/lldb-server/TestNonStop.py
===
--- lldb/test/API/tools/lldb-server/TestNonStop.py
+++ lldb/test/API/tools/lldb-server/TestNonStop.py
@@ -348,3 +348,23 @@
  "send packet: $OK#00",
  ], True)
 self.expect_gdbremote_sequence()
+
+@add_test_categories(["llgs"])
+def test_stop_reason_while_running(self):
+self.build()
+self.set_inferior_startup_launch()
+procs = self.prep_debug_monitor_and_inferior(
+inferior_args=["thread:new", "thread:new", "stop", "sleep:15"])
+self.test_sequence.add_log_lines(
+["read packet: $QNonStop:1#00",
+ "send packet: $OK#00",
+ # stop is used to synchronize starting threads
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ {"direction": "send", "regex": "%Stop:T.*"},
+ "read packet: $c#63",
+ "send packet: $OK#00",
+ "read packet: $?#00",
+ "send packet: $OK#00",
+ ], True)
+self.expect_gdbremote_sequence()
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1019,9 +1019,11 @@
 return;
 
   for (NativeThreadProtocol &listed_thread : m_current_process->Threads()) {
-if (listed_thread.GetID() != thread_to_skip)
-  m_stop_notification_queue.push_back(
-  PrepareSto