[Lldb-commits] [PATCH] D121487: [lldb] Require native for command-thread-siginfo.test

2022-03-11 Thread Ayush Sahay via Phabricator via lldb-commits
asahay created this revision.
Herald added a project: All.
asahay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

command-thread-siginfo.test employs a subject with a call to wait, and
thus requires system-linux. However, it's possible to target non-Linux
platforms despite operating on Linux hosts. So, have it require native
too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121487

Files:
  lldb/test/Shell/Commands/command-thread-siginfo.test


Index: lldb/test/Shell/Commands/command-thread-siginfo.test
===
--- lldb/test/Shell/Commands/command-thread-siginfo.test
+++ lldb/test/Shell/Commands/command-thread-siginfo.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-linux
+# REQUIRES: native && system-linux
 # RUN: %clang_host -g %S/Inputs/sigchld.c -o %t
 # RUN: %lldb %t -b -s %s | FileCheck %s
 


Index: lldb/test/Shell/Commands/command-thread-siginfo.test
===
--- lldb/test/Shell/Commands/command-thread-siginfo.test
+++ lldb/test/Shell/Commands/command-thread-siginfo.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-linux
+# REQUIRES: native && system-linux
 # RUN: %clang_host -g %S/Inputs/sigchld.c -o %t
 # RUN: %lldb %t -b -s %s | FileCheck %s
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121487: [lldb] Require native for command-thread-siginfo.test

2022-03-14 Thread Ayush Sahay via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd506a9ef2b32: [lldb] Require native for 
command-thread-siginfo.test (authored by asahay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121487

Files:
  lldb/test/Shell/Commands/command-thread-siginfo.test


Index: lldb/test/Shell/Commands/command-thread-siginfo.test
===
--- lldb/test/Shell/Commands/command-thread-siginfo.test
+++ lldb/test/Shell/Commands/command-thread-siginfo.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-linux
+# REQUIRES: native && system-linux
 # RUN: %clang_host -g %S/Inputs/sigchld.c -o %t
 # RUN: %lldb %t -b -s %s | FileCheck %s
 


Index: lldb/test/Shell/Commands/command-thread-siginfo.test
===
--- lldb/test/Shell/Commands/command-thread-siginfo.test
+++ lldb/test/Shell/Commands/command-thread-siginfo.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-linux
+# REQUIRES: native && system-linux
 # RUN: %clang_host -g %S/Inputs/sigchld.c -o %t
 # RUN: %lldb %t -b -s %s | FileCheck %s
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140839: [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation

2023-01-01 Thread Ayush Sahay via Phabricator via lldb-commits
asahay created this revision.
Herald added a project: All.
asahay published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

TestFrameFormatNameWithArgs.test is enabled only in case of native
compilation but is applicable in case of cross compilation too. So,
provision support for enabling it in case of both, native and cross
compilation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140839

Files:
  lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
  lldb/test/Shell/helper/build.py


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -26,7 +26,6 @@
 dest='arch',
 required=True,
 default='host',
-choices=['32', '64', 'host'],
 help='Specify the architecture to target.')
 
 parser.add_argument('--compiler',
@@ -110,6 +109,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +236,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +587,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +661,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +801,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,5 +1,5 @@
 # UNSUPPORTED: system-windows
-# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
 break set -n foo


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -26,7 +26,6 @@
 dest='arch',
 required=True,
 default='host',
-choices=['32', '64', 'host'],
 help='Specify the architecture to target.')
 
 parser.add_argument('--compiler',
@@ -110,6 +109,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +236,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +587,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +661,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +801,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
=

[Lldb-commits] [PATCH] D140839: [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation

2023-01-17 Thread Ayush Sahay via Phabricator via lldb-commits
asahay added inline comments.



Comment at: lldb/test/Shell/helper/build.py:29
 default='host',
-choices=['32', '64', 'host'],
 help='Specify the architecture to target.')

Michael137 wrote:
> Why was this needed?
> 
> Other than that, LGTM
IIUC, //~/lldb/test/Shell/helper/toolchain.py// supplies LLDB's bitness (and 
not the target architecture) as //arch// to 
//~/lldb/test/Shell/helper/build.py// unconditionally. However, we may require 
the target architecture too to customize the compile and link commands (we did 
in our downstream project, at least). Perhaps, we'd like both, LLDB's bitness 
and the target architecture to be supplied via separate options but I thought 
that lifting the restriction in question might've sufficed until we'd 
provisioned support for the same. Let me know if we'd like it handled (or, not 
dealt with at all) in this change itself, though, please.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140839

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


