teak-llvm/lldb/packages/Python/lldbsuite/test/commands/expression/call-restarts/lotta-signals.c
Raphael Isemann 29872606d2 [lldb] Restructure test folders to match LLDB command hierarchy
Summary:
As discussed on lldb-dev, this patch moves some LLDB tests into a hierarchy that more closely
resembles the commands we use in the LLDB interpreter. This patch should only move tests
that use the command interpreter and shouldn't touch any tests that primarily test the SB API.

Reviewers: #lldb, jfb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: dexonsmith, arphaman, JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 370605
2019-09-01 09:12:37 +00:00

62 lines
899 B
C

#include <unistd.h>
#include <stdio.h>
#include <signal.h>
static int sigchld_no;
static int nosig_no;
static int weird_value;
void
sigchld_handler (int signo)
{
sigchld_no++;
printf ("Got sigchld %d.\n", sigchld_no);
}
int
call_me (int some_value)
{
int ret_val = 0;
int i;
for (i = 0; i < some_value; i++)
{
int result = 0;
if (i%2 == 0)
result = kill (getpid(), SIGCHLD);
else
sigchld_no++;
usleep(1000);
if (result == 0)
ret_val++;
}
usleep (10000);
return ret_val;
}
int
call_me_nosig (int some_value)
{
int ret_val = 0;
int i;
for (i = 0; i < some_value; i++)
weird_value += i % 4;
nosig_no += some_value;
return some_value;
}
int
main ()
{
int ret_val;
signal (SIGCHLD, sigchld_handler);
ret_val = call_me (2); // Stop here in main.
ret_val = call_me_nosig (10);
return 0;
}