mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-08 06:48:41 +00:00
check in test input binaries, adjust torture test data path
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
bias = (bias^x)&7;
|
||||
x -= bias;
|
||||
x *= 2;
|
||||
x *= x;
|
||||
x += bias;
|
||||
@@ -0,0 +1,126 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
/*
|
||||
* Program to run in debugger organized to provide tests for
|
||||
* single threaded stepping, breakpoints, evaluation.
|
||||
*/
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Complex Types
|
||||
|
||||
#include <complex.h>
|
||||
|
||||
void
|
||||
c_type_coverage_eval_tests(void){
|
||||
#if _WIN32
|
||||
_Fcomplex x = _FCbuild(0.f, 1.f);
|
||||
_Dcomplex y = _Cbuild(0.f, -1.f);
|
||||
|
||||
#else
|
||||
float complex x = 0.f + 1.f*I;
|
||||
double complex y = 0.0 - 1.0*I;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Reuse Type Names From Another Module
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct Basics{
|
||||
double a;
|
||||
float b;
|
||||
unsigned long long c;
|
||||
long long d;
|
||||
unsigned int e;
|
||||
int f;
|
||||
unsigned short g;
|
||||
short h;
|
||||
unsigned char i;
|
||||
char j;
|
||||
|
||||
int z;
|
||||
} Basics;
|
||||
|
||||
typedef struct Basics_Stdint{
|
||||
double x1;
|
||||
float x2;
|
||||
uint64_t x3;
|
||||
int64_t x4;
|
||||
uint32_t x5;
|
||||
int32_t x6;
|
||||
uint16_t x7;
|
||||
int16_t x8;
|
||||
uint8_t x9;
|
||||
int8_t x0;
|
||||
} Basics_Stdint;
|
||||
|
||||
typedef struct Pair{
|
||||
int i;
|
||||
float f;
|
||||
} Pair;
|
||||
|
||||
void
|
||||
c_versions_of_same_types(void){
|
||||
Basics basics = { 1.5f, 1.50000000000001, -1, 1, -2, 2, -4, 4, -8, 8, };
|
||||
Basics_Stdint basics_stdint = { 1.5f, 1.50000000000001, -1, 1, -2, 2, -4, 4, -8, 8, };
|
||||
Pair memory_[] = {
|
||||
{100, 1.f},
|
||||
{101, 2.f},
|
||||
{102, 4.f},
|
||||
{103, 8.f},
|
||||
{104, 16.f},
|
||||
{105, 32.f},
|
||||
};
|
||||
|
||||
int x = memory_[3].i + basics.f;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ NOTE(rjf): Bitfields
|
||||
|
||||
typedef struct TypeWithBitfield TypeWithBitfield;
|
||||
struct TypeWithBitfield
|
||||
{
|
||||
int v : 14;
|
||||
int w : 4;
|
||||
int x : 32;
|
||||
int y : 4;
|
||||
int z : 10;
|
||||
};
|
||||
|
||||
typedef struct BitfieldType64 BitfieldType64;
|
||||
struct BitfieldType64
|
||||
{
|
||||
uint64_t size : 63;
|
||||
uint64_t is_free : 1;
|
||||
};
|
||||
|
||||
static int mut_xarray[4] = {100, 101, 102, 103};
|
||||
static float mut_farray[4] = {100.5f, 101.5f, 102.5f, 103.5f};
|
||||
|
||||
void
|
||||
c_type_with_bitfield_usage(void)
|
||||
{
|
||||
TypeWithBitfield b = {0};
|
||||
b.v = 100;
|
||||
b.w = 6;
|
||||
b.x = 434512;
|
||||
b.y = 7;
|
||||
b.z = 12;
|
||||
int x = (b.v + b.x);
|
||||
int y = (b.y - b.z);
|
||||
int z = (b.w) + 5;
|
||||
BitfieldType64 b64 = {0};
|
||||
b64.size = 524288;
|
||||
b64.is_free = 1;
|
||||
int abc = mut_xarray[0];
|
||||
mut_xarray[0] += 1;
|
||||
abc += mut_xarray[0];
|
||||
abc += mut_xarray[1];
|
||||
abc += mut_xarray[2];
|
||||
float f = mut_farray[0] + mut_farray[1] + mut_farray[2] + mut_farray[3];
|
||||
int w = 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
/*
|
||||
* Program to run in debugger organized to provide tests for
|
||||
* single threaded stepping, breakpoints, evaluation.
|
||||
*/
|
||||
|
||||
void c_type_coverage_eval_tests(void);
|
||||
void c_type_with_bitfield_usage(void);
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
/*
|
||||
** Make sure we have an inlined function
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define FORCE_INLINE __forceinline
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
# define FORCE_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
# error need force inline for this compiler
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Inline Stepping
|
||||
|
||||
unsigned int fixed_frac_bits = 5;
|
||||
static unsigned int bias = 7;
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
fixed_mul(unsigned int a, unsigned int b){
|
||||
unsigned int c = (((a - bias)*(b - bias)) >> fixed_frac_bits) + bias;
|
||||
return(c);
|
||||
}
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
multi_file_inlinesite(unsigned int x){
|
||||
// force compiler to generate annotations for code that's inside another file
|
||||
#include "inline_body.cpp"
|
||||
return x >> fixed_frac_bits;
|
||||
}
|
||||
|
||||
static unsigned int test_value = 0;
|
||||
|
||||
unsigned int
|
||||
inline_stepping_tests(void){
|
||||
bias = 15;
|
||||
|
||||
// NOTE(nick): Interesting that CL does not generate inline site symbols in order of apperance here unlike clang.
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeLengthAndCodeOffset d 0
|
||||
// BinaryAnnotation Length: 4 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: LineOffset 1 CodeLength d
|
||||
// BinaryAnnotation Length: 4 bytes (0 bytes padding)
|
||||
unsigned int x = fixed_mul(5001, 7121);
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeOffsetAndLineOffset d File 0 CodeOffsetAndLineOffset 22 LineOffset 1e
|
||||
// CodeLengthAndCodeOffset 2 3
|
||||
// BinaryAnnotation Length: 12 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: File 18 LineOffset ffffffe6 CodeOffset d CodeOffsetAndLineOffset 22
|
||||
// File 0 LineOffset 1e CodeOffset 3 CodeLength 2
|
||||
// BinaryAnnotation Length: 16 bytes (0 bytes padding)
|
||||
unsigned int z = multi_file_inlinesite(x);
|
||||
return(z);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e2b10fe04ef539796a329790987f781e645707a737e32db863f3e49a1766bf5a
|
||||
size 4763648
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:87783650d5ceb1dd991ae3a01ca4a55cefc9eacd54ead4fcc5deb72af4f9b8a3
|
||||
size 2667692
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7ac765d8dfa6d3a3830b3efc76d8b52f6dd201004e9fead477138ac7b4d1015a
|
||||
size 264704
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#if _WIN32
|
||||
#define export_function extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define export_function extern "C"
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
# define thread_var __declspec(thread)
|
||||
#else
|
||||
# define thread_var __thread
|
||||
#endif
|
||||
|
||||
typedef struct OnlyInModule OnlyInModule;
|
||||
struct OnlyInModule
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
char *name;
|
||||
};
|
||||
|
||||
typedef struct Basics Basics;
|
||||
struct Basics
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
};
|
||||
|
||||
static OnlyInModule only_in_module_global =
|
||||
{
|
||||
1, 2, 3, "foobar",
|
||||
};
|
||||
|
||||
thread_var float tls_a = 1.015625f;
|
||||
thread_var int tls_b = -100;
|
||||
|
||||
export_function void
|
||||
dll_tls_eval_test(void)
|
||||
{
|
||||
tls_a *= 1.5f;
|
||||
tls_b *= -2;
|
||||
only_in_module_global.x += 1;
|
||||
only_in_module_global.y += 2;
|
||||
only_in_module_global.z += 3;
|
||||
}
|
||||
|
||||
export_function void
|
||||
dll_type_eval_tests(void)
|
||||
{
|
||||
Basics basics1 = {1, 2, 3, 4};
|
||||
Basics basics2 = {4, 5, 6, 7};
|
||||
OnlyInModule only_in_module = {123, 456, 789, "this type is only in the module!"};
|
||||
int x = 0;
|
||||
(void)x;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bc2f8b6f96c6bea013dbebcd6f6d84c0f015a361a62bf9158785687402b84311
|
||||
size 6942720
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3bc47bac888fae6cbeb969e59763431847e30f380e24c9ccfd05565beacc9995
|
||||
size 5379652
|
||||
@@ -0,0 +1,119 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
static int important_s32 = 0;
|
||||
static float important_f32 = 0;
|
||||
|
||||
#if _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_something_with_intermediate_values(void)
|
||||
{
|
||||
static int another_important_s32 = 0;
|
||||
static float another_important_f32 = 0;
|
||||
|
||||
another_important_s32 = (int)important_f32;
|
||||
another_important_f32 = (float)important_s32;
|
||||
|
||||
#if _WIN32
|
||||
char buffer[256] = "Hello, World!\n";
|
||||
buffer[0] += important_s32 + another_important_s32;
|
||||
buffer[1] += (int)another_important_f32 * important_f32;
|
||||
OutputDebugStringA(buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
store_important_s32(int *ptr)
|
||||
{
|
||||
important_s32 = *ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
store_important_f32(float *ptr)
|
||||
{
|
||||
important_f32 = *ptr;
|
||||
}
|
||||
|
||||
void
|
||||
optimized_build_eval_tests(void)
|
||||
{
|
||||
int simple_sum = 0;
|
||||
for(int i = 0; i < 10000; i += 1)
|
||||
{
|
||||
simple_sum += i;
|
||||
}
|
||||
store_important_s32(&simple_sum);
|
||||
|
||||
do_something_with_intermediate_values();
|
||||
|
||||
static struct {float x, y;} vec2s[] =
|
||||
{
|
||||
{ 10.f, 76.f },
|
||||
{ 40.f, 50.f },
|
||||
{ -230.f, 20.f },
|
||||
{ 27.f, 27.f },
|
||||
{ 57.f, -57.f },
|
||||
{ -37.f, 97.f },
|
||||
{ 99.f, 67.f },
|
||||
{ 99.f, 37.f },
|
||||
{ 99.f, 57.f },
|
||||
};
|
||||
{
|
||||
struct{float x, y;}sum = {0};
|
||||
int count = sizeof(vec2s)/sizeof(vec2s[0]);
|
||||
for(int i = 0; i < count; i += 1)
|
||||
{
|
||||
sum.x += vec2s[i].x;
|
||||
sum.y += vec2s[i].y;
|
||||
}
|
||||
struct{float x, y;}avg = {sum.x/count, sum.y/count};
|
||||
float f32 = avg.x * avg.y;
|
||||
store_important_f32(&f32);
|
||||
}
|
||||
|
||||
do_something_with_intermediate_values();
|
||||
|
||||
int factorial = 1;
|
||||
for(int i = 10; i > 0; i -= 1)
|
||||
{
|
||||
factorial *= i;
|
||||
}
|
||||
store_important_s32(&factorial);
|
||||
|
||||
do_something_with_intermediate_values();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Struct Parameters Eval
|
||||
|
||||
struct OptimizedBasics{
|
||||
char a;
|
||||
unsigned char b;
|
||||
short c;
|
||||
unsigned short d;
|
||||
int e;
|
||||
unsigned int f;
|
||||
long long g;
|
||||
unsigned long long h;
|
||||
float i;
|
||||
double j;
|
||||
};
|
||||
|
||||
static void
|
||||
optimized_struct_parameter_helper(int *ptr, OptimizedBasics basics)
|
||||
{
|
||||
basics.a += *ptr;
|
||||
basics.a += 1;
|
||||
basics.a += 1;
|
||||
}
|
||||
|
||||
void
|
||||
optimized_struct_parameters_eval_tests(void)
|
||||
{
|
||||
int x = 10;
|
||||
OptimizedBasics basics = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001};
|
||||
optimized_struct_parameter_helper(&x, basics);
|
||||
}
|
||||
@@ -1283,7 +1283,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
{
|
||||
String8 binary_dir_path = get_process_info()->binary_path;
|
||||
String8 root_dir_path = str8_chop_last_slash(binary_dir_path);
|
||||
g_input_data_dir = str8f(scratch.arena, "%S/local/test_data", root_dir_path);
|
||||
g_input_data_dir = str8f(scratch.arena, "%S/data/test_inputs", root_dir_path);
|
||||
}
|
||||
|
||||
// setup output directory
|
||||
|
||||
Reference in New Issue
Block a user