[Lldb-commits] [PATCH] D140839: [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation

2023-01-30 Thread Ayush Sahay via Phabricator via lldb-commits
asahay updated this revision to Diff 493337.
asahay added a comment.

Retain 'choices' for 'arch'.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140839

Files:
  lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
  lldb/test/Shell/helper/build.py


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -110,6 +110,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +237,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +588,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +662,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +802,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,5 +1,5 @@
 # UNSUPPORTED: system-windows
-# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
 break set -n foo


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -110,6 +110,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +237,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +588,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +662,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +802,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,5 +1,5 @@
 # UNSUPPORTED: system-windows
-# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
 break set -n foo
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140839: [lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation

2023-02-01 Thread Ayush Sahay via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08032411301e: [lldb] Enable TestFrameFormatNameWithArgs in 
case of cross compilation (authored by asahay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140839

Files:
  lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
  lldb/test/Shell/helper/build.py


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -110,6 +110,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +237,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +588,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +662,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +802,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,5 +1,5 @@
 # UNSUPPORTED: system-windows
-# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
 break set -n foo


Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -110,6 +110,12 @@
 nargs='+',
 help='Source file(s) to compile / object file(s) to link')
 
+parser.add_argument('--std',
+metavar='std',
+dest='std',
+required=False,
+help='Specify the C/C++ standard.')
+
 
 args = parser.parse_args(args=sys.argv[1:])
 
@@ -231,6 +237,7 @@
 self.verbose = args.verbose
 self.obj_ext = obj_ext
 self.lib_paths = args.libs_dir
+self.std = args.std
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -581,6 +588,9 @@
 args.append('--')
 args.append(source)
 
+if self.std:
+args.append('/std:' + self.std)
+
 return ('compiling', [source], obj,
 self.compile_env,
 args)
@@ -652,6 +662,9 @@
 if sys.platform == 'darwin':
 args.extend(['-isysroot', self.apple_sdk])
 
+if self.std:
+args.append('-std={0}'.format(self.std))
+
 return ('compiling', [source], obj, None, args)
 
 def _get_link_command(self):
@@ -789,6 +802,7 @@
 print('  Verbose: ' + str(args.verbose))
 print('  Dryrun: ' + str(args.dry))
 print('  Inputs: ' + format_text(args.inputs, 0, 10))
+print('  C/C++ Standard: ' + str(args.std))
 print('Script Environment:')
 print_environment(os.environ)
 
Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,5 +1,5 @@
 # UNSUPPORTED: system-windows
-# RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
+# RUN: %build %S/Inputs/names.cpp --std c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
 break set -n foo
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D103609: [lldb-vscode] Synchronize calls to SendTerminatedEvent

2021-06-11 Thread Ayush Sahay via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ef5177145b4: [lldb-vscode] Synchronize calls to 
SendTerminatedEvent (authored by asahay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103609

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -179,6 +179,19 @@
 // Send a "terminated" event to indicate the process is done being
 // debugged.
 void SendTerminatedEvent() {
+  // If an inferior exits prior to the processing of a disconnect request, then
+  // the threads executing EventThreadFunction and request_discontinue
+  // respectively may call SendTerminatedEvent simultaneously. Without any
+  // synchronization, the thread executing EventThreadFunction may set
+  // g_vsc.sent_terminated_event before the thread executing
+  // request_discontinue has had a chance to test it, in which case the latter
+  // would move ahead to issue a response to the disconnect request. Said
+  // response may get dispatched ahead of the terminated event compelling the
+  // client to terminate the debug session without consuming any console output
+  // that might've been generated by the execution of terminateCommands. So,
+  // synchronize simultaneous calls to SendTerminatedEvent.
+  static std::mutex mutex;
+  std::lock_guard locker(mutex);
   if (!g_vsc.sent_terminated_event) {
 g_vsc.sent_terminated_event = true;
 g_vsc.RunTerminateCommands();


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -179,6 +179,19 @@
 // Send a "terminated" event to indicate the process is done being
 // debugged.
 void SendTerminatedEvent() {
+  // If an inferior exits prior to the processing of a disconnect request, then
+  // the threads executing EventThreadFunction and request_discontinue
+  // respectively may call SendTerminatedEvent simultaneously. Without any
+  // synchronization, the thread executing EventThreadFunction may set
+  // g_vsc.sent_terminated_event before the thread executing
+  // request_discontinue has had a chance to test it, in which case the latter
+  // would move ahead to issue a response to the disconnect request. Said
+  // response may get dispatched ahead of the terminated event compelling the
+  // client to terminate the debug session without consuming any console output
+  // that might've been generated by the execution of terminateCommands. So,
+  // synchronize simultaneous calls to SendTerminatedEvent.
+  static std::mutex mutex;
+  std::lock_guard locker(mutex);
   if (!g_vsc.sent_terminated_event) {
 g_vsc.sent_terminated_event = true;
 g_vsc.RunTerminateCommands();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits