start work on raddbg building

This commit is contained in:
Ryan Fleury
2024-07-16 17:23:08 -07:00
parent de131b0c18
commit ec9c68f55e
9 changed files with 403 additions and 118 deletions
+3 -2
View File
@@ -14,7 +14,7 @@ if [ "$gcc" = "1" ]; then clang=0 && echo "[gcc compile]"; fi
auto_compile_flags='' auto_compile_flags=''
# --- Compile/Link Line Definitions ------------------------------------------- # --- Compile/Link Line Definitions -------------------------------------------
clang_common='-I../src/ -I../local/ -gcodeview -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf' clang_common='-I../src/ -I../local/ -gcodeview -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Wno-for-loop-analysis -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf'
clang_debug="clang -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}" clang_debug="clang -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}"
clang_release="clang -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}" clang_release="clang -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}"
clang_link="-lpthread" clang_link="-lpthread"
@@ -22,6 +22,7 @@ clang_out="-o"
# --- Per-Build Settings ------------------------------------------------------ # --- Per-Build Settings ------------------------------------------------------
link_dll="-fPIC" link_dll="-fPIC"
link_os_gfx="-lX11 -lXext"
# --- Choose Compile/Link Lines ----------------------------------------------- # --- Choose Compile/Link Lines -----------------------------------------------
if [ "$clang" = "1" ]; then compile_debug="$clang_debug"; fi if [ "$clang" = "1" ]; then compile_debug="$clang_debug"; fi
@@ -47,7 +48,7 @@ fi
# --- Build Everything (@build_targets) --------------------------------------- # --- Build Everything (@build_targets) ---------------------------------------
cd build cd build
if [ "$raddbg" = "1" ]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $compile_link $out raddbg || exit 1; fi if [ "$raddbg" = "1" ]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $compile_link $link_os_gfx $out raddbg || exit 1; fi
if [ "$rdi_from_pdb" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_pdb/rdi_from_pdb_main.c $compile_link $out rdi_from_pdb || exit 1; fi if [ "$rdi_from_pdb" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_pdb/rdi_from_pdb_main.c $compile_link $out rdi_from_pdb || exit 1; fi
if [ "$rdi_from_dwarf" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_dwarf/rdi_from_dwarf.c $compile_link $out rdi_from_dwarf || exit 1; fi if [ "$rdi_from_dwarf" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_dwarf/rdi_from_dwarf.c $compile_link $out rdi_from_dwarf || exit 1; fi
if [ "$rdi_dump" = "1" ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump || exit 1; fi if [ "$rdi_dump" = "1" ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump || exit 1; fi
+9
View File
@@ -191,7 +191,16 @@
# endif # endif
#elif OS_LINUX #elif OS_LINUX
# if ARCH_X64 # if ARCH_X64
# define ins_atomic_u64_eval(x) __sync_fetch_and_add((volatile U64 *)(x), 0)
# define ins_atomic_u64_inc_eval(x) __sync_fetch_and_add((volatile U64 *)(x), 1) # define ins_atomic_u64_inc_eval(x) __sync_fetch_and_add((volatile U64 *)(x), 1)
# define ins_atomic_u64_dec_eval(x) __sync_fetch_and_sub((volatile U64 *)(x), 1)
# define ins_atomic_u64_eval_assign(x,c) __sync_lock_test_and_set((volatile U64 *)(x),(c))
# define ins_atomic_u64_add_eval(x,c) __sync_fetch_and_add((volatile U64 *)(x), c)
# define ins_atomic_u64_eval_cond_assign(x,k,c) __sync_val_compare_and_swap((volatile U64 *)(x),(c),(k))
# define ins_atomic_u32_eval(x,c) __sync_fetch_and_add((volatile U32 *)(x), 0)
# define ins_atomic_u32_eval_assign(x,c) __sync_lock_test_and_set((volatile U32 *)(x),(c))
# define ins_atomic_u32_eval_cond_assign(x,k,c) __sync_val_compare_and_swap((volatile U32 *)(x),(c),(k))
# define ins_atomic_ptr_eval_assign(x,c) (void*)ins_atomic_u64_eval_assign((volatile U64 *)(x), (U64)(c))
# else # else
# error Atomic intrinsics not defined for this operating system / architecture combination. # error Atomic intrinsics not defined for this operating system / architecture combination.
# endif # endif
+251
View File
@@ -0,0 +1,251 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
internal void
os_gfx_init(void)
{
}
////////////////////////////////
//~ rjf: @os_hooks Graphics System Info (Implemented Per-OS)
internal OS_GfxInfo *
os_get_gfx_info(void)
{
return 0;
}
////////////////////////////////
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
internal void
os_set_clipboard_text(String8 string)
{
}
internal String8
os_get_clipboard_text(Arena *arena)
{
}
////////////////////////////////
//~ rjf: @os_hooks Windows (Implemented Per-OS)
internal OS_Handle
os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title)
{
}
internal void
os_window_close(OS_Handle handle)
{
}
internal void
os_window_first_paint(OS_Handle window_handle)
{
}
internal void
os_window_equip_repaint(OS_Handle handle, OS_WindowRepaintFunctionType *repaint, void *user_data)
{
}
internal void
os_window_focus(OS_Handle handle)
{
}
internal B32
os_window_is_focused(OS_Handle handle)
{
}
internal B32
os_window_is_fullscreen(OS_Handle handle)
{
}
internal void
os_window_set_fullscreen(OS_Handle handle, B32 fullscreen)
{
}
internal B32
os_window_is_maximized(OS_Handle handle)
{
}
internal void
os_window_set_maximized(OS_Handle handle, B32 maximized)
{
}
internal void
os_window_minimize(OS_Handle handle)
{
}
internal void
os_window_bring_to_front(OS_Handle handle)
{
}
internal void
os_window_set_monitor(OS_Handle window_handle, OS_Handle monitor)
{
}
internal void
os_window_clear_custom_border_data(OS_Handle handle)
{
}
internal void
os_window_push_custom_title_bar(OS_Handle handle, F32 thickness)
{
}
internal void
os_window_push_custom_edges(OS_Handle handle, F32 thickness)
{
}
internal void
os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect)
{
}
internal Rng2F32
os_rect_from_window(OS_Handle handle)
{
}
internal Rng2F32
os_client_rect_from_window(OS_Handle handle)
{
}
internal F32
os_dpi_from_window(OS_Handle handle)
{
}
////////////////////////////////
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
internal OS_HandleArray
os_push_monitors_array(Arena *arena)
{
}
internal OS_Handle
os_primary_monitor(void)
{
}
internal OS_Handle
os_monitor_from_window(OS_Handle window)
{
}
internal String8
os_name_from_monitor(Arena *arena, OS_Handle monitor)
{
}
internal Vec2F32
os_dim_from_monitor(OS_Handle monitor)
{
}
////////////////////////////////
//~ rjf: @os_hooks Events (Implemented Per-OS)
internal void
os_send_wakeup_event(void)
{
}
internal OS_EventList
os_get_events(Arena *arena, B32 wait)
{
}
internal OS_EventFlags
os_get_event_flags(void)
{
}
internal B32
os_key_is_down(OS_Key key)
{
}
internal Vec2F32
os_mouse_from_window(OS_Handle handle)
{
}
////////////////////////////////
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
internal void
os_set_cursor(OS_Cursor cursor)
{
}
////////////////////////////////
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
internal void
os_graphical_message(B32 error, String8 title, String8 message)
{
}
////////////////////////////////
//~ rjf: @os_hooks Shell Operations
internal void
os_show_in_filesystem_ui(String8 path)
{
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef OS_GFX_LINUX_H
#define OS_GFX_LINUX_H
////////////////////////////////
//~ rjf: Includes
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/sync.h>
#endif // OS_GFX_LINUX_H
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright (c) 2024 Epic Games Tools // Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/) // Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef OS_GRAPHICAL_H #ifndef OS_GFX_H
#define OS_GRAPHICAL_H #define OS_GFX_H
//////////////////////////////// ////////////////////////////////
//~ rjf: Graphics System Info //~ rjf: Graphics System Info
@@ -188,4 +188,4 @@ internal void os_graphical_message(B32 error, String8 title, String8 m
internal void os_show_in_filesystem_ui(String8 path); internal void os_show_in_filesystem_ui(String8 path);
#endif // OS_GRAPHICAL_H #endif // OS_GFX_H
+10
View File
@@ -6,6 +6,16 @@ os_gfx_init(void)
{ {
} }
////////////////////////////////
//~ rjf: @os_hooks Graphics System Info (Implemented Per-OS)
internal OS_GfxInfo *
os_get_gfx_info(void)
{
local_persist OS_GfxInfo g = {0};
return &g;
}
//////////////////////////////// ////////////////////////////////
//~ rjf: @os_hooks Clipboards (Implemented Per-OS) //~ rjf: @os_hooks Clipboards (Implemented Per-OS)