rename DEBUG_LVAR -> DEBUG_ALIAS

This commit is contained in:
jacob 2024-04-11 12:42:44 -05:00
parent 9a8f86d42b
commit 02b31ab441
19 changed files with 22 additions and 25 deletions

View File

@ -25,7 +25,7 @@ GLOBAL struct {
struct arena arena; struct arena arena;
struct string write_path; struct string write_path;
struct sync_flag quit_sf; struct sync_flag quit_sf;
} L = { 0 }, DEBUG_LVAR(L_app); } L = { 0 }, DEBUG_ALIAS(L, L_app);
/* ========================== * /* ========================== *
* Write directory * Write directory

View File

@ -29,7 +29,7 @@ GLOBAL struct {
u64 dbg_table_count; u64 dbg_table_count;
struct sys_mutex dbg_table_mutex; struct sys_mutex dbg_table_mutex;
#endif #endif
} L = { 0 }, DEBUG_LVAR(L_asset_cache); } L = { 0 }, DEBUG_ALIAS(L, L_asset_cache);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -116,12 +116,9 @@ extern "C" {
#define CT_ASSERT(cond) CT_ASSERT2(cond, __LINE__) #define CT_ASSERT(cond) CT_ASSERT2(cond, __LINE__)
#if DEBINFO #if DEBINFO
/* For use after a static 'L' state variable is declared. This will create a # define DEBUG_ALIAS(var, alias) __attribute((used)) *(alias) = &(var);
* variable that points to the 'L' variable and is kept alive (so that the
* debugger can reference the state with a variable other than 'L') */
# define DEBUG_LVAR(var) __attribute((used)) *var = &L;
#else #else
# define DEBUG_LVAR(var) __attribute((unused)) *var = &L; # define DEBUG_ALIAS(var, alias) __attribute((unused)) *(alias) = &(var);
#endif #endif
#if RTC #if RTC

View File

