[Lldb-commits] [PATCH] D129455: [lldb] Reduce the stack alignment requirements for the Windows x86_64 ABI

2022-07-10 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo created this revision.
mstorsjo added reviewers: labath, jasonmolenda.
Herald added a subscriber: jsji.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLDB.

This fixes https://github.com/llvm/llvm-project/issues/56095.

@labath, FWIW while making the testcase, I realized why most tests on
Windows need the %build script instead of plain %clang_host.

For this testcase, I do need to have at least symbols available
(full debug info isn't needed). On unix-like systems, a command like
"clang source.c -o exec" will produce an executable with symbols.
With MSVC and clang in MSVC mode, the default linking command won't
produce any debug info at all, no symbols, nothing. We can fix it by
passing "-fuse-ld=lld -Wl,-debug:symtab", but that breaks mingw builds
(where symbols are kept by default).

The %build script handles all the options that are needed for creating
PDB debug info with clang-cl/lld-link, and produces symbols when building
in mingw mode too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129455

Files:
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
  lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s
  lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp
  lldb/test/Shell/Unwind/windows-unaligned-x86_64.test


Index: lldb/test/Shell/Unwind/windows-unaligned-x86_64.test
===
--- /dev/null
+++ lldb/test/Shell/Unwind/windows-unaligned-x86_64.test
@@ -0,0 +1,26 @@
+# Test unwinding through stack frames that aren't aligned to 16 bytes.
+# (In real world code, this happens when unwinding through
+# KiUserExceptionDispatcher and KiUserCallbackDispatcher in ntdll.dll.)
+
+# REQUIRES: target-x86_64, native, system-windows
+
+# RUN: %build %p/Inputs/windows-unaligned-x86_64.cpp 
%p/Inputs/windows-unaligned-x86_64-asm.s -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+# Future TODO: If %build could compile the source file in C mode, the symbol
+# name handling would be easier across msvc and mingw build configurations.
+# (In mingw mode, the extern C symbol "func" is printed as "::func" while
+# it's plain "func" in msvc mode. Without the extern C, it's "func(..." in
+# mingw mode, but "void __cdecl func(..." in msvc mode.)
+
+breakpoint set -n func
+# CHECK: Breakpoint 1: where = {{.*}}`{{(::)?}}func
+
+process launch
+# CHECK: stop reason = breakpoint 1.1
+
+thread backtrace
+# CHECK: frame #0: {{.*}}`{{(::)?}}func
+# CHECK: frame #1: {{.*}}`realign_stack
+# CHECK: frame #2: {{.*}}`call_func
+# CHECK: frame #3: {{.*}}`main
Index: lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp
===
--- /dev/null
+++ lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64.cpp
@@ -0,0 +1,8 @@
+extern "C" void call_func(void (*ptr)(int a), int a);
+
+extern "C" void func(int arg) { }
+
+int main(int argc, char **argv) {
+  call_func(func, 42);
+  return 0;
+}
Index: lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s
===
--- /dev/null
+++ lldb/test/Shell/Unwind/Inputs/windows-unaligned-x86_64-asm.s
@@ -0,0 +1,25 @@
+.globlcall_func
+.def  call_func;   .scl2;  .type   32; .endef
+.seh_proc call_func
+call_func:
+subq$32, %rsp
+.seh_stackalloc 32
+.seh_endprologue
+callrealign_stack
+addq$32, %rsp
+ret
+.seh_endproc
+
+.globlrealign_stack
+.def  realign_stack;   .scl2;  .type   32; .endef
+.seh_proc realign_stack
+realign_stack:
+subq$32, %rsp
+.seh_stackalloc 32
+.seh_endprologue
+movq%rcx, %rax
+movl%edx, %ecx
+call*%rax
+addq$32, %rsp
+ret
+.seh_endproc
Index: lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
===
--- lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
+++ lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
@@ -40,10 +40,15 @@
 
   bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
 
-  // In Windows_x86_64 ABI, stack will always be maintained 16-byte aligned
+  // In Windows_x86_64 ABI requires that the stack will be maintained 16-byte
+  // aligned.
+  // When ntdll invokes callbacks such as KiUserExceptionDispatcher or
+  // KiUserCallbackDispatcher, those functions won't have a properly 16-byte
+  // aligned stack - but tolerate unwinding through them by relaxing the
+  // requirement to 8 bytes.
   bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
- if (cfa & (16ull - 1ull))
-  return false; // Not 16 byte aligned
+if (cfa & (8ull - 1ull))
+  return false; // Not 8 byte aligned
 if (cfa == 0)
   return false; // Zero is not a valid stack addr

[Lldb-commits] [PATCH] D129456: [lldb] Add image dump pcm command

2022-07-10 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added reviewers: JDevlieghere, mib, augusto2112.
Herald added subscribers: kbarton, nemanjai.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.

Add `pcm-info` to the `target module dump` subcommands.

This dump command shows information about clang .pcm files. This command
effectively runs `clang -module-file-info` and produces identical output.

The .pcm file format is tightly coupled to the clang version. The clang
embedded in lldb is not guaranteed to match the version of the clang executable
available on the local system.

There have been times when I've needed to view the details about a .pcm file
produced by lldb's embedded clang, but because the clang executable was a
slightly different version, the `-module-file-info` invocation failed. With
this command, users can inspect .pcm files generated by lldb too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129456

Files:
  clang/include/clang/Frontend/FrontendActions.h
  clang/lib/Frontend/FrontendActions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/test/API/commands/target/dump-pcm-info/Makefile
  lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
  lldb/test/API/commands/target/dump-pcm-info/main.m

Index: lldb/test/API/commands/target/dump-pcm-info/main.m
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/main.m
@@ -0,0 +1 @@
+int main() { return 0; }
Index: lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
@@ -0,0 +1,40 @@
+"""
+Test 'target modules dump pcm-info'.
+"""
+
+import os
+import shutil
+import glob
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+@no_debug_info_test
+def test(self):
+self.build()
+
+# lldbutil.run_break_set_by_symbol(self, "main")
+lldbutil.run_to_source_breakpoint(
+self, "return", lldb.SBFileSpec("main.m"))
+
+mod_cache = self.getBuildArtifact("private-module-cache")
+if os.path.isdir(mod_cache):
+shutil.rmtree(mod_cache)
+
+self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'")
+
+# Cause lldb to generate a Darwin-*.pcm
+self.runCmd("p @import Darwin")
+
+# root//-.pcm
+pcm_paths = glob.glob(os.path.join(mod_cache, '*', 'Darwin-*.pcm'))
+self.assertEqual(len(pcm_paths), 1, "Expected one Darwin pcm")
+pcm_path = pcm_paths[0]
+
+self.expect(
+f"target modules dump pcm-info '{pcm_path}'",
+startstr=f"Information for module file '{pcm_path}'",
+substrs=["Module name: Darwin"])
Index: lldb/test/API/commands/target/dump-pcm-info/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+USE_PRIVATE_MODULE_CACHE = YES
+include Makefile.rules
+
Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -53,6 +53,10 @@
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
 
+#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/FrontendActions.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatAdapters.h"
@@ -2155,6 +2159,41 @@
   }
 };
 
