Files
TheRock/debug-tools/rocgdb/source/gdb/testsuite/gdb.python/py-inferior.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

94 lines
1.7 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <pthread.h>
#define CHUNK_SIZE 16000 /* same as findcmd.c's */
#define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
#define NUMTH 8
int8_t int8_search_buf[100];
int16_t int16_search_buf[100];
int32_t int32_search_buf[100];
int64_t int64_search_buf[100];
static char *search_buf;
static int search_buf_size;
int8_t int8_global = 42;
int f2 (int a)
{
/* We use a `char[]' type below rather than the typical `char *'
to make sure that `str' gets allocated on the stack. Otherwise,
the compiler may place the "hello, testsuite" string inside
a read-only section, preventing us from over-writing it from GDB. */
char str[] = "hello, testsuite";
puts (str); /* Break here. */
return ++a;
}
int f1 (int a, int b)
{
return f2(a) + b;
}
static void
init_bufs ()
{
search_buf_size = BUF_SIZE;
search_buf = malloc (search_buf_size);
if (search_buf == NULL)
exit (1);
memset (search_buf, 'x', search_buf_size);
}
static void *
thread (void *param)
{
pthread_barrier_t *barrier = (pthread_barrier_t *) param;
pthread_barrier_wait (barrier);
return param;
}
static void
check_threads (pthread_barrier_t *barrier)
{
pthread_barrier_wait (barrier);
}
extern int
test_threads (void)
{
pthread_t threads[NUMTH];
pthread_barrier_t barrier;
int i;
pthread_barrier_init (&barrier, NULL, NUMTH + 1);
for (i = 0; i < NUMTH; ++i)
pthread_create (&threads[i], NULL, thread, &barrier);
check_threads (&barrier);
for (i = 0; i < NUMTH; ++i)
pthread_join (threads[i], NULL);
pthread_barrier_destroy (&barrier);
return 0;
}
int main (int argc, char *argv[])
{
test_threads ();
init_bufs ();
return f1 (1, 2);
}