@ -6,7 +6,7 @@
GLOBAL struct { GLOBAL struct {
struct renderer_handle solid_white; struct renderer_handle solid_white;
} L = { 0 }, DEBUG_LVAR(L_draw); } L = { 0 }, DEBUG_ALIAS(L, L_draw);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -46,7 +46,7 @@ struct font_task_params_store {
GLOBAL struct { GLOBAL struct {
struct font_task_params_store params; struct font_task_params_store params;
} L = { 0 }, DEBUG_LVAR(L_font); } L = { 0 }, DEBUG_ALIAS(L, L_font);
/* ========================== * /* ========================== *
* Startup * Startup
@ -306,7 +306,7 @@ struct font_task_params_store {
GLOBAL struct { GLOBAL struct {
struct font_task_params_store params; struct font_task_params_store params;
} L = { 0 }, DEBUG_LVAR(L_font); } L = { 0 }, DEBUG_ALIAS(L, L_font);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -23,7 +23,7 @@ GLOBAL struct {
struct sys_mutex published_tick_mutex; struct sys_mutex published_tick_mutex;
struct world published_tick; struct world published_tick;
struct atomic_u64 published_tick_id; struct atomic_u64 published_tick_id;
} L = { 0 }, DEBUG_LVAR(L_game); } L = { 0 }, DEBUG_ALIAS(L, L_game);
/* ========================== * /* ========================== *
* Game cmd * Game cmd

View File

@ -20,7 +20,7 @@ GLOBAL struct {
log_event_callback_func *callbacks_head; log_event_callback_func *callbacks_head;
struct sys_file file; struct sys_file file;
b32 file_valid; b32 file_valid;
} L = { 0 }, DEBUG_LVAR(L_log); } L = { 0 }, DEBUG_ALIAS(L, L_log);
GLOBAL READONLY const struct log_level_settings g_log_level_settings[LOG_LEVEL_COUNT] = { GLOBAL READONLY const struct log_level_settings g_log_level_settings[LOG_LEVEL_COUNT] = {
[LOG_LEVEL_CRITICAL] = { [LOG_LEVEL_CRITICAL] = {

View File

@ -64,7 +64,7 @@ GLOBAL struct {
struct track *track_last_playing; struct track *track_last_playing;
u64 track_playing_count; u64 track_playing_count;
struct track *track_first_free; struct track *track_first_free;
} L = { 0 }, DEBUG_LVAR(L_mixer); } L = { 0 }, DEBUG_ALIAS(L, L_mixer);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -42,7 +42,7 @@ GLOBAL struct {
WAVEFORMATEX *buffer_format; WAVEFORMATEX *buffer_format;
u32 buffer_frames; u32 buffer_frames;
HANDLE mmtc_handle; HANDLE mmtc_handle;
} L = { 0 }, DEBUG_LVAR(L_playback_wasapi); } L = { 0 }, DEBUG_ALIAS(L, L_playback_wasapi);
/* ========================== * /* ========================== *
* Initialize * Initialize

View File

@ -143,7 +143,7 @@ GLOBAL struct {
struct dx11_shader_desc shader_info[NUM_SHADERS]; struct dx11_shader_desc shader_info[NUM_SHADERS];
} L = { 0 }, DEBUG_LVAR(L_renderer_d3d11); } L = { 0 }, DEBUG_ALIAS(L, L_renderer_d3d11);
/* ========================== * /* ========================== *
* Util * Util

View File

@ -12,7 +12,7 @@
GLOBAL struct { GLOBAL struct {
struct arena arena; struct arena arena;
struct tar_archive archive; struct tar_archive archive;
} L = { 0 }, DEBUG_LVAR(L_resource); } L = { 0 }, DEBUG_ALIAS(L, L_resource);
#endif #endif
struct resource_startup_receipt resource_startup(void) struct resource_startup_receipt resource_startup(void)

View File

@ -29,7 +29,7 @@ struct sheet_task_params_store {
GLOBAL struct { GLOBAL struct {
struct sheet_task_params_store params; struct sheet_task_params_store params;
} L = { 0 }, DEBUG_LVAR(L_sheet); } L = { 0 }, DEBUG_ALIAS(L, L_sheet);
/* ========================== * /* ========================== *

View File

@ -29,7 +29,7 @@ struct sound_task_params_store {
GLOBAL struct { GLOBAL struct {
struct sound_task_params_store params; struct sound_task_params_store params;
} L = { 0 }, DEBUG_LVAR(L_sound); } L = { 0 }, DEBUG_ALIAS(L, L_sound);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -116,7 +116,7 @@ GLOBAL struct {
struct sys_mutex windows_mutex; struct sys_mutex windows_mutex;
struct arena windows_arena; struct arena windows_arena;
struct win32_window *first_free_window; struct win32_window *first_free_window;
} L = { 0 }, DEBUG_LVAR(L_sys_win32); } L = { 0 }, DEBUG_ALIAS(L, L_sys_win32);
/* ========================== * /* ========================== *
* Events * Events

View File

@ -32,7 +32,7 @@ struct texture_task_params_store {
GLOBAL struct { GLOBAL struct {
struct texture_task_params_store params; struct texture_task_params_store params;
} L = { 0 }, DEBUG_LVAR(L_texture); } L = { 0 }, DEBUG_ALIAS(L, L_texture);
/* ========================== * /* ========================== *
* Startup * Startup

View File

@ -13,7 +13,7 @@ GLOBAL struct {
struct atomic_i64 metas_lock_flag; struct atomic_i64 metas_lock_flag;
u64 metas_count; u64 metas_count;
struct thread_local_var_meta metas[MAX_THREAD_LOCAL_VARS]; struct thread_local_var_meta metas[MAX_THREAD_LOCAL_VARS];
} L = { 0 }, DEBUG_LVAR(L_thread_local); } L = { 0 }, DEBUG_ALIAS(L, L_thread_local);
INTERNAL void metas_lock(void) INTERNAL void metas_lock(void)
{ {

View File

@ -31,7 +31,7 @@ extern "C"
GLOBAL struct { GLOBAL struct {
/* FIXME: Do we need to wrap this in a mutex? */ /* FIXME: Do we need to wrap this in a mutex? */
IDWriteFactory5 *factory; IDWriteFactory5 *factory;
} L = { 0 }, DEBUG_LVAR(L_ttf_dwrite); } L = { 0 }, DEBUG_ALIAS(L, L_ttf_dwrite);
/* ========================== * /* ========================== *
* Decode font * Decode font
@ -335,7 +335,7 @@ extern "C"
GLOBAL struct { GLOBAL struct {
/* FIXME: Do we need to wrap this in a mutex? */ /* FIXME: Do we need to wrap this in a mutex? */
IDWriteFactory5 *factory; IDWriteFactory5 *factory;
} L = { 0 }, DEBUG_LVAR(L_ttf_dwrite); } L = { 0 }, DEBUG_ALIAS(L, L_ttf_dwrite);
/* ========================== * /* ========================== *
* Decode font * Decode font

View File

@ -85,7 +85,7 @@ GLOBAL struct {
struct v2 viewport_center; struct v2 viewport_center;
struct v2 viewport_cursor; struct v2 viewport_cursor;
struct v2 world_cursor; struct v2 world_cursor;
} L = { 0 }, DEBUG_LVAR(L_user); } L = { 0 }, DEBUG_ALIAS(L, L_user);
/* ========================== * /* ========================== *
* Bind state * Bind state

View File

@ -86,7 +86,7 @@ GLOBAL struct {
/* Pointers to the last piece of work of each priority in the scheduled /* Pointers to the last piece of work of each priority in the scheduled
* work list (used for O(1) insertion) */ * work list (used for O(1) insertion) */
struct work *scheduled_work_priority_tails[NUM_WORK_PRIORITIES]; struct work *scheduled_work_priority_tails[NUM_WORK_PRIORITIES];
} L = { 0 }, DEBUG_LVAR(L_work); } L = { 0 }, DEBUG_ALIAS(L, L_work);
/* ========================== * /* ========================== *
* Thread local state * Thread local state