+class CommandObjectTargetModulesDumpClangPCMInfo : public CommandObjectParsed {
+public:
+  CommandObjectTargetModulesDumpClangPCMInfo(CommandInterpreter &interpreter)
+  : CommandObjectParsed(
+interpreter, "target modules dump pcm-info",
+"Dump information about the given clang module (pcm).") {
+// Take a single file argument.
+CommandArgumentData arg{eArgTypeFilename, eArgRepeatPlain};
+m_arguments.push_back({arg});
+  }
+
+  ~CommandObjectTargetModulesDumpClangPCMInfo() override = default;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+clang::CompilerInstance compiler;
+compiler.createDiagnostics();
+
+const char *pcm_path = command.GetArgumentAtIndex(0);
+const char *clang_args[] = {"clang", pcm_path};
+compiler.setInvocation(clang::createInvocation(clang_args));
+
+clang::DumpModuleInfoAction dump_module_info;
+dump_module_info.OutputStream = &result.GetOutp

[Lldb-commits] [PATCH] D129456: [lldb] Add image dump pcm command

2022-07-10 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 443531.
kastiglione added a comment.

add @skipUnlessDarwin


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129456

Files:
  clang/include/clang/Frontend/FrontendActions.h
  clang/lib/Frontend/FrontendActions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/test/API/commands/target/dump-pcm-info/Makefile
  lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
  lldb/test/API/commands/target/dump-pcm-info/main.m

Index: lldb/test/API/commands/target/dump-pcm-info/main.m
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/main.m
@@ -0,0 +1 @@
+int main() { return 0; }
Index: lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
@@ -0,0 +1,41 @@
+"""
+Test 'target modules dump pcm-info'.
+"""
+
+import os
+import shutil
+import glob
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+@no_debug_info_test
+@skipUnlessDarwin
+def test(self):
+self.build()
+
+# lldbutil.run_break_set_by_symbol(self, "main")
+lldbutil.run_to_source_breakpoint(
+self, "return", lldb.SBFileSpec("main.m"))
+
+mod_cache = self.getBuildArtifact("private-module-cache")
+if os.path.isdir(mod_cache):
+shutil.rmtree(mod_cache)
+
+self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'")
+
+# Cause lldb to generate a Darwin-*.pcm
+self.runCmd("p @import Darwin")
+
+# root//-.pcm
+pcm_paths = glob.glob(os.path.join(mod_cache, '*', 'Darwin-*.pcm'))
+self.assertEqual(len(pcm_paths), 1, "Expected one Darwin pcm")
+pcm_path = pcm_paths[0]
+
+self.expect(
+f"target modules dump pcm-info '{pcm_path}'",
+startstr=f"Information for module file '{pcm_path}'",
+substrs=["Module name: Darwin"])
Index: lldb/test/API/commands/target/dump-pcm-info/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+USE_PRIVATE_MODULE_CACHE = YES
+include Makefile.rules
+
Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -53,6 +53,10 @@
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
 
+#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/FrontendActions.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatAdapters.h"
@@ -2155,6 +2159,41 @@
   }
 };
 
+class CommandObjectTargetModulesDumpClangPCMInfo : public CommandObjectParsed {
+public:
+  CommandObjectTargetModulesDumpClangPCMInfo(CommandInterpreter &interpreter)
+  : CommandObjectParsed(
+interpreter, "target modules dump pcm-info",
+"Dump information about the given clang module (pcm).") {
+// Take a single file argument.
+CommandArgumentData arg{eArgTypeFilename, eArgRepeatPlain};
+m_arguments.push_back({arg});
+  }
+
+  ~CommandObjectTargetModulesDumpClangPCMInfo() override = default;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+clang::CompilerInstance compiler;
+compiler.createDiagnostics();
+
+const char *pcm_path = command.GetArgumentAtIndex(0);
+const char *clang_args[] = {"clang", pcm_path};
+compiler.setInvocation(clang::createInvocation(clang_args));
+
+clang::DumpModuleInfoAction dump_module_info;
+dump_module_info.OutputStream = &result.GetOutputStream().AsRawOstream();
+// DumpModuleInfoAction requires ObjectFilePCHContainerReader.
+compiler.getPCHContainerOperations()->registerReader(
+std::make_unique());
+
+if (compiler.ExecuteAction(dump_module_info))
+  result.SetStatus(eReturnStatusSuccessFinishResult);
+
+return result.Succeeded();
+  }
+};
+
 #pragma mark CommandObjectTargetModulesDumpClangAST
 
 // Clang AST dumping command
@@ -2406,10 +2445,10 @@
   CommandObjectTargetModulesDump(CommandInterpreter &interpreter)
   : CommandObjectMultiword(
 interpreter, "target modules dump",
-"Commands for dumping information about one or "
-"more target modules.",
+"Commands for dumping information about one or more target "
+"modules.",

[Lldb-commits] [PATCH] D129456: [lldb] Add image dump pcm command

2022-07-10 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 443532.
kastiglione added a comment.

remove commented-out code in test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129456

Files:
  clang/include/clang/Frontend/FrontendActions.h
  clang/lib/Frontend/FrontendActions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/test/API/commands/target/dump-pcm-info/Makefile
  lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
  lldb/test/API/commands/target/dump-pcm-info/main.m

Index: lldb/test/API/commands/target/dump-pcm-info/main.m
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/main.m
@@ -0,0 +1 @@
+int main() { return 0; }
Index: lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
@@ -0,0 +1,41 @@
+"""
+Test 'target modules dump pcm-info'.
+"""
+
+import os
+import shutil
+import glob
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+@no_debug_info_test
+@skipUnlessDarwin
+def test(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(
+self, "return", lldb.SBFileSpec("main.m"))
+
+mod_cache = self.getBuildArtifact("private-module-cache")
+if os.path.isdir(mod_cache):
+shutil.rmtree(mod_cache)
+
+self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'")
+
+# Cause lldb to generate a Darwin-*.pcm
+self.runCmd("p @import Darwin")
+
+# root//-.pcm
+pcm_paths = glob.glob(os.path.join(mod_cache, '*', 'Darwin-*.pcm'))
+self.assertEqual(len(pcm_paths), 1, "Expected one Darwin pcm")
+pcm_path = pcm_paths[0]
+
+breakpoint()
+self.expect(
+f"target modules dump pcm-info '{pcm_path}'",
+startstr=f"Information for module file '{pcm_path}'",
+substrs=["Module name: Darwin"])
Index: lldb/test/API/commands/target/dump-pcm-info/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/target/dump-pcm-info/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+USE_PRIVATE_MODULE_CACHE = YES
+include Makefile.rules
+
Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -53,6 +53,10 @@
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
 
+#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/FrontendActions.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatAdapters.h"
@@ -2155,6 +2159,41 @@
   }
 };
 
+class CommandObjectTargetModulesDumpClangPCMInfo : public CommandObjectParsed {
+public:
+  CommandObjectTargetModulesDumpClangPCMInfo(CommandInterpreter &interpreter)
+  : CommandObjectParsed(
+interpreter, "target modules dump pcm-info",
+"Dump information about the given clang module (pcm).") {
+// Take a single file argument.
+CommandArgumentData arg{eArgTypeFilename, eArgRepeatPlain};
+m_arguments.push_back({arg});
+  }
+
+  ~CommandObjectTargetModulesDumpClangPCMInfo() override = default;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+clang::CompilerInstance compiler;
+compiler.createDiagnostics();
+
+const char *pcm_path = command.GetArgumentAtIndex(0);
+const char *clang_args[] = {"clang", pcm_path};
+compiler.setInvocation(clang::createInvocation(clang_args));
+
+clang::DumpModuleInfoAction dump_module_info;
+dump_module_info.OutputStream = &result.GetOutputStream().AsRawOstream();
+// DumpModuleInfoAction requires ObjectFilePCHContainerReader.
+compiler.getPCHContainerOperations()->registerReader(
+std::make_unique());
+
+if (compiler.ExecuteAction(dump_module_info))
+  result.SetStatus(eReturnStatusSuccessFinishResult);
+
+return result.Succeeded();
+  }
+};
+
 #pragma mark CommandObjectTargetModulesDumpClangAST
 
 // Clang AST dumping command
@@ -2406,10 +2445,10 @@
   CommandObjectTargetModulesDump(CommandInterpreter &interpreter)
   : CommandObjectMultiword(
 interpreter, "target modules dump",
-"Commands for dumping information about one or "
-"more target modules.",
+"Commands for dumping information about one or more target "
+"modules.",
 "target mod

[Lldb-commits] [lldb] 4655400 - [lldb] Delete more mydir references (NFC)

2022-07-10 Thread Dave Lee via lldb-commits

Author: Dave Lee
Date: 2022-07-10T18:56:06-07:00
New Revision: 4655400b211319c92e7561952814c7f8e82b8781

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

LOG: [lldb] Delete more mydir references (NFC)

Added: 


Modified: 
lldb/docs/testsuite/a-detailed-walkthrough.txt
lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/simulator/TestDataFormatterLibcxxStringSimulator.py
lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
lldb/test/API/tools/lldb-server/TestNonStop.py
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_logpoints.py

Removed: 




diff  --git a/lldb/docs/testsuite/a-detailed-walkthrough.txt 
b/lldb/docs/testsuite/a-detailed-walkthrough.txt
index 8d374d5d81ea0..57c9dbce3d0ab 100644
--- a/lldb/docs/testsuite/a-detailed-walkthrough.txt
+++ b/lldb/docs/testsuite/a-detailed-walkthrough.txt
@@ -110,19 +110,9 @@ executable by lldb:
 exe = self.getBuildArtifact("a.out")
 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-This is where the attribute assignment:
-
-class SettingsCommandTestCase(TestBase):
-
-mydir = "settings"
-
-which happens right after the SettingsCommandTestCase class declaration comes
-into place. It specifies the relative directory to the top level 'test' so that
-the test harness can change its working directory in order to find the
-executable as well as the source code files. The runCmd() method is defined in
-the TestBase base class (within test/lldbtest.py) and its purpose is to pass 
the
-specified command to the lldb command interpreter. It's like you're typing the
-command within an interactive lldb session.
+The runCmd() method is defined in the TestBase base class and its purpose is to
+pass the specified command to the lldb command interpreter. It's like you're
+typing the command within an interactive lldb session.
 
 The CURRENT_EXECUTABLE_SET is an assert message defined in the lldbtest module
 so that it can be reused from other test modules.

diff  --git 
a/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py 
b/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
index 82f4404241283..c8f6764647a33 100644
--- a/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
+++ b/lldb/test/API/commands/process/continue_to_bkpt/TestContinueToBkpts.py
@@ -12,7 +12,6 @@
 class TestContinueToBkpts(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
-mydir = TestBase.compute_mydir(__file__)
 
 @add_test_categories(['pyapi'])
 def test_continue_to_breakpoints(self):

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/simulator/TestDataFormatterLibcxxStringSimulator.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/simulator/TestDataFormatterLibcxxStringSimulator.py
index e156447121cca..eb6bd3b04e424 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/simulator/TestDataFormatterLibcxxStringSimulator.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/simulator/TestDataFormatterLibcxxStringSimulator.py
@@ -13,7 +13,6 @@
 
 class LibcxxStringDataFormatterSimulatorTestCase(TestBase):
 
-mydir = TestBase.compute_mydir(__file__)
 NO_DEBUG_INFO_TESTCASE = True
 
 def _run_test(self, defines):

diff  --git 
a/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py 
b/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
index b6384c73306ab..f3b174a45625c 100644
--- 
a/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
+++ 
b/lldb/test/API/lang/cpp/step-through-trampoline/TestStepThroughTrampoline.py
@@ -3,8 +3,6 @@
 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,

diff  --git a/lldb/test/API/tools/lldb-server/TestNonStop.py 
b/lldb/test/API/tools/lldb-server/TestNonStop.py
index ebe66366b1736..83772ada78e30 100644
--- a/lldb/test/API/tools/lldb-server/TestNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestNonStop.py
@@ -6,8 +6,6 @@
 
 class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
 
-mydir = TestBase.compute_mydir(__file__)
-
 @skipIfWindows  # no SIGSEGV support
 @add_test_categories(["llgs"])
 def test_run(self):

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_logpoints.py 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_logp

[Lldb-commits] [lldb] fea52ac - [lldb/test] Use SIGINT as the "stopping" signal

2022-07-10 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-07-11T08:42:17+02:00
New Revision: fea52ac541f5973d01a6813475bca08ebe1f1e9b

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

LOG: [lldb/test] Use SIGINT as the "stopping" signal

Using SIGSTOP means that if anything goes wrong in the test, the process
can end up in the stopped state, where it is not running, but still
taking up resources. Eventually, these "zombies" can make the machine
completely unusable. Instead, use a signal whose default action is to
kill the processes.

Added: 


Modified: 
lldb/test/API/tools/lldb-server/main.cpp

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/main.cpp 
b/lldb/test/API/tools/lldb-server/main.cpp
index 36ad21c4fedf..21e46ef4e1b6 100644
--- a/lldb/test/API/tools/lldb-server/main.cpp
+++ b/lldb/test/API/tools/lldb-server/main.cpp
@@ -355,7 +355,7 @@ int main(int argc, char **argv) {
   trap();
 #if !defined(_WIN32)
 } else if (arg == "stop") {
-  raise(SIGSTOP);
+  raise(SIGINT);
 #endif
 } else {
   // Treat the argument as text for stdout.



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