4271 Commits
Author SHA1 Message Date
ed 132cf395b2 Merge remote-tracking branch 'EpicGamesExt/master' 2026-08-07 00:46:42 -04:00
Ryan Fleury 076d41130c fix qualified identifier expression tree buil 2026-07-29 11:40:41 -07:00
Ryan Fleury ba9d36624d lexer fixes; eval2 resolution qualifiers 2026-07-29 11:35:28 -07:00
Ryan Fleury b27585476a fix popup controls 2026-07-28 14:12:27 -07:00
Ryan Fleury 0fe5aa5a43 first pass at watch expr location locks - still some jank around the edges due to eval incompleteness, but works for basic cases 2026-07-28 11:18:00 -07:00
Ryan Fleury ae8960d563 watch lock (ui part, no caching yet) 2026-07-28 07:42:44 -07:00
Ryan Fleury ec520227c5 enforce standalone 'expression' child for watch expressions in cfg tree, adjust eval / ui to work on that child, instead of assuming the first child of a watch expression node is the expression string itself - this will let us tag watch expressions with other info, like project / lock status etc. 2026-07-27 16:02:10 -07:00
Ryan Fleury 0b4c20b165 fix the lack of using contextual cursor info to commit to command parameter registers 2026-07-27 15:50:52 -07:00
Ryan Fleury 81722ebbac fix oob mouse -> line path 2026-07-27 14:47:41 -07:00
Ryan Fleury 41735fbf8b fix mismatched spaces for token/line dragging 2026-07-27 14:47:41 -07:00
Ryan Fleury 0c434583bc eval, local variable resolution -> do not assume offset evaluations. infer evaluation mode from location info 2026-07-27 14:47:40 -07:00
Ryan Fleury 7fbea68613 fix line-terminated tokens causing incorrect token pt parsing - e.g. unmatched quote in a comment 2026-07-27 14:47:40 -07:00
Ryan Fleury 62241f0d55 fix text search fwds/bwds 2026-07-27 14:47:39 -07:00
Ryan Fleury aa94eb6901 fix find-text-forward 2026-07-27 14:47:38 -07:00
Ryan Fleury 65f5b81d49 fix incorrect multiline hotkey mode setting in text view 2026-07-27 14:47:38 -07:00
Ryan Fleury a27dc03ca2 start meta tokens correctly 2026-07-27 14:47:37 -07:00
Ryan Fleury e55fa733fd mostly restore existing read-only functionality, keep existing patching infrastructure but do not use 2026-07-27 14:47:36 -07:00
Ryan Fleury 9ed2e020e8 checkpoint 2026-07-27 14:47:36 -07:00
Ryan Fleury f247d3c52d fix chunk-up/down 2026-07-27 14:47:35 -07:00
Ryan Fleury 150a2247bb fix page-up 2026-07-27 14:47:34 -07:00
Ryan Fleury 604fe35d91 fix navigations when zero-delta-on-select is enabled in multi-line controls; thread line break parsing 2026-07-27 14:47:34 -07:00
Ryan Fleury 36da346590 binary search for off -> line num 2026-07-27 14:47:33 -07:00
Ryan Fleury c8dae72968 cleanup around single vs. multiline text mutation controls 2026-07-27 14:47:32 -07:00
Ryan Fleury 315e0672d3 checkpoint on text patches 2026-07-27 14:47:31 -07:00
Ryan Fleury bb85f6f692 text patches: checkpoint 2026-07-27 14:47:31 -07:00
Nikita Smith cd82268a07 polish ICF section color-space picker 2026-07-27 14:47:30 -07:00
Nikita Smith 4235fa85b4 search small libraries on the main thread to reduce wait times in barriers 2026-07-27 14:47:29 -07:00
Nikita Smith db0151c3e2 parallel radix sort and coalesce adjacent section contribs 2026-07-27 14:47:29 -07:00
Nikita Smith bbb136c9ea radix sort pass over section contribs 2026-07-27 14:47:28 -07:00
Nikita Smith 2d827ac15d make const data eligible for ICF 2026-07-27 14:47:28 -07:00
Nikita Smith c629c5b10e refactor PDB background file output
Add a shared multi-file background writer with lazy worker startup.
Represent PDB output as a file artifact, keep PDB output state internal
to the builder, and overlap deferred PDB writers with the file maps release.
2026-07-27 14:47:27 -07:00
Nikita Smith c96c9620d0 WIP PDB Writer Thread 2026-07-27 14:47:26 -07:00
Nikita Smith a73e3e0790 use cycle tracking only on weak and undefined symbols
* profile of /OPT:REF shows that early push to seen_hm dominates the pass;
  cost: 74.23ms -> 6.81ms (-90.8%)
2026-07-27 14:47:26 -07:00
Nikita Smith fcee35f3e9 rename RAD_TypeHashAlg; extend /RAD_DEBUG_TYPE_HASH with XXHASH option 2026-07-27 14:47:25 -07:00
Nikita Smith 97a1fe6006 radix sort PSI address map 2026-07-27 14:47:24 -07:00
Nikita Smith 134cfce799 merge debug info and llvm_addrsig finders into lnk_obj_initer to reduce
time spent in barrier_wait
2026-07-27 14:47:24 -07:00
Nikita Smith 4cc0f4813b WIP cache COFF symbol interp 2026-07-27 14:47:23 -07:00
Nikita Smith a779d3f1a5 WIP assigned symbols 2026-07-27 14:47:22 -07:00
Nikita Smith 493241c1da WIP light COFF symbol table parse 2026-07-27 14:47:22 -07:00
Nikita Smith bd2cbfc127 gate for page pre-faulting on windows 2026-07-27 14:47:21 -07:00
Nikita Smith cb6443ce4e release file maps before exit in parallel before exit 2026-07-27 14:47:20 -07:00
Nikita Smith 58b5b3d92d search chunks only grow while resolving libraries, so revisit only symbols appended since this library's last search 2026-07-27 14:47:20 -07:00
Nikita Smith b84d32d9fb optimize ICF refinement and COMDAT handling
Cache immutable section and relocation metadata before color refinement,
then reuse generated-tagged concurrent tables.

Parallelize grouping and fold marking.

Include associative COMDAT descendants in contribution hashes and
canonicalize relocation targets to selected COMDAT leaders.
2026-07-27 14:47:19 -07:00
Nikita Smith abfea7c33a update CHANGELOG.md 2026-07-27 14:47:18 -07:00
Nikita Smith d1b0bc0af7 refine COMDAT symlink handling
Stop treating COMDAT section-definition symbols as symlink anchors.
Keep zero-sized COMDAT sections only when they have an owned symlink,
so referenced empty COMDAT symbols still resolve while marker sections
like .gsspr/.gssep are skipped.

Update COMDAT/ICF tests to cover zero-sized COMDAT relocation behavior
and the adjusted removed-COMDAT handling.
2026-07-27 14:47:18 -07:00
Nikita Smith 8ec931d724 fix import data directory bounds
Include the null import descriptor in the import directory size and derive
the IAT directory RVA from the first import descriptor of the start of
the .idata contribution.
2026-07-27 14:47:17 -07:00
Nikita Smith 048b93b166 remove empty sections if it does not have any section contributions too 2026-07-27 14:47:17 -07:00
Nikita Smith f3d2792fb8 simplify COMDAT leader symbol patching
Collapse COMDAT leader symbol patching to a single raw-symbol write path
and make the same-object versus cross-object symlink handling explicit.
Preserve public symbol offsets for ICF folds while avoiding cross-object
section number rewrites.
2026-07-27 14:47:16 -07:00
Nikita Smith 7197398f31 split external-symbol handling from section-definition fallbacks 2026-07-27 14:47:15 -07:00
Nikita Smith d790412219 refactor radlink section gathering
Fold section definition and contributions collection into a worker-count
task with barriers around the serial merge. Share section filtering
between both phases and keep zero-size COMDATs so offset-zero symbols
still map to a section.
2026-07-27 14:47:15 -07:00
Nikita Smith b77c958b5f add DEF, GUARD, and SECTION config support
Parse /DEF, /GUARD, and /SECTION switches, including DEF
handling for NAME/LIBRARY, BASE, VERSION, HEAPSIZE, STACKSIZE, EXPORTS,
and SECTIONS.

Store section directives in linker config and apply them consistently
when gathering object sections when pushing/searching image sections.

Pull load-config symbols for /GUARD without setting GUARD_CF until guard
tables are emitted.

Add coverage for DEF file parity, section directives, and guard
load-config handling.
2026-07-27 14:47:14 -07:00
Nikita Smith 35722f2a01 handle BOMs in linker response files
Decode UTF-16LE response files with a BOM and strip UTF-8 BOMs before
parsing arguments. Add coverage for UTF-16 response-file input.
2026-07-27 14:47:13 -07:00
Nikita Smith 25430ea522 assign COMDAT symlinks after weak symbol replacement
Previously, COMDAT symlinks were assigned as each object batch was loaded.
Weak symbol replacement could later change the selected leader, leaving
objects from earlier passes with stale COMDAT leader refs. Library search
does not need symlinks to be valid, so solve this by doing a single sweep
assignment of COMDAT leaders after a fixed point is found.
2026-07-27 14:47:13 -07:00
Nikita Smith 65541eaf91 LLVM BC magic sniffer 2026-07-27 14:47:12 -07:00
Nikita Smith afd454b41f fix DBI SC image-section range mapping
Log and skip section contributions that fail to map into the linked image.
Keep a file-range-to-section-number map so compact file ranges produce the
correct DBI section numbers.
2026-07-27 14:47:12 -07:00
Nikita Smith 541727b819 debug log unresolved symbols specified in .llvm_addrsig 2026-07-27 14:47:11 -07:00
Nikita Smith 3eeae8d365 enable binary for stdout and stderr to bypass CRLF mangling issues in
captured output under build systems
2026-07-27 14:47:10 -07:00
Nikita Smith 83c55aebdc check that __imp_* archive symbols are import members before applying
import queue flags to the member
2026-07-27 14:47:09 -07:00
Nikita Smith 941b8a011e duplicate identical search aliases are not an error case 2026-07-27 14:47:09 -07:00
Nikita Smith d34e1a7802 implement /OPT:ICF
Add identical COMDAT folding using a color-refinement over foldable
read-only sections. Hash section contents, relocation targets, and target
colors until partitions stabilize, then redirect folded COMDAT symlinks
and discard duplicate sections.

Honor .llvm_addrsig via /LLVM_ADDRSIG so address-significant sections
are not folded, keep separate color space for code, unwind info, and
MSVC vftables, and update COMDAT symbol/section mapping after folding.

Add linker tests covering function folding, relocation-sensitive folds,
alignment, color-space separation, symlink chains, .llvm_addrsig,
pdata/xdata, and C++ ICF cases.
2026-07-27 14:47:08 -07:00
Nikita Smith 1ea9fae835 debug report live stats after /OPT:REF pass 2026-07-27 14:47:08 -07:00
Ryan Fleury 62328cea3f checkpoint on text patches 2026-07-27 14:47:07 -07:00
Ryan Fleury 20cd955cc9 eval2: first pass at type_key -> string path 2026-07-27 14:47:06 -07:00
Ryan Fleury 0963f4a6de const/volatile/unsigned/signed type operators 2026-07-27 14:47:06 -07:00
Ryan Fleury 78d12eb914 custom module loads -> support manually specifying pdb path 2026-07-23 20:28:52 -07:00
Ryan Fleury b0841ff2da first pass at custom load-module exception (long term for JIT) 2026-07-23 20:22:54 -07:00
Ryan Fleury 16c447bb79 eval2: leaf bytecode in ir tree 2026-06-28 07:36:24 -07:00
Ryan Fleury 96cfb441fd correctly use command titles in native file explorer 2026-06-27 12:07:24 -07:00
Ryan Fleury 0e2b4ac5e7 ui discoverability adjustments 2026-06-27 06:21:31 -07:00
Ryan Fleury 969851b6f0 flip NO_ASYNC; turn on as needed, if a layer requiring it is included 2026-06-27 04:54:30 -07:00
Ryan Fleury 410a8e3afa eval2: function pointer type parsing/compiling 2026-06-27 04:43:58 -07:00
Ryan Fleury cae9754099 eval2: fix parsing task popping rules, still give chance to rhs when popping tasks in all cases 2026-06-27 04:25:05 -07:00
Ryan Fleury b704e797e2 notes 2026-06-27 03:50:17 -07:00
Ryan Fleury 773e6554dc cycle detection in fully qualified string generation 2026-06-26 20:35:50 -07:00
Ryan Fleury fdbcf7ccdc eval2: first pass at c recursive type expression parsing 2026-06-26 16:19:19 -07:00
Ryan Fleury f1f654ecfd eval2: simplify expression parsing info, allow child reversal (for parsing non-canonical expression orders into canonical shapes, e.g. Rust-style casts like 123 as float32 -> cast(float32, 123); ptr/array type operators, etc./ 2026-06-26 13:20:38 -07:00
Ryan Fleury 60b266a1cc support size_of and type_of in clike expressions 2026-06-26 11:28:01 -06:00
Ryan Fleury 9491fdf5c2 eval2: split out expression kinds from parse styles of expressions - lets us separate semantic expression tree from frontend, so that we can easily switch frontend 2026-06-26 11:22:43 -06:00
Ryan Fleury bcbc5e4a2a eval2: macro argument expression tree parsing 2026-06-26 10:07:02 -06:00
Ryan Fleury d7393b2f65 eval2: split string -> expr compilation path into frontend / middle end - string -> expr, where expr is a loose structural syntax tree (where we can get macros and stuff without doing typechecking etc.), and expr -> irtree, where irtree is the usual typed / typechecked / ir structured representation - preserve minimal identifier resolution path for parser, but move most resolution things to the middle-end 2026-06-25 15:48:14 -07:00
Ryan Fleury c2b74260ef eval2: opkind -> exprkind, prepare for exprs being looser 2026-06-25 13:58:03 -07:00
Ryan Fleury 6b52d68c62 eval2 checkpoint: type operations, constructed types, checkpoint before splitting back to frontend / compiler split - we need to do things with the parse tree that we can't with an ir tree 2026-06-25 13:50:16 -07:00
Ryan Fleury c1b3461709 eval2: switch to extrusive lists for expression lists - this lets us reuse expression trees. also solve strange isolated unload module events in win32 demon as well 2026-06-25 11:36:18 -06:00
Ryan Fleury 6c309038ce dbg_engine: ctrl thread - be robust to strange duplicate module unload events 2026-06-25 09:51:13 -06:00
Ryan Fleury 9d651f4bd5 EpicGamesExt -> EpicGames 2026-06-25 09:08:52 -06:00
Ryan Fleury 38c1e2a414 eval2: ptr arithmetic & comparisons 2026-06-25 09:07:34 -06:00
Ryan Fleury c817d1f136 eval2: type keys checkpoint 2026-06-24 20:39:53 -07:00
Ryan Fleury 296c851272 eval2 checkpoint: casts, function calls, expression-embedded identifier definitions, ternaries, compile-time ternaries 2026-06-24 16:29:57 -07:00
Ryan Fleury 6b841d9959 rdi_make: allow duplicates in bake name map insertions - they become extremely costly to check for, and we don't produce them anyways... 2026-06-24 07:20:06 -06:00
Ryan Fleury 1901e67f39 use synchronous reads for call stack computation, but extend artifact cache with the ability to say that a non-retryable failure occurred, so that we can fall back to stale call stacks 2026-06-23 20:00:57 -06:00
ed 3de96443a5 Merge remote-tracking branch 'EpicGamesExt/master'
# Conflicts:
#	.gitignore
2026-06-23 20:12:24 -04:00
Ryan Fleury 3d6851c57a rdi_from_Dwarf: count dependency counts correctly when using cached type content hashes 2026-06-23 16:07:53 -07:00
Nikita Smith 4daefad31e map GNU lib extension 2026-06-23 12:32:52 -07:00
Nikita Smith 765b61152d sort import library member refs by input index 2026-06-23 12:32:52 -07:00
Nikita Smith ad20900fc0 import hash table -> hash map 2026-06-23 12:32:51 -07:00
Nikita Smith 8dbced6995 set flag on import member from the originally linked library, otherwise
on subsequent passes linker may queue same import
2026-06-23 12:32:50 -07:00
Nikita Smith 84d025e940 force inline string compars 2026-06-23 12:32:50 -07:00
Ryan Fleury 98b7b5859c rdi_from_dwarf: stub out pointers for now, cache as we go, merge type dependency count calculation with hash computation 2026-06-23 12:32:11 -07:00
Ryan Fleury 28009ec01e rdi_from_dwarf type dedup hashing experiments checkpoint 2026-06-23 10:05:28 -07:00
Ryan Fleury a425936f56 run_tests test data download -> fail if curl fails, follow http redirects 2026-06-22 14:42:50 -07:00
Ryan Fleury fef78609d8 turn off d2r tests for now while new deduper is in progress; better tag skipping in dedup hashing 2026-06-22 14:25:25 -07:00
Martins Mozeiko 401383bbd8 reorganize intrinsic includes to make clang happy 2026-06-22 14:21:01 -07:00
Ryan Fleury 76fa2be5a9 correct arch flags to clang 2026-06-22 13:45:53 -07:00
Ryan Fleury c8c8e02ab0 Revert "use CL driver when compiling with clang on windows to simplify compile and link lines"
This reverts commit ba32d7fdec.

This causes tons of compatibility issues, some of which were preventing
Clang builds on specific Clang versions due to command line
incompatibility between lld-link and link.
2026-06-22 13:44:18 -07:00
Ryan Fleury e2430fa23e remove redundant incs of xxhash - undef cpuid macro before xxhash is
included, so that we don't have conflicting definitions due to memfun
2026-06-22 13:43:19 -07:00
Ryan Fleury 28d037a924 checkpoint on faster rdi_from_dwarf type/namespace deduping 2026-06-22 13:31:08 -07:00
Ryan Fleury 73e9f3c9da rdi_from_dwarf: determinism / regression tests 2026-06-21 20:56:46 -07:00
Ryan Fleury dac63d6bef fix linux build 2026-06-21 20:47:09 -07:00
Ryan Fleury 286589f4de rdi_from_pdb: exemplar tests 2026-06-21 20:37:52 -07:00
Ryan Fleury c890b806d5 pull out test input/exemplar path formation helpers to base; fix torture crash 2026-06-21 20:13:44 -07:00
Ryan Fleury bc324a9041 remove exemplars from repo; switch to storing on test data server 2026-06-21 19:54:37 -07:00
Ryan Fleury fa4c003f79 run_tests.bat -> download test data if stale 2026-06-21 16:20:37 -07:00
Ryan Fleury ed6afcb180 checkpoint on rdi_from_dwarf pass, start addressing O(N lg N) hashing problem for type content, use sibling tags, etc.; remove test inputs from data/, just rely on local folder (filled via data server) 2026-06-21 15:53:38 -07:00
Ryan Fleury d3d35e40d7 rdi_from_dwarf: use sibling tags to advance in hash path too - set up for deduplicating hash work 2026-06-19 20:53:01 -07:00
Nikita Smith 4f899ac678 update memfun 2026-06-19 20:12:27 -07:00
Nikita Smith 05a024ddb3 remove /RAD_ALT_PCH_DIR
* Instead of matching on file path in LF_PRECOMP, loop over the objects
  with .debug$P and probe leaves at the index specified in LF_PRECOMP.
  If signatures match, use the PCH.
* Demote LNK_Error_PrecompObjNotFound to a recoverable error.
2026-06-19 20:12:27 -07:00
Nikita Smith 9b63131f37 ditch semaphores in thread pool in favor of barriers 2026-06-19 20:12:26 -07:00
Nikita Smith 6ea9bfc5a3 fix tail comparisons 2026-06-19 20:12:25 -07:00
Nikita Smith c81c072018 includes for rdi_from_codeview 2026-06-19 20:12:25 -07:00
Nikita Smith 3534100e8d lazy touch obj string tables 2026-06-19 20:12:24 -07:00
Nikita Smith 9616307503 add extra node to the symbol ref for better insertion per 2026-06-19 20:12:24 -07:00
Nikita Smith 871f94a202 use vectorized memory functions in the base strings 2026-06-19 20:12:23 -07:00
Nikita Smith ba32d7fdec use CL driver when compiling with clang on windows to simplify compile and link lines 2026-06-19 20:12:22 -07:00
Nikita Smith 8ef58def99 update torture
* factor test registration logic out of the macro to improve debuggability
* expand the test registration logic
* rename group -> layer for consistency
* fix indentation in the slow tests summary
2026-06-19 20:12:22 -07:00
Ryan Fleury 0d62c49c52 only rewrite stdout/stderr/etc. if passed cli specifically 2026-06-19 20:12:21 -07:00
Ryan Fleury fe2aa4d14c com shim for launching raddbg in cli mode, for proper console subsystem style usage of packaged bin utilities; checkpoint on eval2 2026-06-19 20:12:20 -07:00
Ryan Fleury 3fd7b40f4d remove 'global stream' specialities in codeview -> rdi conversion; just have the caller pass all units, and in the case of pdb conversion, we simply make a global unit at that layer. 2026-06-19 20:12:20 -07:00
Ryan Fleury 15601d48d4 rdi_from_dwarf: use sibling tag attributes to gather root-level tag offsets when present - 15x speedup in the gather on webkit DWARFs... 2026-06-19 20:11:50 -07:00
Ryan Fleury 9f82a6fe91 fix flipped interpretation of scope address ranges in dwarf - address class implies opl, not size 2026-06-19 12:41:17 -07:00
Ryan Fleury 3b22b1f13e fix incorrect work happening w/ subsets turned off for psym generation 2026-06-19 12:37:43 -07:00
Ryan Fleury 66bca76edd delete non-codeview-backed pdb conversion path, switch over to codeview conversion totally 2026-06-18 08:59:51 -07:00
Ryan Fleury a441a5eef3 plug in codeview-conversion-backed pdb converison 2026-06-18 08:54:41 -07:00
Ryan Fleury d56cd83cac sketch out revised pdb conversion path which just uses the codeview conversion pass 2026-06-18 08:24:02 -07:00
Ryan Fleury c411895db5 sketch out & get building rdi_from_codeview, extract ~90% of pdb conversion into only working given codeview info *or* something the linker could produce 2026-06-18 08:04:32 -07:00
Ryan Fleury 3aad389174 notes 2026-06-17 19:30:08 -07:00
Ryan Fleury cc75260946 checkpoint on eval2; type graph operations, parsing, etc. 2026-06-17 17:38:09 -07:00
Ryan Fleury 11b3f25842 checkpoint on eval2 2026-06-16 17:56:48 -07:00
Nikita Smith b8bad9a82e range helper that computes max part from min+size 2026-06-16 17:22:53 -07:00
Nikita Smith 267b8fc519 missing count in the range list concat 2026-06-16 17:22:52 -07:00
Nikita Smith 956df5527a switch type server from PDB to a custom file format (RRT) 2026-06-16 17:22:50 -07:00
Ryan Fleury 00da627293 checkpoint on eval2 compiler; setting to disable update checking; cache version check to once per day so that we do not send a lot of extra GH requests every time the debugger starts 2026-06-16 14:30:13 -07:00
Ryan Fleury bcdc6acd0e checkpoint on eval2 parse 2026-06-16 12:29:03 -06:00
Ryan Fleury eb87cb053e fix bad sub register block address calculation!!! 2026-06-14 20:20:52 -07:00
Ryan Fleury 7f985b35f3 only do session-start logic once per tick! 2026-06-13 20:22:37 -07:00
Ryan Fleury d9efc61b66 just dump file name in raddbg state dump; commit to exemplars; keep exemplars more context-free 2026-06-13 11:21:42 -07:00
Ryan Fleury 6a2aa95ea3 okay, *now* bump to 28 2026-06-13 06:38:03 -07:00
Nikita Smith c030488814 fallback on PCH signature when file path match fails 2026-06-13 06:20:40 -07:00
Ryan Fleury 6ca7f162aa shift temporarily to 27 2026-06-13 06:17:55 -07:00
Nikita Smith c6a4e4c02b skip broken tests 2026-06-12 15:34:30 -07:00
Nikita Smith 41e6470d28 fix radbin launch in p2r determinism test 2026-06-12 15:34:29 -07:00
Ryan Fleury 58c17c2bc3 fix bad rdi opcode tables! 2026-06-12 15:30:30 -07:00
Ryan Fleury 083a843bf7 bump to 28 2026-06-12 14:10:20 -07:00
Ryan Fleury d83f1fad1a turn off eval2 for now 2026-06-12 14:10:20 -07:00
Nikita Smith 7d8aa18e4d make debug hash section tests error number agnostic 2026-06-12 13:54:29 -07:00
Ryan Fleury 2b20760386 checkpoint on revised eval system; first pass on interpretation; eliminating all callbacks / eval involvement in contexts/spaces/identifier-resolution/etc. 2026-06-12 13:50:28 -07:00
Nikita Smith ac0c7d9441 on checkout do git LFS in github actions 2026-06-12 13:35:10 -07:00
Nikita Smith 7ad422f8ad make run_tests.sh executable 2026-06-12 13:21:31 -07:00
Nikita Smith 2a5070bb87 update change log 2026-06-12 13:17:21 -07:00
Nikita Smith ac8c3e7a2d do not emit relocation for empty resource entry 2026-06-12 12:05:45 -07:00
Nikita Smith 3f6d5df899 apply merge fixes 2026-06-12 11:53:15 -07:00
Nikita Smith 9ce6b9504b centralize section header reads and writes 2026-06-12 11:40:03 -07:00
Nikita Smith 42cf820972 cache for section flags
modifying the section flags is expensive with COW file mappings, Windows
maps are set to 64k granularity
2026-06-12 11:40:02 -07:00
Nikita Smith 3452f23839 add a new boot mode to RADLINK for launching as a type server
checkpoint
2026-06-12 11:40:01 -07:00
Ryan Fleury 2c4882595c eval system notes 2026-06-11 11:10:28 -07:00
Ryan Fleury d45401e8cd pass over default light 2026-06-11 10:28:39 -07:00
Ryan Fleury f1dfe5f6c0 changelog notes 2026-06-11 09:40:39 -07:00
Ryan Fleury 90b650354a eliminate redundant/unused info from command tables in dbg engine / raddbg 2026-06-11 09:08:34 -07:00
Ryan Fleury 82fd06c8e4 specialize text right-click menus by disasm vs. source 2026-06-11 08:51:47 -07:00
Ryan Fleury a980be7664 notes 2026-06-10 12:51:52 -07:00
Ryan Fleury 645cf46e55 explicit process address space evaluation 2026-06-10 11:57:53 -07:00
Ryan Fleury f7ba4b2ebe move from fixed flags to list of tags (matching command list evaluation names) for context menu command filtering; pull out code for filling command regs from contextual expressions; add mechanism for contextualizing a whole query, so that we can spawn command listers within the context of some other evaluation, which we'd like to fill registers with (e.g. right-clicking a module -> spawn a module command list, contextualized by the module evaluation itself 2026-06-10 09:54:57 -07:00
Ryan Fleury 1577ea5693 fix rdi folder writability test to account for possibly-uncreated directories, so that we don't unnecessarily write into the user-local rdi cache 2026-06-10 08:39:40 -07:00
Ryan Fleury 40d9e5839f fix torture; adjust raddbg test exemplar dumping to avoid dumping info for anything other than the main module, so that we don't get non-deterministic dumps (for e.g. system PDBs) 2026-06-10 07:57:18 -07:00
Ryan Fleury 9af4c3d614 W over A win32 window functions; wakeup on WM_CLOSE (manual merge of
cbf3fd5587)
2026-06-10 04:43:01 -07:00
Ryan Fleury 19cb0331b0 fix implicit expr parameterization in add-breakpoint margin click path 2026-06-10 04:29:32 -07:00
Ryan Fleury 5ddad36380 zero undefined registers in eh unwind 2026-06-09 16:18:47 -07:00
Ryan Fleury ffb79a67ef be robust to missing symbol server support 2026-06-09 16:07:16 -07:00
Ryan Fleury 8a098c5d45 adjust rules for text view loading; handle non-evaluations / empty evaluations correctly 2026-06-09 16:02:33 -07:00
Ryan Fleury f57137288b check if rdi path is writable before deciding to convert to it; if it isn't writable, then redirect to a rdi cache directory 2026-06-09 16:02:33 -07:00
Ryan Fleury 2faa9211eb cleanup 2026-06-09 16:02:32 -07:00
Малов Андрей Владимирович 220b288690 render/opengl/linux/egl: unwrap R_OGL_Window when extracting EGL surface 2026-06-09 16:02:31 -07:00
Малов Андрей Владимирович 7f3318309b render/opengl/linux/glx: force GL_DRAW_BUFFER=GL_BACK after make-current 2026-06-09 16:02:31 -07:00
Ryan Fleury c05846aef1 fix incorrect impl of RDI_EvalOp_Swap 2026-06-09 16:02:30 -07:00
Малов Андрей Владимирович be8ed940bd eval: implement Swap; soft-fail CallSiteValue; no-op piece markers 2026-06-09 16:02:30 -07:00
Малов Андрей Владимирович 94da046fb6 demon/linux: derive symbol count from GNU_HASH 2026-06-09 16:02:29 -07:00
Малов Андрей Владимирович d64912be7e render/opengl/linux/egl: pick config in init; pass to context; bind pbuffer 2026-06-09 16:02:28 -07:00
Малов Андрей Владимирович eee1a64d14 render/opengl/linux/glx: publish chosen visual + colormap to os layer 2026-06-09 16:02:28 -07:00
Малов Андрей Владимирович 2e5a97ebf9 os/gfx/linux: create x11 window with gl-chosen visual / colormap 2026-06-09 16:02:27 -07:00
Aiden Shi 562c2e3e5f fix: use fp_flags instead of flags 2026-06-09 15:13:10 -07:00
Daniel Ribeiro Maciel 972df1a467 fix delete button on linux 2026-06-09 15:11:42 -07:00
Ryan Fleury e047e84433 do not assume writable module 2026-06-09 15:01:01 -07:00
Ryan Fleury fde13f52d3 fix nil text visualizations; fix auto-load-recent-project 2026-06-09 14:56:34 -07:00
Ryan Fleury 5ae286d67e setting for auto-downloading missing debug info (off by default); command for manually loading module debug info as-needed 2026-06-09 14:01:09 -07:00
Ryan Fleury 0105b06fef fix conflicting lifetimes in http read - batch of retry-response-body-pieces was conflicting with asynchronous reading state! 2026-06-09 13:14:29 -07:00
Ryan Fleury 27e1e36f5c fix incorrect marking of non-stale results by artifact cache lookup; fix view addr parameterizations when a register value is used 2026-06-09 11:24:54 -07:00
Ryan Fleury 0f02c32c89 pull failed-unwind-step register-block-restore out of each impl, just do it on the caller side; pull out module-less read-the-stack-pointer unwind fallback from pe/x64 unwinder, use in module-less unwinds in all cases; call into from pe/x64 unwinder in fallback case 2026-06-09 10:58:16 -07:00
Ryan Fleury ec4fd23e15 fix incorrect commits in new pe/x64 unwinder; fix bad unwind termination conditions 2026-06-09 10:38:08 -07:00
Ryan Fleury 9955c8c1a7 temporarily turn off symbol server stuff - switch off spoof for step-over 2026-06-09 09:27:23 -07:00
Ryan Fleury 132751777f eliminate unnecessary info in debug engine entity abstraction / demon events; adjust symbol server / debug info loading such that the debug info loader is the one who decides to kick off downloads based on presence in cache path; use cache path as key, unpack info for download requests 2026-06-08 21:06:44 -07:00
Ryan Fleury b22f9f2d8b checkpoint on symbol server 2026-06-08 17:32:07 -07:00
Ryan Fleury 536ca53d18 rdi_from_pdb: sketch out paths for LF_ALIAS 2026-06-08 11:26:17 -07:00
Ryan Fleury 2d6260fc68 remove dummy test file 2026-06-08 11:13:07 -07:00
Ryan Fleury 5c664261a3 symbol server abstraction layer; http layer; fix to 'prefer_disasm' rule when no disassembly tabs are open; small fixes / cleanup 2026-06-08 11:10:14 -07:00
Ryan Fleury 1ef94cb759 fix find-code-location snap rule when src/disasm occupy same panel & they are found by different rules; conflicting panels must be checked across *all* cases 2026-06-06 15:37:24 -07:00
Ryan Fleury dc613f3a08 correctly handle voff evaluations in generalized watch window completion path (offline evaluation in everything palette case) 2026-06-03 14:43:50 -07:00
Ryan Fleury 09f78fdae4 small parameterization to query watches 2026-06-03 14:28:06 -07:00
Ryan Fleury 015ae9c62c set up for memory right clicks 2026-06-03 12:49:39 -07:00
Ryan Fleury d7b59e4a39 break when value changes 2026-06-03 12:37:28 -07:00
Ryan Fleury 3a04a96e03 eval right-click; start with go-to-memory command 2026-06-03 12:16:42 -07:00
Ryan Fleury 6b88ad1ea3 fix incorrect temp pop 2026-06-03 10:34:01 -07:00
Ryan Fleury 0df1b34580 fix spacing 2026-06-03 10:31:45 -07:00
Ryan Fleury 737ceb1313 tweaks / improvements to watch windows & lister ui - display controls, appearance, remove redundant visual info 2026-06-03 10:28:47 -07:00
Ryan Fleury e7153e8910 auto load project only when project is not specified; fix alt menu weirdness on alt+tab 2026-06-03 09:10:53 -07:00
Ryan Fleury 4d1d362ac1 adjust find-code-location path to absolutify relativized paths based on current thread/module; also respect module-relative / debug-info-relative paths in src -> voff & voff -> src mapping 2026-06-03 09:01:51 -07:00
Ryan Fleury fd1ee1c265 radbin: absolutify relative external-file-paths (debug link, pdb-in-exe), to avoid clashing with working-directory files of the same name 2026-06-02 14:41:43 -07:00
Ryan Fleury e958814b07 use fully-qualified names in eval viz address resolved symbol strings, used in call stack / etc. 2026-06-02 12:16:16 -07:00
Ryan Fleury 5a819f8094 setting for auto-loading of recent projects 2026-06-02 12:11:17 -07:00
Ryan Fleury 1673fa5606 enable lfs on github actions 2026-06-02 12:11:16 -07:00
Ryan Fleury 6a2e2eb798 d2r2 -> d2r 2026-06-02 12:11:16 -07:00
Ryan Fleury 6ed6d3f16d rdi_from_dwarf [1] -> obsolete; promote 2 -> 1 2026-06-02 12:11:15 -07:00
Ryan Fleury b75b9b45cc fix radbin 2026-06-02 12:11:15 -07:00
Ryan Fleury a2700de35d dwarf parse/expr/unwind/dump 2 -> 1; move old stuff to obsolete 2026-06-02 12:11:14 -07:00
Ryan Fleury ef5fc82e9c dead code elimination 2026-06-02 12:11:14 -07:00
Ryan Fleury d73ce364b9 major clean-up pass over unwinding/module-info abstraction, + usage in the debug engine. simplified / cleaned up DWARF helpers for unwind info & expressions. decoupling unwinding / DWARF evaluation from memory read callbacks. light module info now prepared by demon layer - debug engine no longer duplicates per-backend parsing. unwind abstraction layer now does thin abstraction over unwinding backends, debug engine only calls abstraction. clean up demon to have fewer ad-hoc 'queries' on handles, and prefer sending info over debug events when possible / when it fits the usage pattern. move DWARF enum specifications to metacode, generate enums/xlists/tables/etc. decouple raddbg/radbin completely from old parsing helpers. replace portion of DWARF dumping; pull out some new parsing helpers from converter / dumper. 2026-06-02 12:11:13 -07:00
Nikita Smith 541d3afefa WIP /RAD_TYPE_SERVER
env vars

replace HashTable with HashMap in config
2026-06-02 12:11:12 -07:00
Nikita Smith 4c8d66b431 fix accidental removal of debug info sections resulting in non-eligible
sections not getting marked with 'is_live'
2026-06-02 12:11:11 -07:00
Nikita Smith 98a281c8a0 hint for installing external libraries 2026-06-02 12:11:11 -07:00
Ryan Fleury 9cc2afc659 eliminate backend-specific module parsing from debug engine ctrl thread; just pass that info back via the demon event 2026-06-02 12:11:10 -07:00
Ryan Fleury d98d6b56d9 check in test input binaries, adjust torture test data path 2026-06-02 12:11:09 -07:00
Ryan Fleury 1c1fef0f97 lfs tracking for exes/pdbs/rdis/elfs 2026-06-02 12:11:08 -07:00
Ryan Fleury 2dee864547 fix fn pointer mismatch on clang builds 2026-06-02 12:11:08 -07:00
Ryan Fleury f72d7bbe61 run -> run_tests 2026-06-02 12:11:07 -07:00
Ryan Fleury c746fadcaa run -> run_tests 2026-06-02 12:11:07 -07:00
Ryan Fleury 4dd22c9e51 re-enable p2r determinism tests 2026-06-02 12:11:06 -07:00
Ryan Fleury d909f187d5 be robust to any line endings in exemplar data 2026-06-02 12:11:06 -07:00
Ryan Fleury 1ea8c48867 raddbg exemplar tests -> use specific hash version, name exemplars by their platform, skip if test data unavailable 2026-06-02 12:11:05 -07:00
Ryan Fleury dc61f20e3b sketch out stepping/eval exemplar testing; step-to-exit first pass 2026-06-02 12:11:04 -07:00
Ryan Fleury a0bf825169 run-to-name, use to 'seed' test binary cases' 2026-06-02 12:11:03 -07:00
Ryan Fleury 8564884d76 raddbg: stepping regression tests 2026-06-02 12:11:02 -07:00
Ryan Fleury 685c408a13 migrate from torture-defined testing markup -> base 2026-06-02 12:11:02 -07:00
Ryan Fleury 4e72553006 promote test-definition concepts from torture to base layer; reorganize tests to be nested in their respective layer; eliminate 't_group', just use containing layer 2026-06-02 12:11:01 -07:00
Nikita Smith a151df283f skip tests without directive, and escape * in ubuntu run 2026-06-02 12:11:00 -07:00
Nikita Smith 3a109a7343 sketch test for SYSV and GNU style hash tables 2026-06-02 12:11:00 -07:00
Nikita Smith 637a0f88b2 add run_to_line command; clean up pass over script parser; changed
harness to always compile and link tests to prevent code rotting
2026-06-02 12:10:59 -07:00
Nikita Smith e3fa8e4830 improve error reports in tests 2026-06-02 12:10:58 -07:00
Nikita Smith fe2778133f rework file directive handling; remove T_Group; add SKIP to disable
tests that are not passing; change command line syntax for easier
test run/skip/force; updated help; shortened --dbg_graphical -> --gui;
add 'skip' directive to the dbg scripts
2026-06-02 12:10:58 -07:00
Nikita Smith a21a256333 .gitattributes 2026-06-02 12:10:57 -07:00
Ryan Fleury 769bda0ed8 restore torture mdesk tests 2026-06-02 12:10:57 -07:00
Ryan Fleury 96c1ca549c Revert "export line and column numbers from MD"
This reverts commit 29becc3bfa6037a1ba5c5657f891a65a819b0997.
2026-06-02 12:10:56 -07:00
Nikita Smith 3a7586e84b export line and column numbers from MD 2026-06-02 12:10:56 -07:00
Ryan Fleury 3715021e0e do not assume nonzero namespace table slots 2026-06-02 12:10:55 -07:00
Nikita Smith b1d58fb4f9 skip DWARF line table and checksum tests 2026-06-02 12:10:54 -07:00
Nikita Smith e06e7f1c9f split voff_range into two fields 2026-06-02 12:10:54 -07:00
Nikita Smith c875c912d2 update IPC parser 2026-06-02 12:10:53 -07:00
Ryan Fleury c723584bfa send acks always 2026-06-02 12:10:53 -07:00
Ryan Fleury 5f851ad1b0 simplify testing ipc driving stuff in raddbg layer; put in formal eval/line-from-vaddr commands 2026-06-02 12:10:52 -07:00
Nikita Smith ec6f569181 set CLOCK_MONOTONIC on conditional variables 2026-06-02 12:10:51 -07:00
Ryan Fleury 4bbed83eab only send ack on catch-all path for external driver cmds 2026-06-02 12:10:51 -07:00
Nikita Smith e3587dcb9f use GetForegroundWindow for foucs detection with parented debuggers 2026-06-02 12:10:50 -07:00
Nikita Smith 568a77b73c fix up scratch conflicts 2026-06-02 12:10:50 -07:00
Nikita Smith 4ff6d2cc6c use the make library to generate RDI 2026-06-02 12:10:49 -07:00
Ryan Fleury 4e44a3c271 get default symbol path as part of process info; sketch out windows-style path for local symbol server cache 2026-06-02 12:10:48 -07:00
Ryan Fleury e1782d08cf show line info on visualizing function evaluations 2026-06-02 12:10:48 -07:00
Ryan Fleury 1c29112e9c first pass at per-target output log labels 2026-06-02 12:10:47 -07:00
Nikita Smith eb90ddc739 remove eval_compiler_basics 2026-06-02 12:10:46 -07:00
Nikita Smith b2318803a1 report radbin errors 2026-06-02 12:10:46 -07:00
Nikita Smith e637149ae3 broadcasting a stack pointer and then leaving scope in optimized
mode may cause use-after-free
2026-06-02 12:10:45 -07:00
Nikita Smith 79cb6c3c5e step into tests 2026-06-02 12:10:45 -07:00
Nikita Smith 09afff7957 improve error handling in the debugger harness (source file + line
number for error reports and allow scripts without header)
2026-06-02 12:10:44 -07:00
Ryan Fleury 56ee3bbf7b eval: use resolution qualifiers to express disambiguating debug info, or module, or unit, and use in debug info resolution matching path; automatically prefer selected thread voff's unit 2026-06-02 12:10:43 -07:00
Ryan Fleury a72d284058 more aggressively use scratch & limit temporary allocations in rdi baker 2026-06-02 12:10:43 -07:00
Martins Mozeiko 5e2ae50214 cleanup atomic wrappers
* use iso_volatile_load for just a load of u64/u32 from memory on msvc
* use intrin.h _interlocked* intrinsics instead of defines from windows.h
* use better suited fetch_xyz instead of xyz_fetch ones on gcc/clang
2026-06-02 12:10:42 -07:00
Nikita Smith eb8cee76c0 update .gitattributes to set LF endings on meta files so metagen
files have consistent line endings regardless of the host preference
2026-06-02 12:10:42 -07:00
Ryan Fleury 0b5651eecd project files 2026-06-02 12:10:41 -07:00
Nikita Smith 4a57087d81 dump RDI local vars 2026-06-02 12:10:40 -07:00
Nikita Smith 8127763fa4 fix linux build 2026-06-02 12:10:40 -07:00
Nikita Smith 2e4069b89a debug stats for /OPT:REF 2026-06-02 12:10:39 -07:00
Nikita Smith c5677cf5f4 wire DWARF expression eval to the unwinder 2026-06-02 12:10:39 -07:00
Nikita Smith 8126f1f18e first popped value off the stack is right-hand-side 2026-06-02 12:10:38 -07:00
Nikita Smith 03180247c9 rebase fixes 2026-06-02 12:10:38 -07:00
Nikita Smith 1883649e18 debug util for PDB section map 2026-06-02 12:10:37 -07:00
Nikita Smith 2f799e0e0e more /OPT:REF tests 2026-06-02 12:10:37 -07:00
Nikita Smith 49af8248ef update tests summary 2026-06-02 12:10:36 -07:00
Nikita Smith 31662822db rebase 2026-06-02 12:10:36 -07:00
Nikita Smith 19cee2d646 todo 2026-06-02 12:10:35 -07:00
Nikita Smith cc93bf4439 mismatched type on 'blur_count' 2026-06-02 12:10:34 -07:00
Nikita Smith c62afbcf83 normalize line endings in generated files 2026-06-02 12:10:34 -07:00
Nikita Smith 9447cce94d open generated files as binary so we have consistent line endings across
Linux and Windows
2026-06-02 12:10:33 -07:00
Nikita Smith 5089a01058 change make_directory behavior on Linux to match Windows behavior 2026-06-02 12:10:32 -07:00
Nikita Smith a1f0df2d76 run clang build for now 2026-06-02 12:10:32 -07:00
Nikita Smith fb48dcf42b update defines for non-graphical debugger build 2026-06-02 12:10:31 -07:00
Nikita Smith 612ac8f414 fix regression introduced in aea4a4ff 2026-06-02 12:10:31 -07:00
Nikita Smith 1e0f1d026b sanity-check scissor region, fix var shadowing bug in blur GLSL shader,
and remove 'blur_count' that causes linking issues

[OpenGL] GL_INVALID_OPERATION in glGetUniformLocation(program not linked)
[OpenGL] GL_INVALID_OPERATION in glUniform(program not linked)
[OpenGL] GL_INVALID_VALUE in glScissor
2026-06-02 12:10:30 -07:00
Nikita Smith 15bf343168 gate for dwarf converter 2026-06-02 12:10:30 -07:00
Nikita Smith a3bac20a73 rebase fixes
normalize line endings

sort test pointers

rebase fixes

rebase fixes
2026-06-02 12:10:29 -07:00
Nikita Smith 58fc57f6a3 torture_dbg: reuse Windows env-var expander in the harness compile/link/launch steps 2026-06-02 12:10:28 -07:00
Nikita Smith 96e20759d5 file endings 2026-06-02 12:10:28 -07:00
Nikita Smith 65288208af dbg_engine: extend trap-net range across contiguous same-source-line ranges 2026-06-02 12:10:27 -07:00
Nikita Smith d7e5c5a830 dbg_engine: bugfix memory fetch in step_over, step_over_inst, and step_into
and incorrect boolean logic for trap-net
2026-06-02 12:10:27 -07:00
Nikita Smith 4acd8a9b86 fill out address 2026-06-02 12:10:26 -07:00
Nikita Smith 528b0fde56 replace hard-coded visual studio path with vswhere 2026-06-02 12:10:26 -07:00
Nikita Smith 3e9fff93f1 tidy up names in builds.yml 2026-06-02 12:10:25 -07:00
Nikita Smith 146ef012c4 on error restore PATH 2026-06-02 12:10:24 -07:00
Nikita Smith ec3da44568 minor fix 2026-06-02 12:10:24 -07:00
Nikita Smith 266d66250c process join 2026-06-02 12:10:23 -07:00
Nikita Smith a60b61cafd run 2026-06-02 12:10:23 -07:00
Nikita Smith bf1fd5fbe8 delete debug code 2026-06-02 12:10:22 -07:00
Nikita Smith 608c42a261 run_tests -> run 2026-06-02 12:10:22 -07:00
Nikita Smith 56c5036593 use run_tests.sh to drive builds.yml 2026-06-02 12:10:21 -07:00
Nikita Smith 1de3be3b8b on windows test clang in release without asan 2026-06-02 12:10:21 -07:00
Nikita Smith b4cfc61408 add Ubuntu build and torture steps to GH actions 2026-06-02 12:10:20 -07:00
Nikita Smith 7b2743a4d6 enable stepping test 2026-06-02 12:10:19 -07:00
Nikita Smith 388bbb95a5 update nuke 2026-06-02 12:10:19 -07:00
Nikita Smith ffe18834dd run tests on Linux 2026-06-02 12:10:18 -07:00
Nikita Smith e92947057d workaround os_get_current_path 2026-06-02 12:10:18 -07:00
Nikita Smith bcf248682c guard against relative path nodes 2026-06-02 12:10:17 -07:00
Nikita Smith e17bcd3058 switch for launching debugger with window 2026-06-02 12:10:17 -07:00
Nikita Smith 857ab15aaa hack-in temp backslash for windows 2026-06-02 12:10:16 -07:00
Nikita Smith 2102239b81 make test ignore slashes 2026-06-02 12:10:15 -07:00
Nikita Smith f3c631973b various fixes in torture for Linux compatibility 2026-06-02 12:10:15 -07:00
Nikita Smith 14dff337d4 disable radlink tests for windows 2026-06-02 12:10:14 -07:00
Nikita Smith 2d99f5600c move linker id helper to the main file so we can use it in other torture
layers
2026-06-02 12:10:14 -07:00
Nikita Smith 2ded251f7e update stepping test to produce a fixed exe on windows 2026-06-02 12:10:13 -07:00
Nikita Smith f59784bba0 headers for Linux OS layer 2026-06-02 12:10:13 -07:00
Nikita Smith fc0b0d1586 more targets 2026-06-02 12:10:12 -07:00
Nikita Smith d92d2d435d enable 16-byte CAS intrinsic 2026-06-02 12:10:11 -07:00
Nikita Smith 3da0b89ac6 null check semaphore otherwise sem_* crashes 2026-06-02 12:10:11 -07:00
Nikita Smith 7c6ad4c563 add file reserve Linux OS API for radlink 2026-06-02 12:10:10 -07:00
Nikita Smith 22159ac779 delete unnecessary helper 2026-06-02 12:10:10 -07:00
Nikita Smith 61724e88ad event shadowing in dbg engine ctrl causes debugger to return incorrect
last event
2026-06-02 12:10:09 -07:00
Nikita Smith 1b868928ea infer path style from top node 2026-06-02 12:10:09 -07:00
Nikita Smith de03edc69e rename artifact folder so it does not collide with torture program on linux 2026-06-02 12:10:08 -07:00
Nikita Smith 60a38247af capture output on linux 2026-06-02 12:10:07 -07:00
Nikita Smith 05fc085dc6 new launch target 2026-06-02 12:10:07 -07:00
Nikita Smith 61f7d0c43a minor fixes 2026-06-02 12:10:06 -07:00
Nikita Smith b7e86b038b add asan to build.sh 2026-06-02 12:10:05 -07:00
Nikita Smith 4648b27a06 increase wait time for memory slice in line stepping 2026-06-02 12:10:05 -07:00
Nikita Smith a8c167c6ae builds 2026-06-02 12:10:04 -07:00
Nikita Smith b23323c03d add switch to override default logs folder 2026-06-02 12:10:04 -07:00
Nikita Smith b4dd1f6fd3 implement os wakeup 2026-06-02 12:10:03 -07:00
Nikita Smith 559e730986 add non-graphical debugger and torture targets 2026-06-02 12:10:03 -07:00
Nikita Smith 6d6acc737a set torture as launch target 2026-06-02 12:10:02 -07:00
Nikita Smith 846b2bdf70 fix process reap in the join API 2026-06-02 12:10:01 -07:00
Nikita Smith 55172718c9 implement semaphore take with timeout 2026-06-02 12:10:01 -07:00
Nikita Smith cb190ff9e3 set work directory for new process 2026-06-02 12:10:00 -07:00
Nikita Smith 25d2d12fc9 set executable permission bit on build.sh 2026-06-02 12:10:00 -07:00
Nikita Smith 0cd3cc02ab older bash compatibility improvements and use pkg-config library detection
for external libraries
2026-06-02 12:09:59 -07:00
Nikita Smith d7161ea6e6 clean up stepping test, and remove switch for overriding crash dump path 2026-06-02 12:09:59 -07:00
Nikita Smith fbdfeea8e6 minor fix 2026-06-02 12:09:58 -07:00
Nikita Smith 7b01038f05 add error messages in script runner and create a global default timeout 2026-06-02 12:09:58 -07:00
Nikita Smith 2643d14e06 extend os info struct with binary file path 2026-06-02 12:09:57 -07:00
Nikita Smith 5d8c568d82 use PID to find and kill running debugger after tests, and add automatic
kill on when torture crashes
2026-06-02 12:09:56 -07:00
Nikita Smith 7289338d53 simplify timeouts 2026-06-02 12:09:56 -07:00
Nikita Smith 8be21e599e zip torture artifacts on run fail 2026-06-02 12:09:55 -07:00
Nikita Smith a6da558b44 query binary name in converter command line setup 2026-06-02 12:09:54 -07:00
Nikita Smith 5a3741a264 gen crash dumps 2026-06-02 12:09:54 -07:00
Nikita Smith 3ec7ae6746 explain failed launch 2026-06-02 12:09:53 -07:00
Nikita Smith b60f5ec7cb wire non graphical raddbg build target 2026-06-02 12:09:53 -07:00
Nikita Smith b6bc8d89b0 bifurcate output into stderr and stdout 2026-06-02 12:09:52 -07:00
Nikita Smith 3878a4cd95 minor fixes to basic stepping test 2026-06-02 12:09:51 -07:00
Nikita Smith 8fe39ca2b9 test asan summary print in github actions 2026-06-02 12:09:51 -07:00
Nikita Smith 210b6a212a capture stderr and print out when test fails/crashes 2026-06-02 12:09:50 -07:00
Nikita Smith f991a80c85 remove safe call so crashes in github actions print out callstack 2026-06-02 12:09:50 -07:00
Nikita Smith a6175fecf6 skip debugger tests (there is no way to launch debugger without window) 2026-06-02 12:09:49 -07:00
Nikita Smith 22353d3642 build debugger without asan 2026-06-02 12:09:49 -07:00
Nikita Smith 887ee21d94 print out last captured output when a test fails or crashes 2026-06-02 12:09:48 -07:00
Nikita Smith a645622b10 basic debugger stepping test run to completion 2026-06-02 12:09:47 -07:00
Ryan Fleury 58e6430955 p2r: more carefully choose symbol chunk sizes - we were spending dramatically more memory than needed in cases where there were many translation units, with very few symbols, because of our overly-aggressive chunk sizes (e.g. chrome.dll.pdb). also, since we just parse the msf by forming contiguous streams, let's just always map input files in radbin by default, so that we don't pay twice for the memory. 2026-05-20 14:02:08 -07:00
Ryan Fleury 1912774377 pass over default theme 2026-05-20 11:37:53 -07:00
Ryan Fleury bc22adc440 bump to 27 2026-05-19 14:42:28 -07:00
Ryan Fleury 95f4ade10d lift wait-for-process-memory-cache-update out of d_process_write, since that path runs on control thread now too as the general 'process handle write' abstraction - just move into the rd_eval_space_write path, since that wait was only for UI benefit anyways 2026-05-19 14:35:29 -07:00
Ryan Fleury 7a5ae846e9 annotate changelog notes with issue numbers 2026-05-19 12:34:37 -07:00
Ryan Fleury 17cdf458d3 on ambiguous debug info matches, inside primary debug info -> try building a fully qualified name from context, and replacing initial debug info match if it hits 2026-05-19 12:08:26 -07:00
Ryan Fleury 161663016f project.raddbg 2026-05-19 11:56:08 -07:00
Ryan Fleury 82f47e3436 changelog notes 2026-05-19 11:55:27 -07:00
Ryan Fleury 3360d97e37 fix eval space creation for nil entities 2026-05-19 11:14:19 -07:00
Ryan Fleury 1a48155116 checkpoint on dump file parsing / cache construction; temporarily turn off crash dump command, since still wip 2026-05-19 09:56:01 -07:00
Ryan Fleury fe4de192e4 linux -> prefix user raddbg data with ., so we get ~/.raddbg normally - on windows keep normal style 2026-05-18 20:18:53 -07:00
Ryan Fleury a75cb2c32d display folder in title fstr generation for file evaluations, but only if not inside a folder context 2026-05-18 20:06:05 -07:00
Ryan Fleury 40885a3f59 fix unmapped address visualization when reading is impossible + stop it from terminating rest of useful visualization 2026-05-18 20:01:15 -07:00
Ryan Fleury 80d68b7f95 dbg_engine: minidump memory64 parsing; rename switch -> better thing for what it is 2026-05-18 19:40:47 -07:00
Nikita Smith a73105b296 torture merge build fixes 2026-05-18 18:18:18 -07:00
Nikita Smith 034f2bf0d9 changelog 2026-05-18 18:11:48 -07:00
Nikita Smith 8c58086585 batch relocations to reduce contention on global reference list 2026-05-18 18:11:48 -07:00
Nikita Smith 2683206ba2 changelog 2026-05-18 18:11:48 -07:00
Nikita Smith 0c656563b8 todo 2026-05-18 18:11:48 -07:00
Nikita Smith 488f4eba9a update change log 2026-05-18 18:11:48 -07:00
Nikita Smith 6daf0a5e59 asan is fine 2026-05-18 18:11:48 -07:00
Nikita Smith e1e8ba826d fix duplicate defer import link 2026-05-18 18:11:48 -07:00
Nikita Smith 2f2c975a4a unpoison released memory 2026-05-18 18:11:48 -07:00
Nikita Smith 1dc72b2bcf replace single-hop associative section walk to multi-hop 2026-05-18 18:11:48 -07:00
Nikita Smith 921030c432 hash map 2026-05-18 18:11:47 -07:00
Nikita Smith b8e85ab9ca fix incorrect GSI symbol compars that determ_test exposed 2026-05-18 18:11:47 -07:00
Nikita Smith ffb6cb8987 minidump includes 2026-05-18 18:11:47 -07:00
Ryan Fleury 4840b46b84 dbg_engine: shift thread register reads / process memory reads -> abstraction layer, rather than directly calling into demon; cache crash dump info, like thread info & memory ranges; implement thread reg reads & memory reads for dumps by using this acceleration structure when we have a dump handle, instead of regular demon reads. 2026-05-18 14:51:17 -07:00
Ryan Fleury 463a4f8565 eliminate redundant focus tab automatic commands 2026-05-17 20:24:27 -07:00
Ryan Fleury 6d6cd7033d minidumps: initial gather / events for process/modules/threads 2026-05-16 20:53:46 -07:00
Ryan Fleury fddf353ea0 minidump format types; open crash dump command, stub out opening path in control thread; expand d_handles to support machine id, entity id, *and* 'controller kind', which can be either a dump file or a demon - this properly separates the true process control abstraction (demon) from opening a regular dump file on any machine, which will let us trivially support any kind of dump file on any platform; also fix bad cfg tree state leak 2026-05-16 18:26:23 -07:00
Ryan Fleury c90cbb80aa fix label rendering in cfg title fstr build 2026-05-14 15:00:07 -07:00
Ryan Fleury cb8f2749d9 source/disassembly inline auto expressions 2026-05-14 14:34:17 -07:00
Ryan Fleury a60502d765 sketch out first pass of autos evaluation 2026-05-14 13:50:34 -07:00
Ryan Fleury 54fc7deafa fix incorrect per-unit line table data offset doubly adding base offset of unit - was breaking non-zero-offset line tables 2026-05-14 08:54:38 -07:00
Ryan Fleury 14390c01f7 respect path style in picking file replacements 2026-05-13 18:54:23 -07:00
Ryan Fleury 5977cb400d only do pointer value visualization with valid pointer spaces; otherwise it is just a value 2026-05-13 18:41:43 -07:00
Ryan Fleury ab4a084c9c fix filtered-tab selection adjustments on project load 2026-05-13 16:01:00 -07:00
Ryan Fleury d207398934 display project names in recent project list; fix 0s for address-disabled string viz 2026-05-13 15:50:59 -07:00
Ryan Fleury fbe7b20aee finish addresses-before-content single-line eval visualization path 2026-05-13 15:22:56 -07:00
Ryan Fleury 58caf0d3d5 upgrade eval space reads with staleness/bad/change info, to expand process memory cache reading abilities to all evaluation spaces; unmapped address visualization (both memory view & single line eval) 2026-05-13 14:48:00 -07:00
Ryan Fleury e6d83f7450 visualize unmapped addresses in memory view more correctly (not as 0s) - annotate explicitly with unmapped address annotation 2026-05-13 14:09:21 -07:00
Ryan Fleury 16b1e728ba breakpoints -> project-tagged user config 2026-05-13 13:38:04 -07:00
Ryan Fleury cfbda8bc4d clear last-focused-external-window on new session 2026-05-13 11:57:03 -07:00
Ryan Fleury 9eecffad78 fix mouse-hover-in-source-evaluation (off -> range) rules, to correctly enclose more expressions 2026-05-13 11:55:52 -07:00
Ryan Fleury a1778421c9 eval extended opcode for setting base offset - used for correct cross-module evaluations, fixes go-to-definition when thread is not in module of resolved identifier's symbol 2026-05-13 11:23:48 -07:00
Ryan Fleury 0563cd3b80 fix incorrect lifetime of calculated implicit user/project arguments 2026-05-13 10:43:43 -07:00
Ryan Fleury 1e0bcf0504 treat relative implicit project args correctly 2026-05-13 10:30:54 -07:00
Ryan Fleury 2231228ffb store loaded debug infos as user config, but project-tagged; eliminate 'recent files' from project file (they are almost entirely duplicative of debug info source files); adjust 'last_user' remembering semantics - do not automatically change last_user when setting user explicitly from command line 2026-05-13 10:18:06 -07:00
Ryan Fleury 1774a76cdb scope ending annotations 2026-05-13 08:58:46 -07:00
Ryan Fleury 264abe57aa allow missing debug info in case of 'step out' - we still want to support traditional behavior especially in e.g. disassembly and so on 2026-05-13 08:40:14 -07:00
Ryan Fleury b198f0b421 just move metagen onto regular base layer - in theory this causes cycles (metagen w/ bug -> generates busted base layer code -> can't build metagen!) but we do not currently generate anything in base, and we also can just revert in that case. 2026-05-12 20:02:35 -07:00
Ryan Fleury a0ace3561f eliminate d2r usage (1) from radbin 2026-05-12 19:58:15 -07:00
Ryan Fleury fa5af4fa9f notes 2026-05-12 19:57:01 -07:00
Ryan Fleury b4f15d3111 adjust project/user saving/loading rules to be less idiosyncratic with other applications. user settings persist, to keep the user from needing to specify things like windows/colors/bindings every time, but projects must always be manually specified, e.g. like usual files in other programs. you can do this either via the ui, or via command line still. also, new user/project no longer require a path - they just clear the existing path, then to set the path you just explicitly save. this makes things much more natural & familiar. 2026-05-12 19:34:42 -07:00
Ryan Fleury dcc78314ab fix dbg_info loader treatment of nil keys, avoid bad usage of blank '.rdi' files; os_lnx_* -> lnx_* 2026-05-12 14:42:29 -07:00
Ryan Fleury 50a68b9d8c adjust internal definition of sync barrier type to match windows 2026-05-12 13:52:25 -07:00
Ryan Fleury d4623a7ddf slow & highly contentious implementation of barriers using more basic sync primitives; fall back if sync barriers not present in win32 version 2026-05-12 13:48:57 -07:00
Ryan Fleury 641a7c8b30 on new debug session: close all loaded debug infos, assume none need to stick around 2026-05-12 09:38:06 -07:00
Ryan Fleury 15a2d5658f fix auto-thread-selection rules 2026-05-11 20:04:36 -07:00
Ryan Fleury d45090a8cc adjust kerning to be rounded, rather than floor'd; adjust step-out desc 2026-05-11 19:53:54 -07:00
Ryan Fleury 9eaff99bbb fix build 2026-05-11 19:44:26 -07:00
Ryan Fleury cbbacf0b5f sketch out extra disasm instruction outputs for determining read/write locations from instructions (autos) 2026-05-11 14:53:05 -07:00
Ryan Fleury d1536953b0 p2r: eliminate spurious duplicate address vmap entries; upgrade step-out with block stepping functionality 2026-05-11 14:21:43 -07:00
Ryan Fleury cc099f55aa do not call destroy on caches without a destroy hook :( 2026-05-11 13:30:59 -07:00
Ryan Fleury de35a86505 fix artifact cache replaced-value deletion - this CAN NOT run if the new value == the old value 2026-05-11 13:29:29 -07:00
Ryan Fleury 52da228efe artifact_cache: fix leak of old-generation artifacts, when those artifacts are replaced by newer generation computations. artifacts can opaquely hold things like arena pointers, and so when we replace them in the cache, we need to respect the lookup api's provision of create/destroy hooks for the cache, such that the artifacts can be released correctly (using the destroy hook) before being replaced. this is separate from regular eviction. 2026-05-11 11:49:15 -07:00
Ryan Fleury 6a95da35e0 opengl: more coverage/convergence w/ d3d11 2026-05-09 20:25:14 -07:00
Ryan Fleury 0cfc113272 opengl: apply transforms to rendering 2026-05-09 13:30:56 -07:00
Ryan Fleury a16716eff7 d2r2: fix missing function types on functions returning void 2026-05-09 12:38:08 -07:00
Ryan Fleury d59d6a21f0 d2r2: do not duplicate line records, were being generated by columnar changes, but these are not currently supported by the debugger 2026-05-09 12:18:05 -07:00
Ryan Fleury 2f6d0f9aaa os -> wm; *_w32_ -> w32_*_, *_lnx_ -> lnx_*_ 2026-05-08 21:17:21 -07:00
Ryan Fleury 9a7782de47 re-slice linux/win32 backends, top-level folder is backend (demon/win32 -> win32/demon, etc.); os_gfx -> window_manager; fix linux / opengl builds for new apis/types 2026-05-08 15:21:22 -07:00
Ryan Fleury aea4a4ff9d eliminate os_core, move into base; eliminate regs, move into arch abstraction layer, define x64 regs in x64 layer; move win32 backend for os core (now base) functionality to top-level win32 layer 2026-05-08 15:21:21 -07:00
Nikita Smith 24c858171f fix complex and char conversion + note 2026-05-07 21:49:15 -07:00
Ryan Fleury 774e8e1305 notes 2026-05-05 12:57:04 -07:00
Ryan Fleury 738163dcbd demon: gather success status of setting traps, but do not fail on failure 2026-05-05 12:35:20 -07:00
Ryan Fleury 356237418f demon: always gather 'active' traps - do not require success 2026-05-05 12:32:00 -07:00
Ryan Fleury b210afa5ee demon/linux: do not assert on trap write/read success. breakpoints can evaluate to unmapped addresses 2026-05-05 12:30:12 -07:00
Ryan Fleury 44c6b6e4d5 do not duplicate function records for decls 2026-05-05 12:22:20 -07:00
Ryan Fleury d9f7385f81 d2r2: fix file sequence map build to use correct source files 2026-05-05 12:13:07 -07:00
Ryan Fleury 1c8a10e0f7 rdi_make: fix path node lookup to respect root-level ..s 2026-05-05 11:47:26 -07:00
Ryan Fleury 26646299a1 rdi_make: preserve root-level ..s in interned path tree 2026-05-05 11:20:38 -07:00
Ryan Fleury 5f8e0a5aa9 rd: fix possible-overrides-from-file-path path to correctly use path styles 2026-05-05 11:00:08 -07:00
Ryan Fleury 6e376e5615 rd: fix file path mapping to correctly use destination path's style in constructing mapped paths 2026-05-05 10:57:46 -07:00
Ryan Fleury 1301165aeb d2r2: disable llvm-dwarfdump-style line table logging 2026-05-05 10:50:47 -07:00
Ryan Fleury 384cf11eed d2r2: fix line table register reset conditions in line table conversion 2026-05-05 10:49:33 -07:00
Ryan Fleury fb04768002 d2r2: hook up scope containers to contained types / namespaces; fix address table parsing 2026-05-05 09:42:55 -07:00
Ryan Fleury aee299efe7 d2r2: deduper fixes/simplification, first half of structured namespace support 2026-05-04 15:41:23 -07:00
Ryan Fleury 8f65f466f5 d2r2: expand tag deduplication to both namespaces and types; gather/deduplicate/convert namespaces 2026-05-04 13:14:13 -07:00
Ryan Fleury 7157e813a0 d2r2: fix line table build - correct program data size, correct special opcode application 2026-05-03 17:55:53 -07:00
Ryan Fleury f2d80da2de d2r2: remove markup 2026-05-03 11:25:56 -07:00
Ryan Fleury e48c23db20 d2r2: don't descend children for childless subprograms! 2026-05-03 11:24:38 -07:00
Ryan Fleury 4f3d9c96b8 d2r2: when deduplicating types, ensure deterministic (hash -> .debug_info off) mapping, by minimizing the .debug_info off found for a particular type hash - in theory, this step should not be necessary, but there is a mistake / broken part of this theory, which was leading to non-deterministic type graphs in a very small # of cases, due to the same hash mapping to different .debug_info offsets across runs. in theory, the hash itself should take care of this, but there is likely something important missing. in either case, minimizing the .debug_info offset is very cheap, and guarantees we parse from a deterministic place no matter what the run looks like. 2026-05-02 20:25:33 -07:00
Ryan Fleury f9eb25dbcb d2r2: do unique type info gathering on a sub-unit granularity, so we can subdivide a unit across all lanes; sort unique type tag slots for determinism 2026-05-01 14:12:35 -07:00
Ryan Fleury 0b5e827f6c rd: prioritize fastpath for non-unwound register reads; d2r2: prepass to find all top-level tag trees, subdivide unit work on a root-level tag tree basis 2026-05-01 12:34:35 -07:00
Ryan Fleury 0b26b1c83e radbin: only dump eh frame data if found 2026-05-01 08:49:16 -07:00
Ryan Fleury 13fb24f253 fix incorrect function parameter type parsing (was causing quadratic parses of .debug_info, oops) 2026-05-01 08:42:48 -07:00
Ryan Fleury 0054935252 d2r2: fix scope voff miscount; pattern match trivial value-register locations -> simple kind; fix pre-dwarf5 file table parsing 2026-04-30 18:09:30 -07:00
Ryan Fleury 0e2b37ba32 dwarf: do not crash on unsupported codes; text: do not crash on arena releasing w/ zero hash (#766, #771?, #761) 2026-04-30 17:51:11 -07:00
Ryan Fleury c83c1f3cfd udt conversion 2026-04-29 16:27:58 -07:00
Ryan Fleury 230b004742 d2r2: function type info; fix reg+off location info for signed offsets, function type deduplicating / construction / referencing, etc. 2026-04-29 15:50:31 -07:00
Ryan Fleury 9a923e9bf9 d2r2: .debug_loclists parsing, DWARF expression -> RDI location info; first pass at baking frame base into var locations to match simpler PDB behavior; fixes to high-pc address evaluation (based on form kind) 2026-04-29 12:40:43 -07:00
Ryan Fleury 242f4e9cbd d2r2: dwarf 5 .debug_rnglists, .debug_addr parsing / usage 2026-04-28 09:37:31 -07:00
Ryan Fleury f5ec462438 d2r2: .debug_aranges parsing / unit conversion; .debug_ranges parsing 2026-04-28 08:57:59 -07:00
Ryan Fleury f1a9fc5e3a turn off new dwarf converter outputs temporarily 2026-04-27 18:14:29 -07:00
Ryan Fleury c6b733de20 d2r2: finished first pass of type conversion; sketched out structure for symbol/unit conversion; plugged everything in 2026-04-27 16:07:07 -07:00
Ryan Fleury ffa41c0a98 d2r2: adjustments to type deduper; sketch out topologically-sorted type building path 2026-04-27 12:02:27 -07:00
Ryan Fleury be1095eccf d2r2: type dedup content hashing cycle detection / handling; type dependency chain build 2026-04-25 09:40:49 -07:00
Ryan Fleury 9768321d08 fix build 2026-04-24 20:45:18 -07:00
Ryan Fleury ad0d023c93 d2r2 type deduplication: further work on type content hashing; correct .debug_str_offsets handling; sketch out type dependency chain build 2026-04-24 20:34:20 -07:00
Ryan Fleury 35e00de05c d2r2: cross-unit, cross-lane type deduplication 2026-04-24 20:34:20 -07:00
Nikita Smith 1f4c4af598 use compound initializers to define and drive obj generation 2026-04-24 13:11:34 -07:00
Ryan Fleury ccb1cd8f4d d2r2: built-in types, move rdi variadic type -> built-in 2026-04-23 18:54:01 -07:00
Ryan Fleury 44a1c9ca1b d2r2: line sequence production / equipping to src files 2026-04-23 18:12:14 -07:00
Nikita Smith 6348c63cdc make namespace optional for specifying test targets 2026-04-23 17:34:02 -07:00
Nikita Smith 7ed5977d20 improve determinism test speed 2026-04-23 17:18:24 -07:00
Ryan Fleury 467e09178e file -> seq list line seq chunk building 2026-04-23 16:10:26 -07:00
Ryan Fleury 611e46cda5 d2r2: fix missing sync; per-unit seq table 2026-04-23 15:40:31 -07:00
Ryan Fleury 2637f6abde further line info conversion progress; fix missing sync 2026-04-23 15:30:55 -07:00
Ryan Fleury 602cf68980 fix builds 2026-04-23 14:45:13 -07:00
Ryan Fleury 2623141fd4 checkpoint on multi-lane / simplified dwarf parsing/conversion; fix incorrect assumption of relative in radbin 2026-04-23 14:25:50 -07:00
Ryan Fleury 6f624c10ad fix dwarf conversion to account for new rdi changes 2026-04-23 12:30:45 -07:00
Ryan Fleury 684eeda139 setting to turn off transient tab spawns 2026-04-22 20:15:36 -07:00
Ryan Fleury 3c214cfbb5 views autocompletion; view doc coverage 2026-04-22 19:57:08 -07:00
Nikita Smith 05d76b416a update defer imp link test 2026-04-22 18:38:03 -07:00
Nikita Smith 435b5183fb warn only if override subsystem is different 2026-04-22 18:38:03 -07:00
Ryan Fleury a027a0ea16 use fully qualified symbol names when doing dbg info searches & when producing strings in debug info table evals 2026-04-22 16:24:23 -07:00
Ryan Fleury 0d3539d707 highlighting for views; view doc / autocompletion coverage 2026-04-22 16:09:32 -07:00
Ryan Fleury 2eb0b8b233 ctrl -> d 2026-04-22 14:53:37 -07:00
Ryan Fleury 0e3c821e28 collapse ctrl/d bps 2026-04-22 14:31:08 -07:00
Ryan Fleury 0d8a6a4d3a ctrl -> d type pass 2026-04-22 13:37:00 -07:00
Ryan Fleury a90fbc844b merge ctrl_init / d_init 2026-04-22 12:56:15 -07:00
Ryan Fleury 2388db3998 fold ctrl layer into dbg engine - no benefit to disallowing dependence on debug engine types inside of ctrl, and it has been causing unnecessary barriers for eventual eval magic. 2026-04-22 12:44:18 -07:00
Ryan Fleury d2eb9628ba test cases for ambiguous statics across many units; comments in exprs 2026-04-22 12:44:18 -07:00
Nikita Smith 86066018e7 helper for writing COFF objs and libs 2026-04-22 12:27:25 -07:00
Nikita Smith 4b7dd960d9 pass args to the torture 2026-04-22 09:30:45 -07:00
Nikita Smith ffd6f10b31 wildcard match target tests 2026-04-22 09:30:45 -07:00
Nikita Smith 4786dc419a wildcard matcher 2026-04-22 09:30:45 -07:00
Nikita Smith ffc6905b06 kind mask should be const value 2026-04-22 09:30:45 -07:00
Nikita Smith 60c4518d65 run debug tests first 2026-04-22 09:30:45 -07:00
Nikita Smith 48f2a931ce clang build fix 2026-04-22 09:30:45 -07:00
Nikita Smith a2aab5967c add support for /DEBUG:GHASH 2026-04-22 09:30:45 -07:00
Ryan Fleury 4815007ac1 use fully qualified type names in unpacked eval types - fixes namespaced type views 2026-04-22 09:09:41 -07:00
Ryan Fleury 21a150a181 turn off symbol-lookup highlighting following dot operators 2026-04-21 20:13:54 -07:00
Ryan Fleury 6f2b8540eb store partially-qualified names in generated RDIs; adjust debugger to do fully-qualified lookups when appropriate 2026-04-21 19:36:38 -07:00
Nikita Smith 8cf14b5acb minor fix 2026-04-20 15:28:12 -07:00
Ryan Fleury fda0a9751b equip namespace records with container info 2026-04-20 15:14:01 -07:00
Ryan Fleury 581c102bfd sort deduplicated namespace map before producing namespaces 2026-04-20 14:43:03 -07:00
Ryan Fleury 5fb1ef4df9 fix global vmap baking determinism - eliminate dupes 2026-04-20 14:15:38 -07:00
Ryan Fleury 16ea060382 fix source of vmap baking determinism issue, + fix use-after-free from cross-lane scratch usage 2026-04-20 14:06:34 -07:00
Nikita Smith 43c3d5e348 test param flag 2026-04-20 13:55:23 -07:00
Nikita Smith 52875a2d93 fix regression in RDI make local 2026-04-20 13:55:23 -07:00
Ryan Fleury e8e9ad204a further pdb namespaces progress; fix compile-only output for /o MSVC deprecation 2026-04-20 13:53:50 -07:00
Ryan Fleury e4bd6d5029 revert commit that deleted container-from-procedure APIs for whatever reason 2026-04-20 11:35:04 -07:00
Ryan Fleury 01682dee07 bump to 26 2026-04-20 11:12:25 -07:00
Nikita Smith d607d6377d build fixes 2026-04-20 11:00:54 -07:00
Nikita Smith d7cc06f5d5 show top five slow tests in the summary 2026-04-20 10:39:50 -07:00
Nikita Smith 0a791e5876 add support for LLVM ghash sections 2026-04-20 10:39:50 -07:00
Nikita Smith cd4f81d473 time tests 2026-04-20 10:39:50 -07:00
Nikita Smith 9e19fe5193 prettify elapsed time formatter 2026-04-20 10:39:50 -07:00
Nikita Smith e6f49aaded test stripped PDB 2026-04-20 10:39:50 -07:00
Nikita Smith aefd73e551 test public symbols 2026-04-20 10:39:50 -07:00
Nikita Smith 4decc0d9f0 test GSI procs and typedefs 2026-04-20 10:39:50 -07:00
Ryan Fleury bc43fe9b31 only enable cursor trails if not click+dragging; redundant animation in that case 2026-04-20 10:22:56 -07:00
Ryan Fleury 897ffc6b69 file path evaluation activation in watch windows -> switch to file 2026-04-20 09:57:34 -07:00
Ryan Fleury ee2dcbee48 fix idx shadowing lookup bug in rdim_bake_name_map_insert 2026-04-20 09:57:34 -07:00
Ryan Fleury 03d1575c85 non-scope, non-type namespace gathering / gathering from pdb & baking & dumping 2026-04-20 09:57:34 -07:00
Ryan Fleury 5e81f124dc debug constant data evaluation spaces -> read from rdi data directly 2026-04-20 09:57:33 -07:00
Ryan Fleury 7a59548d5b remove 'Symbols' from section titles, now that old sections are gone 2026-04-20 09:57:33 -07:00
Ryan Fleury 881e19c842 get debugger onto new location info & symbol format 2026-04-20 09:57:33 -07:00
Ryan Fleury 6764e1281e setting for preferring displaying pointer addresses before contents 2026-04-20 09:57:32 -07:00
Ryan Fleury 2bf57c065a new location info format dumping 2026-04-20 09:57:32 -07:00
Ryan Fleury 7383cdc5ae fix dumper for new symbols/locations format; produce dummy global unit for global stream pdb info - avoid stomping on 0 unit; fix stomping of location info, from missing lane sync 2026-04-20 09:57:32 -07:00
Ryan Fleury bec7e630ba fix duplicate nil local, equip locals with their scopes as symbol containers 2026-04-20 09:57:32 -07:00
Ryan Fleury e281528d57 rdi pass checkpoint: rdi baking; scope-organized locals gathering / sorting / organizing; plug into serialization path 2026-04-20 09:57:32 -07:00
Ryan Fleury 290590b885 extend udts w/ container info 2026-04-20 09:57:32 -07:00
Ryan Fleury e6d28d40e2 start plugging in new rdi symbols to dumper 2026-04-20 09:57:31 -07:00
Ryan Fleury 2218649801 fix busted section codes 2026-04-20 09:57:31 -07:00
Ryan Fleury b1e6948576 rdi: extend per-unit info with symbol ranges; build into baker 2026-04-20 09:57:31 -07:00
Ryan Fleury 57e4b69e64 adjust rdi make to keep per-unit info organization - flatten / join in baker, to ensure unit-sorted order 2026-04-20 09:57:31 -07:00
Ryan Fleury b7644a1d34 notes 2026-04-20 09:57:31 -07:00
Ryan Fleury a1978d9fe9 sketch out more locals baking stuff, + notes for unit-arrangement pass 2026-04-20 09:57:31 -07:00
Ryan Fleury abb0199936 checkpoint on new local baking 2026-04-20 09:57:31 -07:00
Ryan Fleury d68e19db8b finish almost all new baking for new symbols/location-info, just missing locals 2026-04-20 09:57:30 -07:00
Ryan Fleury a190051d61 checkpoint on new symbol serialization 2026-04-20 09:57:30 -07:00
Ryan Fleury cff7a786b3 fold voffs/toffs/constants into location case list, plug into converters 2026-04-20 09:57:30 -07:00
Ryan Fleury 4ea7f86d92 checkpoint on new simplified location info baking. plug in constant data baking, bytecode baking 2026-04-20 09:57:30 -07:00
Ryan Fleury 4db9a47d46 new packed location constructions; namespace container baking; feed procedures/constants into new symbol baking path 2026-04-20 09:57:30 -07:00
Ryan Fleury 131d14907e first pass at new unified & tighter symbol location info baking 2026-04-20 09:57:30 -07:00
Ryan Fleury 911e8c135e new location info baking layout computation - symbol-inlined locations in most cases, + indirected to set elements / bytecode / constant data as needed 2026-04-20 09:57:30 -07:00
Ryan Fleury 424549b562 sketch out new location representation 2026-04-20 09:57:30 -07:00
Ryan Fleury eff693244b sketch out first part of new unified symbol table baking pass, sketch out new simplified sections 2026-04-20 09:57:29 -07:00
Nikita Smith 270d73220f test GSI 2026-04-16 16:46:53 -07:00
Nikita Smith e1ab7f4955 GSI parser discarded last symbol in the chain 2026-04-16 16:46:00 -07:00
Nikita Smith 217b761c9b build GSI and PSI before DBI 2026-04-16 16:43:04 -07:00
Nikita Smith 9bf0f77391 size in symbol header was incorrectly including alignment bytes 2026-04-16 16:42:22 -07:00
Nikita Smith 15ff96f4a1 rename macro for declaring tests 2026-04-16 11:52:59 -07:00
Nikita Smith d0364dc39c minor fixes for handling cyclic and corrupted types 2026-04-15 15:32:51 -07:00
Nikita Smith 18f468bc97 os_process_join closes handle 2026-04-15 15:32:51 -07:00
Nikita Smith ae99355c1d shift upper type index bound 2026-04-15 15:32:51 -07:00
Nikita Smith 437e242260 dial down run count in determ_test 2026-04-15 15:32:51 -07:00
Nikita Smith 7872ba5542 disable ASAN for clang (need to figure out how to locate LLVM DLL) 2026-04-15 15:32:51 -07:00
Nikita Smith 4eee46764e update the change log 2026-04-15 15:32:51 -07:00
Nikita Smith d1d42102dd discard trailing free page maps 2026-04-15 15:32:51 -07:00
Nikita Smith 5f3e7e7175 whoops proc refences were pointing to stale symbols
ideally linker parse module streams for proc references
2026-04-15 15:32:51 -07:00
Ryan Fleury dae90f0053 changelog 2026-04-15 12:54:30 -07:00
Ryan Fleury 3bef72f09f changelog work 2026-04-15 12:43:52 -07:00
Ryan Fleury 471abb99ca fix ood readmeg 2026-04-15 12:30:21 -07:00
Ryan Fleury 8513ef8a4f pdb -> rdi conversion: be robust to zero itypes in function type parameter lists. was causing, in some cases, local variables to be incorrectly interpreted as parameters, because there was a (nonexistent) parameter to the function recorded in the type info. 2026-04-15 12:28:42 -07:00
Ryan Fleury 6a36382690 eval: remove incorrect truncate ops 2026-04-15 12:07:14 -07:00
Ryan Fleury 7106265a14 fix duplicate downstream marks of text artifacts; use cancel signal in text processing 2026-04-14 20:10:14 -07:00
Ryan Fleury 0a10e855a5 memory view fixes, changelog, notes 2026-04-14 19:52:10 -07:00
Ryan Fleury 3161fda982 further memory view work: tighter byte context viz, fix missing callstack frames, fix zooming, struct member annotations 2026-04-14 15:35:12 -07:00
Ryan Fleury ee6d9b3a32 fix bad auto column calculating in min edge case 2026-04-13 14:52:09 -07:00
Ryan Fleury 21eb134f24 formalized addr bar in memory view, complete first pass of memory view peek types, various fixes 2026-04-13 14:39:31 -07:00
Nikita Smith 294ede01a2 skip empty hash table adjuster 2026-04-11 14:16:13 -07:00
Nikita Smith e5664facce delete existing files before running test 2026-04-11 13:46:49 -07:00
Nikita Smith 0299b6922f sort global symbols deterministically within GSI bucket 2026-04-11 13:42:30 -07:00
Nikita Smith 1839187a3c sort records must be rebased 2026-04-11 13:41:44 -07:00
Nikita Smith 36d18e440b delete exes to appease windows defender 2026-04-11 12:51:00 -07:00
Nikita Smith 40763c06cf swap dynamic and static libs 2026-04-11 12:50:41 -07:00
Nikita Smith 89a5acba2c WIP stripped PDB 2026-04-10 17:02:04 -07:00
Nikita Smith b4bbc38ab2 validate info stream 2026-04-10 17:02:04 -07:00
Nikita Smith c5dc7bee3e fix info stream layout 2026-04-10 17:02:04 -07:00
Ryan Fleury 686b64c357 start work on more sophisticated memory type interpretation capabilities in memory view 2026-04-09 16:24:28 -07:00
Nikita Smith 120cc529ef update run_tests.bat to use torture 2026-04-09 15:27:20 -07:00
Nikita Smith 38afd6260d port eval test 2026-04-09 14:06:33 -07:00
Nikita Smith 85bbfa755a port pdb -> rdi determinism test 2026-04-09 13:41:04 -07:00
Ryan Fleury 5f5120144b memory copy/paste 2026-04-09 12:08:35 -07:00
Ryan Fleury 9aa63bc86c checkpoint on memory view improvements; bugfixes, improved visualizations, & mutation controls 2026-04-09 11:07:00 -07:00
Ryan Fleury be270a8f8d fix step over/into line operations when source line maps to multiple (potentially) discontiguous code ranges, or at least line info records; this fixes weird stepping with Clang-generated line info for for loops, function prologues in Odin, amongst other similar issues 2026-04-08 14:42:30 -07:00
Ryan Fleury 5bc791566b go to selected thread in ctx menus 2026-04-08 13:44:55 -07:00
Ryan Fleury e9a142b536 fix eval commit rules for strings; do not treat inputs as textual data when committing to pointers unless contents are quoted - fixes inability to change string pointer values 2026-04-08 13:44:55 -07:00
Nikita Smith 1f5bbb9702 minor cleanup 2026-04-08 12:39:15 -07:00
Nikita Smith 33b121215b remove T_EndTest 2026-04-07 21:21:08 -07:00
Ryan Fleury 77afc94cee correctly apply lens type flags in shorthand chained exprs (fixes foo,x
hex inheriatnce)
2026-04-07 17:37:10 -06:00
Ryan Fleury fee9f9a2c3 when resolving irtrees to values, promote register spaces -> containing process space; fixes pointer casts to register values 2026-04-07 17:16:56 -06:00
Ryan Fleury 960f439a59 notes 2026-04-07 15:26:43 -06:00
Nikita Smith 5a0bddafad test EXE and PDB determinism 2026-04-07 11:27:20 -07:00
Nikita Smith 44d09410eb bugfix global symbol dedup 2026-04-07 10:49:48 -07:00
Nikita Smith e54bef58df implement /INFERASANLIBS 2026-04-06 22:18:26 -07:00
Nikita Smith 3bb8983461 implement /WHOLEARCHIVE 2026-04-06 14:35:46 -07:00
Nikita Smith 890f7afccc take exit code before closing process handle 2026-04-06 12:17:25 -07:00
Nikita Smith 8cc8986197 WIP test PDB determinism 2026-04-06 12:04:33 -07:00
Nikita Smith aad1805124 make GSI and PSI serialization deterministic 2026-04-06 12:04:33 -07:00
Nikita Smith 608a0df058 fix race in the type merger 2026-04-06 12:04:33 -07:00
Nikita Smith 232815dbe6 branchless compact 2026-04-06 12:04:33 -07:00
Nikita Smith 85ec2c6317 remove vestige *open functionality from the MSF and PDB 2026-04-06 12:04:33 -07:00
Nikita Smith f69532e11d tweak thread broadcasting and balance symbol inputs 2026-04-06 12:04:33 -07:00
Nikita Smith 77ece3193e fix clang /O2 2026-04-06 12:04:32 -07:00
Nikita Smith f72d127aaa report unknown directives in debug build 2026-04-06 12:04:32 -07:00
Nikita Smith 129f0326f7 use thread broadcasts to simplify global symbol mover 2026-04-06 12:04:32 -07:00
Nikita Smith e9ac0abdf9 thread broadcast 2026-04-06 12:04:32 -07:00
Nikita Smith ef712a36e7 minor bugfix 2026-04-06 12:04:32 -07:00
Nikita Smith 99335959b0 ignore invalid type index errors in release 2026-04-06 12:04:32 -07:00
Nikita Smith c853082e61 test cyclic type detection 2026-04-06 12:04:32 -07:00
Nikita Smith b5f0862a91 fixup file checksums in the MSF streams 2026-04-06 12:04:32 -07:00
Nikita Smith 6b7cd39ff1 msf and cv tree patcher tests 2026-04-06 12:04:32 -07:00
Nikita Smith 30e21a84ea arena helper for dealing with buffer preallocation for workers 2026-04-06 12:04:32 -07:00
Nikita Smith e89041fd59 helper for reading/writing discontinuous memory 2026-04-06 12:04:32 -07:00
Nikita Smith 46243548f3 fixup symbol tree offsets in module stream 2026-04-06 12:04:32 -07:00
Nikita Smith acce76aa4c string list sub range helper 2026-04-06 12:04:32 -07:00
Nikita Smith d7cfd5f55a WIP rework GSI and PSI symbol writer 2026-04-06 12:04:32 -07:00
Nikita Smith 883935d44e WIP simplifying module stream layout step 2026-04-06 12:04:32 -07:00
Nikita Smith f7ac6767cf WIP symbol plumbing 2026-04-06 12:04:32 -07:00
Nikita Smith 12a1e28fff do not round up commit and reserve sizes on optional buffers 2026-04-06 12:04:32 -07:00
Nikita Smith e0c6df710f WIP change symbol extraction approach 2026-04-06 12:04:31 -07:00
Nikita Smith f57b149939 syntax error
fix yaml
2026-04-06 12:04:31 -07:00
Nikita Smith 3834c9be6f torture build with clang release runs out of memory 2026-04-06 12:04:31 -07:00
Nikita Smith 2331425e20 removed duplicate clang sets; disable ICF with lld-link because it erroneously
merges string literals and makes ASAN panic
2026-04-06 12:04:31 -07:00
Nikita Smith f119e8cffc test torture with clang 2026-04-06 12:04:31 -07:00
Nikita Smith 91b50bab00 no need to validate signature in S_OBJ; discard debug info if PCH
is missing instead of exiting
2026-04-06 12:04:31 -07:00
Nikita Smith f703699a59 for mule build tell clang to write objs with .obj extension 2026-04-06 12:04:31 -07:00
Nikita Smith ec1619f357 ASAN freaks out when threads access foreign stack 2026-04-06 12:04:31 -07:00
Nikita Smith b764a838df build meta for torture run; fix base core in metagen 2026-04-06 12:04:31 -07:00
Nikita Smith 44a0efd207 test mismatched PCH signatures and presence of .debug$P and .debug$T in
same obj
2026-04-06 12:04:31 -07:00
Nikita Smith 8a1203ed35 add mutex around fprintf to linearize log 2026-04-06 12:04:31 -07:00
Nikita Smith 3d805af7df WIP test PCH type merging 2026-04-06 12:04:31 -07:00
Nikita Smith fb0b516aa3 objs use 1 byte alignment for leaf data 2026-04-06 12:04:31 -07:00
Nikita Smith d1594f796d fix type source for PCH type indices 2026-04-06 12:04:31 -07:00
Nikita Smith c0418b736d WIP: internal and external type servers are functioning except for the
PCH indirection
2026-04-06 12:04:31 -07:00
Nikita Smith 401ba47ac2 telemetry mark up 2026-04-06 12:04:31 -07:00
Nikita Smith 8f2ec234dc update .gitignore 2026-04-06 12:04:30 -07:00
Nikita Smith 7cf8c00947 improve test for import_export and fix compile errors in merge_duplicates
due to API changes in debug info
2026-04-06 12:04:30 -07:00
Ryan Fleury 45f0b011aa changelog notes 2026-04-02 13:45:04 -06:00
Ryan Fleury da7e3063ae changelog notes 2026-04-02 13:44:10 -06:00
Ryan Fleury 8d67460fa6 treat errored call stacks as valid call stack results - only reject on stale data. allow 0 rips for the top frames. 2026-04-01 11:06:23 -06:00
Ryan Fleury d986ea6cd9 guard against invalid ctrl entity handle resolutions when applying ctrl events; otherwise some edge cases can cause invalid writes. 2026-03-31 07:05:44 -07:00
Ryan Fleury 7021d6056a use project name in window titles 2026-03-29 12:07:27 -07:00
Ryan Fleury a768f398cf single-press-to-activate in text right-click commands menu 2026-03-29 11:46:24 -07:00
Ryan Fleury a23375a070 re-plug raddbg markup data section into module image info cache; fix detachment signifying 2026-03-29 11:05:45 -07:00
Ryan Fleury 8c7b3d7356 project names, remove loaded user viz from top bar (only project is relevant in 99% of cases), clean up loaded project viz 2026-03-29 09:49:20 -07:00
Ryan Fleury 846f174bbd os_process_join on win32 -> CloseHandle of remaining process handle 2026-03-18 21:20:56 -07:00
Nikita Smith 1a10170485 fix clang build error in mule_main 2026-03-17 23:19:57 -07:00
Nikita Smith adbd5c911e update torture runner 2026-03-17 14:44:07 -07:00
Nikita Smith 70677b85d8 align group names 2026-03-17 14:44:07 -07:00
Ryan Fleury 38f08922e5 rdi: sketch out refined location info sections / types - prereq for RDI_Symbol unification 2026-03-10 16:01:33 -07:00
Ryan Fleury 5badc7f325 sketch out unified RDI_Variable to replace RDI_GlobalVariable, RDI_ThreadVariable, RDI_Local, and RDI_Constant, & plug into new RDI structured namespaces 2026-03-09 15:15:48 -07:00
Ryan Fleury 408b3af27c rdi namespace baking; cv parsing rec iterator, deduplicate oob-safe cv record iterating 2026-03-09 14:36:05 -07:00
Ryan Fleury 8db4a09941 eliminate global rdim_shared; just use scratch data 2026-03-09 11:56:43 -07:00
Ryan Fleury e2b9618101 rdi format - namespaces 2026-03-09 09:37:50 -07:00
Ryan Fleury 953f58fd44 notes for next RDI pass to support namespacing, support scope-based lookups for local-statics, support fully-qualified namespace name resolution, & simplify/merge RDI variable symbol types, & reduce a lot of size in RDIs! 2026-03-04 15:35:57 -08:00
Ryan Fleury f59da0be9c extend eval language w/ identifier disambiguators - used to pick amongst many identically-named things. for instance, local_static#0 will match the first local_static, local_static#1 will match the second, etc. 2026-03-04 11:49:04 -08:00
Nikita Smith 1c6baf18f2 msf_parsed_from_data now always returns non-null result 2026-03-04 11:41:51 -08:00
Nikita Smith 0d166b398c add mule_main to the build list 2026-03-04 11:28:53 -08:00
Nikita Smith e9a2f36b23 switch to internal debug mode detection macro for the element size check in radsort 2026-03-04 11:28:53 -08:00
Nikita Smith 57cbd020a1 debugging extras 2026-03-04 11:28:53 -08:00
Ryan Fleury 4312ee14fd first pass at (rdi -> loose rdim) path, used in (rdi * ... * rdi) -> rdi joining in radbin; plug in regular conversion path before voff -> line & breakpad paths in radbin, such that PDBs, DWARFs, RDIs, etc. can be used as input; fix up voff -> line path to plug into regular output systems; remove String8 union thing - three reasons: (a) it was only ever introduced for convenience in Linux layers, so let's just keep zero-terminated Linux nonsense in Linux land, (b) it was just alternate syntax for a cast, so let's just cast, (c) it was misleading - 'cstr' implies null-termination, which String8 of course doesn't guarantee. this led to some misuses, where .cstr was trusted to be zero-terminated, when that was not necessarily true (semaphore opening). 2026-03-03 16:24:54 -08:00
Ryan Fleury 2af3990971 do not rely on lane 0 scratch ptrs for results in p2r - prone to races 2026-03-02 12:17:03 -08:00
Ryan Fleury 9227e884ac san -> asan / ubsan 2026-03-02 12:03:40 -08:00
Nikita Smith 8007c158fa add API to DWARF writer that defines forward references and fix method
conversion in the converter
2026-02-27 11:07:19 -08:00
Nikita Smith b49c902947 remove vim mode line 2026-02-27 00:55:37 -08:00
Nikita Smith 2fbe45cd47 sync before scratch_end to prevent race in the result fill 2026-02-26 16:41:36 -08:00
Nikita Smith a2336b9991 ASAN false-positives when threads access foreign stack addresses 2026-02-26 16:22:36 -08:00
Nikita Smith 13f189ddcd WIP subprogram conversion tests 2026-02-26 14:34:59 -08:00
Nikita Smith e933df6300 WIP type stringifier 2026-02-26 14:34:21 -08:00
Nikita Smith b67d2fad40 convert procedure when it was declared inline but was not inlined 2026-02-25 22:28:09 -08:00
Nikita Smith fdd2f4e8f5 helper for looping over bits in flags 2026-02-25 22:27:12 -08:00
Nikita Smith 1ee8218b0e format visibility attribute 2026-02-25 14:27:59 -08:00
Nikita Smith 3e7b791e01 WIP subprogram conversion test 2026-02-25 11:22:13 -08:00
Nikita Smith dce1f3f8f7 typo 2026-02-25 01:39:48 -08:00
Nikita Smith 3500b9cab8 test checksums 2026-02-24 20:02:29 -08:00
Nikita Smith 2fc4a3472b finalize DWARF line table conversion test 2026-02-24 19:05:22 -08:00
Nikita Smith 732c73deff fix divide by zero in the baker 2026-02-24 18:57:03 -08:00
Nikita Smith 609cbe7288 return invalid line info index on bad virtual offsets 2026-02-24 18:49:11 -08:00
Nikita Smith 3759c3eae4 string natvis 2026-02-24 18:05:39 -08:00
Nikita Smith c7f7e15434 WIP DWARF line table conversion tester 2026-02-24 18:05:39 -08:00
Nikita Smith 03445022d5 make os file read an atomic operation 2026-02-24 18:05:38 -08:00
Nikita Smith eb8fd11b20 input for hashing external leaves was assuming different array layout 2026-02-23 13:55:04 -08:00
Nikita Smith e942dd0380 checkpoint 2026-02-23 12:04:32 -08:00
Nikita Smith 03ab203fb4 warnings 2026-02-23 11:57:05 -08:00
Nikita Smith 2df9a155c6 build radbin for torture 2026-02-23 11:54:37 -08:00
Nikita Smith 6e1816a01c disable crash handler to diagnose crash in github workflows 2026-02-23 11:42:30 -08:00
Nikita Smith b022492c7b use-after-poison fixes 2026-02-23 11:37:36 -08:00
Nikita Smith f07ea37df7 missed format spot 2026-02-23 10:45:05 -08:00
Nikita Smith 8b7215695b test DWARF32 and DWARF64 unit encodings 2026-02-22 22:34:28 -08:00
Nikita Smith cc00fe7825 minor fixes and improvements for DWARF dumper 2026-02-22 20:18:57 -08:00
Nikita Smith 2a8a1a5741 test all LNCT encoding in the file table,
test line instruction encoder,
test special opcode encoding
2026-02-22 20:17:00 -08:00
Nikita Smith a7e64c3928 more reasonable string pad count 2026-02-20 22:24:39 -08:00
Nikita Smith 20d3fa4ddb normalize paths with inconsistent slashes 2026-02-20 22:08:26 -08:00
Nikita Smith 4b88258a30 emit simple DWARF line table 2026-02-20 18:08:45 -08:00
Nikita Smith 121c211d81 minor changes in DWARF dumper 2026-02-20 18:07:47 -08:00
Nikita Smith fda380c66b flush on end sequence opcode and correctly debase addresses 2026-02-20 18:07:06 -08:00
Nikita Smith 3637fe359a do not create async workers for torture 2026-02-20 18:06:31 -08:00
Nikita Smith 6ece754edd max ops and max size for x64 inst 2026-02-20 18:06:00 -08:00
Nikita Smith cfe3cde396 checkpoint: basic line emission 2026-02-20 11:17:12 -08:00
Nikita Smith a6dd529dd5 explicitly handle null terminator in abbrev parse 2026-02-19 18:11:12 -08:00
Nikita Smith a9d3757dbc fix wonky line table indent 2026-02-19 18:11:12 -08:00
Nikita Smith e7cf2513b7 todo 2026-02-19 18:11:11 -08:00
Nikita Smith a02fa0f4cb tests for int128 and uint128 2026-02-18 23:11:25 -08:00
Nikita Smith e300a8579e bump up RDI version 2026-02-18 21:28:40 -08:00
Nikita Smith 338d2177ff added _Decimal* and __bf16 types to RDI and DWARF converter 2026-02-18 21:25:35 -08:00
Nikita Smith f0c3ea7678 treat implicit values as consts 2026-02-18 20:55:41 -08:00
Nikita Smith 28299bf778 move /Zc:preprocessor to common 2026-02-18 19:18:11 -08:00
Nikita Smith 9cc25d11fb update rdi_parse.h 2026-02-18 19:17:40 -08:00
Nikita Smith d26c890246 test basic types 2026-02-18 19:16:51 -08:00
Nikita Smith 09f02f7d08 use xlist macros for float, signed, and unsigned conversion 2026-02-18 16:19:18 -08:00
Nikita Smith a8833dac02 add 96-bit float type to RDI 2026-02-18 16:17:21 -08:00
Nikita Smith 64d0f9b68b copy new memory functions that are used in stb_sprintf to metagen base 2026-02-18 16:16:48 -08:00
Nikita Smith 0e4c864b22 checkpoint: asan crashes radbin in rdi_section_raw_data_from_kind 2026-02-18 01:21:03 -08:00
Nikita Smith 11d90a34a3 stop tests on first fail or crash 2026-02-18 01:20:42 -08:00
Nikita Smith 59e8389ed9 cleanup invoke 2026-02-18 00:56:30 -08:00
Nikita Smith 86de8fb94c string attrib DWARF writer helper 2026-02-18 00:54:55 -08:00
Nikita Smith f9e36b5517 validate attrib-form encoding 2026-02-18 00:54:18 -08:00
Nikita Smith 516365e97b rename CodeView leaf/symbol/debug_s helpers for consistent naming 2026-02-17 03:04:14 -08:00
Nikita Smith 2083c1ed87 serialize symbols directly into MSF streams 2026-02-16 20:32:44 -08:00
Nikita Smith 442f41b51a inline byte hashing around type indices 2026-02-16 13:39:49 -08:00
Nikita Smith 3e5c8ab9f6 minor test fixes 2026-02-16 13:20:13 -08:00
Nikita Smith c1e670a01c type merging test 2026-02-16 12:18:01 -08:00
Nikita Smith 4e4a806b33 pass over the aligner 2026-02-15 23:17:59 -08:00
Nikita Smith 76213ec5cd switch to using 32-bit offsets for leaf records over the pointers 2026-02-15 23:11:51 -08:00
Nikita Smith 09e37a6a2e report unknown ignore codes only in debug builds 2026-02-13 22:10:42 -08:00
Nikita Smith 6fb055bf6e rename asan -> san 2026-02-13 22:07:41 -08:00
Nikita Smith 1f51c6f25b ubsan cleanup 2026-02-13 20:59:26 -08:00
Nikita Smith fbc3cbd6eb polish help in radlink 2026-02-13 19:17:53 -08:00
Nikita Smith 519bc154ec disable async for radlink 2026-02-13 17:33:18 -08:00
Nikita Smith 0315cce2ea track os_commit and os_decommit 2026-02-13 17:31:27 -08:00
Nikita Smith e14d3b7cdb correctly compute size_to_zero for new blocks 2026-02-13 17:29:48 -08:00
Nikita Smith d7a87b7765 share arena between type deduper and MSF 2026-02-13 16:06:54 -08:00
Nikita Smith f5fc3c66b7 reduce leaf hash table bucket size to 8 bytes 2026-02-13 15:03:51 -08:00
Nikita Smith c4b26184fc type warning fix 2026-02-12 13:12:05 -08:00
Nikita Smith 7720ba096e switch to 64-bit type hashes; 128-bits is unnecessary, CodeView can't
have more than 2^32 types
2026-02-12 13:11:36 -08:00
Nikita Smith 1e6df05d9f sort resource pointers 2026-02-11 17:20:38 -08:00
Nikita Smith aa25570904 improve memory usage when reporting unresolved symbols 2026-02-11 15:28:13 -08:00
Nikita Smith e8ca3e0d5c name tag arenas for the memory plots 2026-02-11 15:27:05 -08:00
Nikita Smith 56b89cc8cb plot arena memory usage 2026-02-11 15:26:22 -08:00
Nikita Smith 2a76188570 allocate a minimum cap hash table for the lib member infos 2026-02-11 13:53:37 -08:00
Nikita Smith 5aea3527c1 use-after-poison fix 2026-02-11 13:52:33 -08:00
Nikita Smith efc5855419 bake a predictable producer string 2026-02-11 13:45:25 -08:00
Nikita Smith 21adae63bf enable spec-conformant preprocessor in MSVC 2026-02-11 00:04:43 -08:00
Nikita Smith ddfeba8ae1 natvis for DWARF writer 2026-02-11 00:01:21 -08:00
Nikita Smith da6fd986f0 do not exit on failed call 2026-02-11 00:00:56 -08:00
Nikita Smith aaa5b0cb59 pass over DWARF dumper 2026-02-11 00:00:43 -08:00
Nikita Smith 031e24e1aa handle zero operand count 2026-02-10 23:59:09 -08:00
Nikita Smith ee8562ed97 fix type for the implicit const 2026-02-10 23:58:45 -08:00
Nikita Smith 69434278bd WIP DWARF writer 2026-02-10 23:57:43 -08:00
Nikita Smith ff82d9843c matcher for DW_Form 2026-02-10 15:27:57 -08:00
Nikita Smith 6e100ad52f make form_kind part of DW_Form 2026-02-10 15:27:27 -08:00
Nikita Smith 12f8f4e078 move DW_Form to the DWARF format header 2026-02-10 15:26:56 -08:00
Nikita Smith 988b0f5541 header guard typo 2026-02-09 23:42:09 -08:00
Nikita Smith 9b1a5ae8f8 minor fix 2026-02-09 23:41:33 -08:00
Nikita Smith 482a61aaf7 obj -> COFF serializer 2026-02-09 23:41:19 -08:00
Nikita Smith 33b1e25295 arch -> COFF machine 2026-02-09 23:40:31 -08:00
Nikita Smith 1579e6eae6 simplify serial pushes for u32 and u64 2026-02-09 23:40:10 -08:00
Nikita Smith d7ffea785f compact print abbrev data 2026-02-06 18:49:52 -08:00
Nikita Smith 71a46985b6 use string table extension for long section names 2026-02-05 19:45:35 -08:00
Nikita Smith 010f54674f test for LEB128 reader and writer 2026-02-05 19:45:35 -08:00
Nikita Smith b0d0b6a2b2 factor out LEB128 writer 2026-02-05 19:45:34 -08:00
Nikita Smith b44f79fe44 test section folding with different alignment 2026-02-05 19:45:34 -08:00
Nikita Smith 0c02e21284 WIP tests for ICF 2026-02-05 19:45:34 -08:00
Nikita Smith b6c74ae9bc update values in import_export test 2026-02-05 19:45:34 -08:00
Nikita Smith 0015e52d3c add /FAILIFMISMATCH 2026-02-05 19:45:34 -08:00
Nikita Smith 8b729d4588 refactored testing utility
- factored out common parts in tests into T_BeginTest and T_EndTest
- separated radlink and DWARF tests
2026-02-05 19:45:34 -08:00
Nikita Smith d363c30e95 copy out generic 2026-02-05 19:43:47 -08:00
Nikita Smith ae236f5ccf assert element size does not overflow the simple buffer in radsort 2026-02-05 19:43:47 -08:00
Nikita Smith 09472fafbd typo in the ordinal export sorter 2026-02-05 19:43:47 -08:00
Nikita Smith 15831c704f lock free hash trie 2026-02-05 17:46:10 -08:00
Nikita Smith edd982852e pass over DWARF converter
- prepare to thread line table conversion
- error handling
- organizational improvements
2026-02-05 17:43:20 -08:00
Nikita Smith 4b893d50ec implement swap and drop opcodes; stub out GNU_UnInit 2026-02-05 17:43:20 -08:00
Nikita Smith 5986e595ce eval type group for F80 and F128 2026-02-05 17:43:20 -08:00
Nikita Smith 7d4a64aae6 change size of immediate on Cond opcode to match Skip immediate size 2026-02-05 17:43:20 -08:00
Nikita Smith 2ccb6f6409 natvis 2026-02-05 17:43:19 -08:00
Nikita Smith 3bc9bacf6f update line table dumper; pipe down verbose switch to the DWARF dumper 2026-02-05 17:43:19 -08:00
Nikita Smith 469fbece3d fix check extension in attrib formatter 2026-02-05 17:43:19 -08:00
Nikita Smith 4f30f64914 switched to TryRead helper macro for parsing abbrev table and compile units 2026-02-05 17:43:19 -08:00
Nikita Smith cd70b7e1ec define default debug macros for third party code 2026-02-05 17:43:19 -08:00
Nikita Smith 3d6ca7d610 indent macros 2026-02-05 17:43:19 -08:00
Nikita Smith 6d8cbe8e60 fix stack reference 2026-02-05 17:43:19 -08:00
Nikita Smith 2ca68c1039 flush output buffer before formatting 2026-02-05 17:43:19 -08:00
Nikita Smith c81eafb656 fix memory poisoning for arenas allocated from an optional buffer 2026-02-05 17:43:19 -08:00
Nikita Smith dec5258c32 piece opcodes do not pop the stack 2026-02-05 17:43:19 -08:00
Nikita Smith 82169462a4 detect variable length array in upper bound and lower bound 2026-02-05 17:43:19 -08:00
Nikita Smith 2071e31f29 refactor bad read handling in DWARF parser 2026-02-05 17:43:19 -08:00
Martins Mozeiko a13afb441e fixes issues with minidump on win32
minidump did not have proper exception record passed in, so it did not
contain actual issue of the unhandled exception. Also stack walking
before was mutating registers in exception CONTEXT, this means that
minidump did not have proper call stack anymore. Now code make a local
copy of CONTEXT for stack walking.
2026-02-03 15:15:13 -08:00
Martins Mozeiko f330bde8aa better callstack for null calls
This improves callstack in win32 unhandled exception handler when
indirect call to NULL happens. Before no call stack was printed at
all, so it was hard to know what happened. Now call stack explicitly
will print out [NULL] stack entry + rest of call stack entries. This
is done by manually looking up return address from call stack when
possible.

Also fixes wine compatibility for os_commit function. Wine does not
support RIO buffer functions.
2026-02-03 15:11:03 -08:00
Nikita Smith 3abfb800a8 group forwarder and named exports and sort them together 2026-01-27 11:26:24 -08:00
Nikita Smith cc43d17496 bugfix export by ordinal 2026-01-27 11:25:54 -08:00
Nikita Smith 3113db2d08 add missing retry wraps around syscalls 2026-01-26 15:34:06 -08:00
Nikita Smith be350c4147 add cstr union field to String8 and remove char* casts from the Linux code 2026-01-22 14:04:40 -08:00
Nikita Smith e724ee8185 use /proc/pid/exe to extract ELF header 2026-01-22 13:59:12 -08:00
Nikita Smith e907d895c6 refactored Linux layer to use static types for the entities 2026-01-22 13:30:39 -08:00
Nikita Smith 1ecd970f31 STAP copy functions 2026-01-22 13:30:03 -08:00
Nikita Smith 7627ccf84e move str8 list pop to the base layer 2026-01-22 13:29:45 -08:00
Nikita Smith 29a7dfedac natvis type 2026-01-20 15:35:02 -08:00
Nikita Smith 4f95819eb0 by default linker creates a bind table 2026-01-20 15:33:00 -08:00
Nikita Smith 85df75c30b defer import link test 2026-01-20 15:27:40 -08:00
Nikita Smith 1c0e9030fa move lib member queue state to the link step and release it after link step is done 2026-01-20 15:27:31 -08:00
Nikita Smith d1b055c62f Ignore S_REGREL32 during conversion of optimized procedures.
In optimized builds, MSVC emits parameters as both S_LOCAL and S_REGREL32.
Most likely because their debugger relies on S_REGREL32 to format
parameters in the call stack window.
2026-01-20 14:47:03 -08:00
Nikita Smith a51d3fb752 fix case where return local without a type was converted to a parameter 2026-01-20 14:47:01 -08:00
Nikita Smith 0c4009c328 bugfix import member queue detection 2026-01-16 18:53:03 -08:00
Nikita Smith 8f47ce7616 filter out duplicate page entries before computing the buffer size 2026-01-16 18:52:55 -08:00
Nikita Smith 4ab89cd120 set default values for unload and nobind 2026-01-16 18:41:15 -08:00
Nikita Smith 0168448924 by default commit a page for heap and stack 2026-01-16 18:40:32 -08:00
Nikita Smith 6e32a1f11c ignore /EXPERIMENTAL 2026-01-15 18:29:37 -08:00
Nikita Smith 0c0b7ac6d3 bugfix import linking 2026-01-15 18:25:46 -08:00
Nikita Smith 2729aae982 natvis for linker types 2026-01-15 16:41:07 -08:00
Nikita Smith de164784d0 fix typos in runtime GNU struct parser 2026-01-12 19:06:29 -08:00
Nikita Smith 70d04ac807 clean up unused process fields 2026-01-12 16:48:31 -08:00
Nikita Smith 12b53f4174 move register layout struct to Linux OS layer; use only GPR portion of
the layout struct for reg r/w; handle orig_rax
2026-01-12 16:48:31 -08:00
Nikita Smith fd6c3ef0e0 move GNU and ELF specific struct readers to appropriate layers 2025-12-28 01:16:55 -08:00
Nikita Smith f150662cc4 update logic for tracking new threads 2025-12-20 14:41:01 -08:00
Nikita Smith 13ce0cf020 fix race condition in artifact cache 2025-12-19 17:34:35 -08:00
Nikita Smith 717781e0a3 adjust cursor by delta read size 2025-12-19 17:34:14 -08:00
Nikita Smith 99fe1bc2f2 typo 2025-12-18 20:06:20 -08:00
Nikita Smith cf849f7875 add missing GNU expr opcodes 2025-12-18 20:06:14 -08:00
Nikita Smith cc01c04b8a use p_vaddr for computing dynamic segment address 2025-12-18 20:05:47 -08:00
Nikita Smith ce4d09d431 WIP DW_OP_piece 2025-12-17 17:32:03 -08:00
Nikita Smith 43cb8b7b1a handle DW_Op_FBReg, DW_ExprOp_Deref, DW_ExprOp_BReg*, and DW_ExprOp_BRegX 2025-12-16 17:32:12 -08:00
Nikita Smith 0aea6c4e8f finish value in register test 2025-12-16 13:49:23 -08:00
Nikita Smith da57259379 move DWARF expressions test to the torture 2025-12-16 11:14:17 -08:00
Nikita Smith 823cbf6a72 missing func decls 2025-12-16 11:13:56 -08:00
Nikita Smith 2b4e0f8b77 WIP DWARF expression eval
- fixup jump offsets after expression is serialized
- use generalized machine ops for register reads
- add option to limit number of executed opcodes
2025-12-16 11:12:43 -08:00
Nikita Smith 44123e9712 extend regs with DWARF registers mappings and read/write machine ops 2025-12-16 10:47:05 -08:00
Nikita Smith 952afd49a7 generalize machine ops 2025-12-16 10:40:48 -08:00
Nikita Smith 782f87e512 WIP DWARF expression encoder 2025-12-12 17:39:56 -08:00
Nikita Smith 7d0e168f8f typoes 2025-12-12 12:16:28 -08:00
Nikita Smith 7947d4dc55 outline DWARF expression evaluator 2025-12-11 16:43:21 -08:00
Nikita Smith 5b6ffd5a49 clean up instrumentation inherited during fork 2025-12-09 16:08:19 -08:00
Nikita Smith 094370c028 bugfix last string query 2025-12-09 14:02:06 -08:00
Nikita Smith 962f0e30ae WIP fork 2025-12-09 09:56:43 -08:00
Nikita Smith c221286ab8 WIP process attaching 2025-12-08 13:29:24 -08:00
Nikita Smith 9659ab4ad2 remove privileged registers 2025-12-05 17:03:05 -08:00
Nikita Smith 8005c31276 remove x86 register code 2025-12-05 16:39:02 -08:00
Nikita Smith ce77442d37 fix x87 register layout 2025-12-05 16:36:46 -08:00
Nikita Smith f4ceaecf75 set flags in xstate_bv for updated registers 2025-12-05 13:35:10 -08:00
Nikita Smith 38dbcde3f4 debug info path entity is needed otherwise unwinder fails to map key to RDI 2025-12-02 17:00:05 -08:00
Nikita Smith 81f08a01bc inline anonymous members 2025-12-02 14:39:36 -08:00
Nikita Smith f8f3f95d33 set trace options in PTRACE_SEIZE and remove unnecessary PTRACE_SETOPTIONS 2025-11-27 15:45:36 -08:00
Nikita Smith 1602a9e6ea runtime target OS handling 2025-11-27 11:17:47 -08:00
Nikita Smith 7f701dd806 minor fix 2025-11-26 20:31:34 -08:00
Nikita Smith f9561cb618 add support for CFA in the eval system
Canonical Frame Address is a DWARF-only concept encoded in the unwind info.
Debugger must store this data for each call frame and provide it to
the eval system based on selected stack frame.

To abstract over format details, we introduce a "Frame Unwind Context".
For DWARF, this context maintains the intermediate unwind state and exposes
the CFA, whereas for PE, it remains empty.
2025-11-26 15:42:40 -08:00
Nikita Smith 2a6d0d737c add CFA op to the bytecode 2025-11-26 15:13:24 -08:00
Nikita Smith a1884aaf5f WIP handle abnormal process initialization 2025-11-25 16:24:57 -08:00
Nikita Smith 0565fdef0a WIP add support for GNU LibC TLS model
Unlike on Windows, TLS index isn't part of the module format. glibc stores
it in the opaque link_map struct. There are many different heuristics
a debugger can use to locate it but most of them are unreliable and
prone to errors, or don't work when debugger attaches to a process.
We adopt the newer approach of looking for special symbols
in glibc that provide TLS index offset. These symbols were added in
2021, so programs linked with older glibc won't have TLS support.
2025-11-21 16:41:35 -08:00
Nikita Smith 7347d2f1bc pipe DW_ExprOp_FormTlsAddress through DW_ExprOp_GNU_PushTlsAddress 2025-11-21 16:11:16 -08:00
Nikita Smith 6fa71607e2 do not emit global vars for decls 2025-11-21 16:10:28 -08:00
Nikita Smith 533e7431e7 WIP switch to special mutex for syncing halts 2025-11-19 13:01:25 -08:00
Nikita Smith b7fb4fe04d WIP improved signal handling in multi-threaded programs 2025-11-19 11:38:22 -08:00
Nikita Smith 597ea44337 handle empty hash table case 2025-11-19 11:25:54 -08:00
Nikita Smith e0d0cf6e29 helper marco for dealing with syscalls that are interrupted 2025-11-19 11:25:16 -08:00
Nikita Smith a82cba0c87 cache env strings on startup 2025-11-19 11:24:11 -08:00
Nikita Smith 08f794527c updated hashing libraries 2025-11-13 11:45:34 -08:00
Nikita Smith 7cafde3376 revert DWARF changes to commit bda3a71379 2025-11-13 10:53:29 -08:00
Ryan Fleury 2a76093e17 form value resolution; line table header parsing 2025-11-11 17:24:12 -08:00
Ryan Fleury faee02f763 simplified dwarf parsing checkpoint: pull out form value reading, line table header parsing 2025-11-11 16:27:16 -08:00
Ryan Fleury b8a8ec31c7 checkpoint on simplified / stripped down dwarf -> rdi, and dwarf parsing helpers 2025-11-11 15:10:16 -08:00
Ryan Fleury 17ec73d752 dwarf cleanup checkpoint 2025-11-10 17:41:01 -08:00
Ryan Fleury 08642d2745 next checkpoint on dwarf cleanup 2025-11-10 16:37:23 -08:00
Ryan Fleury f396b2eaa3 start dwarf -> rdi cleanup; eliminate some assertions-as-validation, remove incorrect assumption that line info addresses are vaddrs (they seem to be voffs) 2025-11-10 15:06:52 -08:00
Ryan Fleury efb4731ace respect leading slashes in bake file path tree lookup 2025-11-07 16:53:30 -08:00
Ryan Fleury ed57428602 flip meta check in build.sh 2025-11-07 16:38:46 -08:00
Nikita Smith 1196de6916 move sys/wait.h to os_core_linux 2025-11-07 16:37:45 -08:00
Ryan Fleury 035e72306d o_cloexec; preserve leading slashes in root-level paths 2025-11-07 16:37:30 -08:00
Ryan Fleury d4d2159389 eliminate process array join api, no longer needed 2025-11-07 15:54:41 -08:00
Ryan Fleury 4ea3c5a0e4 artifact cache cancellation mutex -> semaphore (fixes cancellation thread on linux - we cannot take/drop across threads with mutexes); flip no_meta -> meta 2025-11-07 15:47:15 -08:00
Ryan Fleury 85778910c6 radbin build.sh 2025-11-07 15:47:15 -08:00
Nikita Smith 32bdd14d8e image base for a dynamic ELF is always zero 2025-11-07 15:47:15 -08:00
Nikita Smith ddc57a0ac4 WIP changed backend to use ptrace seize and interrupt 2025-11-07 15:47:15 -08:00
Ryan Fleury 80ccfba3c6 fix metagen build on linux 2025-11-07 14:57:41 -08:00
Ryan Fleury af423b142e gl shear 2025-11-07 14:47:14 -08:00
Nikita Smith 920a3ab3b7 discard unknown FDEs 2025-11-07 14:39:46 -08:00
Nikita Smith b00d3d9041 print out call stacks on crashes 2025-11-07 14:39:46 -08:00
Nikita Smith 69fe51ec94 set permissions on shared memory 2025-11-07 14:39:46 -08:00
Nikita Smith 1cb1522931 minor cleanup 2025-11-07 14:39:46 -08:00
Nikita Smith 90c4e1604e implement semaphore open and clsoe 2025-11-07 14:39:46 -08:00
Nikita Smith 857860fb27 remove unused includes and inline ptrace options define 2025-11-07 14:39:46 -08:00
Nikita Smith 880b8135cc add per-item purging to the hash table 2025-11-07 14:39:46 -08:00
Nikita Smith 66606b0327 use STAP probes to generate load and unload module events 2025-11-07 14:39:46 -08:00
Nikita Smith c8c993d4e8 filter for threads 2025-11-07 14:39:46 -08:00
Nikita Smith f832ac191c implement process API under Linux 2025-11-07 14:39:46 -08:00
Nikita Smith e1a46f7d21 reader for STAP arguments 2025-11-07 14:39:46 -08:00
Nikita Smith bda3a71379 argument parser for simple STAP arguments 2025-11-07 14:39:46 -08:00
Nikita Smith c4c9ef5182 WIP: got Linux to the point where single stepping and breakpoint
events are being reported correctly to the debugger
2025-11-07 14:39:46 -08:00
Nikita Smith 0d5df8f38d ELF includes 2025-11-07 14:39:46 -08:00
Nikita Smith fdb1ad5ab6 do not unwind with PE when DWARF unwinder exits with stale flag 2025-11-07 14:39:46 -08:00
Nikita Smith 6cc7b5622c ELF note parser 2025-11-07 14:39:46 -08:00
Nikita Smith b596a6ed8a dumper for SHT_NOTE 2025-11-07 14:39:46 -08:00
Nikita Smith 8bc1e4b21c explicitly update stack pointer 2025-11-07 14:39:46 -08:00
Nikita Smith 3f70cd6d05 handle CFI programs without meaningful instructions 2025-11-07 14:39:46 -08:00
Nikita Smith 7616767ed7 fix CFA_Expr instruction fill 2025-11-07 14:39:46 -08:00
Nikita Smith f2392284d5 add missing case for the register rule 2025-11-07 14:39:46 -08:00
Nikita Smith 793cd90604 zero out IP when reached last frame 2025-11-07 14:39:45 -08:00
Nikita Smith 16232b98d8 SP from arch helper 2025-11-07 14:39:45 -08:00
Nikita Smith 9e965e345f string format expression op when version is below 3 2025-11-07 14:39:45 -08:00
Nikita Smith 1b6e9e9d7b parse "Signal Frame" aug flag and fill out augmentation data size 2025-11-07 14:39:45 -08:00
Nikita Smith 821af9b104 fix FDE binary search for case where PC is not exactly on first instruction 2025-11-07 14:39:45 -08:00
Nikita Smith d44efc15c8 remove structs that are now in GNU layer and add 32 -> 64 bit struct converters 2025-11-07 14:39:45 -08:00
Nikita Smith e6a01472c8 layer for x64 2025-11-07 14:39:45 -08:00
Nikita Smith 942c354bd9 fix eh_frame dumping 2025-11-07 14:39:45 -08:00
Nikita Smith f0bd30c89b layer for interfacing with GNU 2025-11-07 14:39:45 -08:00
Nikita Smith b091233a33 infer path style from exe type 2025-11-07 14:39:45 -08:00
Nikita Smith 36b22c06b1 moved eh_frame files to dwarf layer 2025-11-07 14:39:45 -08:00
Nikita Smith 78f2e641bc fix program header rebase issue in non-PIE exes, and export program header
info through DEMON event
2025-11-07 14:39:45 -08:00
Nikita Smith 7f705923e6 parse CIE and FDE out of runtime ELF 2025-11-07 14:39:45 -08:00
Nikita Smith 4e2c983b0f skip leading NOP opcodes, which caused extra CFI rows to be emitted 2025-11-07 14:39:45 -08:00
Nikita Smith dad92610de dumper for .eh_frame_hdr and .eh_frame 2025-11-07 14:39:45 -08:00
Nikita Smith 327645436a named semaphore impl for Linux 2025-11-07 14:39:45 -08:00
Nikita Smith c32d85ea2d DWARF helper 2025-11-07 14:39:45 -08:00
Nikita Smith 3b81e1a0e9 connect DWARF virtual stack unwinder 2025-11-07 14:39:45 -08:00
Nikita Smith da38f266d9 parser for .eh_frame versions of CIE and FDE and new helper for
mapping PC -> CFI Row
2025-11-07 14:39:45 -08:00
Nikita Smith ecbce1efdf add TR and LDTR registers 2025-11-07 14:39:45 -08:00
Ryan Fleury 88b79b2b6a turn off transient tab creation with explicit open/switch command 2025-11-07 14:15:35 -08:00
Ryan Fleury e4aae5b075 respect cursor trail enabling in single line trail path 2025-11-07 13:40:24 -08:00
Ryan Fleury 0549f670c3 cell cursor trail 2025-11-07 13:20:57 -08:00
Ryan Fleury 0c7630e41c cursor trails 2025-11-07 12:00:40 -08:00
Ryan Fleury bc49b806c1 do not retry artifact computation if cancelled 2025-11-07 10:33:17 -08:00
Ryan Fleury e9e0036122 checkpoint on unified lexer 2025-11-06 12:47:05 -08:00
Ryan Fleury 82bc133ba5 first pass at unified lexer path, not plugged in yet 2025-11-04 15:56:42 -08:00
Speykious 27d01bcee0 Implement Rust syntax highlighting 2025-11-03 16:21:28 -08:00
Ryan Fleury 1ffd662e4f do case/slash insensitive search for filename references for breakpoint disqualification - we can *not* use the string table hash, since paths may disagree on casing 2025-11-03 15:55:43 -08:00
Ryan Fleury cb657aab14 fix bad line range gathering on non-textual files 2025-11-03 15:21:17 -08:00
Ryan Fleury af7f571932 adjust menu bar 2025-11-03 14:59:15 -08:00
Ryan Fleury 499fe635d6 only enable WS_EX_NOREDIRECTIONBITMAP on non-gl renderers - need either this, or we'll need to switch win32/gl to directcomposition (?) 2025-11-03 11:29:04 -08:00
ed 57252a8e29 Merge tag 'v0.9.24-alpha' 2025-10-23 23:36:21 -04:00
Ryan Fleury 4c32238b38 bump to 25 2025-10-23 17:57:33 -07:00
Ryan Fleury c0d28e0ced only retry call stacks on stale / gen tears, *not* on errored frames. 2025-10-23 17:41:49 -07:00
Ryan Fleury e6c3942ed3 artifact_cache: keep access points that we're waiting for up-to-date, even if we don't get the result, so that they are not prematurely cancelled. 2025-10-23 17:16:13 -07:00
Ryan Fleury 980c5a4c21 notes 2025-10-23 16:58:10 -07:00
Ryan Fleury b1a91b8247 adjust expiration timeouts for searches; fix unnecessary lowercasing when generating paths from pdbs 2025-10-23 16:41:08 -07:00
Ryan Fleury 7a5784b5f0 notes 2025-10-23 16:21:12 -07:00
Ryan Fleury 766d7176c4 cycle linked list test in mule 2025-10-23 16:13:07 -07:00
Ryan Fleury 4053329d65 fix incorrect list link read 2025-10-23 16:09:44 -07:00
Ryan Fleury e88a59a57e mask off bad conversion task launches 2025-10-23 15:58:00 -07:00
Ryan Fleury 5a93f5d4cb clean up drop completion, provide paths for debug info drop completion 2025-10-23 15:37:34 -07:00
Ryan Fleury ae17084b44 better artifact cache cancellation thread work organization - only do more frequent cancellation scans when in a tick, otherwise sleep 2025-10-23 14:39:44 -07:00
Ryan Fleury 721649b7ea tweak process working set size placement 2025-10-23 14:14:48 -07:00
Ryan Fleury 1d8abb1906 switch to tighter cache for loaded debug infos 2025-10-23 13:55:51 -07:00
Ryan Fleury c318c10486 pipe through guids in rdi conversion; sketch out 'query' meta cfg evaluation members, which are not stored but computed, but are not sets; plug in debug info guid evaluation that way 2025-10-23 12:10:23 -07:00
Ryan Fleury e83a95f370 relax background timeout 2025-10-23 11:11:34 -07:00
Ryan Fleury b33a257bc4 switch eval viz stringification, and lister completions, over to working correctly with process-less (but not debug-info-less) evaluations 2025-10-22 16:59:24 -07:00
Ryan Fleury c8c25c0f98 processless debug info loading/unloading; separate modules from dbg infos in eval; keep dbg infos around after debugging via config, correllate to new modules, evict when necessary, when generating new versions 2025-10-22 16:39:29 -07:00
Ryan Fleury f9d1ffa5fc look up lowercased file paths in pdb disqualification path as well as normally cased paths 2025-10-21 11:54:34 -07:00
Ryan Fleury cf856524c1 reflect dpi change events appropriately in font size / window pos & size 2025-10-20 17:42:34 -07:00
Ryan Fleury f2d28045fa fix incorrect clip in ui hover 2025-10-20 17:07:36 -07:00
Ryan Fleury 08698d739d do not use full escaping path for cli args - does not correctly match command line behavior 2025-10-20 16:35:04 -07:00
Ryan Fleury 09418f1b08 pipe member finding errors through correctly 2025-10-20 16:30:59 -07:00
Ryan Fleury 2ad3e5b1cf allow . and -> for array types 2025-10-20 16:28:07 -07:00
Ryan Fleury c921645043 fix signed shifts in raddbg_markup utf8 decoding; fix quoting of argument strings with spaces in command line target builds 2025-10-20 16:19:22 -07:00
Ryan Fleury b371bff6f2 do not skip basic itypes when building type building dependency chains! 2025-10-20 14:52:10 -07:00
Mārtiņš Možeiko 6589cbe374 update third_party/martins_hash with latest code 2025-10-20 14:45:09 -07:00
Ryan Fleury 4bc6240ac0 actually record hit offsets in linked list gathering artifact creation! 2025-10-20 13:45:14 -07:00
Ryan Fleury 36fadc3b95 need null check, if match is cancelled 2025-10-17 14:24:24 -07:00
Ryan Fleury 2eba506897 cancellation on match tasks - keep wide matches longer 2025-10-17 14:13:20 -07:00
Ryan Fleury 6bf2d2abb1 artifact cache cancellation mechanism - use in dbgi searching, since this gets huge (& is often not needed quickly after querying) 2025-10-17 14:10:51 -07:00
ed beeba835d6 Merge tag 'v0.9.23-alpha' 2025-10-17 11:42:36 -04:00
Ryan Fleury 0d8590a2f2 bump to 24 2025-10-17 08:01:19 -07:00
Ryan Fleury f5b9443636 notes 2025-10-17 07:44:49 -07:00
Ryan Fleury a96c822440 use process handles in list evaluations rather than spaces - we will need to upgrade this once eval has been upgraded 2025-10-17 07:37:36 -07:00
Ryan Fleury 52680a81fe require data field members when looking for links w/ list lens; config node ptr lists need dll 2025-10-16 15:57:43 -07:00
Ryan Fleury 0f277d6e6e float panels into config layer 2025-10-16 15:26:07 -07:00
Ryan Fleury 7844761748 float keymaps into config 2025-10-16 15:19:18 -07:00
Ryan Fleury 2f315911a5 switch off rd_cfg to cfg layer 2025-10-16 15:00:13 -07:00
Ryan Fleury 46634f547f remove old frame call stack tree cache - supplanted by artifact cache 2025-10-16 14:08:50 -07:00
Ryan Fleury edb1863020 rd_cfgid -> cfg_id 2025-10-16 14:06:12 -07:00
Ryan Fleury 05e096d8b7 further port of rd cfg 2025-10-16 13:56:26 -07:00
Ryan Fleury 78c8aeaf4c config layer schemas 2025-10-16 12:18:29 -07:00
Ryan Fleury 02c7aaec85 progress on config layer untangled from debugger frontend, to do eval on config on ctrl or async threads; turn off metaprogram by default 2025-10-16 12:02:06 -07:00
Ryan Fleury 8dbfa97c71 adjust list lens member picking rules - use default argument, then fall back to next, prev, or the first pointer to an identical type 2025-10-16 11:10:00 -07:00
Ryan Fleury a2522c00fa tweak debug info conversion balancing - we want to give a bit more to debuggees... 2025-10-16 10:33:53 -07:00
Ryan Fleury 891eaec5cb bucket active conversion tasks by priority; adjust thread cap for bg conversion processes, don't flood cores with work while target is doing things 2025-10-15 17:56:10 -07:00
Ryan Fleury 410837d26d key list gather artifact lookups by space gen 2025-10-15 16:44:30 -07:00
Ryan Fleury ac9d6e861c first pass at list view, w/ asynchronous offset chain gathering 2025-10-15 16:33:59 -07:00
Ryan Fleury 25beda50ca mask off more work based on subset flags from baker 2025-10-15 15:44:04 -07:00
Ryan Fleury d9d321c074 mask off name map builds 2025-10-15 15:34:08 -07:00
Ryan Fleury d6a7c8bd00 adjust chunk sizes for per-sym-stream symbol chunk lists 2025-10-15 15:21:42 -07:00
Ryan Fleury 9377efbe13 eliminate rest of p2r_shared usage, just use lane syncs 2025-10-15 14:21:32 -07:00
Ryan Fleury d347e2473b eliminate most reliance on p2r_shared for shared data - isolate scratch allocations, pull into scratch arenas, pop when possible 2025-10-15 14:07:42 -07:00
Ryan Fleury 80b6744673 move more scratch artifacts to scratch lifetimes 2025-10-15 12:01:40 -07:00
Ryan Fleury 1d9870c1f9 rdi string baking, name map baking, idx run baking: put temporary per-lane artifacts/maps onto scratch & pop - reduce permanent memory usage 2025-10-15 11:55:45 -07:00
Ryan Fleury 5cc9d9ae89 remove new marker 2025-10-14 16:37:47 -07:00
Ryan Fleury c7d0a3431b eliminate old vmap baking 2025-10-14 16:35:24 -07:00
Ryan Fleury b757762908 plug in new vmap baking 2025-10-14 16:34:51 -07:00
Ryan Fleury feb5249f47 first pass at faster & simplified vmap baking: sort ranges by both base voff *and* size, generate vmap directly from sorted ranges w/ stack machine; avoid quadratic pop 2025-10-14 16:02:47 -07:00
Ryan Fleury 0d06b7d2d2 regrel32: interpret rbp-relative offsets as potential parameters as well (this only shows up with /ZI - usually everything is rsp-relative) 2025-10-14 10:13:44 -07:00
Ryan Fleury 92517ef2d7 re-enable single-step on empty trap net, if no line info is present 2025-10-14 10:00:31 -07:00
Ryan Fleury 010825a0bb checkpoint on attempt at wide vmap baking 2025-10-13 17:32:53 -07:00
Ryan Fleury 89be41fda9 checkpoint: first pass at wide vmap baking 2025-10-13 17:00:01 -07:00
Ryan Fleury b688c69f13 radbin: compress sections wide, deduplicate work 2025-10-13 13:07:37 -07:00
Ryan Fleury ec39cefc9e correctly decompress rdis in radbin dumping path; do not compress zero-sized sections in rdi make 2025-10-13 12:47:46 -07:00
Ryan Fleury 87edc583bf define ctrl entity eval spaces once, in ctrl layer - nest in rd layer 2025-10-13 12:40:28 -07:00
Ryan Fleury 6bcbf5909d correctly handle bitfield type operators in eval viz string iterator 2025-10-13 11:23:49 -07:00
ed 84cb0f0a44 Merge remote-tracking branch 'EpicGamesExt/master' 2025-10-10 21:50:09 -04:00
ed 5c1c44d46e ignore vscode settings 2025-10-10 21:50:02 -04:00
Ryan Fleury b41bf5b39e update readme 2025-10-10 16:20:34 -07:00
Ryan Fleury b9be24a17d fix releasing of nil gpu buffer handles 2025-10-10 15:53:56 -07:00
Ryan Fleury c934892006 bump version to v0.9.23 2025-10-10 14:55:07 -07:00
Ryan Fleury b09e539534 fix build script for pgo 2025-10-10 14:35:13 -07:00
Ryan Fleury 8e452f10ac v0.9.22-alpha changelog 2025-10-10 13:50:47 -07:00
Ryan Fleury ac378b0ac2 switch in file menu 2025-10-10 13:10:02 -07:00
Ryan Fleury 7fcba83282 use debug info to infer language for files from including-unit language, if we cannot deduce it from extensions / settings (e.g. C++ .inl files) 2025-10-10 13:08:43 -07:00
Ryan Fleury bd9372f07c use current working directory as working directory for command line targets 2025-10-10 12:56:24 -07:00
Nikita Smith 43fcc21490 clang build fixes 2025-10-10 10:19:47 -07:00
Nikita Smith 3bd89b1fad switch over to new MD5 hash lib 2025-10-10 10:15:22 -07:00
Nikita Smith 061b5c5955 added CFA instruction parser, interpreter, and a dumper 2025-10-10 10:09:46 -07:00
Ryan Fleury c738768e41 demon/win32: do not assume actual_read is valid after a failed process memory read 2025-10-09 16:05:13 -07:00
Ryan Fleury da44e89a92 fix clang build 2025-10-09 13:57:41 -07:00
Ryan Fleury 9022efd3ab new strategy - allow artifact creation to report a completed generation which differs from the requested generation, thus preventing duplicate gen requests (in the case of ctrl process memory) 2025-10-09 11:24:48 -07:00
Ryan Fleury 28bb158c61 revert last change - that will forever-retry those reads! need a slightly different retry mechanism 2025-10-09 11:10:14 -07:00
Ryan Fleury fe6eff9d3b pass requested gen to artifact creation hooks, use to retry ctrl memory reads on many successive mem gen bumps - prevents spurious duplicate hashes in content store history 2025-10-09 10:40:31 -07:00
Ryan Fleury 4268c1de76 bump load gen on dbgi close also 2025-10-08 15:59:56 -07:00
Ryan Fleury 96477c65dd switch to martins hash 2025-10-08 12:58:59 -07:00
Nikita Smith 7eb64dbd13 metagen does not have this macro... 2025-10-07 20:42:52 -07:00
Nikita Smith e1986c9594 clang fixes 2025-10-07 20:37:00 -07:00
Nikita Smith 401d7b47df factor out C++ ABI exception handling 2025-10-07 20:28:06 -07:00
Nikita Smith 3560c7d3e7 dump CIE and FDE 2025-10-07 18:16:32 -07:00
Nikita Smith e4f6c0fc8e helper for querying arch bittness in byte size 2025-10-07 18:16:31 -07:00
Nikita Smith 7cf3eaf73f parsers for CIE and FDE 2025-10-07 18:16:31 -07:00
Nikita Smith 62ae5ca3f5 stringify format and cfa opcodes enums 2025-10-07 18:16:31 -07:00
Nikita Smith fb0d42e6d8 extend stb_sprintf.h with formatter for Rng1U64 via %r 2025-10-07 18:16:31 -07:00
Ryan Fleury 9e110bbe6d resolve register space -> primary module space in all visualizers which work on, broadly speaking, ranges of memory 2025-10-07 17:23:58 -07:00
Ryan Fleury fb825247ed resolve register-space evaluations to primary-module space evaluations in the visualizers 2025-10-07 17:20:44 -07:00
Ryan Fleury 7ff5764696 store successful queries keyed by target section as well, to avoid different table evals having different success states - fixes autocomplete flicker 2025-10-07 16:57:05 -07:00
Ryan Fleury d2feaa5f56 oops, fix dbgi search arenas leak! 2025-10-07 16:45:02 -07:00
Ryan Fleury 166b84cf30 eliminate content-layer-specific u128 hash 2025-10-07 16:24:54 -07:00
Ryan Fleury cd26bf1bcc only submit empty ctrl process memory artifacts if we have no other history; only retry on mem gen tears & valid ranges 2025-10-07 16:06:59 -07:00
Ryan Fleury ec69ebff35 fix tick-deferred command mechanism in debug engine 2025-10-07 15:50:52 -07:00
Ryan Fleury 783988c0ac expand ctrl process memory cache access to allow waiting for fresh results, rather than any results; use when doing a ctrl process memory write, to prefer viewing less stale data on exact frame. also expand trap net generation with success bit, use to retry stepping commands across frames if process memory reads are hindered. abort after N retries. 2025-10-07 15:44:35 -07:00
Ryan Fleury 2cc7f45ec1 promote register values to primary module space values for memory view specifically 2025-10-07 15:06:46 -07:00
Ryan Fleury f67cf8b59d remove incorrect space promotion rule 2025-10-07 14:51:34 -07:00
Ryan Fleury ec978d8d46 do not use complex register union types for common registers; just use primitive integer types instead 2025-10-07 14:41:51 -07:00
Ryan Fleury ab841035c0 preserve operand size info for shift operations, use along with typegroup to do correct sign preservation on shifts 2025-10-07 14:20:36 -07:00
Ryan Fleury f60ccb60f1 do not attach last successful filter to view state, since does not apply in all cases - fix artifact staleness default marker (if we do not get an artifact at all, then it is stale) 2025-10-07 12:09:14 -07:00
Ryan Fleury 0f0e36d40b disambiguate rip identifier in disasm base address calculation 2025-10-07 11:45:09 -07:00
Ryan Fleury 2acf77ad9e fix impossible disasm loading condition; do not go wide on dbgi matching unless we have significant-enough dbgis 2025-10-07 11:34:30 -07:00
Ryan Fleury fadef8a886 log source of dwarf info more specifically 2025-10-07 11:03:18 -07:00
Ryan Fleury fe8608ee1c more verbose logging in radbin 2025-10-07 10:37:15 -07:00
Ryan Fleury d20cce536a rdim bake parameter joining, source rdi bake parameters from *all* inputs, and not mutually-exclusive dwarf vs. pdb cases 2025-10-07 10:20:19 -07:00
Ryan Fleury b02a815a27 flush dwm on resize; use WS_EX_NOREDIRECTIONBITMAP window flag to avoid dwm bug 2025-10-06 17:34:19 -07:00
Ryan Fleury 2a7177861b remove extra watch row column cases - simplify most cases down to expr / eval. use extra 'note' for watch window cells to annotate type info - this sacrifices the full type evaluation cell, and instead uses a small extra bit of text to denote the type for quick reading. but this full type cell is not needed in most cases, and it can always be reobtained with an explicit typeof evaluation. 2025-10-06 17:06:00 -07:00
Ryan Fleury 6f4e78d06c do not try to release failed-creation textures 2025-10-06 14:55:51 -07:00
Ryan Fleury 284524e0c4 fix incorrect ctx check in win32 demon 2025-10-06 14:35:41 -07:00
Ryan Fleury 835a57f918 extend dbgi matching system with preferred dbgi key, to disambiguate results - fill with primary module dbgi in eval, to always prefer selected thread context when applicable 2025-10-06 14:31:57 -07:00
Ryan Fleury d2216019b9 prefer primary module, or modules with space matching the primary module's, when doing top-level debug info name matching in eval 2025-10-06 14:23:34 -07:00
Ryan Fleury af4f18ed98 sketch out more flexible texture 2d format codes 2025-10-06 13:52:59 -07:00
Ryan Fleury 213dc6a6a7 fix busted ctrl memory stream, when bad memory & null terminated (#647); do not refresh repeatedly due to loading, if any raddbg window is not focused 2025-10-06 11:38:58 -07:00
Ryan Fleury 811f316ca2 fix clang warnings in dwarf -> rdi 2025-10-06 11:20:12 -07:00
Nikita Smith da0028033d changed dumper to print .debug_info in more compact form 2025-10-03 20:10:09 -07:00
Nikita Smith b1b83c4e3d bugfix const64 interp 2025-10-03 17:16:45 -07:00
Ryan Fleury 32e344c806 remove dbgi name from ood warning 2025-10-02 18:34:04 -07:00
Ryan Fleury 073a0fcf3a add checksum checking for timestamps; fix incorrect sha256 async checksum calculation; plug file-ood back in 2025-10-02 18:34:04 -07:00
Nikita Smith f8229a390d merge conf fix 2025-10-02 18:19:42 -07:00
Nikita Smith 9acff9ecd2 use check sum defn from rdi.h 2025-10-02 18:19:42 -07:00
Nikita Smith 555f8ec6ff grab ranges in compile unit tag for the unit vmap 2025-10-02 18:19:42 -07:00
Nikita Smith 4ba1ee6e06 follow C type conversion rules in the expression transpiler 2025-10-02 18:19:42 -07:00
Nikita Smith 1f9ce6e6ba eval opcode stubs 2025-10-02 18:19:42 -07:00
Nikita Smith c7774c7582 helper for convert opcode 2025-10-02 18:19:42 -07:00
Nikita Smith 1264115d13 define push and pop counts for expression opcodes 2025-10-02 18:19:42 -07:00
Nikita Smith 954633bba2 add opcode for swapping top two values on the stack 2025-10-02 18:19:42 -07:00
Nikita Smith 48c7e45535 helper for determining if bytecode has dependency on TLS 2025-10-02 18:19:42 -07:00
Nikita Smith 0f9df9bc40 change opcode type to U8 2025-10-02 18:19:42 -07:00
Nikita Smith 0e9739f964 expression parser 2025-10-02 18:19:42 -07:00
Nikita Smith da74b8595c add operand count for expression opcodes 2025-10-02 18:19:42 -07:00
Ryan Fleury 569481c779 plug in debugger-side checksum computation & comparison 2025-10-02 17:29:59 -07:00
Ryan Fleury ee759dbac7 sha1/sha256 2025-10-02 17:07:16 -07:00
Ryan Fleury 104e72999c base layer hashing algorithms, fill out md5 2025-10-02 16:20:34 -07:00
Ryan Fleury 2d672d232f checksum baking & rdi changes; checksum dumping 2025-10-02 16:12:53 -07:00
Ryan Fleury c1e32b93a7 switch from variable size checksum data sections to just making well-defined fixed size ones for all of the concrete cases 2025-10-02 15:43:01 -07:00
Ryan Fleury 403d05cc8b first pass at checksum baking 2025-10-02 14:17:44 -07:00
Ryan Fleury 56b5792546 rdi checksum kinds, rdim checksums, pull parsed checksum kinds/values from cv, fill out rdim checksums (still haven't put into rdi itself yet) 2025-10-02 13:40:45 -07:00
Ryan Fleury b88c45d737 dbg info conversion events 2025-10-02 12:44:42 -07:00
Ryan Fleury 871daf3f22 only push unique hashes to key history in content layer; fix staleness detection in search 2025-10-02 12:08:31 -07:00
Ryan Fleury 32c4da878f fix radbin build 2025-10-02 11:53:53 -07:00
Ryan Fleury a58c23754a di2 -> di; delete old dbg info layer, delete async layer 2025-10-01 17:30:08 -07:00
Ryan Fleury 544fea0929 actually - keep (path * stamp -> key) and (key -> path * stamp) history - we do not need to evict these. also fix incorrect file map view closure on debug info close 2025-10-01 17:19:15 -07:00
Ryan Fleury 2cb94c422a update key -> path and path -> key records on debug info closing 2025-10-01 16:36:45 -07:00
Ryan Fleury 47e2014250 reset high priority bit 2025-10-01 15:53:58 -07:00
Ryan Fleury 24670e3095 fix di2 successful search continuity 2025-10-01 15:46:42 -07:00
Ryan Fleury 7707ba1d60 dwarf debug info option in builds, fix heuristic to try to load debug info from exe itself 2025-10-01 15:36:36 -07:00
Ryan Fleury db66beaf22 correctly interpret conversion completions; single high priority re-loop bit for async threads 2025-10-01 14:32:44 -07:00
Ryan Fleury b92821b503 convert less aggressively, fix incorrect di2 request batch clearing 2025-10-01 11:44:47 -07:00
Ryan Fleury 24406d1e4e use lack of user bps as hint that no rdis are necessary to wait on 2025-10-01 11:24:37 -07:00
Ryan Fleury cd048a878b fix module req cache bug; fall back on exe path as debug info 2025-09-30 17:54:31 -07:00
Ryan Fleury 628eaf84ee fix release order in dbg_info2 2025-09-30 16:47:26 -07:00
Ryan Fleury 89a026e2a6 fix content cache submission - theory is that non-zeroed keys were causing double-decs of history! 2025-09-30 15:55:22 -07:00
Ryan Fleury d5ea64a72d merge blob & key storage locking scopes in content layer - keep both blob & key cache updates 'atomic' 2025-09-30 15:25:15 -07:00
Ryan Fleury 5b00aaadaf debugging / fixes 2025-09-30 14:18:11 -07:00
Ryan Fleury 4964a94cd3 transition to dbg_info2 2025-09-30 12:52:32 -07:00
Ryan Fleury 4b122dec51 testing / debugging 2025-09-30 11:21:35 -07:00
Ryan Fleury ea99cb22e7 dbg_info2: async match artifact cache hooks / lookup 2025-09-30 11:16:15 -07:00
Ryan Fleury bf27344a9b replace extra gen parameters in artifact creation hook; replace with explicit cancellation signal, passed by caller 2025-09-30 11:01:04 -07:00
Ryan Fleury 45a2137d08 linux: fix incorrect gethostname usage, fix build, fix clang warnings 2025-09-30 10:02:40 -07:00
Nikita Smith 81d747b8d7 fix process join 2025-09-29 18:05:11 -07:00
Ryan Fleury d842da0b2e checkpoint on wide all-debug-info fuzzy searching cache 2025-09-29 17:21:37 -07:00
Ryan Fleury 4d30933c44 debug info load gen, to easily key anything based on entire set of loaded debug info 2025-09-29 17:15:03 -07:00
Ryan Fleury d2678db25f first pass at new wide async all-debug-info fuzzy searching 2025-09-29 17:09:44 -07:00
Ryan Fleury 768755b0a4 equip conversion subprocesses with info to signal parent on completion, + plug into a wakeup thread, which can re-trigger the async wavefront. also fix duplicate line counts in text parsing 2025-09-29 16:38:57 -07:00
Ryan Fleury 3a409f5ab3 throttle new conversion process launches based on available system-wide threads, with heuristic threshold of oversubscription; tweak size -> thread count heuristic 2025-09-29 16:07:16 -07:00
Ryan Fleury 92809ee6b6 new debug info loading layer debugging & fixes 2025-09-29 15:07:08 -07:00
Ryan Fleury 08904c9e2d another checkpoint on new dbg info loading 2025-09-29 14:51:28 -07:00
Ryan Fleury 46527c8465 checkpoint in new debug info layer: 16-byte key (set up to use GUIDs or otherwise unique keys at the base), better control over oversubscribing cores for conversion, better prioritization of conversions 2025-09-29 14:12:33 -07:00
Nikita Smith 8bf0a3de5b split conversion pass into three (types, udts, and symbols) and use
new locations chunk list
2025-09-29 00:11:27 -07:00
Nikita Smith 07d77a0e79 report unsuccessful writes 2025-09-26 16:28:46 -07:00
Nikita Smith c5fe329c05 fix return status for file writes 2025-09-26 16:28:46 -07:00
Nikita Smith 5709fb54dd simplify debug info conversion loop 2025-09-26 16:28:46 -07:00
Nikita Smith 7084320a83 helper for finding parent type 2025-09-26 16:28:46 -07:00
Nikita Smith eb4e6d2883 alloc slots for null 2025-09-26 16:28:46 -07:00
Ryan Fleury d7fc7d1fa9 handle aliases gracefully in eval expansion & string iterator 2025-09-26 16:23:17 -07:00
Ryan Fleury eda4f6bafa preserve & visualize restrict type modifiers in eval 2025-09-26 15:32:13 -07:00
Ryan Fleury 5fa3efe76a bugfix evictions, correctly maintain downstream content hash counts 2025-09-26 15:09:47 -07:00
Ryan Fleury ad9c67ae43 eliminate old caches from ctrl layer 2025-09-26 13:44:19 -07:00
Ryan Fleury b2acc13fb8 eliminate old async call stack computation / call stack cache code 2025-09-26 12:00:25 -07:00
Ryan Fleury 99195282f1 async call stack tree computation -> artifact cache 2025-09-26 11:57:08 -07:00
Ryan Fleury 9033ad8a2e no dashes in guid formatting in breakpad output; also include age 2025-09-26 11:44:42 -07:00
Ryan Fleury cd7e2d3f89 breakpad dumping: include pdb name if missing exe name, include pdb guid if no exe hash 2025-09-26 11:37:07 -07:00
Ryan Fleury 9ad7361cb9 thin out needed entities for call stack build; fix unnecessary re-loops on async threads 2025-09-25 17:07:02 -07:00
Ryan Fleury 88eddce324 same for clang 2025-09-25 16:42:26 -07:00
Ryan Fleury b1b03ebd56 turn on opt:ref and opt:icf for all builds 2025-09-25 16:38:42 -07:00
Ryan Fleury d1845bf51f no_inline on entry_point 2025-09-25 15:52:58 -07:00
Ryan Fleury 366c63e3ce extend artifact cache loop with an early-out cancellation path, when new high priority requests have been pushed, while low priority ones are still being worked on 2025-09-25 15:35:22 -07:00
Ryan Fleury c4bf855af9 extend artifact cache nodes with last requested vs. last completed gen; pass last requested gen to artifact creation to support cancellation 2025-09-25 14:59:29 -07:00
Nikita Smith d3d91c64cc get DWARF converter up and running 2025-09-25 12:38:21 -07:00
Ryan Fleury 05fbd06f82 delete dead code, dbgi -> dbg_info 2025-09-25 11:57:23 -07:00
Ryan Fleury 6d39a66672 eliminate ptr graph cache experiment 2025-09-25 11:52:33 -07:00
Ryan Fleury f61cd2b673 fix use of unused layers 2025-09-25 11:47:56 -07:00
Ryan Fleury 7990b043a0 eliminate geo cache, replace with trivial use of artifact cache defined by geo visualizer 2025-09-25 11:47:31 -07:00
Ryan Fleury d8fcbcd868 eliminate texture_cache; replace with trivial usage of artifact cache, in raddbg layer defining the bitmap visualizer, which was the only usage 2025-09-25 11:40:35 -07:00
Ryan Fleury b4d672efba flag ctrl memory reads as high priority 2025-09-25 11:20:14 -07:00
Ryan Fleury a338b3413e artifact cache fixes, move ctrl process memory streaming to artifact cache 2025-09-25 10:35:47 -07:00
Ryan Fleury ca7bfab7ea bucket artifact cache requests by wideness/priority; do high/wide, high/thin, low/wide, low/thin 2025-09-24 17:08:08 -07:00
Ryan Fleury 10e8a10d9b adjust new call stack artifact cache hooks to work gracefully with terminated threads/processes 2025-09-24 16:06:46 -07:00
Ryan Fleury 3dc3707b22 maintain fs change gen alsog 2025-09-24 15:41:00 -07:00
Ryan Fleury bdfd4c14ae eliminate old file stream cache, just use simplified cache for linting filesystem changes; otherwise switch everything to artifact cache 2025-09-24 15:40:11 -07:00
Ryan Fleury 684f6344c5 switch to old call stack cache for now 2025-09-24 15:08:07 -07:00
Ryan Fleury 4b335103bc begin moving call stack computation / cache to artifact cache; fix incorrect broadcast val location 2025-09-24 15:04:45 -07:00
Ryan Fleury 0679b4b04c #if 0 out old evictor thread for ptr graph 2025-09-24 13:43:51 -07:00
Nikita Smith 18b5e27015 change log 2025-09-24 12:42:17 -07:00
Nikita Smith 647bc4206f minor typo 2025-09-24 12:42:17 -07:00
Nikita Smith 06e895be7c organize task structs 2025-09-24 12:42:17 -07:00
Nikita Smith 20c92e0baf speed up base reloc gather step and serialize pages in parallel 2025-09-24 12:42:17 -07:00
Nikita Smith 3c0c531c53 reloc helper 2025-09-24 12:42:17 -07:00
Nikita Smith 0a930be613 use radsort for sorting base reloc pages 2025-09-24 12:42:17 -07:00
Ryan Fleury fa0b2440ec subset flag for constants conversion; fix empty-tpi-hash case 2025-09-24 12:42:04 -07:00
Ryan Fleury 7f2a066e8f tear out old file stream tick; switch disasm to using new file stream for interleaved text lines 2025-09-24 12:09:59 -07:00
Ryan Fleury 8e68187107 fix incorrect file artifact reading offsets; switch file eval reads to new artifact cache 2025-09-24 11:53:52 -07:00
Ryan Fleury 5f883860e0 move part of file evaluations onto new async file reads 2025-09-24 11:50:53 -07:00
Ryan Fleury e7368af35c artifact cache waitable cache access; debugging / fixes; start plugging in file stream to artifact cache 2025-09-24 11:25:18 -07:00
Ryan Fleury 7e05a60ffe checkpoint on more artifact cache port of ctrl process memory streaming 2025-09-23 17:05:45 -07:00
Ryan Fleury 141b6c1396 sketch out artifact cache hooks for file streaming layer 2025-09-23 11:58:00 -07:00
Ryan Fleury 6cdce22284 expand artifacts a bit more, to be more useful with larger-than-ptr but not huge allocations 2025-09-23 11:27:56 -07:00
Ryan Fleury 9787c698e6 sketch out new async path for ctrl memory streaming 2025-09-23 10:58:17 -07:00
Ryan Fleury 2ce581fa19 more subset flag respecting 2025-09-22 17:39:26 -07:00
Ryan Fleury 5c1cf77fda respect subset flags in pdb -> rdi converter 2025-09-22 17:32:05 -07:00
Ryan Fleury 8078b90f51 text_cache / dasm_cache -> text / disasm 2025-09-22 16:52:55 -07:00
Ryan Fleury 408c57639a eliminate dasm cache hook calls 2025-09-22 16:23:11 -07:00
Ryan Fleury 6ac8c588f7 eliminate old disasm cache code 2025-09-22 16:22:33 -07:00
Ryan Fleury 4b1939bd6d provide u64 broadcasting mechanism in base layer wavefront lane context, allows more flexible data sharing mechanism which does not depend on statics; reshape dasm building codepath for clicking into artifact cache 2025-09-22 16:21:30 -07:00
Ryan Fleury 8a1e6ab2e6 extend artifact cache with non-key-included generations, to allow gracefully decaying certain computations 2025-09-22 15:25:01 -07:00
Ryan Fleury 811e58c249 progress on single async-filled computation artifact cache; hook up to text cache layer, eliminate bespoke cache for text only 2025-09-22 15:13:31 -07:00
Ryan Fleury 9459327687 pull out table stripe arrays as base layer primitive; unified 'artifact cache' experiment 2025-09-22 14:07:21 -07:00
Nikita Smith 6b278e1ccc parallelize image fill 2025-09-22 10:06:21 -07:00
Nikita Smith a75a33e6d3 minor fix for UBA detour 2025-09-22 10:06:21 -07:00
Nikita Smith e72512f638 switch over to 64-bit pointer tagging 2025-09-22 10:06:21 -07:00
Nikita Smith d1dd8e654c add 128-bit compare exchange 2025-09-22 10:06:21 -07:00
Nikita Smith 861c2cf893 macro for aligning types 2025-09-22 10:06:21 -07:00
Nikita Smith 4717701540 update threading API 2025-09-22 10:06:21 -07:00
Nikita Smith 362557e503 renormalize line endings 2025-09-22 10:06:21 -07:00
Nikita Smith 872c387bad let errors from MT to bubble up to linker's stdout and stderr 2025-09-22 10:06:21 -07:00
Nikita Smith 3d7afb58fa speed up symbol patching 2025-09-22 10:06:21 -07:00
Nikita Smith 42999bea63 profile markup obj relocation patching 2025-09-22 10:06:21 -07:00
Nikita Smith 553154eb39 layer color fix 2025-09-22 10:06:21 -07:00
Nikita Smith ac985bb5da add a real pgo PGO target 2025-09-22 10:06:21 -07:00
Nikita Smith 371e52ad42 add /rad_alt_pch_dir for remapping objs in the local folder for pgo builds 2025-09-22 10:06:21 -07:00
Nikita Smith ee75ada087 mark function override meta-data sections with link info flag so
they do not get a section definition
2025-09-22 10:06:20 -07:00
Nikita Smith ce044e7e83 detect removed fixup symbol and propagate correct section number 2025-09-22 10:06:20 -07:00
Nikita Smith a060f581d9 stub /d2 2025-09-22 10:06:20 -07:00
Nikita Smith 17058e71bf remove empty nodes 2025-09-22 10:06:20 -07:00
Nikita Smith e864674fbd add pgo support to build.cmd 2025-09-22 10:06:20 -07:00
Ryan Fleury aa0eec5763 prevent focusing null window, which was causing weird input event stealing on run... 2025-09-19 16:58:41 -07:00
Ryan Fleury 1745ad4758 eliminate old profiling markup 2025-09-19 16:55:07 -07:00
Ryan Fleury 53054e5add fix incorrect loop-again logic on async threads 2025-09-19 16:41:49 -07:00
Ryan Fleury 8fa01d3e30 expand access scope touches to automatically record update clock idx touch time, + timestamp; move texture cache to new async wavefront 2025-09-19 15:31:30 -07:00
Ryan Fleury 8e2ceeee9e provide mechanism to not wait at top of async loop 2025-09-18 16:20:17 -07:00
Ryan Fleury 30ae9620f9 eliminate ptr graph scope; simplify dasm cache eviction loop 2025-09-18 15:59:21 -07:00
Ryan Fleury 4e99312b75 eliminate tex_scope; fold into access 2025-09-18 15:53:00 -07:00
Ryan Fleury c5bcdbf232 eliminate geo_scope, fold into base layer's 'access' construct 2025-09-18 15:40:13 -07:00
Ryan Fleury 2131e792a1 eliminate text cache scope; fold into base layer's 'access' construct 2025-09-18 15:25:11 -07:00
Ryan Fleury 1b93dbd4bd promote content scope to base layer, rename as 'access'; generalize based just on list of scope refcounts, + optional cvs; eliminate c_scope; replace dasm_scope with access as well 2025-09-18 15:21:22 -07:00
Ryan Fleury 5381307e90 hash_store -> content 2025-09-18 14:42:25 -07:00
Ryan Fleury 364e15491c switch from static lane distribution in file/dasm to dynamic counter 2025-09-18 14:19:00 -07:00
Ryan Fleury 7c08d6846b dasm cache in new async wavefront 2025-09-18 11:18:36 -07:00
Ryan Fleury 0c1010b72d move hash store eviction to base layer async wavefront; start dasm transition 2025-09-17 16:38:14 -07:00
Nikita Smith e33a95bfe2 do not embed time stamp with /brepro 2025-09-17 15:21:37 -07:00
Nikita Smith 0b154cef46 stub /brepro 2025-09-17 15:21:37 -07:00
Nikita Smith c653410af5 stub /errorreportlevel 2025-09-17 15:21:37 -07:00
Nikita Smith 28aec349fd update readme 2025-09-17 15:21:37 -07:00
Nikita Smith b646e1cd43 fix compiler errors 2025-09-17 15:21:37 -07:00
Nikita Smith fe63983d4a u32 decrement intrinsic 2025-09-17 15:21:37 -07:00
Nikita Smith 5a12513306 parallelize section garbage collection
currently we tag pointers to solve ABA problem however if the list
has more than max_U16 items, the tag will overflow and cause serious issues.
To fix this, we need to use 64-bit tags together with 128-bit interlocked
compare-exchange intrinsic
2025-09-17 15:21:37 -07:00
Nikita Smith cc8fdc6c6f order check for COMDATs with any property 2025-09-17 15:21:37 -07:00
Nikita Smith 630c3b42a7 do lightweight import gathering while resolving links 2025-09-17 15:21:37 -07:00
Nikita Smith d4ac5ede77 assign correct removed section type 2025-09-17 15:21:37 -07:00
Nikita Smith 8a46ee0ad2 return full path to the first matched file 2025-09-17 15:21:37 -07:00
Nikita Smith 0b5dd92a87 minor tweaks 2025-09-17 15:21:37 -07:00
Nikita Smith ded932e3ba skip library searches for import stubs 2025-09-17 15:21:37 -07:00
Nikita Smith 98eaf67dd8 while symbol table is being built sort weak and undefined symbols to
separate chunk lists to speed up library search
2025-09-17 15:21:37 -07:00
Nikita Smith 4e1ebe5a6b change import stub symbol characteristic to search alias to skip them
on subsequent searches
2025-09-17 15:21:37 -07:00
Ryan Fleury 7d7edd7cf7 renormalize line endings 2025-09-17 15:21:24 -07:00
Ryan Fleury 6abdadcccb garbage collect window states on quit as well 2025-09-17 14:50:06 -07:00
Ryan Fleury 0d15b8670b eliminate bifurcated rw lock path based on exclusive mode; promote thread operations to base layer, use os layer as impl; first pass on moving file streaming layer to base layer's async wavefront 2025-09-17 14:47:55 -07:00
Ryan Fleury 99c989a3c3 first pass at setting up base layer async thread path 2025-09-17 10:06:21 -07:00
Ryan Fleury 443646b356 rdi make: fix incorrect base encoding offset initialization when pushing into new location chunk 2025-09-16 12:28:33 -07:00
Ryan Fleury 49bcb252d9 remove year from license 2025-09-16 11:51:10 -07:00
Ryan Fleury c5a1da5c80 bump to 22 2025-09-16 11:48:00 -07:00
Ryan Fleury 3ab9f72c76 readme pass 2025-09-16 11:47:04 -07:00
Nikita Smith 80967fac12 pre-parse section names and flag debug info sections 2025-09-16 10:31:02 -07:00
Nikita Smith 3224c5e0aa skip linker info sections during relocation patching, also log a message
when encountering an unsupported machine type
2025-09-16 10:31:01 -07:00
Nikita Smith 488849792c change file search to return on first match 2025-09-16 10:31:01 -07:00
Nikita Smith 7095a8cd6e fix bug where new object tracking failed, causing certain objs to be
skipped during the symbol table input step
2025-09-16 10:31:01 -07:00
Nikita Smith 5aff575feb discard empty symbol nodes 2025-09-16 10:31:01 -07:00
Nikita Smith b5a2bbaf54 early-out of default library searches 2025-09-16 10:31:01 -07:00
Nikita Smith d6596efac8 allow weak symbols to resolve to other weak symbols 2025-09-16 10:31:01 -07:00
Nikita Smith c47b35f635 update link symbol set logic to replace import address symbols with jump
thunk symbols
2025-09-16 10:31:01 -07:00
Nikita Smith c7c86cd360 do not report unresolved symbols in debug info sections 2025-09-16 10:31:01 -07:00
Ryan Fleury 937c6c8bce eliminate radcon, eliminate unused string helpers 2025-09-16 10:17:02 -07:00
Ryan Fleury 1b82c52803 only enable priority thread running on initial run loop; do not pay the cost every run loop iteration 2025-09-15 17:18:59 -07:00
Ryan Fleury 2a8ca37cb3 record & restore target window on runs 2025-09-15 14:10:30 -07:00
Ryan Fleury c7bb49092f radbin dump: isolate output bundling on lane 0 2025-09-15 13:28:43 -07:00
Ryan Fleury cf94b3757e wide rdi dumping 2025-09-15 13:02:32 -07:00
Ryan Fleury 26606d7895 do not strip enums/aliases on array index ops 2025-09-15 11:32:22 -07:00
Ryan Fleury e021079d05 bump rdi encoding version 2025-09-09 08:28:08 -07:00
Nikita Smith b1609017c5 inline xxhash functions 2025-09-08 16:07:31 -07:00
Nikita Smith 763bb57459 revert hasher 2025-09-08 16:07:31 -07:00
Nikita Smith 98a05728b3 add check for whether weak symbol is resolved 2025-09-08 16:07:31 -07:00
Nikita Smith fc0a7d51d3 warning fixes 2025-09-08 16:07:31 -07:00
Nikita Smith 58e3af5b3c test for linking using first and second lib headers 2025-09-08 16:07:31 -07:00
Nikita Smith bbe430cc2f write first linker member header with symbol names grouped by member 2025-09-08 16:07:31 -07:00
Nikita Smith 24b427fe72 delete unused blake3 headers 2025-09-08 16:07:31 -07:00
Nikita Smith ee3832ea3b parallel for lib symbol search 2025-09-08 16:07:31 -07:00
Nikita Smith fb46d0bba4 sort symbol names in first member header 2025-09-08 16:07:31 -07:00
Nikita Smith 7193986305 binary search for strings 2025-09-08 16:07:31 -07:00
Nikita Smith 00536f7ea8 rewrite set linked symbol logic to respect declaration order in obj symbol table 2025-09-08 16:07:31 -07:00
Nikita Smith 8a22910d9b add "Links" log type for diagnosing linked lib members 2025-09-08 16:07:31 -07:00
Nikita Smith 082f6cf6fd fix free block check and remove unused free_size field 2025-09-08 16:07:31 -07:00
Nikita Smith 8f749f4239 use global symbol table to detect duplicate imports 2025-09-08 16:07:31 -07:00
Nikita Smith 7cea036bc1 clean up pass over symbol table
- rename functions for consistency
- remove unused code
2025-09-08 16:07:31 -07:00
Nikita Smith 222c220d99 make xxhash API funcs static and hash string size too 2025-09-08 16:07:31 -07:00
Ryan Fleury 80b65bc0fb fix treatment of unitless pdbs 2025-09-08 16:06:45 -07:00
Nikita Smith 069d683690 fix crash when obj does not have debug info 2025-09-06 09:54:23 -07:00
Nikita Smith 3459070f71 remove windows.h from blake3 2025-09-06 09:54:23 -07:00
Nikita Smith a6432cce8e improve unresolved symbol errors
- collect symbol references and print out objs that reference
  unresolved symbol
- print source file location of the references
2025-09-06 09:54:23 -07:00
Nikita Smith d92f45784d rename defined symbol to obj ref, as the symbol table no longer has
scopes and it makes no sense to refer to them that way
2025-09-06 09:54:22 -07:00
Nikita Smith 21163264d4 redirect entry point to CRT version if name is inferred 2025-09-06 09:54:22 -07:00
Nikita Smith a11406ac51 declare thunk symobls as functions 2025-09-06 09:54:22 -07:00
Ryan Fleury 40d6ce2f59 do not return zeroes for top-level structures in pdb parser; ensure you have a top-level readable pointer, always 2025-09-06 09:53:04 -07:00
Ryan Fleury 0c161f83c7 fix clang 2025-09-05 17:09:01 -07:00
Ryan Fleury 23a68faadd rdim2 -> rdim; p2r2 -> p2r 2025-09-05 17:06:19 -07:00
Ryan Fleury 51ef166e60 eliminate all old conversion/baking code 2025-09-05 17:02:56 -07:00
Ryan Fleury 78530fb10d merge p2r2 into original p2r, delete old conversion path; replace pdb -> breakpad converter & dependency on old converter 2025-09-05 16:35:35 -07:00
Ryan Fleury a2b4e7bdc5 fix missing null voff in scope voff data section 2025-09-05 16:02:38 -07:00
Nikita Smith 11373f4432 disable COFF group info generation 2025-09-05 15:19:31 -07:00
Nikita Smith f2ee135439 fix up symbols visibility 2025-09-05 15:19:31 -07:00
Nikita Smith 56c43ad614 clean up HashTable, removed unused command line switches, added
list wrapper for alt names, added natvis for HashTable, AltNameList,
MergeDirectiveList, and IncludeSymbolList
2025-09-05 15:19:31 -07:00
Nikita Smith 6a3d7e65f3 remove year from the copyright 2025-09-05 15:19:31 -07:00
Nikita Smith e88dc44f31 clean up debug leftovers 2025-09-05 15:19:31 -07:00
Nikita Smith 580303b0dd emit jump thunks for imports only when needed 2025-09-05 15:19:30 -07:00
Nikita Smith 43e81b934b move weak symbol replacer to the symbol table layer 2025-09-05 15:19:30 -07:00
Nikita Smith 8d75497bba do not set function pad min switch by default 2025-09-05 15:19:30 -07:00
Nikita Smith 0b0a2664d1 merge .idata with .rdata 2025-09-05 15:19:30 -07:00
Nikita Smith a64f8f4196 clean up over base strings in the linker layer 2025-09-05 15:19:30 -07:00
Nikita Smith 9f6da0ec63 simplify section removal and purging 2025-09-05 15:19:30 -07:00
Nikita Smith 43b35d43dc change lib sort to preserve input order 2025-09-05 15:19:30 -07:00
Nikita Smith 845e225e81 push alt name strings after they are copied to the config arena 2025-09-05 15:19:30 -07:00
Nikita Smith fdad3f4f58 natvis for lib member ref 2025-09-05 15:19:30 -07:00
Nikita Smith 78b1f7e701 optionally emit import thunks 2025-09-05 15:19:30 -07:00
Nikita Smith 1aac27095e WIP: reorder input and library search order to match MSVC behavior 2025-09-05 15:19:30 -07:00
Nikita Smith 240935f0cc WIP: use MSVC rule for COMDAT symbol replacement 2025-09-05 15:19:30 -07:00
Nikita Smith d9eb26a830 infer subsystem when only entry point is specified 2025-09-05 15:19:30 -07:00
Nikita Smith b0db2b19f8 move entry point name redirection helper to MSCRT layer 2025-09-05 15:19:30 -07:00
Nikita Smith e1b7168605 update weak vs undefined replacement rule 2025-09-05 15:19:30 -07:00
Nikita Smith d7cdaa98b5 oops forgot to set enum type 2025-09-05 15:19:30 -07:00
Nikita Smith c397b1dfb1 handle common section case 2025-09-05 15:19:30 -07:00
Nikita Smith 843de72f64 add U8 atomic exchange for clang and gcc 2025-09-05 15:19:30 -07:00
Nikita Smith 0dac1a91db fix u128 make 2025-09-05 15:19:30 -07:00
Nikita Smith fc4e269211 ignore sign conversions in stb_sprintf.h 2025-09-05 15:19:30 -07:00
Nikita Smith daf69ff1c7 fix sign conversion in radsort.h 2025-09-05 15:19:30 -07:00
Nikita Smith 971f1b9a2f ignore sign conversions in blake3 2025-09-05 15:19:30 -07:00
Nikita Smith 1a9e17ee37 remove invalid normalize helpers for integer vectors (they always produce zero) 2025-09-05 15:19:30 -07:00
Nikita Smith e0c409e3f4 move prototype decl to base_core.h to fix implicit function usage 2025-09-05 15:19:30 -07:00
Nikita Smith 3bd8f0e1d5 fix argument expansion in github actions and build.bat 2025-09-05 15:19:30 -07:00
Nikita Smith 41fe8a7410 merge undefined and weak search passes 2025-09-05 15:19:30 -07:00
Nikita Smith b64e1dca9a WIP fix lib push order and sort new inputs 2025-09-05 15:19:30 -07:00
Nikita Smith 67e66dc26e WIP switching to serial library search-style, removed lib scope from
the symbol table
2025-09-05 15:19:30 -07:00
Nikita Smith 330c8ead38 move member queue-attempt flag from symbol to lib struct 2025-09-05 15:19:30 -07:00
Nikita Smith f1b22dbe27 change library to use compressed member offsets 2025-09-05 15:19:30 -07:00
Nikita Smith 89d496c855 fix replacement rule for weak search library vs undefined 2025-09-05 15:19:30 -07:00
Nikita Smith 0ceadff525 maintain input order of objs in PDB 2025-09-05 15:19:30 -07:00
Ryan Fleury 4eca7f7fea source file / source line map baking 2025-09-05 15:19:30 -07:00
Ryan Fleury efb24fb0fa checkpoint on src file / src line map baking 2025-09-05 15:19:30 -07:00
Ryan Fleury d2e6e5de5a oops - fix non-allocation in previous part 2025-09-05 15:19:30 -07:00
Ryan Fleury 15e9cda7d2 new location info baking, new constants baking 2025-09-05 15:19:30 -07:00
Ryan Fleury ee8dc27428 location data / location block baking 2025-09-05 15:19:30 -07:00
Ryan Fleury cd77ddb1b7 pdb converter - new location info building for all cases 2025-09-05 15:19:30 -07:00
Ryan Fleury 6f9b22b258 plug in new location building code to pdb conversion 2025-09-05 15:19:30 -07:00
Ryan Fleury cc9f45299a eliminate separate chunk list for location cases 2025-09-05 15:19:30 -07:00
Ryan Fleury fa05bbf2a5 udt member/enum-val layout & nested baking; use rio to pre-fault all commits 2025-09-05 15:19:30 -07:00
Ryan Fleury a84142ed77 re-nest enum vals & members into udts; we want to keep the building API flexible with order of member building, and we can assume ~statistically-uniform distribution across all udts, so it makes more sense to just parallelize on udts, and pay the small cost of an upfront per-lane layout. 2025-09-05 15:19:30 -07:00
Ryan Fleury 8b83e5ef48 more non-determinism & bug fixes in name map & idx run map building 2025-09-05 15:19:29 -07:00
Ryan Fleury 4c3bb98c64 more determinism fixes 2025-09-05 15:19:29 -07:00
Ryan Fleury 096b631e8a remove debugging code 2025-09-05 15:19:29 -07:00
Ryan Fleury 27f2acd45d further progress/fixes on pdb -> rdi determinism 2025-09-05 15:19:29 -07:00
Ryan Fleury 27d4793900 fix line table building non-determinism 2025-09-05 15:19:29 -07:00
Ryan Fleury f093ba9d35 fix src file path gathering determinism - was caused by interleaving each lane's non-inline and inline file paths - with different thread counts, these subdivisions will be different, so the order will change 2025-09-05 15:19:29 -07:00
Ryan Fleury 6234fb0c49 fix incorrect scope voff serialization offsets 2025-09-05 15:19:29 -07:00
Ryan Fleury 955f033043 fix incorrect idx run baking; slots need to be laid out based on *idx counts*, rather than *value counts*! 2025-09-05 15:19:29 -07:00
Ryan Fleury e276ce4fb3 stub out src file baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 57125fee1b eliminate helpers from string map baking; no point in extra entry points for partial bakes 2025-09-05 15:19:29 -07:00
Ryan Fleury 2f9006bb8a bugfix name map baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 46ac437e86 name map baking / serialization 2025-09-05 15:19:29 -07:00
Ryan Fleury 92f24a043d idx runs baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 55b05301a4 expand scope vmap sorting -> all vmaps; do final vmap bakes; do first pass of scope (1 scope -> many locals, many voffs) layout / baking 2025-09-05 15:19:29 -07:00
Ryan Fleury cc0d707eb2 eliminate 'lane groups', since we can go wide on the sorts now 2025-09-05 15:19:29 -07:00
Ryan Fleury 1d7cd4f4d2 cleanup / radix sort experimentation 2025-09-05 15:19:29 -07:00
Ryan Fleury a44fbb0909 parallel radix sort for scope vmap baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 8fe4b3524f with sufficient threads, split baking threads into two groups: small # of threads to do expensive 'background' baking tasks, use the rest to do wide predictable baking stuff 2025-09-05 15:19:29 -07:00
Ryan Fleury f065ca33a2 location block baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 3b1aae44d0 location info baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 71cbdba76e remove old section requirement part of rdi, since all sections are now fixed; unit/scope/global vmap baking; collapse chunk list impls 2025-09-05 15:19:29 -07:00
Ryan Fleury e4ac3febd0 finish new udt baking; pull members & enum vals out of sub-udt lists, makes it much harder to layout & parallelize - instead pull them aside into their own chunk lists, require that UDTs just point to their first member; that way we can go wide when baking UDT members/enum-vals 2025-09-05 15:19:29 -07:00
Ryan Fleury b8414c4bfd type, first part of udt baking, string baking 2025-09-05 15:19:29 -07:00
Ryan Fleury ad4e57ec5a idx run baking 2025-09-05 15:19:29 -07:00
Ryan Fleury b22f6d3544 fully wide name map baking, joining, & sorting 2025-09-05 15:19:29 -07:00
Ryan Fleury 95e88e92e7 top-level info string baking 2025-09-05 15:19:29 -07:00
Ryan Fleury 618233eba1 checkpoint on new baker; globals, threads, inline sites 2025-09-05 15:19:29 -07:00
Ryan Fleury 595270bdab path tree baking 2025-09-05 15:19:29 -07:00
Ryan Fleury b169090dc6 checkpoint on new rdi baking; line table baking, string map building, plug in radsort over bad radix sort; arena tweak to aovoid unnecessary zeroes 2025-09-05 15:19:29 -07:00
Ryan Fleury 66ec3e834b rdi baking: wide line table gathering/joining & sorting 2025-09-05 15:19:29 -07:00
Ryan Fleury 69d0da9586 checkpoint on moving all of radbin to wavefront-style, first step to going wide on rdi baking as well 2025-09-05 15:19:28 -07:00
Mārtiņš Možeiko d8bb8c76c6 add shadow stack register and read it in win32 thread context 2025-09-03 09:36:20 -07:00
Ryan Fleury c35c14dadb prefer last match to first in debug info, to gracefully avoid stale debug info in pdbs 2025-08-30 12:04:39 -07:00
Ryan Fleury be5634c448 p2r2 - final conversion output bundling 2025-08-19 17:02:05 -07:00
Ryan Fleury cdec8d5980 ctrl/demon: fastfail exception codes / notes; p2r2: finish symbol conversion etc. in new wavefront-style version 2025-08-19 16:47:12 -07:00
Nikita Smith 0656020ab3 sync primitive fixes 2025-08-18 19:26:35 -07:00
Nikita Smith 429ba8b080 helper for writing 32-bit address relocation 2025-08-18 19:09:32 -07:00
Nikita Smith eee6a9c08a natvis for obj list 2025-08-18 19:09:32 -07:00
Nikita Smith b56ce72b7f test cases for weak vs weak 2025-08-18 19:09:32 -07:00
Nikita Smith 257914da2f handle alternate name directive after obj input 2025-08-18 19:09:32 -07:00
Nikita Smith b19f73b93a change unresolved weak symbol type to undefined 2025-08-18 19:09:32 -07:00
Nikita Smith cdf515793f stop walking on reaching an undefined symbol 2025-08-18 19:09:32 -07:00
Nikita Smith 0983915f40 oops forgot to init the delay load dll hash table and the established name string 2025-08-18 19:09:32 -07:00
Nikita Smith b05237ceec handle anti-dependency weak symbol 2025-08-18 19:09:32 -07:00
Nikita Smith 31b2b1c0f7 add replacement cases for weak vs. undefined and vice versa 2025-08-18 19:09:32 -07:00
Nikita Smith 873aa475e8 update tests to conform to new linking rules 2025-08-18 19:09:32 -07:00
Nikita Smith 1bca83610f changed symbol search logic to run in three steps: undefined, weak,
and anti-dependency weak, allowing linking to proceed only after
symbols from previous step are added to the symbol table

this solves the problem of anti-dependency symbols because they are
searched in libraries if the dependency is unresolved weak symbol
2025-08-18 19:09:32 -07:00
Nikita Smith e1786d0a11 discard delay loads in the config before they get to link context builder 2025-08-18 19:09:32 -07:00
Nikita Smith 1ce2fbfd1a helper for setting default symbol 2025-08-18 19:09:32 -07:00
Nikita Smith a3582332ee push a null symbol as a terminator for /alternatename weak symbol chain 2025-08-18 19:09:31 -07:00
Nikita Smith 04d2877b40 strip leading white space 2025-08-18 19:09:31 -07:00
Nikita Smith 81381f9a6d minor cleanups 2025-08-18 19:09:31 -07:00
Nikita Smith 81c68cfdd3 register common and absolute symbols in library's symbol table 2025-08-18 19:09:31 -07:00
Nikita Smith e27831902e note 2025-08-18 19:09:31 -07:00
Nikita Smith c53b8d43d0 assign symbol indices before serializing symbols so forward-references
are possible
2025-08-18 19:09:31 -07:00
Ryan Fleury cff69f287a p2r2 more progress; src file line sequence equipping, sketch out symbol conversion - we unfortunately cannot currently easily subdivide units! we need to pull out the few 'record-range' concepts and make them flat first, e.g. proc base address for inline sites, frameproc info, etc. 2025-08-18 16:58:05 -07:00
Ryan Fleury 83d4afabd5 p2r2: types building 2025-08-18 16:28:22 -07:00
Ryan Fleury 0fa45fe71b p2r2: reslice per-lane work; bucket subsets of units by record count, rather than assigning units to lanes 2025-08-18 15:24:25 -07:00
Ryan Fleury 55f21018df unit conversion, line info conversion 2025-08-18 14:19:48 -07:00
Ryan Fleury 34cb8ded2c better uniform lane range distribution when count / lanes is not cleanly divisible; plug in source file path gathering 2025-08-18 12:01:55 -07:00
Ryan Fleury d52b6d7bca go wide on msf stream extraction 2025-08-18 11:36:33 -07:00
Ryan Fleury d0ece7bc57 hook up p2r2 to radbin 2025-08-18 11:26:05 -07:00
Ryan Fleury c33dd2869a define synchronization primitive interface in base layer, implement using os layer; convert all usage -> base layer; use base sync primitives in lane tctx info 2025-08-18 10:46:43 -07:00
Ryan Fleury a48651471d share-read in header analysis in radbin 2025-08-15 16:54:06 -07:00
Ryan Fleury e566b2ed30 checkpoint on wavefront-style pdb -> rdi converter 2025-08-15 16:50:28 -07:00
Ryan Fleury f1a1863d5c set up base-layer tctx info for thread wavefront metadata 2025-08-15 12:16:58 -07:00
Ryan Fleury f754b4c2db fix pointer/array comparison paths not being enabled for not-equal; fix value arithmetic paths applying in type comparisons 2025-08-15 11:31:50 -07:00
Ryan Fleury 83650a5fe0 support unsigned -> unsigned int; support as-style casts in expressions; pack int alias in pdb-produced rdis 2025-08-15 10:56:42 -07:00
Ryan Fleury 36c626e375 Merge branch 'master' of https://github.com/EpicGames/raddebugger into dev 2025-08-14 11:31:43 -07:00
Ryan Fleury 7be1faaa9b fix callstack cache lookup early out case 2025-08-13 14:13:10 -07:00
Ryan Fleury 5144ced282 turn off call stack tree macro for now 2025-08-13 13:46:02 -07:00
Ryan Fleury 6a8277536f fix one-sided bounds check in text containing-scope binary search 2025-08-13 13:21:34 -07:00
Nikita Smith 1d6eae2b18 minor fixes for gathering library members 2025-08-12 19:03:51 -07:00
Nikita Smith 086d774b8b fix ELF compressed header and skip duplicate sections 2025-08-12 14:10:13 -07:00
Ryan Fleury 788df5f556 os: barrier 2025-08-12 10:12:05 -07:00
Nikita Smith b50f309422 modified member queue logic to prioritize libs where pull-in reference
symbol is declared
2025-08-11 23:28:03 -07:00
Ryan Fleury a8f6142e63 eval/ir: do not strip enum types off when doing address operations 2025-08-11 16:18:39 -07:00
Ryan Fleury 36dcd65a83 first pass at call stack tree evaluation 2025-08-11 16:08:04 -07:00
Ryan Fleury 056604fb94 sketch out tline -> vline text wrapping cache types; first pass of async call stack tree builder 2025-08-11 13:46:06 -07:00
Nikita Smith 829a35430c add flag to exclude objs from debug info input 2025-08-11 02:49:26 -07:00
Nikita Smith 702fd74b23 minor cleanup in obj initer 2025-08-10 21:41:39 -07:00
Nikita Smith 2b02f5cec6 lifetime fixes
- fully serialize the lib because we cannot guarantee that its members
  will have the same lifetime as the serialized lib
- put import stub symbols on the symbol table arena
2025-08-10 21:35:33 -07:00
Nikita Smith 7466da1479 mark referenced symbols as live for unresolved-symbol detection 2025-08-08 15:54:21 -07:00
Nikita Smith 9893a8135d fix crash when linking undefined weak symbol 2025-08-08 13:35:47 -07:00
Nikita Smith 137eb6403a fix crash when relocation points to an undefined section symbol 2025-08-07 22:40:20 -07:00
Nikita Smith 4f6f9d61ed inline function for replacing weak symbols with default symbol 2025-08-07 17:41:45 -07:00
Nikita Smith 9a1f96bda2 progress on /opt:ref
Link the debugger and strip unreferenced sections
TODO: Mark referenced undefined symbols for unresolved symbol reporting
2025-08-07 17:36:11 -07:00
Ryan Fleury e1d6b9f319 tweaks 2025-08-06 17:21:44 -07:00
ed 0c32946cd6 Merge remote-tracking branch 'EpicGamesExt/master' 2025-08-06 18:45:17 -04:00
Ryan Fleury af5dcffdac tie scope rendering to settings 2025-08-06 14:33:17 -07:00
Ryan Fleury a227aff8f6 finish containing-scope visualization 2025-08-06 14:24:12 -07:00
Ryan Fleury cd8c3a2172 enable read/write bits on just read data breakpoint on x64 - there is no way to do a read-only (without write) data breakpoint 2025-08-06 11:50:01 -07:00
Ryan Fleury 4c10e84e5f fix txt cache scope lookup binary search 2025-08-05 21:17:50 -07:00
Ryan Fleury 01f60834e9 plug in text scope tree to code slice visualization 2025-08-05 16:36:59 -07:00
Ryan Fleury 230f452edb text cache scope tree lookup paths 2025-08-05 16:11:49 -07:00
Ryan Fleury 5a5fd53bfa scope tree / sorted scope endpoints parsing in text cache parsing 2025-08-05 14:28:49 -07:00
Ryan Fleury c4374810cb fix wrong void type in pdb -> rdi 2025-08-05 13:41:10 -07:00
Ryan Fleury 9cff2bc7dd symbolof operation in eval 2025-08-05 10:21:42 -07:00
Ryan Fleury 1856c52e58 xxhash for ctrl layer 2025-08-05 09:27:38 -07:00
Nikita Smith cff6426741 null check for obj 2025-08-05 08:39:12 -07:00
Nikita Smith d3dedd8bef simplifying symbol table scopes
Linker cannot register extern import symbols initially because
the import object files are not available until all other object files are
resolved. To work around this, we create a stub weak symbol and assign
it to each import symbol. This allows linker to proceed. Once the import
object files are generated, linker replaces the stub symbol with
the actual ones from the import objects.
2025-08-05 08:39:12 -07:00
Nikita Smith dd715dacf7 assign COMDAT symlinks as soon as the symbol table is processed 2025-08-05 08:39:11 -07:00
Nikita Smith 1fe85acff8 refactor include symbols to go through same code path as alternate name symbols 2025-08-05 08:39:11 -07:00
Nikita Smith c1958809eb make use of undocumented anti-dependency search property on weak symbols
to implement alternate name using weak symbols
2025-08-05 08:39:11 -07:00
Nikita Smith 8d246d0c6a pass down to config obj; preparing to refactor alternate name out of the symbol table 2025-08-05 08:39:11 -07:00
Ryan Fleury 31973ac2ac eliminate extra type stuff in rdim, organize / reslice dwarf conversion code, start reading through dwarf conversion 2025-08-04 14:19:17 -07:00
Ryan Fleury b31b4612e9 pre-emptive thread register cache updating on ctrl thread - cache reading/updating on ui thread should always be allowed to gracefully fail, since it is literally impossible on linux, but we can always rely on the ctrl thread to pipe the right thing through eventually. 2025-08-04 13:13:18 -07:00
Ryan Fleury 9c2bdf492f ptrace register reading debugging 2025-08-04 12:36:04 -07:00
Ryan Fleury 209c5e96b8 bitmap view -> rich hover 2025-08-01 11:45:28 -07:00
Ryan Fleury 25963dc9b4 demon/linux: correct main module address range formation; further progress on event processing 2025-07-31 17:33:58 -07:00
Ryan Fleury a323aec6d0 demon/linux: x64 trap writing 2025-07-31 15:10:25 -07:00
Ryan Fleury 7c99e79981 demon/linux: first pass port at x64 register writing 2025-07-31 14:54:28 -07:00
Ryan Fleury 1a19bf9663 render/d3d11: adjust allowed frame 'latency' (frames-in-queue) based on number of active windows, to not unnecessarily block if we have two windows to build frames for; demon/linux: sketch out register writing path, ensure reg read/write paths have slots for other architectures 2025-07-31 14:09:42 -07:00
Ryan Fleury ad735dab5e pull raddbg byte attachment aside into standalone section - this guarantees byte placement, does not rely on ordering, and does not require symbols 2025-07-31 13:15:37 -07:00
Ryan Fleury 9ef87e9d56 fix to match 32 -> 64 change in demon/win32 2025-07-29 14:22:23 -07:00
Ryan Fleury 7403a8ea3b demon/linux: x64 register reading 2025-07-29 14:19:54 -07:00
Nikita Smith 92e6069104 collapse obj directive directive code paths 2025-07-28 20:07:56 -07:00
Nikita Smith 18f83521e4 clean up pass over directives handler; preparing to collapse code paths 2025-07-28 20:07:56 -07:00
Nikita Smith 0b904f4e24 extract function size infer logic into its own block 2025-07-28 20:07:56 -07:00
Nikita Smith 7be9df0e90 move directive section gather logic to obj layer 2025-07-28 20:07:56 -07:00
Nikita Smith 72e073e4e6 fix typo that broke /NODEFAULTLIB usage 2025-07-28 20:07:56 -07:00
Nikita Smith b3efce4b9a better place for this helper function 2025-07-28 20:07:56 -07:00
Nikita Smith 1e1d903878 store library pointer in the obj instead of path; required for prioritized symbol lookup implementation 2025-07-28 20:07:56 -07:00
Nikita Smith 4cb09e73c2 remove warning pragma 2025-07-28 20:07:56 -07:00
Nikita Smith 0b37fac81c move delay load helper to mscrt layer 2025-07-28 20:07:55 -07:00
Ryan Fleury 0e9f2ee03c demon/linux: halting, sigstop cases 2025-07-28 17:47:50 -07:00
Ryan Fleury 64c2d98ede demon/linux: sketch out signal interpretation, more ptrace study 2025-07-28 17:25:24 -07:00
Ryan Fleury 122c27eabe do not funnel non-dwarf sections in dwarf input prep pass 2025-07-28 16:22:23 -07:00
Ryan Fleury 48f5df2523 cleanup pass over elf parsing; base addr calculation? 2025-07-28 16:13:45 -07:00
Ryan Fleury 09f9cc25df os/linux: move-file-path impl 2025-07-28 14:54:48 -07:00
Ryan Fleury 2e8c0875c8 only use type-derived sizes in eval ranges when the evaluation is an offset, not a value 2025-07-28 14:34:46 -07:00
Ryan Fleury 5134d1ce4c adjust eval -> space range mapping to fix a few edge cases 2025-07-28 14:32:47 -07:00
Ryan Fleury c22ecf8e71 output clearing path 2025-07-28 12:05:37 -07:00
Ryan Fleury 97b4abd6de measure os file write helper success by bytes written - do not assume the write completes if the file handle is valid 2025-07-28 11:36:43 -07:00
Ryan Fleury 9b28ab68f2 adjust open user/project path to be more robust in cases of loading corrupted data on startup 2025-07-28 11:26:55 -07:00
Ryan Fleury e3a79dae86 apply slash insensitivity to fuzzy matches 2025-07-27 21:02:34 -07:00
Ryan Fleury 7dca3fd954 os/gfx/win32: fix bad alloc size in new utf16 clipboard path 2025-07-27 20:02:18 -07:00
Ryan Fleury 2e14f34cc8 derefence pointer/reference evaluations when generating block tree, to match expected behavior, & what the string iterator does 2025-07-25 16:11:17 -07:00
Ryan Fleury cb68abe844 packed bits test in mule 2025-07-25 15:31:22 -07:00
Ryan Fleury 163b79e4c0 decay bitfield types in casting path, allow casting to integer types 2025-07-25 15:29:34 -07:00
Ryan Fleury 393c291f63 reflect casting changes to call-cast style 2025-07-25 15:19:35 -07:00
Ryan Fleury 1c2855a314 unwrap decorative type operators on casts when building ops for casting, to allow for graceful enum casting; gracefully skip struct/enum symbol name prefixes 2025-07-25 15:17:39 -07:00
Ryan Fleury 1d67eb42a2 os win32 -> upgrade clipboard paths for unicode 2025-07-25 14:27:38 -07:00
Ryan Fleury 4d7088d321 do not pre-emptively exit the debug event loop on timeout unless we actually have debug strings 2025-07-25 14:21:31 -07:00
Ryan Fleury b5accc9105 apply floating flag to tooltip correctly 2025-07-25 14:00:23 -07:00
Ryan Fleury c43697fb18 fix type debug info table evaluations; fix preference for auto-hook-applied lhs evaluation when doing member/array accesses 2025-07-25 13:29:08 -07:00
Ryan Fleury 81b51446a4 cap maximum frame latency 2025-07-25 11:26:08 -07:00
Nikita Smith 6fda20ec9c helper script for extracting obj paths out of pdb 2025-07-24 17:44:13 -07:00
Nikita Smith 54fad8a89c validate strong symbol interp type 2025-07-24 17:32:05 -07:00
Nikita Smith 6cc5be0065 opt ref test 2025-07-24 17:32:05 -07:00
Nikita Smith 2d52e274ce remove debug code 2025-07-24 17:32:05 -07:00
Nikita Smith cc6e56eee1 do full path check for thin objs only 2025-07-24 17:32:05 -07:00
Ryan Fleury 955a5f01ca fix normalized path allocation 2025-07-23 17:28:14 -07:00
Ryan Fleury 66d5d93fc9 build path tree via non-case-mutated (non-normalized) src file paths in rdi build; still sanitize paths, but do not normalize them until we actually have to build the normalized file path map build 2025-07-23 17:18:54 -07:00
Ryan Fleury 45d1f8e58b clear overwritten path on cfg writes 2025-07-23 16:24:34 -07:00
Nikita Smith 9b91a0f907 github actions fun 2025-07-23 16:09:48 -07:00
Nikita Smith 9fab69002c fix buffer over-read in sinfl.h 2025-07-23 16:09:48 -07:00
Nikita 295a822889 put quotes around arguments to prevent command injection 2025-07-23 16:09:48 -07:00
Nikita Smith 07c7178770 filter out removed COMDATs from the PDB public symbols 2025-07-23 16:09:48 -07:00
Nikita Smith ffc9317067 add a relocation to "a" to prevent linker from removing .test 2025-07-23 16:09:48 -07:00
Nikita Smith 17d35cd327 add garbage collector for COMDAT sections 2025-07-23 16:09:48 -07:00
Nikita Smith a6b2cf64ba WIP collect sections associations 2025-07-23 16:09:48 -07:00
Nikita Smith a4ac07162e test abs vs abs 2025-07-23 16:09:48 -07:00
Nikita Smith d32667546d factor out weak symbol resolution logic and apply it to the symbol table
when building link context
2025-07-23 16:09:48 -07:00
Nikita Smith 7cd5a670e3 WIP factoring out symbol table fixups 2025-07-23 16:09:48 -07:00
Ryan Fleury 051bacf124 reflect cast changes in cast-calls 2025-07-23 16:05:30 -07:00
Ryan Fleury 3ae3f94db0 split unsigned => signed casting case from shrinking conversion truncation cast path 2025-07-23 16:04:59 -07:00
Ryan Fleury a776f53379 skip block group row unpack paths when we're doing the special case of a root block row generation 2025-07-23 15:20:41 -07:00
Ryan Fleury cf9d736ff5 promote register space -> primary space, on space reads 2025-07-23 15:00:05 -07:00
Ryan Fleury 38f769c00d only apply truncation to integer types, oops 2025-07-23 14:36:20 -07:00
Ryan Fleury cd64d959ef apply integer truncation operations on both sign/size changes, rather than just size 2025-07-23 14:31:51 -07:00
Ryan Fleury 8d1de1b24c report user errors from ctrl thread more vigorously 2025-07-23 14:06:17 -07:00
Ryan Fleury a85284793b be more robust to user/project paths passed via command line to raddbg; do not interpret them as targets 2025-07-23 14:03:39 -07:00
Ryan Fleury 87fa6b9239 fix <64-bit integer eval stringification path, to not interpret too many bits 2025-07-23 13:26:23 -07:00
Ryan Fleury 6026ac16d4 fix call stack flickering; do not timeout early if we need to fall back to stale results after requesting new call stack compute 2025-07-23 10:38:59 -07:00
Ryan Fleury 64a0682611 fix processing of select-alls in watch tabnles 2025-07-23 10:34:27 -07:00
Ryan Fleury fcf3e73f5f demon/linux: thread resuming in dmn_ctrl_run 2025-07-17 18:51:40 -07:00
Ryan Fleury 6fb406d6c5 demon/linux: launch event info coverage, module path strings, pipe deferred debug info events first on dmn_ctrl_run 2025-07-17 18:05:00 -07:00
Ryan Fleury d5380998a7 os/linux: fix rwlock cv waits 2025-07-17 16:32:12 -07:00
Ryan Fleury 145ad87967 fix incorrect font metrics in freetype font provider 2025-07-17 15:18:02 -07:00
Ryan Fleury eba2aff0f0 demon/linux: process read/write 2025-07-17 14:46:31 -07:00
Ryan Fleury 3466779d41 demon/linux: kill, detach, process iteration 2025-07-17 14:45:08 -07:00
Ryan Fleury 2db6b826a1 demon/linux: launching events/entity builds; access synchronization 2025-07-17 14:31:57 -07:00
Ryan Fleury 0610d5ae13 demon/linux: pid extraction, module extraction, most of launching path 2025-07-17 14:08:44 -07:00
Ryan Fleury 190b3384f9 preserve selected thread info on continues 2025-07-16 15:52:41 -07:00
Ryan Fleury 6e6a2df0cb implement 'priority thread' in demon, to prefer debug events from selected thread - greatly improves multithreaded stepping 2025-07-16 15:38:27 -07:00
Nikita Smith db52ba32e6 helper for profiling parallel fors 2025-07-16 13:54:58 -07:00
Nikita Smith 093e43d2ff change output folder name 2025-07-16 13:54:58 -07:00
Ryan Fleury 5e04734444 source_files collection evaluation; expand switch to allow file evaluations 2025-07-16 13:52:49 -07:00
Ryan Fleury f6931ef0b7 apply string size limitations from explicit array types in eval string iterator 2025-07-16 13:10:35 -07:00
Ryan Fleury fc8b521b2c adjust demon to correctly produce, & ctrl to correctly process, breakpoint events which cannot be correlated to a high-level UI-defined breakpoint state. this catches, for example, data breakpoints which are programmatically set by the user program. 2025-07-16 11:54:02 -07:00
Ryan Fleury 26f9e09483 eliminate cases where typekind_function was being assumed when building keys for function & inline site types - this cannot be assumed, and will lead to bad type info interpretation 2025-07-16 10:35:14 -07:00
Ryan Fleury 0902d9fafb detach in control menu 2025-07-01 20:08:44 -07:00
Ryan Fleury a4d0fbcb46 always show null pointer address values with string visualization 2025-07-01 09:46:12 -07:00
Ryan Fleury dc79c06031 adjust implicit accessing rules with nested auto hooks (slice-of-slices case); prefer to not show address value with string prefix content in single-line eval stringification 2025-06-30 09:33:23 -07:00
Ryan Fleury 15a7efab43 slice-of-slice ambiguity debugging note 2025-06-29 18:22:03 -07:00
Ryan Fleury 74e1ccd147 invalidate mem/reg/run generations on every dmn run 2025-06-28 11:18:02 -07:00
Ryan Fleury 124c71c19a notes & bump version 2025-06-28 11:15:02 -07:00
Ryan Fleury 89cfd65f9c fix incorrect programmatic bp generation on vaddr range notes... 2025-06-28 11:07:43 -07:00
Ryan Fleury 709bc2cfab float run/mem/reg generations out of demon, into core; fix issue of demon access synchronization w/ mem gens, causing failure-to-update-stale-parts-of-process-memory-cache 2025-06-28 10:02:51 -07:00
Ryan Fleury e34e8adbaa do not disqualify flagged expr breakpoints if 0 2025-06-27 23:15:02 -07:00
Ryan Fleury ac8c402868 note 2025-06-27 23:03:16 -07:00
Ryan Fleury b67d7f729b do not require eval cache for breakpoint touched-symbols parse/check; reintroduce memory read retry loop - necessary in some cases 2025-06-27 22:59:10 -07:00
Ryan Fleury 5ba9b6abd8 regression debugging & notes 2025-06-27 22:54:34 -07:00
Ryan Fleury 0018147b95 bounds-check di matches 2025-06-27 14:40:13 -07:00
Ryan Fleury d4c15d9089 pull out type-only identifier resolution and switch to match store; eliminate synchronous matching work 2025-06-27 13:55:18 -07:00
Ryan Fleury d723a00979 zero precise match info before doing matches in dbgi async match path, so we don't keep stale ones around too long, once they've been invalidated 2025-06-27 12:52:13 -07:00
Ryan Fleury 09a047feee zero match store dbgi/idx selection info if params hash has changed; we can still return the section kind (e.g. for syntax highlighting), but we no longer want to try to refer to any specific debug info slot, since it may have been evicted. 2025-06-27 12:36:27 -07:00
Ryan Fleury 5750c17c80 eliminate old slow identifier resolution path 2025-06-27 12:34:46 -07:00
Ryan Fleury 29886171b3 fix missing strtbl stream case in msf parser 2025-06-27 12:24:58 -07:00
Ryan Fleury 460dbe52fe fix invalid strtbl validity check in pdb_has_file_ref path 2025-06-27 12:19:07 -07:00
Ryan Fleury b315bf6811 switch eval debug info symbol name resolution to using async match store 2025-06-27 11:58:04 -07:00
Ryan Fleury a702e187ef expand match store cache to include all match info 2025-06-27 11:24:59 -07:00
Ryan Fleury 0d75e8e5e0 fix raddbg_is_attached data marker - static won't work, will be stripped... 2025-06-25 17:36:03 -07:00
Nikita Smith 4322c9ccfc change torture to assume default liker to be radlink, typo fix, and
added progress report
2025-06-25 10:53:25 -07:00
Nikita Smith 17ca83697b draft symbol table fixups to prepare for refactoring symbol table patching step 2025-06-25 10:53:25 -07:00
Nikita Smith 08f2b749e8 omit file offset, file size, and hash on bss sections 2025-06-25 10:53:25 -07:00
Nikita Smith 7769a485ba more merge fixes 2025-06-25 10:53:25 -07:00
Nikita Smith 91ddd214b3 fix string to U64 conversion
- handle zero on input string
- handle upper and lower case prefixes
2025-06-25 10:53:25 -07:00
Nikita Smith a954c2125c merge fixups 2025-06-25 10:53:25 -07:00
Nikita Smith fcb06579a4 collapse symbol scope and symbol type enums 2025-06-25 10:53:25 -07:00
Nikita Smith b1723ce066 gracefully handle invalid libs 2025-06-25 10:53:25 -07:00
Nikita Smith 2ba9f2a61b fix uinited var warning 2025-06-25 10:53:24 -07:00
Nikita Smith 153d78ec6a unpoison memory-mapped files 2025-06-25 10:53:24 -07:00
Nikita Smith 790c95fc80 organization pass over symbol table files 2025-06-25 10:53:24 -07:00
Nikita Smith 7120d0c1a4 share memory mapped files 2025-06-25 10:53:24 -07:00
Nikita Smith 2fbaafa32c parallel compute common block 2025-06-25 10:53:24 -07:00
Nikita Smith a395398bdf remove global variable for null section contrib 2025-06-25 10:53:24 -07:00
Nikita Smith f5b19675cb merge conflict 2025-06-25 10:53:24 -07:00
Nikita Smith 0aadf60359 update code block dividers 2025-06-25 10:53:24 -07:00
Nikita Smith 46663688e2 on read memory map files 2025-06-25 10:53:24 -07:00
Nikita Smith 16e72fd573 remove unused switch 2025-06-25 10:53:24 -07:00
Nikita Smith 6b3a63f474 correct task name for weak symbol patch 2025-06-25 10:53:24 -07:00
Nikita Smith 65095437b7 allow forward reference tag symbols 2025-06-25 10:53:24 -07:00
Nikita Smith e487fbc494 minor torture fixes 2025-06-25 10:53:24 -07:00
Nikita Smith ba326924ee test for relocation against removed COMDAT 2025-06-25 10:53:24 -07:00
Nikita Smith ad3e6e0b79 pipe obj reads through IO layer 2025-06-25 10:53:24 -07:00
Nikita Smith 4c972c0fba handle COMDAT symbols with non-zero section offset 2025-06-25 10:53:24 -07:00
Nikita Smith 422829b196 print align and debug sections 2025-06-25 10:53:24 -07:00
Nikita Smith bddf088df1 collect type indices in L_THREAD32 2025-06-25 10:53:24 -07:00
Nikita Smith c7d6145ec9 print section contributions in RAD_MAP 2025-06-25 10:53:24 -07:00
Nikita Smith 1fde5a5120 linker natvis 2025-06-25 10:53:24 -07:00
Nikita Smith 06e844abaa remove default delay bind table 2025-06-25 10:53:24 -07:00
Nikita Smith 048600260c special case fill for bss contribs 2025-06-25 10:53:24 -07:00
Nikita Smith a4b4d5799a fixes for delay import by ordinal and null terminate ILT, IAT, BIAT, and UIAT 2025-06-25 10:53:24 -07:00
Nikita Smith 8ba64238a2 delay load test 2025-06-25 10:53:24 -07:00
Nikita Smith 3c4edba465 validate section flags on merge 2025-06-25 10:53:24 -07:00
Nikita Smith cccbbfc74c do not patch debug section symbols and patch replaced COMDATs in separate
pass
2025-06-25 10:53:24 -07:00
Nikita Smith b19be0574c function pad min - final pass over 2025-06-25 10:53:24 -07:00
Nikita Smith bbb825adf4 extract hotpatch flag from compile symbol 2025-06-25 10:53:24 -07:00
Nikita Smith a5119e3b51 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita Smith d7b8de5998 test empty section and section with removed flag 2025-06-25 10:53:24 -07:00
Nikita Smith 5fb0d978b9 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita Smith 9d93eda3ed simplify section table 2025-06-25 10:53:24 -07:00
Nikita Smith ecdee57c60 move helpers to COFF layer 2025-06-25 10:53:24 -07:00
Nikita Smith a484906cf9 create section contribution for common block 2025-06-25 10:53:24 -07:00
Nikita Smith 95bea877ab merge .bss with custom section to simplify linker output verification 2025-06-25 10:53:24 -07:00
Nikita Smith 15836572f4 factor out section sort index into contribution chunk and simplify
contribution sorting
2025-06-25 10:53:24 -07:00
Nikita Smith f64265aafe typo in contrib sort 2025-06-25 10:53:24 -07:00
Nikita Smith 246bbf1e23 fix common block patch 2025-06-25 10:53:24 -07:00
Nikita Smith 490b22f6f9 put common blocks in .bss 2025-06-25 10:53:24 -07:00
Nikita Smith 626d94104d atomic contrib push 2025-06-25 10:53:24 -07:00
Nikita Smith b3aadbd49a store first data node in section contrib 2025-06-25 10:53:24 -07:00
Nikita Smith 3fb5e21d73 profiler markup 2025-06-25 10:53:24 -07:00
Nikita Smith 439fd0324d typos 2025-06-25 10:53:24 -07:00
Nikita Smith 75d02f1c1e check symbol presence using stable name pointer 2025-06-25 10:53:24 -07:00
Nikita Smith 5fd06f4466 do not push section contribs for sections without bytes 2025-06-25 10:53:24 -07:00
Nikita Smith af00acd0f5 add missing symbol replacement logic 2025-06-25 10:53:24 -07:00
Nikita Smith 205723f8d6 parallelize symbol tables patching 2025-06-25 10:53:24 -07:00
Nikita Smith d604456def align sizeofs 2025-06-25 10:53:24 -07:00
Nikita Smith 32a22779da fix run 2025-06-25 10:53:24 -07:00
Nikita Smith 7d77210a5f run test after build 2025-06-25 10:53:24 -07:00
Nikita Smith 25710d39b7 test optional header fields 2025-06-25 10:53:24 -07:00
Nikita Smith fe967a3d36 more validity checks in simple_link_test 2025-06-25 10:53:24 -07:00
Nikita Smith c4a36f73dc redirect stdout and stderr to a file 2025-06-25 10:53:24 -07:00
Nikita Smith 1c08db2705 move image, import lib, and debug info builders outside of the state machine 2025-06-25 10:53:24 -07:00
Nikita Smith e971db7fdd remove unused layout flag in section struct 2025-06-25 10:53:24 -07:00
Nikita Smith 47ef37ed8e fix section order 2025-06-25 10:53:24 -07:00
Nikita Smith 881050addf add default merges and section removes 2025-06-25 10:53:23 -07:00
Nikita Smith a4b2d40d15 fix sizeof section headers 2025-06-25 10:53:23 -07:00
Nikita Smith 578a7ebdee factor out pdata code to PE layer 2025-06-25 10:53:23 -07:00
Nikita Smith f055267e59 remove double init and equip of thread contexts 2025-06-25 10:53:23 -07:00
Nikita Smith aae3874521 disable TLS merge for now 2025-06-25 10:53:23 -07:00
Nikita Smith c82b98cd49 assign section index to .reloc 2025-06-25 10:53:23 -07:00
Nikita Smith e1278a6545 null terminate static imports 2025-06-25 10:53:23 -07:00
Nikita Smith e65d1536b6 dynamic loader crashes if the import data is not in a stand-alone section 2025-06-25 10:53:23 -07:00
Nikita Smith 54e7f9aafc appease ASAN 2025-06-25 10:53:23 -07:00
Nikita Smith 1c656979d2 move MSVC lib symbols to CRT layer 2025-06-25 10:53:23 -07:00
Nikita Smith 47e123221a minor fixes 2025-06-25 10:53:23 -07:00
Nikita Smith 86556c68ed point TLS directory to TLS header 2025-06-25 10:53:23 -07:00
Nikita Smith 3d2b1e19e3 handle communal var vs regular non-comdat symbol 2025-06-25 10:53:23 -07:00
Nikita Smith 42bed0e5c6 merge delayed data section with .data 2025-06-25 10:53:23 -07:00
Nikita Smith f2394b6cf7 off-by-one 2025-06-25 10:53:23 -07:00
Nikita Smith e911bf5368 move obj writer for PE debug directory to stand-alone file 2025-06-25 10:53:23 -07:00
Nikita Smith 7f6d8004a9 fix import dll debug symbols 2025-06-25 10:53:23 -07:00
Nikita Smith 89e2ea15ad add /RAD_REMOVE_SECTION switch and special case debug sections 2025-06-25 10:53:23 -07:00
Nikita Smith 9c59cfd4e7 pointless check, in .debug relocations point to __ImageBase 2025-06-25 10:53:23 -07:00
Nikita Smith d51fe49bab delay import fix 2025-06-25 10:53:23 -07:00
Nikita Smith dcc4f38709 clean up pass over obj file 2025-06-25 10:53:23 -07:00
Nikita Smith 64415e21f0 special case bss section contribs and fix off by one in range array bsearch 2025-06-25 10:53:23 -07:00
Nikita Smith 37689b2e4a section collector 2025-06-25 10:53:23 -07:00
Nikita Smith 382204a4ea WIP test delay user32 import 2025-06-25 10:53:23 -07:00
Nikita Smith 8fb0aaf2b3 test kernel32 import 2025-06-25 10:53:23 -07:00
Nikita Smith fb0e8d7579 fix crash on COMDAT folding communal variable 2025-06-25 10:53:23 -07:00
Nikita Smith 9060004827 test for communal variable 2025-06-25 10:53:23 -07:00
Nikita Smith 40efbeb512 test for /INCLUDE 2025-06-25 10:53:23 -07:00
Nikita Smith 8d7bd6f9fe minor fixes
- copy alt name to config arena
- promote alternate name conflict error to stop run
- remove unused error code
2025-06-25 10:53:23 -07:00
Nikita Smith da0e7e5f69 test for /ALTERNATENAME 2025-06-25 10:53:23 -07:00
Nikita Smith ea81d18223 test for out of bounds section number on external symbol 2025-06-25 10:53:23 -07:00
Nikita Smith ef476bf1f0 tests for COMDAT Associative selection 2025-06-25 10:53:23 -07:00
Nikita Smith bf25b5b249 handle COMDAT Associative selection 2025-06-25 10:53:23 -07:00
Nikita Smith 69d4e31b15 helper for parsing COFF symbols 2025-06-25 10:53:23 -07:00
Nikita Smith 8fad6da751 add support for associative COMDAT symbols 2025-06-25 10:53:23 -07:00
Nikita Smith 889b1807f2 test for COMDAT Largest selection 2025-06-25 10:53:23 -07:00
Nikita Smith e97d476c7c test for COMDAT ExactMatch selection 2025-06-25 10:53:23 -07:00
Nikita Smith bde11caf11 improve exact match selection 2025-06-25 10:53:23 -07:00
Nikita Smith 4b8c9db8f5 add dependency to COMDAT symbol so we do not need to link with /OPT:NOREF 2025-06-25 10:53:23 -07:00
Nikita Smith 9bea163d10 test COMDAT SameSize selection 2025-06-25 10:53:23 -07:00
Nikita Smith aafb980c6b prevent dropping of newly inserted symbol while selecting slot leader 2025-06-25 10:53:23 -07:00
Nikita Smith 3eb7debad5 check COMDAT symlink points to a defined symbol 2025-06-25 10:53:23 -07:00
Nikita Smith 8d324775a2 test COMDAT NoDuplicates selection 2025-06-25 10:53:23 -07:00
Nikita Smith 3978181d02 check symbol type before patching section header 2025-06-25 10:53:23 -07:00
Nikita Smith a6924a22cf by default stop on undefined section symbol 2025-06-25 10:53:23 -07:00
Nikita Smith c907a10365 fixup test for COMDAT Any 2025-06-25 10:53:23 -07:00
Nikita Smith f5504c79e9 test COMDAT any selection 2025-06-25 10:53:23 -07:00
Nikita Smith 4aa6e6d132 store symbol links for COMDAT 2025-06-25 10:53:23 -07:00
Nikita Smith 9b6a15ce66 headers for delay import table columns 2025-06-25 10:53:23 -07:00
Nikita Smith f0a967a15d don't create BIAT and UIAT sections when not requested 2025-06-25 10:53:23 -07:00
Nikita Smith 9c93ee1579 compute correct IAT size 2025-06-25 10:53:23 -07:00
Nikita Smith b1cd2146ac patch export table directory using section contribs 2025-06-25 10:53:23 -07:00
Nikita Smith 0f9321e92a move default linker options to main file 2025-06-25 10:53:23 -07:00
Nikita Smith dcc8bfcf39 test section merges 2025-06-25 10:53:23 -07:00
Nikita Smith c2b3634e7a guard against circular section merges 2025-06-25 10:53:23 -07:00
Nikita Smith 2e531cd70a refactored special case for image base 2025-06-25 10:53:22 -07:00
Nikita Smith d22962af8d warn about exporting entry point symbol 2025-06-25 10:53:22 -07:00
Nikita Smith 90797f363f fix for machine compatibility check 2025-06-25 10:53:22 -07:00
Nikita Smith b709640ddc test for machine compatibility 2025-06-25 10:53:22 -07:00
Nikita Smith b7a06f3f7f sort on section index too 2025-06-25 10:53:22 -07:00
Nikita Smith 422e9449c8 natvis for section contrib types 2025-06-25 10:53:22 -07:00
Nikita Smith b8f45e97c9 test section alignment flags 2025-06-25 10:53:22 -07:00
Nikita Smith 87acc95016 set section align in common block test 2025-06-25 10:53:22 -07:00
Nikita Smith c0613c2a7e section align fixes 2025-06-25 10:53:22 -07:00
Nikita Smith 681c1619fb finish undefined section test 2025-06-25 10:53:22 -07:00
Nikita Smith a3bcfe01e1 fix signedness issue 2025-06-25 10:53:22 -07:00
Nikita Smith 671431cfbd remove unused define 2025-06-25 10:53:22 -07:00
Nikita Smith d5297e01ac workaround for image base address 2025-06-25 10:53:22 -07:00
Nikita Smith 971f6ec368 test virtual offset relocation with __ImageBase 2025-06-25 10:53:22 -07:00
Nikita Smith c98ae0925f error check relocations 2025-06-25 10:53:22 -07:00
Nikita Smith ad069cb854 unknown relocation 2025-06-25 10:53:22 -07:00
Nikita Smith 73fe9d223a handle /ALTERNATENAME directive 2025-06-25 10:53:22 -07:00
Nikita Smith 60d3f25057 test for __ImageBase with relative and address relocations 2025-06-25 10:53:22 -07:00
Nikita Smith 03e4958190 assign layout offsets and sizes to merged sections 2025-06-25 10:53:22 -07:00
Nikita Smith f75cdd23d7 collapse linker input states into one state 2025-06-25 10:53:22 -07:00
Nikita Smith d3c3b672ea image name helper 2025-06-25 10:53:22 -07:00
Nikita Smith 6fd9ab7388 strip postfix when searching for section 2025-06-25 10:53:22 -07:00
Nikita Smith a2bef106a1 handle case where symbol doesn't have obj 2025-06-25 10:53:22 -07:00
Nikita Smith 1cc23e42ff delay import objs 2025-06-25 10:53:22 -07:00
Nikita Smith c209dd730a set ordinal low in export finalize path 2025-06-25 10:53:22 -07:00
Nikita Smith ac261b3eed trim obj paths pulled in from libs 2025-06-25 10:53:22 -07:00
Nikita Smith f2c7e69844 natvis for hash table 2025-06-25 10:53:22 -07:00
Nikita Smith 71596b2f3e collapse make API for imports 2025-06-25 10:53:22 -07:00
Nikita Smith 65944f0444 clean up pass over COFF writer 2025-06-25 10:53:22 -07:00
Nikita Smith 34a87e7828 create member symbol only for imports with name 2025-06-25 10:53:22 -07:00
Nikita Smith 89239fc744 test reloc for section symbol with merged section 2025-06-25 10:53:22 -07:00
Nikita Smith f467ff8822 WIP move export and import table make code to appropriate layers 2025-06-25 10:53:22 -07:00
Nikita Smith 69d5010245 WIP switching to creating import table objs 2025-06-25 10:53:22 -07:00
Nikita Smith 1b21d0709f return symbol for pushed lib member 2025-06-25 10:53:22 -07:00
Nikita Smith 2c5fb7e7ef guard against merges with resource and base reloc sections 2025-06-25 10:53:22 -07:00
Nikita Smith 86fe2ddd38 remove arena per section 2025-06-25 10:53:22 -07:00
Nikita Smith 8da56025b3 patch section symbol and test for relocations to discarded memory 2025-06-25 10:53:22 -07:00
Nikita Smith 40fda5335c move default section flags to separate file to use them in torture 2025-06-25 10:53:22 -07:00
Nikita Smith bd830a6023 test case for relocation to undefined section with base relocations 2025-06-25 10:53:22 -07:00
Nikita Smith f25dc5cc8d pack export table into obj and input back to the linker 2025-06-25 10:53:22 -07:00
Nikita Smith c5164bd490 discard null data nodes 2025-06-25 10:53:22 -07:00
Nikita Smith 3ffd8c19ea helper for querying machine specific relocation for virtual offset relocation 2025-06-25 10:53:22 -07:00
Nikita Smith c55c60549e export virtual ranges for data directories 2025-06-25 10:53:22 -07:00
Nikita Smith f37f94a2b9 minor fixes 2025-06-25 10:53:22 -07:00
Nikita Smith 4161dd0440 check export table entries 2025-06-25 10:53:22 -07:00
Nikita Smith 9bcb227ed9 test imports and exports 2025-06-25 10:53:22 -07:00
Nikita Smith 35e6b4a9f9 linker directive header fix 2025-06-25 10:53:22 -07:00
Nikita Smith e7c808ee69 test simple lib link 2025-06-25 10:53:22 -07:00
Nikita Smith 3a7afcd80c replace linker lib writer with one from COFF 2025-06-25 10:53:22 -07:00
Nikita Smith 120829095b COFF lib writer 2025-06-25 10:53:22 -07:00
Nikita Smith ccf204d2f1 build target for torture 2025-06-25 10:53:22 -07:00
Nikita Smith 7c071e7238 linker checkpoint 2025-06-25 10:53:22 -07:00
Nikita Smith a60216fa9f minor fixes in hash table 2025-06-25 10:53:22 -07:00
Nikita Smith 0f81aae985 extend COFF obj writer with ability to produce linker directive section 2025-06-25 10:53:22 -07:00
Nikita Smith 45ca147579 report test stats, and check the exit code 2025-06-25 10:53:22 -07:00
Nikita Smith b0a652b10b helpers for parsing aux COFF symbols 2025-06-25 10:53:22 -07:00
Nikita Smith f81bab5a4c remove special sort postfix case 2025-06-25 10:53:22 -07:00
Nikita Smith 63a374cf54 simplify COFF reloc apply helper 2025-06-25 10:53:22 -07:00
Nikita Smith a5b3df7d1b check flags on custom bss section 2025-06-25 10:53:22 -07:00
Nikita Smith 5cb682bcb3 check common block relocs and sort 2025-06-25 10:53:22 -07:00
Nikita Smith cede94f8d9 test for conflicting section header flags and common bss and common block
basic tests
2025-06-25 10:53:21 -07:00
Nikita Smith e9d5022a55 test section sorter 2025-06-25 10:53:21 -07:00
Nikita Smith 0772617486 add relocation for shared symbol in abs_vs_regular test
test linker on base relocations to abs symbols
2025-06-25 10:53:21 -07:00
Nikita Smith 2a0929014b test weak tag 2025-06-25 10:53:21 -07:00
Nikita Smith f39397fa78 test cycles made from weak symbols 2025-06-25 10:53:21 -07:00
Nikita Smith 2c6db1b566 update COFF type enum strings 2025-06-25 10:53:21 -07:00
Nikita Smith 174c6ebb7d bugfix data directory range export 2025-06-25 10:53:21 -07:00
Nikita Smith f17ed8485d add tests for symbols with absolute address 2025-06-25 10:53:21 -07:00
Nikita Smith 01c905dbbd reuse import table flags, and parameterize data directory count 2025-06-25 10:53:21 -07:00
Nikita Smith c56cfefe09 move rsp unwrapper to config 2025-06-25 10:53:21 -07:00
Nikita Smith 3875b057d7 delete string compars form linker layer 2025-06-25 10:53:21 -07:00
Nikita Smith c2a0a6f1e1 factored out format specific relocation code to COFF layer 2025-06-25 10:53:21 -07:00
Nikita Smith ada037cb88 export range for data directories, subsystem, and check sum 2025-06-25 10:53:21 -07:00
Nikita Smith f001f08e04 string compar funcs 2025-06-25 10:53:21 -07:00
Nikita Smith 88d34eff54 simple link test 2025-06-25 10:53:21 -07:00
Nikita Smith 19694dac2a test case for merged pdata 2025-06-25 10:53:21 -07:00
Nikita Smith b9768be4ed tester for linkers 2025-06-25 10:53:21 -07:00
Nikita Smith 19a7ada1dc make export table with COFF obj writer,
partially converted import table to COFF obj writer
2025-06-25 10:53:21 -07:00
Nikita Smith 3a2bb318c7 make import lib objs with COFF obj writer 2025-06-25 10:53:21 -07:00
Nikita Smith e580b69180 make linker obj with COFF obj writer 2025-06-25 10:53:21 -07:00
Nikita Smith c45088b546 replaced dependency on linker's chunking for resource serialization
with COFF obj writer
2025-06-25 10:53:21 -07:00
Nikita Smith 55c76db902 handle linker directives in a separate step after obj is initialized,
this way we don't need to store directives in obj struct
2025-06-25 10:53:21 -07:00
Nikita Smith 307d3a7f4b check obj compatibility before initializing them 2025-06-25 10:53:21 -07:00
Nikita Smith 1eca5818a6 removed dependency on relocation list when error checking .drectve 2025-06-25 10:53:21 -07:00
Ryan Fleury 36f5597d8e eliminate unneeded path-renormalization in debug info cache lookup 2025-06-25 10:52:29 -07:00
Ryan Fleury e2eb1cd6d6 do not unnecessarily block on parses when closing modules 2025-06-25 09:41:48 -07:00
Ryan Fleury 10a49ca331 actually, rely on entry point trap calculation to do exe-rdi waiting; adjust default fonts to be more consistent with windows 2025-06-25 08:32:48 -07:00
Ryan Fleury a2608261d1 always wait for initial module debug info 2025-06-25 07:56:51 -07:00
Ryan Fleury 5f1a0e27a8 sketch out event buffer opening/closing 2025-06-21 12:30:00 -07:00
Ryan Fleury 185056a5cd breakpoint list command 2025-06-21 12:10:07 -07:00
Ryan Fleury 6dbc275129 command coverage for target/bp modifications; allow full path matches when fuzzy searching through cfgs 2025-06-21 11:22:05 -07:00
Ryan Fleury 2595427189 request frames on all ipc receives 2025-06-21 09:57:25 -07:00
Ryan Fleury b6eca01e2a upgrade textual command -> cmd-regs-filling path, to use expression evaluation when possible, and to use fuzzy filtering over associated query lists when possible 2025-06-21 09:24:08 -07:00
Ryan Fleury 65f00f3b17 do not scale swapchain framebuffer contents 2025-06-20 13:52:51 -07:00
Ryan Fleury 7960a0546a fix rd cfg debug stringification for new hs apis 2025-06-20 13:45:42 -07:00
Ryan Fleury 7e08b58cd8 render/d3d11: switch to flip_discard model 2025-06-20 12:34:13 -07:00
Ryan Fleury ce9f7f691a always-refresh dev option 2025-06-20 10:55:45 -07:00
Ryan Fleury 995f65ee1a rdi dump parseability pass 2025-06-20 09:08:25 -07:00
Ryan Fleury ad995374bb cache module requirement disqualifications; reuse within scope of same run (& thus same user bps) 2025-06-20 07:57:16 -07:00
Ryan Fleury 327f0f128a more parseability coverage on rdi dumping 2025-06-19 21:15:16 -07:00
Ryan Fleury 248a155579 checkpoint on dump parseability pass 2025-06-19 16:48:07 -07:00
Ryan Fleury fa242b3d80 #if 0 broken code; fix clang build 2025-06-19 15:26:56 -07:00
Ryan Fleury d532f62aaa plug in expression-based breakpoints to RDI-necessary-checking path 2025-06-19 14:53:13 -07:00
Ryan Fleury bfe90f5906 plug in thin pdb analysis to determine if waiting on a full RDI conversion is necessary - do not wait if RDI is determined to be unnecessary given breakpoints! 2025-06-19 14:48:13 -07:00
Ryan Fleury b28b730788 plug in dwarf dumping to radbin 2025-06-19 13:37:28 -07:00
Ryan Fleury 052d32d534 sketch out dwarf in radbin 2025-06-19 11:12:10 -07:00
Ryan Fleury 056942a792 remaining dwarf dumping coverage 2025-06-19 11:00:24 -07:00
Ryan Fleury 8eab0e16b8 pass over .debug_abbrev dump 2025-06-19 10:41:42 -07:00
Ryan Fleury 7c35028a6b .debug_info dumping pass 2025-06-19 10:33:44 -07:00
Ryan Fleury a2ab822eb5 attrib -> attrib_kind; attrib_ptr -> attrib 2025-06-19 09:49:01 -07:00
Ryan Fleury 8dac256a12 consistency pass over dwarf layer 2025-06-19 09:44:41 -07:00
Ryan Fleury e37ee72feb ditto 2025-06-19 08:28:36 -07:00
Ryan Fleury db4831fafb include rad lzb codec directly in rdi parse library 2025-06-19 08:25:35 -07:00
Ryan Fleury 88867ac758 lib_rdi_format -> lib_rdi 2025-06-19 08:21:58 -07:00
Ryan Fleury 66c2d51a7d pass over dwarf dump, get it building, eliminate reliance on one-off helpers from raddump 2025-06-19 08:02:36 -07:00
Ryan Fleury f590e9b6d5 eliminate separate path layer, merge into base strings layer 2025-06-19 07:38:34 -07:00
Ryan Fleury f2dc9a7d4a fix codeview format/parse interleave 2025-06-19 07:29:24 -07:00
Ryan Fleury 058c1454e2 eliminate all extra enums files for formats 2025-06-19 07:25:35 -07:00
Ryan Fleury 699cb5134e dwarf dump => dwarf layer; eliminate separate dwarf enum file 2025-06-19 07:19:38 -07:00
Ryan Fleury a812dc95ce notes 2025-06-18 14:08:16 -07:00
Ryan Fleury 9f0da8d1b8 notes 2025-06-18 13:31:22 -07:00
Ryan Fleury 0ff246d13f fixes to ctrl call stack lookup path 2025-06-18 13:26:45 -07:00
Ryan Fleury df901b2497 pass over ctrl call stack lookup path, eliminate races between multiple retry loops 2025-06-18 12:42:34 -07:00
Ryan Fleury a1f71379f4 adjust thread extra string rendering to account for missing modules/rdi frames 2025-06-18 10:40:50 -07:00
Ryan Fleury bee2570d39 fix double-load in radbin conversion path; fix incorrect mutation of potentially-nil trees when snapping to a file without a specific line; fix di_close path when work is occurring 2025-06-18 09:56:47 -07:00
Ryan Fleury 401f117653 adjust step trap net build in case of memory read failure - ensure we get correct memory read, otherwise we can generate bad trap nets during heavy load. allow high vs. low priority in async rdi loading; use low-priority in pre-emptive case 2025-06-18 08:36:41 -07:00
Ryan Fleury 5de7c06d3b always zero param type keys 2025-06-17 07:26:17 -07:00
Ryan Fleury 53e6050ee0 outer loop timeout exit condition in ctrl process memory cache lookup 2025-06-16 09:10:25 -07:00
ed bd5ec34b38 Merge tag 'v0.9.20-alpha' 2025-06-13 23:07:02 -04:00
Ryan Fleury 6543dad458 use .rdi fallback only when generating rdi, use .psym for breakpad 2025-06-10 15:30:41 -07:00
Ryan Fleury 0ad3bb1550 fix radsort multi-inclusion 2025-06-10 15:15:54 -07:00
Ryan Fleury b8c0a6c4f0 adjust file format preamble for unsupported formats 2025-06-10 14:41:50 -07:00
Ryan Fleury 399915e14d fix default subsets in radbin dump 2025-06-10 14:40:23 -07:00
Ryan Fleury 0e414a3dfb fix clang build; adjust raddbg --convert option to --bin 2025-06-10 14:39:09 -07:00
Ryan Fleury f604ced174 bump version 2025-06-10 14:35:38 -07:00
Ryan Fleury 87fac3a42c adjust help to match rdi support only for now 2025-06-10 14:34:15 -07:00
Ryan Fleury 834f38f73b pass over rdi dumping code; relocate to rdi_format_local; eliminate redundant helpers; plug into radbin 2025-06-10 14:14:39 -07:00
Ryan Fleury 6096869004 pass over radbin help 2025-06-10 09:57:01 -07:00
Ryan Fleury 7205b7d1ab pass over base layer command line parsing. do not assume debugger-style 'treat all after first non-option input as passthrough options'. most things do not want that - the debugger can still get it by doing a quick secondary parse 2025-06-10 09:46:46 -07:00
Ryan Fleury 49de09883e plug in dwarf converter to radbin; hook up to both rdi generation & breakpad generation; radbin exe -> pdb / elf -> dwarf inferences; cleanup / unification passes 2025-06-10 08:53:57 -07:00
Ryan Fleury 638adad93b implement raddbg markup lib functions only once, allow inclusion of header across many TUs, linking with the implementation in only one 2025-06-10 06:42:28 -07:00
Ryan Fleury 79bf3d8639 eliminate standalone programs for pdb -> rdi; dwarf -> rdi; pdb -> breakpad; sketch out 'radbin', unified cli frontend for dumping/converting/etc., plug in pdb -> rdi, pdb -> breakpad, & stub out dumper/dwarf 2025-06-09 15:40:48 -07:00
Ryan Fleury 4926f6cfc8 programmatic address range annotations; pipe -> ctrl entities; render in memory view 2025-06-08 17:37:55 -07:00
Ryan Fleury bb2900c2b7 memory view: globals & procedures annotations, changed & bad visualization 2025-06-08 16:26:57 -07:00
Ryan Fleury c3f4c758b4 notes 2025-06-06 15:43:09 -07:00
Ryan Fleury 4057e00fa1 further memory view fixes / tweaks; rich hover coverage for virtual address ranges in memory views / watch views 2025-06-06 14:57:46 -07:00
Ryan Fleury 2d9929452c memory view go-to-address / cursor/mark tracking fixes 2025-06-06 12:09:07 -07:00
Ryan Fleury 60d88ac446 fix missing increment in eval token chunk list -> token array 2025-06-06 09:53:44 -07:00
Ryan Fleury c282e7d4be command outputs; ipc command output reception & writing to stdout 2025-06-05 16:08:53 -07:00
Ryan Fleury 3d7bfb41b8 pull aside project registration in user, pull aside last-opened-user setting, trigger on save user/project, as well as open. 2025-06-05 13:16:35 -07:00
Ryan Fleury a73cda80e7 adjust find-code-location path to account for many windows; always snap in obviously-correct cases (e.g. window has the source code focused), fall back to other rules, mask off extra snaps when snap destination is found by earlier passes. 2025-06-05 12:55:48 -07:00
Ryan Fleury 3e1bc21f95 p2r: hoist comp unit contributions bucketing out from per-unit path 2025-06-04 13:23:56 -07:00
Ryan Fleury 0512b61d95 p2r: wide/async per-unit src file gather/dedup; wide/async line (& inline) table conversion 2025-06-03 17:10:36 -07:00
Ryan Fleury ad0ead92c3 fix bad parent eval inheritance in raddbg_pin ui build 2025-06-03 14:28:17 -07:00
Ryan Fleury 00fd597658 fix ptr/ref coverage in expansions 2025-06-03 13:55:37 -07:00
Ryan Fleury b57deebd03 another pass over ctrl process memory cache lookup, prevent another deadlock case 2025-06-03 12:06:02 -07:00
Ryan Fleury 594594ec72 adjust ctrl memory cache committing condition to be more robust to bad regions. otherwise we were flooding new request to repeatedly recopy from the client, when we effectively already knew it would never be valid. 2025-06-02 15:28:26 -07:00
Ryan Fleury 44280f3dd0 fix bad wait condition in ctrl memory cache accessing 2025-06-02 14:45:52 -07:00
Ryan Fleury 94b969f203 copyright year 2025-06-02 14:13:57 -07:00
Ryan Fleury cff99f5431 oops, fix very bad mistake, using part of HS roots that don't exist! 2025-06-02 14:00:47 -07:00
Ryan Fleury becb61f00d many-thread-stepping test in mule, adjust call stack thread name decoration limit, now that call stack computation is async; tweak ctrl process memory cache lookup exit condition to be more robust to failed-read cases 2025-06-02 11:59:49 -07:00
Ryan Fleury e83c74db29 more ue type view coverage 2025-05-29 18:20:43 -07:00
Ryan Fleury af4972a333 all constants evaluation; constant autocompletion; constant name string baking fix 2025-05-29 17:50:35 -07:00
Ryan Fleury 6322427171 qualify constant names by containing type, if applicable; otherwise we get tons of duplicate constant names... 2025-05-29 17:36:41 -07:00
Ryan Fleury a111c21972 fix constant evaluation 2025-05-29 17:12:44 -07:00
Ryan Fleury 858f3866d4 fix name map kind name lookup build 2025-05-29 17:05:51 -07:00
Ryan Fleury 770fbe9459 constant evaluation 2025-05-29 17:04:01 -07:00
Ryan Fleury 89cc73eca6 constant name map 2025-05-29 16:57:08 -07:00
Ryan Fleury ae139fea05 raddump constants 2025-05-29 16:51:40 -07:00
Ryan Fleury bf5ac0d3e8 fill out constants in symbol stream conversion 2025-05-29 16:43:22 -07:00
Ryan Fleury 3513d6cfb9 first pass at rdi format constant value support 2025-05-29 16:37:36 -07:00
Ryan Fleury a53ccee46d more ue type view coverage 2025-05-29 13:55:52 -07:00
Ryan Fleury 477e2b19da fix preservation of ir tree chain w/ multiple composing type views 2025-05-29 13:40:46 -07:00
Ryan Fleury 14cfd87f68 start sketching out basic unreal type views 2025-05-28 18:00:16 -07:00
Ryan Fleury 7350c2d576 fix trailing wildcard matches 2025-05-28 15:51:15 -07:00
Ryan Fleury f116d88b08 wildcard instance identifier resolution in type views; ?{arg1, arg2, arg3} in type view pattern -> use arg1, arg2, or arg3 in expression 2025-05-28 15:41:48 -07:00
Ryan Fleury 1d72de8c4a pattern parts as strings -> pattern part type, which can include wildcard inst names 2025-05-28 14:52:21 -07:00
Ryan Fleury de3782c974 do not advance wildcard scan position if wildcard match done 2025-05-28 14:42:20 -07:00
Ryan Fleury d0a2c0f22c auto hook list(expr) -> auto hook list(match), where match includes both an expression and a list of comma-delimited wildcard instances 2025-05-28 14:37:44 -07:00
Ryan Fleury 1609c8f948 clean up & fixup pass over type pattern matching, allow closed {}s, ()s, []s, <>s in wildcards 2025-05-28 14:08:53 -07:00
Ryan Fleury 70ccfd2d86 do greedy ? matching in type pattern matching by default 2025-05-28 13:07:18 -07:00
Ryan Fleury 8bf07f8a52 bump to 19 2025-05-22 22:37:03 -07:00
Ryan Fleury 58df68b9be adjust good-machine-code check to factor in memory read failure mask 2025-05-22 17:15:51 -07:00
Ryan Fleury 914273d5af hack in quick fix for overambitious type pattern matching - will do a better pass shortly... 2025-05-22 12:29:56 -07:00
Ryan Fleury 4aeadc12b7 adjust memory reading fail conditions in trap net generation; fix early-aborting of retry loop in process memory cache lookup 2025-05-22 12:15:31 -07:00
Ryan Fleury 02611de6af broadcast wakeup event on ctrl cache commits 2025-05-22 11:39:08 -07:00
Ryan Fleury c41d67120f fix incorrect bounds check in new per-line fstrs building path 2025-05-22 11:13:18 -07:00
Ryan Fleury 25813e62ea adjust spall usage code - still not generating multi-thread events correctly... 2025-05-22 09:58:09 -07:00
Ryan Fleury 3fcdb85ebf use tid/pid-specifying spall functions 2025-05-22 09:34:47 -07:00
Ryan Fleury d254d8edb4 switch singular frame scopes to stack of frame scopes; always ensure scopes are closed before breaks in frames. 2025-05-22 09:28:13 -07:00
Ryan Fleury 895a965f70 defer call stack scope touches until retry loop exit 2025-05-21 17:33:30 -07:00
Ryan Fleury b0fb102813 sketch out spall integration 2025-05-21 12:01:43 -07:00
ed 46ef06e4db Merge remote-tracking branch 'EpicGamesExt/dev' 2025-05-20 22:08:31 -04:00
Ryan Fleury 8bed56adde step-into-line trap nets: omit stopping at non-final call destinations with no line info 2025-05-20 16:15:03 -07:00
Ryan Fleury 25dda717ad setting to prefer os native file dialog uis (off by default because they are slow and bad) 2025-05-20 15:59:49 -07:00
Ryan Fleury 2d5bf9efc2 last-hit-breakpoint visualization 2025-05-20 15:41:16 -07:00
Ryan Fleury 16fd72ef4f more granular watch window fresh/bad visualization, since each cell can be an arbitrary evaluation now; also reintroduce failed-memory-read visualization 2025-05-20 15:31:37 -07:00
Ryan Fleury e6f53a39bb old windows dpi awareness paths 2025-05-20 15:13:23 -07:00
Ryan Fleury 0eb37c527c fix incorrect abort-on-0-rip condition in unwinder path; we can still have nonzero rsps and find valid frames. 2025-05-20 15:09:35 -07:00
Ryan Fleury f7df65678f fix incorrect bounds check in regrel32 frameproc grab 2025-05-20 15:05:05 -07:00
Ryan Fleury 206ec346cf fix 2-byte utf decoding issues, fix utf8 lexing issues 2025-05-20 14:46:46 -07:00
Ryan Fleury 2f5082fb61 fix treatment of octal strings in try_u64/s64_from_str8_c_rules 2025-05-20 14:10:34 -07:00
Ryan Fleury 95dbba1144 debugging notes of programmatic data breakpoints 2025-05-20 13:18:15 -07:00
Ryan Fleury a55c5b49aa similarly adjust call stack cache timeout periods 2025-05-20 13:06:16 -07:00
Ryan Fleury 15459edc75 adjust wait timeout properties of ctrl process memory cache grab; don't wait forever to submit, don't wait if work was completed even if results bad, etc. 2025-05-20 13:03:58 -07:00
Ryan Fleury d709724128 fix ctrl scope mal-usage 2025-05-20 11:15:55 -07:00
Ryan Fleury 7fc39a3d97 eliminate old debug engine unwind cache 2025-05-20 11:13:04 -07:00
Ryan Fleury 41ee0c83d4 notes; skip relativization path for stdout/stderr/stdin paths 2025-05-20 11:00:18 -07:00
Ryan Fleury 34df269c58 eliminate extra root id list placement in key nodes 2025-05-20 10:53:02 -07:00
Ryan Fleury 56b975a6b1 adjust async call stack querying API to guard against waiting in clearly-invalid cases (trying to wait for call stacks when running, for example); also eliminate logs 2025-05-20 10:36:44 -07:00
Ryan Fleury b94535b20b fix array-indexing in type evaluation mode 2025-05-19 22:22:47 -07:00
Ryan Fleury 7d274dd2f6 fix incorrect lens application condition in eval viz string iter 2025-05-19 22:09:52 -07:00
Ryan Fleury 7dc4399300 dead ctrl process memory cache elimination 2025-05-19 19:38:27 -07:00
Ryan Fleury 9ae0ee9a46 correctly use tab width px in new code slice fstrs measuring path 2025-05-19 19:21:06 -07:00
Ryan Fleury 54325828b2 absolutify target stdout/stderr/stdin paths based on working directory 2025-05-19 18:56:13 -07:00
Ryan Fleury 862e0ef882 fix lens expansions being treated like set expansions in eval viz string iter 2025-05-19 18:47:52 -07:00
Ryan Fleury 47d658daed ensure rd frame depth is always computed correctly; eliminate incorrect frame scope (ctrl/di) usage - fix weird deadlocks! 2025-05-19 16:21:38 -07:00
Ryan Fleury b9e3df4cae pass over hash store layer / all users, to switch to explicit 64-bit root alloc/dealloc, and 128-bit ids, for a full 192-bit hs key 2025-05-19 14:52:28 -07:00
Ryan Fleury 8b4e2a099f hash store root allocation/deallocation 2025-05-18 16:00:18 -07:00
Ryan Fleury cb2f8aa766 sketch out 'root cache' in hash store 2025-05-18 15:46:50 -07:00
Ryan Fleury 90955ac2a8 fix incorrect lock type in hs key closing path 2025-05-18 15:24:56 -07:00
Ryan Fleury 342627ae3b dead code deletion 2025-05-18 13:16:51 -07:00
Ryan Fleury 0a51de094d switch to stripe-cv-based waiting mechanism on nonzero scope touches 2025-05-18 12:58:44 -07:00
Ryan Fleury f99dd2a477 clean up search data commit on scope-hold mechanism 2025-05-17 13:33:43 -07:00
Ryan Fleury 5cb2a7bbde fix usage of [] operator on pointer values; fix incorrect interpretation of []s as assembly style derefs in chained cases 2025-05-17 13:05:07 -07:00
Ryan Fleury 5712c2ac07 fix ternary expr tree stringification 2025-05-17 12:56:49 -07:00
Ryan Fleury ea5dcafd1e hash store key closing path 2025-05-17 12:41:47 -07:00
Ryan Fleury 66fdfc84fc further pass over call stack cache lookup path 2025-05-17 10:16:49 -07:00
Ryan Fleury 7a44cbbd0d adjust high priority call stack timeout threshold 2025-05-17 08:41:51 -07:00
Ryan Fleury a379134ed8 demon tweaks / debugging; adjust call stack cache reading API to account for high-priority path, where we want to try computing the thread's call stack immediately 2025-05-16 21:12:58 -07:00
Ryan Fleury 86eabe0d6d offer priority selection in call stack retrieval; prioritize selected thread & operations which require a result; adjust call stack builder path to be a bit more generous while waiting for memory reads 2025-05-15 21:57:50 -07:00
Ryan Fleury 965f5f4896 0.9.18 notes 2025-05-15 14:37:37 -07:00
Ryan Fleury ed9866e9e2 retry call stack commits a bit more aggressively 2025-05-15 14:17:17 -07:00
Ryan Fleury 6ff66b0fef adjust static breakpoint disqualification to not assume invalid eval -> statically disqualfiied 2025-05-15 14:05:14 -07:00
Ryan Fleury 95032147e8 lock ctrl thread entity ctx for much less long when doing unwinds; only copy the minimal entity tree needed into a mini entity ctx, then use that to do the unwind 2025-05-15 13:47:55 -07:00
Ryan Fleury 9a805b8bb5 adjust call stack cachc committing mechanism, to guarantee commits in face of scope touches, and to ensure waiting for new commits in face of cache lookup 2025-05-15 13:27:11 -07:00
Ryan Fleury e5d6a49055 first pass at call stack cache, need a lot of clean up before this is working... 2025-05-14 21:44:09 -07:00
Ryan Fleury a84739e1c4 set up async cached call stack building 2025-05-14 20:15:10 -07:00
Ryan Fleury 981dd2e02c tighten up usage of ctrl entity ctx vs. r/w ctx store vs. accel 2025-05-14 19:16:06 -07:00
Ryan Fleury 1b26c3f180 entity_ctx * entity_store -> entity_ctx, entity_ctx_rw_store, thread-local entity_ctx_lookup_accel 2025-05-14 19:11:02 -07:00
Ryan Fleury 1e6b3ee2e6 split read-only ctrl entity operations from read-write ctrl entity operations, represent in type system via EntityCtx vs. EntityStore 2025-05-14 18:35:25 -07:00
Ryan Fleury e513af5361 ditto 2025-05-14 15:30:49 -07:00
Ryan Fleury 60e47fb821 unwind cache -> callstack cache 2025-05-14 15:28:57 -07:00
Ryan Fleury 81483f5100 eliminate per-callstack-frame 'parent num' - redundant info 2025-05-14 14:41:13 -07:00
Ryan Fleury 1e53ac29ef still protect against infinite unwinds, but require that both rsp/rip remain unchanged, rather than just rip 2025-05-14 13:55:16 -07:00
Ryan Fleury 99a8108b2a eliminate now-unnecessary debug info references in call stack data structure 2025-05-14 13:53:24 -07:00
Ryan Fleury a7b6e6f02a eliminate usage of old overcomplicated call stack data structure, which required actively holding debug info references... we want to eliminate this so that we can trivially cache call stacks / unwinds 2025-05-14 13:51:59 -07:00
Ryan Fleury b49f4559ce get main unwinding path off of requiring entire ctrl entity store 2025-05-14 13:32:32 -07:00
Ryan Fleury f12b66c1ee sketch out asynchronous unwinding stuff 2025-05-14 13:27:10 -07:00
Ryan Fleury e60e0c8555 sketch out unwind cache 2025-05-14 11:43:54 -07:00
Ryan Fleury a67f326f78 eliminate redundant recomputation of ir extensions 2025-05-14 10:27:01 -07:00
Ryan Fleury 10c4dcecd1 do not prohibit same-rips from stopping unwinds 2025-05-14 10:15:42 -07:00
Ryan Fleury 2e2eb4a6f2 bump to 18 2025-05-14 09:53:50 -07:00
Ryan Fleury 70ae35cbd7 do not use worker thread arenas from main thread in rdi baker... 2025-05-14 09:51:46 -07:00
Ryan Fleury 141b96c17e do not skip 0 with texture formats 2025-05-14 08:21:54 -07:00
Ryan Fleury a371374d6c require file existence before calling into dwrite 2025-05-14 08:19:30 -07:00
Ryan Fleury ad714e9baa dwrite: do not try to create font face if font file creation fails 2025-05-14 08:11:13 -07:00
Ryan Fleury 271e8e4523 deduplicate new file path maps on-add 2025-05-13 16:29:23 -07:00
Ryan Fleury 5532aa6903 rdi_from_pdb: when relative paths are supplied by line info, build them as being relative to OBJ; this is not necessarily correct but it is the best thing we can do given the available information. the user needs to remap this once in the debugger, but then it will work. 2025-05-13 16:23:31 -07:00
Ryan Fleury 258b45a837 eliminate a bit of duplicate font cache lookups in code view build, + eliminate unnecessary per-box color lookups 2025-05-13 15:11:41 -07:00
Ryan Fleury e10f0489da record which irtree-and-type generations were produced via auto-hooks; skip those when doing typeofs 2025-05-13 14:19:30 -07:00
Ryan Fleury 89e93459d7 fix ufcs-style 'raw' lens application 2025-05-13 13:51:56 -07:00
Ryan Fleury 8b8c88f310 preserve whole chain of parent irtrees, do not simply apply only to autohook overrides; straighten out some event consumption weirdness in interaction between autocompletion floating view & query floating view; ensure we mark the cfg space as dirty when modifying strings 2025-05-13 13:44:14 -07:00
Ryan Fleury 97c58e3747 start sketching out pieces for flattened expansions in rows(...) 2025-05-13 11:55:06 -07:00
Ryan Fleury 34304280c9 fix old usage of table in mule_main; resolve to value in (sequence) 2025-05-13 10:55:39 -07:00
Ryan Fleury 11c1b5277e only -> rows; table -> columns 2025-05-13 10:44:06 -07:00
Ryan Fleury 73c91ae2bc eval: adjust array expansion, use parent key of pointer argument, rather than key of pointer argument, to scope count expression evaluation; fix up a few edge cases with $. and implicit $ member accesses; make omit much more powerful, by allowing list of arguments to control all expansion expressions, rather than assuming only member names 2025-05-13 10:19:47 -07:00
Ryan Fleury 86dcec4334 Merge branch 'dev' of https://github.com/EpicGames/raddebugger 2025-05-12 21:39:46 -07:00
Ryan Fleury bc75635a65 os/gfx/linux: window focus querying 2025-05-12 21:22:03 -07:00
Ryan Fleury 4c1585444c be less ambitious about occupying basic type names in debugger; can conflict with common purposes in codebases, and really we should defer to debug info when possible 2025-05-12 17:33:57 -07:00
Ryan Fleury 533136875e eliminate dummy window egl setup 2025-05-12 17:20:46 -07:00
Ryan Fleury d564184d31 chip away more unneeded path processing, impeding proper support for relative paths; we want to mostly preserve paths as we see them, and then we should find a different story for mapping the paths in very few places 2025-05-12 17:09:13 -07:00
Ryan Fleury a5b227a1c6 egl/glx work; eliminate unneeded path normalization paths; do not assume os current path when normalizing paths; gl synchronous debug strings 2025-05-12 16:03:36 -07:00
Ryan Fleury fe3cac7ac3 parameterize irtree generation path with identifier resolution rules; in most cases, we want the usual order: implicit accesses -> locals -> registers -> globals/tlocals/types/procedures -> macros; but if we are specifically evaluating a call expression tree, we want to prefer callables - in this case, macros should be prioritized. 2025-05-12 11:56:57 -07:00
Ryan Fleury 8688322a43 more of the same 2025-05-11 21:47:24 -07:00
Ryan Fleury 2307d44506 forward declare XLookupString ourselves, since it is apparently missing in libx11-dev 2025-05-11 21:26:39 -07:00
Ryan Fleury cc319190c6 render/opengl: flushed instance buffers 2025-05-11 15:26:05 -07:00
Ryan Fleury 1896ec2a85 more os/gfx linux coverage 2025-05-11 15:19:40 -07:00
Ryan Fleury 684402efac x11 event coverage 2025-05-11 14:14:12 -07:00
Ryan Fleury 9de203e2cd adjust smooth-unhinted dwrite raster params 2025-05-11 13:48:05 -07:00
Ryan Fleury 8b3f07c7b5 eliminate font fudge factors; fix size units in freetype backend; fix directory iteration lack-of-robustness-to-failed-dir-open 2025-05-11 13:27:59 -07:00
Ryan Fleury 6df96b7eef preserve mouse coordinates from xlib button events 2025-05-10 17:08:40 -07:00
Ryan Fleury 0a3869981f correctly calculate shortened hash w/ dirty marker in build.sh 2025-05-10 16:01:56 -07:00
Ryan Fleury 219e5bd211 first pass at standing up freetype font provider backend 2025-05-10 15:59:44 -07:00
Ryan Fleury 868f2d0660 be a bit more robust to failures in window creation, IPC thread launching, & semaphore non-implemented parts 2025-05-10 14:39:32 -07:00
Ryan Fleury 3fd1f9d255 stub out demon/fontprovider so we can build debugger 2025-05-10 14:28:14 -07:00
Ryan Fleury b52e3be5ae fill out more linux os layer coverage 2025-05-10 11:38:43 -07:00
Ryan Fleury b9350c867c egl backend for linux backend of opengl backend of render 2025-05-10 11:04:59 -07:00
Ryan Fleury ab5c47a0fd fix opengl win32 build 2025-05-10 08:36:13 -07:00
Ryan Fleury a1318e6117 sketch out first bit of linux-backend of opengl-backend 2025-05-09 21:51:48 -07:00
Ryan Fleury 5939c3f010 switch 4coder back to defaultly building with d3d11 backend 2025-05-09 19:51:24 -07:00
Ryan Fleury 48b8c41713 opengl render backend 2025-05-09 19:48:41 -07:00
Ryan Fleury 1b7a57914e get linux building again 2025-05-09 13:44:17 -07:00
Ryan Fleury f38da420e9 force hover eval in window on X axis only; store expr strings rather than expr trees in auto hook map 2025-05-09 12:51:02 -07:00
Ryan Fleury 345d5579d2 do not show switch in IPC docs 2025-05-09 12:27:35 -07:00
Ryan Fleury 2c58b81dde parameterize find-code-location by forcing-focus to destination panel; use that in 'switch' command 2025-05-09 12:22:27 -07:00
Ryan Fleury 719e8ce179 crash dump generation from crash dialog, or via --gen_crash_dump for CLI 2025-05-09 12:08:08 -07:00
Jan Hebbel 7939bcbc95 Fixed signed minimum values. 2025-05-09 11:35:42 -07:00
Ryan Fleury a3e471897c scroll-to-bottom-on-change setting for text (inc. output) visualizers 2025-05-09 11:31:54 -07:00
Ryan Fleury f2bf8ccb2e layer color coverage / usage in thread colors 2025-05-09 11:15:00 -07:00
Ryan Fleury 1c4ad499dc prohibit DefWindowProc from running on syschars, for everything except alt+space 2025-05-09 10:51:03 -07:00
Ryan Fleury 5fce46baaf adjust toggle-switch-dragging path so that keyboard presses still register 2025-05-09 10:43:17 -07:00
Ryan Fleury 3b0064d8cd multi-toggle-switch-toggle-in-single-press 2025-05-09 10:34:00 -07:00
Ryan Fleury 417202c0a0 press in view content -> steal focus from query bar 2025-05-09 10:16:49 -07:00
Ryan Fleury e491a76861 prevent mutating nil trees in irtree generation 2025-05-09 09:58:39 -07:00
Ryan Fleury cb2e9fe27c record last opened user in program data, recall on startup 2025-05-09 09:56:16 -07:00
Ryan Fleury dd3f3366a8 fix bad 0.9.16 version check in config loading; helpers for building version codes, so they can be compared 2025-05-09 09:48:54 -07:00
Ryan Fleury bbdbcead16 correctly allow space keybindings; bind by default to 'accept', along with return; -> allow space for hitting buttons, expansions, etc. 2025-05-09 09:05:51 -07:00
Ryan Fleury f237f6cb24 hack in fix for not automatically escaping user inputs - was preventing backslashes from being used correctly in query inputs 2025-05-08 16:16:53 -07:00
Ryan Fleury 5bfef50915 bump to 0.9.17 2025-05-08 15:24:35 -07:00
Ryan Fleury 802da729b2 further work on view callee helper ui 2025-05-08 15:18:09 -07:00
Ryan Fleury 2a3c5527e0 only decorate debug-info-table-generated expressions with `s when we can detect it is necessary (.s are now allowed); only generate simplified expression extension strings for expressions in watch windows if parent keys are present, otherwise just do the full expression 2025-05-08 14:14:30 -07:00
Ryan Fleury b30e928501 fall back on creating a synthetic symbol name when a chain of leaf-identifier member accesses fail, and produce synthetic leaf-identifier expression to try to resolve it that way. 2025-05-08 14:00:54 -07:00
Ryan Fleury e13de08637 fix process choice in lister-completion-evaluation; do not rely on selected process! fixes 'enter' in listers not functioning when initially launching a process. 2025-05-08 13:34:38 -07:00
Ryan Fleury 4c49daa5a4 reintroduce add function breakpoint fast-path 2025-05-08 13:22:16 -07:00
Ryan Fleury 13324d9073 more progress on view caller helper 2025-05-08 12:25:31 -07:00
Ryan Fleury ef974b8dc0 begin sketching out the callee info helper, as an additional mechanism within the autocompletion system - find the call we're in, evaluate the callee, look up schema, show args/docs 2025-05-08 12:03:12 -07:00
Ryan Fleury a95780f2be provide path for explicit cast operator in eval parser; abort trying c-style casts in non-trivial cases (the parse becomes ambiguous, and it is better for us to prefer the usual non-casting path 2025-05-08 11:04:11 -07:00
Ryan Fleury e0202c5c18 path_pt schema type, which bundles a file path & textual location; use to do path relativization on serialize with breakpoints/watch pins 2025-05-08 10:23:46 -07:00
Ryan Fleury b59e8e5024 absolutify initial user/project paths; need absolute path information in order to relativize/absolutify paths in config 2025-05-08 09:57:17 -07:00
Ryan Fleury a31840fd8c eliminate reload-active command binding - it is no longer a command 2025-05-08 09:20:09 -07:00
Ryan Fleury ead193ee3b move enum value by-name lookup onto cached fastpath 2025-05-07 17:08:28 -07:00
Ryan Fleury 54a0560cef make window-level font size changing more strict wrt modifiers; do not accept ctrl+shift 2025-05-07 17:05:25 -07:00
Ryan Fleury 64e12d0591 fix binary tool builds after usage of path in rdi_from_pdb layer 2025-05-07 16:10:22 -07:00
Ryan Fleury 43c1a5d68b oops, fix bad reset of autocompletion arena! 2025-05-07 16:00:06 -07:00
Ryan Fleury 80f1a8b7ba enum value filtering / lookup cache 2025-05-07 15:46:59 -07:00
Ryan Fleury e7a4f407bb use 'sufficient suffixes' when generating enum expansions 2025-05-07 15:24:23 -07:00
Ryan Fleury 1929bcac0a defer to simple numeric evaluation if we cannot visualize an enum value by name 2025-05-07 15:20:49 -07:00
Ryan Fleury 7ded00af72 pdb -> rdi: correctly convert negative enumerate numerics; move enum value visualization into complex string-iterator visualization path, rather than hacking it into the simply-typed eval path (we want to generate a new task for the numeric value itself); handle negative enums correctly 2025-05-07 15:20:12 -07:00
Ryan Fleury a4367e02f2 pdb -> rdi: more gracefully handle ..s in file paths when building source line maps, normalized file paths, and path tree 2025-05-07 14:58:23 -07:00
Ryan Fleury 4f980c4820 correctly flag deletion editing commands as zeroing delta on selection 2025-05-07 14:36:39 -07:00
Ryan Fleury 9c296cb9b2 fixes for arithmetic with bitfields; bitfield -> numeric value path in irtree generation; fix bad stomping / mutation when generating a synthetic UFCS tree 2025-05-07 14:19:39 -07:00
Ryan Fleury 1cc5561f1f evaluate settings in raw mode, always 2025-05-07 10:50:27 -07:00
Ryan Fleury db2c8607fb clear breakpoints command 2025-05-07 09:23:42 -07:00
Ryan Fleury cbc0ec1254 commit root-level split axis data on panel tree edits 2025-05-07 09:13:59 -07:00
Ryan Fleury 1284c25b9e sketch out better usage of expansion info in text visualizer; notes; naming pass 2025-05-07 08:58:12 -07:00
Ryan Fleury 4d6d4429e1 fix incorrect rad <-> turn conversion path 2025-05-07 06:31:19 -07:00
Ryan Fleury 73d30759a1 fix incorrect command usage in auto-run path 2025-05-07 06:27:34 -07:00
Ryan Fleury 2919ecb135 more robustness to malformed expressions 2025-05-07 06:25:47 -07:00
Ryan Fleury 84e299e081 readme adjustments 2025-05-07 05:56:41 -07:00
Ryan Fleury afd1f0c713 do not reset to default bindings if not needed... 2025-05-07 05:50:47 -07:00
Ryan Fleury 7048a8748c bindings resetting function 2025-05-06 17:34:49 -07:00
Ryan Fleury df8c29d7b1 clamp font size settings 2025-05-06 17:22:59 -07:00
Ryan Fleury 1447e6ca24 revert-to-default ui for meta setting editors 2025-05-06 17:09:01 -07:00
Ryan Fleury 6b4c1997e1 eliminate defaults for overridden properties, e.g. per-tab font size; just pull value from hierarchy 2025-05-06 16:25:04 -07:00
Ryan Fleury de5ae9746d when generating debug info table evaluations, check for non-simple symbol identifiers, and generate slightly-better-though-not-comprehensive-escape-hatch for that symbol expression 2025-05-06 15:48:57 -07:00
Ryan Fleury 8d8e9b3cc5 be more judicious about edit buttons in fancy rows; allow escape-hatch identifier evaluation via grave accents 2025-05-06 15:42:36 -07:00
Ryan Fleury 53fea4a17e hack to fix corner case in watch window controls 2025-05-06 15:29:38 -07:00
Ryan Fleury b902b0a5b3 animation setting coverage 2025-05-06 15:21:01 -07:00
Ryan Fleury 848f144ab9 distinguish between expr strings and code strings in schemas; use normal autocompletion in meta-evaluation spaces only when editing expr strings, whereas code strings you want to look like code but do not generally refer to things that expressions can, e.g. it is a label 2025-05-06 14:42:27 -07:00
Ryan Fleury 686c666058 final theme presets pass 2025-05-06 14:03:22 -07:00
Ryan Fleury e1bdae4144 adjust focuses on project-load, if project-filtered tabs are focused 2025-05-06 13:20:52 -07:00
Ryan Fleury fe8d7e86fe fix expression editability condition in watch tables; notes 2025-05-06 13:09:47 -07:00
Ryan Fleury a6eda7db04 fix incorrect parsing / expr-building order of casts vs. other prefix unaries in new parser path 2025-05-06 13:02:48 -07:00
Ryan Fleury 08402a57b4 notes 2025-05-06 09:41:54 -07:00
Ryan Fleury 2b1e286aad preserve dbgi fuzzy searching results based on key alone, rather than throwing away all results if params change (although still re-querying if params change); also fix not clearing the autocompletion string gathered for a UI build across frames 2025-05-06 09:31:16 -07:00
Ryan Fleury e5a2f6da11 do not apply filters past one block layer (fixes broken expansions in debug info table tabs) 2025-05-06 09:24:34 -07:00
Ryan Fleury b8eace001a working on visualizer tab pull-outs in all cases, cleaning up some rough edges of watch window controls 2025-05-06 08:56:11 -07:00
Ryan Fleury f218ac6628 release notes 2025-05-05 23:06:23 -07:00
Ryan Fleury ac0a242f73 sketch out simple old-config-loader to just preserve targets/file_path_maps/etc. from 0.9.15 and before 2025-05-05 22:04:40 -07:00
Ryan Fleury 0594d99c8d clean up status bar rendering, collapse ui for rebinding/run-status/errors/conversions 2025-05-05 20:45:17 -07:00
Ryan Fleury 0e1599c554 constrain queries to window 2025-05-05 20:14:31 -07:00
Ryan Fleury 241d2454be stop funnelling autocompletion through via events - it is not an event-like thing, and making it one led to weirdness... 2025-05-05 20:01:44 -07:00
Ryan Fleury 64010486fe theme preset coverage 2025-05-05 17:19:29 -07:00
Ryan Fleury e52ab7ad6b garbage collect window states based on frame touch, and on cfg elimination 2025-05-05 16:30:31 -07:00
Ryan Fleury afae94b49c opaque backgrounds setting coverage 2025-05-05 16:00:57 -07:00
Ryan Fleury b2e24fe760 do not synthesize simpler expression strings on unsuccessful evaluation 2025-05-05 15:56:28 -07:00
Ryan Fleury 5f3c2d6932 new/save user/project commands 2025-05-05 15:51:42 -07:00
Ryan Fleury d17502fac4 fix missing byte sizes on alises 2025-05-05 15:29:07 -07:00
Ryan Fleury 27072e1148 save to project 2025-05-05 15:23:16 -07:00
Ryan Fleury 9c969d7c2b readme pass 2025-05-05 15:23:16 -07:00
Nikita Smith 08515428fb convert typedefs from PDB 2025-05-05 15:11:48 -07:00
Nikita Smith d3f8c1864d simplify aliases table and build basic types for unknown records 2025-05-05 15:03:53 -07:00
Nikita Smith cbe2783e0d always create RDI builtins 2025-05-05 15:03:53 -07:00
Ryan Fleury ced9c7a3f5 fix more secondary-flag coverage, fix error rows being generated as type rows, fix improper piping of autocompletion cursor info into autocompletion lister build 2025-05-05 11:26:14 -07:00
Ryan Fleury 4ad3748d1e commit panel/tab/view to rd_regs earlier in window_frame, this allows correct calculation of per-window settings in theme calc etc. 2025-05-05 10:53:25 -07:00
Ryan Fleury cf33470cb1 fix incorrect usage of type byte size for eval memory range sizes 2025-05-05 10:49:52 -07:00
Ryan Fleury 573a6b0bb2 further work on autocompletion system; more carefully preserve information about cursor / what is being replaced, do not apply autocompletion lister enabling setting to required listers (e.g. for settings/themes), and adjust navigation controls such that arrowkeys are consumed by the autocompletion lister (in principle this is 'stealing' functionality from the source ui, e.g. the watch window using up/down to go to different rows, but in practice when an autocompletion lister pops up, it feels way more natural to use arrowkeys) 2025-05-05 10:45:40 -07:00
Nikita Smith e1ca449ccb revert type indices change 2025-05-05 10:19:13 -07:00
Nikita Smith e2266322d0 Revert "pass over PDB converter"
This reverts commit f1e88b5667.
2025-05-05 10:19:13 -07:00
Ryan Fleury c840071bf8 clean up visualizer default sizes, clean up rough edges of various combos of theme setting / config state 2025-05-05 09:54:29 -07:00
Nikita Smith f7a3239294 utility for stripping debug info out of libs 2025-05-05 09:22:59 -07:00
Ryan Fleury d13bf27ab7 shift theme pattern cache from a per-frame cache to a permanent cache; use to animate (ui_key -> color) 2025-05-05 06:00:45 -07:00
Ryan Fleury da8e583f93 hook up fancy-cell edit button to double-click action, ensure double-click starts edits in listers for editable cells 2025-05-05 05:32:26 -07:00
Ryan Fleury 19acf2cdee checkpoint on final pre-release pass over 'fancy rows' (combined line edit, toggler, slider, etc. widget), plug autocompletion in for theme selection lister 2025-05-04 16:57:50 -07:00
Ryan Fleury 9b3a2c2428 pull out decision of autocompletion list expression, so that we can begin basing it on destination evaluations; adjust top-level theme editing controls to be less annoying 2025-05-04 15:28:47 -07:00
Ryan Fleury 24148dd672 set up settings for enabling/disabling pre-packaged stl/ue type view rules; fill out basic stl ones 2025-05-03 21:01:26 -07:00
Ryan Fleury 6c7568f946 fix out-of-date file rendering 2025-05-03 16:56:54 -07:00
Ryan Fleury 8fddc7b712 markup: omit static in global raddbg-section data, since clang will strip it 2025-05-03 16:53:57 -07:00
Ryan Fleury 8b7e7471f5 markup: thread id based APIs for names/colors; handle names/colors-before-thread, or id-based application, in ctrl layer 2025-05-03 16:45:45 -07:00
Ryan Fleury 5086d1b3db notes 2025-05-03 16:18:58 -07:00
Ryan Fleury 473f84cbda flip priority of (handle, id) thread name events; prefer id if it is there, to correctly work with the set-suspended-thread-name-by-ID case 2025-05-03 16:17:10 -07:00
Ryan Fleury ad8ae313f4 windows: clear unneeded working set pages shortly after startup/initialization 2025-05-03 09:43:02 -07:00
Ryan Fleury edafc4d5c2 batteries-included std::string_view 2025-05-03 09:19:48 -07:00
Ryan Fleury dfd0fe3fcb raddbg_markup: stl batteries-included basics 2025-05-03 06:18:26 -07:00
Ryan Fleury fe7bd82bda handmade hero theme 2025-05-03 05:52:56 -07:00
Ryan Fleury d3a60e1808 solarized dark theme 2025-05-03 05:30:16 -07:00
Ryan Fleury 2835706d3d 4coder theme 2025-05-02 20:44:50 -07:00
Ryan Fleury 293738e084 parameterize open-theme path correctly by parent bucket, rather than assuming user 2025-05-02 16:25:01 -07:00
Ryan Fleury a140197fcd crazier union test 2025-05-02 16:20:17 -07:00
Ryan Fleury f7ae0a1b47 collapse theme-file vs. theme-preset, plug all theme selection paths into picking that single string, plug theme lister in 2025-05-02 16:13:39 -07:00
Ryan Fleury 6c2cf98ea6 themes collection evaluation, begin moving theme preset/file setting to just being based on the themes folder, rather than completely path-based 2025-05-02 15:52:21 -07:00
Ryan Fleury 644ba8d02e theme presets work 2025-05-02 15:28:56 -07:00
Ryan Fleury d98335ef76 per-window theme-usage setting - by default, prioritize project theme settings, but allow using only user themes per-window as well. 2025-05-02 13:24:01 -07:00
Ryan Fleury dddc79e852 adjust tags in accordance with theme design pass 2025-05-02 13:17:17 -07:00
Ryan Fleury adf2eabba7 eliminate remaining usage code of old theme system; to not pay the cost of slower-path color lookups for every single syntax highlighted thing in the UI, just introduce 'code color slots', which are computed once per window per frame 2025-05-02 11:34:24 -07:00
Ryan Fleury 2b12239300 preserve query regs in floating views, so that we can chain info from many query commands together; more progress on theme editing, simplify command surface 2025-05-02 11:10:14 -07:00
Ryan Fleury 137855c217 improve row-building for type evaluations (eliminate redunant cells, show offsets/sizes) 2025-05-02 10:46:04 -07:00
Ryan Fleury bbeeb3dde5 ditto 2025-05-02 10:35:37 -07:00
Ryan Fleury 58b1aa41f6 drag/drop work & cleanup; memory view work; pull initial project path (if not specified on command line) from user recent projects before forming a default path 2025-05-02 10:29:22 -07:00
Ryan Fleury a96546c5f5 view rules / auto view rules -> views / type views 2025-05-02 09:50:41 -07:00
Ryan Fleury 2dbe8d42eb eliminate more old view settings code, simplify new, also clean up the targetless launch flow even more - if we only have one target, but it's inactive, and the user is trying to launch, then it doesn't hurt to just act as if that target was selected, then select it for them... 2025-05-01 17:04:29 -07:00
Ryan Fleury afc3a1a818 begin memory view pass 2025-05-01 16:43:20 -07:00
Ryan Fleury 23601f38a2 more run-in-invalid-state case tweaks 2025-05-01 14:17:57 -07:00
Ryan Fleury b20f003e7f tooltip coverage for all command evaluations, major top-bar simplification, anchored tooltips 2025-05-01 14:09:05 -07:00
Ryan Fleury e3f68622f7 window titles 2025-05-01 13:06:16 -07:00
Ryan Fleury 3be17c7157 merge local todo notes, pre/post 0.9.16 notes pass 2025-05-01 12:52:33 -07:00
Ryan Fleury f7757cd163 update memory range parameter extraction in visualizers, to be based on cfg tree 2025-05-01 11:56:27 -07:00
Ryan Fleury 630394750e add all visualizers to fixed tab list, derive language from view tree correctly rather than just the evaluation 2025-05-01 11:39:08 -07:00
Ryan Fleury 36e77e9691 clean up flow of active-targetless launch path; instead of just erroring, prompt user with selection, select if none selected, etc. 2025-05-01 11:04:14 -07:00
Ryan Fleury 306ad2d382 allow multiple leaf-identifier completions per input, using the cursor_off -> cursor_expr_node autocompletion querying path 2025-05-01 10:38:36 -07:00
Ryan Fleury 80268dd770 correctly evaluate array lens size arguments in the context of the parent expression 2025-05-01 10:16:41 -07:00
Ryan Fleury aa9a00f754 sketch out first pass of autocompletion list-expr/replace-range/filter based on cursor-offset -> expression-node path 2025-05-01 09:47:20 -07:00
Ryan Fleury 3a46e66efa expand eval expression tree location info to being based on textual range, rather than just offset 2025-05-01 09:05:42 -07:00
Ryan Fleury 2a1e19ad23 fix view-embedded query pushing - needs to apply to view, not simply tabs; fix schema-expansion command filtering 2025-05-01 08:34:43 -07:00
Ryan Fleury ed4fe5e3d1 fix auto-downcasting to work in all cases 2025-05-01 08:27:03 -07:00
Ryan Fleury 791187b152 blank cell rendering fixes, autocompletion work, fix to value-string visualization, more fixes/tweaks 2025-05-01 08:18:14 -07:00
Ryan Fleury 91be06dea9 fix single-line string value stringification; expand commands for tabs 2025-05-01 07:50:46 -07:00
Ryan Fleury f73ef86a54 fix row command query spawning rules 2025-05-01 07:36:34 -07:00
Ryan Fleury b0dd7700d7 apply autocasting below the ir-tree generation level of lens calls, so that we don't accidentally strip away lenses 2025-04-30 17:04:10 -07:00
Ryan Fleury 58a3a364cf sketch out autocompletion lister usage in query bars 2025-04-30 16:55:56 -07:00
Ryan Fleury c199ea6158 fix empty case in autocompletion lister building 2025-04-30 16:48:23 -07:00
Ryan Fleury fd6637b87b more dead code elimination 2025-04-30 16:41:01 -07:00
Ryan Fleury 78928974cb implicit member access path 2025-04-30 16:38:25 -07:00
Ryan Fleury c473cdf3b8 eliminate old autocompletion code 2025-04-30 16:24:38 -07:00
Ryan Fleury 1d4aa92779 fix autocomplete hint rendering on non-active line edits 2025-04-30 15:38:46 -07:00
Ryan Fleury 6ea0a237ce feed autocompletion rows forward from autocompletion lister 2025-04-30 15:33:15 -07:00
Ryan Fleury 9c53215daf fix expression updating with query views 2025-04-30 15:17:46 -07:00
Ryan Fleury 24f4ef2d2d begin sketching out new autocompletion lister path 2025-04-30 15:06:43 -07:00
Ryan Fleury 9ed65c2997 fix sizeof/typeof/bswap expr stringization 2025-04-30 13:42:43 -07:00
Ryan Fleury b1d63cd130 unattached process evaluation / lister 2025-04-30 13:34:05 -07:00
Ryan Fleury 9f468c44d9 ditto 2025-04-30 11:57:35 -07:00
Ryan Fleury e16f64f4e2 tighten up expr drag/drop 2025-04-30 11:54:10 -07:00
Ryan Fleury ee9017d5db cfg schema-based path relativization on save, derelativization on load; omit for file path maps 2025-04-30 10:50:36 -07:00
Ryan Fleury 005ff83d67 eliminate now-0redundant raw usage in watch row build 2025-04-30 10:19:44 -07:00
Ryan Fleury 10ff98faa8 fix type pattern matching for auto hooks, improve slice array indexing operations to rely less on the full irtree path (it composes poorly when using combining type views 2025-04-30 10:15:32 -07:00
Ryan Fleury 60b2195500 file path map, replacement file picking 2025-04-30 08:46:03 -07:00
Ryan Fleury 6f939bf9fc first pass at expr drag/drop in watch windows 2025-04-29 17:06:22 -07:00
Ryan Fleury fc308c0609 command correctness/cleanup pass 2025-04-29 16:00:06 -07:00
Ryan Fleury 7b5f55c3c8 convert mule_main to crlf, apparently..? 2025-04-29 15:34:39 -07:00
Ryan Fleury f521e01d6e dynamic ternaries in ir tree evaluation, fixes to over-ambitious parsing of identifier qualifiers 2025-04-29 15:26:40 -07:00
Ryan Fleury 0a214fda3c dynamic type resolution in ir tree / type generation pass 2025-04-29 15:06:06 -07:00
Ryan Fleury 4cccc9cb42 proper cast parsing, elimninate chained casts entirely 2025-04-29 14:53:35 -07:00
Ryan Fleury d41b414f2a eliminate very-poorly-thought-through idea of 'chained casts' - we need to recognize cast operators in the parser somehow, otherwise we are using the expr chain for way too many things in many cases... 2025-04-29 14:29:42 -07:00
Ryan Fleury 195883cbcb stub single line expansion flag 2025-04-29 13:50:20 -07:00
Ryan Fleury 3e6efb8935 fix lister row flags 2025-04-29 13:21:52 -07:00
Ryan Fleury 09372bd7c1 color visualizer / theme editing work 2025-04-29 12:15:41 -07:00
Ryan Fleury ddbb2148a4 distinguish tabs vs. views in rd_regs 2025-04-29 09:55:02 -07:00
Ryan Fleury c9be93485f build full evaluation expr string when building a view from an eval 2025-04-29 09:27:49 -07:00
Ryan Fleury f4e2728e9c full evaluation expression string computation, use for expression drag/drop - resolve parent expression chain in order 2025-04-29 09:16:26 -07:00
Ryan Fleury bc67abe4ca fix block type extraction in row build; the block tree build resolves evals to whatever types it is using for expansion, but sometimes we need to see types which have been stripped for row building (e.g. tables) 2025-04-29 09:01:09 -07:00
Ryan Fleury 71bdeb8f92 release notes work 2025-04-28 21:20:08 -07:00
Ryan Fleury 0c535b3e60 pre-emptively accumulate label edits in evaluation macro map, to prevent mid-frame ui tearing on edited cfg state 2025-04-28 17:51:45 -07:00
Ryan Fleury e7acf145cf clear cfgs on release 2025-04-28 17:29:13 -07:00
Ryan Fleury eb3b2572f1 more fixes to name -> color matching; more meta-type-tag usage fixes in reordering path 2025-04-28 17:13:22 -07:00
Ryan Fleury 1f1c4f161b cfg query eval filtering 2025-04-28 16:53:53 -07:00
Ryan Fleury a2ba3933cf fix ui tags-key/name -> color mapping; if a pattern is too specific, it should never match more general queries. but more specific queries can match less general patterns 2025-04-28 16:43:39 -07:00
Ryan Fleury 33479ec732 fix thread-in-code-view right-clicks, after moving to more stable ctrl entity evaluation 2025-04-28 16:20:41 -07:00
Ryan Fleury 57c331537b release notes 2025-04-28 16:19:05 -07:00
Ryan Fleury dc15a4fdc5 fix busted chained dot-access-style views 2025-04-28 16:02:48 -07:00
Ryan Fleury f72c956c9f fix implicit parent/override member accesses 2025-04-28 15:41:32 -07:00
Ryan Fleury 9fdfc7fab9 eval: distinguish irtree 'parents' from 'overrides' - parents are any irtree which some other expression is extending, and overrides are a subset of those, being just the irtrees overridden by auto-hooks. doing this because when we unwind the parent chain, sometimes we do not want to do that for basic expression extensions - we just want to undo the overrides. 2025-04-28 15:37:30 -07:00
Ryan Fleury 5a5e24a4a9 ditto 2025-04-28 14:06:02 -07:00
Ryan Fleury fff259e113 cache font setting calculations per-frame rather than recomputing all the time, fix some expandability calculations in eval visualization w/ multiple composing views 2025-04-28 14:04:02 -07:00
Ryan Fleury 0cdcb06db8 fix some edge cases in new casting compilation, fix some old usage of cast expr trees 2025-04-28 12:11:38 -07:00
Ryan Fleury c62ad20a9a switch cast expressions from being formally represented in the expression tree - instead use cast-like tree shapes to perform casts in the ir/typechecking phase. this is odd, given C's casting syntax, but it is much more natural given that the parser is not any longer doing identifier resolution, and as such it fixes a bunch of nasty edge cases. 2025-04-28 11:50:23 -07:00
Ryan Fleury 81425e8b90 use more stable IDs for ctrl entity evaluations 2025-04-28 10:25:37 -07:00
Ryan Fleury 93b1e3988d notes 2025-04-27 20:32:36 -07:00
Ryan Fleury 66187931aa accept font names, as well as font paths 2025-04-26 21:41:27 -07:00
Ryan Fleury 693ba7d077 fix 'cut' event being missed in standalone cell 2025-04-26 20:49:03 -07:00
Ryan Fleury 1e82d31eba first rough pass on theme editing 2025-04-26 19:01:35 -07:00
Ryan Fleury 282f6022e1 begin color editing, fix some bugs with meta-type-info disrupting type chain scans 2025-04-26 17:30:34 -07:00
Ryan Fleury 6a7420b7aa exception code filter project settings / ui 2025-04-26 14:50:49 -07:00
Ryan Fleury 2092f5ca69 eval space generation, to gracefully mark cached evaluations as dirty when desired 2025-04-26 12:33:48 -07:00
Ryan Fleury ea18e58903 fix & simplify path/pt meta editing 2025-04-26 11:38:22 -07:00
Ryan Fleury 6a9d212e70 adjust escape-to-close-query view rules, to account for non-lister query views, but with a command 2025-04-26 11:17:47 -07:00
Ryan Fleury db4f390fd0 fix input-expression-evaluation fallback in query views, to not be listerified; automatically open breakpoint editor when adding an address breakpoint manually 2025-04-26 11:13:36 -07:00
Ryan Fleury 05b52cfaca add extra bit that views can use to disable query bar - use in the case of watch window (and thus lister) editing 2025-04-26 11:04:54 -07:00
Ryan Fleury 6749f30b6b release notes 2025-04-26 10:57:11 -07:00
Ryan Fleury 19784ba476 improve labeled view titles, convert old watch-expression-gathering paths to using the per-watch-tab watches structure 2025-04-26 10:48:49 -07:00
Ryan Fleury 5103252a1b eliminate watches as a top-level entity, nest watch expressions under tabs - allow many watch windows, each with their own set of expressions. 2025-04-26 10:27:21 -07:00
Ryan Fleury 09f248de59 cfg evaluation improvements, tab expression editing, window size serialization fix, other small fixes 2025-04-26 10:02:56 -07:00
Ryan Fleury 970f40e516 notes 2025-04-25 11:08:46 -07:00
Ryan Fleury 33362d91a0 add dedicated open tab command as a fast path for all tab commands, simplify/streamline new tab menu 2025-04-25 10:04:42 -07:00
Ryan Fleury 0ed951e537 simplify font cache run building api, since it is now cahced 2025-04-25 09:46:58 -07:00
Ryan Fleury 7dc920c14f font cache: add additional layer of caching for runs 2025-04-25 09:45:43 -07:00
Ryan Fleury e0ba1155e8 eliminate recursive version of final ui layout position pass 2025-04-25 08:29:44 -07:00
Ryan Fleury fe46e61acb eliminate recursion from ui size calculation pass, replace with iterative equivalents 2025-04-25 08:25:00 -07:00
Ryan Fleury 0fbcd72a3e fix query offsets 2025-04-24 20:09:18 -07:00
Ryan Fleury b59528edea tab/text-pt/text-range filtered commands, hook up to right-click menus 2025-04-24 16:55:52 -07:00
Ryan Fleury 0470b646cd more tab-opening-fastpath coverage, fix described-code-string meta-cfg evaluation value rendering, tab settings cmd coverage 2025-04-24 16:27:24 -07:00
Ryan Fleury 23c7fcf099 plug tab opening back in 2025-04-24 15:57:57 -07:00
Ryan Fleury f4b364b668 autogenerate fixed tab list, autogenerate command metadata for opening fixed tabs 2025-04-24 15:21:51 -07:00
Ryan Fleury d0cbaee344 prep watch windows for floating query stacks; fix member/array-index generated-expression visualization 2025-04-24 13:39:26 -07:00
Ryan Fleury a9685e6b9d pass through eval msgs appropriately in eval cache evaluations; fix rules for reverting to overridden IR trees on usage of 'raw'; more fixes/improvements 2025-04-24 13:04:32 -07:00
Ryan Fleury a6c9a1bd2a fix editable expression strings, fix command evaluation, etc. 2025-04-24 09:52:29 -07:00
Ryan Fleury a35e483629 switch type expansion hooks to being eval-based, not expr/irtree-based 2025-04-24 09:36:00 -07:00
Ryan Fleury 9bb592786a eliminate all old evaluation bundled helpers, eliminate old fragmented eval caches; move all to unified evaluation cache 2025-04-24 09:07:29 -07:00
Ryan Fleury c341fb6c00 work on next release notes 2025-04-23 21:26:32 -07:00
Ryan Fleury 2f7e48e5cf first pass at unified evaluation cache 2025-04-23 17:29:31 -07:00
Ryan Fleury 23125dd312 cache font raster flag settings, add additional acceleration to very common repeated cfg lookups - e.g. same window/view -> state structure N times, or same ID -> cfg N times 2025-04-23 16:21:10 -07:00
Ryan Fleury ba29350939 parse cache, ir-tree cache 2025-04-23 16:00:23 -07:00
Ryan Fleury c9a05bc76f adjust block tree building from being on expr -> being on eval 2025-04-23 14:45:15 -07:00
Ryan Fleury a27b90a3f9 eliminate separate expr -> type path (this is just done via ir tree generation now), eliminate helper for locating defines & pushing to macro maps 2025-04-23 12:04:50 -07:00
Ryan Fleury c766ffe0a3 kill old code 2025-04-23 11:55:58 -07:00
Ryan Fleury 264dbc8199 deduplication from evaluation ctxs - just have base ctx with deduplicated info, then separate type-state, ir-ctx, and interpretation-ctx 2025-04-23 11:49:44 -07:00
Ryan Fleury 0ce85082ec include font in user settings schema 2025-04-22 17:16:29 -07:00
Ryan Fleury a9dcc7a08e more tweaks 2025-04-22 17:05:28 -07:00
Ryan Fleury afed771adb adjust cmd binding editor buttons style 2025-04-22 16:43:17 -07:00
Ryan Fleury 4cbb03fbfe ctrl + scroll -> adjust global font size by default, ctrl + shift + scroll -> adjust text view font size 2025-04-22 16:40:45 -07:00
Ryan Fleury fc728ea4e9 description coverage, char visualization disabling 2025-04-22 16:13:29 -07:00
Ryan Fleury 5bfb5b578a do not do mixed eval/expr booleans in watch groups 2025-04-22 15:47:37 -07:00
Ryan Fleury 42ee4b9776 lister -> palette 2025-04-22 15:36:45 -07:00
Ryan Fleury 5aae5cc4bb more work on combined cell path, debugging, fixes 2025-04-22 15:29:58 -07:00
Ryan Fleury d9d102cb56 expand cell capabilities to have meta data (expr name/description/etc.), as well as value editor, as well as fancy value editing widgets, all in one cell 2025-04-22 13:53:52 -07:00
Ryan Fleury 78b5582e95 dead code elimination, do cleanup pass over cell text rendering story, prep for expr/eval in same cell 2025-04-22 11:24:41 -07:00
Ryan Fleury c7a9e174fa eliminate mutual exclusion of expression/evaluation cells; allow both paths to be turned on in a single cell 2025-04-22 10:17:16 -07:00
Ryan Fleury 3d1f764741 control to disable windows style menu bar alt behavior 2025-04-21 17:23:38 -07:00
Ryan Fleury c9227b71e2 corner radii editing 2025-04-21 17:17:52 -07:00
Ryan Fleury 83e59bb0c0 fix incorrect resolution to type-mode evaluation with dereference ops 2025-04-21 16:57:27 -07:00
Ryan Fleury 1c71b89387 eval irgen: allow ,length fastpath for array types as well 2025-04-21 16:55:46 -07:00
Ryan Fleury 4fe602521a fix pointer dereference path in type-mode evaluation; carve out exception for lens visualization with string-pointers - in that case, we just want to apply a string size limitation & go to the regular string path; begin getting off old color slots 2025-04-21 16:49:02 -07:00
Ryan Fleury 93b8aef49c fix target environment string list evaluation cell building; extend lister completion with further push-queries for catchall; extend f1 lister to include targets, types, globals, thread-locals 2025-04-21 15:45:39 -07:00
Ryan Fleury a5c68412fc further work/convergence on cell rendering / listers 2025-04-21 15:23:49 -07:00
Ryan Fleury 20ba4a6af9 dead code elimination, user/project setting evaluation, work on color view ui 2025-04-21 14:57:31 -07:00
Ryan Fleury 0ce9925ba6 pipe through parent expression string info through expr -> string generation path, so we can correctly generate standalone expression strings in the presence of $ (parent shortcuts) 2025-04-21 11:54:55 -07:00
Ryan Fleury 7946e938c0 raw -> walk chain of overridden irtrees, since we want to strip 100% of all overrides/hooks/etc. 2025-04-21 11:46:03 -07:00
Ryan Fleury 8dd334d754 fix row key uniqueness of chained expansions, fix initial edit strings for value editing 2025-04-21 11:37:10 -07:00
Ryan Fleury 21a7126a57 kill old row/cell building code, fix incorrect use of view ui rule hooks in all cells 2025-04-21 11:12:42 -07:00
Ryan Fleury c4a18f7bff list select thread command in ui again 2025-04-21 11:05:14 -07:00
Ryan Fleury 02dc501547 transient tab editing, more work on descriptions/schemas for settings/etc 2025-04-21 11:02:27 -07:00
Nikita Smith d98ea1cf6f parallel build targets 2025-04-21 10:19:56 -07:00
Ryan Fleury cbe1365244 cell description rendering 2025-04-20 20:21:54 -07:00
Ryan Fleury 9453f62cf4 cmd filter -> filter on display names, descriptions, and search tags 2025-04-20 19:35:37 -07:00
Ryan Fleury ffb81cd814 f1 lister completion; improve command listing 2025-04-20 19:30:22 -07:00
Ryan Fleury 19a56b88a0 correct cell expression edit string formation 2025-04-20 19:09:11 -07:00
Ryan Fleury c45bd364eb use meta-display-names in cell rendering, fix small command buttons 2025-04-19 21:23:48 -07:00
Ryan Fleury 657f5edb31 compute cell editability 2025-04-19 19:12:55 -07:00
Ryan Fleury 92f3ea922d fix row command evaluations in row building 2025-04-19 09:44:43 -07:00
Ryan Fleury dc151609ad fix files/cmds fancy string list build 2025-04-18 21:21:46 -07:00
Ryan Fleury e30df5122a first half of cell rendering pass 2025-04-18 17:15:57 -07:00
Ryan Fleury 225ac267f0 pass over row info building 2025-04-18 15:51:27 -07:00
Ryan Fleury f99d560b40 more tweaks of the previous 2025-04-18 15:02:24 -07:00
Ryan Fleury c5402faa25 work on floating view state machines / characteristics - lister, query views, what happens on escape, is there a filter by default or not, etc. 2025-04-18 14:49:59 -07:00
Ryan Fleury d053edab3f correctly register types for cfg/ctrl-entity queries 2025-04-18 13:58:38 -07:00
Ryan Fleury ff35db0e16 more eval type operators for metadata decorations; fix target environment string list evaluation / edits 2025-04-18 13:48:31 -07:00
Ryan Fleury ddf0703b02 fix scroll bar size in watch views with changed font size, fix type evaluations 2025-04-18 11:03:40 -07:00
Ryan Fleury 2fd5e743b9 eliminate old font size code 2025-04-17 16:35:01 -07:00
Ryan Fleury 2925161c3a sequence/table visualization test in mule 2025-04-17 16:29:38 -07:00
Ryan Fleury 79b6ee4959 fix permanent growth of transient cfg trees, ensure correct recycling as old cfg trees for module-defined auto view rules etc. 2025-04-17 16:26:13 -07:00
Ryan Fleury 559f1baae1 begin fitting settings into window evaluation 2025-04-17 16:05:31 -07:00
Ryan Fleury f3974b2af7 only/omit; disallow chained fastpaths (vs-style ,x ; ,b; ,count) in nested irtree generations 2025-04-17 15:36:43 -07:00
Ryan Fleury 751f3708e7 interval lens, to generate an expansion of N things, to use w/ tables 2025-04-17 13:46:06 -07:00
Ryan Fleury a2047619c4 window evaluation, provide path to get to per-window settings 2025-04-17 13:14:08 -07:00
Ryan Fleury 9bc8641db1 distinguish row commands vs. expansion commands in cfg evals 2025-04-17 12:52:47 -07:00
Ryan Fleury b20ff61e50 fix inc/dec font size commands for new font size cfg setup 2025-04-17 11:22:51 -07:00
Ryan Fleury f1549f6b53 correctly use all schemas (including inherited ones) when doing lookups/evaluations; shift enabled to using evaluation path rather than just checking the value string; fix visualization of inherited schema values (e.g. font sizes in tabs) 2025-04-17 10:53:11 -07:00
Ryan Fleury f29c017268 adjust text/disasm views to apply top-level font size to scroll bars / metadata, but use the per-view font size for main contents 2025-04-16 12:16:36 -07:00
Ryan Fleury 950199026b begin folding font size parameters into main cfg tree settings path; allow per-tab font sizes, eliminate all redundant font size lookups/applications 2025-04-16 12:10:56 -07:00
Ryan Fleury 51f46cb5b8 eliminate extra view rule channel in rd_regs/hover-eval/watch-pins/etc. 2025-04-16 11:13:30 -07:00
Ryan Fleury 2a45696294 matrix table visualization test 2025-04-16 11:02:04 -07:00
Ryan Fleury b9ef453a14 eval visualization - allow chained expressions to cause multiple child expansion blocks; begin work on unified lister watch window 2025-04-15 16:27:44 -07:00
Ryan Fleury 923f55fb2b correctly treat chains of lenses when looking up type hooks; allow type-evaluations when producing per-cell evaluations 2025-04-15 14:18:21 -07:00
Ryan Fleury 82ec25ad19 table lens 2025-04-15 13:31:11 -07:00
Ryan Fleury 85f715f2ba revert to single expression from parse, but keep chains as implicit extension to expressions; use chained expressions to look up shorthands for hex, dec, bin, array counts, etc. 2025-04-15 13:07:59 -07:00
Ryan Fleury 1679aa6f64 fix up / simplify decision path to wrap cfg evaluations with meta-expr type 2025-04-15 11:50:36 -07:00
Ryan Fleury e27f31cfa4 adjust meta-expr type visualization; unify 'type unwrapping' paths, instead of nest of various 'scanners', we just have one path which we parameterize via bits to skip what each path needs 2025-04-15 11:35:49 -07:00
Ryan Fleury db381db85d meta-expr type operators, for meta-evaluations, to annotate source expression strings of evaluations 2025-04-14 15:21:46 -07:00
Ryan Fleury 8e13f8162a adjust memory reads from cfg spaces to evaluating the cfg strings, rather than directly interpreting them as leaves 2025-04-14 14:52:46 -07:00
Ryan Fleury cbc44cd9e4 fix hover eval view cfg build; fix editability-from-type-key path to respect lenses 2025-04-14 14:31:38 -07:00
Ryan Fleury a34e39751f eliminate type-determined cfg tree eval writes - just always use textual data, and only use type info if committing to an actual ctrl entity space 2025-04-14 14:12:23 -07:00
Ryan Fleury a021e6f68f extend rangification of meta evaluations to all child evaluations; further mark up schema expansion types 2025-04-14 13:51:43 -07:00
Ryan Fleury 5162301316 f32 path for meta evaluations 2025-04-14 13:18:01 -07:00
Ryan Fleury 7d48e9915d adjust lens'd eval -> view cfg to being based on type info, not expression tree 2025-04-14 12:58:26 -07:00
Ryan Fleury b34c70a247 begin merging view state / view parameterizations - unify code for introspecting on each, thus allowing explicit parameterizations of view state via a lens call. also build out the path from an eval -> cfg tree 2025-04-14 12:49:47 -07:00
Ryan Fleury ee0c1b25c3 eval ir generation: adjust autohook-allowance to be a stack, and correctly disable it for all sub-evaluations when using a raw lens, such that autohooks do not apply for evaluation of the parameter (e.g. raw(foo) -> foo, without allowing mapping of foo to something else) 2025-04-14 11:07:18 -07:00
Ryan Fleury 70c003607d further fixes to slider viz 2025-04-14 10:55:33 -07:00
Ryan Fleury 550950ed46 ui min sizes, fixes to slider viz 2025-04-14 10:49:36 -07:00
Ryan Fleury b98f2b153e fix call expr stringification 2025-04-13 16:45:27 -07:00
Ryan Fleury 7c668388eb hook up programmatic breakpoint state to trap list 2025-04-12 19:38:07 -07:00
Ryan Fleury 8a857b2154 use set/unset breakpoint events to build bp entities in ctrl entity tree 2025-04-12 15:32:27 -07:00
Ryan Fleury 7ba027e841 sketch out new markup API for programmatic address/data breakpoints 2025-04-12 15:21:48 -07:00
Ryan Fleury 6a5fa58d8a dedup flagged traps, so we don't write the same data breakpoint into the registers multiple times 2025-04-12 14:47:29 -07:00
Ryan Fleury 97e3c73086 fix flagged-trap-search 2025-04-12 14:39:38 -07:00
Ryan Fleury 0f380e9228 transmit user breakpoints hit from demon -> ctrl using ctrl-defined IDs, correllate those IDs to rd-defined IDs, use rd-defined IDs in stop events to count bp hits, rather than re-resolving breakpoints. further fixes & work on first pass of data breakpoints 2025-04-12 14:28:38 -07:00
Ryan Fleury d894f7112f array view rule 2025-04-12 07:55:19 -07:00
Ryan Fleury 3f69b028e4 fix ptr-to-ptr expansions 2025-04-12 07:34:27 -07:00
Ryan Fleury ecad70ca19 pass through data breakpoint length, more progress on fixes/correctness in first pass 2025-04-11 18:07:00 -07:00
Ryan Fleury 929e68d074 first pass at setting up x64 debug registers for data breakpoints 2025-04-11 17:49:16 -07:00
Ryan Fleury e621d13669 frontend ui/editor & data funnelling for hardware data breakpoints 2025-04-11 17:03:36 -07:00
Ryan Fleury 64187e75eb slider extension to built-in cell controls (similar to toggle-switch) 2025-04-11 16:21:47 -07:00
Ryan Fleury 72aa479724 eliminate unnecessary usage of $. in mule auto view rules 2025-04-11 15:04:32 -07:00
Ryan Fleury e754380caa eval identifier resolution: allow implicitly mapping leaf identifiers to member accesses of overridden irtree 2025-04-11 15:02:54 -07:00
Ryan Fleury 2e8bca21f6 strip out only/omit - i think they are insufficient for long-term filtering stuff... 2025-04-11 14:41:15 -07:00
Ryan Fleury 3e49e92e98 only and omit; notes & dead code deletion 2025-04-11 14:16:48 -07:00
Ryan Fleury 83a31a5229 take out view rules from pins, since that is just in the expr itself now 2025-04-11 13:21:25 -07:00
Ryan Fleury abd33f7160 new (and successful :) ) story for 'parent/overridden irtrees'. basically, if we have a rule which maps some eval X's type from A -> B, we preserve the original ir-tree compilation of A in the 'history' when we inevitably produce the ir-tree compilation of B. this can be used for accesses on overridden evaluations, and it allows us to implement $ in auto view rules. 2025-04-11 11:58:43 -07:00
Ryan Fleury 9622bc8808 fix calls to parent tree experiment 2025-04-11 11:26:01 -07:00
Ryan Fleury b60329c817 eliminate view rule column; eliminate 'parent irtree' experiment, need to do something else 2025-04-11 11:25:16 -07:00
Ryan Fleury 59df09b39b re-enable auto view rules in mule 2025-04-10 16:53:36 -07:00
Ryan Fleury 297c576623 irtree parent experiment (failed) 2025-04-10 16:20:52 -07:00
Ryan Fleury b7e12f900c eliminate dead code 2025-04-10 15:19:58 -07:00
Ryan Fleury 0dd0f1b8bc rephrase type irgen hook -> irext, to eliminate cases where it'd be very easy to accidentally cause infinite recursion of ir generation (e.g. slice(x) requiring evaluation of 'lhs.count', where lhs == slice(x)). also bring back slice hooks 2025-04-10 15:19:29 -07:00
Ryan Fleury 4a69b8e57a type decoration to explicitly disable string visualization; use in registers & padding members; eliminate dead code 2025-04-10 14:29:58 -07:00
Ryan Fleury c05c21cfa4 lens inheritance-on-expansion, composability with lens types & accesses (dot operator, array index operator), plugging in visualizers, killing dead code, etc. 2025-04-10 14:29:58 -07:00
Ryan Fleury d15f9af4b7 fix incorrect signal of error on meta-ctrl-entity eval space write 2025-04-10 14:29:58 -07:00
Ryan Fleury 8dd8eaa507 more work on lens-wrapped expressions composability w/ default expansions, operators, etc. 2025-04-10 14:29:58 -07:00
Ryan Fleury c9e55cacf5 fix root-level block -> row expansion 2025-04-10 14:29:57 -07:00
Ryan Fleury c7a3a73b63 fix incorrect story for chained lens calls; fix possibly-overridden usage of lens calls in ui build 2025-04-10 14:29:57 -07:00
Ryan Fleury fbe747a8b4 further work on convergence, dead code elimination, and lens (view rule) calls 2025-04-10 14:29:57 -07:00
Ryan Fleury cde079a14d checkpoint in moving to new type-based view rule / synthetic structure hooks 2025-04-10 14:29:57 -07:00
Ryan Fleury ac65d7fc34 fix incorrect type info generation of schema'd evaluations 2025-04-10 14:29:57 -07:00
Ryan Fleury c938a6fcfa next checkpoint; eval/type-hooks for registers, locals, files/folders, cfgs 2025-04-10 14:29:57 -07:00
Ryan Fleury d3f0a9a672 checkpoint in moving from old lookup hooks -> new type hooks; elimination of unnecessary recomputation of ir-trees/evals, just use information in already-computed evals 2025-04-10 14:29:56 -07:00
Ryan Fleury fbd78525d2 sketch out new eval type-system-defined hooks for all eval-layer view rules; accesses (., [] operators), expansion ranges, id <-> num mapping 2025-04-10 14:29:56 -07:00
Ryan Fleury 7c0a37fef3 boil down expr/irtree/type -> lookup_rule mapping more - since lens arguments are now stored in type info, we no longer need other ways of smuggling through expression trees. also fill out new path of pointer eval single-line string generation. 2025-04-10 14:29:56 -07:00
Ryan Fleury 9bfa4f87e3 work on new eval-viz layer stringification which factors out measurement/limiting/etc., but just walks an eval tree and stringifies each part; start working on new types <-> lookup-rule stuff 2025-04-10 14:29:56 -07:00
Ryan Fleury b1f17b217c checkpoint - extend constructed types w/ expression arguments, new 'lens' type operator, which can wrap evaluations of other types, + provide a name/args. e.g., bitmap(256, 256) <- (uint8 *), as a well-formed type. this also is the first step to collapsing all 'expression introspection' paths, and making sure they all compose properly. 2025-04-10 14:29:56 -07:00
Ryan Fleury 97a1003d85 eliminate old incorrect auto-hook of ctrl entity type keys; was busting visualization of ctrl entities 2025-04-10 14:29:56 -07:00
Ryan Fleury 84e16b81ff automatically mark up entry_point as exe entry points, for codebase builds 2025-04-10 14:29:55 -07:00
Ryan Fleury da69d9e91c more progress on new eval/view-rule integration; raddbg_entry_point markup feature 2025-04-10 14:29:55 -07:00
Ryan Fleury ecb3992b93 eval stability tests in tester; tear out last pass' view rule extensions 2025-04-10 14:29:55 -07:00
Ryan Fleury 710828c67d checkpoint in switching to new call-style of view rules for everything 2025-04-10 14:29:55 -07:00
Martins Mozeiko 0c999d70dc better error message if CreateProcess fails 2025-04-07 10:42:54 -07:00
Ryan Fleury 0705ba0a96 begin plugging in view rules as formal call part of expression language 2025-04-07 08:01:33 -07:00
Nikita Smith d060cb58b7 disable import library for radlink build 2025-04-05 11:59:10 -07:00
Nikita Smith ea5aab3f7e remove assert for empty switch 2025-04-04 15:50:23 -07:00
Nikita Smith ab05133f8a picked better name convention for the section table 2025-04-04 15:47:56 -07:00
Nikita Smith 8beb168905 went over COFF string table and changed the parser code accept to String8 2025-04-04 15:45:51 -07:00
Nikita Smith c090bee2f3 added missing debug comments for chunks 2025-04-04 15:45:51 -07:00
Nikita Smith bb3d01ffe6 output lib index and chunk debug comments 2025-04-04 15:45:51 -07:00
Nikita Smith c6ba475427 produce image layout map 2025-04-04 15:45:51 -07:00
Nikita Smith 02885b0b86 dedup manifest inputs 2025-04-02 22:48:56 -07:00
Ryan Fleury ca7f20e394 detect window resizes as a layout-reset correctly 2025-04-02 15:55:50 -07:00
Ryan Fleury 95df14bc20 eliminate old short-circuit from leaf-numeric expr tree generation path 2025-04-02 15:25:14 -07:00
Ryan Fleury c6add5f8f0 fix incorrect type name short-circuit check 2025-04-02 15:12:32 -07:00
Ryan Fleury 9bf69afd0b eval: procedure, type, thread-variable name mapping; sketch out implicit member access path 2025-04-02 15:07:35 -07:00
Ryan Fleury 33de625373 eval: register, register alias name mapping in new name resolution pass 2025-04-02 14:56:53 -07:00
Ryan Fleury 9146594ff9 eval: global name resolution in new ir-stage name resolution path 2025-04-02 14:39:38 -07:00
Ryan Fleury 6113a2e3db eval: do simplification pass over identifier resolution, shift from parsing stage -> ir generation / typechecking stage; do simplifications over expr tree, eliminate redundant kinds 2025-04-02 14:30:12 -07:00
Ryan Fleury b2ae4d89d7 eval: re-slice helper map data structures -> core 2025-04-02 11:08:27 -07:00
Ryan Fleury 190b74f411 shift first-class basic type names to more widely-used names (int32 instead of S32, etc.); force match of any debugger-known basic type name -> key, do not settle for bogus aliases from debug info 2025-04-01 16:04:57 -07:00
Nikita Smith 1c518bfa07 prefix COFF machine enums with "Type" 2025-03-31 22:53:10 -07:00
Nikita Smith 1c1a8b84ec pass over raddump
- made inline sites section more compact
- consistent indentation for PE/COFF printers
2025-03-31 22:49:17 -07:00
Nikita Smith 03a87fd4ee cleaned up a bit symbol replacement logic 2025-03-31 22:47:57 -07:00
Ryan Fleury bca5169447 eliminate manual console creation & needs-console detection; use user-error mechanism for process creation failure 2025-03-31 16:38:18 -07:00
Ryan Fleury 999eca5e29 more old eval trimming 2025-03-31 15:41:10 -07:00
Ryan Fleury a5d6e8a335 make eval ctxs more robust to missing info, e.g. in the test harness case 2025-03-31 13:48:19 -07:00
Ryan Fleury 17ff4da9bf more eval scratch work 2025-03-31 13:09:30 -07:00
Ryan Fleury fbe0d3bc2e set up eval scratch; promote raddbg_markup to base layer, plug in custom codebase vsnprintf 2025-03-31 11:41:14 -07:00
Ryan Fleury 1adf280354 delete dead code in eval 2025-03-31 11:02:17 -07:00
Ryan Fleury 833bee35e3 sketch out new auto view rules for new expression language idea 2025-03-28 15:50:19 -07:00
Ryan Fleury 5eb9f2f886 big notes/todos/release-notes pass 2025-03-28 12:21:18 -07:00
Ryan Fleury 160083835a add std::vector / auto-view-rule test to mule 2025-03-28 11:38:56 -07:00
Ryan Fleury 269efba455 fix treatment of floats in thread color rgba macro in raddbg_markup 2025-03-28 11:04:37 -07:00
Ryan Fleury 3911a66b30 fill out first pass implementations of raddbg_markup features; thread names, thread colors, format-string output-debug-string helper, attachment-checking 2025-03-28 10:56:41 -07:00
Nikita Smith 4cc883a353 update includes in rdi_breakpad_from_pdb 2025-03-27 15:49:15 -07:00
Ryan Fleury da3c15c7ed short-circuit rule lookups if explicit default is found 2025-03-27 15:41:47 -07:00
Nikita Smith c57b5fcd6d appease clang 2025-03-27 15:37:27 -07:00
Nikita Smith dab65d6523 deleted rdi_dump, all features of this dumper are now part of raddump 2025-03-27 15:18:43 -07:00
Nikita 350c17a606 Update builds.yml
replaced rdi_dump with raddump
2025-03-27 15:17:50 -07:00
Nikita 12628c679c Update builds.yml
remove rdi_from_dwarf
2025-03-27 15:10:57 -07:00
Nikita Smith 5ba981357d fix string cast warning 2025-03-27 15:01:16 -07:00
Nikita Smith 3c7c2918f6 replace pointers to incomplete types in UDT members 2025-03-27 13:47:47 -07:00
Nikita Smith 49ba163077 export CodeView types as aliases to its builtin counter-parts, 2025-03-27 13:47:47 -07:00
Nikita Smith 53c889e5d3 switched to using base Arch enum for converting DWARF registers,
simplified top level building path
2025-03-27 13:47:46 -07:00
Ryan Fleury dc967f5274 fix treatment of 0-terminator in raddbg data section, fix encoding of auto view rules in raddbg data section 2025-03-26 16:28:13 -07:00
Ryan Fleury b154c5a120 use slightly looser mapping for auto-view-rules, to not generate false negatives when looking up 2025-03-26 14:57:58 -07:00
Nikita Smith 14966d932e don't bake discarded type 2025-03-26 14:52:35 -07:00
Ryan Fleury 03cbbac6d7 source-markup-defined auto-view-rules 2025-03-26 13:45:26 -07:00
Nikita Smith 8f7ca178c2 bugfix incomplete type resolution hash table lookup 2025-03-26 12:21:55 -07:00
Nikita Smith c80661449c added rest of XMM registers, more progress on converting expressions front 2025-03-26 12:19:16 -07:00
Nikita Smith e7cee3b83c helper for extract bits 2025-03-26 12:19:16 -07:00
Nikita Smith ff61ad4cf8 improved formatting of bytecode locations, and added inline site name display
next to inline site index
2025-03-26 12:19:16 -07:00
Nikita Smith 63086b802c opcodes for encoding partial values 2025-03-26 12:19:16 -07:00
Nikita Smith 64b8f762cb fix bytecode list concat 2025-03-26 12:19:16 -07:00
Nikita Smith d137d928c9 added call site value opcode to RDI format 2025-03-26 12:19:16 -07:00
Nikita Smith 8551e8c3ec remove unused funcs 2025-03-26 12:19:16 -07:00
Nikita Smith 801b18a82d bugfix machine conversion in PDB and improved inference of conversion drivers 2025-03-26 12:19:16 -07:00
Nikita Smith a63254b70d merged rdim_help.c into rdim_local.c 2025-03-26 12:19:16 -07:00
Nikita Smith 7d5110e752 take into account null type slot 2025-03-26 12:18:47 -07:00
Nikita Smith b10b08783a WIP RAD debug info converter 2025-03-26 12:18:47 -07:00
Nikita Smith a84028d67a helper for checking if ELF has DWARF debug sections 2025-03-26 12:18:47 -07:00
Nikita Smith b9c4774786 minor fixes 2025-03-26 12:18:46 -07:00
Nikita Smith 2e6ffbd0c4 fixed typo in attrib class for DW_Form_RngListx 2025-03-26 12:18:46 -07:00
Nikita Smith 0c61415f72 merged path helper code from linker layer into main path layer 2025-03-26 12:18:46 -07:00
Nikita Smith 1ec1deedee moved MSF magic checkers to msf.c 2025-03-26 12:18:46 -07:00
Nikita Smith 0c3a37af44 helper for extracting GNU debug link info 2025-03-26 12:18:46 -07:00
Ryan Fleury 48f0702e05 fix source markup parsing, release notes for source-defined watch annotations 2025-03-26 11:49:15 -07:00
Ryan Fleury bd35ea83fc support for raddbg_pin markup on-the-fly watch pin annotations 2025-03-26 11:38:32 -07:00
Ryan Fleury 29d430ca6c dial back use of hand hover cursor 2025-03-26 10:00:49 -07:00
Ryan Fleury 42e888d41e fix breakpad converter build 2025-03-25 16:57:33 -07:00
Ryan Fleury ab9885bc7d fix clang build 2025-03-25 16:54:12 -07:00
Ryan Fleury 213091cf75 add safeguard to not overwrite old config data, for anyone using dev currently... 2025-03-25 16:40:52 -07:00
Ryan Fleury a826afd4d6 merge part 2 2025-03-25 16:30:05 -07:00
Ryan Fleury c4f4b5ff01 merge 2025-03-25 16:21:51 -07:00
Ryan Fleury 4787a183e3 fix consistency issues 2025-03-25 16:06:13 -07:00
Ryan Fleury 8ba44295c6 more aggressively gc hover eval view state; do not use hotkey intermediate if a command triggered by a watch window is already parameterized 2025-03-25 15:17:56 -07:00
Ryan Fleury af9ddf0a48 eliminate old entity -> eval blob paths / cache 2025-03-25 14:57:06 -07:00
Ryan Fleury aff63db8eb ctrl entity meta evaluation, hook up reads/writes, get off eval blobs; switch freeze/thaw ui to working on 'active' child, plugs into usual toggle path 2025-03-25 14:56:21 -07:00
Ryan Fleury 974ce5fa59 eliminate rule to associate set names with expand rules / visualizers; this is really only a rule we want for the core eval lookup hooks 2025-03-25 14:13:59 -07:00
Ryan Fleury ef1685adc9 pass over cfg meta evaluations; instead of forming artificial 'eval blob', just use sets/queries/hooks to do the lookups. eliminate cfg -> eval blob cache. switch to 'enabled' rather than 'disabled' as the cfg default. more convergences/fixes/tweaks. 2025-03-25 13:49:59 -07:00
Ryan Fleury 87e4b8b3f8 adjust toggle_switch 2025-03-24 15:48:44 -07:00
Ryan Fleury 2d7a8740bf adjust toggle switch rules 2025-03-24 15:04:54 -07:00
Ryan Fleury 4f2eb2ebe2 pass over cell line edit; toggle-switches for editable boolean types 2025-03-24 14:56:41 -07:00
Ryan Fleury 93584ba2ba convergence, enum member name evaluation fixes, visual fixes/tweaks 2025-03-24 13:17:10 -07:00
Ryan Fleury 02322191fe fix drag/drop of immediate views, fix disallowance of [ or { in mdesk tags, other various convergences/fixes 2025-03-21 17:18:16 -07:00
Ryan Fleury c2bebf2a53 snap to thread on stop on all windows, not just focused 2025-03-21 14:30:29 -07:00
Ryan Fleury c70132cd37 never mind --- this conflicts badly with stable version! 2025-03-21 11:51:52 -07:00
Ryan Fleury 1cef39d0a3 bump encoding version to match dev 2025-03-21 11:42:02 -07:00
Ryan Fleury cc4c889a99 bump format encoding version; add breakpad converter to ci; remove unused code 2025-03-21 11:39:53 -07:00
Ryan Fleury 6f3c14c423 fix misusage of disabled schema 2025-03-20 16:17:12 -07:00
Ryan Fleury 5596f1c8a3 more convergence, fixes, use new tab options mechanism to allow disabling line numbers in text/disasm 2025-03-20 16:00:23 -07:00
Ryan Fleury e2bfecc384 further work on rich hover vs. hover eval vs. ctx menu arrangements; it's a bit too noisy/annoying when hover eval for breakpoints/threads/etc. is just turned on all the time, and now that we have the ability to hover-eval-style query views, because of tabs, we can just do that with breakpoints etc. too. the old rich hover tooltips / highlights / etc. can then just be used normally. also put in some mechanisms to block rich hover tooltips when it is strictly redundant information. 2025-03-20 15:01:40 -07:00
Ryan Fleury 43d8fd4886 query watch windows progress; hook up visualizer schemas to cfg evaluator, use in tab query watch 2025-03-20 14:26:09 -07:00
Ryan Fleury f5683b0f3d convergence - source view switching commands 2025-03-20 10:09:06 -07:00
Ryan Fleury 1ffb8a082e sketch out first several 0.9.16 release notes 2025-03-20 09:19:27 -07:00
Ryan Fleury 8df16b8508 fix ctx menu closing escape consumption rules; fix top bar prioritization rules 2025-03-19 16:42:14 -07:00
Ryan Fleury b9ed7b3f0f fix menu bar focus rules breaking when hover eval focused 2025-03-19 16:22:42 -07:00
Ryan Fleury 4316325b33 demon win32: only alloc console when launching target if the exe is not a windows gui pe subsystem 2025-03-19 16:08:29 -07:00
Ryan Fleury d3e25567ac convergence on listers / visual fixes 2025-03-19 15:30:47 -07:00
Ryan Fleury 7d4d8762b7 collapse query/hover-eval building paths into single floating-view-build path 2025-03-19 10:30:50 -07:00
Ryan Fleury eaa3711405 dead code elimination / small fixes in collection query eval 2025-03-19 06:31:18 -07:00
Ryan Fleury 6a44f6485d eliminate old and now unused parts of hover eval state 2025-03-18 16:30:14 -07:00
ed 26c488b93a Merge tag 'v0.9.15-alpha' 2025-03-17 20:06:46 -04:00
Nikita Smith 1dc0192322 fix clang warning and errors 2025-03-17 15:25:49 -07:00
Nikita Smith 344cd8ffbf use djb2 hash for now 2025-03-17 14:20:40 -07:00
Nikita Smith 4298f3d5f6 typo 2025-03-17 13:29:52 -07:00
Nikita Smith 13352751ec moved DWARF parser to use str8_deserial-style API, added to the parser
layer functionality for interpreting different types of attributes,
added support for location lists, and API to enable parsing tags with
abstract origin.
2025-03-17 10:40:59 -07:00
Nikita Smith 57208909f1 updated DWARF expression printer, added ELF preamble,
transitioned debug info and debug line printers to new parser
2025-03-17 10:28:56 -07:00
Ryan Fleury 9c763c4554 fix open-recent-project according to recent_project schema 2025-03-17 07:13:52 -07:00
Ryan Fleury 41a252e563 notes on low-priority odd edge-case behavior 2025-03-15 11:42:20 -07:00
Ryan Fleury a4888055e2 better disabled/conditional rendering of breakpoints 2025-03-14 21:16:19 -07:00
Ryan Fleury cb6a66b98d member filtering, better visualization for selection state in targets/bps/threads/etc. 2025-03-14 13:27:26 -07:00
Ryan Fleury 24ddab0db2 fix slice view rule to apply correctly to pointers/refs->structs too 2025-03-14 12:41:48 -07:00
Ryan Fleury 41aa23b71b work on hover eval visualizers; skip watch window level if all we're doing is spawning a visualizer at the top-level; more convergence / cleanup / fixes 2025-03-14 09:54:48 -07:00
Nikita Smith f1e88b5667 pass over PDB converter
- moved incomplete type resolution from the converter to RDI make helper
  layer so we don't need to duplicate code in DWARF converter
- changed code for building basic types to handle various data models
2025-03-13 23:04:40 -07:00
Ryan Fleury c331133388 adjust hash store - first, don't keep strong refcounts for key history past the 2nd hash - this is prohibitively expensive. but, keep 'downstream' refcounts - this is a mechanism which downstream caches (e.g. text visualization info parsing etc.) can use to ensure a hash stays held in the hash store, given some other data's dependence on it - this stops the storing of unnecessary OutputDebugString log copies 2025-03-13 14:02:06 -07:00
Ryan Fleury d10547d2c0 don't assume offset evaluation mode in array dereferences; could apply to type info too, thus null mode; fix visualizer drag/drop causing close of hover eval, invalidating the dragged view too early; fix close-window not exiting if last window 2025-03-13 08:30:16 -07:00
Nikita Smith 631106b0a8 natvis for RDI Make types 2025-03-12 14:52:09 -07:00
Nikita Smith 3eedcb1912 initialize frame base in interp context 2025-03-12 14:49:14 -07:00
Nikita Smith 44249f35fc pass over the make RDI library
- Handle type layout in the library so converts simply
  define type graph and let the library handle DAG layout.
- Changed location baking. For now the library waits for scope, procs,
  global vars, and thread vars steps to serially finish because
  of common dependency on location sections, we need to parallel for each step.
- Changed encoded offset size for RDI_EvalOp_FrameOff to 8 bytes
  (1 byte is not enough to cover all cases)
- Added frame base location to RDI_Procedure (WASM encodes frame base
  as an index into a global array and so we have to resolve the base
  at runtime).
2025-03-10 16:49:54 -07:00
Nikita Smith 5717d6c54c export restrict modifier 2025-03-04 13:26:24 -08:00
Nikita Smith 4e775d5b6c hash table helper 2025-03-04 11:39:26 -08:00
Nikita Smith dfd6950ff3 deleted obsolete DWARF parser files 2025-03-03 17:20:22 -08:00
Nikita Smith 2ba1a0d502 pass over DWARF header
- added new types
- renamed mode -> format
- fixed section naming
- added helper for picking array lower bound
2025-03-03 17:14:22 -08:00
Nikita Smith ed897979ca added fields for user defined ELF types 2025-03-03 17:11:52 -08:00
Nikita Smith 6c425aa9dc misc NATVIS types 2025-03-03 17:10:44 -08:00
Nikita Smith 35ed8d6a1e bugfixed zero-length block decomp and fixed 64-bit casts 2025-03-03 17:10:06 -08:00
Nikita Smith 8b4f97223e moved async bakers from PDB converter to a stand-alone file to reuse
them in DWARF converter
2025-03-03 17:09:01 -08:00
Nikita Smith 53bff614e6 moved LEB helpers to DWARF layer 2025-03-03 17:06:58 -08:00
Nikita Smith d5811b7748 binary search for U64 and Rng1U64 arrays 2025-03-03 17:04:07 -08:00
Nikita Smith a06f576161 detect and error out on PDB linked with /DEBUG:FASTLINK 2025-02-25 14:42:10 -08:00
Nikita Smith 6c5d2a05cb moved platform depended code from OS layer to linkers IO 2025-02-25 14:41:34 -08:00
Nikita Smith d5ab121183 pre-allocate file size before write 2025-02-25 14:41:34 -08:00
Nikita Smith bbce89eada added /RAD_WRITE_TEMP_FILES
When enabled linker writes image and debug info to temporary files
and renames them after all writes are done.
2025-02-25 14:41:34 -08:00
Nikita Smith 8a8a8bcc8d resource id compar typo 2025-02-25 14:41:34 -08:00
Nikita Smith 1d441bac30 minor fixes and renames in DWARF enums 2025-02-25 14:41:16 -08:00
Nikita Smith 90c05d56b5 added zlib decompressor for DWARF extraction 2025-02-25 14:41:16 -08:00
Nikita Smith b74c304f39 added ELF header and parser 2025-02-25 14:41:15 -08:00
Nikita Smith 87ae363292 print file path in DW_Attrib_DeclFile 2025-02-25 14:41:15 -08:00
Nikita Smith ea6a84ca57 helper for extracting DWARF sections in COFF files 2025-02-25 14:41:15 -08:00
Nikita Smith 8d9f85bfcc move magic check to PE layer 2025-02-25 14:41:15 -08:00
Ryan Fleury 33326a8fa6 fix breakpad converter build 2025-02-23 14:18:12 -08:00
Ryan Fleury 9e6e65d3c6 eliminate cfg testing from this build; fix bad recursion artifacts, causing bad state when types tab visible; put in temporary fix for memory view truncation 2025-02-23 14:06:11 -08:00
Ryan Fleury 225445a204 bump version 2025-02-23 13:21:06 -08:00
Ryan Fleury 74ce085adc start on new 'pull/pop out' button for visualizers 2025-02-21 19:59:26 -08:00
Ryan Fleury f753e9bd18 small fix 2025-02-21 19:20:09 -08:00
Ryan Fleury a3062dfeb1 watch-window-defined/driven query lister completion 2025-02-21 19:15:26 -08:00
Ryan Fleury 8bca57ef7f improved stability w.r.t. cfgs and ctrl entities expansion across changes 2025-02-21 18:14:02 -08:00
Ryan Fleury 1b4a5e529f more convergence / fixes relating to searching/queries/filters 2025-02-21 16:33:57 -08:00
Ryan Fleury 9b636568fd more convergence 2025-02-21 15:29:54 -08:00
Ryan Fleury e76da7892a fix bad debug info scope search usage 2025-02-21 13:57:54 -08:00
Ryan Fleury 3c8f58cb38 add tracking to dbgi scopes 2025-02-21 13:23:12 -08:00
Ryan Fleury 03337a7280 more convergence on lister/queries 2025-02-21 13:01:28 -08:00
Ryan Fleury b0486d942e correctly pipe through exception info, visualize exceptions better 2025-02-21 11:46:28 -08:00
Ryan Fleury 96fbcc848e double clicking cfgs with location info -> snap 2025-02-21 11:30:45 -08:00
Ryan Fleury 4f99a76ace commit window placement/etc. to cfg tree, pass through all monitor/pos/size/fullscreen/maximize info to initialization 2025-02-21 10:57:32 -08:00
Ryan Fleury 9e0fe942e6 allow base/opl style slices in slice view rule 2025-02-21 10:20:11 -08:00
Ryan Fleury 4f1e0dedb2 start plugging tab-opening back in 2025-02-21 09:52:50 -08:00
Ryan Fleury 2f2bb0d797 plug rebindings back in 2025-02-21 09:25:26 -08:00
Ryan Fleury c7da3e8a13 distinguish cfg (breakpoints, watch pins) source-locations from address locations; expand breakpoint addresses to being full expressions, & use this to implement symbol breakpoints (we now support fancier address resolution breakpoints too) 2025-02-21 08:42:33 -08:00
Ryan Fleury f3c6ee6f1f fix statically-disqualifiable breakpoint evaluations from being sent to the control thread as actual control thread conditions 2025-02-20 19:52:17 -08:00
Ryan Fleury 0a588d4058 fix keyboard input delegation between meta-interfaces (query lister line edit) and watch window controls; always accept single-visible-button presses, if multiline logic does not consume an event 2025-02-20 19:46:41 -08:00
Ryan Fleury 04c40e8359 expand eval to collecting irtree/type/lookup-rule, base all value string generation on entire root_eval rather than just root_expr; fixes wrong inheritance of tags in single-line visualization 2025-02-20 19:16:27 -08:00
Ryan Fleury 92df402ad1 member filtering 2025-02-20 18:46:22 -08:00
Ryan Fleury 2373af25ce watch expr drag/drop -> watch pin creation 2025-02-20 18:11:25 -08:00
Ryan Fleury e4de4dd52f hook up project cfg saving 2025-02-20 17:28:56 -08:00
Ryan Fleury cc966deb7c eliminate 'watch' as a view ui rule, move formally into just being a regular view ui build. hook up user file saving. fix metadesk parser - newlines must terminate *all* active implicit set parsing work. 2025-02-20 17:25:38 -08:00
Ryan Fleury 428a3f2536 always prefer explicitly attached tags (view rules); give all tags a chance in sequence; allow 'default' to be explicitly attached, to disable auto-view-rules etc. 2025-02-20 16:38:27 -08:00
Ryan Fleury ec782fa39c correct tag poisoning in lookup-rule tag usage within ir generation, allow lookup-rules to call dependent irgens 2025-02-20 16:26:40 -08:00
Ryan Fleury 13bfa42acf more work on watch-window-driven file lister 2025-02-20 14:49:25 -08:00
Ryan Fleury eae15a3d41 work on command queries, distinguish floating vs. embedded 2025-02-20 13:30:28 -08:00
Ryan Fleury 6653a0e437 auto tabs 2025-02-20 10:04:48 -08:00
Ryan Fleury 1a84f1cedd macroify 'search_path', use in file system queries 2025-02-19 17:22:49 -08:00
Ryan Fleury f61d87e0ce extend command info with query expressions for lister 2025-02-19 17:09:48 -08:00
Ryan Fleury b0cff76501 eliminate old palette system entirely 2025-02-19 12:09:28 -08:00
Ryan Fleury 26514ddc6a dead code elimination 2025-02-19 11:35:30 -08:00
Ryan Fleury a8f72dd5f1 progress on per-view searching operation - will be specialized & used for replacements for finding text, for going to line/address, and filtering in query views 2025-02-19 11:33:16 -08:00
Ryan Fleury f87dd1be82 per-box tags -> per-box tags key; cache (key -> tags_list), and (key * string -> theme_pattern) separately; accelerate all theme lookups 2025-02-19 09:35:45 -08:00
Ryan Fleury 9805f8cd20 begin work on lister-flavored watch windows; begin on using that for the query ui 2025-02-19 08:37:34 -08:00
Ryan Fleury 73351b7550 fix zero-sized content rect busting panel rectangles 2025-02-19 07:21:53 -08:00
Ryan Fleury eb4fe472f9 tweaks 2025-02-18 19:33:47 -08:00
Ryan Fleury 8706e7c56d dead code elimination, eliminating old theme usage 2025-02-18 19:27:27 -08:00
Ryan Fleury 1b8e39c635 work on tag-based styling 2025-02-18 18:08:18 -08:00
Ryan Fleury 6c9f7018f1 sketch out tag-based theme, per-window computation 2025-02-18 15:13:59 -08:00
Ryan Fleury e45bdfd90d linearize theme from srgba on load, use linear colors everywhere; begin simplifying ui colors 2025-02-18 10:39:43 -08:00
Ryan Fleury 42e3c406cd oklab <-> linear, linear <-> srgb 2025-02-17 18:33:56 -08:00
Ryan Fleury 2b54f48aab test with srgba buffer, hack in srgb -> linear conversion in shader for
testing
2025-02-17 18:02:47 -08:00
Ryan Fleury 21a41e9105 sketch out unattached process evaluation 2025-02-17 16:47:44 -08:00
Ryan Fleury 877e0126c9 file path drag/drops; a few fixes with tab drag/drop 2025-02-17 16:24:17 -08:00
Ryan Fleury 36798def1b convergence & cleanup & simplification & fixes of tab drag/drop, panel rearranging 2025-02-17 16:03:05 -08:00
Ryan Fleury 40d762756b more convergence on panel creation/removal paths 2025-02-17 13:25:06 -08:00
Ryan Fleury 72869bc73b simplify name alloctors in rd/ctrl layers; port panel-closure path 2025-02-17 12:05:56 -08:00
Ryan Fleury dc79b82991 watch pin view rules 2025-02-17 10:13:34 -08:00
Ryan Fleury 2636f296cc simplify stylized watch row building rules; allow buttons to be editable, maintain expr key stability even in different watch row styles 2025-02-17 09:48:26 -08:00
Ryan Fleury 5d8e6dac91 begin working on watch window stylization for file system evaluations 2025-02-16 22:16:59 -08:00
Ryan Fleury c77f2de156 more work on file evaluation; move eval_string <-> eval <-> file_path to formal filesystem/file spaces, rather than inferring from the expression tree; imply '.data' when generating file contents visualizer tabs 2025-02-16 18:36:45 -08:00
Ryan Fleury 5e98e40af7 file/folder evaluation work 2025-02-16 17:57:00 -08:00
Ryan Fleury 95493b6c30 do not lex/highlight non-code strings in watch cell 2025-02-16 14:22:01 -08:00
Ryan Fleury 7d84ec79c5 formalize file/folder evaluations; use set-types for files/folders so that we can evaluate both file metadata & contents, rather than just assuming the contents; adjust slice view rule to just expand to the contents, rather than achieving the slice with a changed type 2025-02-16 14:13:48 -08:00
Ryan Fleury c603457460 dead code deletion, begin extending eval/eval-viz to work on expr-chains rather than single expressions; fixes / convergence for watch window 2025-02-15 18:11:22 -08:00
Ryan Fleury 176c2590a0 ghosted 'view rule' hint 2025-02-15 15:10:04 -08:00
Ryan Fleury 5ce74bd66b readjust cfg lookup rule to apply to not just top-level queries but scoped queries too; eliminate old scheduler code 2025-02-15 15:02:58 -08:00
Ryan Fleury b7f6b301ec eliminate unnecessary complication for debugger query evaluations; formalize them in the schemas, use set-hook rule to automatically plug in querying functions for them 2025-02-15 14:52:40 -08:00
Ryan Fleury 404ad620ef more convergence; split scheduler into machines, process, and threads tabs. most people just care about threads, and so that should be the default/common case 2025-02-15 13:32:46 -08:00
Ryan Fleury 81be64dac6 more covergence, freeze controls on applicable ctrl entities when evalled 2025-02-14 13:41:02 -08:00
Ryan Fleury ecb4e0d282 rich hover for thread-hover editors 2025-02-14 09:43:19 -08:00
Ryan Fleury c5de847fa5 ctrl entity rich hovering 2025-02-14 09:19:25 -08:00
Ryan Fleury 35ba41f712 correctly hook up watch window commands to their associated cfg; plug in ctrl entity detection / fancy rows 2025-02-14 09:04:46 -08:00
Ryan Fleury 87ee37d19e if cell activates on single-click, disable double-click path 2025-02-13 21:55:04 -08:00
Ryan Fleury af8f1ff162 frontend cleanups, cmd running from watch 2025-02-13 21:33:40 -08:00
Ryan Fleury f58c13b3a0 plug full data member calculation path & padding member visualization back in 2025-02-13 15:26:21 -08:00
Ryan Fleury 141dd69eba correct rich hovering for rich watch window rows; distinguish between single/double-click watch cells; more convergence 2025-02-13 15:12:34 -08:00
Ryan Fleury c39cc5d642 call stack rows -> module evaluation column 2025-02-13 11:36:57 -08:00
Ryan Fleury 18010db753 per-row command cells in watch windows when evaluating cfgs; table-drive per-collection commands 2025-02-13 11:20:10 -08:00
Ryan Fleury 6498666619 begin moving per-row style info to per-cell style info 2025-02-13 09:26:05 -08:00
Ryan Fleury fba0053e9b preserve ambiguous path rendering 2025-02-13 08:21:48 -08:00
Ryan Fleury 863d98c43e do the same reuse of the computed irtree for array-index expr extensions 2025-02-13 08:13:53 -08:00
Ryan Fleury 50b195deb3 eliminate member-expr-extension irtree/oplist/etc. recomputations; just convert lhs irtree to bytecode and attach that to new expr as a leaf bytecode 2025-02-13 06:51:50 -08:00
Ryan Fleury c31b15524a ensure threads match before visualizing call stack frame selection 2025-02-12 17:53:41 -08:00
Ryan Fleury 4dfa4a120f re-add special-case watch cell style for call stack frame selection 2025-02-12 17:50:18 -08:00
Ryan Fleury 374317abd7 call stack info extraction in watch row building; special style for call stack frames 2025-02-12 17:39:17 -08:00
Ryan Fleury f165eb7b8e recompute row infos on watch column drag 2025-02-12 16:58:24 -08:00
Ryan Fleury 96afe943c2 multi-row-topology watch window column dragging & saving to cfg tree 2025-02-12 16:54:48 -08:00
Ryan Fleury e84f8e66f5 precompute watch row infos before build 2025-02-12 16:05:37 -08:00
Ryan Fleury c8fb9a0ec9 clean up panel drop site jank 2025-02-12 14:27:14 -08:00
Ryan Fleury 204ac60999 extend fancy string lists to include per-node rasterization flags, to correctly mix flags from various fonts; pull command tables into the vocabulary map & accelerate lookups; drive icons/display-strings for commands with vocabulary map; plug in commands/fstrs to command evaluations in watch windows 2025-02-12 14:01:21 -08:00
Ryan Fleury 295cfa8698 fix new window creation 2025-02-11 17:21:24 -08:00
Ryan Fleury c555166af6 visualize *.N ptrs in single-line eval visualization; eliminate old hover eval code 2025-02-11 16:58:17 -08:00
Ryan Fleury 5f88db68ec preserve fancy string list on a per-ui_box basis - do not rely on fancy *run* list for truncated-string-hover, as this will invalidly hold onto stale render handles (fixes crash on font resizes) 2025-02-11 16:48:12 -08:00
Ryan Fleury 6c37db2105 more inline visualization; do not require qualifier if view rule names collide with locals 2025-02-11 16:36:20 -08:00
Ryan Fleury 98ec6ee3bb extend constructed type info with 'pointer depth', to distinguish between inline-depths; use in symbolizing & call stack expression formation 2025-02-11 16:16:44 -08:00
Ryan Fleury 312ddd5899 fix array-index ir tree generation - was incorrectly applying array value rules to address value evaluations; plug in ir-generation hooks for slices, arrays, etc.; eliminate old view rule code 2025-02-11 15:25:42 -08:00
Ryan Fleury 50e4f6a22a move watch window to using exclusively view ui rule input eval, rather than looking at the expression string itself 2025-02-11 14:14:55 -08:00
Ryan Fleury fa7143a3e4 never build hover evals if we cannot evaluate the root expression successfully 2025-02-11 14:07:43 -08:00
Ryan Fleury 82803e710e plug in fancy member names to watch views 2025-02-11 14:03:28 -08:00
Ryan Fleury ee984877b0 work on multi-topology watch tables; fancy evaluation for cfgs, regardless of where they are spawned 2025-02-11 13:30:07 -08:00
Ryan Fleury 1162841b6e begin sketching out watch row button cells, for intermixing fancy buttons for cfgs/entities/etc. with regular watch rows 2025-02-11 11:14:38 -08:00
Ryan Fleury 045aad8578 request reanimation on view loading-persist 2025-02-10 16:54:29 -08:00
Ryan Fleury 2a543ee7d7 fix environment string piping to control thread 2025-02-10 16:36:53 -08:00
Ryan Fleury 80b0138ea3 fix expansion rules being applied to traditionally non-expandable type info; plug memory view back in 2025-02-10 16:32:07 -08:00
Ryan Fleury 29033fe6cc fix incorrect type usage in default lookup-range eval path; fixes broken pointer/reference expansions to structs/unions/classes 2025-02-10 16:14:11 -08:00
Ryan Fleury 052efc7f64 meta command evaluation in frontend eval/eval-viz 2025-02-10 16:11:34 -08:00
Ryan Fleury 428617de91 re-add id stability to top-level-cfg evaluation expansions 2025-02-10 15:51:36 -08:00
Ryan Fleury f3c17a4e2c target environment string editing 2025-02-10 15:32:48 -08:00
Ryan Fleury 300231ad75 require file handle validity for file stream cache submits; simply retry on missing files 2025-02-10 14:22:42 -08:00
Ryan Fleury 3b19334075 tear out old meta evaluation code; robustify filesystem streaming async reads 2025-02-10 14:12:44 -08:00
Ryan Fleury d48cd460d1 begin prepping watch window ui for reintroduction of fancy rows; extend target/thread evaluations with .environment & .call_stack sketch; more convergence progress 2025-02-10 12:15:03 -08:00
Ryan Fleury 2da83dd732 bump to 0.9.15 - hook disasm back up 2025-02-10 09:47:37 -08:00
Ryan Fleury 4b85df0725 fix expr chain parsing; fix panel tree building 2025-02-10 09:44:32 -08:00
Ryan Fleury 3de43b8c74 view params, pulled either from cfg trees or view rule params (tag calls); expr chain parsing; correctly use tags in nested single-line eval visualization 2025-02-07 15:20:19 -08:00
Ryan Fleury 3582ab10e2 eliminate old watch view column state; plug in on-the-fly computed per-row cells; eliminate old table helper usage in watch window; plug in visualizers to watch window 2025-02-07 12:45:30 -08:00
Ryan Fleury 412c55a474 plug in visualizer view ui rules in new eval viz code; cfg-tree/vocab-driven tab titles 2025-02-07 11:40:49 -08:00
Ryan Fleury 31b0772137 eval viz: view rule -> expansion rule; rd: view rule -> view ui rule 2025-02-07 09:21:06 -08:00
Ryan Fleury e88f2e2e82 eliminate old entity tables 2025-02-06 12:51:59 -08:00
Ryan Fleury 712162af4a correctly apply root view rules; apply inherited view rule tags first, since we apply all view rules in order, and we want explicitly-stored tags (nearest to the expression) to be strongest 2025-02-06 12:32:09 -08:00
Ryan Fleury 7bc1dd7362 eliminate old eval vis view rule paths; sketch out view-rule-lookup & expr-tag-equipping, & expr tag (view rule) inheritance 2025-02-06 12:14:12 -08:00
Ryan Fleury d1541d3989 fix handling of root-expr editing in watch views; eliminate dead code 2025-02-06 11:36:56 -08:00
Ryan Fleury eaa65a6b3d raddbg: cast basic type value commits to destination type; ensures numeric things are casted appropriately (fixes f32/f64 value writes) 2025-02-06 11:26:02 -08:00
Ryan Fleury 295778f1ca eval: prohibit identifier overrides in macro maps; raddbg: correctly mark dirty state & recompute given watch window mutations; do not escape unquoted value eval strings 2025-02-06 11:17:42 -08:00
Ryan Fleury 43222e8511 tweak cfg tree mutations a bit to recycle old nodes/identities where possible 2025-02-06 09:35:19 -08:00
Ryan Fleury be039496c7 rd: watch window editability progress, implicit root vis rules; eval: fix call args parser 2025-02-06 09:15:13 -08:00
Ryan Fleury 66ab9c0ba3 rd: watch cell string edit commits 2025-02-05 16:21:51 -08:00
Ryan Fleury f2a958e5b6 rd: progress on reintroducing watch window editability 2025-02-05 16:09:20 -08:00
Ryan Fleury ffe8a01699 uid <-> num mapping for top-level cfg collection expansions; fix incorrect expansion for watches 2025-02-05 14:15:50 -08:00
Ryan Fleury 836b671491 move from ptr*gen handles -> id; eliminate all handle code in frontend and convert to using 64-bit ids 2025-02-05 13:37:58 -08:00
Ryan Fleury edbce2713f eliminate RD_Entity code entirely 2025-02-05 13:11:06 -08:00
Ryan Fleury 92d4f3ebb1 eliminate old config code 2025-02-05 13:02:12 -08:00
Ryan Fleury a80bd6664d collapse all watch-table watch window view rules into specializations of singular watch view path 2025-02-05 12:44:33 -08:00
Ryan Fleury ad4e6cbce5 size hover eval watch window by predicted block tree 2025-02-05 11:38:55 -08:00
Ryan Fleury 8a8f1e4fc2 work on new hover eval ui, built using the new cfg data structure, immediate-mode view states, etc.; all watch window features -> hover eval 2025-02-05 10:34:47 -08:00
Ryan Fleury 50f8732e63 fix num/idx/vidx/vnum coordinates to correctly apply to root row in watch windows 2025-02-04 19:38:57 -08:00
Ryan Fleury a003a11425 progress on mixing control (command, insertion) rows in cfg-list evaluation, for watch windows; e.g. empty row in watch window, add-new buttons in targets/breakpoints/watchpins/etc. 2025-02-04 16:44:04 -08:00
Ryan Fleury de16c9cdef keep active tab view states hot, even if their ui is not built on any given frame (because they are not selected) 2025-02-04 14:13:01 -08:00
Ryan Fleury 90c86dc812 eval/eval-viz: pull out rules for mapping exprs/irtrees -> lookup/expansion rules; use this path in the single-line value string generator; eliminate old non-view-rulified string generation paths 2025-02-04 13:20:25 -08:00
Ryan Fleury afd113adcc rd: derive schema tree parse on startup rather than recomputing every time 2025-02-04 12:16:28 -08:00
Ryan Fleury b9756d222a eval: sketch out parse/ir cache 2025-02-04 10:29:52 -08:00
Ryan Fleury 657b78c4ef eval: separate ir_ctx -> ir_state & ir_ctx; ir_state for implicit thread-local caching mechanisms for eval, ir_ctx for explicitly supplied user info 2025-02-04 09:57:13 -08:00
Ryan Fleury 9a405bee20 eval: lookup info hook -> just pass irtree, do not recompute; cache for type-key -> auto hook tag exprs; use tags/auto-tags in lookup rule for . operator; fix tag poisoning in ir generation pass; cache for type-key -> unpacked type info; replace all unpacked type info paths with cache usage 2025-02-03 13:21:08 -08:00
Ryan Fleury 59fe6c79cb distinguish root block from non-root blocks; in root case, we do not want to do a lookup-range to generate the block's expression (but in all other cases we do) 2025-02-03 10:07:20 -08:00
Ryan Fleury 6f4533d8f5 rd: new ctrl entity meta evaluation path; ctrl entity meta evaluation cache; eval: auto-view-rules (via 'auto hook map'), + support for 'type patterns', e.g. for templates; ir generation / typechecking hook application + source-tag coloring (to avoid infinite recursion of repeatedly-applied auto view rules 2025-02-02 17:08:14 -08:00
Ryan Fleury eab5c7c971 eval_visualization: eliminate expansion-range hook; move expansions & block tree building completely to new eval hooks for lookups 2025-02-02 14:39:43 -08:00
Ryan Fleury 5bbd9f1c7e eliminate expr resolution hook in eval visualization layer; now succeeded by irgen hook 2025-02-02 12:46:59 -08:00
Nikita Smith d9874e8f2f bugfix resource compar 2025-02-02 00:06:07 -08:00
Nikita Smith 76b83794b2 added printer for .res files 2025-02-01 23:50:30 -08:00
Ryan Fleury 07c9268941 eval: specify formal way in which tags (view rules) can fit into expression language, both in parsing & in structure; introduce ir-generation hook step in eval pipeline, transfer most of the default non-vbisualization view rule features to that layer 2025-02-01 20:50:31 -08:00
Ryan Fleury aac93b5952 move over all expansion view rules to new eval-system lookup hooks; eliminate most of old hooks 2025-02-01 17:37:24 -08:00
Ryan Fleury b1829af8c6 eliminate old per-frame cfg group cache 2025-01-30 16:52:15 -08:00
Ryan Fleury 5b82fc2339 eliminate member-filtering hack for cfg views; eliminate deref-space-ptr hack 2025-01-30 15:52:26 -08:00
Ryan Fleury 68966ba55f eval: more progress on 'sets', plug primary watch group into it; rd: more progress on watch ui based on new sets/lookups 2025-01-30 15:43:41 -08:00
Ryan Fleury 12784d9ae9 partial transition to new flexible watch table structure; more work on 'set' types; checkpoint before replacement of old view-rule-hacks with proper-eval-system support for sets/collections/etc. 2025-01-30 14:11:01 -08:00
ed 92df592f82 Merge remote-tracking branch 'EpicGamesExt/dev' 2025-01-30 14:44:58 -05:00
Ryan Fleury 92e68701d0 eval: lookup rule map building; eval: use general 'set' type-kind to specify custom lookup rule; watch: new table <-> stable-point mappings 2025-01-30 10:57:29 -08:00
Ryan Fleury 394d35287a fix default lookup rule 2025-01-29 17:00:50 -08:00
Ryan Fleury baa19f3de4 begin introducing 'lookup' hook path in eval ir-tree generation, to collapse/universalize all 'access' operations, such that ., ->, and [] operations can be overridden via view rules, for cfg evaluations, and so on 2025-01-29 16:41:14 -08:00
Nikita Smith 0a0742aa0e remove unused enum fields 2025-01-29 16:28:02 -08:00
Nikita Smith e114ea7fdb hook RDI printers to the dumper 2025-01-29 16:27:15 -08:00
Nikita Smith 5c1e219901 minor prof fix 2025-01-29 16:26:02 -08:00
Nikita Smith 497f0e45d6 WIP merging RDI dump into RAD Dumper 2025-01-29 10:47:18 -08:00
Ryan Fleury 136a6a6d80 eval visualization: vidx <-> num mappings; helpers to move from logical nums -> rows, feed through windowed row production path 2025-01-29 10:38:04 -08:00
Ryan Fleury 84d55c8939 make some progress on watch window refinement for various row topologies 2025-01-28 18:31:34 -08:00
Nikita Smith bd5d38ef0c handle null write 2025-01-28 16:56:12 -08:00
Nikita Smith 5e3b500119 put ranges on arena 2025-01-28 16:46:50 -08:00
Ryan Fleury 2a1ab9b3be fix incorrect bytecode writing for deref-space-ptr 2025-01-28 10:42:41 -08:00
Ryan Fleury 4cc5f636fe cfg tree collection evaluation 2025-01-27 15:33:35 -08:00
Ryan Fleury b085acbc32 strip out collection type - instead we will implement collections via arrays of exprs which map to meta evals 2025-01-27 11:02:49 -08:00
Ryan Fleury c0f23c3807 further tweaks to support meta cfg eval 2025-01-27 09:22:34 -08:00
Nikita Smith 409905c983 yank out shared mutex impl
Initially shared mutex was needed to lock cores so thread pool
executes one parallel for at a time but on machine with high core count
we cant saturate processor all the time so we switched to shared semaphore
and block thread when all cores are busy.
2025-01-25 11:46:25 -08:00
Ryan Fleury 730e8a4720 commit cfg changes to eval blob cache immediately 2025-01-24 15:55:08 -08:00
Nikita Smith 0ca9d97750 error out on /LIB and /DUMP switches 2025-01-24 14:40:27 -08:00
Ryan Fleury aa03955a45 first pass at meta-cfg-space writes, for cfg editing 2025-01-24 13:22:14 -08:00
Nikita Smith f2f18b9798 replaced /RAD_IDLE_WORKERS with /RAD_SHARED_THREAD_POOL_MAX_WORKERS 2025-01-24 12:49:30 -08:00
Ryan Fleury 04e6eae49d progress on meta-evaluation of cfg trees & plugging into watch/eval system 2025-01-24 12:28:52 -08:00
Nikita Smith 8196ef0a6e tweaks and fixed in thread pool
- created a separate entry point for shared workers
- fixed race condition in tp_run_tasks where worker would read
  modified task count and cause unpredictable behavior
2025-01-24 10:33:42 -08:00
Nikita Smith b18060ef0d on crash CRT randomly wont flush stdout 2025-01-23 20:45:25 -08:00
Nikita Smith b463c8087d copy alternate name strings 2025-01-23 20:44:14 -08:00
Nikita Smith 71b0dfa150 bugfix for uninited memory 2025-01-23 20:39:06 -08:00
Nikita Smith b007e4c0e5 printer for S_LABEL 2025-01-23 20:38:43 -08:00
Ryan Fleury 50000c0d6b adjust metagen to support correctly-escaped multiline string generations; sketch out setting schemas; eliminate old settings hack, move to using cfg tree & settings schema 2025-01-23 11:39:55 -08:00
Ryan Fleury 45f02b7a41 sketch out top-level schema for cfg tree 2025-01-22 15:42:21 -08:00
Ryan Fleury 9a54ae50c1 old config code elimination 2025-01-22 14:23:39 -08:00
Ryan Fleury 443fee10ec more entity code deletion 2025-01-22 09:57:40 -08:00
Ryan Fleury 7443f33069 sketch out schemas for configuration trees 2025-01-22 09:40:57 -08:00
Ryan Fleury 16a717d684 further elimination of entity-based code; more simplification/moving to cfg; begin sketching out expanded eval-viz block tree, such that each block can have its own table topology (will be useful to collapse/simplify/expand the capabilities of watch views) 2025-01-22 09:22:06 -08:00
Ryan Fleury 84fd1e9d3f big batch of work in moving from entity -> cfg; work on new universal lister system for cfg right-click menus, system processes, file system, autocompletion, procedures, etc. 2025-01-21 16:41:59 -08:00
Nikita Smith 53db7ee712 fix symbol table printer for big objs 2025-01-21 11:29:28 -08:00
Nikita Smith aa4ec903a6 update LF_STRUCT2 printer 2025-01-21 11:29:12 -08:00
Nikita Smith c6d28b97b7 more details for LF_STRUCT2 2025-01-21 11:14:12 -08:00
Nikita Smith 61307aefbc reworked thread pool to share workers via semaphore 2025-01-21 01:55:13 -08:00
Nikita Smith 85ea141b83 minor fixes 2025-01-20 21:53:45 -08:00
Nikita Smith d3fbc858b8 impl shared thread pool mode 2025-01-20 21:41:24 -08:00
Nikita Smith e1e7fb745e win32 shared mutex impl and linux stubs 2025-01-20 21:36:43 -08:00
Nikita Smith 153bbc7b1d pass over COFF layer
- updated naming convention on structs, enums, and macros to conform with code base style
- moved related structs closer to each other
- moved parser code to separate file
2025-01-20 19:31:52 -08:00
Nikita Smith 269dc33985 set COMDAT selection on chunks created by import table 2025-01-18 23:21:06 -08:00
Nikita Smith a1d5837ff3 helpers for matching string literals 2025-01-18 17:39:11 -08:00
Nikita Smith 89ff4d0de2 on lambda types we have to replace unique name with hash,
otherwise visual studio wont show local variables in lambdas
2025-01-17 15:31:34 -08:00
Ryan Fleury 5cbef8f10d more entity -> cfg work 2025-01-17 15:16:23 -08:00
Ryan Fleury 4371d727fb line expressions in eval lang; begin getting off of entities for breakpoints/watch-pins/etc., move -> cfg 2025-01-17 13:34:18 -08:00
Ryan Fleury 069084c108 fix view parameter storage hook to not repeatedly duplicate key values 2025-01-17 10:35:04 -08:00
Ryan Fleury e6d0afb026 stateful query lister stack & immediate-mode autocompletion lister, via same codepath; begin hooking up views 2025-01-17 08:11:01 -08:00
Nikita Smith de2ea38f50 build file paths relative to image path 2025-01-16 14:03:14 -08:00
Nikita Smith b405ed4873 factored out logic for splitting function chunks into separate pass
over symbol table; associations are now assigned to sub chunks too;
inherit function chunk align from parent chunk
2025-01-16 13:47:13 -08:00
Nikita Smith c000817b9a pass over COFF symbol parser 2025-01-16 13:43:19 -08:00
Ryan Fleury 4ae032efff begin sketching out stuff for stateful listers being collapsed with immediate-mode autocomplete lister 2025-01-15 17:18:58 -08:00
Ryan Fleury 62894c098a further progress on unified lister interface 2025-01-15 15:25:49 -08:00
Nikita Smith 190eb03ff3 removed default lib directive parser, moved directive code to obj file,
getting ready to deprecate LNK_Directive struct
2025-01-15 14:03:40 -08:00
Nikita Smith 1d6ee73409 handle zero sized array 2025-01-15 10:37:47 -08:00
Nikita Smith 1f8433096a COFF parser fixes 2025-01-15 10:25:16 -08:00
Ryan Fleury 6fe9a14778 eliminate stateful keybindings data structure - move to on-the-fly cfg tree usage 2025-01-14 17:30:07 -08:00
Nikita Smith 25f924b075 generate markers from RDI 2025-01-14 16:49:23 -08:00
Nikita Smith b889765c15 updated PE bin info to handle RDI entry, changed raddump to
convert and load RDI from memory, added helper for parsing debug directory
2025-01-14 16:49:05 -08:00
Ryan Fleury b98ebc8da4 lister applicability work - applies to commands, icons, descriptions, etc. 2025-01-14 15:16:55 -08:00
Ryan Fleury ace7db492b fix nil-cases of cfg insertion; fix incorrect root setting in cfg deep copy 2025-01-14 13:06:26 -08:00
Nikita Smith b1c5b308c0 collect inline site name string 2025-01-14 10:42:22 -08:00
Nikita Smith 24efb574f1 factored out inline site decoder into stand alone helper so it can be
reused in the converter
2025-01-13 18:00:18 -08:00
Nikita Smith 3cec629a8c pipe obj directives through config path 2025-01-13 15:22:37 -08:00
Ryan Fleury 1b52100361 part 5: begin shifting autocompletion lister box to being unified lister/ctx-menu replacement 2025-01-13 14:18:34 -08:00
Ryan Fleury e9a10bbbd2 part 4: fix panel/tab ui key stability for new cfg-based panels/tabs; eliminate query views & begin pluggin in autocompletion lister to query input 2025-01-13 11:12:59 -08:00
Nikita Smith 076aa0a8cb build fixes for parse_inline_sites 2025-01-13 10:12:15 -08:00
Ryan Fleury 8bb3e6c191 rdi_from_pdb: fix line emitting rules in inline site symbol parsing; also fix non-application of code lengths to code offsets in inline lines 2025-01-13 10:07:59 -08:00
Ryan Fleury a1e7ec5a0e rdi_from_pdb: fix line emitting rules in inline site symbol parsing; also fix non-application of code lengths to code offsets in inline lines 2025-01-13 10:06:47 -08:00
ed d42aa42ab1 Merge remote-tracking branch 'EpicGamesExt/master' 2025-01-12 17:29:22 -05:00
Ryan Fleury 6ff2693823 part 3: more progress on entity -> cfg frontend pass 2025-01-10 15:53:40 -08:00
Ryan Fleury d9ca51b36f part 2: furthered progress on cfg switch 2025-01-10 12:56:53 -08:00
Ryan Fleury 6ce8046029 part 1: new cfg data structure & caches to replace rd_entity, rd_window, rd_panel, rd_view, etc. 2025-01-09 17:31:02 -08:00
Ryan Fleury 5b7c366234 cfg data structure first pass, serialization/deserialization, & building, to prep for all rd_entity code deletion 2025-01-08 14:54:11 -08:00
Nikita Smith 30dc0340a4 print sizes in telemetry mark up in GSI build step 2025-01-08 03:26:04 -08:00
Nikita Smith 2b33978037 updated name convention for flag extract macro in CodeView layer 2025-01-08 03:26:04 -08:00
Nikita Smith 42e441541d fixes for LEB decode 2025-01-08 03:26:04 -08:00
Nikita Smith d0d1786cec define enum for image type 2025-01-08 03:26:04 -08:00
Nikita Smith 0d0a6d3980 fixed compile error in Linux entry point 2025-01-08 03:26:04 -08:00
Nikita Smith 98b9427446 dumper for Dwarf 2025-01-08 03:26:04 -08:00
Nikita Smith 543ee72f95 u64 array helper 2025-01-08 03:26:04 -08:00
Nikita Smith a5c9a1c978 u64 array sort 2025-01-08 03:26:04 -08:00
Nikita Smith b27b783e6f Dwarf parser WIP
Copied the parser from internal repo and integrated with the base layer
(not tested)

Parser uses based/range pattern for which we have an alternative in
string layer (str8_deserial_*)
2025-01-08 03:26:04 -08:00
Nikita Smith 76b742ceb8 coffdump -> raddump 2025-01-08 03:26:04 -08:00
Nikita Smith b6b64be867 moved enum handling code to separate files 2025-01-08 03:24:35 -08:00
Nikita Smith 3961f93d1a moved CodeView parser code into separate file 2025-01-08 03:24:35 -08:00
Nikita Smith be81533f63 removed coff guid and added missing defrange symbol 2025-01-08 03:24:35 -08:00
Ryan Fleury 41d4bcfe11 notes 2025-01-07 16:10:28 -08:00
Ryan Fleury 1bf66afef9 more entity code deletion 2025-01-07 15:53:22 -08:00
Ryan Fleury ee181c685b more old entity code deletion 2025-01-07 14:05:58 -08:00
Ryan Fleury 7fea55348f fix hack to stop busted animation when minimized - just bounds check the content rectangle 2025-01-07 13:30:53 -08:00
Ryan Fleury 6682613a1a entity, d -> rd convergence 2025-01-07 13:21:23 -08:00
Ryan Fleury ee9961cce4 rd: eliminate old entity code pertaining to mirroring ctrl entities - we just use ctrl entities directly now, and rd entities are just used for frontend debugger state 2025-01-07 11:49:13 -08:00
Ryan Fleury 64aa06895e eliminate code view dependence on txt/hs 2025-01-07 11:42:18 -08:00
Ryan Fleury e82041e5df 'ghost exceptions' fix - spoof hit detection needs to occur based on the demon event's reported exception address, rather than wherever the instruction pointer happens to be at the time of the exception 2025-01-07 11:04:34 -08:00
Ryan Fleury c1a2023b15 move remaining parts of frontend to xxhash, eliminate blake2; sketch out test program for debug string performance testing 2025-01-07 10:40:55 -08:00
ed 4cdff84bb0 scripts 2025-01-06 11:59:08 -05:00
Ryan Fleury 812cea7e73 actually, bad idea - turn that off for now... 2025-01-05 22:47:06 -08:00
Ryan Fleury fb1fb6b014 fix incorrect restriction of value committing in watch views; only commit value if initial value of edited text was unchanged 2025-01-05 22:46:08 -08:00
Ryan Fleury bc44f58a80 fix off-by-one size restriction in string chunk allocation; apply same fixes to ctrl entity string allocator 2025-01-05 22:39:10 -08:00
Ryan Fleury d70ce6465a fix incorrect initialization of catchall chunks in name allocator free list 2025-01-05 22:39:10 -08:00
Ryan Fleury fbc1f871cf add comment about previously introduced path heuristic - will need to be careful on linux 2025-01-04 17:07:34 -08:00
Ryan Fleury 47373fbb58 prioritize exe-relative debug paths - treat embedded pdb/rdi paths as relative to the exe first - if they are relative, then relative to the exe is the correct choice, but if they are absolute, then it will simply be an invalid path, and so it will just pick up the full absolute embedded pdb path on the next candidate. 2025-01-04 17:02:46 -08:00
Ryan Fleury 4cb6e889ef hack to avoid minimization causing bad panel animation state - will investigate this more fully later... 2024-12-30 10:09:29 -08:00
Ryan Fleury 94f0ae660f fix bytecode size calculation bug 2024-12-29 16:02:54 -08:00
Ryan Fleury be45100964 if regrel32 is marked as being outside the procedure frame, and if it has no type info, it seems that compilers generate that case to encode return variables which exist outside a procedure's frame, in which case we can make up the difference by grabbing the return type from the containing procedure type. this does not break existing valid cases, but may not be the fully correct rule. 2024-12-29 13:46:44 -08:00
Ryan Fleury aa42d12d0f zerofiy range dim, if max > min; fixes incorrect range intersection & read, in eval path 2024-12-20 09:00:17 -08:00
Ryan Fleury 49d11ea35b plug min-digits view rule into f32/f64 value string visualization path; also expand default precision of f32/f64 string visualization, but truncate redundant zeroes 2024-12-17 16:04:09 -08:00
Ryan Fleury e9ac6ccf7e remove heuristic of array view rule implicitly disabling string visualization; prefer explicit no_string view rule 2024-12-17 09:45:54 -08:00
Ryan Fleury 3023269a9c correctly use array sizes in value string string literal visualization; slices / array lengths now correctly apply to string visualization 2024-12-17 09:39:57 -08:00
Ryan Fleury 78309209ae clear completed task log 2024-12-16 13:02:37 -08:00
Ryan Fleury 5f1d0b4d1c adjust compact vs. default panel layout pick heuristic 2024-12-16 12:52:46 -08:00
Ryan Fleury 090c555d68 fix default space assumption in full eval path, if not inferred from the expression itself 2024-12-16 12:09:50 -08:00
Ryan Fleury 8f91ec4f88 fix __va_args__ nonsense in rdi_from_dwarf; fix incorrect mask check in linux os_file_open 2024-12-16 11:41:23 -08:00
Ryan Fleury c66d705791 toggle-press for theme colors in settings view, not click-to-open 2024-12-16 11:33:26 -08:00
Ryan Fleury 97241e73f9 more aggressively commit changes to meta-entity edits in watch windows; undo if cancelling 2024-12-16 11:26:08 -08:00
Ryan Fleury ac54281062 fix nccalcsize in fullscreen mode 2024-12-16 10:59:35 -08:00
Nikita Smith 2a72f525fb added support for dumping disassembly and raw data out of sections 2024-12-11 12:07:42 -08:00
Nikita Smith c91253a19e move feature flags to appropriate layer 2024-12-10 14:07:51 -08:00
Nikita Smith 48cb999c3d format VC Features and COFF Group in debug directory 2024-12-10 13:47:47 -08:00
Nikita Smith 9ff49c33cc validate export table fields 2024-12-10 13:44:09 -08:00
Nikita Smith cd3fd4df16 format file preamble and warn about unknown argument 2024-12-09 17:16:44 -08:00
Nikita Smith dd3b4a025d advance offset 2024-12-09 15:49:34 -08:00
Nikita Smith aaa82af9b3 format base relocations 2024-12-09 15:25:12 -08:00
Nikita Smith db82b2ea63 remove dependency on bin info from base reloc parser 2024-12-09 15:24:18 -08:00
Nikita Smith 723c950c01 add default params for /FUNCTIONPADMIN 2024-12-09 14:27:03 -08:00
Ryan Fleury 274b710329 notes 2024-12-09 08:35:01 -08:00
Ryan Fleury edfbcb9c85 fix incorrect line textual coordinates when triple-dragging code slices 2024-12-06 16:32:43 -08:00
Nikita Smith 08a368dd66 handle ADDR32 base relocation 2024-12-06 15:35:33 -08:00
Nikita Smith f56bc209e0 minor fix 2024-12-06 14:39:00 -08:00
Nikita Smith b5273d6a00 keep parsing on encountering epilog opcode 2024-12-06 14:00:12 -08:00
Ryan Fleury bca1325d9a eliminate machine/file entities in frontend layer 2024-12-06 13:53:25 -08:00
Ryan Fleury 87a1dd84ec delete raddbg layer duplicative ctrl entity kinds / related code; we are now fully moved onto the ctrl system for ctrl entities 2024-12-06 12:31:37 -08:00
Ryan Fleury 751626446a pending thread names in ctrl entity system, for cases where a thread name is established before the thread is reported as being created, and the id is used to correllate 2024-12-06 12:31:37 -08:00
Ryan Fleury 59e2d7de61 eliminate old universal entity ui; eliminate old stop explanation string generation path 2024-12-06 12:31:37 -08:00
Nikita Smith 6cf42338ba clang build fixes 2024-12-06 12:05:44 -08:00
Nikita Smith e73ce59945 WIP coffdump 2024-12-06 11:53:16 -08:00
Nikita Smith c3831e4350 WIP parser for MSVC C++ exceptions unwind info 2024-12-06 11:53:16 -08:00
Nikita Smith 0ea0820d19 minor fixes and cleanups 2024-12-06 11:53:16 -08:00
Nikita Smith 86db833a83 pass over PE
* upgraded PE with parsers for imports, exports, and tls
* added struct definitions for image load config and debug dir structs
2024-12-06 11:53:16 -08:00
Nikita Smith 80fa226432 pass over COFF archive parser 2024-12-06 11:53:16 -08:00
Nikita Smith 29de0c5a9e moved unsigned range list to base math 2024-12-06 11:53:16 -08:00
Nikita Smith d73e53a5b5 integer array structs 2024-12-06 11:53:16 -08:00
Nikita Smith 3851604705 32bit integer from ascii helpers 2024-12-06 11:53:16 -08:00
Nikita Smith 2bf3194cff disable .exp for radlink 2024-12-06 11:53:16 -08:00
Nikita Smith 669c03cff1 rename time -> time_stamp 2024-12-06 11:53:16 -08:00
Nikita Smith e22bd33275 pass over COFF, added symbol for function definitions, updated names
and types in structs, added enum to and from string helpers
2024-12-06 11:53:16 -08:00
Nikita Smith 53a5f6ab06 big-endian conversion helpers 2024-12-06 11:53:16 -08:00
Nikita Smith 746a2728b3 date time from unix time stamp 2024-12-06 11:53:16 -08:00
Nikita Smith 9ad63e45e6 u32 from string version 2024-12-06 11:53:16 -08:00
Nikita Smith 47ac1796a9 use build string literal from base context 2024-12-06 11:53:16 -08:00
Nikita Smith fc429449cf fix out of bounds check 2024-12-06 11:53:16 -08:00
Ryan Fleury cd64657746 adjust disasm snapping rules, to not open disasm in cases where we can infer user doesn't have/want it open, and also to snap correctly if we can infer that the user is actively viewing/using disasm 2024-12-06 10:27:37 -08:00
Ryan Fleury 347ce2281d clear breakpoint hit counts on restart command 2024-12-04 13:40:20 -08:00
Ryan Fleury 09cf0fb348 introduce manual clearing path in font cache layer; use to prevent permanent accumulation of font glyphs even after font resizes etc. 2024-12-04 13:34:00 -08:00
Ryan Fleury 94c4000603 adjust failure cases in conversion; adjust waiting time period in pre-emptive heuristic conversion rule; avoid bp resolution path & waiting on debug info when unnecessary 2024-12-03 11:32:57 -08:00
Ryan Fleury aee2d510d4 fix blur 2024-12-02 15:19:29 -08:00
Ryan Fleury 74004321aa adjust auto-focus-on-stop rules; only do it given stops caused by threads 2024-12-02 10:01:58 -08:00
Ryan Fleury a827c74501 adjust thread-selection-on-stop & thread-snapping rules, to prevent useless disasm snaps & incorrect thread selections in some edge cases 2024-12-02 09:44:50 -08:00
alektron 0c86580e1e Further simplify WM_NCCALCSIZE handling; 2024-12-01 08:21:58 -08:00
alektron b4cbaa0171 Simplify borderless window code and improve resizing behavior and style (e.g. dropshadow); 2024-12-01 08:21:58 -08:00
Nikita Smith 19fac9b1aa changed symbol table parser to convert symbols as they are being read 2024-11-21 19:42:39 -08:00
Nikita Smith a0dbe72820 moved common codeview code to the main layer 2024-11-21 15:58:32 -08:00
Nikita Smith 7ac7bea420 minor fixes 2024-11-21 15:58:32 -08:00
Nikita Smith fbf180df2f assert when merging associative chunks 2024-11-21 13:30:13 -08:00
Nikita Smith 8e8924fcc6 minor fixes 2024-11-21 13:29:23 -08:00
Nikita Smith d9d0618e97 helpers for quickly checking presence of symbols and file paths in PDB 2024-11-21 01:05:33 -08:00
Nikita Smith a87e2745a4 GSI and String Table helpers 2024-11-21 01:05:33 -08:00
Nikita Smith bdb41aa040 fix off by one in GSI parser 2024-11-21 01:05:33 -08:00
Nikita Smith 714316aebf factor out stream table out of MSF parser 2024-11-21 01:05:33 -08:00
Nikita Smith c037d6ad75 WIP function padding 2024-11-21 01:05:33 -08:00
Ryan Fleury d8279c1ff3 clean up per-build natvis integration into build.bat 2024-11-20 19:41:27 -08:00
Ryan Fleury f15a4f17d1 worker thread parameterization; sketch out wide-conversion scratch program; fix one common crash case in some pdb conversions 2024-11-20 15:36:13 -08:00
Ryan Fleury adbd7fbc97 fix is-zoomed behavior in nccalcsize 2024-11-20 10:44:54 -08:00
Ryan Fleury cb4232469e adjust nccalcsize window message; we just need to coax windows into doing the copy in order to avoid resize artifacts. still not perfect, can get into a weird state, and we may need to do more full size calculation in some cases 2024-11-19 16:59:20 -08:00
Ryan Fleury a40c26a0eb fix incorrect singly-linked-list/doubly-linked-list mismatch in dbgi search cache 2024-11-19 10:41:22 -08:00
Nikita Smith 816d8e88bf remove warning pragma around radsort 2024-11-18 16:26:42 -08:00
Ryan Fleury 9eb482b17b fix old include sites of xxhash 2024-11-18 16:19:04 -08:00
Nikita Smith 31f536334e third party include fixups 2024-11-18 16:17:26 -08:00
Nikita Smith f0a1deec62 merge third party folders 2024-11-18 16:16:15 -08:00
Nikita Smith af57e321de show full lib path for better debuggability 2024-11-18 15:38:00 -08:00
Nikita Smith e44dd3aa07 instead of searching for manifest tool manually punt the job to CreateProcess 2024-11-18 15:38:00 -08:00
Nikita Smith 938be0aa84 changed string conversion routines to return null on null input
In os_process_launch on windows, linker relies on directory string conversion
to return null so CreateProcessW can set work directory itself.
2024-11-18 15:38:00 -08:00
Ryan Fleury 33c4c7c883 fix false positive file ood rule 2024-11-18 13:54:57 -08:00
Ryan Fleury cb5f9a2e06 robustify search item usage code to changed sets of dbgis 2024-11-18 11:42:43 -08:00
Ryan Fleury 846cfd259c fix incorrect search joining logic, in cases where a key has been evicted 2024-11-18 10:24:02 -08:00
Ryan Fleury 32cfe28094 exclusively lock search stripe when taking task & bumping work refcount 2024-11-18 09:58:34 -08:00
Nikita Smith b99e10224f simplified chunk size tracking 2024-11-15 16:14:00 -08:00
Nikita Smith 435f6c4ef6 append .lib to defaultlibs 2024-11-15 16:14:00 -08:00
Nikita Smith b631d431fa create section layout without copying chunk data and perform chunk data
copy in parallel given layout
2024-11-15 16:14:00 -08:00
Nikita Smith 2562d04fbf changed build.bat to handle extra natvis for radlink and removed
'Unset' part since we use setlocal that prevents local variable
from leaking to the environment.
2024-11-15 16:14:00 -08:00
Nikita Smith b52a008748 remove debug trap 2024-11-15 16:14:00 -08:00
Nikita Smith b16d930d13 natvis for linker types 2024-11-15 16:14:00 -08:00
Ryan Fleury 26be351354 eliminate per-build version numbers, just use base layer to define defaults; bump to 14 2024-11-15 15:36:12 -08:00
Ryan Fleury 77b2172a85 restrict cursor line info committing by selected module 2024-11-15 15:00:15 -08:00
Ryan Fleury f1c5c97a1b fix stale detection in background fuzzy search results 2024-11-15 14:53:03 -08:00
Ryan Fleury 6be2792659 search cache eviction 2024-11-15 14:40:05 -08:00
Ryan Fleury c42e7837ac fix 64-bit bitfield type value evaluation mask/shift 2024-11-15 11:44:51 -08:00
Ryan Fleury fe657987d6 restrict module for line info visualization; it is not generally useful to do all modules, and in large projects it is too slow to do serially: 2024-11-15 11:19:46 -08:00
Ryan Fleury 48c7bb788e fix incorrect completion parameters hash storage in dbgi matching work, pt. 2 2024-11-15 11:15:25 -08:00
Ryan Fleury 080a001183 fix incorrect completion parameters hash storage in dbgi matching work 2024-11-15 11:12:58 -08:00
Ryan Fleury 81c7c7a7c4 per-target option of automatically debugging subprocesses, or not 2024-11-14 14:18:35 -08:00
Ryan Fleury 95fe497056 fix incorrect advance logic on invalid page reads in cached process memory reading path 2024-11-14 13:08:17 -08:00
Ryan Fleury 8994cb04bc adjust default font size settings by dpi relative to standard 2024-11-14 12:07:19 -08:00
Ryan Fleury ce90b63079 oops........ 2024-11-14 10:58:52 -08:00
Ryan Fleury 6cf9b82857 strip out completion counter from dbgi parsing layer 2024-11-14 10:47:45 -08:00
Ryan Fleury cefbd40e2c fix rw lock r/w mismatch 2024-11-14 10:26:51 -08:00
Ryan Fleury 420f089fda eliminate incorrect cases of async_push_work, where pushes which could occur on worker threads may try to write to a cache that is currently being held, when the push occurs (when all threads are saturated) - async_push_work must never be called from within a cache locking mechanism 2024-11-14 09:55:03 -08:00
Ryan Fleury ff45952f07 re-introduce timeout-based re-requests for dbgi & fs layers; further adjust pre-emptive conversion heuristic 2024-11-14 09:29:01 -08:00
Ryan Fleury fa4f9621b0 adjust pre-emptive conversion heuristics; fix deadlock scenario in match work 2024-11-14 09:10:07 -08:00
Ryan Fleury 4c0ebc851c async priorities, strip out incorrect ring position calculations 2024-11-13 18:23:18 -08:00
Ryan Fleury 5a79518dcb fix debug directory tree cache clearing rule 2024-11-13 16:05:22 -08:00
Ryan Fleury 713cc2c693 entering the 7th circle of DLL hell 2024-11-13 15:48:38 -08:00
Ryan Fleury dcec3c07d9 pass over pre-emptive debug info conversion heuristic, to be friendlier to ue-style root project directories, with what feels like 1000s and 1000s of sub-directories with DLLs hidden in various folders 2024-11-13 14:40:08 -08:00
Ryan Fleury b03c1766c6 just make commit granularity 64 bit; it matches the expected usage pattern in a few spots 2024-11-13 12:18:48 -08:00
Ryan Fleury 4278f7db1e extend pre-emptive conversion rule to do limited children directory checking as well 2024-11-13 11:47:17 -08:00
Ryan Fleury ff90a90744 fix lru eviction in async name match store 2024-11-12 14:36:40 -08:00
Ryan Fleury 626665911d fix incorrect order of work queueing in file stream task kickoff 2024-11-12 14:15:28 -08:00
Ryan Fleury f09f059af2 eliminate thread expression strings in scheduler process expansion 2024-11-12 13:47:04 -08:00
Ryan Fleury e95afcd5aa fix ring buffer stomping in async match 2024-11-12 13:20:42 -08:00
Nikita Smith a8b1805749 updated prof markup usage sites 2024-11-12 13:18:17 -08:00
Nikita Smith a8b2266fc0 added macro for sending notes to telemetry 2024-11-12 13:18:17 -08:00
Nikita Smith bc446d8520 dynamic profile zone with raddbg sprintf 2024-11-12 13:18:17 -08:00
Ryan Fleury 9808157f45 switch match tasks to atomically update match nodes, rather than push results into a queue 2024-11-12 13:00:23 -08:00
Ryan Fleury 0ec6b8e8a8 more work on match store experiment; consume ring buffer results on begin - this experiment is not exactly the right approach, though. because the ui thread definitionally learns about these identifiers faster than the matches can (always) be completed, there is a permanent writer-going-faster-than-reader problem. the correct approach will need to account for this. 2024-11-12 13:00:23 -08:00
Ryan Fleury 3e0c150ccb more work on background name matching & plugging it into syntax highlighting path 2024-11-12 13:00:23 -08:00
Nikita Smith fd1906b034 safe cast commit size 2024-11-12 10:36:45 -08:00
Nikita Smith 2bbf3ff987 switch to data size formatter 2024-11-12 10:36:45 -08:00
Nikita Smith 880d7a4139 data size formatter for stb_sprintf 2024-11-12 10:36:45 -08:00
Nikita Smith c6caec657d moved cstring and find needle string ops to the main layer 2024-11-12 10:36:45 -08:00
Nikita Smith 3d7fc6fce5 moved memory and count string formatters to the main layer and
replaced str8_from_memory_size with more accurate data size units
2024-11-12 10:36:44 -08:00
Nikita Smith 0d0951bf08 squash some image-related steps into finalize image 2024-11-12 10:36:44 -08:00
Nikita Smith 3a190ae2c3 show an early warning for /DEBUG:FASTLINK 2024-11-12 10:36:44 -08:00
Ryan Fleury 420c2ec208 fix dbgi key array copy 2024-11-11 16:15:15 -08:00
Ryan Fleury f9abd3efb9 first half of first pass at asynchronous name matching; simplify current name matching path used in syntax highlighting & deduplicate between code slice & code labels 2024-11-11 16:06:01 -08:00
Ryan Fleury 5893ab94cb cancellation mechanism for debug info fuzzy searching 2024-11-11 10:38:52 -08:00
Ryan Fleury ff2e9df705 fix incorrect match range list copying in new searcher threads 2024-11-11 10:02:06 -08:00
Ryan Fleury 5aeee47f98 oops - fix busted render handle compare 2024-11-11 09:48:11 -08:00
Ryan Fleury 31f25d0fe7 eliminate attempts at clever read-only synchronization in file stream & ctrl layer, just fall back to simple locking mechanism 2024-11-10 11:25:55 -08:00
Nikita Smith bd4f82c8e8 cursed early return 2024-11-08 16:46:11 -08:00
Nikita Smith 680ea2ffdc added /RAD_IDLE_WORKERS 2024-11-08 16:09:56 -08:00
Nikita Smith f7d7f6633f expose file API to enable IO detouring 2024-11-08 16:09:56 -08:00
Ryan Fleury 04c1488cd4 xxhash for ev & ui hashes 2024-11-08 15:02:52 -08:00
Ryan Fleury 5232ba298d cache cons type byte size, and more generally, do not require full type calculation in order to calculate byte sizes 2024-11-08 15:02:52 -08:00
Ryan Fleury 65ada18d1d fix render layer guid linking w/out font provider layer; eliminate generation number on render handles; sketch out tester scratch program for text drawing performance 2024-11-08 15:02:52 -08:00
Nikita Smith 8e6a0ae4db errors and warnings fixes 2024-11-08 11:43:05 -08:00
Nikita Smith e297460697 add necessary Linux impls for linker
NOTE: Current OS API for semaphores doesn't work well with Linux/pthreads
way, for example, on Linux it's up to user program to allocate shared memory
and store there sem_t and detect when to release it. (Windows does this under
the hood when process that created shared semaphore exits)
2024-11-08 11:43:05 -08:00
Nikita Smith cf8c0e7442 clang and gcc bit ops 2024-11-08 11:43:05 -08:00
Nikita Smith 776c8daa27 updated build.sh to define git hash 2024-11-08 11:43:05 -08:00
Nikita Smith 69b43c76d4 default to llvm-mt on non-windows platforms 2024-11-08 11:43:05 -08:00
Nikita Smith d114a0e961 tidy up guid on linux 2024-11-08 11:43:05 -08:00
Nikita Smith d177e39a54 build.sh add radlink target 2024-11-08 11:43:05 -08:00
Ryan Fleury 158dd742ad eliminate entry point 'mode'/type; just gather argc/argv as part of command line parse 2024-11-08 10:33:28 -08:00
Ryan Fleury 0773b6d282 switch to xxhash for font cache hashes 2024-11-08 09:04:16 -08:00
Nikita Smith 15d43d7c99 removed dependency on os_ext 2024-11-07 14:12:41 -08:00
Nikita Smith 7650a83d1e further simplify linker/os_ext/os_core.c 2024-11-07 14:08:21 -08:00
Nikita Smith daeb08e79f moved os_folder_exists to the main layer and deleted win32 layer from linker folder 2024-11-07 13:55:15 -08:00
Nikita Smith ef5287d2a9 switch to os_full_path_from_path 2024-11-07 13:41:47 -08:00
Nikita Smith db04792073 moved getter for process start time w32 2024-11-07 13:33:37 -08:00
Nikita Smith 4091373517 moved operating system -> string to base 2024-11-07 11:54:25 -08:00
Nikita Smith 214be8c433 moved Guid struct and related helpers to base 2024-11-07 11:54:25 -08:00
Nikita Smith f807dc4785 override entry point 2024-11-07 11:54:25 -08:00
Nikita Smith 0dd05169ee add ability to override entry point type 2024-11-07 11:54:25 -08:00
Nikita Smith ce9d43a92e pass over coff header 2024-11-07 11:54:25 -08:00
Nikita Smith 0886963d93 promote section definition number to 32-bit when linking big obj 2024-11-07 11:54:25 -08:00
Nikita Smith 27cd7a21a3 coff section definition for big obj 2024-11-07 11:54:24 -08:00
Nikita Smith 7bb88f480e mask compute typo 2024-11-07 11:54:24 -08:00
Nikita Smith fad817fb9e apply communal variable rule for largest comdat only 2024-11-07 11:54:24 -08:00
Nikita Smith 1d42f1bd66 speed up export table build with hash table 2024-11-07 11:54:24 -08:00
Ryan Fleury a5dd35b874 eliminate dbgi search layer usage 2024-11-07 10:14:17 -08:00
Ryan Fleury a89af7f6fd scratch that - *now* fix the arrayification 2024-11-07 10:07:36 -08:00
Ryan Fleury 5a19ab9c31 fix new search path arrayification 2024-11-07 10:06:49 -08:00
Ryan Fleury e204fe28c1 eliminate deadlocking mechanism in dbgi search cache lookup/mutation; replace with simpler but possibly worse mechanism for now 2024-11-07 09:57:25 -08:00
Ryan Fleury d036eb9fc5 eliminate old dbgi_search layer 2024-11-05 15:08:58 -08:00
Ryan Fleury 1621e504ce first half pass at new dbgi fuzzy searching functionality; distributes search amongst sub-tasks 2024-11-05 15:07:06 -08:00
Ryan Fleury 44b8c9e87c eliminate r/w lock promotion concept 2024-11-04 13:30:10 -08:00
Ryan Fleury 4a0e21d447 collapse user clock indices into base-layer-provided clock counter; fuzzy_search -> dbgi_search 2024-11-04 13:12:52 -08:00
Ryan Fleury 3cd32fa235 correctly prepare paths for windows launches in demon 2024-11-03 14:45:21 -08:00
Ryan Fleury c3a672cd02 fix incorrect async work ordering in dbgi layer 2024-11-03 12:48:34 -08:00
Ryan Fleury 9ce0bc5dbf [geo] move to async layer 2024-11-03 12:17:18 -08:00
Ryan Fleury ffb21277e9 [tex] move to async layer 2024-11-03 12:13:20 -08:00
Ryan Fleury a40edbba51 dasm, ctrl memstream, & more moving to async layer, rather than per-layer thread pools 2024-11-03 12:11:24 -08:00
Ryan Fleury c2855a9a46 eliminate txt layer parsing threads; use async layer 2024-11-03 11:12:24 -08:00
Ryan Fleury 61e7aaadeb implement 'work stealing' mechanism for falling back to synchronous task execution, if all work threads are taken 2024-11-01 16:41:43 -07:00
Ryan Fleury 5a0efe1261 move dbgi layer to async task layer 2024-11-01 15:30:17 -07:00
Ryan Fleury 6d55d21643 fix clang builds 2024-11-01 15:22:26 -07:00
Ryan Fleury 4164b30aac move breakpad converter to async layer; eliminate task system 2024-11-01 15:18:40 -07:00
Ryan Fleury aded54c97f fix pointer stability of async task output slot; finish moving converter to async system 2024-11-01 15:02:45 -07:00
Ryan Fleury 79bcbe4b39 switch rdi_from_pdb to new async layer, off of old task system 2024-11-01 14:44:56 -07:00
Ryan Fleury 86d9b792d8 shift file streaming layer to using async layer for background work, remove file stream layer thread pool 2024-10-31 11:44:54 -07:00
Nikita Smith f3a36ece13 rebase fixes 2024-10-30 15:56:55 -07:00
Nikita Smith c5d198e3e9 build linker with branch name and full commit hash 2024-10-30 15:56:10 -07:00
Nikita Smith eba7500f73 /rad_pdb_hash_type_names:lenient
Less aggressive optimization for type names. When lenient enabled, linker
replaces only mangled names and compiler generated lambda types.
2024-10-30 15:56:10 -07:00
Nikita Smith 339f43919c remove bogus leaf align 2024-10-30 15:56:09 -07:00
Nikita Smith f3fbf10754 replace type names with hashes 2024-10-30 15:56:09 -07:00
Nikita Smith 4a2e1dd8d0 switch to thread safe hash trie map
Initial implementation of the symbol table allowed us to push symbols
from one thread at a time and required a wonky lock-step and spread out
logic for replacing symbols. And because it was a externally chained
hash table we had to guesstimate optimal capacity for small and big targets.
We erred on the side of larger capacity to prevent degradation and
rehashing, however this meant small targets had to spent unreasonable
amount of time memory allocing slots. With hash trie we can dynamically
scale up to 4 ^ 32 items and atomically replace symbols when needed. Neat!
2024-10-30 15:43:53 -07:00
Nikita Smith ee65ea3692 fast-path for string matching 2024-10-30 15:42:39 -07:00
Nikita Smith baead67a99 minor fixes 2024-10-30 15:42:39 -07:00
Nikita Smith e085dae636 pass over atomic operations
- use cast to volatile trick for atomic loads on x64 windows
- removed unnecessary includes on windows
- upgraded clang and gcc code paths to use modern atomics

Removed WIN32_LEAN_AND_MEAN because we were already compiling without it
and there is code path in os_gfx_win32.c that relies on including full
windows.h
2024-10-30 15:42:39 -07:00
Nikita Smith eba6765541 set LF endings for shell scripts so they are executable after checkout 2024-10-30 15:42:39 -07:00
Nikita Smith 002e479a2d index on dev: 62880e6 set explicitly heap and stack reserve and size 2024-10-30 15:42:39 -07:00
Nikita Smith 8848080729 set explicitly heap and stack reserve and size 2024-10-30 15:42:39 -07:00
Nikita Smith e1166abc63 typo in str8 compar name 2024-10-30 15:42:39 -07:00
Nikita Smith 6ffc065712 set dynamic base on /fixed:no 2024-10-30 15:42:39 -07:00
Nikita Smith 15b1ebcd21 coff section align from byte size helper 2024-10-30 15:42:39 -07:00
Ryan Fleury 37b27a9cff correctly bounds-check cursor before doing snapping operations 2024-10-30 06:20:11 -07:00
Ryan Fleury 327fec3155 fix rdi_from_pdb build 2024-10-29 16:50:37 -07:00
Ryan Fleury d0b97a3010 first pass at more comprehensive async layer, for replacing task system & providing single mechanism for async work, which is currently done ad-hoc in various layers 2024-10-29 16:27:21 -07:00
Ryan Fleury 1b5321ad8e fix incorrect tooltip 2024-10-28 21:38:09 -07:00
Ryan Fleury 4769d0a8d4 narrow scope of name resolution for debugger collections; default launching to not attach to child processes, set up msgs to parameterize this 2024-10-28 15:37:28 -07:00
Ryan Fleury 41cddf96b8 preemptive adjacent pdb conversion on initial module load; tighten up c/c++ lexer for smaller string lexes 2024-10-28 13:52:36 -07:00
Ryan Fleury 100d3523d3 clamp floating root positions by window lower bound as well 2024-10-24 11:48:45 -07:00
Ryan Fleury f0b1b46840 clamp thread tooltip callstack symbol names 2024-10-24 11:45:45 -07:00
Ryan Fleury e9666e2edd adjust disasm lexer to account for compiler-autogenerated symbol names 2024-10-24 11:41:59 -07:00
Ryan Fleury 8f932bdbf7 oops 2024-10-24 11:29:13 -07:00
Ryan Fleury c3c9539f9b prioritize string/symbol content in single-line pointer visualization; only use address-first when descending. also fix signed/unsigned visualization of character numeric values 2024-10-24 11:25:27 -07:00
Ryan Fleury 13341a458a fix incorrect kill-single-process ui path 2024-10-23 13:23:22 -07:00
Ryan Fleury 62659c5161 introduce dedicated kill-all path; fix exit conditions for single-stepping stuck threads to be robust toward unexpected kills; fix exit conditions for kill-single-process path, to be more robust to halts; correctly report stop cause 2024-10-23 13:19:37 -07:00
Ryan Fleury 1ecabff7b6 prefer usage of pdbs in dbgi layer, if rdi path is not baked in, but pdb path *is* - otherwise the dbgi layer can simply choose a stale rdi file with no way to generate a new one. 2024-10-23 11:49:47 -07:00
Ryan Fleury 45f5a2d18f accept / command line arguments on windows 2024-10-23 11:19:07 -07:00
Ryan Fleury bcd16a4f29 only plug in jumping immediates to jump_dest_vaddr paths in stepping; ctrl flow info analysis path stops when it has to read memory or registers 2024-10-23 11:07:51 -07:00
Ryan Fleury 6d7858d445 parameterize tester with test data root folder; wrap tester run in top-levels cript 2024-10-22 17:51:21 -07:00
Ryan Fleury c67f1a8b4a fix empty file edge case in hash store / text cache 2024-10-22 16:19:11 -07:00
Nikita Smith 340396f9f7 fix arena usage 2024-10-22 15:07:49 -07:00
Nikita Smith eb6aabe2d1 set block base pos 2024-10-22 15:06:39 -07:00
Nikita Smith 9ec7fb61ed implemented /noimplib /noexp 2024-10-22 11:02:59 -07:00
Nikita Smith dcffefd0c6 typo in string table lookup 2024-10-22 10:58:41 -07:00
Nikita Smith 5be2b5dfd9 alias for amd64 machine 2024-10-22 10:19:37 -07:00
Nikita Smith 7260baea85 implemented /PDBALTPATH and /RAD_DEBUGALTPATH 2024-10-21 18:03:28 -07:00
Nikita Smith a802f2186b actually push new block to list 2024-10-21 14:35:55 -07:00
Nikita Smith a43678e311 voff -> line search fix
when line table contains duplicate virtual offsets we have to return
index of last virtual offset so following property is true:
'line_length = virtual_offsets[index + 1] - virtual_offsets[index]'
2024-10-21 13:32:04 -07:00
Ryan Fleury edee84dd03 fix maximum munch rule application in text cache lexers 2024-10-21 10:37:04 -07:00
Ryan Fleury 4a211de2b3 do not bake path normalization into eval string <-> file path; this incorrectly assumes the normalization base directory, which is not correct when serializing/deserializing/etc. instead, just normalize on find-code-location. 2024-10-21 09:56:32 -07:00
Ryan Fleury d0915ec9a7 eval expressions: unary +, correctly lex exponentiated numerics 2024-10-21 09:23:31 -07:00
Ryan Fleury 52245a8e5a maintain explicit casts in cstring -> string paths 2024-10-21 08:51:19 -07:00
Nikita Smith dbcecd99af fix sizeof array types 2024-10-19 20:39:40 -07:00
Nikita Smith 68c0906570 print register name 2024-10-19 20:39:40 -07:00
Nikita Smith 26611c5454 moved IO related code to stand-alone file, piped all read/and writes
through new API, /rad_log now can enable read and/or write logs with
"io", "io_reads", "io_writes" parameters.
2024-10-19 16:36:32 -07:00
Nikita Smith 05d4faeb49 remove unsued func 2024-10-19 15:13:10 -07:00
Nikita Smith d5c2e50e9a rename import table regular -> static 2024-10-19 15:11:51 -07:00
Nikita Smith 800a2349e5 pass over COFF resource reader and writer 2024-10-19 13:44:36 -07:00
Nikita Smith 46390ba0b8 reworked manifest handling
- manifest files wont be created unless symbols are resolved
- delay mt.exe presence check until we launch it
- create explicit case that writes manifests to disk
- moved manifest dependency collection step to happen after obj input
- removed /rad_delete_manifest
2024-10-18 23:37:30 -07:00
Nikita Smith f1a0e7233d cstring helper for wide chars 2024-10-18 22:56:55 -07:00
Nikita Smith 9d60dcc099 updated radlink benches in readme 2024-10-18 17:12:31 -07:00
Nikita Smith f792da5d31 manifest... 2024-10-18 16:53:30 -07:00
Ryan Fleury 1344270b5a adjust versions 2024-10-18 16:40:25 -07:00
Ryan Fleury c03844fb1a fix build, make icon unique to raddbg 2024-10-18 16:32:49 -07:00
Nikita Smith d04e86c007 rename merged manifest 2024-10-18 16:23:51 -07:00
Ryan Fleury 669574df5a fix incorrect ordering of inline sites & concrete frames in call stack view 2024-10-18 16:07:25 -07:00
Nikita Smith 3aa4b2ea03 fix udt resolution & emit correct null type 2024-10-18 16:01:17 -07:00
Nikita Smith 2f5e55d52f switch check typo 2024-10-18 16:01:17 -07:00
Nikita Smith 14ad67d59a assign correct file path node to source file
* disabled debug check for sortness too while I'm here
2024-10-18 16:01:17 -07:00
Nikita Smith b2bdb893a0 print file path node idx 2024-10-18 16:01:17 -07:00
Ryan Fleury 98dfedfff5 limit the amount of line info visualization voff gathering; otherwise we can just spend tons of time gathering inline site voffs forever... 2024-10-18 15:16:34 -07:00
Ryan Fleury 1f633a029c skip redundant expansion tasks in eval viz block tree build 2024-10-18 13:58:24 -07:00
Ryan Fleury b3d6b2913e fix enum value committing 2024-10-18 13:47:51 -07:00
Ryan Fleury 53c624a27c respect view rule radix in enum evaluations 2024-10-18 13:37:14 -07:00
Ryan Fleury 1865c33704 specify collection qualifier for collection tabs; do not resolve to anything else 2024-10-18 13:32:29 -07:00
Ryan Fleury e17a089564 fix incorrect 0 member (should be nil) 2024-10-18 12:14:40 -07:00
Ryan Fleury eb9212b6f7 fix string cmd query params 2024-10-18 12:00:13 -07:00
Nikita Smith 0ac090cab2 delete unused files 2024-10-18 11:07:00 -07:00
Nikita Smith 7827e1b1c7 fix bounds check condition in assert 2024-10-18 11:07:00 -07:00
Nikita Smith 36f3924160 don't allocate .reloc section when there are no pages 2024-10-18 11:05:51 -07:00
Nikita Smith 00dd4ad6ec check if subsystem was specified 2024-10-18 11:05:01 -07:00
Nikita Smith 7f7f7f2873 reserve space for null string 2024-10-18 11:03:46 -07:00
Nikita Smith c8a5fc4806 Changed debug directory parser to handle multiple entries. Added
parser for RDI debug info entry. Changed debug info lookup order so
debugger tries to load path specified in exe first and if debug info
is missing then debugger will do heuristic searches.
2024-10-17 18:51:35 -07:00
Nikita Smith 652dcafbbf demon helper for reading cstrings 2024-10-17 18:46:59 -07:00
Ryan Fleury 72f987533c Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-10-17 16:50:50 -07:00
Ryan Fleury 5fd835c4d4 note 2024-10-17 16:50:25 -07:00
Nikita Smith c50d9276ba build inline lines accels 2024-10-17 16:25:54 -07:00
Nikita Smith 1214cb0968 dumper for CodeView inline sites 2024-10-17 16:25:54 -07:00
Nikita Smith 3099759c0b stringizers for inline site range kind 2024-10-17 16:25:54 -07:00
Nikita Smith 95d31f5608 fix off-by-one in inline site decode 2024-10-17 16:25:54 -07:00
Ryan Fleury 687323fc2e fix soft-halt with thread freezes; fix disabling/tooltips of top-bar controls 2024-10-17 16:12:31 -07:00
Ryan Fleury 51dce36ede notes 2024-10-17 14:51:41 -07:00
Ryan Fleury b61f4d550f Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-10-17 14:51:28 -07:00
Ryan Fleury d8d8762869 adjust entity rows in watch views to use single-click for select, double-click for their primary operation, and add in operation for breakpoints/watch-pins 2024-10-17 14:51:07 -07:00
Nikita Smith d2db4542cb check type server signature against signature in obj 2024-10-17 14:05:34 -07:00
Ryan Fleury 7adf08cc7b parameterize string eval commit path by whether or not the surrounding ui expects the string to be manually escaped or not by the user (it is not in the case of things like the meta-entity views) 2024-10-17 12:57:53 -07:00
Ryan Fleury a202999655 fix over-ambitious thread selection in frontend 2024-10-17 12:43:32 -07:00
Ryan Fleury ae3a43c694 fix file-path-parameterized commands w/ ipc 2024-10-17 12:32:20 -07:00
Ryan Fleury 2f7434cd92 always use pending-file when doing a file switch 2024-10-17 12:29:06 -07:00
Ryan Fleury b02c67bfa6 close stdout/stderr/stdin handles 2024-10-17 12:20:03 -07:00
Ryan Fleury 992be37801 fix unclamped-by-line token ranges in code slice widget mouse -> token path 2024-10-17 12:13:32 -07:00
Ryan Fleury 4727a01b9f fix kill/halt button & text 2024-10-17 12:01:02 -07:00
Ryan Fleury e376ad8113 stdout/stderr/stdin file path overrides for targets 2024-10-17 11:25:47 -07:00
Ryan Fleury 23ad094a68 allow escaped-identifier lookup for type names 2024-10-17 10:46:14 -07:00
Nikita Smith 2b407b5861 changed write file to accept 1MiB blocks to improve file write speed on windows 2024-10-16 22:27:46 -07:00
Nikita Smith 79390f4a95 align msf pages on page size 2024-10-16 22:27:46 -07:00
Nikita Smith aedfb556be fix aligned arena push 2024-10-16 22:27:46 -07:00
Ryan Fleury 78039c86a0 include no_addr in view rule system for docs/inheritance rules 2024-10-16 15:41:21 -07:00
Ryan Fleury 186e8cbabe shift disasm view to rounding/sizing equally 2024-10-16 14:58:13 -07:00
Ryan Fleury 5ec0a0e406 fix incorrect inline site baking 2024-10-16 14:29:08 -07:00
Martins Mozeiko 9c016004c2 Setup symbol path in win32 exception handler to the .exe folder
Otherwise it was trying lookup .pdb files only in the current folder,
as that is how .exe's are built (/pdbaltpath). This change now makes
exception handler to load .pdb from the same folder as where .exe is.
2024-10-16 14:13:26 -07:00
Ryan Fleury 9c1f8ef37b file name disambiguation for tab titles 2024-10-16 14:12:21 -07:00
Ryan Fleury 938af75efb normalize paths when doing file-path <-> eval string 2024-10-16 13:33:47 -07:00
Ryan Fleury 38173a7154 adjust pointer visualization; don't follow 0 pointers, go back to showing address first; adjust find-code-location snapping rule to only require a disasm snap / focus if no file location is specified 2024-10-16 13:23:10 -07:00
Ryan Fleury 74ee3b9850 option to rdi_from_pdb for deterministic generation; omits non-intrinsic, build-dependent information 2024-10-16 12:47:10 -07:00
Ryan Fleury 2edb65b5bd fix remaining non-determinism in pdb -> rdi generation! 2024-10-16 12:07:02 -07:00
Nikita Smith 9e6aa8506f README.md tweaks 2024-10-16 10:48:51 -07:00
Nikita Smith 648fa7cdab update hash in config 2024-10-16 10:23:53 -07:00
Nikita Smith 6612f4a32d hash image only when we have debug info building 2024-10-16 10:15:16 -07:00
Ryan Fleury e65bc121ed more work on pdb -> rdi determinism; almost done hitting all of the issues... 2024-10-16 08:52:27 -07:00
Ryan Fleury e1575f815c Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-10-15 18:05:14 -07:00
Ryan Fleury 0b50d8718e oops - reenable 2024-10-15 18:05:05 -07:00
Ryan Fleury 4671458e8e further debugging / logging / work on tester, trynig to get to the bottom of nondeterministic rdi generation 2024-10-15 17:41:18 -07:00
Nikita Smith bb86072dfa updated git actions 2024-10-15 17:32:21 -07:00
Nikita Smith d5988d0066 updated README 2024-10-15 17:26:50 -07:00
Nikita Smith 932df7bf68 linker 2024-10-15 17:25:22 -07:00
Nikita Smith 0cf553e39a minor fixes 2024-10-15 17:24:29 -07:00
Nikita Smith 1bcd66329f factored parser code out of pdb 2024-10-15 16:28:51 -07:00
Nikita Smith c3e2e2e91b factored parser code out of msf 2024-10-15 16:28:47 -07:00
Nikita Smith c34d7e2062 added missing LF_ENDPRECOMP type, fixed case for S_OBJNAME symbol,
merged leaf id kinds into main leaf enum, renamed public flags enum,
removed type dependency on PDB string table and PDB coff section array
2024-10-15 16:24:29 -07:00
Nikita Smith b1d6ebf77b added masm language enum and type kind count 2024-10-15 16:20:18 -07:00
Nikita Smith 9535652cfb define null path style 2024-10-15 16:19:27 -07:00
Nikita Smith 3ae1d8e401 bunch of tiny tweaks and changes from internal repo 2024-10-15 16:18:43 -07:00
Nikita Smith 7e98df22d7 temp arena change that lets us bypass memory decommits 2024-10-15 14:43:36 -07:00
Ryan Fleury 65b5176468 allocate extra slot for nil in global vmap baking; was causing overwrites of keys/markers before! 2024-10-15 12:42:43 -07:00
Ryan Fleury e61dfd793a stdout redirection support in os command line launch helper; do rdi dumps in determinism test 2024-10-15 12:20:25 -07:00
Ryan Fleury 97abec11a2 begin setting up tester for automated tests 2024-10-15 11:46:07 -07:00
Ryan Fleury b223a61cad tweaks & language fix 2024-10-15 10:17:37 -07:00
Ryan Fleury 94fb5056c2 resolve ptr-addition integer to value 2024-10-15 10:07:10 -07:00
Ryan Fleury 88dced7d2a notes 2024-10-15 09:00:54 -07:00
Ryan Fleury e92543d3f8 round to 4K rather than 16K boundaries for starting disasm address 2024-10-14 21:46:03 -07:00
Ryan Fleury 078cbf6afd fix incorrect auto disasm starting address 2024-10-14 20:56:25 -07:00
Martins Mozeiko 3d34a26205 avx512 register support in codeview -> rdi conversion 2024-10-14 20:54:26 -07:00
Ryan Fleury cc2848feb9 visualize temporary targets, provide path to move to project; final notes & readme adjustments 2024-10-14 16:25:31 -07:00
Ryan Fleury 5c861d5a10 temporary hack to fix serialization/deserialization of symbol breakpoints 2024-10-14 15:54:11 -07:00
Ryan Fleury 78e99d4094 temporary hack to fix over-ambitious project filtering 2024-10-14 15:45:15 -07:00
Ryan Fleury 18f72dd5ea fix cases where empty/busted config was not being properly reset; a few other small fixes & notes; disabling linked list helper tooltip until it's back in 2024-10-14 15:33:35 -07:00
Ryan Fleury eadd49072a restart path, breakpoint vaddr editing path 2024-10-14 15:10:44 -07:00
Ryan Fleury 1bf01c790b ctrl entity lister; fix up entity parameter commands / lister interaction 2024-10-14 15:01:35 -07:00
Ryan Fleury 6fcdce4e0f default expansion in eval visualization; apply to scheduler tree 2024-10-14 14:21:12 -07:00
Ryan Fleury 6a297113c5 more work on new scheduler 2024-10-14 13:36:17 -07:00
Ryan Fleury 9169c14e24 dead code elimination 2024-10-14 11:04:28 -07:00
Ryan Fleury e2722e45c8 new go-to-file-path implementation, in go-to-name command 2024-10-14 11:03:51 -07:00
Ryan Fleury 59abb3750d switch-to-partner file implementation 2024-10-14 10:43:48 -07:00
Ryan Fleury 4f33162d8c new switch implementation with per-project recent files 2024-10-14 10:35:00 -07:00
Ryan Fleury d87704c91f decay arrays to pointers when doing pointer-array comparisons; begin gathering recent file history into project state; prefer larger src/disasm panels when finding a new location; do not over-ambitiously hold top-level frame scopes for dbgi/fzy - stop before per-frame sleep 2024-10-14 10:20:27 -07:00
Ryan Fleury 89f47df0e2 wrap view rule, for wrapping an expression with a containing expression 2024-10-14 09:17:29 -07:00
Ryan Fleury 68fa006e53 basic entity right click menu for name/condition editing 2024-10-14 08:44:18 -07:00
Ryan Fleury a365d23acf do not apply invalid auto view rules: 2024-10-14 08:21:21 -07:00
Ryan Fleury 1c269286df auto view rules 2024-10-14 08:19:42 -07:00
Ryan Fleury 8a1dd578a7 sketch out ptr graph building data structures 2024-10-13 20:14:59 -07:00
Ryan Fleury adb8d5237c stub out linked list view rule in new eval viz system; sketch out pointer graph cache layer, for pointer chasing & building graphs asynchronously, for use in the linked list viewer & other future visualizers 2024-10-13 20:07:39 -07:00
Ryan Fleury 000970758a dead code elimination; bp hit count reset on initial-step-into fix; notes 2024-10-13 19:32:09 -07:00
Ryan Fleury ba0e4ea0c5 fix cross-module global evaluation with new multi-module-capable eval system 2024-10-13 19:25:42 -07:00
Ryan Fleury b45462c740 cache control entity meta evals, do not reconstruct on every single meta ctrl eval space read 2024-10-13 18:11:20 -07:00
Ryan Fleury ff589d2e55 digits view rule 2024-10-13 16:39:16 -07:00
Ryan Fleury 2a44f1df60 tweaks 2024-10-13 15:16:54 -07:00
Ryan Fleury 165170ba2b Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-10-11 17:26:56 -07:00
Ryan Fleury 9aefc68177 more work on full scheduler view 2024-10-11 17:23:41 -07:00
Nikita Smith 3f88b83fdb pe: added helpers for image checksum debug directory, and entry point names 2024-10-11 16:15:55 -07:00
Ryan Fleury 7724c7f7d3 begin setting up view rules for scheduler tree 2024-10-11 16:01:40 -07:00
Ryan Fleury e86190a3d3 Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-10-11 15:14:50 -07:00
Ryan Fleury fc1c00c8f5 fix array value string generation to account for type modifiers 2024-10-11 15:14:46 -07:00
Ryan Fleury 193d6726c6 adjust control thread single-step path to be a bit more robust to malformed requests 2024-10-11 15:09:08 -07:00
Nikita Smith ab9804860c base: bug fix large pages commit code path 2024-10-11 13:50:08 -07:00
Ryan Fleury 4091f5e0c0 rich unwind -> callstack, defined by ctrl layer, so we can begin floating meta evaluation cache to ctrl layer 2024-10-11 11:46:25 -07:00
Ryan Fleury 4757c4dafd switch reg cmd name parameterization from using general string slot, to its own dedicated slot, so that the string can be used 2024-10-11 10:38:28 -07:00
Ryan Fleury f44c94c3ca bring-to-front command 2024-10-11 10:23:18 -07:00
Ryan Fleury b9f931a749 guard against name collisions in call stack root expression; need to explicitly resolve against debugger-defined names 2024-10-10 15:34:31 -07:00
Ryan Fleury 79b2bcf37a fix incorrect alignment assumption in arena 2024-10-10 15:11:22 -07:00
Ryan Fleury 01eb655d19 fix memory view 2024-10-10 14:37:46 -07:00
Ryan Fleury 51b8dbaab0 fix incorrect registers view with new eval viz expansion system 2024-10-10 14:06:52 -07:00
Ryan Fleury 578d8d64a0 correctly apply path maps in engine; correctly set disasm mode in source/disasm views 2024-10-10 13:43:45 -07:00
Ryan Fleury 546c817d34 proper file path map application in source code line info visualization & thread/bp mapping; fix incorrect base vaddr in disasm view post-visualization pass 2024-10-10 13:33:50 -07:00
Ryan Fleury 2bf5c9c9a4 docs & fix for -q 2024-10-10 13:04:16 -07:00
Ryan Fleury f6502f476b quit-after-success flag 2024-10-10 12:57:26 -07:00
Ryan Fleury 0d50157239 fixes with path map application; further completeness of file drop completion menu; fix of set-next-statement 2024-10-10 12:03:11 -07:00
Ryan Fleury ba5f2021f6 file path map application in go-to-code-location path 2024-10-10 11:45:38 -07:00
Ryan Fleury 8336aa71ad fix incorrect deletion flags set for file path map entities 2024-10-10 11:23:29 -07:00
Ryan Fleury 903995f85e file path map building & ui 2024-10-10 11:13:11 -07:00
Ryan Fleury 0c6912ed78 sketch out meta-evaluation for file path maps; have an extra drop-completion ui step when drag/dropping exes, so you can easily drag/drop exes from explorer and add them as targets (the likely common case), but also allowing viewing them with the memory viewer 2024-10-10 09:03:38 -07:00
Ryan Fleury 5933708bdb fix cacheline boundary visualization & other various fixes in eval / eval viz 2024-10-10 08:13:58 -07:00
Ryan Fleury 9c5d9caa32 pass over help menu; typeof in eval 2024-10-10 07:44:26 -07:00
Ryan Fleury 848b26bbd9 fixes / jank pass 2024-10-10 07:13:47 -07:00
Ryan Fleury 0359998a8b do not send statically-disqualified conditional breakpoints to control thread - if they are only controlled by static values or by evaluations on ui-thread-controlled-or-defined state, we can eliminate them from the control thread's concerns 2024-10-09 16:38:34 -07:00
Ryan Fleury 883f1ee1cb eliminate path for frontend to communicate meta evaluation info to ctrl thread - that can't be how it works, since control thread entities change during a demon_run, and thus the control thread needs to recompute meta evaluations for its entities on-the-fly 2024-10-09 16:26:04 -07:00
Ryan Fleury 07c781a4f6 jank reduction & completeness pass 2024-10-09 16:24:29 -07:00
Ryan Fleury ac19591df6 source view reset bugfix; bp hit count reset bugfix (should happen on launch-of-new-session, not after process has started, since we can now evaluate breakpoints on the control thread) 2024-10-09 16:07:00 -07:00
Ryan Fleury 564b8ea753 don't use checkbox icon for what is really a radio button 2024-10-09 15:26:12 -07:00
Ryan Fleury 73555a2486 shift+click to toggle bps 2024-10-09 15:17:39 -07:00
Ryan Fleury 1758292074 pipe breakpoint-condition-touched meta-evaluations to control thread; allow evaluation of meta-evaluations in conditional breakpoints 2024-10-09 15:07:54 -07:00
Ryan Fleury d0e0e35fb5 fix first-time startup not being parameterized by startup window 2024-10-09 14:25:28 -07:00
Ryan Fleury 8e5ebc2d75 memory view fixups for new visualization systems; breakpoint editing work 2024-10-09 13:58:41 -07:00
Ryan Fleury bd87c109b5 extend autocompletion lister to support path autocompletion; use in cases where a watch window view is editing a path-tagged type 2024-10-09 11:18:46 -07:00
Ryan Fleury b960935315 only apply file paths to registers in text visualizers if they are explicitly evaluated - otherwise line info will be correlated to non-source-files 2024-10-08 21:37:45 -07:00
Ryan Fleury dc32a9eb01 leave stubs for go-to-disasm & go-to-source commands 2024-10-08 17:12:45 -07:00
Ryan Fleury 8d0267395a fix go-to-source 2024-10-08 17:08:02 -07:00
Ryan Fleury 05045c8db0 increase hash store history limit; fix incorrectly skipping important go-to-code-location commands 2024-10-08 17:02:49 -07:00
Ryan Fleury aea1999af0 further fixes to implicit disasm parameterization 2024-10-08 16:28:36 -07:00
Ryan Fleury 6bcc316b42 adjust non-parameterized disassembly rules to fit expected behavior better; if user runs 'go to address', or 'go to disassembly', a non-parameterized disassembly view will adjust to a 'temporary look' address, but will reset back to the thread's address upon a new run. this fits generally expected behavior - for stable looks at arbitrary addresses, that is when you would just want to use the watch window & use the disassembly view rule on a specific parameter expression. 2024-10-08 16:19:11 -07:00
Ryan Fleury 8cdf264f4d fix only/omit rules to apply to pointers-to-structs in the same way they apply to regular structs 2024-10-08 15:46:17 -07:00
Ryan Fleury 91aedd5888 be a bit less careful with disabled animation delay 2024-10-08 15:33:52 -07:00
Ryan Fleury 870df1191b jank reduction & flow fix pass, after all of the last month's changes 2024-10-08 15:32:34 -07:00
Ryan Fleury 8708b27bff bps view work 2024-10-08 11:52:43 -07:00
Ryan Fleury c6b44f6afa bp hit counts reset; cell-granularity deletions path for watch windows 2024-10-08 11:25:16 -07:00
Ryan Fleury 6be9c71ea9 first pass at meta entity eval commits; breakpoint editing, target editing, watch pin editing 2024-10-07 21:22:22 -07:00
Ryan Fleury 3720634a62 scroll output to bottom by default (not yet configurable) 2024-10-07 17:45:57 -07:00
Ryan Fleury 534a727b7c unminimize on exception hit 2024-10-07 17:33:10 -07:00
Ryan Fleury 32ce2e110b auto-resolution of derived class ptrs 2024-10-07 17:06:40 -07:00
Ryan Fleury 58114b72f4 move member lookup paths to using eval type member cache 2024-10-07 16:26:43 -07:00
Ryan Fleury 54bb225704 lock expand operations in the watch view via the expandability detection - do not just try expanding 2024-10-07 16:13:36 -07:00
Ryan Fleury 3f19c45dd3 fix enums not working for simple integer operations in eval 2024-10-07 16:04:03 -07:00
Ryan Fleury cf46ce7712 codebase readme pass 2024-10-07 15:59:39 -07:00
Ryan Fleury 23ed5c8f5f allow 'only' view rule to determine sort-order of members in constructed type info 2024-10-07 14:50:41 -07:00
Ryan Fleury c7ce08fd71 fix clang builds 2024-10-07 14:43:31 -07:00
Ryan Fleury 7114a20e66 apply expr view rule fast paths properly 2024-10-07 14:22:31 -07:00
Ryan Fleury 95dd544871 top-level text editing mode state, so that textual keys can be used for hotkeys, but just become disabled when text editing is actually happening 2024-10-07 13:54:30 -07:00
Ryan Fleury 084ef67583 fix implicit source code location parameterization w.r.t. disassembly & code file cursors; also fix output view state 2024-10-07 13:40:08 -07:00
Ryan Fleury 71cdc0eab8 watch pins 2024-10-07 13:10:54 -07:00
Ryan Fleury fa46a52600 stop double-escaping font config paths 2024-10-07 12:50:38 -07:00
Ryan Fleury a2f1be3aa9 fix view rule state retention across reloads 2024-10-07 12:47:17 -07:00
Ryan Fleury 9ed5134843 fix watch reordering, to be more flexible to how entities are arranged w.r.t. rows (add-new-rows at top) 2024-10-07 11:52:53 -07:00
Ryan Fleury 232f955786 breakpoints, watch pins 2024-10-06 13:35:41 -07:00
Ryan Fleury 6a1c36b212 use more basic default epsilon assumption 2024-10-04 11:51:12 -07:00
Ryan Fleury 71ff183dc4 move over to new rich hover system for all entity tooltips 2024-10-03 09:34:47 -07:00
Ryan Fleury 8b8acf64d6 more work on universal rich hover / ctx menu systems 2024-10-02 12:02:49 -07:00
Ryan Fleury 487c7c9938 show rich hover tooltips when dragging/dropping as well 2024-10-01 15:44:37 -07:00
Ryan Fleury d978f56250 thread rich hover 2024-10-01 13:48:11 -07:00
Ryan Fleury 5f32b0710e more work on modules view; show debug info loading status 2024-10-01 12:36:41 -07:00
Ryan Fleury 911f9ef97b make meta & eval type system a bit richer to express plain text vs. code text vs. path text 2024-10-01 12:04:40 -07:00
Ryan Fleury 685cb4a3b8 further work on expanding main watch path to support various string styling/visualizing mechanisms, used ad-hoc before; more work on scheduler 2024-10-01 11:43:57 -07:00
Ryan Fleury dae0d602f9 modules view pass 2024-10-01 10:42:31 -07:00
Ryan Fleury ac5c65ebdd fix busted next/prev tab operations on panels with single tab 2024-10-01 10:02:37 -07:00
Ryan Fleury 04815b4265 continue work on ctrl entity visualization in watch views & further progress on new scheduler 2024-10-01 09:36:29 -07:00
Ryan Fleury 152cc709ce work on ctrl entity buttons in watch views 2024-09-30 17:07:50 -07:00
Ryan Fleury 57d01355a1 create pre-filtered types for meta evals; all of the same underlying data transforms are on a single meta-eval data bundle, but now each type of meta eval entity is exposed via a tighter type to the ui & eval system 2024-09-30 16:03:55 -07:00
Ryan Fleury fcedcab57c begin work on scheduler view requirements 2024-09-30 15:08:05 -07:00
Ryan Fleury 3fb8b83324 mostly done with all of the special machinery for entity views via watch windows 2024-09-30 14:12:55 -07:00
Ryan Fleury 5d76b58acd targets view: ensure ctrl+click for selection, ensure proper target parameterization of engine commands 2024-09-30 09:40:39 -07:00
Ryan Fleury 2e13b221ac do not attempt to form implicit member lookup expressions if initial map failed 2024-09-27 17:03:18 -07:00
Ryan Fleury 64e5d60f38 eliminate adjusted frame base check, which was causing incorrect unwinds in some cases 2024-09-27 16:57:23 -07:00
Ryan Fleury ce72af8b59 fix inclusion of symbolized addresses in editable eval visualization strings 2024-09-27 16:30:01 -07:00
Ryan Fleury 086ca98181 callstack unwind selection in watch window-ified callstack view 2024-09-27 16:27:55 -07:00
Ryan Fleury fe59fab3da progress on callstack view replacement 2024-09-27 15:48:36 -07:00
Ryan Fleury 52b2cbc17a selection in targets view 2024-09-27 14:46:22 -07:00
Ryan Fleury 7362f8ef60 always focus window on stop events; further watch view progress 2024-09-27 14:25:32 -07:00
Ryan Fleury cab01431be more watch view work 2024-09-27 13:41:17 -07:00
Ryan Fleury 771883c56c another checkpoint in fixing up the watch window for replacing targets/scheduler/etc 2024-09-27 13:15:10 -07:00
Ryan Fleury b6b188b67b begin work on full targets view replacement in new watch / eval viz systems 2024-09-27 11:02:37 -07:00
Ryan Fleury ecaa2c55c0 eliminate all old eval visualization block/row code 2024-09-27 10:29:55 -07:00
Ryan Fleury 45226e8a81 begin eliminating old block/row code in eval visualization 2024-09-27 10:26:30 -07:00
Ryan Fleury 0073b2b045 fix correct application of top-level view rules in block tree build 2024-09-27 10:12:44 -07:00
Ryan Fleury 3d781f847e fix expansion rule picking 2024-09-27 10:08:49 -07:00
Ryan Fleury 4b7e6d7113 fixes for variable size rows in new eval visualization structures / integration 2024-09-27 10:04:56 -07:00
Ryan Fleury 3fa98eb0e7 begin moving all visualizer view rules to new eval visualization block system 2024-09-26 17:00:32 -07:00
Ryan Fleury 60f65d30e2 populate entity deletions more urgently in watch viiew 2024-09-26 16:24:47 -07:00
Ryan Fleury 007efe29eb fix incorrect multi-select deletion behavior 2024-09-26 16:21:45 -07:00
Ryan Fleury bbac451de4 fix a few small issues with insertion/deletion of new watch rows 2024-09-26 16:15:03 -07:00
Ryan Fleury 73c37b4d8b correct collection editing/deletion/reordering/etc. with new watch visualization system 2024-09-26 16:08:35 -07:00
Ryan Fleury 2fdfeec467 always keep collections in filtered watch views; add add-new-row capability to watch collection expansion & hook up with expansion ids 2024-09-26 15:36:22 -07:00
Ryan Fleury d314a12698 eliminate possibility for recursive watch window builds; correctly sort child expansion keys before iteration, if needed, for non-identity-based id schemes (debug info tables, frontend entities, etc.); further fixes & integration 2024-09-26 15:26:28 -07:00
Ryan Fleury 07f978ac41 further integration work & expanded support; generalized paths for entity reordering in watch views 2024-09-26 14:37:13 -07:00
Ryan Fleury 338fabd9d0 more block tree / eval visualization integration work with watch views 2024-09-26 13:13:30 -07:00
Ryan Fleury 715bd36965 fix table cursor snapping 2024-09-26 12:24:13 -07:00
Ryan Fleury 198246eb52 more integration work, of new block tree eval visualization structure w/ watch views 2024-09-26 12:05:01 -07:00
Ryan Fleury e705907ec0 checkpoint in moving existing watch views to new block-tree visualization structure 2024-09-26 08:09:22 -07:00
Ryan Fleury 2fb0eb0eb1 sketch out basic coordinate space conversions for new block tree / block range list structures; num -> key; key -> row; num -> containing block range; etc. 2024-09-25 16:53:54 -07:00
Ryan Fleury 48b10411bc eliminate old weld-together path for block tree walk & windowed row list build 2024-09-25 16:37:11 -07:00
Ryan Fleury d6f6ec83da unweld windowed row list generation from block tree walk; write new path which relies on caller-prepped block range list 2024-09-25 16:36:43 -07:00
Ryan Fleury df2bc62563 extend eval visualization view rule hooks to support view-rule-defined (id <-> number) mapping; used for id-based state keys, but an immediate-mode ordering (e.g. sorted/filtered debug info tables); can be used in the future for sorted types/arrays/etc., while preserving expansion/view rule state. also, pull out the block tree -> list(block*range) walk, since it is going to be useful in multiple places 2024-09-25 16:32:48 -07:00
Ryan Fleury f2ecb3d898 expand info & expansion range query hook implementation, for all currently supported view rules 2024-09-25 15:59:42 -07:00
Ryan Fleury a1ceb5fa3b on second thought... merging both view rule expansion *header* info generation, and windowed range queries into an expanded block, into the same hook, is really limiting & wrong - so split back to two hooks, one stage is just informing the expansion space, the next provides per-row information within an expanded block with range-based queries 2024-09-25 15:17:39 -07:00
Ryan Fleury a87c032305 fix a few details in new eval visualization block tree generation algorithm; fix row generation; start fitting new system into hover eval as a first test 2024-09-25 13:17:17 -07:00
Ryan Fleury 9c3d2cd5ab eval visualization: first pass of new tree-ified block building, which preserves the hierarchy of the eval visualization path, as well as relies on only a single view rule hook; first pass of windowed row list production, given that block tree build; also still just uses the single hook 2024-09-25 12:23:50 -07:00
Ryan Fleury c976154284 eval: add cache for type data member gathering & member lookup; eval_visualization: sketch out new hook organization which has single hook for both view rule expansion info, + expansion expr production, in a single combined path (the two often require the same information so it is maybe a good idea to combine them - if not, it will be easy to separate into two stages (expand + expr-child production), but basically just trying to get view rules out of 'block production', and more into just providing the information that actually varies per view rule 2024-09-25 09:34:23 -07:00
Ryan Fleury fcfd446c5e watch ui tweaks 2024-09-24 16:58:10 -07:00
Ryan Fleury d2c9fdcf0b notes 2024-09-24 13:27:59 -07:00
Ryan Fleury 2f9121171c eliminate dead code, after this pass 2024-09-24 13:24:23 -07:00
Ryan Fleury fbfaf1c747 strip out root buttons idea; fix up pretty member names 2024-09-24 11:06:31 -07:00
Ryan Fleury 64f763162f adjust font provider rasterization bounds to prevent off-by-one cutoffs 2024-09-24 07:23:44 -07:00
Ryan Fleury 629ddec458 begin sketching out watch-window-driven scheduler replacement 2024-09-23 17:41:26 -07:00
Ryan Fleury 5690a9e19b further enriching of codebase type info & eval type info to encode code-contents of pointers, pretty names for members; further progress on improving watch views to support all needed features for replacing all table uis 2024-09-23 16:45:18 -07:00
Ryan Fleury 508d11c8d8 further progress on targets view replacement; split collection views into several types 2024-09-23 16:06:01 -07:00
Ryan Fleury bfe6f655be more work on watch view to replace all old uis 2024-09-23 14:26:27 -07:00
Ryan Fleury f728614e0b eliminate watch view fill kind; extend rtti & eval type system with 'external' pointers, for e.g. meta-space vaddr u64s pointing into an address space; begin sketching out paths for mutational rows in watch collections, use to add 'add target' fastpath in targets collection evaluations 2024-09-23 10:57:43 -07:00
Ryan Fleury ebaad35813 fix filter passthrough & fix double-application of view rules in some cases 2024-09-20 17:19:13 -07:00
Ryan Fleury 8babd89f47 modules view, watch window style 2024-09-20 17:04:53 -07:00
Ryan Fleury 066f5f6cf2 add correct inheritance rules for oct, hex, dec, bin, only, omit view rules 2024-09-20 16:24:09 -07:00
Ryan Fleury c98db01b63 replace watch view fill kind with top-level expression & view rule; collection macro for watches; reintroduce only/omit, with new expr-macro-based eval visualization system; remove root-expression-generation from expansion block generation, since it makes things a bit more complicated 2024-09-20 16:15:29 -07:00
Ryan Fleury a1debd9219 targets, breakpoints, watch pins, etc. collections; fix . access on enum types; add more information to meta evaluations 2024-09-20 13:49:27 -07:00
Ryan Fleury 432e70caf6 begin sketching out 'collections', which are the formal mechanism in the eval/eval-viz systems for visualizing synthetic structures/arrays/trees produced by the debugger, rather than ad-hocing / hardwiring the correct ev-block production for each kind of view - the views can still stay, but this is an important feature for other cases 2024-09-20 12:04:13 -07:00
Ryan Fleury bbd86449d8 fix ghost auto-view-rule text visualization to calculate auto view rule from raw type expression rather than post-view-rule-applied one 2024-09-19 16:07:14 -07:00
Ryan Fleury 454764b9f6 set up auto view rule table in frontend thread; visualize auto-view-rules as ghosted text in watch views 2024-09-19 15:29:08 -07:00
Ryan Fleury 05ec402a8e make eval visualization system robust to absence of auto view rule table 2024-09-19 15:23:55 -07:00
Ryan Fleury df4d18aa5c sketch out type-based auto-view-rule in eval visualization system 2024-09-19 15:22:47 -07:00
Ryan Fleury cc61df0c7b lazily-evaluate meta evaluations on an as-needed basis - with callstacks in particular it is just too expensive to do all threads every frame up-front 2024-09-19 14:38:24 -07:00
Ryan Fleury 7bec50db75 type-info-table-driven pointer rebasing for meta evals; add callstack info to entity meta evals 2024-09-19 14:04:40 -07:00
Ryan Fleury 0e993c5e7a eliminate old ctx menu paths 2024-09-19 11:36:34 -07:00
Ryan Fleury 16ba8a98cf shift source ctx menu to universal ctx menu path 2024-09-19 11:33:23 -07:00
Ryan Fleury 1e8413797a shift tab ctx menu into universal ctx menu 2024-09-19 11:27:55 -07:00
Ryan Fleury ca8fdd1d6e progress on universal ctx menu 2024-09-19 11:22:08 -07:00
Ryan Fleury 714c736530 eliminate old manual serialization code for meta evals in ctrl msgs 2024-09-18 17:01:59 -07:00
Ryan Fleury 7c41fc11e0 fix up issues with user <-> ctrl thread communication 2024-09-18 16:21:22 -07:00
Ryan Fleury 546e6e695f eliminate ad-hoc meta eval info type tables; switch to base layer meta type info; do first pass of shifting serialization of meta evals to meta type info driven system 2024-09-18 15:57:01 -07:00
Ryan Fleury 7e5759ed03 finish first pass sketching out basic base-layer-defined codebase type info & serialization/deserialization path with basic pointer cases 2024-09-18 14:52:39 -07:00
Ryan Fleury 9ae3b2eb92 base layer defined type info tables experiment - can ideally be used as a more whole solution for the ctrl meta eval info stuff 2024-09-17 17:52:23 -07:00
Ryan Fleury 85a07be1ac generate meta tables for meta evaluations; use to table-drive ctrl msg serialization, deserialization, meta eval type info generation, and info <-> serialized eval path 2024-09-17 15:43:39 -07:00
Ryan Fleury 3de6331a8e notes for 0.9.12 2024-09-17 14:17:04 -07:00
Ryan Fleury 487637aaaa fix while-loading command processing in text views 2024-09-17 14:05:40 -07:00
Ryan Fleury e825c0f5b5 keep 64mb reserve size default if possible with large pages enabling 2024-09-17 13:46:11 -07:00
Ryan Fleury 5dd89f350d --large_pages option; allow dynamic override of arena defaults 2024-09-17 13:41:56 -07:00
Ryan Fleury 4d41c32586 plug in fuzzy searching system to autocompletion lister; can now autocomplete procedures, types, globals in watch window 2024-09-17 11:52:33 -07:00
Ryan Fleury a368d04e3b checkpoint on new universal drag/drop stuff 2024-09-17 11:26:13 -07:00
Ryan Fleury ca9ee9a658 checkpoint in new universal regs-based rich hover / context menu / drag-drop systems 2024-09-17 11:05:43 -07:00
Ryan Fleury 8ce7626099 fix run-to-line & run-to-address (was accidentally zeroing extra_bps) 2024-09-16 18:09:19 -07:00
Ryan Fleury d66703a044 filter commands in views by view rather than window/panel 2024-09-16 17:57:48 -07:00
Ryan Fleury fa64116048 notes 2024-09-16 17:54:53 -07:00
Ryan Fleury cff6222863 additional small fixes 2024-09-16 17:48:39 -07:00
Ryan Fleury 515724f264 small fixes 2024-09-16 17:43:38 -07:00
Ryan Fleury a7ca8dd0a0 sketch out thread color events & client-driven thread color state, plug thread colors back into ui 2024-09-16 17:37:50 -07:00
Ryan Fleury 35659a4525 checkpoint on new drag/drop system; eliminate old drag/drop payload, just use regs like everything else 2024-09-16 17:25:21 -07:00
Ryan Fleury 4b382777e9 fix debug engine incorrectly using visual run state to soft halt, when ctrl thread did not necessarily report it was running; was leading to 'phantom halts'; other small fixes, dead code elimination, and begin sketching out proper cross-window drag/drop 2024-09-16 17:09:41 -07:00
Ryan Fleury 3cf27169b6 fix view snapping in frame selection & disasm 2024-09-16 16:25:02 -07:00
Ryan Fleury ba647a0b1d fix open-tab path; fix pending-file setup 2024-09-16 16:13:40 -07:00
Ryan Fleury 2f86e289a4 get all view code off of explicit view parameterization; merge row value cell ui hook with regular view ui hook 2024-09-16 15:59:01 -07:00
Ryan Fleury 9899efe93c merge view rules & view specs entirely; simplify graphical view rules down to single hook 2024-09-16 14:44:28 -07:00
Ryan Fleury 84f685803d fix set-space ir extension instruction; expand ctrlbits to u16, so that it can encode modern register sized decodes 2024-09-16 11:59:06 -07:00
Ryan Fleury c00fede4f1 fill out meta eval info system in frontend; get eval back up and running 2024-09-16 11:51:55 -07:00
Ryan Fleury adc9e0e512 begin sketching out meta eval info, to allow for debugger meta evaluations on both ctrl thread & on ui thread - e.g. breakpoint hit count evaluation in conditional bps 2024-09-16 10:36:22 -07:00
Ryan Fleury 17d062934e dead code elimination 2024-09-16 10:13:28 -07:00
Ryan Fleury e8c8df9c6e eliminate setup hook for views 2024-09-16 09:53:24 -07:00
Ryan Fleury 23a5c9eb44 eliminate view cmds hook; just use ui hook 2024-09-16 09:45:54 -07:00
Ryan Fleury 3c262fccf3 adjust top-level rd_frame structure to allow N cycles (rather than 1) of [rd cmds], [d tick] per frame; fix a few ctrl thread driving issues in dbg engine 2024-09-15 12:46:03 -07:00
Ryan Fleury 114ebfa27b adjust raddbg command queue to have two phases; first phase, r/w, core gets chance to push extra commands & consume them immediately same-frame; views get second phase, read-only, where they can consume all commands, but when they push new commands, those are distributed back at the top of the chain, where the core gets first chance 2024-09-15 09:47:37 -07:00
Ryan Fleury 7a1811fb71 begin eliminating setup hook for views 2024-09-14 08:12:26 -07:00
Ryan Fleury f396a88bac mdesk layer extensions for mutable tree manipulations 2024-09-13 17:16:42 -07:00
Ryan Fleury 4b526db0dd organization pass & straightening some things out before entity simplification/replacement 2024-09-13 16:12:55 -07:00
Ryan Fleury 8ffc9f4a9b more progress on entity simplification; df -> rd; eliminate dbg_frontend distinction from raddbg layer 2024-09-13 15:55:58 -07:00
Ryan Fleury 48ae9b6973 move rest of cfg-related stuff into frontend 2024-09-13 14:51:07 -07:00
Ryan Fleury 793ad8fe1e new view rule table definition in df, merging graphical view rules & views totally 2024-09-13 13:39:40 -07:00
Ryan Fleury 7cd1d175de deduplicate string escaping paths in eval/cfg/etc 2024-09-13 12:08:22 -07:00
Ryan Fleury 306f8d84c5 remainder of entity code -> df; exception code filters -> df 2024-09-13 11:59:46 -07:00
Ryan Fleury 573bad8487 entity from d -> df 2024-09-13 11:46:17 -07:00
Ryan Fleury 9b66a9c60e fix df/ctrl kind mismatch 2024-09-13 11:26:53 -07:00
Ryan Fleury 96b5f82964 run-to-line/address porting from old df_entity-based behavior 2024-09-13 11:21:13 -07:00
Ryan Fleury 6b758f08fa eliminate dead code; port breakpoint hit counting to frontend; begin floating entity code into frontend, prepping for simplification/replacement 2024-09-13 10:48:40 -07:00
Ryan Fleury 7fb711b07c eliminate more dead code 2024-09-13 10:41:42 -07:00
Ryan Fleury c8a892ad8f eliminate d_entity-based module mapping code; all of this is done via ctrl systems now 2024-09-13 10:39:32 -07:00
Ryan Fleury f9c541ea7b eliminate regs concept from engine; eliminate more d_entity mirroring ctrl_entity 2024-09-13 10:26:34 -07:00
Ryan Fleury 2dfa3dae42 snap-to-thread if none selected in frontend; fix soft halt logic to match old logic; fix ctrl entity store alloc gen on release 2024-09-12 17:10:39 -07:00
Ryan Fleury f13806b19f another checkpoint in moving previously engine-controlled behavior to frontend, and getting engine completely off d_entities 2024-09-12 16:51:48 -07:00
Ryan Fleury 71cb03f3be checkpoint in getting off of d_entities and onto ctrl_entities for frontend paths, including thread selection & df_regs 2024-09-12 16:30:26 -07:00
Ryan Fleury 3641c212b2 begin floating thread/frame selection mechanisms into frontend and out of engine 2024-09-12 14:58:48 -07:00
Ryan Fleury 638140ab87 another checkpoint, moving d_regs -> df_regs; eliminating more state & responsibilities from dbg_engine 2024-09-12 14:10:41 -07:00
Ryan Fleury 65ed1f0997 another checkpoint - eliminate cmd specs from engine, move all dynamic command definition things into frontend 2024-09-12 12:11:00 -07:00
Ryan Fleury 472e73137d checkpoint 2024-09-11 18:25:48 -07:00
Ryan Fleury 2f299e087a fix busted stepping mechanism 2024-09-11 17:44:30 -07:00
Ryan Fleury c8efacf707 split engine from frontend cmd structure; use to begin fixing/hardening engine commands and decoupling them from frontend complications 2024-09-11 17:42:34 -07:00
Ryan Fleury deef05d0d2 extend eval space size to allow u128 key for hash store & related cache keys, + some extra metadata determined by user (user-defined kind & extra u64) 2024-09-11 17:11:33 -07:00
Ryan Fleury 26fb91d539 fix top-level frontend exit logic; eliminate path -> entity code, since we are totally off filesystem entities 2024-09-11 16:25:02 -07:00
Ryan Fleury f59694fcfb float cfg from engine -> frontend; more elimination of dead code in engine 2024-09-11 15:40:11 -07:00
Ryan Fleury f4726eee0a eliminate old eval viz code in engine 2024-09-11 15:22:51 -07:00
Ryan Fleury cc2b5138b0 more dead code elimination & simplification & floating from engine -> frontend 2024-09-11 15:04:12 -07:00
Ryan Fleury e7b4912e4a eliminate more dead code in engine 2024-09-11 14:35:30 -07:00
Ryan Fleury af5825c89a move interaction register stack into frontend layer 2024-09-11 14:24:16 -07:00
Ryan Fleury be6458690f ctrl layer defined handle system, to replace machine-id/demon-handle pairs used everywhere by users 2024-09-11 14:01:38 -07:00
Ryan Fleury e6872cb71e eliminate all old debug engine eval visualization code; we're now moved over to the new more standalone eval viz codebase layer 2024-09-10 17:22:24 -07:00
Ryan Fleury 20aba085cd oops 2024-09-10 17:14:10 -07:00
Ryan Fleury 299ea04539 port debugger frontend to using eval visualization layer, over old debug engine code 2024-09-10 17:10:48 -07:00
Ryan Fleury bb50e88141 eval_visualization layer: builtin view rules, porting of more debug engine code over 2024-09-10 16:14:11 -07:00
Ryan Fleury e989da4087 float down dbg engine eval visualization stuff into formal codebase layer which just builds on top of eval 2024-09-10 15:46:05 -07:00
Ryan Fleury d3bf9cbb53 eliminate now-unnecessary config writing mechanism 2024-09-10 14:11:54 -07:00
Ryan Fleury d35bc56f8f further coalesce all frontend command processing into top-level frame path; have frontend commands for all possible engine commands 2024-09-10 14:01:06 -07:00
Ryan Fleury 9e7ce6a6c7 do not bake in this parameters in static methods 2024-09-10 13:51:59 -07:00
Ryan Fleury 09db3aacd0 formally split dbg engine/frontend commands; float entity operations & all ui-related operations up to frontend layer, keep engine to small set of control operations (we are trying to get the engine out of the mix in managing entity state) 2024-09-10 11:37:01 -07:00
Ryan Fleury 6534bff5d0 eliminate state delta history experiment codef 2024-09-10 07:24:33 -07:00
Ryan Fleury baaa853c7f dead code & unnecessary helper elimination 2024-09-08 16:49:27 -07:00
Ryan Fleury 8831781af4 reorder top-level frame structure; frontend gets chance first 2024-09-08 14:28:06 -07:00
Ryan Fleury dfe0c17b89 oops; fix incorrect usage of thread instead of process entity 2024-09-08 13:16:57 -07:00
Ryan Fleury 6cf0c7ee92 promote thread freeze state to ctrl entity tree; communicate via msgs for user -> ctrl, and communicate entity state changes back via events for ctrl -> user 2024-09-08 13:09:52 -07:00
Ryan Fleury fee500578a get trap net generation off of d_entities and onto ctrl entities; decouple debug engine stepping/running from d_entities 2024-09-08 10:50:00 -07:00
Ryan Fleury 43b83b56f1 float eval system preparation to frontend & out of engine 2024-09-08 10:30:05 -07:00
Ryan Fleury 9b95e60894 feed flattened breakpoints into ctrl message instead of entities 2024-09-08 10:26:14 -07:00
Ryan Fleury 2272b4a14c eliminate d_ctrl_run helper intermediate; switch to using simplified passdown types for breakpoints, rather than entities, in ctrl run parameterization 2024-09-08 10:23:32 -07:00
Ryan Fleury 6b172396f5 eliminate messages - too early for that change; eliminate many usage sites of d_ctrl_run; focus all ctrl thread driving code into one spot 2024-09-08 10:12:10 -07:00
Ryan Fleury 2cc81baffa sketch out simplified input types for engine; port over animation cache from reverted changes 2024-09-08 09:44:39 -07:00
Ryan Fleury a204018e94 Revert "checkpoint on pass to majorly simplify debug frontend state, and eliminate df entities, and move from cmds -> msgs"
This reverts commit 06a685221a.
2024-09-07 14:50:27 -07:00
Ryan Fleury 3ed8f4af98 Revert "begin sketching out live cfg mutation code, as replacement for frontend entity tree formation/mutation"
This reverts commit c8c9c7ea27.
2024-09-07 14:48:47 -07:00
Ryan Fleury 5ffab0439b Revert "more msgs -> cmds & df entity elimination progress"
This reverts commit 9968c6e491.
2024-09-07 14:48:42 -07:00
Ryan Fleury cccbd265ff Revert "another checkpoint in big df entity elimination pass"
This reverts commit f8fd32e328.
2024-09-07 14:48:34 -07:00
Ryan Fleury 6180da1b0f Revert "yet another checkpoint"
This reverts commit 5ad8d523ba.
2024-09-07 14:48:29 -07:00
Ryan Fleury 30766f93ae Revert "checkpoint"
This reverts commit 3631de648b.
2024-09-07 14:48:21 -07:00
Ryan Fleury 3631de648b checkpoint 2024-09-07 13:37:35 -07:00
Ryan Fleury 5ad8d523ba yet another checkpoint 2024-09-05 19:19:00 -07:00
Ryan Fleury f8fd32e328 another checkpoint in big df entity elimination pass 2024-09-04 15:50:59 -07:00
Ryan Fleury 9968c6e491 more msgs -> cmds & df entity elimination progress 2024-09-03 16:50:16 -07:00
Ryan Fleury c8c9c7ea27 begin sketching out live cfg mutation code, as replacement for frontend entity tree formation/mutation 2024-09-03 15:20:04 -07:00
Ryan Fleury 06a685221a checkpoint on pass to majorly simplify debug frontend state, and eliminate df entities, and move from cmds -> msgs 2024-09-03 12:46:30 -07:00
Ryan Fleury 6b02c8a7d6 more progress on converting cmds codepaths -> msgs codepaths 2024-09-01 16:20:26 -07:00
Ryan Fleury 06f65857db more progress in df cmds -> msgs 2024-09-01 15:49:06 -07:00
Ryan Fleury 6ead03ac17 strip out update/render/repaint window cruft; promote layer per-tick APIs to base layer 2024-09-01 09:00:58 -07:00
Ryan Fleury 98840c73d8 finish initial pass over df msgs 2024-09-01 08:39:18 -07:00
Ryan Fleury 45d3702c5b further progress on cmds -> msgs in debug frontend 2024-08-31 09:02:42 -07:00
Ryan Fleury 2696c96f75 continue coalescing df frame 2024-08-31 07:36:53 -07:00
Ryan Fleury 7645d00392 eliminate more cruft in engine/frontend layers; sketch out new frontend msg processing loop 2024-08-30 18:08:29 -07:00
Ryan Fleury 7004994b25 sketch out msg processing loop, to replace cmd processing loop, in dbg engine 2024-08-30 17:52:45 -07:00
Ryan Fleury 8770a43678 set up scaffolding for dbg engine/frontendm sgs 2024-08-30 15:24:35 -07:00
Ryan Fleury 533fd0041f begin flattening d/df tick paths 2024-08-30 14:10:12 -07:00
Ryan Fleury 2ceff4293f begin eliminating begin/end frame concept in debug engine, and moving to single debug engine tick 2024-08-30 12:24:47 -07:00
Ryan Fleury 13f2de6e88 d regs -> mdesk 2024-08-30 10:07:56 -07:00
Ryan Fleury ecf9cd1dab fix markup vsnprintf fwd declare warning 2024-08-30 09:33:54 -07:00
Ryan Fleury b0d10d457e notes 2024-08-29 17:14:50 -07:00
Ryan Fleury e1806d2d61 notes 2024-08-29 17:02:26 -07:00
Ryan Fleury facf0dafe6 move remaining per-window cmds to top-level 2024-08-29 16:29:10 -07:00
Ryan Fleury 37f771ae9b begin moving all frontend command processing into top-level layer, rather than doing it per-window 2024-08-29 16:24:15 -07:00
Ryan Fleury 84bc078e9f watch commands -> core layer 2024-08-29 15:54:10 -07:00
Ryan Fleury df777a4c07 eliminate old code slice cruft 2024-08-29 13:39:53 -07:00
Ryan Fleury e81fbe4bf2 eliminate old code; organization pass over dbg frontend 2024-08-29 13:37:28 -07:00
Ryan Fleury 9932a30ef9 entity parameter tree equipment; architecture -> arch 2024-08-29 13:16:50 -07:00
Ryan Fleury df6150c811 always produce inheritance child cfg tables for each viz block 2024-08-29 12:48:54 -07:00
Ryan Fleury 719c453bfc eliminate old type 2024-08-29 11:57:57 -07:00
Ryan Fleury 0f4d2cfbc1 entity name -> string 2024-08-29 11:48:55 -07:00
Ryan Fleury bb553b4ec0 eliminate manual notification of entity / panel mutations for soft halts & config changes; just compute a hash of all run parameterization state every time you run, and every frame, and if they change, soft halt refresh 2024-08-29 11:34:29 -07:00
Ryan Fleury 9bba4f224c ctrl flow analysis -> dasm layer 2024-08-29 10:58:16 -07:00
Ryan Fleury 5907783a2e d_interact_regs -> d_regs 2024-08-29 10:54:54 -07:00
Ryan Fleury 4944652331 introduce debug engine entity kinds for windows/panels/tabs, to begin process of formally moving all view parameterizations to watch entities; eliminate redundant passthrough of window/panel parameters 2024-08-29 10:49:35 -07:00
Ryan Fleury e9304b5eff parameter tree editing in tab right-click menu 2024-08-28 17:54:49 -07:00
Ryan Fleury 61a264e20c fix empty language option in autocompletion lister 2024-08-28 17:22:27 -07:00
Ryan Fleury 4439aab721 split more frontend-only information from debug engine core definitions 2024-08-28 17:14:59 -07:00
Ryan Fleury 1c62787758 dbg_gfx -> dbg_frontend; fix force-confirm commands; more naming passes 2024-08-28 16:59:21 -07:00
Ryan Fleury 269abf661f switch to simplified debug engine command interface; rely on interact registers, rather than explicit pass-down, for contextually-obvious parameters 2024-08-28 16:47:05 -07:00
Ryan Fleury e3dc29d7ae push_cmd__root -> push_cmd 2024-08-28 15:37:55 -07:00
Ryan Fleury cb25e261e4 eliminate all cmd param slot marking 2024-08-28 15:37:03 -07:00
Ryan Fleury 818c5a9160 eliminate dependence on 'command parameter slots' 2024-08-28 15:34:46 -07:00
Ryan Fleury c60809f02b df -> dbg_engine and dbg_gfx layers; df (core) -> d 2024-08-28 15:16:55 -07:00
Ryan Fleury ca4b602b28 f -> fnt 2024-08-28 13:45:54 -07:00
Ryan Fleury 83542d4010 re-slice views code; begin prepping for view rules / views being organized together 2024-08-28 13:38:49 -07:00
Ryan Fleury 01236ca3b9 make all view, core view rule, and gfx view rule names completely consistent, use the name as the unique key among all tables 2024-08-28 13:11:00 -07:00
Ryan Fleury 31810bb221 fix incorrect lifetime of cfg table trees 2024-08-28 12:01:19 -07:00
Ryan Fleury 22c4336375 finish trimming old view rule code; get 3d geometry viewer back in good shape and integrated as a full view 2024-08-28 11:36:44 -07:00
Ryan Fleury 5ff9e47f8a fix loading in transient views 2024-08-27 17:18:42 -07:00
Ryan Fleury d956f7a266 view rule table notes 2024-08-27 16:46:19 -07:00
Ryan Fleury 0c2502c89f partway through fixing regressions of color view rule 2024-08-27 16:35:15 -07:00
Ryan Fleury be93968c8d fix incorrect resource kind string table; fix incorrect usage of resource kind table when doing texture format lookups in bitmap view 2024-08-27 15:48:27 -07:00
Ryan Fleury 32ac4f10bb support loading overlay in transient views; fix incorrect transient view state caching when view parameters change 2024-08-27 15:23:19 -07:00
Ryan Fleury 59360f770c file drop support 2024-08-27 14:49:57 -07:00
Ryan Fleury 32fcc6d34c expand pending file view to actually analyze files a bit before picking appropriate viewer; for now just do code if text, memory if not 2024-08-27 14:27:14 -07:00
Ryan Fleury 645db07493 add memory view rule; adjust memory view to appropriately use eval parameterizations, so that it can be used as a view rule correctly 2024-08-27 13:47:38 -07:00
Ryan Fleury 4b75145ec0 only consider non-queried disassembly views in general-purpose find-code-locationp ath 2024-08-27 13:08:32 -07:00
Ryan Fleury e59e014b2b shift disassembly view to being usable as a view rule too; arbitrary disassembly view parameterization 2024-08-27 13:00:21 -07:00
Ryan Fleury 08652e8b0a cast view rule 2024-08-27 11:46:54 -07:00
Ryan Fleury 511e81b188 eliminate eval resolution stage; we can just use expr resolution stage for everything 2024-08-27 11:39:46 -07:00
Ryan Fleury 90273e7a2e bswap view rule 2024-08-27 11:37:27 -07:00
Ryan Fleury cf7b664ab2 bswap expression & ir 2024-08-27 11:35:45 -07:00
Ryan Fleury accc77e03e eliminate type resolution eval viz stage (can just be done via the expr resolution stage, which is more powerful); fix elements expansion for non-pointers 2024-08-27 11:17:05 -07:00
Ryan Fleury 5b29f0db47 new expr resolution eval visualization stage; use to implement array & slice view rules 2024-08-27 11:04:22 -07:00
Ryan Fleury a97c8bd070 fix new param tree generation; stop string viz for padding members; fix relative file path serialization in new cfg saving path 2024-08-27 09:13:28 -07:00
Ryan Fleury 6a8c110b83 remove old cursor/mark decls 2024-08-26 16:15:28 -07:00
Ryan Fleury c97c351508 move cursor/mark state out of being hardcoded in view, and into param tree 2024-08-26 16:13:50 -07:00
Ryan Fleury 567aea2b15 new view serialized/deserialized params storage 2024-08-26 15:55:12 -07:00
Ryan Fleury 895c4dd199 fix press detection in watch view canvases 2024-08-26 15:16:23 -07:00
Ryan Fleury 3691b59af3 set up system for per-view param tree mutations; fix duplicate param key serialization 2024-08-26 15:13:53 -07:00
Ryan Fleury ec16f59a1e fix incorrect usage of new ui events pump 2024-08-26 14:34:24 -07:00
Ryan Fleury c16e21db71 eliminate dead code 2024-08-26 14:27:51 -07:00
Ryan Fleury 1de57557b5 get off cfg node duplicates of mdesk trees; use md trees for params consistently across view rules, tabs, etc. 2024-08-26 14:26:23 -07:00
Ryan Fleury aed18eb71c eliminate string-from-state function for view specs - we will be doing everything via the cfg tree; clean up & fix view titles for all of the different visualizer circumstances; do general path for serializing cfg trees for each view 2024-08-26 11:26:34 -07:00
Ryan Fleury 14f617db85 begin eliminating separate hook system for view rule uis; shift over to regular views, so there is just one codepath for all visualizers; move ui to event pump system, with permissions stack, so that callers of sub-ui-codepaths can mask off event consumption as needed 2024-08-26 09:56:47 -07:00
Ryan Fleury 74471e4b8d fix tab title rules; fix watch keyboard navigation with new dynamic columns 2024-08-26 06:12:42 -07:00
Ryan Fleury 43eac9f332 add entity labels to macro map 2024-08-23 16:28:09 -07:00
Ryan Fleury 729a4aa1f9 first step to collapsing separate view parameterization path, and just having views be parameterized by evaluation strings 2024-08-23 16:17:19 -07:00
Ryan Fleury e395ef42a1 eval system syntax for opaque id evaluations 2024-08-23 14:45:48 -07:00
Ryan Fleury 8ae8e2f943 extend file streaming cache to support range-based file stream queries; begin plugging in file stream queries as alternative to ctrl stream queries; further bugfixes & unification in eval system 2024-08-23 12:29:52 -07:00
Ryan Fleury ff922fa087 fix expandability/block/row building for block ui view rules 2024-08-22 17:11:12 -07:00
Ryan Fleury 47462f4789 first pass at filesystem evaluation in eval system 2024-08-22 16:55:07 -07:00
Ryan Fleury 341f9c6cf7 introduce resolution qualifiers to evaluation syntax, to specifically denote resolution to registers, locals, types, etc., or file paths 2024-08-22 15:56:43 -07:00
Ryan Fleury b7cc2e8d93 entity evaluation committing; checkbox view rule; per-column view rules in watch views 2024-08-22 15:28:13 -07:00
Ryan Fleury acd7435553 collapse register mode into being a thread space, unify process/thread/debugger read/write paths, keep differences in core eval read/write paths 2024-08-22 14:50:27 -07:00
Ryan Fleury a7cf64d5e2 extend watch view column parameterization; further progress on replacing entity views with watch views 2024-08-22 12:01:53 -07:00
Ryan Fleury 1848acd47e eliminate eval assumption of single architecture; equip each eval module with an architecture; use to correctly specify the debugger process architecture; do initial pass of debugger space evaluation 2024-08-21 12:55:50 -07:00
Ryan Fleury 1ec62b40ae reverse decision to show inheritance type prefix in member names, because I forgot that C++ STL / other codebase types are completely insane; go back to showing inheritance info as a tooltip 2024-08-21 11:24:52 -07:00
Ryan Fleury 70fa90bb87 fix incorrect os_window_first_paint rules 2024-08-20 17:07:59 -07:00
Ryan Fleury c77d61fb4c ellipses for unfinished arrays/structs in eval single-line visualization 2024-08-20 16:33:08 -07:00
Ryan Fleury 4611ddb536 eval value array indexing; type-only evaluation of array indexing and member accesses; various fixes 2024-08-20 16:13:01 -07:00
Ryan Fleury 156a94b286 string/char literal escaping in eval 2024-08-20 14:57:23 -07:00
Ryan Fleury b5b6f61811 fix various edge cases in visualizer paths 2024-08-20 14:48:25 -07:00
Ryan Fleury 67a719f2c6 fix parse error visualization; fix invalid cases in eval expression parser 2024-08-20 14:12:40 -07:00
Ryan Fleury c896d05afc relocate entity; fix incorrect eval mode for procedures view; fix incorrect evaluation of callstack frames in new callstack view 2024-08-20 13:53:54 -07:00
Ryan Fleury b44a5db97f further progress on cleaned up eval watch system; visual fixes/improvements in hover eval 2024-08-20 13:41:36 -07:00
Ryan Fleury 408b689245 eliminate old eval/eval-viz paths 2024-08-20 12:06:02 -07:00
Ryan Fleury 639239d758 convert all eval visualization paths to incrementally building expression trees, rather than using final eval bundles; ensure all evaluation paths, in various circumstances (single line viz, row viz), go through exactly the same path; deduplicate single-row-expr evaluation paths 2024-08-20 12:04:23 -07:00
Ryan Fleury be2daf570a checkpoint on eval / eval-viz simplification pass 2024-08-19 11:26:28 -07:00
Ryan Fleury 9f593f9971 callstack frame selection in watch views 2024-08-16 16:17:50 -07:00
Ryan Fleury 04b38eb405 more progress on new expanded watch path; mostly feature convergent for procedures & callstack 2024-08-16 15:28:16 -07:00
Ryan Fleury 2d1adaf932 watch view feature parity for error visualization 2024-08-16 13:00:02 -07:00
Ryan Fleury d749a5e965 progress on single path for building all cells in watch window, reaching feature parity with old watch windows 2024-08-16 12:49:35 -07:00
Ryan Fleury 25f30f6a72 begin pass to make watch view columns dynamic; will use to specialize watch views for the new expanded set of purposes it has 2024-08-16 11:49:10 -07:00
Ryan Fleury 6bdaf9b4df plug watch pins into new watch-driven ui 2024-08-15 15:12:58 -07:00
Ryan Fleury 82fcc9ed4d evaluate breakpoints in per-breakpoint space, rather than a top-level space for all of the debugger entities 2024-08-15 14:57:16 -07:00
Ryan Fleury 01cf3d39f1 further progress on using the upgraded eval system; sketch out replacement breakpoints & callstack views, which are just specializations of watch window 2024-08-15 14:34:47 -07:00
Ryan Fleury 8b5be64507 fix primary module selection in multi-process scenarios 2024-08-15 12:23:08 -07:00
Ryan Fleury 20bde07c46 fix ir generation for set-space opcode 2024-08-15 12:16:00 -07:00
Ryan Fleury b98a75e056 switch eval memory reads -> more generalized space reads; apply to register reads as well 2024-08-15 11:55:22 -07:00
Ryan Fleury 59c01a73af pipe through space information through eval compiler/interpreter 2024-08-15 11:21:52 -07:00
Ryan Fleury a0d91862a7 bundle per-module info in eval system; use all modules in all processes in ctrl layer evaluations; further sketching out of space info 2024-08-15 10:04:52 -07:00
Ryan Fleury ed75b253f7 notes on 'eval space'; first step to evaluating debugger-space things 2024-08-14 16:26:47 -07:00
Ryan Fleury 857bf44001 converge watch pin / breakpoint commands & mapping, without file entity structure 2024-08-14 15:41:18 -07:00
Ryan Fleury 94791e62ff eliminate old serialization/deserialization paths 2024-08-14 15:27:36 -07:00
Ryan Fleury 52f4474cc8 legacy config exe key for targets 2024-08-14 15:27:01 -07:00
Ryan Fleury 4a2aaf650a add legacy config deserialization paths, for old config files 2024-08-14 15:25:11 -07:00
Ryan Fleury bb9e5057d7 fix go-to-location path to adjust for no file entities; write single deserialization path for all entities, instead of handwritten special casedo nes 2024-08-14 15:08:48 -07:00
Ryan Fleury 33fe9ba485 formally support hresult codes as distinct from handles in debug info & visualization 2024-08-14 13:48:09 -07:00
Ryan Fleury a9f4a11c0a fix run-to-line and run-to-address for new breakpoint entity setup 2024-08-14 12:39:34 -07:00
Ryan Fleury afdb0e5b2e remove addr-mode assumption for string visualizing; eliminate entity deleted flag 2024-08-14 12:26:53 -07:00
Ryan Fleury 728120690d ptr/array-value comparison path in eval 2024-08-14 11:29:45 -07:00
Ryan Fleury 918895c091 small string evaluation; strings as values in eval 2024-08-14 10:49:56 -07:00
Ryan Fleury eac1672c4e begin sketching out eval paths for small string operations 2024-08-13 16:16:55 -07:00
Ryan Fleury 07c4e6ee87 evaluation compiler debug tooltip visualizer 2024-08-13 15:41:01 -07:00
Ryan Fleury c64d207d4d finish sketching out complex synthetic type construction; tear out unneeded leaf external evaluation (we can just use the macro map & separate address spaces); sketch out scaffolding for a thread evaluation type 2024-08-13 13:40:14 -07:00
Ryan Fleury a1605acb7b correct procedural struct/union byte size calculation in eval types 2024-08-13 13:07:13 -07:00
Ryan Fleury 0eff5aca06 extend constructed types in eval system to support procedural construction of structs/unions/enums; can be used for synthetic evals in debugger frontend & ctrl layer 2024-08-13 13:04:05 -07:00
Ryan Fleury 6d30455e76 further progress on eliminating file entities; further entity simplification; set up external identifier resolution map for evaluating 'meta' variables; sketch out generalized entity serialization path 2024-08-13 11:39:25 -07:00
Ryan Fleury 057d4d485e begin entity simplification pass; begin eliminating frontend file system entity cache; build new path-based file override systems, instead of relying on the entity tree 2024-08-12 17:06:59 -07:00
Ryan Fleury 86f45ce5e7 do not assume valid identifier maps if location info is not present 2024-08-12 09:26:44 -07:00
Ryan Fleury 77edf0d8da further progress on undo 2024-08-09 12:11:14 -07:00
Ryan Fleury e506d8389c strip out old undo/redo scaffolding 2024-08-09 10:19:29 -07:00
Ryan Fleury a541ca50d9 rdi_from_pdb: robustify to malformed/unexpected pdb characteristics; df: display errors with inline code better; eval: fix incorrect assumption of addr mode being required for member access operators 2024-08-09 09:27:18 -07:00
Ryan Fleury eda3d6f8b5 fix incorrect assumption of 0 slot -> primary rdi; fixes mistyped locals 2024-08-08 15:56:38 -07:00
Ryan Fleury 896f84369b ues correct unwound registers for eval context 2024-08-08 15:32:18 -07:00
Ryan Fleury 18237a1464 eliminate old architecture info tables 2024-08-07 16:48:20 -07:00
Ryan Fleury 6563cb9e2c split command lister-omission to being either included in ui lists, and included in lower level ipc driving documentation 2024-08-07 15:17:27 -07:00
Ryan Fleury 6a886e096e fix ternary operators in eval; fix incorrect oplist concatentation path 2024-08-07 13:10:41 -07:00
Ryan Fleury 607442b92a fix member lookup rules in new eval ir tree builder 2024-08-07 08:22:22 -07:00
Ryan Fleury fee31daa55 fix system processes lister 2024-08-06 15:08:41 -07:00
Ryan Fleury 44fb75228a fix incorrect symbol name font in symbol lister tooltips 2024-08-06 14:12:18 -07:00
Ryan Fleury ba095129e6 fix incorrect index space usage in debug-info-wide tables 2024-08-06 14:05:39 -07:00
Ryan Fleury a4978e75a3 eliminate separate helper for eval viz block list building 2024-08-06 14:01:30 -07:00
Ryan Fleury 5a682e5888 split eval systems, to decouple types/exprs/parsing (debug info dependent), from irization (macro map dependent), from interpretation (completely independent of the former two stages & all their dependencies) 2024-08-06 13:57:48 -07:00
Ryan Fleury c1cea82ae7 eliminate old eval/type-graph layers 2024-08-06 10:20:37 -07:00
Ryan Fleury e951d788ed fix watch window snap to cursor; begin introducing string literals into eval 2024-08-06 10:19:10 -07:00
Ryan Fleury 615a05e423 fix watch window snap-to-cursor rules; fix eval path for command parameter filling 2024-08-06 09:22:03 -07:00
Ryan Fleury 24d398e3c0 fix resolution to address value in array case; reintroduce macro map building (but this time it is frontend-wide rather than locked to a watch window) 2024-08-06 08:58:30 -07:00
Ryan Fleury 26f75fe7c1 shift watch view expressions from being a watch view implementation detail to being a top-level entity 2024-08-06 08:39:52 -07:00
Ryan Fleury 784a77bdff be a bit more forgiving in eval interpreter, to allow for graceful type (and thus empty bytecode) evaluation 2024-08-06 07:15:03 -07:00
Ryan Fleury ebaf83172f eliminate mid-frame calls into full update step via os_window_first_paint; pull up outside regular frontend frame boundaries; fixes incorrect per-frame dbgi scope usage 2024-08-06 07:07:44 -07:00
Ryan Fleury 3e6b8a3c66 first pass at converting frontend over to using new eval system 2024-08-05 17:05:43 -07:00
Ryan Fleury ba45dd161d complete eval2 first pass 2024-07-30 13:50:27 -07:00
Ryan Fleury d2c363ada2 eval2; ir tree compiler pass, type operations pass 2024-07-30 13:40:24 -07:00
Ryan Fleury 87b9b833d1 multi-module eval; new eval vm 2024-07-29 16:40:36 -07:00
Ryan Fleury ff90223dcb multi-module eval: type graph; eval parser 2024-07-29 16:23:13 -07:00
Ryan Fleury 3a61a0363b fix built exes to refer to their pdbs relatively, so that relocated builds can still locate pdbs relatively; eliminate old unused targets; simplify project.4coder 2024-07-29 11:38:15 -07:00
Ryan Fleury 6bef60b306 begin sketching out new eval layer upgrade, to support (a) many modules, (b) string operations, (c) many address spaces (?) 2024-07-26 16:56:21 -07:00
Ryan Fleury 23da2f8901 always serialize tab filters, if filtering is possible 2024-07-26 16:13:26 -07:00
Ryan Fleury 361be3f6e8 actually fix clang 2024-07-26 15:02:41 -07:00
Ryan Fleury f7dd96a5d1 fix clang 2024-07-26 14:58:17 -07:00
Ryan Fleury 333d9d9eb3 strip out unneeded info from df entities; raddbg_markup windows thread names 2024-07-26 14:52:11 -07:00
Ryan Fleury e80dc54aa7 fix inline frame snapping rules 2024-07-26 12:08:21 -07:00
Ryan Fleury 78d07b8d80 up-one-frame & down-one-frame commands for new rich unwind structure 2024-07-26 11:45:10 -07:00
Ryan Fleury e637ffa523 fix incorrect inline depth check 2024-07-26 11:24:08 -07:00
Ryan Fleury b18e437337 git normalize all files 2024-07-26 11:13:47 -07:00
Ryan Fleury c13833f74f fix line info voff baking; default selected inline frame depth to being shallowest; rework rich unwind to not lose concrete/inline frame structured info 2024-07-26 11:09:55 -07:00
Ryan Fleury 1d87c34dca fix big growth path in arena; make rdi parse code slightly more robust to malformed rdis 2024-07-26 08:37:13 -07:00
Ryan Fleury 1f89d4de9e do not overly-ambitiously hold debug info access scopes in ctrl thread run loop 2024-07-25 10:40:35 -07:00
Ryan Fleury b555655f3a fix incorrect chain size computation in new arena push implementation 2024-07-25 10:33:40 -07:00
Ryan Fleury e48baf9666 begin some work on extending rich hovering; working towards correllating rich hover info from everywhere, to everywhere; memory view <-> source view <-> bitmap viewer <-> watch window <-> etc. 2024-07-23 17:15:00 -07:00
Ryan Fleury ccf8504dd1 switch ctrl flow analysis etc. to zydis from udis86; unify disassembling path in dasm_cache layer, use single instruction decode path in frontend for ctrl flow analysis; use in dasm cache layer for disassembly textualization 2024-07-23 16:23:29 -07:00
Ryan Fleury 926b5e3546 apply linux notes from martins; simplify build.sh; simplify some linux layer code; fix incorrect linux api usage; get gcc builds up and running 2024-07-23 14:31:10 -07:00
Ryan Fleury e0b67f0ecb initial integration of zydis into dasm cache layer 2024-07-23 14:30:26 -07:00
Ryan Fleury 72c940d2b3 project.4coder 2024-07-23 08:45:10 -07:00
Nikita e18e136f82 fixed line number binary search for last range in line number map 2024-07-23 08:44:08 -07:00
Martins Mozeiko ce7c8d5244 avx512 registers & fixes for getting & setting x64 context 2024-07-23 08:43:35 -07:00
Henry Goschütz 14759e49e9 Fixed a typo. 2024-07-23 08:33:33 -07:00
Ryan Fleury d143fec0d1 fix mmap error case 2024-07-18 14:45:16 -07:00
Ryan Fleury 4835264059 stub out linux demon; linux font provider; begin work, get windows/events up and running in os_gfx 2024-07-18 13:37:22 -07:00
Ryan Fleury ec9c68f55e start work on raddbg building 2024-07-16 17:23:08 -07:00
Ryan Fleury de131b0c18 add rdi_dump to build.sh 2024-07-16 16:51:20 -07:00
Ryan Fleury fdd6c20c78 add cli utilities to build.sh 2024-07-16 16:49:49 -07:00
Ryan Fleury d5338c05f2 os_core: fix file tree iteration 2024-07-16 16:44:05 -07:00
Ryan Fleury d0d9327236 update metagen base/os & entry point 2024-07-16 16:09:53 -07:00
Ryan Fleury d82b54597f os_core: linux port of condition variables 2024-07-16 16:01:23 -07:00
Ryan Fleury 90065e535f os_core: linux port for shared memory, system info, process info, safe call, guid, mutexes, threads 2024-07-16 15:25:19 -07:00
Ryan Fleury b3f69f30ad os_core: linux port for file maps, file iters 2024-07-16 14:11:37 -07:00
Ryan Fleury 3cc51038df os_core: linux port for memory, thread info, filesystem apis 2024-07-16 13:24:54 -07:00
Ryan Fleury 1b74fb0760 simplification pass over os core layer; simplification pass over base arena; set up build.sh; stub out new spot for linux os core 2024-07-15 17:23:01 -07:00
Ryan Fleury 6447a2a993 notes 2024-07-15 10:41:03 -07:00
Ryan Fleury 2539e2ef45 full pass over ui to centralize text rasterization settings by font slot 2024-07-15 10:40:42 -07:00
Ryan Fleury 45656194f4 fix some text spacing issues after text rendering pass 2024-07-15 09:55:30 -07:00
Ryan Fleury 3bb8dc9089 adjust hover eval focus rules; require manual interaction to focus 2024-07-15 09:39:56 -07:00
Ryan Fleury ebbf927fc1 fix interaction register propagation rules on unfocused windows (still propagate if window was last focused) 2024-07-15 09:28:12 -07:00
Ryan Fleury 044e78bea2 fix incorrect scratch usage in new code view ui build path 2024-07-15 09:07:02 -07:00
Ryan Fleury d78afc5000 reintroduce out-of-date file warning 2024-07-04 09:56:44 -07:00
Ryan Fleury aed9a285f5 fix misuse of inactive panel overlay 2024-07-02 16:07:29 -07:00
Ryan Fleury f03d0fb974 correctly apply deserialized window settings 2024-06-28 17:36:44 -07:00
Ryan Fleury 80690d7b20 notes 2024-06-28 16:07:39 -07:00
Ryan Fleury 843749c8ae ui for editing multiple keybindings per command 2024-06-28 16:07:05 -07:00
Ryan Fleury 38090b6273 extend font provider backend with ability to independently toggle hinting & full anti-aliasing; fix up ui text measurement/placement; introduce per-window settings for adjusting font rendering parameters 2024-06-28 15:31:27 -07:00
Ryan Fleury b0259b7a49 visual cleanup / fixes 2024-06-28 09:47:55 -07:00
Ryan Fleury f7b97b302f fix visual issues in completion behavior of autocomplete lister 2024-06-28 09:42:38 -07:00
Ryan Fleury f2a7103461 watch-expr-at-mouse command 2024-06-28 09:14:58 -07:00
Ryan Fleury d1c0bf5fe2 fix add-tab button corners/placement with max-side tabs 2024-06-28 09:02:08 -07:00
Ryan Fleury 8ca67ff892 fix possible incorrect panel being used in commands fired from tab right-click menu 2024-06-27 14:24:45 -07:00
Ryan Fleury 13aa41910e default settings categories to closed 2024-06-27 13:17:44 -07:00
Ryan Fleury c05ceedfcb fix clang build 2024-06-26 18:12:27 -07:00
Ryan Fleury 5e093a9b4c notes 2024-06-26 17:54:54 -07:00
Ryan Fleury 08bc2b0a79 fix up color config remapping table 2024-06-26 17:48:28 -07:00
Ryan Fleury 4ebc38d9f9 fill theme presets for new theme color codes 2024-06-26 17:39:40 -07:00
Ryan Fleury 5e2c6b5107 setting view categories 2024-06-26 15:47:28 -07:00
Ryan Fleury 7584890edd theme presets in new settings view 2024-06-26 15:16:41 -07:00
Ryan Fleury 4bbf64de7e first pass at new settings view 2024-06-26 15:00:45 -07:00
Ryan Fleury e10bef9d2b fix function breakpoints using hit-count as voff; pass over entity ref buttons in various uis; go-to-location with address values in watch views 2024-06-26 12:05:56 -07:00
Ryan Fleury 1229a50c68 eliminate txti layer 2024-06-26 11:09:58 -07:00
Ryan Fleury 6e2353d302 eliminate margin from output 2024-06-26 11:01:51 -07:00
Ryan Fleury 3d272a598b complete convergence of new disasm view, which uses the core code view path 2024-06-26 10:57:49 -07:00
Ryan Fleury dbdf6e7c02 eliminate old duplicative disasm path; use same code view path 2024-06-26 10:44:24 -07:00
Ryan Fleury 0904de74de eliminate old duplicative code/output views 2024-06-26 10:07:26 -07:00
Ryan Fleury e3077cf6f5 pick-file path for new code view 2024-06-26 10:06:16 -07:00
Ryan Fleury 9ad52d25b5 more progress on top-level interaction-register-based cursor commands, getting more out of unified source view 2024-06-26 10:02:26 -07:00
Ryan Fleury c2ddffd424 set up interaction register push/pops for windows & views; use to implement top-level cursor-breakpoint operations; more convergence with new unified src view path 2024-06-26 09:21:51 -07:00
Ryan Fleury 7d351d03c5 txt: split symbol tokens in language lexers to defaultly do single-char symbols unless in special cases; this resolves weird indirection-size-change code label displays 2024-06-26 07:37:52 -07:00
Ryan Fleury 2e12b1485a some light mode fixes, light mode theme preset re-filled 2024-06-25 17:53:39 -07:00
Ryan Fleury 653eb08d43 set up interaction register stack 2024-06-25 17:21:59 -07:00
Ryan Fleury 9be3c2affc sketch out 'interaction registers'; fix bp hit count tracking 2024-06-25 17:02:43 -07:00
Ryan Fleury 6fa8af5e1a checkpoint on unified code ctx menu & all of its operations 2024-06-25 16:31:31 -07:00
Ryan Fleury 010d5609c6 checkpoint in first pass at new unified code view impl.; start setting up unified top-level code ctx menu 2024-06-25 12:00:50 -07:00
Ryan Fleury d12c5ec2e8 first pass at mutable text layer, which allows debugger-produced/controlled buffers to be fed into text visualization systems; start pulling out code view into single path, which will be used for disassembly/source/output 2024-06-25 11:09:02 -07:00
Ryan Fleury c10ac170a8 config settings, for top-level toggles or simple numeric parameters; use to mask off animations, background blurs, and so on; use to control tab width 2024-06-25 09:09:10 -07:00
Ryan Fleury 7a185f9560 auto-fill ctrl+f query from selection; fix single-cell copy/paste in watch views; tweaks/fixes 2024-06-25 08:04:00 -07:00
Ryan Fleury 0d581694e6 notes; tweaks; fixes 2024-06-24 16:35:23 -07:00
Ryan Fleury b4b8f5f0ab fix some escape-to-cancel & context menu behavior; notes 2024-06-24 16:14:06 -07:00
Ryan Fleury 15d42027e7 adjust memory view for new ui palettes & themes 2024-06-24 15:39:12 -07:00
Ryan Fleury 883aa2d1de fix binding ui interaction with group keys 2024-06-24 15:34:56 -07:00
Ryan Fleury 586b3e3072 fix incorrect margin measurement in output view 2024-06-24 15:32:50 -07:00
Ryan Fleury 2588bbcd12 notes 2024-06-24 15:25:22 -07:00
Ryan Fleury 0a5cc5df6f ui: group key, for menu-bar-style interactions, where you have several distinct boxes, but want one interaction to continuously flow between them 2024-06-24 15:23:56 -07:00
Ryan Fleury ff32449ba2 adjust rich hover info in source/disasm view to be less noisy; require hovering over line number margin, rather than always displaying it for whatever line the mouse is over 2024-06-24 15:14:13 -07:00
Ryan Fleury 614954b7ef checkpoint on palettes, fix source view overlay margin building/drawing 2024-06-24 14:46:16 -07:00
Ryan Fleury 31c671e3f5 more progress on simplifying/condensing new theme colors 2024-06-24 14:08:28 -07:00
Ryan Fleury 6d75d6b63b simplification/consolidation pass over theme colors 2024-06-24 11:59:19 -07:00
Ryan Fleury 4d2b524400 notes, ui pass tweaks 2024-06-23 23:21:18 -07:00
Ryan Fleury 16863b1f5a fix run-list size calculation, accounting for advance vs. end pad 2024-06-22 20:29:38 -07:00
Ryan Fleury f9abb397f3 adjust px offset -> byte offset path for new text measuring fixes 2024-06-22 20:19:24 -07:00
Ryan Fleury db5a7d4be2 adjust title bar 2024-06-22 16:12:53 -07:00
Ryan Fleury 6ac870dac0 improvements in text layout, focus visualization, smooth text rasterization for icons; checkpoint in ui visuals pass 2024-06-22 15:58:40 -07:00
Ryan Fleury 5f23820f9d checkpoint on ui/palettes/visuals pass 2024-06-21 22:06:40 -07:00
Ryan Fleury fc77844452 color scheme -> palette; fix eval/watch views after cleanup; make more progress on new palette system 2024-06-21 09:49:51 -07:00
Ryan Fleury 3b27abd5c7 first pass at new theme color table, scheme-based ui color specification 2024-06-20 15:28:48 -07:00
Ryan Fleury ce1f54a931 notes 2024-06-20 09:06:35 -07:00
Ryan Fleury c60d3aab22 mouse-driven ui path for query completion; show-in-explorer ui for tab ctx menu 2024-06-20 08:02:01 -07:00
Ryan Fleury b76c605eba sort locals by debug info order; still likely not sufficient for all the options, but at least marginally better & introduces the sorting path 2024-06-20 07:35:59 -07:00
Ryan Fleury 6eef8c3e16 rdi_format_parse: prefer line info idxs with file coordinates in line mapping helper 2024-06-19 13:27:34 -07:00
Ryan Fleury b5b5aca691 log win32 demon resume code 2024-06-19 12:07:08 -07:00
Ryan Fleury 435877824a oh NO... never mind... mystery solved... be VERY CAREFUL ABOUT STATE MACHINES! fixes incorrect non-resets of win32 demon 'exception not handled' state, which was buggily leading to DBG_EXCEPTION_NOT_HANDLED being passed to ContinueDebugEvent 2024-06-19 11:56:47 -07:00
Ryan Fleury 3327d73373 notes on memory-execution-exception spoof implementation situation, and toggles to switch to old behavior, for later investigation 2024-06-19 11:32:44 -07:00
Ryan Fleury 376a7c48a5 pass over logging, include a lot of extra info in ctrl thread log; demon abstraction for target-process memory allocation/protection; switch spoofs to being in allocated page, rather than at bogus address 2024-06-19 11:12:21 -07:00
Ryan Fleury f6eec680bc adjust single stepping rule to be robust to non-single-step events; this is still not what the issue is pertaining to the stepping bug... 2024-06-18 17:19:17 -07:00
Ryan Fleury 41fd224956 log ctrl events on user thread; do not use cached register block reading path for ctrl stepping machine, as it must not prematurely update cache for all readers, since runs are not complete 2024-06-18 12:07:46 -07:00
Ryan Fleury c794d896c9 oops - fix logging for trap net 2024-06-18 10:59:35 -07:00
Ryan Fleury 1a8b39ad9d fix builds github workflow for new build names 2024-06-18 10:56:41 -07:00
Ryan Fleury a8891b3ca4 fix rdi_from_dwarf build 2024-06-18 10:55:54 -07:00
Ryan Fleury ada1b8dfe2 log final trap net 2024-06-18 10:51:29 -07:00
Ryan Fleury 9461e79268 adjust build script to warn if valid build target was not specified 2024-06-18 10:46:50 -07:00
Ryan Fleury 4fc5b61676 also disable overly-ambitious cursor centering in memory view 2024-06-18 10:28:49 -07:00
Ryan Fleury 6cc1dfb39a trap net generation logging; log markers 2024-06-18 10:14:54 -07:00
Ryan Fleury d44f098e84 disallow override detection with nil overrides 2024-06-17 13:06:23 -07:00
Ryan Fleury 749821dd27 adjust unwind loop to be robust to noop-unwind-steps that would otherwise result in infinite unwind loops 2024-06-17 12:14:10 -07:00
Ryan Fleury 6ad94978ce correctly adjust dbgi timestamp in ctrl entity store, upon debug info changes 2024-06-17 10:55:17 -07:00
Ryan Fleury bc5d0b1888 fix rich hover reset behavior 2024-06-17 10:18:41 -07:00
Ryan Fleury 3c2c98b08a rdi_make: fix incorrect line table count calculation 2024-06-17 10:08:11 -07:00
Ryan Fleury 31d7be8f8a tweak snap-to-cursor behavior when dragging 2024-06-17 09:42:12 -07:00
Ryan Fleury 0b3e3228d1 rdi_from_pdb: fix incorrect bounds checks on procedure frameproc lookup for local location info 2024-06-17 09:34:27 -07:00
Ryan Fleury 794f212501 dasm address consistency 2024-06-14 14:17:26 -07:00
Ryan Fleury 723c7c5d4d further tightening up of win32 demon run path; take a few fastpaths on x64; speeds up conditional breakpoints 2024-06-14 09:50:33 -07:00
Ryan Fleury fb9824dc24 remove unnecessary ctrl log flushes, which seriously bloated the ctrl thread running path 2024-06-14 07:57:46 -07:00
Ryan Fleury 933b4c90de fix rdi_format_parse and rdi_breakpad_from_pdb build 2024-06-13 17:12:31 -07:00
Ryan Fleury 5349838633 rdi: producer name in top-level-info 2024-06-13 16:55:47 -07:00
Ryan Fleury f655758060 extend tooltips & stringization of callstacks with rich unwind info 2024-06-13 16:48:27 -07:00
Ryan Fleury fa4d0bc262 ctrl: break debug string events apart if needed; enforce size cap on serialized ctrl events 2024-06-13 16:24:54 -07:00
Ryan Fleury 3c39a88abf correctly transform saved relative project paths to absolute project paths on config deserialization 2024-06-13 15:52:11 -07:00
Ryan Fleury fb6689a74d always report debug string events earlier in queue 2024-06-13 15:28:56 -07:00
Ryan Fleury a5e29f65f6 Merge branch 'inline_merge' of https://github.com/EpicGamesExt/raddebugger into inline_merge 2024-06-13 15:20:35 -07:00
Ryan Fleury b6f50cc4be intersect line voff ranges across all overlapping line tables when mapping voffs to line info; fixes inline stepping 2024-06-13 15:18:29 -07:00
Ryan Fleury b47b22bdce correct thread -> src mapping, given inline info 2024-06-13 15:18:29 -07:00
Ryan Fleury 41e99bd2f6 proper inline frame unwind selection & storage & command parameterization 2024-06-13 15:18:29 -07:00
Ryan Fleury 2c7d15de59 pull out 'rich unwind' gathering path, which takes a 'concrete unwind'
and produces a full unwind with debug-info-derived inline frames
2024-06-13 15:18:29 -07:00
Ryan Fleury bf2d5640fa go back to per-inline-site line tables; eliminate call location for inline tables; these can be encoded via parent line tables; wire up parsed line tables to inline site production from symbol conversion phase 2024-06-13 15:18:29 -07:00
Ryan Fleury 1880eca295 do not assume non-empty name map bakes 2024-06-13 15:18:29 -07:00
Ryan Fleury 59a20a5574 fix missing line chunks in inline line table parsing 2024-06-13 15:18:29 -07:00
Ryan Fleury 852ff5f054 oops! 2024-06-13 15:18:29 -07:00
Ryan Fleury ac3d7be4de look up into inline site info in call stack view; display both concrete & inline frames 2024-06-13 15:18:29 -07:00
Ryan Fleury 07b56a920c parse inline site scope ranges in symbol conversion pass 2024-06-13 15:18:29 -07:00
Ryan Fleury 1cc829512f fix disasm cmd/ui discrepancy 2024-06-13 15:18:29 -07:00
Ryan Fleury dafbe32e85 adjust line info lookup apis to be range-based, with a first-and-shallowest-only helper 2024-06-13 15:18:29 -07:00
Ryan Fleury 2419a00b11 fix cases where decorative disasm lines were being confused with non-decorative 2024-06-13 15:18:29 -07:00
Ryan Fleury 6e9b2bd107 extend rdi line info lookups with depth; fix bad panel deref in target view cmds 2024-06-13 15:18:29 -07:00
Ryan Fleury 123232ab32 correctly apply procedure base voffs in inline line info parsing 2024-06-13 15:18:29 -07:00
Ryan Fleury 1dbc37fe1f eliminate per-inline-site line tables; merge inline site line info with unit's line table 2024-06-13 15:18:29 -07:00
Ryan Fleury 4c10967cec merged line table sort experiments 2024-06-13 15:18:29 -07:00
Ryan Fleury e543abd478 rdi_from_pdb: next checkpoint on inline line table parsing/conversion 2024-06-13 15:18:29 -07:00
Ryan Fleury 3b94fa55fb rdi_from_pdb: inline binary annotations parsing 2024-06-13 15:18:29 -07:00
Ryan Fleury 3b6d8cb761 rdi_from_pdb: sketch out unified inlinee parsing/gathering path in units conversion task 2024-06-13 15:18:29 -07:00
Ryan Fleury a73cde2864 codeview c13 inlinee lines info parsing, lookup in inline site parsing path 2024-06-13 15:18:29 -07:00
Ryan Fleury fe12f2fdf9 inline site info extraction 2024-06-13 15:18:29 -07:00
Ryan Fleury c80555c49d rdi_make, rdi_from_pdb, rdi_dump: sketch out the building (no parsing/filling yet), dumping, and baking/serializing of inline sites 2024-06-13 15:18:29 -07:00
Ryan Fleury a3f411ddd4 more progress on rdi parsing library high-level composite helpers; update breakpad_from_pdb to new format/maker changes 2024-06-13 15:18:29 -07:00
Ryan Fleury 084cabad39 pass over high level composite rdi parsing helpers 2024-06-13 15:18:29 -07:00
Ryan Fleury 64d7bae845 rdi_make: eliminate old baking/serializing code 2024-06-13 15:18:29 -07:00
Ryan Fleury 93d5bab41c eliminate base node idx from per-node info; nodes can be stored all relative to their name map's base indices, and this is naturally applied on lookup, no need to bake it in 2024-06-13 15:18:29 -07:00
Ryan Fleury 772bc37504 fix fuzzy search layer for new table extraction code 2024-06-13 15:18:29 -07:00
Ryan Fleury 2ff0abb91e rdi_make, rdi_from_pdb: complete next pass over new serialization/compression interface, including for new top-level-only name map data sections; eliminate determinism issues from string map build (task dispatch was busted) 2024-06-13 15:18:28 -07:00
Ryan Fleury b05cfa4b24 checkpoint on new baking implementation 2024-06-13 15:18:28 -07:00
Ryan Fleury 379885421e rdi make: xfer over per-name-map building path 2024-06-13 15:18:28 -07:00
Ryan Fleury 809a888ce7 rdi make: first pass at new baking paths 2024-06-13 15:18:28 -07:00
Ryan Fleury 9dadd3ed3c sketch out new rdi make baking codepaths 2024-06-13 15:18:28 -07:00
Ryan Fleury d0d1e7d7e6 sketch out artifact types for new rdi baking pass 2024-06-13 15:18:28 -07:00
Ryan Fleury 10ead2f999 rdi: first pass of eliminating remainder of non-top-level sections; simplification/cleanup of rdi parsing layer 2024-06-13 15:18:28 -07:00
Ryan Fleury 550e8a0451 set up inline site info building scaffolding 2024-06-13 15:18:28 -07:00
Ryan Fleury 7495096e05 fix baking of joined line tables 2024-06-13 15:18:28 -07:00
Ryan Fleury 7e85335f3b move per-source-file line maps to top-level sections, and move source line -> voff maps to separate top-level info table 2024-06-13 15:18:28 -07:00
Ryan Fleury 3ad6197b88 eliminate old per-unit line info code 2024-06-13 15:18:28 -07:00
Ryan Fleury 81b45f1a2f do not broadcast unnecessarily in task system kickoff 2024-06-13 15:18:28 -07:00
Ryan Fleury 44868c0e85 rdi, rdi_make, rdi_from_pdb, rdi_dump, df, dasm, etc: extract line tables from per-unit data sections, have top-level line info tables with units referring to line tables, and line tables just referring to sub-ranges of top-level sections; fix off-by-one string index in rdi generation 2024-06-13 15:18:28 -07:00
Ryan Fleury f7ce1b73bc introduce separate rdi table element types for isolated line tables & inline sites 2024-06-13 15:18:28 -07:00
Ryan Fleury a4a0452d0c fix project.4coder 2024-06-13 15:18:28 -07:00
Ryan Fleury 45090de3fb appease clang 2024-06-13 15:18:28 -07:00
Ryan Fleury 6824ffddc0 intersect line voff ranges across all overlapping line tables when mapping voffs to line info; fixes inline stepping 2024-06-13 15:17:12 -07:00
Ryan Fleury dc34cdb59a correct thread -> src mapping, given inline info 2024-06-13 15:04:12 -07:00
Ryan Fleury 98290ff29b proper inline frame unwind selection & storage & command parameterization 2024-06-13 14:58:18 -07:00
Ryan Fleury 5a24649a31 pull out 'rich unwind' gathering path, which takes a 'concrete unwind'
and produces a full unwind with debug-info-derived inline frames
2024-06-13 11:28:38 -07:00
Ryan Fleury 97a96cfdd4 go back to per-inline-site line tables; eliminate call location for inline tables; these can be encoded via parent line tables; wire up parsed line tables to inline site production from symbol conversion phase 2024-06-13 10:41:19 -07:00
Ryan Fleury e25c3044b0 do not assume non-empty name map bakes 2024-06-10 15:59:19 -07:00
Ryan Fleury af80e1bfc8 fix missing line chunks in inline line table parsing 2024-06-10 15:42:50 -07:00
Ryan Fleury 6488e2d5e2 oops! 2024-06-10 15:26:02 -07:00
Ryan Fleury 649932cce0 look up into inline site info in call stack view; display both concrete & inline frames 2024-06-10 15:06:25 -07:00
Ryan Fleury dd5cc89483 parse inline site scope ranges in symbol conversion pass 2024-06-10 14:36:00 -07:00
Ryan Fleury 8a6837c553 fix disasm cmd/ui discrepancy 2024-06-10 13:33:32 -07:00
Ryan Fleury a009473557 adjust line info lookup apis to be range-based, with a first-and-shallowest-only helper 2024-06-10 13:28:08 -07:00
Ryan Fleury c18c02a37e fix cases where decorative disasm lines were being confused with non-decorative 2024-06-10 13:23:32 -07:00
Ryan Fleury c61f820aef extend rdi line info lookups with depth; fix bad panel deref in target view cmds 2024-06-10 12:34:22 -07:00
Ryan Fleury 5c8c1a89e3 correctly apply procedure base voffs in inline line info parsing 2024-06-10 11:35:31 -07:00
Ryan Fleury 61630f4cf9 eliminate per-inline-site line tables; merge inline site line info with unit's line table 2024-06-10 11:26:54 -07:00
Ryan Fleury 21b439e7e5 merged line table sort experiments 2024-06-10 11:12:21 -07:00
Ryan Fleury 4888f90f7f rdi_from_pdb: next checkpoint on inline line table parsing/conversion 2024-06-10 09:45:41 -07:00
Ryan Fleury 6f92fe971a rdi_from_pdb: inline binary annotations parsing 2024-06-10 09:18:05 -07:00
Ryan Fleury cfd2380caa rdi_from_pdb: sketch out unified inlinee parsing/gathering path in units conversion task 2024-06-07 17:22:45 -07:00
Ryan Fleury 07d56ee27c codeview c13 inlinee lines info parsing, lookup in inline site parsing path 2024-06-07 16:40:21 -07:00
Ryan Fleury 334bd3b06f inline site info extraction 2024-06-07 15:22:53 -07:00
Ryan Fleury a14a2f34f5 rdi_make, rdi_from_pdb, rdi_dump: sketch out the building (no parsing/filling yet), dumping, and baking/serializing of inline sites 2024-06-07 14:54:13 -07:00
Ryan Fleury 9dcb5a209a more progress on rdi parsing library high-level composite helpers; update breakpad_from_pdb to new format/maker changes 2024-06-07 13:45:26 -07:00
Ryan Fleury 300b14ffb4 pass over high level composite rdi parsing helpers 2024-06-07 11:45:18 -07:00
Ryan Fleury 8c63478d9b rdi_make: eliminate old baking/serializing code 2024-06-07 11:17:48 -07:00
Ryan Fleury 8f03fb0cc5 eliminate base node idx from per-node info; nodes can be stored all relative to their name map's base indices, and this is naturally applied on lookup, no need to bake it in 2024-06-07 11:17:11 -07:00
Ryan Fleury b48fcea28a fix fuzzy search layer for new table extraction code 2024-06-07 11:07:58 -07:00
Ryan Fleury 431884dce8 rdi_make, rdi_from_pdb: complete next pass over new serialization/compression interface, including for new top-level-only name map data sections; eliminate determinism issues from string map build (task dispatch was busted) 2024-06-07 11:03:00 -07:00
Ryan Fleury d931aed462 checkpoint on new baking implementation 2024-06-06 17:13:44 -07:00
Ryan Fleury 2c4c9e9d75 rdi make: xfer over per-name-map building path 2024-06-06 16:50:02 -07:00
Ryan Fleury 11978904e1 rdi make: first pass at new baking paths 2024-06-06 16:47:33 -07:00
Ryan Fleury 8d99f4859b sketch out new rdi make baking codepaths 2024-06-06 16:06:50 -07:00
Ryan Fleury 6e84c078a8 sketch out artifact types for new rdi baking pass 2024-06-06 15:37:27 -07:00
Ryan Fleury 14034c8bea rdi: first pass of eliminating remainder of non-top-level sections; simplification/cleanup of rdi parsing layer 2024-06-06 14:37:22 -07:00
Ryan Fleury 0a88e08dee Merge branch 'dev' of https://github.com/EpicGamesExt/raddebugger into inline_merge 2024-06-05 18:06:47 -07:00
Ryan Fleury c04a97f991 eval: fix enum type unwrapping; unwrap enum types on array indexing 2024-06-05 18:06:09 -07:00
Ryan Fleury 0b35224cf8 set up inline site info building scaffolding 2024-06-04 17:04:53 -07:00
Ryan Fleury 3f50169fee fix baking of joined line tables 2024-06-04 15:46:51 -07:00
Ryan Fleury ebd5cf9e47 move per-source-file line maps to top-level sections, and move source line -> voff maps to separate top-level info table 2024-06-04 13:33:38 -07:00
Ryan Fleury f7e67a80c9 eliminate old per-unit line info code 2024-06-03 16:45:33 -07:00
Ryan Fleury 063975693d do not broadcast unnecessarily in task system kickoff 2024-06-03 16:25:37 -07:00
Ryan Fleury 44fbbc24ee rdi, rdi_make, rdi_from_pdb, rdi_dump, df, dasm, etc: extract line tables from per-unit data sections, have top-level line info tables with units referring to line tables, and line tables just referring to sub-ranges of top-level sections; fix off-by-one string index in rdi generation 2024-06-03 15:32:14 -07:00
Ryan Fleury fcb839b788 introduce separate rdi table element types for isolated line tables & inline sites 2024-06-02 21:22:01 -07:00
Ryan Fleury 139d00e660 Merge branch 'dev' of https://github.com/EpicGamesExt/raddebugger into inline_merge 2024-06-02 18:24:30 -07:00
Ryan Fleury 41afe1af64 Merge branch 'dev' of https://github.com/EpicGamesExt/raddebugger 2024-06-02 18:23:38 -07:00
Ryan Fleury 3927d333ae remove unnecessary and sometimes unsupported win_noexcept keyword 2024-06-02 18:22:51 -07:00
Ryan Fleury 8438faca06 fix project.4coder 2024-06-01 21:09:44 -07:00
Ryan Fleury 061abb4545 appease clang 2024-06-01 21:09:36 -07:00
Ryan Fleury 011c980646 fix project.4coder 2024-06-01 21:09:10 -07:00
Ryan Fleury 26626c3946 appease clang 2024-06-01 21:09:06 -07:00
Ryan Fleury 281849b4e8 fix project.4coder 2024-06-01 21:06:28 -07:00
Ryan Fleury d3f7bef2b7 appease clang 2024-06-01 21:06:22 -07:00
Ryan Fleury ab5259a3d3 Merge branch 'inline_merge' of https://github.com/EpicGamesExt/raddebugger into inline_merge 2024-06-01 19:25:33 -07:00
Ryan Fleury 57da328c2a d3d11 render backend c++ -> c; raddbg build c++ -> c 2024-06-01 19:24:47 -07:00
Ryan Fleury ebc19ded62 font provider dwrite c++ -> c 2024-06-01 19:24:47 -07:00
Ryan Fleury aff3da8256 move font provider directwrite backend to using martins' auto-generated dwrite c declarations, get it almost off C++ entirely 2024-06-01 19:24:47 -07:00
Ryan Fleury c1764cee07 adjust builds to new rdi library setup 2024-06-01 19:24:46 -07:00
Ryan Fleury cc58703185 reorganize generated & handwritten library (relocatable) rad debug info format files; separate from codebase-local tools for managing or internally including the libraries 2024-06-01 19:24:46 -07:00
Ryan Fleury 6a57555882 lld no_aslr 2024-06-01 19:24:46 -07:00
Ryan Fleury cdf0b67354 clean up metaprogram multiline string line endings; fix rdi_from_pdb build 2024-06-01 19:24:46 -07:00
Ryan Fleury 45f69b6f98 further progress on metacode-driven generation of rdi headers; metaprogram xlist generation; getting rdi_dump up-to-speed 2024-06-01 19:24:46 -07:00
Ryan Fleury 47df50b6dc generation folder output override in metaprogram 2024-06-01 19:24:46 -07:00
Ryan Fleury f50b54cff7 complete metacodification of rdi format info into tables 2024-06-01 19:24:46 -07:00
Ryan Fleury 8492693df2 initial pass of moving rdi definitions to metacode tables 2024-06-01 19:24:45 -07:00
Nikita Smith 652a9b5cee codeview: inline binary annot format and decode helpers 2024-06-01 19:23:59 -07:00
Ryan Fleury 7f87f89aa8 rdi_dump: stringize source file's path 2024-06-01 19:22:30 -07:00
Nikita Smith 92b3356526 codeview: struct defs for $$INLINEE_LINES 2024-06-01 19:22:30 -07:00
Nikita Smith 98486f0795 codeview: new sub-section types 2024-06-01 19:22:29 -07:00
Ryan Fleury 729a5a9392 clean up & merge inline binary annotation decoders 2024-06-01 19:22:29 -07:00
Nikita Smith ffa802f583 codeview: inline binary annot format and decode helpers 2024-06-01 19:22:29 -07:00
Ryan Fleury b192e38d12 d3d11 render backend c++ -> c; raddbg build c++ -> c 2024-06-01 19:21:43 -07:00
Ryan Fleury 3c0831ec09 font provider dwrite c++ -> c 2024-06-01 18:21:29 -07:00
Ryan Fleury 02e1b8cf00 move font provider directwrite backend to using martins' auto-generated dwrite c declarations, get it almost off C++ entirely 2024-06-01 18:20:13 -07:00
Ryan Fleury 448baf68a8 adjust builds to new rdi library setup 2024-06-01 12:07:55 -07:00
Ryan Fleury 82c1badcdc reorganize generated & handwritten library (relocatable) rad debug info format files; separate from codebase-local tools for managing or internally including the libraries 2024-06-01 12:05:51 -07:00
Ryan Fleury 01a21af955 lld no_aslr 2024-06-01 11:57:44 -07:00
Ryan Fleury a8b02f9791 clean up metaprogram multiline string line endings; fix rdi_from_pdb build 2024-06-01 11:30:51 -07:00
Ryan Fleury 2c9a6f996d fix zero expression child nodes, commonly produced via partially typed expressions 2024-06-01 10:58:49 -07:00
Ryan Fleury d66bbdc6a7 further progress on metacode-driven generation of rdi headers; metaprogram xlist generation; getting rdi_dump up-to-speed 2024-06-01 10:16:38 -07:00
Ryan Fleury de56231f4a generation folder output override in metaprogram 2024-05-31 17:29:25 -07:00
Ryan Fleury 35c1c463c8 complete metacodification of rdi format info into tables 2024-05-31 17:16:54 -07:00
Ryan Fleury 59e71eb5cc drive iteration in win32 file system api; fix some root-level behaviors of file browser 2024-05-31 12:20:14 -07:00
Ryan Fleury d3adfdeced deduplicate debug string event generation; log ctrl messages 2024-05-31 11:17:59 -07:00
Ryan Fleury ed8731c093 correctly handle copy path in new multicursor-able watch view controls 2024-05-31 10:47:46 -07:00
Ryan Fleury 6d4b4b1526 time-based exit path for demon win32 event consumption loop, to not overly-aggressively-buffer things 2024-05-30 07:10:21 -07:00
Ryan Fleury 9fbcd1ec36 Merge branch 'dev' 2024-05-30 07:06:53 -07:00
Ryan Fleury da54fd1217 majorly improve outputdebugstring performance 2024-05-30 07:06:29 -07:00
Ryan Fleury 34bba95839 import todo notes from awkwardly aggressive user feedback 2024-05-29 21:25:47 -07:00
Ryan Fleury 89fd718a8c Merge branch 'dev' of https://github.com/EpicGamesExt/raddebugger into inline_merge 2024-05-29 12:35:49 -07:00
Ryan Fleury 89c8f84498 more tweaks with new double-margin; do not try to display non-printable ascii characters in watch 2024-05-29 12:25:03 -07:00
Ryan Fleury c426818364 draw line between priority & catchall marging 2024-05-29 11:53:48 -07:00
Ryan Fleury 62fa397e29 split code slice margin into two parts - priority, and catchall. priority for selected thread so it is always necessarily visible, and catchall for other threads, breakpoints, watch pins, etc. also tweak targets view behavior to prioritize selection as the common path, and to make checkboxes less idiosyncratic 2024-05-29 11:51:04 -07:00
Ryan Fleury 0e179f3844 fix clips, occlusion, for ui-tree-wide truncated text tooltips 2024-05-29 10:56:46 -07:00
Ryan Fleury f808e8ae29 adjust force-contain on tooltips; we don't want it for drag/drop, we do for tooltips, so use active interaction as a proxy 2024-05-29 10:43:14 -07:00
Ryan Fleury 8f446d1f9a pass over callstack view to display function type info and properly display richer/weirder C++ symbol names 2024-05-29 10:36:22 -07:00
Ryan Fleury e073ff3218 more notes on the multithreaded access violation stuff! 2024-05-29 08:31:24 -07:00
Ryan Fleury 2512d07c72 correctly roll-back late-hits for int3s 2024-05-29 08:08:44 -07:00
Ryan Fleury f65cf5436e fix code off -> instruction idx lookup - fixes busted instruction pointer drawing in disassembly view 2024-05-29 08:03:06 -07:00
Ryan Fleury 5778e75d66 oops - do not zero unwind cache node after adding it, zero it before adding it 2024-05-28 21:45:14 -07:00
Ryan Fleury 08750c2318 initial pass of moving rdi definitions to metacode tables 2024-05-28 21:31:56 -07:00
Ryan Fleury 9a5a3b9296 Merge remote-tracking branch 'refs/remotes/origin/inline_merge' into inline_merge 2024-05-28 07:41:31 -07:00
Ryan Fleury cab8bdaf38 rdi_dump: stringize source file's path 2024-05-28 07:37:19 -07:00
Nikita Smith afb7aba039 codeview: struct defs for $$INLINEE_LINES 2024-05-28 07:37:19 -07:00
Nikita Smith 0750570081 codeview: new sub-section types 2024-05-28 07:37:18 -07:00
Ryan Fleury 86a9934016 clean up & merge inline binary annotation decoders 2024-05-28 07:37:18 -07:00
Nikita Smith f14686c6fb codeview: inline binary annot format and decode helpers 2024-05-28 07:37:18 -07:00
Ryan Fleury e80008cb7e do not animate disasm load when running 2024-05-28 07:34:10 -07:00
Ryan Fleury 68d3f17ecb do not snap-to-thread on soft-halts 2024-05-28 07:30:54 -07:00
Ryan Fleury e541fce2bc fix non-enumeration of 0 tex2dfmt 2024-05-28 06:13:14 -07:00
Ryan Fleury 6a32c197fa rdi_dump: stringize source file's path 2024-05-28 06:10:43 -07:00
Nikita Smith eea3c6b53c codeview: struct defs for $$INLINEE_LINES 2024-05-28 06:10:43 -07:00
Nikita Smith d2f9bdeefb codeview: new sub-section types 2024-05-28 06:10:43 -07:00
Ryan Fleury c767f03f32 clean up & merge inline binary annotation decoders 2024-05-28 06:10:43 -07:00
Nikita Smith db737941d8 codeview: inline binary annot format and decode helpers 2024-05-28 06:10:43 -07:00
Ryan Fleury 8319850666 fix precision tab alignment issue 2024-05-28 06:10:12 -07:00
Ryan Fleury d04ee598b2 use lower level unwinding path with more generous time allowance, rather than passive cache query, for step-out 2024-05-26 14:35:57 -07:00
Ryan Fleury 15f5894c60 choose debug info key timestamps from debug info path, rather than module timestamp; the module should be allowed to be newer 2024-05-26 13:25:03 -07:00
Ryan Fleury 05c751a61a fix filesystem lister names 2024-05-26 12:47:47 -07:00
Ryan Fleury dd7cce2c3a some progress on the bitmap view rule 2024-05-24 21:20:44 -07:00
Ryan Fleury b1e1752229 oops 2024-05-24 17:19:46 -07:00
Ryan Fleury bddc9c97d9 get rdi_dump off dbgi layer, actually, super bad idea; just dedup decompression code 2024-05-24 17:18:31 -07:00
Ryan Fleury 325474fc49 Merge remote-tracking branch 'refs/remotes/origin/dev' into dev 2024-05-24 16:35:09 -07:00
Ryan Fleury 50d401e4ce formalize tab size in all ui codepaths, per-box; pick 4*columnsize by default in text views 2024-05-24 16:34:42 -07:00
Ryan Fleury 1dbbd351d7 formalize tab size in all ui codepaths, per-box; pick 4*columnsize by default in text views 2024-05-24 16:33:30 -07:00
Casey Muratori 1161c4adbb Added line that got left out when I tried to commit this the first time. 2024-05-24 16:10:40 -07:00
Casey Muratori 320a307e90 Dynamically linked SetThreadDescription to avoid requiring latest SDK/kernel version on Windows 2024-05-24 16:10:40 -07:00
Casey Muratori f835158071 Added call to the build.bat so that rc can be redirected as a batch file 2024-05-24 16:10:40 -07:00
Ryan Fleury f214b7d5f2 eliminate tab picker ui 2024-05-24 15:17:36 -07:00
Ryan Fleury d716159faf feed base column & tab width through all font rendering paths; use temporary constants 2024-05-24 15:12:40 -07:00
Ryan Fleury 5074b7f62e expand f_push_run_from_... to basing its tab-advance logic on what base column it is starting at - currently assume this is 0, basically doing the most naive tab alignment version that will work for leading spaces but for nothing else, and also assume 4-space tab width for now 2024-05-24 14:40:07 -07:00
Martins Mozeiko fd982d38fc Fixes bad resource usage in rendering
D3D11 is quite strict about how resources are supposed to be used - read/write & CPU access.
This changes Tex2DKind and BufferKind into one uniform ResourceKind (because it's the same thing really).

And it is more strict about usage:
1) Static is not allowed to update, resource is immutable, data provided at creation
2) Dynamic allows CPU to update GPU resource occasionally via UpdateSubresource
3) Stream allows CPU to update GPU resource often via Map/Unmap (currently unused)
2024-05-24 14:04:42 -07:00
Ryan Fleury 7e0611e7f1 recent projects history & opener 2024-05-24 14:03:07 -07:00
Ryan Fleury fd7085b690 do not settle for empty unwinds 2024-05-24 13:37:31 -07:00
Ryan Fleury 5f76fcfb6b filter panel tabs by project, if applicable; move all tab controls & so on to working based on this filtering mechanism 2024-05-24 13:33:47 -07:00
Ryan Fleury 9e778b30b6 begin tracking per-tab project info; fix dasm cache request dequeue incorrect cv broadcast 2024-05-24 12:58:54 -07:00
Ryan Fleury 15a1f81545 profile -> project 2024-05-24 12:35:51 -07:00
Ryan Fleury f7ad44a0d7 fix new-file query completion 2024-05-24 12:16:30 -07:00
Ryan Fleury 9349ac9e72 eliminate weird rollback/re-adjust rules for threads hitting int3s - rollback should only ever happen for temporary traps, e.g. user breakpoints or stepping. the fact that the thread shows *after* the trap later is a visualization issue, not a functionality issue 2024-05-24 08:20:10 -07:00
Ryan Fleury 489ae56223 fix moduleless unwinding and find-threads without debug info 2024-05-23 16:17:31 -07:00
Ryan Fleury 35b97d9c20 process name on stop-reason strings 2024-05-23 15:38:51 -07:00
Ryan Fleury bafc2170ca do not consume passthrough --s in command line parser 2024-05-23 15:21:53 -07:00
Ryan Fleury 6837d8d71a move rdi_dump over to dbgi layer 2024-05-23 15:16:53 -07:00
Ryan Fleury 35c599dea3 raddbgi -> rdi 2024-05-23 15:09:53 -07:00
Ryan Fleury dc5dda3f71 visualize handle basic types 2024-05-23 14:47:42 -07:00
Ryan Fleury fdfee37228 oops - only d3d11 flush on resize 2024-05-23 14:45:32 -07:00
Ryan Fleury ece414c575 prioritize title-bar-client-areas over built-in window borders; expand top bar rect a bit to ensure edge of window coverage 2024-05-23 14:40:23 -07:00
Ryan Fleury f431ac7f80 rewrite ipc communication; do ipc message reception on separate thread, wake up main thread; fix various robustness issues. do not necessarily initialize slower-to-initialize layers in conversion/ipc instances 2024-05-23 14:34:01 -07:00
Ryan Fleury e850f6fc93 c++ module extensions 2024-05-23 12:39:14 -07:00
Ryan Fleury 68a9802357 re-implement keyboard-driven path for opening dedicated view rule tabs 2024-05-23 11:36:51 -07:00
Ryan Fleury 905d04ab0b adjust disasm window limits; too often hitting non-read-only memory 2024-05-23 11:34:23 -07:00
Ryan Fleury bc40d1c0b0 rewrite frontend unwind cache to always preserve stale results until a new unwind successfully completes 2024-05-23 11:16:34 -07:00
Ryan Fleury f26b4c3b06 eliminate path-tree-based keying of debug info on frontend; use dbgi-layer-defined debug info keys, which can be more robust to changes to the same debug info path across time (e.g. during hot reloads 2024-05-23 10:30:23 -07:00
Ryan Fleury 68a92e910a eliminate old dbgi layer 2024-05-23 08:26:16 -07:00
Ryan Fleury 1621dc0637 correct nil rdi top-level-info 2024-05-23 07:54:28 -07:00
Ryan Fleury 21fcfd28a4 appease clang 2024-05-23 07:38:30 -07:00
Ryan Fleury 4a3d439c44 adjust symbol lister to apply to all loaded debug infos, rather than just the selected thread's debug info 2024-05-23 07:34:24 -07:00
Ryan Fleury 30f8e1675e new multi-dbgi-capable fuzzy search layer first pass 2024-05-23 07:01:34 -07:00
Ryan Fleury c17072053b adjust d3d11 resize path 2024-05-22 15:27:39 -07:00
Ryan Fleury a5e2235fc6 fix deadlocks on di_close contending with passive scoped dbgi access 2024-05-22 11:54:27 -07:00
Ryan Fleury 0160d05e8a further tweaks to mule_peb_trample 2024-05-22 11:39:23 -07:00
Ryan Fleury 7a4e939886 fix incorrectly referring to root entity for debug info if missing; fix thread register cache issues; fix new dbgi layer issues 2024-05-22 11:13:08 -07:00
Ryan Fleury b33559b081 tweaks to mule_peb_trample 2024-05-21 12:40:21 -07:00
Ryan Fleury b74db17375 peb trampling mule 2024-05-21 11:29:19 -07:00
Ryan Fleury a019115b95 get ctrl and debug frontend layers onto new pdb-path-based debug info loader layer; sketch out standalone fuzzy search layer, to replace old dbgi searching functionality; shift all debug frontend code from referring to debug info via 'binaries' to referring to debug info via 'dbgis', just file entities at the location of o.g. debug info 2024-05-21 10:08:28 -07:00
Ryan Fleury b9ac104276 begin stitching new dbgi layer usage code into ctrl layer; keep track of per-module preferred pdb paths via event-synchronized ctrl entity tree; still need conversion 2024-05-20 17:15:11 -07:00
Ryan Fleury 6e41bdf11b first pass at loader portion of new dbgi layer replacement; set up ctrl entity for per-module debug info selection path info 2024-05-20 16:28:52 -07:00
Ryan Fleury 49eb834e2b eliminate old unwind code 2024-05-20 12:58:02 -07:00
Ryan Fleury fd6befecc3 get tls address calculation off of binary parsing path; do based on in-process memory 2024-05-20 12:55:20 -07:00
Ryan Fleury 5342fab86b bugfix in new unwinder; applying stack ptr read & unwind when doing epilog unwinds 2024-05-20 11:12:29 -07:00
Ryan Fleury 9919ac59bb move module image info parse / cache management to ctrl thread, directly tie to module lifetime as ctrl thread sees it; reduce load from each unwind 2024-05-20 10:58:45 -07:00
Ryan Fleury 2d1fcd7475 fix some unwanted frontend unwind cache behavior; fix staleness calculation in ctrl process memory cache 2024-05-20 08:23:41 -07:00
Ryan Fleury 393fb9e5f2 eliminate old unwinder usage code; more regression fixing 2024-05-17 15:07:21 -07:00
Ryan Fleury 301cf6b7ac regression fixes, better integration, and tightening up the new unwinder 2024-05-17 14:15:11 -07:00
Ryan Fleury 578a56d231 further progress on new unwinder 2024-05-16 17:12:37 -07:00
Ryan Fleury 33ab26dfb3 begin porting unwinder to ctrl layer, just built purely on in-process memory, and getting completely off of parsed binary image artifacts 2024-05-16 15:39:57 -07:00
Ryan Fleury 8901dd30ec eliminate old pending entity code; do not build missing entity interface if data is actually present (but frontend cache still suggests missing) 2024-05-16 10:35:56 -07:00
Ryan Fleury e1a5d131c8 fix clang... sigh 2024-05-15 15:41:03 -07:00
Ryan Fleury 55c1674ec6 notes 2024-05-15 13:38:38 -07:00
Ryan Fleury 364a2160af correctly register jit debugger exe; collect jit_debug_info into dmn win32; notes 2024-05-15 13:25:20 -07:00
Ryan Fleury 56afe8ca60 watch window reordering 2024-05-15 11:57:46 -07:00
Ryan Fleury 6e039430a5 mouse controls for new watch window editing mechanism 2024-05-15 11:22:05 -07:00
Ryan Fleury f1af166fd4 expand ui events to contain semantic 'controls' info, to eliminate most hardcoded escs/returns/f2s/etc; formalize these things as proper commands; keyboard-driven expansions; other various fixes 2024-05-15 10:53:26 -07:00
Ryan Fleury 03844d81d2 further progress on watch window pass; multi-cursor, multi-selection, autocomplete lister, etc 2024-05-15 09:26:16 -07:00
Ryan Fleury aa73e62240 fix clang 2024-05-14 16:31:34 -07:00
Ryan Fleury 16de33245c first half of first pass at multi-cursor watch window 2024-05-14 16:25:24 -07:00
Ryan Fleury f8b688096a fix crash on tpi-less pdbs 2024-05-14 11:39:18 -07:00
Ryan Fleury 4dd1f6f579 eval watch -> watch; prep for more organized event-driven editing path for watch windows, beginning of multi-selection support 2024-05-14 10:33:03 -07:00
Ryan Fleury 58b8ed8974 floating line-nums/margins in source & disasm views, when horizontally scrolled 2024-05-14 09:07:44 -07:00
Ryan Fleury ac9a908464 automatically support insert-based copy/paste shortcuts 2024-05-14 08:27:59 -07:00
Ryan Fleury 5d459d9b7a skip/chop whitespace on launch parameters 2024-05-14 08:23:28 -07:00
Ryan Fleury 3085482e34 expand base layer logging mechanism with bucketing info; make one bucket for passive log collection, another for user-facing errors; always consume user errors at the top-level and display; use user-error mechanism to communicate bad 32-bit app launches from demon 2024-05-14 08:10:02 -07:00
Ryan Fleury 6c200a59cd bugfixes for new autocompletion system 2024-05-14 07:50:13 -07:00
Ryan Fleury 362bcbcda5 fix clang 2024-05-13 16:28:13 -07:00
Ryan Fleury 897949d33a notes 2024-05-13 16:27:15 -07:00
Ryan Fleury 70479e0399 fix autocompletion query word calculation 2024-05-13 16:26:54 -07:00
Ryan Fleury 90fc289ef0 extend autocompletion lister parameter detection, based on cursor position; feed through view rule parameters; correctly support cursor position with multi-arguments, regardless of which argument the cursor is on 2024-05-13 16:19:32 -07:00
Ryan Fleury 7c0f92ab3d sketch out view rule schemas; use them to determine autocompletion lister flags via partial parse of view rule input & matching to cursor; expand autocompletion lister to support lists of various things used in view rule arguments 2024-05-13 15:45:35 -07:00
Ryan Fleury 036d94fff0 autocompletion lister improvements - completions now can be used for sub-expression parts 2024-05-13 14:24:28 -07:00
Ryan Fleury 37dd5cea2d oops - this was not dead code! 2024-05-13 13:11:34 -07:00
Ryan Fleury 05f2cde2ee fix clang 2024-05-13 13:10:49 -07:00
Ryan Fleury e59d71893b bugfix copying & other accidental event consumption issues with new ui events 2024-05-13 12:57:45 -07:00
Ryan Fleury e41eb9430f finish pass to convert everything over to ui events, eliminate nav actions; intermix os events & ui event production with commands 2024-05-13 11:48:42 -07:00
Ryan Fleury 58192b8356 move all ui/df codepaths onto new ui event consumption, rather than os/nav events in parallel 2024-05-13 10:33:30 -07:00
Ryan Fleury 38e38eaf3b sketch out ui event type, to unify type & stream for text ops, nav actions, and all other user inputs 2024-05-13 07:48:48 -07:00
Ryan Fleury 9f89735b01 preserve jeff notes from emails - put into todo list 2024-05-12 14:11:08 -07:00
Ryan Fleury 4cb0073909 stop non-x64 builds with less cryptic errors 2024-05-10 16:32:01 -07:00
Ryan Fleury 6fb8db4d3d getting started view improvements 2024-05-10 10:15:10 -07:00
Ryan Fleury 123276a1c6 choose compact layout by default with smaller monitor size 2024-05-10 09:59:23 -07:00
Ryan Fleury 6e8753f1e1 formalize more compact panel layout 2024-05-10 09:56:06 -07:00
Ryan Fleury dda0e012bf support getting started view in default panel layout 2024-05-10 09:35:03 -07:00
Ryan Fleury 6660446bdd auto-close panels if final tabs are closed; simplify empty panel view, move 'helper' stuff to dedicated 'getting started' tab 2024-05-10 08:48:42 -07:00
Nikita Smith ef175baae4 fix chained unwind info count 2024-05-10 08:47:25 -07:00
Ryan Fleury f45ea18f24 full line bounds check in intermixed dasm 2024-05-01 05:13:17 -07:00
Ryan Fleury 4aeb6d7d03 notes 2024-04-30 11:38:02 -07:00
Ryan Fleury ed0ec4b34d last fixes, improvements, & split operation coverage for new tab drag/drop system 2024-04-30 11:14:24 -07:00
Ryan Fleury 2e971f9e39 do not force contain tooltip if it is above some threshold - otherwise it can occlude important ui 2024-04-30 10:02:50 -07:00
Ryan Fleury d65c263266 new/fixed panel animation 2024-04-30 09:41:57 -07:00
Ryan Fleury cd9437534c remove old animation method for panel pcts; since panels are often rearranged in a hierarchy, having pcts being based on parent rectangle (as opposed to the root rectangle) is unstable and often looks bad 2024-04-30 09:17:00 -07:00
Ryan Fleury 3b2656675e root-level non-split-axis splits; less noisy tab drag/drop ui 2024-04-30 05:39:34 -07:00
Ryan Fleury b4dab84235 always resolve to address mode evaluation when doing a member access 2024-04-29 18:13:50 -07:00
Ryan Fleury 2fc34ffb3d further coverage of split-drop drag/drop sites, for splitting options at non-leaf-panels 2024-04-29 12:17:03 -07:00
Ryan Fleury d419c6e15c formal drop-hot mechanism in ui core; further cleanup/fixes in drop-split combined operation ui 2024-04-29 11:06:18 -07:00
Ryan Fleury 15a2e708a0 hook up new combined move-tab-and-split ui with actual operation; auto-close panels which have their last tab dragged away; etc 2024-04-29 06:15:43 -07:00
Ryan Fleury 5a84fe4949 first half of pass to enable combined, standard split+movetab drag/drop fast-paths; just visualizations, next need the combo mutations 2024-04-28 18:51:57 -07:00
Ryan Fleury 9177299488 improve tab drag/drop 2024-04-28 17:29:41 -07:00
Ryan Fleury b6eb13761f fix breakpad_from_pdb build; robustify to typeless global vars 2024-04-25 11:53:23 -07:00
Ryan Fleury 67eede7513 hot-reloading for dasm_cache, in case of filesystem changes; file stream layer -> expose filesystem-wide generation number, for very coarse-grained generation number to gracefully depend on filesystem changes passively 2024-04-25 09:37:16 -07:00
Ryan Fleury f4ea9e66b0 bugfix on-demand process-dependent breakpoint resolution path & user breakpoint hit logic in stepping machine; more logging 2024-04-25 08:59:00 -07:00
Ryan Fleury 0dbde584bd jump destination symbol name visualization in disassembly 2024-04-23 19:12:58 -07:00
Ryan Fleury 579e3e9637 adjust source code intermixing symbol 2024-04-23 14:01:11 -07:00
Ryan Fleury 425626a275 first pass over mixed-mode disassembly 2024-04-23 13:52:44 -07:00
Ryan Fleury 5b87c2b64a bundle disassembly parameterizations into single dasm params type; extend with exe path & base address, to begin using debug info in the disassembly pass itself 2024-04-23 12:37:53 -07:00
Ryan Fleury 879e649d0e more frontend logging 2024-04-23 10:07:59 -07:00
Ryan Fleury 15e9dec60a fix incorrect entity destruction logging 2024-04-23 10:04:05 -07:00
Ryan Fleury ec13092a35 ui thread logging; more ctrl thread logging 2024-04-23 09:57:17 -07:00
Ryan Fleury 757cd9b9d2 correct createfile params for appending 2024-04-23 08:34:32 -07:00
Ryan Fleury 856c59a949 set up ctrl thread log scopes; ditch ctrl -> user log stuff, just make each log site in control of exporting to a separate file 2024-04-18 15:09:43 -07:00
Ryan Fleury 62d1c6b130 scoped log gathering; communicate ctrl logs -> user via events 2024-04-18 14:48:03 -07:00
Ryan Fleury b995909997 sketch out logging stub, to begin marking up debugger layers with logging - high level stuff still wip 2024-04-17 14:32:09 -07:00
Ryan Fleury a954317500 fix new issues with confirmation popup & top bar 2024-04-17 12:41:49 -07:00
Ryan Fleury b307d3bbed fix top bar issues 2024-04-17 11:50:38 -07:00
Ryan Fleury 8890284f97 zig lexing (syntax highlighting & hover-on-eval) 2024-04-17 11:36:01 -07:00
Ryan Fleury b41e762393 jai syntax highlighting & hover-eval support 2024-04-17 11:12:05 -07:00
Ryan Fleury 72e8ae6e30 actually do redraw on resize - need that win32 window class style.. 2024-04-17 09:58:03 -07:00
Ryan Fleury 9f4aade2e1 stepping fast-paths in top bar 2024-04-17 09:47:36 -07:00
Ryan Fleury 27fef06b6c remove unnecessary window class styles 2024-04-17 09:19:00 -07:00
Ryan Fleury 572fad1f03 first pass at custom window border 2024-04-17 08:46:21 -07:00
Ryan Fleury c31847f785 improve min sampling when applying transforms in ui 2024-04-13 12:18:01 -07:00
Ryan Fleury 9719688bb3 improve query visualization in tabs; don't collapse title before query string 2024-04-13 11:46:55 -07:00
Ryan Fleury a6bed27dff errr, reverse last change 2024-04-10 13:37:32 -07:00
Ryan Fleury b7a14aa41c explicitly show error if decoding line machine code or line info fails 2024-04-10 13:36:52 -07:00
Ryan Fleury 56bc399fd5 initial pass for compression in converter; decompression in debuggerdbgi layer 2024-04-10 09:33:55 -07:00
Ryan Fleury d560f8c734 fix backslash escaping rules in cfg serialization; fix small scrolling (e.g. from trackpad) often being truncated to having no effect; fixed hanging when set-thread-name specifies a non-readable address 2024-04-09 07:37:53 -07:00
Ryan Fleury 36b50981ff fix conditional breakpoints, post demon2/ctrl passes 2024-04-05 11:38:14 -07:00
Ryan Fleury 32114c3215 begin cleanup/naming pass over view rules 2024-04-05 10:17:38 -07:00
Ryan Fleury a8ece647c1 simplify and remove temporary polish from minified bitmap viewer 2024-04-02 15:31:02 -07:00
Ryan Fleury e0879ac569 stub out graph view rule 2024-04-02 15:18:16 -07:00
Ryan Fleury 0eb8216ea0 first pass at dedicated bitmap tab view, & all the machinery of going from watch window w/ view rule -> dedicated ui 2024-04-02 14:33:17 -07:00
Ryan Fleury cd1a0a4cb5 tab query serialization/deserialization; only enable for view rule defined view specs 2024-04-02 10:42:31 -07:00
Ryan Fleury 1b95eacd08 stub out visualizer tab view hooks for bitmap, geo, text, disasm viewers; pass down cfg node trees for open-tab command; visualize query string in tab titles 2024-04-02 10:35:19 -07:00
Ryan Fleury 546c544ae0 eliminate eval-viewer view - instead we can have the gfx view rule spec table optionally define tab view specs itself, and those can be separately registered from the sort of 'base' tab views. then we can map from gfx-view-rule -> dedicated-tab-view-spec 2024-04-02 10:16:53 -07:00
Ryan Fleury 3ea67dd7cf eliminate old disasm layer initialization 2024-04-01 15:09:41 -07:00
Ryan Fleury 52295e5e06 first pass at view rule lookup cache... this might not be the right thing here 2024-04-01 14:48:48 -07:00
Ryan Fleury 63123d69d1 set up auto view rule entities, serialization, & editor ui, for automatically mapping specific types to specific view rules 2024-04-01 14:30:48 -07:00
Ryan Fleury 835eae208a extend eval viz pipeline with split between edit/display expression strings per-block and per-row. this allows reconstruction of the string that would lead to the same eval as a row (even if it is auto-generated by e.g. expanding a root-level row; also allow -- to extend eval expressions with passthrough text, used for view rules 2024-04-01 13:56:07 -07:00
Ryan Fleury cfb34ec560 C++ namespace examples 2024-04-01 11:11:27 -07:00
Ryan Fleury c45b12cfac only export executable name, not full cmdline specified path in converter 2024-04-01 10:25:27 -07:00
Ryan Fleury 7c0ce2ab54 fix incorrect skip-to-end in new pdb -> raddbgi converter member parsing, in some cases (particularly noticeable in C++ structs with vtable members) 2024-03-30 19:44:20 -07:00
Ryan Fleury 693d20ec1a fix incorrect generation of modifier flags, container types, and out-of-order pointer/modifier types in new pdb -> raddbgi converter. fixes many 'nil type' issues, missing this ptr, etc. 2024-03-30 19:29:16 -07:00
Ryan Fleury a6db711f2d quick fix to not omit opl line records in breakpad_from_pdb 2024-03-29 15:53:18 -07:00
Ryan Fleury f2dd1e3c2d further sketching & setting up for escape-hatch-style view rule uis 2024-03-29 14:02:46 -07:00
Ryan Fleury 81c79c0ac2 sketch out parts of 'whole ui' eval viz pipeline build stage; fix copypaste issue with string viz 2024-03-29 12:52:19 -07:00
Ryan Fleury c1b92c1b27 reintroduce support for address/code-bytes toggling in disassembly view; also reintroduce support for toggle-watch-expr and goto-name commands 2024-03-29 11:51:20 -07:00
Ryan Fleury eec124c53b eliminate old text searching thread code 2024-03-29 11:28:45 -07:00
Ryan Fleury 8c5c0be040 ui: further improvements to double/triple dragging detection; df: use double/triple dragging to determine mouse-drag-range. dbl -> use token range, triple -> use line. pick appropriate side of mouse drag range on drag based on side of mark. 2024-03-29 11:17:01 -07:00
Ryan Fleury 2842901f9c ui: extend box->signal path with double-drag, triple-drag info 2024-03-29 10:58:05 -07:00
Ryan Fleury 6eb8e37d4d default to hexadecimal radix in register-mode hover-evaluations 2024-03-29 10:42:14 -07:00
Ryan Fleury 7496f3b8cc dont over-ambitiously respond to exceptions/errors on kill/detach 2024-03-29 10:22:06 -07:00
Ryan Fleury 7c3fabfc39 wchar test in mule_main 2024-03-29 10:13:29 -07:00
Ryan Fleury 4b3941c17f sketch out non-utf8 string visualization in frontend eval paths; simple retry mechanism for large memory reads that may fail across page boundaries in ctrl process memory cache 2024-03-29 10:09:57 -07:00
Ryan Fleury 60030b298b bitfield support in address mode -> value mode evaluation path 2024-03-29 09:51:38 -07:00
Ryan Fleury 60e1f105e4 raddbgi: correctly encode bitfields; type_graph: correctly stringify bitfield types 2024-03-29 09:22:13 -07:00
Ryan Fleury d9675f2565 allow assembly-style dereferences in eval parser; register/register-alias syntax highlighting 2024-03-29 08:52:46 -07:00
Ryan Fleury 7c7b44e940 attempt to auto-resolve numeric evaluations into addresses in frontend eval path 2024-03-29 08:52:45 -07:00
Mohit Sethi 6c8963cd06 Disable Alt+Enter fullscreen 2024-03-29 08:23:24 -07:00
Ryan Fleury 5aa8aa1c66 fix expandability rules for function pointer types; identifiers -> keywords in disassembly 2024-03-28 19:56:33 -07:00
Ryan Fleury 7f50beae2a notes 2024-03-28 15:40:28 -07:00
Ryan Fleury 3931edb3f1 notes 2024-03-28 15:21:25 -07:00
Ryan Fleury 1904d4ca0d support copy from disasm (finally) 2024-03-28 15:19:25 -07:00
Ryan Fleury 0ead1c034c eliminate old dasm layer, since we're all caught up with dasm_cache 2024-03-28 14:58:25 -07:00
Ryan Fleury 09f74805e0 restore old demon layer linux implementation, to not have to seek back in version control to find it when porting 2024-03-28 14:54:52 -07:00
Ryan Fleury f75ae9eb4a transition disassembly command processing paths to dasm cache 2024-03-28 14:53:38 -07:00
Ryan Fleury 2f5cc748d8 use disasm style parameters in dasm_cache disassembly path 2024-03-28 14:42:56 -07:00
Ryan Fleury 614b9bc537 extend dasm cache with style parameters; switch over primary disassembly ui path to dasm cache 2024-03-28 14:38:35 -07:00
Ryan Fleury bcbb4142cf plug in x64 intel-syntax disassembly 'language' into text analysis cache layer, to use that layer to naturally do parser/highlighter work for disassembly 2024-03-28 12:01:14 -07:00
Ryan Fleury d3570e8147 further progress on disassembly cache; instead of caching the text via the disassembly cache, simply submit into the hash store; this allows the disassembly cache to be composed with other caches, like the text analysis cache. + plug this system into the disassembly view rule, so now we can disassemble arbitrary pointers in the watch window 2024-03-28 11:36:57 -07:00
Ryan Fleury c91cd69536 first pass at new hash-store-based disassembly cache layer; can serve as a general-purpose asynchronous disassembly visualization cache layer, regardless of where that data ultimately comes from - can click into a file, process memory cache, etc. 2024-03-28 10:57:34 -07:00
Ryan Fleury f46691d79a dasm -> dasmi; make room for new dasm_cache layer 2024-03-28 09:45:41 -07:00
Ryan Fleury dbb0c1e0a4 file_stream: solidify retry mechanism; df: multiline controls for text_cache-based info, begin porting over txti-based systems 2024-03-28 09:36:09 -07:00
Ryan Fleury 96ff5efe7c allow delete/rename access on exe/debug handles 2024-03-28 08:54:08 -07:00
Ryan Fleury a14d0f5b18 rewire up target colors with processes/modules/threads; use first module path for correllation rather than entities & id correllation 2024-03-27 15:25:27 -07:00
Ryan Fleury 22185cee5f eliminate stuck-step disabling hack 2024-03-27 14:36:11 -07:00
Ryan Fleury 1da92b8dbc store per-launch entry points in ctrl entity store; use to later correllate PIDs to custom entry points in run path 2024-03-27 14:24:06 -07:00
Ryan Fleury 291bf3875d eliminate launch-and-init path, switch fully to separate 'launch' and 'run' paths; snap to selected thread if no stopper thread on stopped events; 2024-03-27 14:09:29 -07:00
Ryan Fleury ee056aa45d collapse user bp gathering helper, used only once 2024-03-27 12:29:45 -07:00
Ryan Fleury 53163f3610 ctrl: kill launch_and_handshake; begin extending run to be usable for launch-and-init and launch-and-run operations 2024-03-27 12:26:15 -07:00
Ryan Fleury 4899f1871b correctly close module file handles on module unloading in new demon layer 2024-03-27 11:19:24 -07:00
Ryan Fleury d73a3d4196 plug txt-layer-provided tokens into text view rule - both source code & text view rule are now completely powered via the txt visualization layer, rather than the special-purpose txti layer, which is now being retired 2024-03-26 16:47:15 -07:00
Ryan Fleury 4272258f99 txti -> txt; checkpoint #5 2024-03-26 16:38:12 -07:00
Ryan Fleury 8792c2280c txti -> txt; checkpoint #4 2024-03-26 16:26:31 -07:00
Ryan Fleury 88798e4453 txti -> txt; checkpoint #3 2024-03-26 16:04:21 -07:00
Ryan Fleury e80c69cb8f txti -> txt; checkpoint #2 2024-03-26 16:00:43 -07:00
Ryan Fleury 40ed36df3f txti -> txt; checkpoint #1 2024-03-26 15:31:39 -07:00
Ryan Fleury 88b692c840 eliminate fallback cache in text cache layer; we can use the hash store layer to rewind 2024-03-26 12:11:00 -07:00
Ryan Fleury 9dc484858a eliminate geo cache fallback key/hash cache; we can just use the hash store to rewind 2024-03-26 11:59:54 -07:00
Ryan Fleury f7e7aec355 bundle 'get key & stream' operation in process memory cache; eliminate old cache interaction in texture view rule hook 2024-03-26 11:55:15 -07:00
Ryan Fleury 7cf8da0b43 eliminate fallback key/hash pair cache in texture cache layer; we can rely on rewinding purely via the hash store layer 2024-03-26 11:50:44 -07:00
Ryan Fleury 4027338a2f adjust stripe counts 2024-03-26 11:30:47 -07:00
righthandprincess 3e911a8c64 Improve disabled overlay
Disabled overlay now respects the theme background color, as well as
the theme inactive overlay color, improving readability across themes.
2024-03-26 11:08:38 -07:00
Ryan Fleury 4bc82db69e deduplicate txti/text_cache language stuff; port over odin lexing 2024-03-26 11:00:37 -07:00
Ryan Fleury ca6e75d466 allow c++14 digit separators in c/c++ lexing 2024-03-26 10:42:46 -07:00
Ryan Fleury 6393766f82 deduplicate txti/txt layer lexing 2024-03-26 10:31:20 -07:00
Ryan Fleury 206d48b363 notes 2024-03-25 15:47:34 -07:00
Ryan Fleury f561abfd63 show stopper-thread exception-info on entity tooltips, when applicable 2024-03-25 15:43:00 -07:00
Ryan Fleury 6d1c0d9f6d louder & more informative exception info viz 2024-03-25 15:37:31 -07:00
Ryan Fleury 55146b547b reading & organization pass over unwinding layer; deduplicate PE info with PE layer, move dwarf info to in-progress dwarf layer 2024-03-25 14:42:54 -07:00
Ryan Fleury 1c3792a3da tighten architecture-specific path for unwinder 2024-03-25 13:34:43 -07:00
Ryan Fleury e5df25b314 use stderr-based fatal crash reporting, rather than windows gui, with programs built as console interfaces rather than guis 2024-03-25 13:24:00 -07:00
Ryan Fleury 23c1ea0e68 ui: if only one view scroll axis is specified on a box, always use scroll info to fill it, regardless of which axis that scroll took place on 2024-03-25 13:02:17 -07:00
Ryan Fleury aa85b2cdbb correctly pass unicode environments to launched child processes; also treat unicode command line arguments correctly 2024-03-25 12:57:00 -07:00
Ryan Fleury e136a67535 demon/win32: correctly report exception repetitions for unhandled exception cases 2024-03-25 11:00:00 -07:00
Ryan Fleury 83ecb4b86a ctrl thread stepping machine: read initial stack-pointer-check-value *before* single-stepping stuck threads, otherwise we can obtain an incorrect stack check value if the single-step causes a call. 2024-03-22 17:27:54 -07:00
Ryan Fleury c26274ac70 disable single-step-stuck-thread behavior when launching-and-initing, such that breakpoints on entry point will not be stepped over 2024-03-22 17:17:08 -07:00
Ryan Fleury 995804cc78 demon2 -> demon; eliminate original demon layer 2024-03-22 16:33:48 -07:00
Ryan Fleury c9df04ca60 merge 2024-03-22 16:31:05 -07:00
Ryan Fleury 71f3d18bf7 notes 2024-03-22 16:30:04 -07:00
Ryan Fleury 928532f386 do not attempt to refresh tls base calculation cache, if targets running 2024-03-22 16:29:50 -07:00
Ryan Fleury 7cd524d39d fix tls base calculation in demon2 2024-03-22 16:19:35 -07:00
Ryan Fleury 2c8c9a497c parameterize ctrl thread registers cache with entity store, rather than relying on implicit demon-api-provided cache 2024-03-22 16:15:20 -07:00
Ryan Fleury c636e1ad2e extend demon2 with explicit separation between blocking ctrl mechanisms & passive access/introspection/writing mechanisms; extend demon2 api with access mechanism 2024-03-22 15:53:04 -07:00
Ryan Fleury 07bbf1b43c organize demon2 by thread api 2024-03-22 15:15:33 -07:00
Ryan Fleury ca01e66ea2 plug in tls root vaddr path 2024-03-22 14:12:40 -07:00
Ryan Fleury 14ac7141e7 double buffer member cache 2024-03-22 13:53:14 -07:00
Ryan Fleury 9de678ec22 disable debug heap by default; get unwindg path off caching layers & use demon reads directly 2024-03-22 13:51:26 -07:00
Ryan Fleury e9129975e3 double buffer locals cache & tls base cache; introduce synchronizing mechanism for run vs. non-run ctrl thread states, to only attempt demon reads/queries during non-running times 2024-03-22 13:32:22 -07:00
Ryan Fleury 3994adae92 double-buffer frontend unwind cache 2024-03-22 11:56:28 -07:00
Ryan Fleury 982f2b6bab extend process memory cache queries with output channel for staleness detection - in some cases this is crucial, in other cases you don't care & want to passively accept stale redsults 2024-03-22 10:33:20 -07:00
Ryan Fleury a694a77eba fix halting, unattached running, and caching generations in demon2 2024-03-21 16:49:34 -07:00
Ryan Fleury 54677e05ec fix incorrect metagen pointer comparisons 2024-03-21 16:21:17 -07:00
Ryan Fleury 236214db25 eliminate unnecessary layers in frontend 2024-03-21 16:13:01 -07:00
Ryan Fleury 2c9ff37b2c sketch out new unwind cache types 2024-03-21 13:53:12 -07:00
Ryan Fleury 1466b27385 tweak registers cache lookup rules, to correctly return stale results on failed reads 2024-03-21 11:48:48 -07:00
Ryan Fleury e0e84c2ee3 further progress on integrating new demon layer 2024-03-21 11:28:47 -07:00
Ryan Fleury c2709d78b8 dont over-ambitiously consider the unwind cache up-to-date if some thread unwinds failed 2024-03-17 12:21:57 -07:00
Ryan Fleury 1269b93588 fix unchecked zero pointers in bake string map joining task, when zero pointers are legal 2024-03-17 12:17:22 -07:00
Ryan Fleury 14d3037aec raddbgi_breakpad_from_pdb: add a few missing null checks for edge cases 2024-03-17 12:17:22 -07:00
Ryan Fleury fbf4cce0e7 make tpi hash parsing gracefully exit on empty input data 2024-03-17 12:17:21 -07:00
Ryan Fleury d3cdb97a4e notes 2024-03-17 12:16:40 -07:00
Ryan Fleury 808d26684e fix unchecked zero pointers in bake string map joining task, when zero pointers are legal 2024-03-15 14:16:30 -07:00
Ryan Fleury 8f0e39024f fix additional demon2 typo 2024-03-14 21:24:12 -07:00
Ryan Fleury aa7c30d85b ctrl: first pass at new thread registers cache; also checkpoint for progress on moving to new demon layer 2024-03-14 21:09:43 -07:00
Ryan Fleury 22e6352056 raddbgi_breakpad_from_pdb: add a few missing null checks for edge cases 2024-03-13 15:25:05 -07:00
Ryan Fleury 2fff68cfcf make tpi hash parsing gracefully exit on empty input data 2024-03-13 15:10:39 -07:00
Ryan Fleury 936c6149e3 remove timeout on thread register cache accessor 2024-03-12 16:35:43 -07:00
Ryan Fleury c417f15912 fix task entry points in breakpad converter 2024-03-12 16:01:30 -07:00
Ryan Fleury ea74f928cd fix process memory cache query mechanism when ring buffer is near capacity 2024-03-12 15:51:26 -07:00
Ryan Fleury 871419de39 bugfixes in new demon layer; adjust retry mechanism in process memory cache query; ui fixes 2024-03-12 15:49:36 -07:00
Ryan Fleury 8639faabdd ctrl entity string allocation & tracking, for thread names & module names; fix process memory cache in edge cases 2024-03-12 14:56:02 -07:00
Ryan Fleury d1e88f781e tweak ctrl entity building to be bucketed per 'entity store' - we can now have multiple 'entity stores', one on the frontend thread, one on the ctrl thread, and keep them in sync at specific points via event lists 2024-03-12 14:20:24 -07:00
Ryan Fleury 4a3cc9bb39 get raddbg building on new demon layer 2024-03-12 13:55:13 -07:00
Ryan Fleury 2749301777 checkpoint - moving ctrl mostly over to demon2; sketching out a few missing cache pieces 2024-03-12 11:41:53 -07:00
Ryan Fleury 90d9f3b7c2 fix task entry points in breakpad converter 2024-03-12 09:05:00 -07:00
Ryan Fleury 49ccf50fd4 first pass at integrating new demon2 layer into debugger, need to change ctrl a bit to adopt some of the things that were previously being left up to demon layers 2024-03-08 12:49:06 -08:00
Ryan Fleury 0d0c599e00 begin process of moving pe unwinding info into pe layer; more demon2 work checkpoint 2024-03-05 16:54:57 -08:00
Ryan Fleury e25364a835 strip out some unnecessary apis from the demon layer, since we'll be doing per-entity caching in ctrl and keep demon as close to a thin abstraction as possible 2024-03-05 14:55:49 -08:00
Ryan Fleury f85718f1e2 fix eval header 2024-03-05 14:48:23 -08:00
Ryan Fleury 4074551a1a hook up demon2 initialization to base layer entry point 2024-03-05 14:27:40 -08:00
Ryan Fleury 0c436f0d5b first pass at demon replacement layer; just trimming out old code & cruft & reading & naming pass 2024-03-05 14:17:41 -08:00
Ryan Fleury 091269b1d8 eliminate synchronous per-thread string map building, just do it as-needed on each thread; 2024-03-04 11:53:12 -08:00
Ryan Fleury 4d6860b3a1 raddbgi_from_pdb/raddbgi_make: kill old synchronous string map code; naming pass 2024-03-04 11:14:54 -08:00
Ryan Fleury 778f4eb08d raddbgi_from_pdb: complete initial parallelization pass over string map building, joining, & sorting 2024-03-04 11:02:48 -08:00
Ryan Fleury 0ad795ba4c eliminate old udt string baking kickoff code 2024-03-01 11:36:03 -08:00
Ryan Fleury ac22e24841 raddbgi_from_pdb: switch string baking to using fixed per-thread maps, rather than per-task maps 2024-03-01 11:21:30 -08:00
Ryan Fleury 2fc0b4eac2 extend task system with thread count, so usage code can easily create per-thread state; pass thread idx into task entry points 2024-03-01 11:08:00 -08:00
Ryan Fleury 7eca2a35cd raddbgi_dump: dump string table 2024-02-29 11:04:53 -08:00
Ryan Fleury 1ea3a14a50 shift to slice-granularity of string map gathering, rather than chunk-granularity - gives a bit more flexibility. set up pdb converter type name gathering tasks for slice subdivision. before going forward with this plan it's imperative that we start sparsely allocating these name maps... 2024-02-28 16:48:25 -08:00
Ryan Fleury a38742d80b adjust string map sorting tasks to be wide, but less granular than per-slot; divide up table into chunks 2024-02-28 16:18:11 -08:00
Ryan Fleury e94b530758 new bake string map gathering/merging passes & async usage in converter 2024-02-28 15:51:17 -08:00
Ryan Fleury 0916c2a3c8 first pass at bake string chunk list, bake string chunk list map, and bake string chunk list sorting paths/datastructures - basic machinery for going wide on the string/name map builds 2024-02-28 13:27:48 -08:00
Ryan Fleury 56690a703f fix padding insertion pass over members gathering 2024-02-27 06:35:11 -08:00
Ryan Fleury bb0ebb5df2 raddbgi prefix on breakpad converter 2024-02-26 17:01:52 -08:00
Ryan Fleury 70d004e5d3 clean up command line arguments & help in converters 2024-02-26 16:49:57 -08:00
Ryan Fleury 3b7a4f3331 clean up pdb -> raddbgi converter parameters; extend conversion parameterization with optional type/udt disabling; use in breakpad converter 2024-02-26 14:11:26 -08:00
Ryan Fleury 1c2c82cc58 breakpad_from_pdb per-function line info writing 2024-02-26 13:34:33 -08:00
Ryan Fleury 03763e3444 raddbgi_from_pdb/raddbgi_make: split top-level units baking from per-unit baking; do per-unit baking wide 2024-02-26 12:15:18 -08:00
Ryan Fleury d9897161c2 first half of first pass at breakpad textual symbol info format exporter 2024-02-26 11:49:19 -08:00
Ryan Fleury 874f40244c eliminate per-executable initialization, just pull that down into the base layer entry point 2024-02-26 10:45:00 -08:00
Ryan Fleury 443c3fb74b get dwarf -> raddbgi converter on new entry point style 2024-02-25 15:03:27 -08:00
Ryan Fleury 8eb0f90f3e move to codebase-defined entry point style, with basic command line argument parsing, capture, thread-ctx, and other boilerplate deduplicated in the base layer's entry point definition 2024-02-25 15:02:05 -08:00
Ryan Fleury dd05eaa21e sketch out some codebase-wide standard thread entry point boilerplate 2024-02-25 14:13:27 -08:00
Ryan Fleury 93ab48ecdf organization/naming/dead-code-elimination pass over base 2024-02-25 14:00:35 -08:00
Ryan Fleury 3ec1edaff1 oops, fix clang 2024-02-25 13:33:27 -08:00
Ryan Fleury d8cf83b4d7 pull out & organize build configuration options, including entry point style, to context cracker 2024-02-25 13:30:15 -08:00
Ryan Fleury c4b8916bcf raddbgi dump - fix bad condition 2024-02-25 09:59:56 -08:00
Ryan Fleury 642acdf474 switch voff -> symbol name path to graceful failure RDI lookups 2024-02-25 09:57:51 -08:00
Ryan Fleury 7c9f127425 cleanup/naming pass over raddbgi_dump, do not require specific named params 2024-02-24 22:03:08 -08:00
Ryan Fleury 93c0e657fd eliminate old test files 2024-02-24 20:08:44 -08:00
Ryan Fleury 10ab27eb43 oops - actually respect operating system file system match flags in dbgi layer 2024-02-24 18:16:59 -08:00
Ryan Fleury 4c76eb73f1 respect operating system file system case sensitivity rules in dbgi layer 2024-02-24 14:04:41 -08:00
Ryan Fleury d9aa49e45c respect wait timeouts in task system join 2024-02-23 12:17:57 -08:00
Ryan Fleury 4da33c0d2c eliminate noop in ui layout pass 2024-02-23 11:21:47 -08:00
Ryan Fleury dd0416f9f9 fix nil expressions mapping to valid expression kinds, thus implying children nodes 2024-02-23 11:18:53 -08:00
Ryan Fleury c1984edadf dont over-eagerly join udt building tassk 2024-02-23 11:13:12 -08:00
Ryan Fleury ac8a7ba988 fix enumerate gathering in new udt building pass 2024-02-23 11:07:09 -08:00
Ryan Fleury 6beb9951e6 adjust default task sizes in raddbgi_from_pdb 2024-02-22 16:54:39 -08:00
Ryan Fleury 5813cb2af8 proper thread names 2024-02-22 16:20:27 -08:00
Ryan Fleury 74d051f383 walk args as dependent types for member function types 2024-02-22 15:51:18 -08:00
Ryan Fleury 7facfb7d08 kill single threaded udt conversion code 2024-02-22 15:50:07 -08:00
Ryan Fleury fe1e0cc2fd move udt info conversion to task threads, divide up itype stream and do it wide 2024-02-22 15:49:46 -08:00
Ryan Fleury bcbd01bf2c eliminate type revisiting task list, just iterate itypes again - in preparation for dividing up the itype stream and doing udt building in parallel 2024-02-22 15:37:50 -08:00
Ryan Fleury 34f500ce27 push unit conversion & src file gathering to background task threads; dont preemptively join initial independent parses until they are necessary 2024-02-22 15:11:13 -08:00
Ryan Fleury 0e352f92df separate per-name-map baking stages from each other, and from top-level name map section build; do them all independently 2024-02-22 14:45:09 -08:00
Ryan Fleury 50f7d53db2 eliminate unnecessary copy in raddbgi string map interner 2024-02-22 14:15:23 -08:00
Ryan Fleury b508489416 clean up old transitionary code 2024-02-22 10:03:26 -08:00
Ryan Fleury d2adf3e067 extend task system with ability to specify per-task arenas, if needed - not necessary in the converter, since it is fire-and-forget, but this will make it more useful for the debugger later 2024-02-22 09:48:19 -08:00
Ryan Fleury a5493d5edb appease the clang gods 2024-02-21 16:48:22 -08:00
Ryan Fleury c7e80ee135 raddbgi_from_pdb: move all top-level baking phases to task system threads. still a lot of improvement to do, these are top-level tasks and there is a lot of work *within* these tasks that is happening serially unnecessarily, but this is a good first step to parallelizing the bake. 2024-02-21 16:27:29 -08:00
Ryan Fleury 6a49672904 raddbgi_from_pdb: idx run baking; raddbg: catch up to new converter interface 2024-02-21 15:23:35 -08:00
Ryan Fleury 2dd4526dd9 raddbgi_from_pdb: path tree & string baking 2024-02-21 15:12:08 -08:00
Ryan Fleury f2cf518231 raddbgi_from_pdb: name map baking, small fixes with new baking strategy 2024-02-21 14:55:50 -08:00
Ryan Fleury 41b1f1c7e3 raddbgi_from_pdb: organize new baking path, which does all independent section list builds separately; do first pass of baked string map building 2024-02-21 14:36:15 -08:00
Ryan Fleury f93b71d8c3 raddbgi_from_pdb: untangle all baking stages - move almost all baking stages to a strictly read-only path of strings, idx runs, and so on. make section layout, given some loose input baking params, completely deterministic & well-defined, such that section list building for each stage of baking can be completely independent 2024-02-21 13:43:56 -08:00
Ryan Fleury 25ef98a98c raddbgi_make: eliminate old bake src files, switch over completely to user-specified src files; enforce nil entries in all tables for all cases 2024-02-21 10:36:22 -08:00
Ryan Fleury 529262d471 begin untangling source file & path tree building in converter/maker/baker; this cannot happen as another implicitly-mutated-context thing that magically happens behing a top-level 'baking' function. instead, this needs to be constructed according to the rules of the user, and passed to baking stages as a batch 2024-02-20 16:32:09 -08:00
Ryan Fleury 7581a6866d raddbgi_from_pdb: overlap link name map building with type info building, since they are independent streams of work 2024-02-20 15:13:22 -08:00
Ryan Fleury 923714c3c9 raddbgi_make: split final blob flattening & encoding from 'baking' phase 2024-02-20 14:07:58 -08:00
Ryan Fleury b8a4aeac39 raddbgi_from_pdb: offload c13 line info parsing to task threads 2024-02-20 13:16:52 -08:00
Ryan Fleury e7ab92e07c raddbgi_from_pdb: move comp unit contributions parsing out to task threads; move per-comp-unit top-level symbol parsing to task threads 2024-02-20 13:09:23 -08:00
Ryan Fleury 53bc258c4a raddbgi_from_pdb: move itype dependency chain building to task threads 2024-02-20 12:58:04 -08:00
Ryan Fleury 7e36c25a31 fix more async fwd map building bugs; move symbol stream conversion to task system 2024-02-20 12:04:57 -08:00
Ryan Fleury 66ef1b3eeb raddbgi_from_pdb: move top-level compilation unit parsing to asynchronous tasks 2024-02-20 11:30:01 -08:00
Ryan Fleury 6b2e4abe81 unify async task kickoff/await mechanism in first pass of 'task system' layer; use in organizing various independent parsing passes of a pdb; also fix busted multithreaded fwd resolution pass 2024-02-20 11:16:54 -08:00
Ryan Fleury 10a0420264 raddbgi_from_pdb: parameterize symbol stream conversion pass with sub-range of symbols; this cannot be applied to unit conversion, since they have cross-sym-record concepts, but it *can* be used for global symbol streams, which are also the most expensive to convert. this majorly speeds up global symbol stream conversion 2024-02-19 16:41:22 -08:00
Ryan Fleury 0b73582b87 raddbgi_from_pdb: multithread initial independent parsing/preparation phases of converter 2024-02-19 15:52:26 -08:00
Ryan Fleury 8369637026 raddbgi_from_pdb: multithread itype forward resolution map building 2024-02-19 15:07:25 -08:00
Ryan Fleury 86ee3cb4b6 raddbgi_from_pdb: multithread per-unit symbol conversion 2024-02-19 14:42:13 -08:00
Ryan Fleury 5cd5503db1 raddbgi_make: adjust baking-phase bucket counts based on estimates from parameters 2024-02-19 12:13:42 -08:00
Ryan Fleury 29c21b43af fix busted vmap section size 2024-02-19 11:52:28 -08:00
Ryan Fleury f7f57a2c7a fix enumerate parsing 2024-02-19 11:18:34 -08:00
Ryan Fleury 694e9d27d6 raddbgi_from_pdb: adjust itype -> type node building strategy; do initial pass of finding dependent itypes from a given itype, since those *must* be built first in order to comply with raddbgi's rule of type nodes only ever referencing earlier type nodes; then do a single itype build pass where you build all itypes by iterating their dependency chains 2024-02-19 11:13:29 -08:00
Ryan Fleury e44128de96 bugfix udt member parsing 2024-02-17 21:26:23 -08:00
Ryan Fleury b93bb5904a more itype generation fixes 2024-02-17 17:14:11 -08:00
Ryan Fleury cfe089de8c eliminate forward reference parsing work in non-forward-reference cases 2024-02-17 12:31:15 -08:00
Ryan Fleury e752eebfc9 fix itype conversion 2024-02-17 10:50:56 -08:00
Ryan Fleury d0fe5b9e04 raddbgi make: export scope voffs section 2024-02-17 10:36:07 -08:00
Ryan Fleury c790ee3de0 fix reversed-order path building 2024-02-17 08:44:55 -08:00
Ryan Fleury 4f9e3bb4f5 clean up / debugging / bugfixes in new converter 2024-02-17 08:41:27 -08:00
Ryan Fleury e9d2cb82b2 eliminate all old raddbgi_make and raddbgi_from_pdb code 2024-02-16 13:46:55 -08:00
Ryan Fleury 5190530417 oops, remember units... 2024-02-16 13:44:42 -08:00
Ryan Fleury 626ad29b91 converge raddbg to new conversion/raddbgi-make layers 2024-02-16 13:39:52 -08:00
Ryan Fleury 178719c479 transfer over idx run baking 2024-02-16 13:35:00 -08:00
Ryan Fleury 9cccabfa21 transfer over string baking 2024-02-16 13:33:45 -08:00
Ryan Fleury 3735e82579 source file baking 2024-02-16 13:31:58 -08:00
Ryan Fleury 75263c5833 path node tree baking 2024-02-16 13:29:26 -08:00
Ryan Fleury c64fba90a1 transfer over name map baking 2024-02-16 13:26:43 -08:00
Ryan Fleury 3fb632c23d raddbgi_make: name maps 2024-02-16 13:11:57 -08:00
Ryan Fleury 7597bccd46 raddbgi from pdb: fix chunk list concats 2024-02-16 12:51:17 -08:00
Ryan Fleury 335f22e00b raddbgi_make & raddbgi_from_pdb: solve multithreaded 'indexing' problem - how do we correllate loose pointer relationships, constructed by various threads, with final indices in the baked file 2024-02-16 11:53:03 -08:00
Ryan Fleury a38241ebe0 raddbgi_make: overrideable profile macros; raddbgi_from_pdb: itype name resolution, link anme resolution 2024-02-16 11:18:48 -08:00
Ryan Fleury 5ae9259253 raddbgi_from_pdb: global variable, thread variable, procedure, scope, local, location info baking 2024-02-16 09:04:15 -08:00
Ryan Fleury 7646487a90 raddbgi_from_pdb: type info baking 2024-02-16 07:28:55 -08:00
Ryan Fleury e8ca548360 transfer over unit vmap baking 2024-02-15 16:11:24 -08:00
Ryan Fleury 5f1ab8fdb4 move over per-source-file line info baking 2024-02-15 15:56:20 -08:00
Ryan Fleury c3c1906d43 first pass over raddbgi make baking phase rewrite/cleanup pass, getting off of old cons API 2024-02-15 15:44:24 -08:00
Ryan Fleury a9c5ec8878 symbol conversion passes in new converter 2024-02-15 12:00:02 -08:00
Ryan Fleury a118ff79cd partial first pass over converter & raddbgi make layer rewrites/optimizations 2024-02-14 13:34:39 -08:00
Ryan Fleury f18e236431 a few more raddbgi, raddbgic -> rdi, rdim notes 2024-02-13 16:06:56 -08:00
Ryan Fleury 816f94ef71 further raddbgi -> rdi naming pass 2024-02-13 15:56:30 -08:00
Ryan Fleury b9f010dff6 raddbgi_ -> rdi_ 2024-02-13 15:52:53 -08:00
Ryan Fleury 30d2dea951 complete raddbgi_cons -> raddbgi_make 2024-02-13 15:38:38 -08:00
Ryan Fleury 87d9d0be05 readme 2024-02-13 15:37:27 -08:00
Ryan Fleury db35e09629 raddbgic -> rdim (rad debug info make) 2024-02-13 15:36:06 -08:00
Ryan Fleury 90dce510cc raddbgi_from_pdb: eliminate unnecessary files 2024-02-13 15:16:42 -08:00
Ryan Fleury fb56951264 collapse raddbgi_convert folder into just being separate from_pdb and from_dwarf layers 2024-02-13 15:12:40 -08:00
Ryan Fleury ecd21d0c1b pdbconv -> p2r 2024-02-13 15:05:46 -08:00
Ryan Fleury 67859f228b fix parse error checks in raddbgi_from_pdb 2024-02-13 14:37:59 -08:00
Ryan Fleury 348034a490 reading/cleanup/organization pass over main symbol conversion pass in raddbgi_from_pdb; automate & table-drive a few pieces via metacode tables 2024-02-13 14:26:01 -08:00
Ryan Fleury 725481fcc7 fix codeview struct 2024-02-13 13:36:15 -08:00
Ryan Fleury 608055e447 metagen: simplify catchall generations; move some codeview enums into metacode; generate enum->string code 2024-02-13 13:27:02 -08:00
Ryan Fleury 66a24a226a adjust contain -> center cursor threshold 2024-02-13 11:42:20 -08:00
Ryan Fleury 9c7fd0a411 metagen: simplify & straighten out table generation further; raddbgi_cons: fix incorrect str8_list_join 2024-02-13 11:38:43 -08:00
Ryan Fleury 348e93162a metagen: simplify & unify error gathering & printing path 2024-02-13 11:26:31 -08:00
Ryan Fleury 1d9dc2b9a9 metagen: simplify data tables 2024-02-13 11:16:45 -08:00
Ryan Fleury 742d2387e2 metagen: simplify metacode structs 2024-02-13 11:00:58 -08:00
Ryan Fleury ea840a71e8 metagen: simplify enum generation; reading/organization pass over raddbgi_from_pdb 2024-02-13 10:55:06 -08:00
Ryan Fleury 4a9e5512f6 fix this_function_name macro 2024-02-13 09:56:46 -08:00
Ryan Fleury ac30c8a84b add codeview/msf/pdb notes to readme 2024-02-13 09:53:52 -08:00
Ryan Fleury 7defce94c7 float codeview, msf, pdb layers up as regular codebase layers, and out of converter-specific code; clangify some builds 2024-02-13 09:51:50 -08:00
Ryan Fleury 017116aee9 formalize codebase's library exports; document in README 2024-02-13 09:27:52 -08:00
Ryan Fleury 8c70b5efc9 raddbgi_cons: get building standalone, without base layer; complete first pass of librarification 2024-02-13 08:58:10 -08:00
Ryan Fleury 4aa2cb655b further progress on raddbgi cons librarification 2024-02-12 21:05:05 -08:00
Ryan Fleury 440dcf21a2 further raddbg_cons librarification 2024-02-12 20:32:20 -08:00
Ryan Fleury 2a85e1d37d raddbgi cons: more overrides work 2024-02-12 19:10:31 -08:00
Ryan Fleury 7022c58018 begin libraryifying raddbgi_cons; switch to raddbgi_format types, or overrideable base-layer-style types; just override & include in codebase-local inclusion sites. next step is to break out this stuff, along with stringization, into a raddbgi helper layer 2024-02-12 16:17:54 -08:00
Ryan Fleury 840e1da5f3 update github workflows to new debug info naming 2024-02-12 15:26:06 -08:00
Ryan Fleury 02825f3b3e move raddbgi stringize into standalone layer 2024-02-12 15:22:41 -08:00
Ryan Fleury cf19b13b78 dump -> raddbgidump 2024-02-12 15:19:20 -08:00
Ryan Fleury ad4003e70d cons -> raddbgic 2024-02-12 15:17:23 -08:00
Ryan Fleury 5c33c410d3 flatten cons api; eliminate private/public distinction 2024-02-12 15:11:20 -08:00
Ryan Fleury d35bdf2128 adjust readme for new debug info naming convention 2024-02-12 15:08:40 -08:00
Ryan Fleury aa2a0948ba raddbg -> raddbgi 2024-02-12 15:03:13 -08:00
Ryan Fleury 4b68967fbe raddbg format stuff -> raddbgi; partial naming/organization over raddbgi_cons 2024-02-12 14:29:24 -08:00
Ryan Fleury cc26a22e40 apply cancel/ok ordering note from jeff 2024-02-12 10:33:04 -08:00
Ryan Fleury 4fde6addc4 raddbg_cons: parameterize bake ctx with bucket sizes; make initial prediction based on symbol count 2024-02-11 13:29:06 -08:00
Ryan Fleury 60b6e2d597 Merge branch 'dev' of https://github.com/EpicGames/raddebugger into dev 2024-02-11 09:23:37 -08:00
Ryan Fleury e5c35a4035 oops! fix wrong type fwd reference condition 2024-02-11 09:23:16 -08:00
Ryan Fleury 47bb3464e1 oops! 2024-02-11 09:23:06 -08:00
Ryan Fleury 2e8afad5f0 adjust conversion visualization; strip out old profiling markup 2024-02-10 19:40:19 -08:00
Ryan Fleury e7897f302f do some more fine tuning of symbol id hash functions used in pdb -> raddbg path; also eliminate unnecessary per-type work 2024-02-10 18:25:47 -08:00
Ryan Fleury c81ee6d9bc extend id -> handle cons APIs with separate hash channel, so usage code completely controls both unique IDs and how they're hashed; second pass at designing better local variable hashing function 2024-02-10 16:21:55 -08:00
Ryan Fleury 801518ea75 improve local map hash 2024-02-09 18:02:44 -08:00
Ryan Fleury ebfddabd0b raddbg cons: extend u64 -> ptr map api with separate channel for hash, which reduces scan space, independently from unique keys which were previously assumed to be a reasonable hash (which they weren't) 2024-02-09 16:59:42 -08:00
Ryan Fleury 6c872566af raddbg_from_pdb: greatly improve speed of line info combining pass; do not linearly scan for line numbers, use line as hash -> slot key and search only slots 2024-02-09 15:31:24 -08:00
Ryan Fleury 44d9b57eb5 track bucket collision counts, include in table diagnostics dump; finish moving pdb->raddbg conversion tables over to dynamic & heuristically chosen table sizes 2024-02-09 14:55:07 -08:00
Ryan Fleury cdb53ebed0 pdb -> raddbg table diagnostic dumping 2024-02-09 12:59:06 -08:00
Ryan Fleury 2d63234c92 eliminate static, absurdly large table sizes in all cases in pdb->raddbg path; markup & diagnostics of table sizes vs. counts, to begin gathering data for table size prediction path 2024-02-09 11:50:04 -08:00
Ryan Fleury 7f357b264c os_gfx_win32: fix preservation of sign info in x/y lparams for mouse events 2024-02-08 17:05:24 -08:00
Ryan Fleury 11dd5fd21a fix dragging interpretation in ui box -> signal path 2024-02-08 15:10:53 -08:00
Ryan Fleury 77337f9e86 use globals, thread-locals, types, procedures in default panel layout 2024-02-08 10:37:08 -08:00
Ryan Fleury 95a6579f89 expand eval machine interpretation error codes; visualize 2024-02-08 10:28:41 -08:00
Ryan Fleury fed0a13aca eliminate leftover events system, since ui codepaths should now consume as many events as possible within a single frame 2024-02-08 10:09:51 -08:00
Ryan Fleury 6e3242848f wm_mousewheel and wm_mousehwheel report mouse coordinates in screen space, not client space; fix to account fo rthat 2024-02-08 10:05:29 -08:00
Ryan Fleury 2967d8be2a fix double assignment to strtable buckets_min in raddbg_pdb 2024-02-08 04:12:29 -08:00
Ryan Fleury 3a811e5e16 middle click -> close tabs 2024-02-07 16:49:05 -08:00
Ryan Fleury 0bced47404 eliminate old ui box -> signal path 2024-02-07 16:47:21 -08:00
Ryan Fleury c637ad6ede rewrite ui box -> signal path for less lossy event processing & correctness; also extend to use all 3 mouse buttons. eliminate ui signal bitfields, just use flags & helper macros everywhere. 2024-02-07 16:46:57 -08:00
Ryan Fleury b9cec99cd4 ui code -> extend 'active' system to all left/middle/right mouse buttons, rather than just min/max (left/right) 2024-02-07 14:20:21 -08:00
axeldaguerre fb9e890653 fix utf8 encoding missing one bit shift
For Unicode code point in the highest range, 1 bit shift operation on the 4th byte is missing, giving a wrong encoding
2024-02-07 13:54:58 -08:00
Ryan Fleury 2c73c65878 remove debug 2024-02-07 13:35:34 -08:00
Ryan Fleury 390aab2699 raddbg from pdb: correctly parse several c13 files in single c13 subsection, rather than just assuming a single one 2024-02-07 13:35:14 -08:00
Ryan Fleury ccec64750d fix raddbg_dump build 2024-02-07 12:59:56 -08:00
Ryan Fleury e637f7237c straighten out a few key stability issues in eval watch views; editing expressions will no longer eliminate view rules; stale view rules will no longer find their way into inserted expressions 2024-02-07 10:32:24 -08:00
Ryan Fleury c757388bb4 fix serialization/deserialization of top-level watch view rules 2024-02-06 15:38:42 -08:00
Ryan Fleury fb43eb9c72 default to no d3d11 debug features; use command line flag to enable 2024-02-06 14:59:41 -08:00
Ryan Fleury 9ef1b4b021 fix system processes lister fuzzy matching; fix ctrl layer locking modules on detach (demon was not reporting module string!) 2024-02-06 13:59:43 -08:00
Ryan Fleury 7305c12166 reset control context unwind count when submitting all runs 2024-02-06 13:48:05 -08:00
Ryan Fleury e3f18d3b87 fix mutable eval root key stability w.r.t. view rules & so on 2024-02-06 13:28:14 -08:00
Ryan Fleury 86e332f2ef allow compound macro expressions in eval system; poison used macro names, before descending 2024-02-06 11:55:51 -08:00
Ryan Fleury 6296d2bd96 first pass of watch window macros; fix active-but-disabled line edit rendering; other minor fixes 2024-02-06 11:47:52 -08:00
Ryan Fleury c2d96a8df6 pull out eval watch view cursor state; begin prepping for multirow table selection 2024-02-06 09:21:14 -08:00
Ryan Fleury c0cf0bf2da fix small visual issues with hover eval 2024-02-06 08:55:55 -08:00
Ryan Fleury 87ed6a8c62 per-run tls base vaddr cache; cleanup/fixes/improvements on fuzzy filtering of scheduler view 2024-02-06 08:48:09 -08:00
Ryan Fleury 0696eab974 address some jank with query view focuses intermixing with deselection/hover-eval/etc. 2024-02-06 07:35:51 -08:00
Martins Mozeiko 9c02f947c7 show git commit id in window title & fatal exception dialog 2024-02-06 07:30:58 -08:00
Ryan Fleury 816bf195c2 more filtering coverage; fuzzy filtering on search tags as well as entity display string; display a few known frames from callstack in thread entity description buttons 2024-02-05 14:36:33 -08:00
Ryan Fleury 95b8b71322 dedup multiple unwinder paths; just collapse down to using the ctrl one 2024-02-05 14:06:06 -08:00
Ryan Fleury ef317c1ffc procedures view 2024-02-05 13:58:19 -08:00
Ryan Fleury 9504946376 entity view filtering 2024-02-05 12:08:50 -08:00
Ryan Fleury e03e1dd136 eval lexer: same as last 2024-02-05 11:28:29 -08:00
Ryan Fleury 0b6b0947ed eval lexer: allow a few more corner cases of various compiler/linker-inserted identifiers, so that eval works in all cases 2024-02-05 11:26:37 -08:00
Ryan Fleury 38b8bfd6fb fix ordering of event consumption w/ filter box 2024-02-05 11:24:31 -08:00
Ryan Fleury 87e0e9a7e9 bugfix truncated string hover rule 2024-02-05 11:19:34 -08:00
Ryan Fleury 6e874c7449 syschar -> defwindowproc 2024-02-05 11:07:36 -08:00
Ryan Fleury d2d3d14c41 demon/win32: roll back on all hit traps, even if explicit. the previous implementation would silently skip threads past explicit traps that they hit, as a way of implicitly storing the fact that trap exceptions had been reported, and the user could continue past them. this resulted in incorrect instruction pointer display in those circumstances. this change adjusts this, so that after a trap exception of any kind, the instruction pointer is ALWAYS rolled back. to ensure that the trap is not repeatedly hit, if the associated exception has already been reported, to allow the user to e.g. step over traps (this is the behavior of Visual Studio), additional state is stored per-thread-entity, which allows a subsequent demon_os_run to adjust RIPs past their previously reported traps before running again. 2024-02-05 10:47:57 -08:00
Ryan Fleury 2359c82fba extend ctrl process memory cache with waiting mechanism; employ to wait for changes to propagate through process memory cache, when forcibly mutating debuggee process memory 2024-02-05 10:04:00 -08:00
Ryan Fleury f2c74cbcb2 float mousemove detection & ui mouse position rules down to ui core layer 2024-02-05 09:29:50 -08:00
Ryan Fleury f03f3e4421 robustify ctrl memory streaming cache & texture cache layer to unreasonably large sizes/dimensions 2024-02-05 09:24:00 -08:00
Ryan Fleury 95eea70682 fix failure condition in entry point detection 2024-02-05 08:54:45 -08:00
Ryan Fleury 762013899f switch entry point detection/trap strategy to finding *all* possible candidates, and trapping all of them, rather than forcing the ctrl thread to decide on one specific entry point voff 2024-02-05 08:41:18 -08:00
Ryan Fleury 0be4680ec9 os_gfx -> report mouse move events; still allow passive mouse interaction if window is unfocused, but have recently received mousemove events 2024-02-03 18:04:21 -08:00
Ryan Fleury 985a6f37e9 notes 2024-02-03 17:37:39 -08:00
Ryan Fleury f9e2aa99a9 fix padding calculation - prohibit all overlapping members 2024-02-03 09:56:24 -08:00
Ryan Fleury 509089d95d remain robust to busted range queries for ctrl process memory cache 2024-02-03 09:20:31 -08:00
Ryan Fleury 647558b140 fix plural language in singular scenarios 2024-02-02 17:28:22 -08:00
Ryan Fleury cbe842c5ec dont do padding members for unions, oops 2024-02-02 17:15:55 -08:00
Ryan Fleury f796f64c2f process memory read failuer visualization in eval watch view tables 2024-02-02 17:05:55 -08:00
Ryan Fleury 36d749ddb5 slightly stronger padding visualization 2024-02-02 16:46:54 -08:00
Ryan Fleury 7e589e8cd2 padding visualization 2024-02-02 16:42:08 -08:00
Ryan Fleury 708517a668 move fuzzy range match visualization into formal ui rendering path; write dedicated truncated fuzzy match rendering path; fixes some visual bugs & makes all fuzzy range match visualization consistent and not ad-hoc 2024-02-02 15:35:44 -08:00
Ryan Fleury 876d9338fc auto-close universal ctx menus when entities/tabs invalidate; some visual fixes 2024-02-02 14:13:00 -08:00
Ryan Fleury 6897c0bb57 only show mid-row cache line boundaries when unexpanded, since the expansion will show more precise info 2024-02-02 12:53:34 -08:00
Ryan Fleury 15e239a0dc cache line boundary visualization 2024-02-02 12:47:51 -08:00
Ryan Fleury 5d3aa301f0 enum type evaluation visualization - can now use watch windows to inspect all possible enum values 2024-02-02 11:50:21 -08:00
Ryan Fleury 847749337b eval parser: more coverage for c++-compiler-generated & various C++-style identifier names 2024-02-02 11:33:06 -08:00
Ryan Fleury 542753ddcc deduplicate editability/expandability determination path for viz row build 2024-02-02 11:12:20 -08:00
Ryan Fleury 9d8efa3a44 deduplicate common parts of viz row building 2024-02-02 11:03:14 -08:00
Ryan Fleury 410a340a09 oops -> carry over dbgi target with viz block splits 2024-02-02 10:13:39 -08:00
Ryan Fleury 8958b414e2 properly parameterize viz block & viz row building paths based on dbgi table target 2024-02-02 10:09:30 -08:00
Ryan Fleury ac895a85eb eliminate old eval watch view code 2024-02-02 09:30:22 -08:00
Ryan Fleury ad57a0d3e8 stop following expansion nodes at the first non-expanded one, when converting watch view selection coords when ancestor has been collapsed 2024-02-02 09:28:15 -08:00
Ryan Fleury 20ff4acecc simplify/collapse/deduplicate eval viz block building code; correctly build filtered-info-table-sorted expansions for filtered debug info table watches; eliminate special-case empty row in watch views, just feed everything through the viz blocks path 2024-02-01 17:05:08 -08:00
Ryan Fleury be4c52b7ef first part of collapsing globals/types/threadlocals path into being single viz block building path; more filtering ui work 2024-02-01 13:54:34 -08:00
Ryan Fleury 6740520bbe straighten out table coordinates <-> viz block coordinate space mappings, since search-backed tables no longer can assume those two things are the same; clang -> o2; fix clang build 2024-02-01 13:21:07 -08:00
Ryan Fleury 28fdd791ae extend eval viz blocks & windowed row build path with optional member info - use to extend watch type info visualization with size/offset information 2024-02-01 10:59:55 -08:00
Martins Mozeiko d6608adf60 make msvc release build much faster
cl.exe for some reason spends unreasonable amount of time optimizing
df_window_update_and_render function,  we can use pragma to skip
optimization for this function
2024-02-01 09:53:14 -08:00
Ryan Fleury 45b59e4cc4 apply fuzzy filtering correctly to globals/thread-locals/types views 2024-01-31 15:06:20 -08:00
Ryan Fleury 02979ba26c first pass at equipping frontend line edit with fuzzy match range visualization; shift new debug-info-range viz block -> viz row path to using a backing filtered item array to map the abstract index space into the debug info table spaces 2024-01-31 14:54:49 -08:00
Ryan Fleury f3f0e2a697 plug in basic, half-finished filtering functionality to watch/locals/registers/types/globals/threadlocals views 2024-01-31 14:35:14 -08:00
Ryan Fleury 630272ec37 expand dbgi asynchronous fuzzy matching system to allow selection of target table; this allows asynchronous fuzzy matching over types, globals, thread locals, and procedures 2024-01-31 14:22:12 -08:00
Ryan Fleury 41b853b874 simplify fuzzy matching path to a single query 2024-01-31 14:07:16 -08:00
Ryan Fleury 071ff82673 introduce general-purpose filtering path for tabs; control whether or not it is enabled via view spec flags. + feature flags for automatically bring up filtering box when typing 2024-01-31 14:01:53 -08:00
Ryan Fleury 9106190893 first pass at types view 2024-01-31 12:31:09 -08:00
Ryan Fleury 8602e5b23e first pass at thread-locals view 2024-01-31 12:24:57 -08:00
Ryan Fleury c8010b7542 first pass at globals view 2024-01-31 12:17:43 -08:00
Ryan Fleury edb204bc5f eliminate old expand-key-based eval history - ctrl process memory cache offers much better comprehensive replacement. also eliminate per-row and per-block eval views, since we've collapsed all eval views to one per list-of-watch-trees 2024-01-31 11:12:59 -08:00
Ryan Fleury 2bf8179fee eliminate old registers/locals view states 2024-01-31 10:49:47 -08:00
Ryan Fleury 4e9cf2ef89 eliminate old locals view path; dont constantly mutate root expressions, simply query locals & build blocks 2024-01-31 10:48:49 -08:00
Ryan Fleury 14db7dbab4 stub out globals, thread-locals, types views; eliminate unnecssary uniquifier u64 in expand tree hash keys - simplify eval watch views to using a single eval view for the entire view, rather than allocating one per root expression. expand keys are now simply comprised of parent hash * child num 2024-01-31 10:39:18 -08:00
Ryan Fleury 8aac3f7bda escape textual string data before visualizing it in single-line eval visualization 2024-01-31 09:22:47 -08:00
Ryan Fleury 385014adcb raddbg nil tables, autofill empty tables with 1-sized nils; use element-from-idx wrapper to bounds-check and nilify all out-of-bounds raddbg table accesses 2024-01-31 08:43:33 -08:00
Ryan Fleury a6f42502ec symbol lister -> show procedure # in debug info, source location, name in tooltip; busyloop to wait to commit new fuzzy search results if scope touches active; sort fuzzy match results 2024-01-31 07:22:07 -08:00
Ryan Fleury 94d2be1683 some hover eval adjustments 2024-01-31 06:29:25 -08:00
Ryan Fleury 09f2b83603 fix function name breakpoint serialization 2024-01-31 06:20:49 -08:00
Ryan Fleury 00594a841a notes 2024-01-30 14:44:11 -08:00
Ryan Fleury 2731bdac59 extend fuzzy search cache nodes to having 3 buckets - 3rd bucket can be used to abort working copy, and speed an updated query along 2024-01-30 14:19:11 -08:00
Ryan Fleury 6e456424b0 handle thread name events correllated with only TID, without corresponding thread entity - correllate upon thread creation as-needed 2024-01-30 13:50:23 -08:00
Ryan Fleury c700264445 use explicit thread name exception thread ID parameter, when not implicit 2024-01-30 13:11:37 -08:00
Ryan Fleury d9f69cdf14 complete first pass of fuzzy matching symbol lister for go-to-name, and setting function breakpoints 2024-01-30 12:58:24 -08:00
Ryan Fleury 4ef814acb5 fix more tab bar stuff; further sketchout of asynchronous dbgi layer fuzzy searching 2024-01-30 09:57:15 -08:00
Ryan Fleury d139c2874c add optional command spec restriction to cmd param slot -> view spec table; eliminate mouse testing when windows are not focused 2024-01-30 09:14:59 -08:00
Ryan Fleury c61ff1910c split ui view clamp rule into separate x/y flags 2024-01-30 08:02:25 -08:00
Ryan Fleury c9b22acd5a sketch out symbol lister view; float fuzzy matching code into base string layer; bugfix unnecessary ui layer view clamping 2024-01-30 07:59:24 -08:00
Ryan Fleury 38af1a5cab fix bottom tab clipping 2024-01-30 06:52:03 -08:00
Ryan Fleury fe5f38c306 only retry findthread given missing debug info or RIP if ctrl thread is stopped 2024-01-30 06:33:16 -08:00
Ryan Fleury f130f23b3f include jmc line number hacks in line step-over and step-into trap-net 2024-01-30 06:18:02 -08:00
Ryan Fleury aa31afcd24 bump patch version, mule_main -> common link flags 2024-01-29 17:39:20 -08:00
Ryan Fleury 49f7fa9fa3 notes; load user/profile -> open user/profile 2024-01-29 17:31:47 -08:00
Ryan Fleury 9b8c0e32b5 hover eval change visualization 2024-01-29 17:21:25 -08:00
Ryan Fleury 2518eaf57c pass over line info colors, enable source-hover-line-info-viz, a few other visual improvements/tweaks 2024-01-29 16:54:31 -08:00
Ryan Fleury d2bdf512cf in the case of unspecified colors in cfg, default fill them from the preset theme with the most similar background; this will mean that even with totally custom themes, as new color codes are added to the frontend, people will get sensible defaults. if they are just using a preset, then they will get the default new values by default 2024-01-29 16:24:41 -08:00
Ryan Fleury 0ce5239404 prefer serializing theme presets, if applicable 2024-01-29 16:13:08 -08:00
Ryan Fleury 83e8bb8ddd actually still need corner sdf sample with sufficient softness as well 2024-01-29 15:58:15 -08:00
Ryan Fleury afe105da31 eliminate further useless sdf sampling in shaders; eliminate useless borders in ui, eliminating more overdraw; eliminate tab bar clipping issue 2024-01-29 15:52:08 -08:00
Ryan Fleury f6e7db7c3a clean up ui box hierarchy rendering path, to eliminate duplicate node visits, causing a lot of extra dumb overdraw etc. 2024-01-29 15:30:59 -08:00
Ryan Fleury d1fde3c908 fix busted synchronization in non-file-backed txti buffer edits; fix some snapping issues in Output view 2024-01-29 13:57:24 -08:00
Ryan Fleury baca24c037 fix leftover event consumption tautological rule; fix a few small visual issues 2024-01-29 12:53:09 -08:00
Ryan Fleury 57fb21adf7 always allocate byte dirty/unreadable flags in ctrl process memory cache lookup, rather than trusting caller to check 2024-01-29 11:56:34 -08:00
Ryan Fleury 3fd9014c20 feed user-specified strings in cfg serialization/deserialization through escaping/unescaping path -- escape all double-quotes before serialization, de-escape when deserializing 2024-01-29 11:51:12 -08:00
Ryan Fleury 1ade5e44fa do not strip quotations from command line arguments when launching debuggee processes, as otherwise quoted arguments with spaces will be broken apart in inconsistent & unintended ways; fix utf16 decoding with certain ranges of codepoints 2024-01-29 11:28:58 -08:00
Ryan Fleury 28e258b5dc dont assume valid slice from process memory cache grab 2024-01-27 10:46:41 -08:00
Ryan Fleury 967936cef6 pass over rules in picking step-into entry point. right now we don't exactly have a trivial way of checking if an entry point truly was defined by a user. but if line info exists, and the file seems local, and there is a procedure name for an EXE's built-in entry point address, then we can at least guarantee that there is source for the entry point, and thus can serve as an acceptable entry point. this currently does not take into account cases where the OBJ path is not local, but the user overrides the file paths to have source. if the entry point is determined to be non-user-defined, then everything falls back to the usual paths - try WinMain, WinMainCRTStartup, etc., and then override with explicit custom entry points if needed. not great, currently, w.r.t. detecting if the entry point is in user code. maybe can check more info in the unit later... 2024-01-26 20:37:36 -08:00
Ryan Fleury 04b5b362bc fix deadlock in launch_and_init - don't hold dbgi scopes open too aggressively, as we may need to eliminate dbgi which they refer to. 2024-01-26 19:04:30 -08:00
Ryan Fleury f047a0beac slight logo tweaks 2024-01-26 17:37:15 -08:00
Ryan Fleury 7355389e19 ohhhh my godd pt 2 2024-01-26 14:25:46 -08:00
Ryan Fleury 5f8ec62b4c ohhhh myyy gooood 2024-01-26 14:23:54 -08:00
Ryan Fleury 207e46c8e8 prefer exe header's default entry point if it doesn't match expected defaults 2024-01-26 13:59:17 -08:00
Ryan Fleury b76a8b9854 oops - do not ring_write in reader path... also fix silly shader thing 2024-01-26 13:51:57 -08:00
Ryan Fleury 6b7588b4b3 oops;git status 2024-01-26 13:51:33 -08:00
Ryan Fleury 455dac958c first pass at asynchronous file streaming -> hash store layer; fix non-windowed memory access in watch window when doing change visualization, causing major performance regression with large arrays; fix some extra jank with truncated-string-hover & help labels 2024-01-26 11:47:25 -08:00
Ryan Fleury 0974337450 oops, fix function pointer display 2024-01-26 09:50:03 -08:00
Ryan Fleury fea74aedd8 visualize global variable symbol pointers after addresses only on void*s (keep function symbol visualization for function pointer types); otherwise there is real content to visualize 2024-01-26 09:24:35 -08:00
Ryan Fleury 89af8124c7 ui truncated string hovering -> display full string as a tooltip 2024-01-26 09:04:29 -08:00
Ryan Fleury 33f5d4f5b1 default animation rate tweaks 2024-01-26 07:59:04 -08:00
Ryan Fleury 88a218e36e visual jank-fix/polish pass 2024-01-26 07:43:40 -08:00
Ryan Fleury f69176ee4e dbgi layer: treat <header-sized raddbg files as out-of-date 2024-01-26 06:14:02 -08:00
Ryan Fleury 8c0708d2ab remove unnecessary idx run iterator assertion in converter; 'twas asserting that no nodes remained in the bake phase when reaching the end of the idx run section, but this does not hold in all cases (e.g. in the case where there is an empty idx run added last) 2024-01-26 06:08:12 -08:00
Ryan Fleury 21deaace66 fix focus visualization seam given new shaders 2024-01-25 14:20:11 -08:00
Ryan Fleury 3aa602eca7 fix satval picker rendering, with new shader performance improvements 2024-01-25 14:15:24 -08:00
Ryan Fleury 1319a23f98 raddbg_from_pdb: cv struct2/class2 paths 2024-01-25 13:23:50 -08:00
Ryan Fleury c8c5da4f4a improve flow around multi-target debugging: prefer one-target-only in default path; only enable command line specified target if present; explicit commands for enabling/disabling targets, as well as mutually-exclusive selection of targets; make default clicking path in UI go through mutually exclusive selection, whereas ctrl+clicks will do multi-target selection 2024-01-25 11:49:05 -08:00
Ryan Fleury dd38822a4c Merge branch 'dev' 2024-01-25 11:22:06 -08:00
Martins Mozeiko 644a94d5ef fixing clang build 2024-01-25 11:19:30 -08:00
Martins Mozeiko fc9449a2d5 make sure github action fails on error 2024-01-25 11:19:30 -08:00
Ryan Fleury 168f66cc99 further progress on new process memory cache; first pass at visualizing changed watch window rows, based on ctrl process memory cache history 2024-01-25 11:17:16 -08:00
Ryan Fleury 38b113f1d0 simplify & consolidate ctrl layer process memory caching mechanisms - move all non-necessarily-synchronous caching to background memory streaming thread cache 2024-01-25 10:04:03 -08:00
Ryan Fleury b14b9f0344 strip out ctrl process memory cache fresh flags & hash history, since both will be replaced by hash store layer's capabilities 2024-01-25 09:09:36 -08:00
Ryan Fleury d0c3d9dc21 extend ctrl process memory cache reads with freshness info - it is a bit too coarse grained at page granularity, that should've been easy to predict... in any case, to start addressing that, start keeping >1 hash key hash history in hash store layer, such that history may be preserved for a bit longer & diff'd with new key hashes 2024-01-25 09:06:03 -08:00
Ryan Fleury 76b2facbf4 restrict menu bar keyboard shortcuts to being modifierless 2024-01-25 07:47:11 -08:00
Ryan Fleury 813554fa62 detect alt-held character inputs; short-circuit menu bar shenanigans on chars-with-alt 2024-01-25 07:29:55 -08:00
Ryan Fleury 7cf0854178 reimplement run-to-line and run-to-address with temporary user breakpoints which die-on-stop, which provides the desired flow for e.g. run-to-line while nothing runs 2024-01-25 07:07:22 -08:00
Ryan Fleury ed7d31d7ea support C++ style scope resolution in txti buffer * point -> expression range path 2024-01-25 06:18:47 -08:00
Ryan Fleury 66b56789c6 eval: support for multiple namespacified fallback token lookups, to account for the several possibilities of namespaces & nested namespaces & static class members nested inside of namespaces & namespaces within namespaces within classes within namespaces & wow C++ is very bad; also ui: temporarily disable space-to-click, as it conflicts with typing and this case is not yet well supported 2024-01-25 06:15:28 -08:00
Ryan Fleury 96b0dd0783 note on bilinear sampling requirement (e.g. not interpolating per-vertex coordinates) for specific UI 2024-01-24 16:10:11 -08:00
Ryan Fleury 2dbcc26cdb switch local dev debugger to using local user/profile files, to explicitly separate from stable build 2024-01-24 15:26:12 -08:00
786 changed files with 410351 additions and 162365 deletions

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
*.sh text=auto eol=lf
src/lib_rdi/rdi.h text=auto eol=lf
src/lib_rdi/rdi.c text=auto eol=lf
*.meta.* text=auto eol=lf
*.exe filter=lfs diff=lfs merge=lfs -text
*.pdb filter=lfs diff=lfs merge=lfs -text
*.elf filter=lfs diff=lfs merge=lfs -text
*.rdi filter=lfs diff=lfs merge=lfs -text
+132 -9
View File
@@ -8,21 +8,144 @@ on:
paths-ignore:
- '**.md'
env:
TORTURE_FLAGS: "--gen_crash_dump"
jobs:
build-ubuntu-24-04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target:
- raddbg
- raddbg_non_graphical
- radlink
- radbin
- torture
compiler:
- clang-22
# TODO: - gcc
mode:
- debug
- release
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: true
- name: Install Dependencies
shell: bash
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main"
sudo apt-get update
sudo apt-get install -y clang-22 lld-22 llvm-22 gcc-14 pkg-config libfreetype6-dev libx11-dev libxext-dev libgl1-mesa-dev libegl1-mesa-dev
sudo ln -s /usr/bin/llvm-symbolizer-22 /usr/bin/llvm-symbolizer
- name: build
shell: bash
run: |
CC="${{ matrix.compiler }}" ./build.sh "${{ matrix.target }}" "${{ matrix.mode }}"
build-windows-2022:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
target:
- raddbg
- radlink
- radbin
- mule_main
compiler:
- msvc
- clang
mode:
- debug
- release
steps:
- name: checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v6
with:
lfs: true
- name: build (vs 2022)
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call build raddbg msvc debug
call build raddbg_from_pdb msvc debug
call build raddbg_from_dwarf msvc debug
call build raddbg clang debug
call build raddbg_from_pdb clang debug
call build raddbg_from_dwarf clang debug
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_INSTALL=%%i"
call "%VS_INSTALL%\VC\Auxiliary\Build\vcvarsall.bat" x64
call build meta "${{ matrix.target }}" "${{ matrix.compiler }}" "${{ matrix.mode }}" || exit /b 1
run-ubuntu-24-04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
compiler:
- clang-22
# TODO: - gcc
mode:
- debug
# TODO: - release
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: true
- name: Install Dependencies
shell: bash
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main"
sudo apt-get update
sudo apt-get install -y clang-22 lld-22 llvm-22 gcc-14 pkg-config libfreetype6-dev libx11-dev libxext-dev libgl1-mesa-dev libegl1-mesa-dev
# crash callstack symbolizer depends on LLVM
sudo ln -s /usr/bin/llvm-symbolizer-22 /usr/bin/llvm-symbolizer
- name: Run
shell: bash
run: |
CC="${{ matrix.compiler }}" ./run_tests.sh clang "${{ matrix.mode }}" -- \* $TORTURE_FLAGS
- name: Upload Artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: torture-crash-dumps-${{ matrix.compiler }}-${{ matrix.mode }}
path: |
build/*.core
build/*.exe
build/*.pdb
build/torture_artifacts/**
if-no-files-found: ignore
run-windows-2022:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
compiler:
- msvc
- clang
mode:
- debug
- release
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: true
- name: Run
shell: cmd
run: |
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_INSTALL=%%i"
call "%VS_INSTALL%\VC\Auxiliary\Build\vcvarsall.bat" x64
call run_tests.bat ${{ matrix.compiler }} ${{ matrix.mode }} -- * %TORTURE_FLAGS% || exit /b 1
- name: Upload Artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: torture-crash-dumps-${{ matrix.compiler }}-${{ matrix.mode }}
path: |
build/*.dmp
build/*.exe
build/*.pdb
build/torture_artifacts/**
if-no-files-found: ignore
+5 -3
View File
@@ -1,3 +1,5 @@
/build/
/local/
*~
/build/
/local/
*~
.vs
tags
+399
View File
@@ -0,0 +1,399 @@
# v0.9.28-alpha
## Linker Changes
- Implemented `/OPT:ICF` identical COMDAT folding.
- Added DEF, and SECTION configuration support.
- Improved COMDAT handling for weak symbols, ICF, and zero-sized COMDAT
anchors, and stopped emitting empty marker sections that could produce invalid
PE images.
- Fixed import/export edge cases, including import data-directory bounds and
archive member handling for `__imp_*` symbols.
- Accepted duplicate identical weak search aliases without reporting multiply
defined symbols.
- Add support for UTF-16 encoded response files.
- Fixed DBI section-contribution image-section range mapping.
- Improved debug logging for `/OPT:REF` liveness stats and unresolved symbols
referenced by `.llvm_addrsig`.
# v0.9.27-alpha
## Debugger Changes
- Fixed an issue which would rarely cause steps to take a long time.
- Drastically improved memory usage of PDB -> RDI conversion for some
workloads, notably PDBs with many small compilation units.
- Added the ability to disambiguate symbol names by module name, debug info
name, or compilation unit name in expressions. This can be done using the
usual syntax, e.g. `my_module.dll!foo`, or `my_unit.obj!foo`. `:` can also be
used instead of `!`.
- Added the ability to redirect debug string output to any label on a
per-target basis. Those labels can then be evaluated in any watch window or
text visualizer. By default, all targets write to `output`, which is
automatically visualized by an `Output` tab. But if you want different
targets to route their debug output to different buffers, you can name the
buffers differently, and then view those in separate text views.
- Added a `Run To Name` command.
- Added an `Auto Load Last Project` setting, which will automatically load the
most recently loaded project on startup (the old behavior pre-0.9.26). This
setting is off by default.
- Added right-click menus for watch expressions, to easily find them in a
memory view, or to break when their value changes.
- Added preliminary support for symbol servers. First, the debugger can attempt
to download debug info for any module via the `Download Module Debug Info`
command (also accessible by right-clicking a module). Second, the debugger
can be configured to automatically do this for all modules which don't have
debug info via the `Auto Download Debug Info` setting. The local cache path
and server URLs used by the debugger for downloading symbols are parsed from
the `_NT_SYMBOL_PATH` environment variable. If that environment variable is
not configured, then it falls back to the defaults of `C:/SymbolCache` and
`https://msdl.microsoft.com/download/symbols`.
- Adjusted the default dark theme.
- Made several UI visual improvements.
- Fixed a few issues relating to offline symbol evaluation (evaluation of
symbols in debug info when not debugging); this was sometimes preventing
function listers (e.g. used in `Go To Name`) from working when not debugging.
- Fixed the debugger's snap-to-code-location rule when a `Disassembly` tab is
occupying the same panel as source code tabs. Previously, the debugger would
overly aggressively switch back to source code tabs. Now, it should respect
the preference of disassembly correctly.
- Improved the stability of the step-over-line operation. Our stepping
algorithm would sometimes cause spurious (and rarely, non-spurious)
access violation exceptions when a thread would try to execute at address
`0x38f`. This most regularly surfaced when an exception on one thread (like a
breakpoint being hit) would interrupt stepping on another thread. This has
been resolved, and stepping in such scenarios should be much more reliable.
- Fixed some crashes in the PDB -> RDI converter. (#792, #803)
- Fixed a bug which was sometimes causing a step-over operation to resume the
process without catching the target thread after its step completed. (#804)
- Adjusted evaluation visualizations to include fully qualified symbol names.
(#809)
## Linker Changes
- /OPT:REF Fixed a race in the dead-code-elimination pass where the linker
sometimes erroneously removed live sections.
- Fixed a bug where the linker emitted relocations for empty COFF resource entries,
which lead to "relocating against symbol that is in a removed section" errors.
- Added the /RAD_TYPE_SERVER switch to run the type-dedup pass on object files,
producing RRT files that can be passed back on the next link to improve
linking speed.
# v0.9.26-alpha
## Debugger Changes
- Added scope ending visualizations to the text view, to display the header of
a scope at the closing position of the scope. This can be turned off via the
`Cursor Scope End Annotations` setting.
- Added the ability to evaluate `autos`, which is a collection of expressions
that the debugger determines refer to symbols which are being (or about to
be) changed by the selected thread.
- Added source-inline and disassembly-inline visualization of auto expressions.
This can be turned off via the `Show Auto Watches In Source / Disassembly`
setting.
- Added the ability to evaluate local static variables unambiguously, when the
same name is used for multiple local static variables, even when outside the
function containing the local static. This can be done by namespacing the
variable name with the containing function, either using a `::` or `.`
operator. (#359)
- Added a setting, `Transient Tabs`, to disable transient tabs being opened,
when the debugger automatically snaps to new code locations.
- Added a setting, `Display Pointer Addresses Before Contents`, to always
force the debugger to show pointer addresses before attempting to visualize
to what the pointer points.
- Adjusted the `Step Out` command to perform scope-granularity stepping, rather
than only being function-frame-granularity. This uses scope information found
in debug info to step out of scopes when possible, rather than always exiting
the current function frame. This makes the command much more useful for
stepping through larger functions with several scopes of larger work, or for
stepping out of loops. (#746)
- Adjusted the debugger's user & project configuration file behavior to be less
idiosyncratic with other programs. Project files are no longer auto-loaded
based on the project last loaded during the previous debugger runtime.
Creating a new user or project also does not immediately require choosing a
path for the file; these can later be specified using the respective `Save`
commands. (#743)
- Adjusted the debugger to automatically set the current path when loading a
project file. (#743)
- Added syntax highlighting and tab-completion for view identifiers in
watch expressions.
- Added more in-debugger documentation for views and their arguments, when
written in a watch expression.
- Moved configuration data previously treated as project data to being user
data, tagged with the associated project. This includes loaded debug info and
breakpoints. The effect of this is that project files are much easier to
check into source control (they do not change in spurious ways for other
users on a project), but project-related user configuration will still be
correctly filtered based on whatever project is loaded.
- Improved the debugger's behavior with respect to keeping previously-loaded
debug info around. Now, when the debugger begins a new debugging session, it
will unload all loaded debug info, and it will only reload debug info that is
actively found to be needed by debuggees. This preserves the debugger's
ability to use debug info without debugging for features like
go-to-definition and type evaluation, but it stops the debugger from keeping
old and unneeded debug info loaded indefinitely (until it is manually
unloaded). (#711)
- Adjusted recent project visualization to include the name of the project,
specified with the `Project Name` setting.
- Renamed `Switch` to `Open Source File From Debug Info`, to better represent
the command's functionality.
- Adjusted file path evaluation visualization to include the full path to the
containing folder, when it is not obvious from context (for instance, if the
file evaluation is a child evaluation of a folder evaluation, the containing
folder path is not shown; if the file path is evaluated standalone, as it is
in the lister generated for the `Open Source File From Debug Info` command,
then the containing folder path is shown).
- Improved visualization of unmapped addresses in the memory view. Now, instead
of bytes at these addresses being displayed as `0` with a special background,
they are displayed as `x`, and the annotations for these addresses (displayed
at the bottom of the memory view, for the cursor's cell) explicitly label
them as being unmapped.
- Improved visualization of unmapped addresses in watch expressions. Now,
instead of only being colored differently with evaluations reading as zeroed
memory, the value will explicitly label addresses as unmapped when possible.
- Fixed a leak which most notably manifested during rapid creation/destruction
of new threads. (#780)
- Fixed a leak related to debugger's config state. This was difficult to
reproduce, but it may fix leaks experienced after running the debugger for an
extended period of time.
- Fixed a bug where cross-module evaluations would resolve to incorrect
addresses, due to using the incorrect module's base virtual address. This was
also causing broken behavior sometimes in the `Go To Name` lister, and
other similar UIs.
- Fixed a bug where panels without tabs were unnecessarily keeping the debugger
UI awake in some cases.
- Fixed a bug preventing hover evaluation from working on indexing expressions.
(#707)
- Replaced the DWARF -> RDI converter with a new multithreaded version, which
should execute much faster on larger DWARF debug info, and produce much
smaller RDI output, due to the addition of type deduplication.
- Introduced structured namespaces to RDI, which structurally encode namespace
hierarchies for debug info symbols, instead of this information being
implicitly baked using language-specific conventions into symbol names. This
is used to deduplicate repeated namespace prefixes from symbol names, leading
to a smaller string footprint for generated RDIs. Symbols now only store
their partially-qualified name. For example, for a C++ symbol `A::B::C`, the
symbol itself will store its name as `C`, but it will also record its
container as being `B`. `B`, then, will record its container as being `A`.
This allows users of RDI to dynamically construct the fully-qualified name as
needed, and it allows for more reliable and language-agnostic usage of
partially-qualified symbol names.
- Adjusted the debugger to not rely on `SynchronizationBarrier` functions on
Windows when they're not available (pre-Windows-8). (#739)
## Linker Changes
- Implemented /DEBUG:GHASH
- Fixed an issue where an import thunk or import address could be linked from
the currently searched library instead of the library where the first import
reference was found. For example, if the first pass finds the import thunk in
foo.lib and the second pass resolves symbol to the import address in bar.lib,
the linker now always linkes the import thunk and import address members from
the library where the first reference was found.
- /OPT:REF: Fixed an issue with garbage collection of associated sections and
weak symbols that led linker to remove live sections.
- /OPT:REF Added relocation batching to reduce contention on the global
reference list during garbage collection.
# v0.9.25-alpha
## Debugger Changes
- Added a dedicated cursor address bar to the memory view. This can be focused
with the keyboard with the `Focus Menu` command. By default, this command is
bound to `Alt + D`, but if you have existing configuration, you may need to
bind it yourself manually (this can be done in the palette). This address bar
accepts any expression, and controls the cursor's address. All other
configuration options are still available in the memory view settings.
- Added "Peek Types" to the memory view. These control the set of types which
are used to interpret bytes at the cursor. Options exist for basic cases,
like integers and floats, but the view also supports entering a list of
full type expressions, which can include user-defined types like structures.
- Added annotations for members of structure variables to the memory view.
- Added a dedicated zoom setting for the memory view.
- Added a setting for automatically determining the number of columns in the
memory view based on the available space.
- Fixed many bugs and improved visuals in the memory view. (#690)
- Fixed the debugger incorrectly evaluating pointer casts of registers in
register space, rather than promoting them to process address space
evaluations. This fixes cases where expressions like `(int *)rax` were not
evaluating correctly. (#659)
- Fixed the debugger incorrectly requiring multiple step operations when source
lines mapped to multiple discontiguous ranges of instructions. This most
notably showed up with certain styles of `for`-loops, especially with Clang
and other non-C/C++ languages, and function prologues in non-C/C++ languages.
- Fixed the debugger treating the `foo, x` fastpath for `hex(foo)` differently
than `hex(foo)`, in that the hexadecimal setting was not being inherited.
- Fixed the debugger leaking debug info conversion process handles. This
addresses cases where the debugger was preventing stale debug info from being
updated, after a rebuild. (#736)
- Fixed the debugger not correctly using target-embedded markup data. (#702)
- Fixed the debugger not showing full call stacks when the top instruction
pointer is located at a 0 address.
- Fixed integer casts producing incorrect values. (#754)
- Fixed the PDB -> RDI converter's interpretation of certain empty argument
lists in function types in PDB. This fixes some cases where local variables
were being interpreted as parameters, which resulted in incorrect evaluation
results. (#751)
- Fixed several crashes and instabilities. (#735)
- Added a dedicated settings button to the focused tab. This opens the same
menu as right-clicking the tab, but this makes this menu (and thus all
options for all tabs and views) more discoverable.
- Added optional cursor trails, to visualize cursor motion. Can be turned off
by toggling the `Cursor Trail` setting.
- Added project names. When set, this name is used for displaying the project
instead of the project filename in the UI and window titles.
- Adjusted the rules for explicit file location finding commands (like
`Switch`, or `Switch To Partner File`), such that they prefer creating new
non-transient tabs, even if the target file is found within an existing
transient tab.
- Adjusted the source code context menu to activate commands with a single
press, rather than the usual double click behavior from general palettes.
## Linker Changes
- Optimized debug info generation to reduce memory usage in large links by 25%.
- Fixed a determinism issue that caused linker to write unreliable debug info.
- Fixed over-reservetaion of PDB pages, reducing the PDB size.
- Implemented /INFERASANLIBS
- Implemented /WHOLEARCHIVE
- Implemented /PDBSTRIPPED
- Set correct defaults for unload and bind import tables.
# v0.9.24-alpha
## Debugger Changes
- Added the ability for the debugger to load, use, and evaluate using debug
info, even when not actively debugging. The debugger will now keep a process'
debug info loaded, even after the process ends. It stores the set of loaded
debug info files in the project configuration file, meaning it will also
automatically load the same debug info across many runs. Debug info can also
be loaded manually (without ever launching a process) with the
`Load Debug Info` command. There is also a new tab, `Debug Info`, which allows
viewing and managing the set of loaded debug info files.
- Improved the debugger's behavior when used as a drag & drop target, to allow
for debug info loading as an option (when relevant), and to better handle the
case where many files (potentially of different types) are dropped together.
- Improved debug info searching performance and reponsiveness in large projects.
- Fixed some crashes and incorrect results with the new `list` view.
- Fixed some cases where RDIs did not contain some basic types from their
originating PDBs.
- Allowed `.` and `->` operators to be used with array types.
- Fixed the debugger's treatment of quoted command line arguments when building
targets. In previous versions, calling `raddbg main.exe "foo bar baz"` would
create a target `main.exe` with arguments `foo bar baz` (dropping the quotes).
This is now fixed, such that the target's arguments string will also contain
the quotes, and pass them to the target when launched.
- Fixed the debugger not correctly responding (through font and UI scale) to DPI
changes.
- Fixed the debugger incorrectly generating conflicting source line info records
in PDB -> RDI conversion, which in some scenarios was preventing source line
maps from working (leading to breakpoint resolution failing).
- Other small fixes, improvements, and tweaks.
# v0.9.23-alpha
## Debugger Changes
- Further improved PDB -> RDI conversion performance & memory usage.
- Adjusted limits for the amount of PDB -> RDI conversion work that the
debugger will kick off, to prevent PDB -> RDI conversion interfering with
debuggee performance.
- Reintroduced the `list` lens, which gathers all nodes in a linked list, and
visualizes them as a flat list of pointers (the same as how an array of
pointers is visualized).
- Fixed a crash when closing empty Geometry 3D views. (#652, #657)
- Fixed the debugger not visualizing `enum` types when evaluated through a
bitfield type. (#655)
- Fixed the PDB -> RDI conversion not correctly generating location information
for function parameters, when the EXE/PDB were built to include support for
Edit and Continue (`-ZI` switch). (#656)
## Binary Utility Changes
- Fixed a crash when using the `--compress` option, when generating RDI files.
# v0.9.22-alpha
## Debugger Changes
- Further improved PDB -> RDI conversion performance.
- Capped the number of additional threads / processes spawned for PDB -> RDI
conversion.
- Prioritize PDB -> RDI conversion based on what is actually found to be
necessary by the debugger, rather than converting all PDBs in the order in
which they're discovered.
- Added preliminary support for DWARF -> RDI conversion on Windows.
- The debugger now relies on source file checksums to determine whether or not
a source file is out-of-date with respect to what was compiled when debug info
was produced, rather than just the modification timestamp.
- The debugger now will rely on debug info to detect the language of source code
files, if it cannot infer from the source file's extension, or view settings.
This will enable features like syntax highlighting and hover evaluation in
cases like `.inl` files being included in C++ projects.
- The debugger now will restore the last focused window when continuing
automatically. (#245, #596)
- Watch tables have been simplified in that they no longer have a separate
column for evaluation types, since this was usually taking a lot more space
than it deserved. The type of evaluations is still displayed in watch table
cells, and it can always be evaluated directly via `typeof`.
- Type evaluations have been simplified in watch tables as well; they no longer
have untitled columns for sizes and offsets, this is instead displayed as
an extra note by default. Similar behavior to the original behavior can still
be obtained using the `columns` view, if needed.
- The debugger no longer uses complex `union` types for most registers, and
instead just displays the register value plainly.
- The hover evaluation UI has been made larger when needed.
- The debugger now prefers matching global, function, and type identifiers to
the most relevant debug info and module in context; this fixes evaluation in
some multi-process debugging contexts. (#581)
- Fixed the debugger unnecessarily stripping `enum` type information when
accessed through array operators. (#634)
- The debugger now understands a standalone `unsigned` keyword as an
`unsigned int` type, to match C rules.
- The debugger now uses the current working directory to form the working
directory for targets specified on the command line, to match behavior when
running a command from the command line without the debugger.
- Improved call stack computation performance.
- Improved debugger memory usage over long periods of time.
- Fixed string-pointer comparison not working with not-equal (`!=`) operations.
- Fixed a bug which was causing bad debuggee performance on some threads after
some interactions with the debugger controller.
- Fixed incorrect results when adding two register values. (#642)
- Fixed the interpretation of register expressions in visualizers. (#649)
- Fixed "forever loading" states in disassembly views in some cases. (#643)
- Fixed jittering on window resizing. (#636)
- Fixed the bitmap visualizer crashing in some circumstances relating to
unsupported bitmap sizes. (#444, #563)
- Fixed a crash when an empty `cast()` expression would be evaluated. (#625)
- Fixed a crash when an invalid expression would be visualized using the `text`
view. (#647)
## Linker Changes
- Changed symbol resolution in libaries to match MSVC behavior.
- Optimized image building step to reduce memory usage.
- Linker memory maps all input files by default to lower memory usage.
(`/RAD_MEMORY_MAP_FILES`)
- If debug info is available, linker uses it to show file and line number for
unresolved relocations.
- Improved base relocation build performance for large images, cutting build
time by 70%.
- Added stubs for `/Brepro`, `/D2`, and /ErrorReport to improve compatability
with existing response files
- Implemented section garbage collection (`/OPT:REF`)
- Fixed bug where thread local variables pointed to incorrect types.
- Changed rules for weak and undefined symbols, now weak symbol is not allowed
to replace an undefined symbol.
- Linker no longer creates thunks for imports that don't require them.
## Binary Utility Changes
- The binary utility, like the debugger, now can convert DWARF debug info to
RDI files. When both DWARF and PDB info is present, it can now convert both,
and produce a single final RDI file with all information.
- Textual dumping of RDI files is now done in parallel, massively improving
dumping performance.
- PDB -> Breakpad conversion performance has now been parallelized to a greater
degree, improving performance.
+19 -19
View File
@@ -1,19 +1,19 @@
Copyright (c) 2024 Epic Games Tools
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Copyright (c) Epic Games Tools
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+428 -325
View File
@@ -1,325 +1,428 @@
# The RAD Debugger Project
The RAD Debugger is a native, user-mode, multi-process, graphical debugger. It
currently only supports local-machine Windows x64 debugging with PDBs, with
plans to expand and port in the future. In the future we'll expand to also
support native Linux debugging and DWARF debug info.
The RAD Debugger is currently in *ALPHA*. In order to get the debugger bullet-
proof, it'd greatly help out if you submitted the issues you find here, along
with any information you can gather, like dump files (along with the build you
used), instructions to reproduce, test executables, and so on.
You can download pre-built binaries for the debugger
[here](https://github.com/EpicGames/raddebugger/releases).
The RAD Debugger project aims to simplify the debugger by simplifying and
unifying the underlying debug info format. In that pursuit we've built
the RADDBG debug info format, which is what the debugger parses and uses. To
work with existing toolchains, we convert PDB (and eventually PE/ELF files
with embedded DWARF) into the RADDBG format on-demand. This conversion process
is currently an unoptimized reference version. Nevertheless it's still quite
fast for smaller PDB files (in many cases faster than many other programs
simply deserialize the PDBs). It is much slower for much larger projects at the
moment, but we expect this will vastly improve overtime.
The RADDBG format is currently specified in code, in the files within the
`src/raddbg_format` folder. The other relevant folders for working with the
format are:
- `raddbg_cons`: The RADDBG construction layer, for constructing RADDBG files.
- `raddbg_convert`: Our implementation of PDB-to-RADDBG (and an in-progress
implementation of a DWARF-to-RADDBG) conversion.
- `raddbg_dump`: Code for textually dumping information from RADDBG files.
## Development Setup Instructions
**Note: Currently, only x64 Windows development is supported.**
### 1. Installing the Required Tools (MSVC & Windows SDK)
In order to work with the codebase, you'll need the [Microsoft C/C++ Build Tools
v15 (2017) or later](https://aka.ms/vs/17/release/vs_BuildTools.exe), for both
the Windows SDK and the MSVC compiler and linker.
If the Windows SDK is installed (e.g. via installation of the Microsoft C/C++
Build Tools), you may also build with [Clang](https://releases.llvm.org/).
### 2. Build Environment Setup
Building the codebase can be done in a terminal which is equipped with the
ability to call either MSVC or Clang from command line.
This is generally done by calling `vcvarsall.bat x64`, which is included in the
Microsoft C/C++ Build Tools. This script is automatically called by the `x64
Native Tools Command Prompt for VS <year>` variant of the vanilla `cmd.exe`. If
you've installed the build tools, this command prompt may be easily located by
searching for `Native` from the Windows Start Menu search.
You can ensure that the MSVC compiler is accessible from your command line by
running:
```
cl
```
If everything is set up correctly, you should have output very similar to the
following:
```
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30151 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
```
### 3. Building
Within this terminal, `cd` to the root directory of the codebase, and just run
the `build.bat` script:
```
build
```
You should see the following output:
```
[debug mode]
[msvc compile]
[default mode, assuming `raddbg` build]
metagen_main.c
searching C:\devel\raddebugger/src... 299 files found
parsing metadesk... 12 metadesk files parsed
gathering tables... 37 tables found
generating layer code...
raddbg.cpp
```
If everything worked correctly, there will be a `build` folder in the root
level of the codebase, and it will contain a freshly-built `raddbg.exe`.
## Short-To-Medium-Term Roadmap
### The Initial Alpha Battle-Testing Phase
The first priority for the project is to ensure that the most crucial debugger
components are functioning extremely reliably for local, x64, Windows
debugging. This would include parts like debug info conversion, debug info
loading, process control, stepping, evaluation (correct usage of both location
info and type info), and a robust frontend which ensures the lower level parts
are usable.
We feel that the debugger has already come a long way in all of these respects,
but given the massive set of possible combinations of languages, build
settings, toolchains, used language features, and patterns of generated code,
there are still cases where the debugger has not been tested, and so there are
still issues. So, we feel that the top priority is eliminating these issues,
such that the debugging experience is rock solid.
Additionally, the debug info conversion process is not fast (nor wide) enough
to support extremely large projects. This is for two reasons: (a) the
PDB-to-RADDBG converter is an unoptimized reference implementation, and (b) the
debugger learns of new modules (and thus which PDBs to load) in a
serially-dependent way (this is necessarily the case for correct debugging
results). We expect that the conversion process' performance can be massively
improved, and also that some heuristics can be used to begin converting PDBs
to RADDBGs before the debugger knows those PDBs are needed, thus ensuring the
associated RADDBG files are ready instantaneously when the associated modules
are finally loaded by the debugger. Improving this situation is a major part of
this phase, as it will make the debugger much more usable for large projects.
### Local x64 Linux Debugging Phase
The next priority for the project is to take the rock solid x64 Windows
debugging experience, and port all of the relevant pieces to support local x64
Linux debugging also.
The debugger has been written to abstract over the parts that need to differ on
either Linux or Windows, and this is mainly going to be a task in building out
different backends for those abstraction layers.
The major parts of this phase are:
- Porting the `src/demon` layer to implement the Demon local process control
abstraction API.
- Porting the `src/unwind` layer to support x64 ELF unwinding (currently, there
is only an x64 PE unwinding implementation).
- Creating a DWARF-to-RADDBG converter (in the same way that we've built a PDB-
to-RADDBG converter). A partial implementation of this is in
`src/raddbg_convert/dwarf`.
- Porting the `src/render` layer to implement all of the rendering features the
frontend needs on a Linux-compatible API (the backend used on Windows is D3D11).
- Porting the `src/font_provider` layer to a Linux-compatible font
rasterization backend, like FreeType (the backend used on Windows is
DirectWrite).
- Porting the `src/os` layers to Linux. This includes core operating system
abstraction (virtual memory allocation, threading and synchronization
primitives, and so on), and graphical operating system abstraction (windows,
input events, and so on).
Once the above list is complete, and once every part is rock solid, the Windows
debugging experience we'll have worked diligently to create will also be
available natively on Linux machines.
### And Beyond!
There are several directions we might take after these two major phases,
like remote debugging, porting to different architectures, further improving
the debugger's features (like improving the visualization engine), and so on.
But for now, we're mostly focused on those first two phases.
## Top-Level Directory Descriptions
- `data`: Small binary files which are used when building, either to embed
within build artifacts, or to package with them.
- `src`: All source code.
After setting up the codebase and building, the following directories will
also exist:
- `build`: All build artifacts. Not checked in to version control.
- `local`: Local files, used for local build configuration input files.
## Codebase Introduction
The codebase is organized into *layers*. Layers are separated either to isolate
certain problems, and to allow inclusion into various builds without needing to
pull everything in the codebase into a build. Layers correspond with folders
inside of the `src` directory. Sometimes, one folder inside of the `src`
directory will include multiple sub-layers, but the structure is intended to be
fairly flat.
Layers correspond roughly 1-to-1 with *namespaces*. The term "namespaces" in
this context does not refer to specific namespace language features, but rather
a naming convention for C-style namespaces, which are written in the codebase as
a short prefix, usually 1-3 characters, followed by an underscore. These
namespaces are used such that the layer to which certain code belongs may be
quickly understood by glancing at code. The namespaces are generally quite short
to ensure that they aren't much of a hassle to write. Sometimes, multiple sub-
layers will share a namespace. A few layers do not have a namespace, but most
do. Namespaces are either all-caps or lowercase depending on the context in
which they're used. For types, enum values, and some macros, they are
capitalized. For functions and global variables, they are lowercase.
Layers depend on other layers, but circular dependencies would break the
separability and isolation utility of layers (in effect, forming one big layer),
so in other words, layers are arranged into a directed acyclic graph.
A list of the layers in the codebase and their associated namespaces is below:
- `base` (no namespace): Universal, codebase-wide constructs. Strings, math,
memory allocators, helper macros, command-line parsing, and so on. Depends
on no other codebase layers.
- `coff` (`COFF_`): Code for parsing and/or writing the COFF (Common Object File
Format) file format.
- `ctrl` (`CTRL_`): The debugger's "control system" layer. Implements
asynchronous process control, stepping, and breakpoints for all attached
processes. Runs in lockstep with attached processes. When it runs, attached
processes are halted. When attached processes are running, it is halted.
Driven by a debugger frontend on another thread.
- `dasm` (`DASM_`): An asynchronous disassembly decoder and cache. Users ask for
disassembly for a particular virtual address range in a process, and threads
implemented in this layer decode and cache the disassembly for that range.
- `dbgi` (`DBGI_`): An asynchronous debug info loader and cache. Loads debug
info stored in the RADDBG format. Users ask for debug info for a particular
executable, and on separate threads, this layer loads the associated debug
info file. If necessary, it will launch a separate conversion process to
convert original debug info into the RADDBG format.
- `demon` (`DEMON_`): An abstraction layer for local-machine, low-level process
control. The abstraction is used to provide a common interface for process
control on target platforms. Used to implement part of `ctrl`.
- `df/core` (`DF_`): The debugger's non-graphical frontend. Implements a
debugger "entity cache" (where "entities" include processes, threads, modules,
breakpoints, source files, targets, and so on). Implements a command loop
for driving process control, which is used to implement stepping commands and
user breakpoints. Implements extractors and caches for various entity-related
data, like full thread unwinds and local variable maps. Also implements core
building blocks for evaluation and evaluation visualization.
- `df/gfx` (`DF_`): The debugger's graphical frontend. Builds on top of
`df/core` to provide all graphical features, including windows, panels, all
of the various debugger interfaces, and evaluation visualization.
- `draw` (`D_`): Implements a high-level graphics drawing API for the debugger's
purposes, using the underlying `render` abstraction layer. Provides high-level
APIs for various draw commands, but takes care of batching them, and so on.
- `eval` (`EVAL_`): Implements a compiler for an expression language built for
evaluation of variables, registers, and so on from debugger-attached processes
and/or debug info. Broken into several phases mostly corresponding to
traditional compiler phases - lexer, parser, type-checker, IR generation, and
IR evaluation.
- `font_cache` (`F_`): Implements a cache of rasterized font data, both in CPU-
side data for text shaping, and in GPU texture atlases for rasterized glyphs.
All cache information is sourced from the `font_provider` abstraction layer.
- `font_provider` (`FP_`): An abstraction layer for various font file decoding
and font rasterization backends.
- `geo_cache` (`GEO_`): Implements an asynchronously-filled cache for GPU
geometry data, filled by data sourced in the `hash_store` layer's cache. Used
for asynchronously preparing data for memory visualization in the debugger.
- `hash_store` (`HS_`): Implements a cache for general data blobs, keyed by a
128-bit hash of the data. Used as a general data store by other layers.
- `metagen` (`MG_`): A metaprogram which is used to generate primarily code and
data tables. Consumes Metadesk files, stored with the extension `.mdesk`, and
generates C code which is then included by hand-written C code. Currently, it
does not analyze the codebase's hand-written C code, but in principle this is
possible. This allows easier & less-error-prone management of large data
tables, which are then used to produce e.g. C `enum`s and a number of
associated data tables. There are also a number of other generation features,
like embedding binary files or complex multi-line strings into source code.
This layer cannot depend on any other layer in the codebase directly,
including `base`, because it may be used to generate code for those layers. To
still use `base` and `os` layer features in the `metagen` program, a separate,
duplicate version of `base` and `os` are included in this layer. They are
updated manually, as needed. This is to ensure the stability of the
metaprogram.
- `mule` (no namespace): Test executables for battle testing debugger
functionality.
- `natvis` (no namespace): NatVis files for type visualization of the codebase's
types in other debuggers.
- `os/core` (`OS_`): An abstraction layer providing core, non-graphical
functionality from the operating system under an abstract API, which is
implemented per-target-operating-system.
- `os/gfx` (`OS_`): An abstraction layer, building on `os/core`, providing
graphical operating system features under an abstract API, which is
implemented per-target-operating-system.
- `os/socket` (`OS_`): An abstraction layer, building on `os/core`, providing
networking operating system features under an abstract API, which is
implemented per-target-operating-system.
- `pe` (`PE_`): Code for parsing and/or writing the PE (Portable Executable)
file format.
- `raddbg` (no namespace): The layer which ties everything together for the main
graphical debugger. Not much "meat", just drives `df`, implements command line
options, and so on.
- `raddbg_cons` (`CONS_`): Implements an API for constructing files of the
RADDBG debug info file format.
- `raddbg_dump` (`DUMP_`): A dumper utility program for dumping textualizations
of RADDBG debug info files.
- `raddbg_format` (`RADDBG_`): Standalone types and helper functions for the
RADDBG debug info file format. Does not depend on `base`.
- `raddbg_markup` (`RADDBG_`): Standalone header file for marking up user
programs to work with various features in the `raddbg` debugger. Does not
depend on `base`.
- `regs` (`REGS_`): Types, helper functions, and metadata for registers on
supported architectures. Used in reading/writing registers in `demon`, or in
looking up register metadata.
- `render` (`R_`): An abstraction layer providing an abstract API for rendering
using various GPU APIs under a common interface. Does not implement a high
level drawing API - this layer is strictly for minimally abstracting on an
as-needed basis. Higher level drawing features are implemented in the `draw`
layer.
- `scratch` (no namespace): Scratch space for small and transient test or sample
programs.
- `texture_cache` (`TEX_`): Implements an asynchronously-filled cache for GPU
texture data, filled by data sourced in the `hash_store` layer's cache. Used
for asynchronously preparing data for memory visualization in the debugger.
- `txti` (`TXTI_`): Machinery for asynchronously-loaded, asynchronously hot-
reloaded, asynchronously parsed, and asynchronously mutated source code files.
Used by the debugger to visualize source code files. Users ask for text lines,
tokens, and metadata, and it is prepared on background threads.
- `type_graph` (`TG_`): Code for analyzing and navigating type structures from
RADDBG debug info files, with the additional capability of constructing
synthetic types *not* found in debug info. Used in `eval` and for various
visualization features.
- `ui` (`UI_`): Machinery for building graphical user interfaces. Provides a
core immediate mode hierarchical user interface data structure building
API, and has helper layers for building some higher-level widgets.
- `unwind` (`UNW_`): Code for generating unwind information from threads, for
supported operating systems and architectures.
# The RAD Debugger Project
_**NOTE:** This README does not document usage instructions and tips for the
debugger itself, and is intended as a technical overview of the project. The
debugger's README, which includes usage instructions and tips, can be found
packaged along with debugger releases, or within the `build` folder after a
local copy has been built. You can find pre-built release binaries
[here](https://github.com/EpicGames/raddebugger/releases)._
The RAD Debugger is a native, user-mode, multi-process, graphical debugger. It
currently only supports local-machine Windows x64 debugging with PDBs, with
plans to expand and port in the future. In the future we'll expand to also
support native Linux debugging and DWARF debug info.
The debugger is currently in *ALPHA*. In order to get the debugger
bullet-proof, it'd greatly help out if you submitted the issues you find
[here](https://github.com/EpicGames/raddebugger/issues), along with any
information you can gather, like dump files (along with the build you used),
instructions to reproduce, test executables, and so on.
In addition to the debugger, we aim to further improve the toolchain with two
additional related technologies: **(1)** the RAD Debug Info (RDI) format, and
**(2)** the RAD Linker.
## The RAD Debug Info (RDI) Format
The RAD Debug Info (RDI) format is our custom debug information format, which
the debugger parses and uses, rather than the debug information natively
produced by toolchains, like PDB or DWARF. To work with these existing
toolchains, we convert PDB (and eventually PE/ELF files with embedded DWARF)
into the RDI format on-demand.
The RDI format is currently specified in code, in the files within the
`src/lib_rdi` folder. In [`rdi.h`](src/lib_rdi/rdi.h) and
[`rdi.c`](src/lib_rdi/rdi.c), the types and functions which define the format
itself are specified. In [`rdi_parse.h`](src/lib_rdi/rdi_parse.h) and
[`rdi_parse.c`](src/lib_rdi/rdi_parse.c), helpers for parsing the format are
included.
We also have an in-progress library for constructing and serializing RDI data,
located within the `src/lib_rdi_make` folder.
Our `radbin` utility (accessible through the debugger too, via the `--bin`
command line argument) is capable of converting native debug information formats
to RDI, and of producing textual dumps of contents stored within RDI files.
## The RAD Linker
The RAD Linker is a new performance linker for generating x64 PE/COFF binaries.
It is designed to be very fast when creating gigantic executables. It generates
standard PDB files for debugging, but it can also (optionally) natively create
RAD Debug Info too, which is useful both to eliminate on-demand conversion time
when debugging, but also for huge executables that otherwise create broken
PDBs that overflow internal 32-bit tables.
The RAD Linker is primarily optimized to handle huge linking projects. In our
test cases (where debug info is multiple gigabytes), we see 50% faster link
times.
The command line syntax is fully compatible with MSVC; you can get a full list
of implemented switches from `/help`.
Our current designed-for use case for the linker is to help with the
compile-debug cycle of huge projects. We don't yet have support for
link-time-optimizations, but this feature is on the road map.
By default, the linker spawns as many threads as there are cores, so if you plan
to run multiple linkers in parallel, you can limit the number of thread workers
via `/rad_workers`.
We also have support for large memory pages, which, when enabled, reduce link
time by another 25%. To link with large pages, you need to explicitly request
them via `/rad_large_pages`. Large pages are off by default, since Windows
support for large pages is a bit buggy; we recommend they only be used in Docker
or VM images where the environment is reset after each link. In a standard
Windows environment, using large pages otherwise will fragment memory quickly,
forcing a reboot. We are working on a Linux port of the linker that will be able
to build with large pages robustly.
A benchmark of the linker's performance is below:
![AMD Ryzen Threadripper PRO 3995WX 64-Cores, 256 GiB RAM (Windows x64)](https://github.com/user-attachments/assets/a95b382a-76b4-4a4c-b809-b61fe25e667a)
---
# Project Development Setup Instructions
**NOTE: Currently, only x64 Windows development is supported for the project.**
## 1. Installing the Required Tools (MSVC & Windows SDK)
In order to work with the codebase, you'll need the [Microsoft C/C++ Build Tools
v15 (2017) or later](https://aka.ms/vs/17/release/vs_BuildTools.exe), for both
the Windows SDK and the MSVC compiler and linker.
If the Windows SDK is installed (e.g. via installation of the Microsoft C/C++
Build Tools), you may also build with [Clang](https://releases.llvm.org/).
## 2. Build Environment Setup
Building the codebase can be done in a terminal which is equipped with the
ability to call either MSVC or Clang from command line.
This is generally done by calling `vcvarsall.bat x64`, which is included in the
Microsoft C/C++ Build Tools. This script is automatically called by the `x64
Native Tools Command Prompt for VS <year>` variant of the vanilla `cmd.exe`. If
you've installed the build tools, this command prompt may be easily located by
searching for `Native` from the Windows Start Menu search.
You can ensure that the MSVC compiler is accessible from your command line by
running:
```
cl
```
If everything is set up correctly, you should have output very similar to the
following:
```
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30151 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
```
### 3. Building
Within this terminal, `cd` to the root directory of the codebase, and just run
the `build.bat` script:
```
build
```
You should see the following output:
```
[debug mode]
[msvc compile]
[default mode, assuming `raddbg` build]
metagen_main.c
searching C:\devel\raddebugger/src... 458 files found
parsing metadesk... 16 metadesk files parsed
gathering tables... 97 tables found
generating layer code...
raddbg_main.c
```
If everything worked correctly, there will be a `build` folder in the root
level of the codebase, and it will contain a freshly-built `raddbg.exe`.
This `raddbg.exe` will have been built in **debug mode**, which is not built
with optimizations, and may perform worse. To produce a
**release mode executable**, run `build.bat` with a `release` argument:
```
build release
```
This build will take significantly longer.
By default, `build.bat` only builds the debugger if no arguments (or just
`release`) are passed, but additional arguments can be passed to build the RAD
Linker, or the `radbin` CLI binary file utility:
```
build radlink release
build radbin release
```
---
# Project Roadmap
### The Initial Alpha Battle-Testing Phase
The first priority for the project is to ensure that the most crucial components
are functioning extremely reliably for local, x64, Windows development.
For the debugger, this would include parts like debug info conversion, debug
info loading, process control, stepping, evaluation (correct usage of both
location info and type info), and a robust frontend which ensures the lower
level parts are usable. For the linker, this is a matter of reliability and
convergence with existing linker behavior.
We feel that we've already come a long way in all of these respects, but given
the massive set of possible combinations of languages, build settings,
toolchains, used language features, and patterns of generated code, we still
expect some issues, and are prioritizing these issues being resolved first.
We also hope to continue to improve performance in this phase. For the debugger,
this primarily includes frontend performance, introducing caches when economical
to do so, and tightening existing systems up. For the linker, it has been mostly
tuned thus far for giant projects, and so we'd like to improve linking speed for
small-to-mid sized projects as well.
For the linker, there are also a number of features to come, like
dead-code-elimination (`/opt:ref`), and link-time-optimizations with the help
of `clang` (we won't support LTCG from MSVC, since it is undocumented).
### Local x64 Linux Debugging Phase
The next priority for the project is to take the rock solid x64 Windows
debugging experience, and port all of the relevant pieces to support local x64
Linux debugging also.
The debugger has been written to abstract over the parts that need to differ on
either Linux or Windows, and this is mainly going to be a task in building out
different backends for those abstraction layers.
The major parts of this phase are:
- Porting the `src/demon` layer to implement the Demon local process control
abstraction API.
- Implementing an x64 ELF Linux unwinder in the `src/ctrl` layer.
- Creating a DWARF-to-RDI converter (in the same way that we've built a
PDB-to-RDI converter). A partial implementation of this is in
`src/rdi_from_dwarf`.
- Porting the `src/render` layer to implement all of the rendering features the
frontend needs on a Linux-compatible API (the backend used on Windows is D3D11).
- Porting the `src/font_provider` layer to a Linux-compatible font
rasterization backend, like FreeType (the backend used on Windows is
DirectWrite).
- Porting the `src/os` layers to Linux. This includes core operating system
abstraction (virtual memory allocation, threading and synchronization
primitives, and so on), and graphical operating system abstraction (windows,
input events, and so on).
Once the above list is complete, and once every part is rock solid, the Windows
debugging experience we'll have worked diligently to create will also be
available natively on Linux machines.
### And Beyond!
There are several directions we might take after these two major phases,
like remote debugging, porting to different architectures, further improving
the debugger's features (like improving the visualization engine), and so on.
But for now, we're mostly focused on those first two phases.
---
# Codebase Introduction
## Top-Level Directory Descriptions
- `data`: Small binary files which are used when building, either to embed
within build artifacts, or to package with them.
- `src`: All source code.
After setting up the codebase and building, the following directories will
also exist:
- `build`: All build artifacts. Not checked in to version control.
- `local`: Local files, used for local build configuration input files. Not
checked in to version control.
## Layer Descriptions
The codebase is organized into *layers*. Layers are separated either to isolate
certain problems, and to allow inclusion into various builds without needing to
pull everything in the codebase into a build. Layers correspond with folders
inside of the `src` directory. Sometimes, one folder inside of the `src`
directory will include multiple sub-layers, but the structure is intended to be
fairly flat.
Layers correspond roughly 1-to-1 with *namespaces*. The term "namespaces" in
this context does not refer to specific namespace language features, but rather
a naming convention for C-style namespaces, which are written in the codebase as
a short prefix, usually 1-3 characters, followed by an underscore. These
namespaces are used such that the layer to which certain code belongs may be
quickly understood by glancing at code. The namespaces are generally quite short
to ensure that they aren't much of a hassle to write. Sometimes, multiple sub-
layers will share a namespace. A few layers do not have a namespace, but most
do. Namespaces are either all-caps or lowercase depending on the context in
which they're used. For types, enum values, and some macros, they are
capitalized. For functions and global variables, they are lowercase.
Layers depend on other layers, but circular dependencies would break the
separability and isolation utility of layers (in effect, forming one big layer),
so in other words, layers are arranged into a directed acyclic graph.
A few layers are built to be used completely independently from the rest of the
codebase, as libraries in other codebases and projects. As such, these layers do
not depend on any other layers in the codebase. The folders which contain these
layers are prefixed with `lib_`, like `lib_rdi`.
A list of the layers in the codebase and their associated namespaces is below:
- `artifact_cache` (`AC_`): Implements an asynchronously-filled cache of
computation artifacts, which are automatically evicted when not accessed. Used
for asynchronously streaming and caching process memory and file system
contents, as well as asynchronously preparing visualizer data.
- `base` (no namespace): Universal, codebase-wide constructs. Strings, math,
memory allocators, helper macros, command-line parsing, and so on. Requires
no other codebase layers.
- `codeview` (`CV_`): Code for parsing and writing the CodeView format.
- `coff` (`COFF_`): Code for parsing and writing the COFF (Common Object File
Format) file format.
- `content` (`C_`): Implements a cache for general data blobs, keyed by a
128-bit hash of the data. Also implements a keying system on top, where keys
refer to a unique identity which corresponds to a history of 128-bit hashes.
Used as a general data store by other layers.
- `ctrl` (`CTRL_`): The debugger's "control system" layer. Implements
asynchronous process control, stepping, and breakpoints for all attached
processes. Runs in lockstep with attached processes. When it runs, attached
processes are halted. When attached processes are running, it is halted.
Driven by a debugger frontend on another thread.
- `dbg_engine` (`D_`): Implements the core debugger system, without any
graphical components. This contains top-level logic for things like stepping,
launching, freezing threads, mid-run breakpoint addition, some caches, and so
on.
- `dbg_info` (`DI_`): Implements asynchronous debug info conversion and loading.
Maintains a cache for loaded debug info. Loads RAD Debug Info (RDI) files.
Launches separate processes for on-demand conversion to the RDI format if
necessary. Also provides various asynchronous operations for using debug info,
like fuzzy searching across all records in loaded debug info.
- `demon` (`DMN_`): An abstraction layer for local-machine, low-level process
control. The abstraction is used to provide a common interface for process
control on target platforms. Used to implement part of `ctrl`.
- `disasm` (`DASM_`): Implements disassembly generation, including exposing the
ability to compute and cache disassembly asynchronously.
- `draw` (`DR_`): Implements a high-level graphics drawing API for the
debugger's purposes, using the underlying `render` abstraction layer. Provides
high-level APIs for various draw commands, but takes care of batching them,
and so on.
- `dwarf` (`DW_`): Code for parsing the DWARF format.
- `eh` (`EH_`): Code for parsing the EH frame format.
- `elf` (`ELF_`): Code for parsing the ELF format.
- `eval` (`E_`): A compiler for an expression language, built for evaluation of
variables, registers, types, and more, from debugger-attached processes,
debug info, debugger state, and files. Broken into several phases mostly
corresponding to traditional compiler phases: lexer, parser, type-checker, IR
generation, and IR evaluation.
- `eval_visualization` (`EV_`): Implements the core non-graphical evaluation
visualization engine, which can be used to visualize evaluations (provided by
the `eval` layer) in a number of ways. Implements core data structures and
transforms for watch tables.
- `file_stream` (`FS_`): Implements asynchronous file streaming, storing the
artifacts inside of the cache implemented by the `content` and
`artifact_cache` layers, hot-reloading the contents of files when they change.
Allows callers to map file paths to data hashes, which can then be used to
obtain the file's data.
- `font_cache` (`FNT_`): Implements a cache of rasterized font data, both in
CPU-side data for text shaping, and in GPU texture atlases for rasterized
glyphs. All cache information is sourced from the `font_provider` abstraction
layer.
- `font_provider` (`FP_`): An abstraction layer for various font file decoding
and font rasterization backends.
- `lib_raddbg_markup` (`RADDBG_`): Standalone library for marking up user
programs to work with various features in the debugger. Does not depend on
`base`, and can be independently relocated to other codebases.
- `lib_rdi` (`RDI_`): Standalone library which defines the core RDI types
and helper functions for reading and writing the RDI debug info file format.
Does not depend on `base`, and can be independently relocated to other
codebases.
- `lib_rdi_make` (`RDIM_`): Standalone library for constructing RDI debug info
data. Does not depend on `base`, and can be independently relocated
to other codebases.
- `linker` (`LNK_`): The layer which implements the RAD Linker executable
itself.
- `mdesk` (`MD_`): Code for parsing Metadesk files (stored as `.mdesk`), which
is the JSON-like (technically a JSON superset) text format used for the
debugger's user and project configuration files and metacode, which is parsed
and used to generate code with the `metagen` layer.
- `metagen` (`MG_`): A metaprogram which is used to generate primarily code and
data tables. Consumes Metadesk files, stored with the extension `.mdesk`, and
generates C code which is then included by hand-written C code. Currently, it
does not analyze the codebase's hand-written C code, but in principle this is
possible. This allows easier & less-error-prone management of large data
tables, which are then used to produce e.g. C `enum`s and a number of
associated data tables. There are also a number of other generation features,
like embedding binary files or complex multi-line strings into source code.
- `msf` (`MSF_`): Code for parsing and writing the MSF file format.
- `msvc_crt` (`MSCRT_`): Code for parsing that's specific to the MSVC CRT.
- `mule` (no namespace): Test executables for battle testing debugger
functionality.
- `mutable_text` (`MTX_`): Implements an asynchronously-filled-and-mutated
cache for text buffers which are mutated across time. In the debugger, this is
used to implement the `Output` log.
- `natvis` (no namespace): NatVis files for type visualization of the codebase's
types in other debuggers.
- `os/core` (`OS_`): An abstraction layer providing core, non-graphical
functionality from the operating system under an abstract API, which is
implemented per-target-operating-system.
- `os/gfx` (`OS_`): An abstraction layer, building on `os/core`, providing
graphical operating system features under an abstract API, which is
implemented per-target-operating-system.
- `pdb` (`PDB_`): Code for parsing and writing the PDB file format.
- `pe` (`PE_`): Code for parsing and writing the PE (Portable Executable) file
format.
- `radbin` (`RB_`): The layer implementing the `radbin` binary utility
executable.
- `raddbg` (`RD_`): The layer which ties everything together for the main
graphical debugger executable. Implements the debugger's graphical frontend,
all of the debugger-specific UI, the debugger executable's command line
interface, and all of the built-in visualizers.
- `rdi` (`RDI_`): A layer which includes the `lib_rdi` layer and bundles it with
codebase-specific helpers, to easily include the library in codebase programs,
and have it be integrated with codebase constructs.
- `rdi_from_coff` (`C2R_`): Code for converting information in COFF files to the
equivalent RDI data.
- `rdi_from_dwarf` (`D2R_`): In-progress code for converting DWARF to the
equivalent RDI data.
- `rdi_from_elf` (`E2R_`)): Code for converting ELF data to the equivalent RDI
data.
- `rdi_from_pdb` (`P2R_`): Code for converting PDB data to the equivalent RDI
data.
- `rdi_make` (`RDIM_`): A layer which includes the `lib_rdi_make` layer and
bundles it with codebase-specific helpers, to easily include the library in
codebase programs, and have it be integrated with codebase constructs.
- `regs` (`REGS_`): Types, helper functions, and metadata for registers on
supported architectures. Used in reading/writing registers in `demon`, or in
looking up register metadata.
- `render` (`R_`): An abstraction layer providing an abstract API for rendering
using various GPU APIs under a common interface. Does not implement a high
level drawing API - this layer is strictly for minimally abstracting on an
as-needed basis. Higher level drawing features are implemented in the `draw`
layer.
- `scratch` (no namespace): Scratch space for small and transient test programs.
- `tester` (no namespace): A program used for automated testing.
- `text` (`TXT_`): Implements text processing functions, like parsing line
breaks, and lexing and parsing source code. Also offers an API to do this
asynchronously.
- `third_party` (no namespace): External code from other projects, which some
layers in the codebase depend on. All external code is included and built
directly within the codebase.
- `ui` (`UI_`): Machinery for building graphical user interfaces. Provides a
core immediate mode hierarchical user interface data structure building
API, and has helper layers for building some higher-level widgets.
+189 -115
View File
@@ -1,115 +1,189 @@
@echo off
setlocal
cd /D "%~dp0"
:: --- Usage Notes (2024/1/10) ------------------------------------------------
::
:: This is a central build script for the RAD Debugger project. It takes a list
:: of simple alphanumeric-only arguments which control (a) what is built, (b)
:: which compiler & linker are used, and (c) extra high-level build options. By
:: default, if no options are passed, then the main "raddbg" graphical debugger
:: is built.
::
:: Below is a non-exhaustive list of possible ways to use the script:
:: `build raddbg`
:: `build raddbg clang`
:: `build raddbg release`
:: `build raddbg asan telemetry`
:: `build raddbg_from_pdb`
::
:: For a full list of possible build targets and their build command lines,
:: search for @build_targets in this file.
::
:: Below is a list of all possible non-target command line options:
::
:: - `asan`: enable address sanitizer
:: - `telemetry`: enable RAD telemetry profiling support
:: --- Unpack Arguments -------------------------------------------------------
for %%a in (%*) do set "%%a=1"
if not "%msvc%"=="1" if not "%clang%"=="1" set msvc=1
if not "%release%"=="1" set debug=1
if "%debug%"=="1" set release=0 && echo [debug mode]
if "%release%"=="1" set debug=0 && echo [release mode]
if "%msvc%"=="1" set clang=0 && echo [msvc compile]
if "%clang%"=="1" set msvc=0 && echo [clang compile]
if "%~1"=="" echo [default mode, assuming `raddbg` build] && set raddbg=1
:: --- Unpack Command Line Build Arguments ------------------------------------
set auto_compile_flags=
if "%telemetry%"=="1" set auto_compile_flags=%auto_compile_flags% -DPROFILE_TELEMETRY=1 && echo [telemetry profiling enabled]
if "%asan%"=="1" set auto_compile_flags=%auto_compile_flags% -fsanitize=address && echo [asan enabled]
:: --- Compile/Link Line Definitions ------------------------------------------
set cl_common= /I..\src\ /I..\local\ /nologo /FC /Z7
set 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 -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf
set cl_debug= call cl /Od %cl_common% %auto_compile_flags%
set cl_release= call cl /O2 /DNDEBUG %cl_common% %auto_compile_flags%
set clang_debug= call clang -g -O0 %clang_common% %auto_compile_flags%
set clang_release= call clang -g -O3 -DNDEBUG %clang_common% %auto_compile_flags%
set cl_link= /link /MANIFEST:EMBED /INCREMENTAL:NO /natvis:"%~dp0\src\natvis\base.natvis" logo.res
set clang_link= -fuse-ld=lld -Xlinker /MANIFEST:EMBED -Xlinker /natvis:"%~dp0\src\natvis\base.natvis" logo.res
set cl_out= /out:
set clang_out= -o
:: --- Per-Build Settings -----------------------------------------------------
set gfx=-DOS_FEATURE_GRAPHICAL=1
set net=-DOS_FEATURE_SOCKET=1
set link_dll=-DLL
if "%msvc%"=="1" set only_compile=/c
if "%clang%"=="1" set only_compile=-c
if "%msvc%"=="1" set EHsc=/EHsc
if "%clang%"=="1" set EHsc=
:: --- Choose Compile/Link Lines ----------------------------------------------
if "%msvc%"=="1" set compile_debug=%cl_debug%
if "%msvc%"=="1" set compile_release=%cl_release%
if "%msvc%"=="1" set compile_link=%cl_link%
if "%msvc%"=="1" set out=%cl_out%
if "%clang%"=="1" set compile_debug=%clang_debug%
if "%clang%"=="1" set compile_release=%clang_release%
if "%clang%"=="1" set compile_link=%clang_link%
if "%clang%"=="1" set out=%clang_out%
if "%debug%"=="1" set compile=%compile_debug%
if "%release%"=="1" set compile=%compile_release%
:: --- Prep Directories -------------------------------------------------------
if not exist build mkdir build
if not exist local mkdir local
:: --- Produce Logo Icon File -------------------------------------------------
pushd build
rc /nologo /fo logo.res ..\data\logo.rc
popd
:: --- Build & Run Metaprogram ------------------------------------------------
if "%no_meta%"=="1" echo [skipping metagen]
if not "%no_meta%"=="1" (
pushd build
%compile_debug% ..\src\metagen\metagen_main.c %compile_link% %out%metagen.exe || exit /b 1
metagen.exe || exit /b 1
popd
)
:: --- Build Everything (@build_targets) --------------------------------------
pushd build
if "%raddbg%"=="1" %compile% %gfx% ..\src\raddbg\raddbg_main.cpp %compile_link% %out%raddbg.exe || exit /b 1
if "%raddbg_from_pdb%"=="1" %compile% ..\src\raddbg_convert\pdb\raddbg_from_pdb_main.c %compile_link% %out%raddbg_from_pdb.exe || exit /b 1
if "%raddbg_from_dwarf%"=="1" %compile% ..\src\raddbg_convert\dwarf\raddbg_from_dwarf.c %compile_link% %out%raddbg_from_dwarf.exe || exit /b 1
if "%raddbg_dump%"=="1" %compile% ..\src\raddbg_dump\raddbg_dump.c %compile_link% %out%raddbg_dump.exe || exit /b 1
if "%ryan_scratch%"=="1" %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
if "%cpp_tests%"=="1" %compile% ..\src\scratch\i_hate_c_plus_plus.cpp %compile_link% %out%cpp_tests.exe || exit /b 1
if "%look_at_raddbg%"=="1" %compile% ..\src\scratch\look_at_raddbg.c %compile_link% %out%look_at_raddbg.exe || exit /b 1
if "%mule_main%"=="1" del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj || exit /b 1
if "%mule_module%"=="1" %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
if "%mule_hotload%"=="1" %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
popd
:: --- Unset ------------------------------------------------------------------
for %%a in (%*) do set "%%a=0"
set raddbg=
set compile=
set compile_link=
set out=
set msvc=
set debug=
@echo off
setlocal enabledelayedexpansion
cd /D "%~dp0"
:restart
:: --- Usage Notes (2024/1/10) ------------------------------------------------
::
:: This is a central build script for the RAD Debugger project, for use in
:: Windows development environments. It takes a list of simple alphanumeric-
:: only arguments which control (a) what is built, (b) which compiler & linker
:: are used, and (c) extra high-level build options. By default, if no options
:: are passed, then the main "raddbg" graphical debugger is built.
::
:: Below is a non-exhaustive list of possible ways to use the script:
:: `build raddbg`
:: `build raddbg clang`
:: `build raddbg release`
:: `build raddbg asan telemetry`
:: `build rdi_from_pdb`
::
:: For a full list of possible build targets and their build command lines,
:: search for @build_targets in this file.
::
:: Below is a list of all possible non-target command line options:
::
:: - `asan`: enable address sanitizer
:: - `ubsan`: enable undefined-behavior sanitizer
:: - `telemetry`: enable RAD telemetry profiling support
:: - `spall`: enable spall profiling support
:: --- Unpack Arguments -------------------------------------------------------
for %%a in (%*) do set "%%~a=1"
if not "%msvc%"=="1" if not "%clang%"=="1" set msvc=1
if not "%release%"=="1" set debug=1
if "%debug%"=="1" set release=0 && echo [debug mode]
if "%release%"=="1" set debug=0 && echo [release mode]
if "%msvc%"=="1" set clang=0 && echo [msvc compile]
if "%clang%"=="1" set msvc=0 && echo [clang compile]
if "%~1"=="" echo [default mode, assuming `raddbg` build] && set raddbg=1&& set com_shim=1&& set raddbg_com_shim=1
if "%~1"=="release" if "%~2"=="" echo [default mode, assuming `raddbg` build] && set raddbg=1&& set com_shim=1&& set raddbg_com_shim=1
:: --- Unpack Command Line Build Arguments ------------------------------------
set auto_compile_flags=
if "%telemetry%"=="1" set auto_compile_flags=%auto_compile_flags% -DPROFILE_TELEMETRY=1 && echo [telemetry profiling enabled]
if "%spall%"=="1" set auto_compile_flags=%auto_compile_flags% -DPROFILE_SPALL=1 && echo [spall profiling enabled]
if "%asan%"=="1" set auto_compile_flags=%auto_compile_flags% -fsanitize=address && echo [asan enabled]
if "%ubsan%"=="1" set auto_compile_flags=%auto_compile_flags% -fsanitize=undefined && echo [ubsan enabled]
if "%opengl%"=="1" set auto_compile_flags=%auto_compile_flags% -DR_BACKEND=R_BACKEND_OPENGL && echo [opengl render backend]
if "%dwarf%"=="1" if "%clang%"=="1" set auto_compile_flags=%auto_compile_flags% -gdwarf && echo [dwarf debug info]
if "%dwarf%"=="" if "%clang%"=="1" set auto_compile_flags=%auto_compile_flags% -gcodeview
if "%pgo%"=="1" (
where llvm-profdata /q || echo llvm-profdata is not in the PATH || exit /b 1
if "%clang%"=="1" (
if "%pgo_run%" == "1" (
call llvm-profdata merge %LLVM_PROFILE_FILE% -output=%~dp0build\build.profdata || exit /b 1
set auto_compile_flags=%auto_compile_flags% -fprofile-use=%~dp0build\build.profdata
set pgo_run=0
) else (
echo [pgo enabled]
set auto_compile_flags=%auto_compile_flags% -fprofile-generate -mllvm -vp-counters-per-site=5
set LLVM_PROFILE_FILE=%~dp0build\build.profraw
set pgo_run=1
)
) else (
echo ERROR: PGO build is not supported with current compiler
exit /b 1
)
)
:: --- Compile/Link Line Definitions ------------------------------------------
set cl_common= /I..\src\ /I..\local\ /nologo /FC /Z7 /Zc:preprocessor
set cl_debug= call cl /Od /Ob1 /DBUILD_DEBUG=1 %cl_common% %auto_compile_flags%
set cl_release= call cl /O2 /DBUILD_DEBUG=0 %cl_common% %auto_compile_flags%
set cl_link= /link /MANIFEST:EMBED /INCREMENTAL:NO /pdbaltpath:%%%%_PDB%%%% /NATVIS:"%~dp0\src\natvis\base.natvis" /noexp /nocoffgrpinfo /opt:ref /opt:icf
set cl_out= /out:
set cl_obj_out= /Fo:
set cl_linker=
set clang_common= -mcx16 -I..\src\ -I..\local\ -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-unused-parameter -Wno-writable-strings -Wno-missing-field-initializers -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 -ferror-limit=10000
set clang_debug= call clang -g -O0 -DBUILD_DEBUG=1 -D_DEBUG %clang_common% %auto_compile_flags%
set clang_release= call clang -g -O2 -DBUILD_DEBUG=0 -DNDEBUG %clang_common% %auto_compile_flags%
set clang_link= -fuse-ld=lld -Xlinker /MANIFEST:EMBED -Xlinker /pdbaltpath:%%%%_PDB%%%% -Xlinker /NATVIS:"%~dp0\src\natvis\base.natvis" -Xlinker /opt:ref -Xlinker /opt:noicf
set clang_out= -o
set clang_obj_out= -o
set clang_linker= -Xlinker
:: --- Per-Build Settings -----------------------------------------------------
set link_icon=logo.res
if "%msvc%"=="1" set linker=%cl_linker%
if "%clang%"=="1" set linker=%clang_linker%
if "%msvc%"=="1" set only_compile=/c
if "%clang%"=="1" set only_compile=-c
if "%msvc%"=="1" set EHsc=/EHsc
if "%clang%"=="1" set EHsc=
if "%msvc%"=="1" set no_aslr=/DYNAMICBASE:NO
if "%clang%"=="1" set no_aslr=-Wl,/DYNAMICBASE:NO
if "%msvc%"=="1" set rc=call rc
if "%clang%"=="1" set rc=call llvm-rc
if "%msvc%"=="1" set link_dll=/link /DLL
if "%clang%"=="1" set link_dll=-Xlinker -DLL
:: --- Choose Compile/Link Lines ----------------------------------------------
if "%msvc%"=="1" set compile_debug=%cl_debug%
if "%msvc%"=="1" set compile_release=%cl_release%
if "%msvc%"=="1" set compile_link=%cl_link%
if "%msvc%"=="1" set out=%cl_out%
if "%msvc%"=="1" set obj_out=%cl_obj_out%
if "%clang%"=="1" set compile_debug=%clang_debug%
if "%clang%"=="1" set compile_release=%clang_release%
if "%clang%"=="1" set compile_link=%clang_link%
if "%clang%"=="1" set out=%clang_out%
if "%clang%"=="1" set obj_out=%clang_obj_out%
if "%debug%"=="1" set compile=%compile_debug%
if "%release%"=="1" set compile=%compile_release%
:: --- Prep Directories -------------------------------------------------------
if not exist build mkdir build
if not exist local mkdir local
:: --- Produce Logo Icon File -------------------------------------------------
pushd build
%rc% /nologo /fo logo.res ..\data\logo.rc || exit /b 1
popd
:: --- Get Current Git Commit Id ----------------------------------------------
for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\"
for /f %%i in ('call git rev-parse HEAD') do set compile=%compile% -DBUILD_GIT_HASH_FULL=\"%%i\"
:: --- Build & Run Metaprogram ------------------------------------------------
pushd build
if "%meta%"=="1" (
echo [building metagen]
%compile_debug% ..\src\metagen\metagen_main.c %compile_link% %out%metagen.exe || exit /b 1
)
if "%no_meta%"=="" if exist metagen.exe (
echo [running metagen]
metagen.exe || exit /b 1
)
popd
:: --- Build Everything (@build_targets) --------------------------------------
pushd build
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
if "%raddbg_non_graphical%"=="1" set didbuild=1 && %compile% -DWM_STUB=1 -DR_BACKEND=R_BACKEND_STUB ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg_non_graphical.exe || exit /b 1
if "%com_shim%"=="1" set didbuild=1 && %compile% ..\src\com_shim\com_shim_main.c %compile_link% %out%com_shim.exe || exit /b 1
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %linker% /NOIMPLIB %linker% /NATVIS:"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
if "%radbin%"=="1" set didbuild=1 && %compile% ..\src\radbin\radbin_main.c %compile_link% %out%radbin.exe || exit /b 1
if "%raddump%"=="1" set didbuild=1 && %compile% ..\src\raddump\raddump_main.c %compile_link% %out%raddump.exe || exit /b 1
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
if "%textperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\textperf.c %compile_link% %out%textperf.exe || exit /b 1
if "%convertperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\convertperf.c %compile_link% %out%convertperf.exe || exit /b 1
if "%debugstringperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\debugstringperf.c %compile_link% %out%debugstringperf.exe || exit /b 1
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
if "%strip_lib_debug%"=="1" set didbuild=1 && %compile% ..\src\strip_lib_debug\strip_lib_debug.c %compile_link% %out%strip_lib_debug.exe || exit /b 1
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp %obj_out%mule_inline.obj && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp %obj_out%mule_o2.obj && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %link_dll% %out%mule_module.dll || exit /b 1
if "%mule_hotload%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
if "%torture%"=="1" set didbuild=1 && %compile% ..\src\torture\torture_main.c %compile_link% %out%torture.exe || exit /b1
if "%dwarf_expr_test%"=="1" set didbuild=1 && %compile% ..\src\torture\dwarf_expr_test.c %compile_link% %out%dwarf_expr_test.exe || exit /b1
if "%unit_sizes_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\scratch\unit_sizes_from_pdb.c %compile_link% %out%unit_sizes_from_pdb.exe || exit /b1
if "%mule_peb_trample%"=="1" (
set didbuild=1
if exist mule_peb_trample.exe move mule_peb_trample.exe mule_peb_trample_old_%random%.exe
if exist mule_peb_trample_new.pdb move mule_peb_trample_new.pdb mule_peb_trample_old_%random%.pdb
if exist mule_peb_trample_new.rdi move mule_peb_trample_new.rdi mule_peb_trample_old_%random%.rdi
%compile% ..\src\mule\mule_peb_trample.c %compile_link% %out%mule_peb_trample_new.exe || exit /b 1
move mule_peb_trample_new.exe mule_peb_trample.exe
)
popd
:: --- Set Up Debugger Com Shim -----------------------------------------------
pushd build
if "%raddbg_com_shim%"=="1" copy /y com_shim.exe raddbg.com
popd
:: --- Warn On No Builds ------------------------------------------------------
if "%didbuild%"=="" (
echo [WARNING] no valid build target specified; must use build target names as arguments to this script, like `build raddbg` or `build rdi_from_pdb`.
exit /b 1
)
:: --- PGO Run ----------------------------------------------------------------
if "%pgo_run%"=="1" (
if "%radlink%"=="1" (
pushd local\lyra_pgo
call %~dp0build\radlink @lyra.rsp || exit /b 1
popd
)
goto restart
)
Executable
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
set -eu
cd "$(dirname "$0")"
# --- Unpack Arguments --------------------------------------------------------
for arg in "$@"; do declare $arg='1'; done
if [[ "$#" == "0" ]]; then raddbg='1'; fi
cc_sanitize=""
if [[ "${asan:-0}" == "1" ]]; then
echo "[asan enabled]"
cc_sanitize="-fsanitize=address"
fi
# --- Get Current Git Commit Id -----------------------------------------------
git_hash=$(git describe --always --dirty)
git_hash_full=$(git rev-parse HEAD)
# --- Compile/Link Line Definitions -------------------------------------------
cc_cflags_gcc=""
cc_cflags_clang=${cc_sanitize}" -fdiagnostics-absolute-paths -Wno-for-loop-analysis -Wno-incompatible-pointer-types-discards-qualifiers -Wno-initializer-overrides -Wno-compare-distinct-pointer-types -Wno-single-bit-bitfield-constant-conversion -Wno-deprecated-declarations -Wno-writable-strings -Wno-unknown-warning-option -Wno-deprecated-register -Wno-unused-local-typedef -msse2"
cc_common="-mcx16 -I../src/ -I../local/ -D_GNU_SOURCE -g -DBUILD_GIT_HASH=\"$git_hash\" -DBUILD_GIT_HASH_FULL=\"$git_hash_full\" -Wall -Wno-missing-braces -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-value -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf"
cc_debug="-g -O0 -DBUILD_DEBUG=1 ${cc_common}"
cc_release="-g -O2 -DBUILD_DEBUG=0 ${cc_common}"
cc_link="-lpthread -lm -lrt -ldl"
# --- Per-Build Settings ------------------------------------------------------
cc_link_dll="-fPIC"
# --- External Libraries ------------------------------------------------------
# sudo apt install -y pkg-config libfreetype6-dev libx11-dev libxext-dev libgl-dev libegl-dev
if [[ -x "$(command -v pkg-config)" ]]; then
cc_font_provider="$(pkg-config --cflags --libs freetype2)"
cc_os_gfx="$(pkg-config --cflags --libs x11 xext)"
cc_render="$(pkg-config --cflags --libs gl egl)"
else
cc_font_provider="-I/usr/include/freetype2 -lfreetype"
cc_os_gfx="-lX11 -lXext"
cc_render="-lGL -lEGL"
fi
# --- Choose Compile/Link Lines -----------------------------------------------
if [[ "${gcc:-0}" == "1" ]]; then compiler="${CC:-gcc} $cc_cflags_gcc"; echo "[gcc compile]";
elif [[ "${clang:-1}" == "1" ]]; then compiler="${CC:-clang} $cc_cflags_clang"; echo "[clang compile]";
fi
if [[ "${release:-0}" == "1" ]]; then echo "[release mode]"; compile="$compiler $cc_release";
elif [[ "${debug:-1}" == "1" ]]; then echo "[debug mode]"; compile="$compiler $cc_debug";
fi
# --- Prep Directories --------------------------------------------------------
mkdir -p build local
# --- Build & Run Metaprogram -------------------------------------------------
if [[ "${no_meta:-0}" == "0" ]]
then
echo "[building metagen]"
cd build
$compiler $cc_debug ../src/metagen/metagen_main.c $cc_link -o metagen
./metagen
cd ..
fi
# --- Build Everything (@build_targets) ---------------------------------------
cd build
if [[ "${raddbg:-0}" == "1" ]]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $cc_link $cc_os_gfx $cc_render $cc_font_provider -o raddbg; fi
if [[ "${raddbg_non_graphical:-0}" == "1" ]]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c -DWM_STUB=1 -DR_BACKEND=R_BACKEND_STUB $cc_link $cc_os_gfx $cc_render $cc_font_provider -o raddbg_non_graphical; fi
if [[ "${radbin:-0}" == "1" ]]; then didbuild=1 && $compile ../src/radbin/radbin_main.c $cc_link -o radbin; fi
if [[ "${radlink:-0}" == "1" ]]; then didbuild=1 && $compile ../src/linker/lnk.c $cc_link -o radlink; fi
if [[ "${torture:-0}" == "1" ]]; then didbuild=1 && $compile ../src/torture/torture_main.c $cc_link $cc_os_gfx $cc_render $cc_font_provider -o torture; fi
cd ..
# --- Warn On No Builds -------------------------------------------------------
if [[ "${didbuild:-0}" == "0" ]]
then
echo "[WARNING] no valid build target specified; must use build target names as arguments to this script, like \`./build.sh raddbg\` or \`./build.sh radlink\`."
exit 1
fi
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
View File
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "cppdbg",
"name": "launch - torture",
"request": "launch",
"project": "c://windows//system32//cmd.exe",
"cwd": "build/",
"program": "torture",
"args": [ "d2r_checksums" ],
"stopAtEntry": false,
"environment": [],
"externalConsole": false,
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
"pipeProgram": "wsl",
"pipeArgs": [ "${debuggerCommand}" ]
},
"setupCommands": [
{ "text": "-gdb-set follow-fork-mode parent" },
{ "text": "-gdb-set detach-on-fork on" },
{ "text": "handle SIGUSR1 nostop" }
],
"MIMode": "gdb"
},
{
"type": "cppdbg",
"name": "launch - radbin",
"request": "launch",
"project": "c://windows//system32//cmd.exe",
"cwd": "build/",
"program": "radbin",
"args": [ "-voff2line", "-voff:0x1000", "torture_artifacts/d2r_line_table/a.rdi" ],
"stopAtEntry": false,
"environment": [],
"externalConsole": false,
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
"pipeProgram": "wsl",
"pipeArgs": [ "${debuggerCommand}" ]
},
"setupCommands": [
{ "text": "-gdb-set follow-fork-mode parent" },
{ "text": "-gdb-set detach-on-fork on" },
{ "text": "handle SIGUSR1 nostop" }
],
"MIMode": "gdb"
},
{
"type": "cppdbg",
"name": "launch - radlink",
"request": "launch",
"project": "c://windows//system32//cmd.exe",
"cwd": "/mnt/c/devel/raddebugger/build/torture_artifacts/debug_p_sig_mismatch",
"program": "/mnt/c/devel/raddebugger/build/radlink",
"args": [ "/subsystem:console", "/entry:entry", "/out:a.exe", "/debug:full", "a.obj", "b.obj", "entry.obj" ],
"stopAtEntry": false,
"environment": [],
"externalConsole": false,
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
"pipeProgram": "wsl",
"pipeArgs": [ "${debuggerCommand}" ]
},
"setupCommands": [
{ "text": "handle SIGUSR1 nostop" }
],
"MIMode": "gdb"
},
{
"type": "cppdbg",
"name": "launch - raddbg",
"request": "launch",
"project": "c://windows//system32//cmd.exe",
"cwd": "build/",
"program": "/mnt/c/devel/raddebugger/build/raddbg",
//"processId": "65821",
"environment": [],
"externalConsole": false,
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
"pipeProgram": "wsl",
"pipeArgs": [ "${debuggerCommand}" ]
},
"setupCommands": [
{ "text": "handle SIGUSR1 nostop" }
],
"MIMode": "gdb"
}
]
}
File diff suppressed because it is too large. Load diff
+73
View File
@@ -0,0 +1,73 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef DWARF_DUMP_H
#define DWARF_DUMP_H
typedef enum
{
DW_DumperCacheFlag_InfoRanges = (1 << 0),
DW_DumperCacheFlag_CuArr = (1 << 1),
DW_DumperCacheFlag_LineVmMap = (1 << 2),
DW_DumperCacheFlag_TagTrees = (1 << 3),
} DW_DumperCacheFlags;
typedef struct DW_Dumper
{
Arena *arena;
Arch arch;
B32 is_relaxed;
B32 is_verbose;
DW_Raw *input;
DW_DumperCacheFlags cache_flags;
struct {
Rng1U64Array info_ranges;
DW_CompUnit *cu_arr;
HashTable *line_vm_map;
DW_TagTree *tag_trees;
} cache;
} DW_Dumper;
#define DW_PRINTER(name) void name(Arena *arena, String8List *strings, int indent, DW_Dumper *dumper)
typedef DW_PRINTER(DW_Printer);
////////////////////////////////
// cache
internal Rng1U64Array dw_get_info_ranges(DW_Dumper *dumper);
internal DW_CompUnit * dw_get_cu_arr(DW_Dumper *dumper);
internal HashTable * dw_get_line_vm_map(DW_Dumper *dumper);
internal DW_TagTree * dw_get_tag_trees(DW_Dumper *dumper);
////////////////////////////////
//~ rjf: Stringification Helpers
internal String8List dw_string_list_from_cfi_program(Arena *arena, U64 cu_base, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format, U64 pc_begin, DW_CIE *cie, DW_DecodePtr *decode_ptr_func, void *deocde_ptr_ud, String8 program);
internal String8List dw_string_list_from_expression (Arena *arena, String8 raw_data, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
internal String8 dw_string_from_reg_off (Arena *arena, Arch arch, DW_Reg reg_idx, S64 reg_off);
internal String8 dw_string_from_attrib_value(Arena *arena, DW_Raw *input, Arch arch, DW_CompUnit *cu, DW_LineVM *line_vm, DW_Attrib *attrib);
internal String8 dw_string_from_expression (Arena *arena, String8 expr, U64 cu_base, U64 addr_size, Arch arch, DW_Version ver, DW_Ext ext, DW_Format format);
internal String8 dw_string_from_cfa (Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFA cfa);
internal String8 dw_string_from_cfi_row (Arena *arena, Arch arch, U64 address_size, DW_Version version, DW_Ext ext, DW_Format format, DW_CFI_Row *row);
#if 0
internal void dw_print_eh_frame (Arena *arena, String8List *out, String8 indent, String8 raw_eh_frame, Arch arch, DW_Version ver, DW_Ext ext, EH_PtrCtx *ptr_ctx);
internal void dw_print_debug_loc (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
internal void dw_print_debug_ranges (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Arch arch, ExecutableImageKind image_type, B32 relaxed);
internal void dw_print_debug_aranges (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
internal void dw_print_debug_addr (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
internal void dw_print_debug_loclists (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_vranges, Arch arch);
internal void dw_print_debug_rnglists (Arena *arena, String8List *out, String8 indent, DW_Raw *input, Rng1U64Array segment_vranges);
internal void dw_print_debug_pubnames (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
internal void dw_print_debug_pubtypes (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
internal void dw_print_debug_line_str (Arena *arena, String8List *out, String8 indent, DW_Raw *input);
internal void dw_print_debug_str_offsets(Arena *arena, String8List *out, String8 indent, DW_Raw *input);
#endif
////////////////////////////////
//~ rjf: Dump Entry Point
internal String8List dw_dump_list_from_sections(Arena *arena, DW_Raw *input, Arch arch, DW_SectionFlags dump_sections, B32 is_verbose);
#endif // DWARF_DUMP_H
File diff suppressed because it is too large. Load diff
+233
View File
@@ -0,0 +1,233 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef DWARF_EXPR_H
#define DWARF_EXPR_H
////////////////////////////////
// evaluator
#define DW_ExprValueType_IsSigned(x) ((x) == DW_ExprValueType_S8 || (x) == DW_ExprValueType_S16 || (x) == DW_ExprValueType_S32 || (x) == DW_ExprValueType_S64 || (x) == DW_ExprValueType_S128 || (x) == DW_ExprValueType_S256 || (x) == DW_ExprValueType_S512)
#define DW_ExprValueType_IsUnsigned(x) ((x) == DW_ExprValueType_U8 || (x) == DW_ExprValueType_U16 || (x) == DW_ExprValueType_U32 || (x) == DW_ExprValueType_U64 || (x) == DW_ExprValueType_U128 || (x) == DW_ExprValueType_U256 || (x) == DW_ExprValueType_U512)
#define DW_ExprValueType_IsFloat(x) ((x) == DW_ExprValueType_F32 || (x) == DW_ExprValueType_F64)
#define DW_ExprValueType_IsInt(x) (DW_ExprValueType_IsSigned(x) || DW_ExprValueType_IsUnsigned(x) || (x) == DW_ExprValueType_Addr)
typedef enum
{
DW_ExprValueType_Generic,
DW_ExprValueType_U8,
DW_ExprValueType_U16,
DW_ExprValueType_U32,
DW_ExprValueType_U64,
DW_ExprValueType_U128,
DW_ExprValueType_U256,
DW_ExprValueType_U512,
DW_ExprValueType_S8,
DW_ExprValueType_S16,
DW_ExprValueType_S32,
DW_ExprValueType_S64,
DW_ExprValueType_S128,
DW_ExprValueType_S256,
DW_ExprValueType_S512,
DW_ExprValueType_F32,
DW_ExprValueType_F64,
DW_ExprValueType_Addr,
DW_ExprValueType_Implicit,
DW_ExprValueType_Bool,
} DW_ExprValueType;
typedef S8 DW_ExprBool;
typedef struct DW_ExprValue
{
DW_ExprValueType type;
Rng1U64Array ranges;
U64 *offsets;
union {
U8 u8;
U16 u16;
U32 u32;
U64 u64;
U128 u128;
U256 u256;
U512 u512;
S8 s8;
S16 s16;
S32 s32;
S64 s64;
F32 f32;
F64 f64;
U64 addr;
DW_ExprBool boolean;
String8 implicit;
String8 generic;
};
} DW_ExprValue;
typedef struct DW_ExprValueNode
{
DW_ExprValue v;
struct DW_ExprValueNode *next;
} DW_ExprValueNode;
typedef enum
{
DW_PieceKind_Null,
DW_PieceKind_Value,
DW_PieceKind_Undefined,
} DW_PieceKind;
typedef struct DW_Piece
{
DW_PieceKind kind;
U64 bit_size;
U8 *value;
} DW_Piece;
typedef struct DW_PieceNode
{
DW_Piece v;
struct DW_PieceNode *next;
} DW_PieceNode;
typedef struct DW_PieceList
{
U64 count;
DW_PieceNode *first;
DW_PieceNode *last;
} DW_PieceList;
typedef struct DW_ExprStack
{
U64 count;
DW_ExprValueNode *top;
} DW_ExprStack;
typedef enum
{
DW_ExprEvalResult_Fail,
DW_ExprEvalResult_Ok,
DW_ExprEvalResult_Maybe,
DW_ExprEvalResult_ExecOpLimitReached,
} DW_ExprEvalResult;
////////////////////////////////
// encoder
typedef enum
{
DW_ExprEncType_Null,
DW_ExprEncType_Op,
DW_ExprEncType_U8,
DW_ExprEncType_U16,
DW_ExprEncType_U32,
DW_ExprEncType_U64,
DW_ExprEncType_S8,
DW_ExprEncType_S16,
DW_ExprEncType_S32,
DW_ExprEncType_S64,
DW_ExprEncType_ULEB128,
DW_ExprEncType_SLEB128,
DW_ExprEncType_Addr,
DW_ExprEncType_Block,
DW_ExprEncType_DwarfUInt,
DW_ExprEncType_Label,
DW_ExprEncType_DeclLabel,
} DW_ExprEncType;
typedef struct DW_ExprEnc
{
DW_ExprEncType type;
union {
DW_ExprOp op;
U8 u8;
U16 u16;
U32 u32;
U64 u64;
S8 s8;
S16 s16;
S32 s32;
S64 s64;
U64 addr;
String8 block;
String8 label;
};
} DW_ExprEnc;
#define DW_ExprEnc_Op(v) { .type = DW_ExprEncType_Op, .op = DW_ExprOp_##v }
#define DW_ExprEnc_U8(v) { .type = DW_ExprEncType_U8, .u8 = v }
#define DW_ExprEnc_U16(v) { .type = DW_ExprEncType_U16, .u16 = v }
#define DW_ExprEnc_U32(v) { .type = DW_ExprEncType_U32, .u32 = v }
#define DW_ExprEnc_U64(v) { .type = DW_ExprEncType_U64, .u64 = v }
#define DW_ExprEnc_S8(v) { .type = DW_ExprEncType_S8, .s8 = v }
#define DW_ExprEnc_S16(v) { .type = DW_ExprEncType_S16, .s16 = v }
#define DW_ExprEnc_S32(v) { .type = DW_ExprEncType_S32, .s32 = v }
#define DW_ExprEnc_S64(v) { .type = DW_ExprEncType_S64, .s64 = v }
#define DW_ExprEnc_ULEB128(v) { .type = DW_ExprEncType_ULEB128, .u64 = v }
#define DW_ExprEnc_SLEB128(v) { .type = DW_ExprEncType_SLEB128, .s64 = v }
#define DW_ExprEnc_Addr(v) { .type = DW_ExprEncType_Addr, .addr = v }
#define DW_ExprEnc_Block(v) { .type = DW_ExprEncType_Block, .block = v }
#define DW_ExprEnc_UInt(v) { .type = DW_ExprEncType_DwarfUInt, .u64 = v }
#define DW_ExprEnc_Label(v) { .type = DW_ExprEncType_Label, .label = str8_lit_comp(v) }
#define DW_ExprEnc_DeclLabel(v) { .type = DW_ExprEncType_DeclLabel, .label = str8_lit_comp(v) }
////////////////////////////////
// pieces
internal DW_PieceNode * dw_piece_list_push(Arena *arena, DW_PieceList *list, DW_Piece v);
// size -> type
internal DW_ExprValueType dw_expr_unsigned_value_type_from_bit_size(U64 bit_size);
internal DW_ExprValueType dw_expr_signed_value_type_from_bit_size(U64 bit_size);
internal DW_ExprValueType dw_expr_float_type_from_bit_size(U64 bit_size);
// type -> size
internal U64 dw_expr_byte_size_from_value_type(U64 addr_size, DW_ExprValueType k);
// typer
internal DW_ExprValueType dw_expr_pick_common_value_type(DW_ExprValueType rhs, DW_ExprValueType lhs);
internal DW_ExprValueType dw_expr_pick_common_compar_value_type(DW_ExprValueType rhs, DW_ExprValueType lhs);
internal DW_ExprValue dw_expr_cast(DW_ExprValue value, DW_ExprValueType type);
// arithmetic operators
internal DW_ExprValue dw_expr_add (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_minus(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_mul (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_div (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_mod (DW_ExprValue rhs, DW_ExprValue lhs);
// comparison operators
internal DW_ExprValue dw_expr_eq(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_ge(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_gt(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_le(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_lt(DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_ne(DW_ExprValue rhs, DW_ExprValue lhs);
// bitwise operators
internal DW_ExprValue dw_expr_xor (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_and (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_or (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_shl (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_shr (DW_ExprValue rhs, DW_ExprValue lhs);
internal DW_ExprValue dw_expr_shra(DW_ExprValue rhs, DW_ExprValue lhs);
// unary operators
internal DW_ExprValue dw_expr_abs(DW_ExprValue value);
internal DW_ExprValue dw_expr_neg(DW_ExprValue value);
internal DW_ExprValue dw_expr_not(DW_ExprValue value);
// stack
internal DW_ExprValueNode * dw_expr_stack_push(Arena *arena, DW_ExprStack *stack, DW_ExprValue value);
internal DW_ExprValueNode * dw_expr_stack_push_unsigned(Arena *arena, DW_ExprStack *stack, void *value, U64 value_size);
internal DW_ExprValue dw_expr_stack_pop(DW_ExprStack *stack);
internal DW_ExprValue dw_expr_stack_peek(DW_ExprStack *stack);
internal DW_ExprValueNode * dw_expr_stack_pick(DW_ExprStack *stack, U64 idx);
// value helpers
internal String8 dw_string_from_expr_value(Arena *arena, U64 addr_size, DW_ExprValue v);
// evaluator
internal DW_ExprEvalResult dw_eval_expr(Arena *arena, Arch arch, DW_Format format, U64 frame_base, U64 cfa, U64 tls_base, U64 op_limit, DW_Expr expr, void *reg_block, MachineOp_MemRead *mem_read, void *mem_read_ud, DW_ExprValue *value_out);
#endif //DWARF_EXPR_H
File diff suppressed because it is too large. Load diff
+528
View File
@@ -0,0 +1,528 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef DWARF_PARSE_H
#define DWARF_PARSE_H
typedef struct DW_Section
{
String8 name;
String8 data;
B32 is_dwo;
} DW_Section;
typedef struct DW_Raw
{
DW_Section sec[DW_Section_COUNT];
DW_Section sup[DW_Section_COUNT];
} DW_Raw;
typedef struct DW_ListUnit
{
DW_Version version;
U64 address_size;
U64 segment_selector_size;
U64 entry_size;
String8 entries;
} DW_ListUnit;
typedef struct DW_ListUnitInput
{
U64 addr_count;
U64 str_offset_count;
U64 rnglist_count;
U64 loclist_count;
Rng1U64Array addr_ranges;
Rng1U64Array str_offset_ranges;
Rng1U64Array rnglist_ranges;
Rng1U64Array loclist_ranges;
DW_ListUnit *addrs;
DW_ListUnit *str_offsets;
DW_ListUnit *rnglists;
DW_ListUnit *loclists;
} DW_ListUnitInput;
typedef struct DW_AbbrevTableEntry
{
U64 id;
U64 off;
} DW_AbbrevTableEntry;
typedef struct DW_AbbrevTable DW_AbbrevTable;
struct DW_AbbrevTable
{
U64 count;
DW_AbbrevTableEntry *entries;
};
typedef enum DW_AbbrevKind
{
DW_Abbrev_Null,
DW_Abbrev_Tag,
DW_Abbrev_Attrib,
DW_Abbrev_AttribSequenceEnd,
DW_Abbrev_DIEBegin,
DW_Abbrev_DIEEnd,
} DW_AbbrevKind;
typedef U32 DW_AbbrevFlags;
enum
{
DW_AbbrevFlag_HasImplicitConst = (1 << 0),
DW_AbbrevFlag_HasChildren = (1 << 1),
};
typedef struct DW_Abbrev
{
DW_AbbrevKind kind;
U64 sub_kind;
U64 id;
S64 implicit_const;
DW_AbbrevFlags flags;
} DW_Abbrev;
typedef struct DW_Attrib
{
U64 info_off;
U64 abbrev_off;
U64 abbrev_id;
DW_AttribKind attrib_kind;
DW_Form form;
} DW_Attrib;
typedef struct DW_AttribNode
{
struct DW_AttribNode *next;
DW_Attrib v;
} DW_AttribNode;
typedef struct DW_AttribList
{
DW_AttribNode *first;
DW_AttribNode *last;
U64 count;
} DW_AttribList;
typedef U8 DW_TagSpare;
typedef struct DW_Tag
{
B32 has_children;
U64 abbrev_id;
DW_TagKind kind;
DW_AttribList attribs;
U64 info_off;
DW_TagSpare v;
} DW_Tag;
typedef struct DW_TagNode
{
DW_Tag tag;
struct DW_TagNode *sibling;
struct DW_TagNode *first_child;
struct DW_TagNode *last_child;
} DW_TagNode;
typedef struct DW_Loc
{
Rng1U64 range;
String8 expr;
} DW_Loc;
typedef struct DW_LocNode
{
DW_Loc v;
struct DW_LocNode *next;
} DW_LocNode;
typedef struct DW_LocList
{
U64 count;
DW_LocNode *first;
DW_LocNode *last;
} DW_LocList;
typedef struct DW_CompUnit
{
B32 relaxed;
DW_Ext ext;
DW_CompUnitKind kind;
DW_Version version;
DW_Format format;
U64 address_size;
U64 abbrev_off;
Rng1U64 info_range;
U64 first_tag_info_off;
DW_AbbrevTable abbrev_table;
DW_ListUnit *addr_lu;
DW_ListUnit *str_offsets_lu;
DW_ListUnit *rnglists_lu;
DW_ListUnit *loclists_lu;
U64 low_pc;
U64 dwo_id;
DW_Tag tag;
HashTable *tag_ht;
} DW_CompUnit;
typedef struct DW_TagTree
{
DW_TagNode *root;
U64 tag_count;
} DW_TagTree;
////////////////////////////////
typedef struct DW_LineFile
{
String8 path;
U64 dir_idx;
U64 time_stamp;
U64 size;
U128 md5;
String8 source;
} DW_LineFile;
typedef struct DW_LineFileNode
{
struct DW_LineFileNode *next;
DW_LineFile file;
} DW_LineFileNode;
typedef struct DW_LineFileList
{
U64 node_count;
DW_LineFileNode *first;
DW_LineFileNode *last;
} DW_LineFileList;
typedef struct DW_LineFileArray
{
U64 count;
DW_LineFile *v;
} DW_LineFileArray;
typedef struct DW_LineVMHeader
{
U64 unit_length;
DW_Version version;
U8 address_size; // Duplicates size from the compilation unit but is needed to support stripped exe that just have .debug_line and .debug_line_str.
U8 segment_selector_size;
U64 header_length;
U8 min_inst_len;
U8 max_ops_for_inst;
U8 default_is_stmt;
S8 line_base;
U8 line_range;
U8 opcode_base;
U64 num_opcode_lens;
U8 *opcode_lens;
U64 line_program_off;
String8Array dir_table;
DW_LineFileArray file_table;
} DW_LineVMHeader;
typedef struct DW_LineVMState
{
U64 address; // Address of a machine instruction.
U32 op_index; // This is used by the VLIW instructions to indicate index of operation inside the instruction.
// Line table doesn't contain full path to a file, instead
// DWARF encodes path as two indices. First index will point into a directory
// table, and second points into a file name table.
U64 file_index;
U64 line;
U64 column;
B32 is_stmt; // Indicates that "address" points to place suitable for a breakpoint.
B32 basic_block; // Indicates that the "address" is inside a basic block.
// Indicates that "address" points to place where function starts.
// Usually prologue is the place where compiler emits instructions to
// prepare stack for a function.
B32 prologue_end;
B32 epilogue_begin; // Indicates that "address" points to section where function exits and unwinds stack.
U64 isa; // Instruction set that is used.
U64 discriminator; // Arbitrary id that indicates to which block these instructions belong.
B32 end_sequence; // Indicates that "address" points to the first instruction in the instruction block that follows.
} DW_LineVMState;
typedef struct DW_LineVM
{
Arena *arena;
U64 cursor;
String8 program;
DW_LineVMHeader header;
B32 new_line;
B32 new_seq;
B32 skip_opcode;
DW_LineVMState state;
U64 advance;
U64 opcode_off;
DW_StdOpcode opcode;
DW_ExtOpcode ext_opcode;
U64 ext_length;
U64 line_advance;
U64 addr_advance;
HashTable *ext_file_ht;
struct {
union {
String8 string;
U64 u64;
S64 s64;
};
} operands[4];
String8 error;
} DW_LineVM;
////////////////////////////////
// .debug_pubnames and .debug_pubtypes
typedef struct DW_PubStringsBucket
{
struct DW_PubStringsBucket *next;
String8 string;
U64 info_off;
U64 cu_info_off;
} DW_PubStringsBucket;
typedef struct DW_PubStringsTable
{
U64 size;
DW_PubStringsBucket **buckets;
} DW_PubStringsTable;
typedef struct DW_Reference
{
DW_CompUnit *cu;
U64 info_off; // global .debug_info offset
} DW_Reference;
////////////////////////////////
//~ Expression
typedef union DW_ExprOperand
{
U8 u8;
U16 u16;
U32 u32;
U64 u64;
S8 s8;
S16 s16;
S32 s32;
S64 s64;
String8 block;
} DW_ExprOperand;
typedef struct DW_ExprInst
{
DW_ExprOp opcode;
DW_ExprOperand *operands;
U64 size;
struct DW_ExprInst *next;
struct DW_ExprInst *prev;
} DW_ExprInst;
typedef struct DW_Expr
{
U64 count;
DW_ExprInst *first;
DW_ExprInst *last;
} DW_Expr;
////////////////////////////////
// .debug_frame
typedef struct DW_CIE
{
String8 insts;
String8 aug_string;
String8 aug_data;
U64 code_align_factor;
S64 data_align_factor;
U64 ret_addr_reg;
U64 ext[4];
DW_Format format;
U8 version;
U8 address_size;
U8 segment_selector_size;
} DW_CIE;
typedef struct DW_FDE
{
DW_Format format;
U64 cie_pointer;
Rng1U64 pc_range;
String8 insts;
} DW_FDE;
typedef union DW_CFA_Operand
{
U64 u64;
S64 s64;
String8 block;
} DW_CFA_Operand;
typedef enum
{
DW_CFA_ParseErrorCode_NewInst,
DW_CFA_ParseErrorCode_End,
DW_CFA_ParseErrorCode_OutOfData
} DW_CFA_ParseErrorCode;
typedef struct DW_CFA_Inst
{
DW_CFA_Opcode opcode;
DW_CFA_Operand operands[DW_CFA_OperandMax];
} DW_CFA_Inst;
typedef struct DW_CFA_InstNode
{
DW_CFA_Inst v;
struct DW_CFA_InstNode *next;
} DW_CFA_InstNode;
typedef struct DW_CFA_InstList
{
U64 count;
DW_CFA_InstNode *first;
DW_CFA_InstNode *last;
} DW_CFA_InstList;
#define DW_DECODE_PTR(name) U64 name(String8 data, void *ud, U64 *ptr_out)
typedef DW_DECODE_PTR(DW_DecodePtr);
// hasher
internal U64 dw_hash_from_string(String8 string);
// deserial helpers
internal U64 str8_deserial_read_dwarf_packed_size(String8 string, U64 off, U64 *size_out);
internal U64 str8_deserial_read_dwarf_uint (String8 string, U64 off, DW_Format format, U64 *uint_out);
internal U64 str8_deserial_read_uleb128_array(Arena *arena, String8 string, U64 off, U64 count, U64 **arr_out);
internal U64 str8_deserial_read_sleb128_array(Arena *arena, String8 string, U64 off, U64 count, S64 **arr_out);
internal Rng1U64List dw_unit_ranges_from_data(Arena *arena, String8 data);
internal Rng1U64Array dw_unit_ranges_from_data_arr(Arena *arena, String8 data);
// list units
internal U64 dw_read_list_unit_header_addr (String8 unit_data, DW_ListUnit *lu_out);
internal U64 dw_read_list_unit_header_str_offsets(String8 unit_data, DW_ListUnit *lu_out);
internal U64 dw_read_list_unit_header_list (String8 unit_data, DW_ListUnit *lu_out);
internal DW_ListUnitInput dw_list_unit_input_from_input(Arena *arena, DW_Raw *input);
internal U64 dw_offset_from_list_unit(DW_ListUnit *lu, U64 index);
internal U64 dw_addr_from_list_unit (DW_ListUnit *lu, U64 index);
// abbrev table
internal U64 dw_read_abbrev_tag (String8 data, U64 offset, DW_Abbrev *out_abbrev);
internal U64 dw_read_abbrev_attrib(String8 data, U64 offset, DW_Abbrev *out_abbrev);
internal DW_AbbrevTable dw_read_abbrev_table(Arena *arena, String8 abbrev_data, U64 abbrev_base);
internal U64 dw_abbrev_offset_from_abbrev_id(DW_AbbrevTable table, U64 abbrev_id);
// form and tag
internal B32 dw_read_form (String8 data, DW_Version version, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, S64 implicit_const, DW_Form *form_out, U64 *bytes_read_out);
internal U64 dw_read_tag (Arena *arena, DW_Raw *input, DW_AbbrevTable abbrev_table, DW_Version version, DW_Format format, U64 address_size, Rng1U64 cu_info_range, U64 tag_info_off, DW_Tag *tag_out);
internal U64 dw_read_tag_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out);
// attrib interp
internal U64 dw_interp_sec_offset(DW_Form form);
internal String8 dw_interp_exprloc (DW_Form form);
internal U128 dw_interp_const_u128(DW_Form form);
internal U64 dw_interp_const_u64 (DW_Form form);
internal U32 dw_interp_const_u32 (DW_Form form);
internal S64 dw_interp_const_s64 (DW_Form form);
internal S32 dw_interp_const_s32 (DW_Form form);
internal B32 dw_interp_flag (DW_Form form);
internal U64 dw_interp_address (U64 address_size, U64 base_addr, DW_ListUnit *addr_xlist, DW_Form form);
internal String8 dw_interp_block (DW_Raw *input, DW_CompUnit *cu, DW_Form form);
internal String8 dw_interp_string (DW_Raw *input, DW_Format unit_format, DW_ListUnit *str_offsets, DW_Form form);
internal String8 dw_interp_line_ptr (DW_Raw *input, DW_Form form);
internal DW_LineFile * dw_interp_file (DW_LineVM *line_vm, DW_Form form);
internal DW_Reference dw_interp_ref (DW_Raw *input, DW_CompUnit *cu, DW_Form form);
internal DW_LocList dw_interp_loclist (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Form form);
internal Rng1U64List dw_interp_rnglist (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Form form);
internal String8 dw_exprloc_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal U128 dw_const_u128_from_attrib(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal U64 dw_const_u64_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal U32 dw_const_u32_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal S64 dw_const_s64_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal S32 dw_const_s32_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal B32 dw_flag_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal U64 dw_address_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal String8 dw_block_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal String8 dw_string_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal String8 dw_line_ptr_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal DW_LineFile * dw_file_from_attrib (DW_CompUnit *cu, DW_LineVM *line_vm, DW_Attrib *attrib);
internal DW_Reference dw_ref_from_attrib (DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal DW_LocList dw_loclist_from_attrib (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal Rng1U64List dw_rnglist_from_attrib (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
internal String8 dw_exprloc_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal U128 dw_const_u128_from_tag_attrib_kind(DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal U64 dw_const_u64_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal U32 dw_const_u32_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal B32 dw_flag_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal U64 dw_address_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal String8 dw_block_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal String8 dw_string_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal DW_LineFile * dw_file_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_LineVM *line_vm, DW_Tag tag, DW_AttribKind kind);
internal DW_Reference dw_ref_from_tag_attrib_kind (DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal DW_LocList dw_loclist_from_tag_attrib_kind (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal Rng1U64List dw_rnglist_from_tag_attrib_kind (Arena *arena, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
internal B32 dw_is_attrib_var_ref(DW_Raw *input, DW_CompUnit *cu, DW_Attrib *attrib);
// compile unit
internal DW_CompUnit dw_cu_from_info_off(Arena *arena, DW_Raw *input, DW_ListUnitInput lu_input, U64 offset, B32 relaxed);
internal DW_TagTree dw_tag_tree_from_cu(Arena *arena, DW_Raw *input, DW_CompUnit *cu);
internal HashTable * dw_make_tag_hash_table(Arena *arena, DW_TagTree tag_tree);
internal DW_TagNode * dw_tag_node_from_info_off(DW_CompUnit *cu, U64 info_off);
// line VM
internal U64 dw_read_line_vm_header(Arena *arena, DW_Raw *input, String8 cu_stmt_list, String8 cu_dir, String8 cu_name, U8 cu_address_size, DW_ListUnit *cu_str_offsets, DW_LineVMHeader *header_out);
internal DW_LineVM * dw_line_vm_init(DW_Raw *input, DW_CompUnit *cu);
internal void dw_line_vm_release(DW_LineVM *vm);
internal void dw_line_vm_advance(DW_LineVM *vm, U64 advance);
internal B32 dw_line_vm_step(DW_LineVM *vm);
internal DW_LineFile * dw_line_vm_find_file(DW_LineVM *vm, U64 file_idx);
internal String8 dw_path_from_file(Arena *arena, String8Array dir_table, DW_LineFile *file);
// helper for .debug_pubtypes and .debug_pubnames
internal DW_PubStringsTable dw_v4_pub_strings_table_from_section_kind(Arena *arena, DW_Raw *input, DW_SectionKind section_kind);
// expression
internal DW_Expr dw_expr_from_data(Arena *arena, DW_Format format, U64 addr_size, String8 data);
// debug frame
internal void dw_cfa_inst_list_push_node(DW_CFA_InstList *list, DW_CFA_InstNode *n);
internal DW_CFA_InstNode * dw_cfa_inst_list_push(Arena *arena, DW_CFA_InstList *list, DW_CFA_Inst v);
internal U64 dw_read_debug_frame_ptr(String8 data, DW_CIE *cie, U64 *ptr_out);
internal U64 dw_parse_descriptor_entry_header(String8 data, U64 off, DW_DescriptorEntry *desc_out);
internal B32 dw_parse_cie(String8 data, DW_Format format, Arch arch, DW_CIE *cie_out);
internal B32 dw_parse_fde(String8 data, DW_Format format, DW_CIE *cie, DW_FDE *fde_out);
internal B32 dw_parse_cfi(String8 data, U64 fde_offset, Arch arch, DW_CIE *cie_out, DW_FDE *fde_out);
internal DW_CFA_ParseErrorCode dw_parse_cfa_inst(String8 data, U64 code_align_factor, S64 data_align_factor, DW_DecodePtr *decode_ptr_func, void *decode_ptr_ud, U64 *bytes_read_out, DW_CFA_Inst *inst_out);
internal DW_CFA_InstList dw_parse_cfa_inst_list(Arena *arena, String8 data, U64 code_align_factor, S64 data_align_factor, DW_DecodePtr *decode_ptr_func, void *decode_ptr_ud);
#endif // DWARF_PARSE_H
+373
View File
@@ -0,0 +1,373 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal DW_CFI_Row *
dw_make_cfi_row(Arena *arena, U64 reg_count)
{
DW_CFI_Row *row = push_array(arena, DW_CFI_Row, 1);
row->regs = push_array(arena, DW_CFI_Register, reg_count);
for EachIndex(reg_idx, reg_count) {
row->regs[reg_idx].rule = DW_CFI_RegisterRule_SameValue;
}
return row;
}
internal void
dw_memcpy_cfi_row(DW_CFI_Row *dst, DW_CFI_Row *src, U64 reg_count)
{
dst->cfa = src->cfa;
MemoryCopyTyped(dst->regs, src->regs, reg_count);
}
internal DW_CFI_Row *
dw_copy_cfi_row(Arena *arena, DW_CFI_Row *row, U64 reg_count)
{
DW_CFI_Row *new_row = dw_make_cfi_row(arena, reg_count);
dw_memcpy_cfi_row(new_row, row, reg_count);
return new_row;
}
internal DW_CFI_Unwind *
dw_cfi_unwind_init(Arena *arena,
Arch arch,
DW_CIE *cie,
DW_FDE *fde,
DW_DecodePtr *decode_ptr_func,
void *decode_ptr_ud)
{
Temp scratch = scratch_begin(&arena, 1);
DW_CFI_Unwind *uw = push_array(arena, DW_CFI_Unwind, 1);
uw->insts = dw_parse_cfa_inst_list(arena, fde->insts, cie->code_align_factor, cie->data_align_factor, decode_ptr_func, decode_ptr_ud);
uw->cie = cie;
uw->fde = fde;
uw->pc = fde->pc_range.min;
uw->arch = arch;
uw->reg_count = dw_reg_count_from_arch(arch);
// setup initial register rules
DW_CFA_InstList initial_insts = dw_parse_cfa_inst_list(scratch.arena, cie->insts, cie->code_align_factor, cie->data_align_factor, decode_ptr_func, decode_ptr_ud);
uw->row = dw_make_cfi_row(arena, uw->reg_count);
uw->curr_inst = initial_insts.first;
if (!dw_cfi_next_row(arena, uw)) {
AssertAlways(0 && "unable to interpret initial row instructions");
}
// make first row from initial rules
uw->initial_row = uw->row;
uw->row = dw_copy_cfi_row(arena, uw->initial_row, uw->reg_count);
uw->curr_inst = uw->insts.first;
scratch_end(scratch);
return uw;
}
internal B32
dw_cfi_next_row(Arena *arena, DW_CFI_Unwind *uw)
{
B32 is_row_valid = 0;
DW_CFA_InstNode *row_inst = uw->curr_inst;
// skip leading nops
while (uw->curr_inst) {
if (uw->curr_inst->v.opcode != DW_CFA_Nop) {
break;
}
uw->curr_inst = uw->curr_inst->next;
}
while (uw->curr_inst) {
DW_CFA_Inst *inst = &uw->curr_inst->v;
// validate register operands
DW_CFA_OperandType *operand_types = dw_operand_types_from_cfa_op(inst->opcode);
U64 operand_count = dw_operand_count_from_cfa_opcode(inst->opcode);
for EachIndex(operand_idx, operand_count) {
if (operand_types[operand_idx] == DW_CFA_OperandType_Register) {
if (inst->operands[operand_idx].u64 >= uw->reg_count) {
goto exit;
}
}
}
switch (inst->opcode) {
// Row Creation Instructions
case DW_CFA_SetLoc: {
uw->pc = inst->operands[0].u64;
} break;
case DW_CFA_AdvanceLoc:
case DW_CFA_AdvanceLoc1:
case DW_CFA_AdvanceLoc2:
case DW_CFA_AdvanceLoc4: {
uw->pc += inst->operands[0].u64;
} break;
// CFA Definition Instructions
case DW_CFA_DefCfa:
case DW_CFA_DefCfaSf: {
U64 reg = inst->operands[0].u64;
S64 off = inst->operands[1].s64;
uw->row->cfa.rule = DW_CFA_Rule_RegOff;
uw->row->cfa.reg = reg;
uw->row->cfa.off = off;
} break;
case DW_CFA_DefCfaRegister: {
// TODO: report error: this operation is valid only if the current CFA rule is defined to register+offset
if (uw->row->cfa.rule != DW_CFA_Rule_RegOff) { goto exit; }
U64 reg = inst->operands[0].u64;
uw->row->cfa.reg = reg;
} break;
case DW_CFA_DefCfaOffset:
case DW_CFA_DefCfaOffsetSf: {
// TODO: report error: this operation is valid only if the current CFA rule is defined to register+offset
if (uw->row->cfa.rule != DW_CFA_Rule_RegOff) { goto exit; }
uw->row->cfa.off = inst->operands[0].s64;
} break;
case DW_CFA_DefCfaExpr: {
uw->row->cfa.rule = DW_CFA_Rule_Expression;
uw->row->cfa.expr = inst->operands[0].block;
} break;
// Register Rule Instructions
case DW_CFA_Undefined: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_Undefined;
} break;
case DW_CFA_SameValue: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_SameValue;
} break;
case DW_CFA_Offset:
case DW_CFA_OffsetExt:
case DW_CFA_OffsetExtSf: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_Offset;
uw->row->regs[reg].n = inst->operands[1].s64;
} break;
case DW_CFA_ValOffset:
case DW_CFA_ValOffsetSf: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_ValOffset;
uw->row->regs[reg].n = inst->operands[1].s64;
} break;
case DW_CFA_Register: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_Register;
uw->row->regs[reg].n = inst->operands[1].s64;
} break;
case DW_CFA_Expr: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_Expression;
uw->row->regs[reg].expr = inst->operands[1].block;
} break;
case DW_CFA_ValExpr: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg].rule = DW_CFI_RegisterRule_ValExpression;
uw->row->regs[reg].expr = inst->operands[1].block;
} break;
case DW_CFA_Restore:
case DW_CFA_RestoreExt: {
U64 reg = inst->operands[0].u64;
uw->row->regs[reg] = uw->initial_row->regs[reg];
} break;
// Row State Instructions
case DW_CFA_RememberState: {
DW_CFI_Row *new_row = dw_copy_cfi_row(arena, uw->row, uw->reg_count);
SLLStackPush(uw->row, new_row);
} break;
case DW_CFA_RestoreState: {
if (uw->row == 0) { goto exit; } // TODO: report error: unbalanced number of pushes and pops
DW_CFI_Row *free_row = uw->row;
SLLStackPop(uw->row);
SLLStackPush(uw->free_rows, free_row);
} break;
case DW_CFA_Nop: {} break;
default: { NotImplemented; } break; // TODO: report error: unknown CFA opcode
}
uw->curr_inst = uw->curr_inst->next;
if (uw->curr_inst) {
if (dw_is_new_row_cfa_opcode(uw->curr_inst->v.opcode)) { break; }
}
}
is_row_valid = row_inst != 0;
exit:;
return is_row_valid;
}
internal DW_CFI_Row *
dw_cfi_row_from_pc(Arena *arena, Arch arch, DW_CIE *cie, DW_FDE *fde, DW_DecodePtr *decode_ptr_func, void *decode_ptr_ctx, U64 pc)
{
Temp scratch = scratch_begin(&arena, 1);
B32 is_row_found = 0;
U64 reg_count = dw_reg_count_from_arch(arch);
DW_CFI_Unwind *uw = dw_cfi_unwind_init(scratch.arena, arch, cie, fde, decode_ptr_func, decode_ptr_ctx);
DW_CFI_Row *row = dw_copy_cfi_row(scratch.arena, uw->row, uw->reg_count);
U64 prev_pc = uw->pc;
while (dw_cfi_next_row(scratch.arena, uw)) {
if (prev_pc <= pc && pc < uw->pc) {
is_row_found = 1;
break;
}
dw_memcpy_cfi_row(row, uw->row, uw->reg_count);
prev_pc = uw->pc;
}
// handle last row
if (!is_row_found) {
if (contains_1u64(fde->pc_range, pc)) {
row = uw->row;
is_row_found = 1;
}
}
// copy out final row
DW_CFI_Row *result = 0;
if (is_row_found) {
result = dw_copy_cfi_row(arena, row, reg_count);
}
scratch_end(scratch);
return result;
}
internal MachineOpResult
dw_compute_cfa(Arch arch, DW_CFI_Row *row, void *reg_block, MachineOp_MemRead *mem_read_func, void *mem_read_ud, U64 *cfa_out)
{
MachineOpResult unwind_status = MachineOpResult_Fail;
ARCH_Info *arch_info = arch_info_from_arch(arch);
switch(row->cfa.rule)
{
case DW_CFA_Rule_Null:{}break;
case DW_CFA_Rule_RegOff:
{
// TODO: report error (invalid register read)
U64 cfa_reg_value = 0;
U64 reg_size = dw_reg_size_from_code(arch, row->cfa.reg);
AssertAlways(reg_size <= sizeof(cfa_reg_value));
ARCH_RegCode reg_code = arch_reg_code_from_dw(arch, row->cfa.reg);
Rng1U16 reg_rng = arch_info->reg_code_rng_table[reg_code];
if(!arch_reg_block_read_range(arch_info, reg_block, reg_rng, &cfa_reg_value))
{
break;
}
*cfa_out = cfa_reg_value + row->cfa.off;
unwind_status = MachineOpResult_Ok;
}break;
case DW_CFA_Rule_Expression:
{
Temp scratch = scratch_begin(0,0);
DW_ExprValue value = {0};
DW_Expr expr = dw_expr_from_data(scratch.arena, DW_Format_32Bit, byte_size_from_arch(arch), row->cfa.expr);
DW_ExprEvalResult eval_result = dw_eval_expr(scratch.arena, arch, DW_Format_32Bit, 0, 0, 0, 9999, expr, reg_block, mem_read_func, mem_read_ud, &value);
if (eval_result == DW_ExprEvalResult_Ok) {
if (DW_ExprValueType_IsInt(value.type)) {
*cfa_out = value.u64;
unwind_status = MachineOpResult_Ok;
}
} else if (eval_result == DW_ExprEvalResult_Maybe) {
unwind_status = MachineOpResult_Maybe;
}
scratch_end(scratch);
}break;
}
return unwind_status;
}
internal MachineOpResult
dw_cfi_apply_register_rules(Arch arch, U64 cfa, DW_CFI_Row *row, void *reg_block, MachineOp_MemRead *mem_read_func, void *mem_read_ud)
{
Temp scratch = scratch_begin(0,0);
MachineOpResult unwind_status = MachineOpResult_Ok;
ARCH_Info *arch_info = arch_info_from_arch(arch);
U64 max_reg_size = dw_reg_max_size_from_arch(arch);
void *reg_buffer = push_array(scratch.arena, U8, max_reg_size);
U64 reg_count = dw_reg_count_from_arch(arch);
for EachIndex(reg_idx, reg_count)
{
DW_CFI_Register *reg = &row->regs[reg_idx];
ARCH_RegCode reg_code = arch_reg_code_from_dw(arch, reg_idx);
Rng1U16 reg_rng = arch_info->reg_code_rng_table[reg_code];
switch(reg->rule)
{
default:{}break;
case DW_CFI_RegisterRule_Undefined: {} break;
case DW_CFI_RegisterRule_SameValue: {} break;
case DW_CFI_RegisterRule_Offset:
{
// read register value from memory
U64 addr = cfa + reg->n;
U64 reg_size = dw_reg_size_from_code(arch, reg_idx);
unwind_status = mem_read_func(addr, reg_buffer, reg_size, mem_read_ud);
if (unwind_status != MachineOpResult_Ok) { goto exit; }
// write register value to the thread context
if(!arch_reg_block_write_range(arch_info, reg_block, reg_rng, reg_buffer))
{
unwind_status = MachineOpResult_Fail;
goto exit;
}
}break;
case DW_CFI_RegisterRule_ValOffset:
{
// compute register value
U64 reg_value = cfa + reg->n;
// write register value to the thread context
U64 reg_size = dw_reg_size_from_code(arch, reg_idx);
if(!arch_reg_block_write_range(arch_info, reg_block, reg_rng, &reg_value))
{
unwind_status = MachineOpResult_Fail;
goto exit;
}
}break;
case DW_CFI_RegisterRule_Register:
{
// read register value from another register
U64 reg_size = dw_reg_size_from_code(arch, reg_idx);
if(!arch_reg_block_read_range(arch_info, reg_block, reg_rng, reg_buffer))
{
unwind_status = MachineOpResult_Fail;
goto exit;
}
// write register value to the thread context
if(!arch_reg_block_write_range(arch_info, reg_block, reg_rng, reg_buffer))
{
unwind_status = MachineOpResult_Fail;
goto exit;
}
if (unwind_status != MachineOpResult_Ok) { goto exit; }
}break;
case DW_CFI_RegisterRule_Expression:
{
// TODO: evaluate expression
NotImplemented;
}break;
case DW_CFI_RegisterRule_ValExpression:
{
// TODO: evaluate expression
NotImplemented;
}break;
case DW_CFI_RegisterRule_Architectural:
{
NotImplemented;
}break;
}
}
// update stack pointer
arch_reg_block_write_sp(arch_info, reg_block, cfa);
exit:;
scratch_end(scratch);
return unwind_status;
}
+81
View File
@@ -0,0 +1,81 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef DWARF_UNWIND_H
#define DWARF_UNWIND_H
typedef enum DW_CFI_RegisterRule
{
DW_CFI_RegisterRule_Undefined,
DW_CFI_RegisterRule_SameValue,
DW_CFI_RegisterRule_Offset,
DW_CFI_RegisterRule_ValOffset,
DW_CFI_RegisterRule_Register,
DW_CFI_RegisterRule_Expression,
DW_CFI_RegisterRule_ValExpression,
DW_CFI_RegisterRule_Architectural
} DW_CFI_RegisterRule;
typedef enum DW_CFA_Rule
{
DW_CFA_Rule_Null,
DW_CFA_Rule_RegOff,
DW_CFA_Rule_Expression
} DW_CFA_Rule;
typedef struct DW_CFA
{
DW_CFA_Rule rule;
union {
struct {
DW_Reg reg;
S64 off;
};
String8 expr;
};
} DW_CFA;
typedef struct DW_CFI_Register
{
DW_CFI_RegisterRule rule;
union {
S64 n;
String8 expr;
};
} DW_CFI_Register;
typedef struct DW_CFI_Row
{
DW_CFA cfa;
DW_CFI_Register *regs;
struct DW_CFI_Row *next;
} DW_CFI_Row;
typedef struct DW_CFI_Unwind
{
DW_CFA_InstList insts;
DW_CIE *cie;
DW_FDE *fde;
DW_CFI_Row *initial_row;
DW_CFI_Row *row;
DW_CFA_InstNode *curr_inst;
DW_CFI_Row *free_rows;
U64 pc;
Arch arch;
U64 reg_count;
} DW_CFI_Unwind;
////////////////////////////////
internal DW_CFI_Row * dw_make_cfi_row(Arena *arena, U64 reg_count);
internal DW_CFI_Row * dw_copy_cfi_row(Arena *arena, DW_CFI_Row *row, U64 reg_count);
internal DW_CFI_Unwind * dw_cfi_unwind_init(Arena *arena, Arch arch, DW_CIE *cie, DW_FDE *fde, DW_DecodePtr *decode_ptr_func, void *decode_ptr_ud);
internal B32 dw_cfi_next_row(Arena *arena, DW_CFI_Unwind *uw);
internal DW_CFI_Row * dw_cfi_row_from_pc(Arena *arena, Arch arch, struct DW_CIE *cie, struct DW_FDE *fde, DW_DecodePtr *decode_ptr_func, void *decode_ptr_ctx, U64 pc);
internal MachineOpResult dw_compute_cfa(Arch arch, DW_CFI_Row *row, void *reg_block, MachineOp_MemRead *mem_read_func, void *mem_read_ud, U64 *cfa_out);
internal MachineOpResult dw_cfi_apply_register_rules(Arch arch, U64 cfa, DW_CFI_Row *row, void *reg_block, MachineOp_MemRead *mem_read_func, void *mem_read_ud);
#endif // DWARF_UNWIND_H
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,275 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef RDI_FROM_DWARF_H
#define RDI_FROM_DWARF_H
////////////////////////////////
//~ Conversion
typedef struct D2R_ConvertParams
{
String8 dbg_name;
String8 dbg_data;
String8 exe_name;
String8 exe_data;
ExecutableImageKind exe_kind;
RDIM_SubsetFlags subset_flags;
B32 deterministic;
B32 is_parse_relaxed;
} D2R_ConvertParams;
#define D2R_UNIT_CHUNK_CAP 512
#define D2R_UDT_CHUNK_CAP 1024
#define D2R_TYPE_CHUNK_CAP 1024
#define D2R_SRC_FILE_CAP 1024
#define D2R_LINE_TABLE_CAP 1024
#define D2R_GVAR_CHUNK_CAP 1024
#define D2R_TVAR_CHUNK_CAP 1024
#define D2R_LOCATIONS_CAP 4096
#define D2R_PROC_CHUNK_CAP 4096
#define D2R_SCOPE_CHUNK_CAP 4096
#define D2R_INLINE_SITE_CHUNK_CAP 4096
typedef struct D2R_Shared
{
RDIM_TopLevelInfo top_level_info;
RDIM_BinarySectionList binary_sections;
RDIM_UnitChunkList units;
RDIM_UDTChunkList udts;
RDIM_TypeChunkList types;
RDIM_SrcFileChunkList src_files;
RDIM_LineTableChunkList line_tables;
} D2R_Shared;
////////////////////////////////
//~ Value Types
typedef enum
{
D2R_ArithmeticType_Null,
D2R_ArithmeticType_Signed,
D2R_ArithmeticType_Unsigned,
D2R_ArithmeticType_Float,
} D2R_ArithmeticType;
#define D2R_ValueType_Signed_XList \
X(S8, Signed, 1 ) \
X(S16, Signed, 2 ) \
X(S32, Signed, 4 ) \
X(S64, Signed, 8 ) \
X(S128, Signed, 16) \
X(S256, Signed, 32) \
X(S512, Signed, 64)
#define D2R_ValueType_Unsigned_XList \
X(U8, Unsigned, 1 ) \
X(U16, Unsigned, 2 ) \
X(U32, Unsigned, 4 ) \
X(U64, Unsigned, 8 ) \
X(U128, Unsigned, 16) \
X(U256, Unsigned, 32) \
X(U512, Unsigned, 64)
#define D2R_ValueType_Float_XList \
X(F16, Float, 2 ) \
X(F32, Float, 4 ) \
X(F48, Float, 6 ) \
X(F64, Float, 8 ) \
X(F80, Float, 10) \
X(F96, Float, 12) \
X(F128, Float, 16)
#define D2R_ValueType_XList \
X(Generic, Null, 0 ) \
X(ImplicitValue, Null, 0 ) \
X(Address, Unsigned, 0 ) \
D2R_ValueType_Signed_XList \
D2R_ValueType_Unsigned_XList \
D2R_ValueType_Float_XList
typedef enum
{
#define X(t, ...) D2R_ValueType_##t,
D2R_ValueType_XList
#undef X
D2R_ValueType_Bool = D2R_ValueType_S8,
} D2R_ValueType;
typedef struct D2R_ValueTypeNode
{
D2R_ValueType type;
struct D2R_ValueTypeNode *next;
} D2R_ValueTypeNode;
typedef struct D2R_ValueTypeStack
{
U64 count;
D2R_ValueTypeNode *top;
D2R_ValueTypeNode *free_list;
} D2R_ValueTypeStack;
////////////////////////////////
//~ Type Table
typedef struct D2R_TypeTable
{
HashTable *ht;
RDIM_TypeChunkList *types;
U64 type_chunk_cap;
RDIM_Type **builtin_types;
} D2R_TypeTable;
////////////////////////////////
//~ Tag Iterator
typedef DW_TagSpare D2R_TagFlags;
enum
{
D2R_TagFlags_TypeConverted = (1 << 0),
D2R_TagFlags_UdtConverted = (1 << 1),
};
typedef struct D2R_TagFrame
{
DW_TagNode *node;
RDIM_Scope *scope;
struct D2R_TagFrame *next;
} D2R_TagFrame;
typedef struct D2R_TagIterator
{
D2R_TagFrame *free_list;
D2R_TagFrame *stack;
DW_TagNode *null_tag_node;
DW_TagNode *tag_node;
B32 visit_children;
} D2R_TagIterator;
////////////////////////////////
//~ Line Table Conversion
typedef struct D2R_SrcFileLookup
{
DW_LineFile *file;
DW_LineVM *vm;
RDIM_SrcFile *src_file;
} D2R_SrcFileLookup;
////////////////////////////////
//~ Contrib Map
typedef struct D2R_CompUnitContribMap
{
U64 count;
U64 *info_off_arr;
RDIM_Rng1U64ChunkList *voff_range_arr;
} D2R_CompUnitContribMap;
////////////////////////////////
//~ RDIM Bytecode Extensions
internal B32 rdim_is_eval_bytecode_static (RDIM_EvalBytecode bc);
internal B32 rdim_static_eval_bytecode_to_voff(RDIM_EvalBytecode bc, U64 image_base, U64 *voff_out);
////////////////////////////////
//~ DWARF -> RDI Enums
internal RDI_Language d2r_rdi_language_from_dw_language(DW_Language v);
internal RDI_RegCodeX64 d2r_rdi_reg_code_from_dw_reg_x64 (DW_RegX64 v);
internal RDI_RegCode d2r_rdi_reg_code_from_dw_reg (Arch arch, DW_Reg v);
////////////////////////////////
//~ Value Type
internal D2R_ValueTypeNode * d2r_value_type_stack_push(Arena *arena, D2R_ValueTypeStack *stack, D2R_ValueType type);
internal D2R_ValueType d2r_value_type_stack_pop (D2R_ValueTypeStack *stack);
internal D2R_ValueType d2r_value_type_stack_peek(D2R_ValueTypeStack *stack);
internal D2R_ValueType d2r_signed_value_type_from_bit_size (U64 bit_size);
internal D2R_ValueType d2r_unsigned_value_type_from_bit_size(U64 bit_size);
internal D2R_ValueType d2r_float_type_from_bit_size (U64 bit_size);
internal U64 d2r_size_from_value_type(U64 addr_size, D2R_ValueType value_type);
internal D2R_ArithmeticType d2r_arithmetic_type_from_value_type(D2R_ValueType v);
internal D2R_ArithmeticType d2r_arithmetic_type_from_value_type(D2R_ValueType v);
internal B32 d2r_is_value_type_signed (D2R_ValueType v);
internal B32 d2r_is_value_type_integral(D2R_ValueType v);
internal B32 d2r_is_value_type_unsigned(D2R_ValueType v);
internal B32 d2r_is_value_type_float (D2R_ValueType v);
internal D2R_ValueType d2r_pick_common_value_type(D2R_ValueType lhs, D2R_ValueType rhs);
internal RDI_EvalTypeGroup d2r_value_type_to_rdi(D2R_ValueType v);
internal D2R_ValueType d2r_apply_usual_arithmetic_conversions(Arena *arena, D2R_ValueType lhs, D2R_ValueType rhs, RDIM_EvalBytecode *bc);
internal void d2r_push_arithmetic_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
internal void d2r_push_relational_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
////////////////////////////////
//~ Expression Conversion
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Raw *input, U64 image_base, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, D2R_ValueType *result_type_out);
internal RDIM_Location d2r_transpile_expression (Arena *arena, DW_Raw *input, U64 image_base, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
internal RDIM_Location d2r_location_from_attrib (Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
internal RDIM_LocationCaseList d2r_locset_from_attrib (Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, DW_Raw *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
internal RDIM_LocationCaseList d2r_var_locset_from_tag (Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, DW_Raw *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag);
////////////////////////////////
//~ Type Table
internal RDIM_Type * d2r_create_type (Arena *arena, D2R_TypeTable *type_table);
internal RDIM_Type * d2r_create_type_from_offset(Arena *arena, D2R_TypeTable *type_table, U64 info_off);
internal RDIM_Type * d2r_type_from_offset(D2R_TypeTable *type_table, U64 info_off);
internal RDIM_Type * d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
////////////////////////////////
//~ Tag Iterator
internal D2R_TagIterator * d2r_tag_iterator_init(Arena *arena, DW_TagNode *root);
internal void d2r_tag_iterator_next(Arena *arena, D2R_TagIterator *iter);
internal void d2r_tag_iterator_skip_children (D2R_TagIterator *iter);
internal DW_TagNode * d2r_tag_iterator_parent_tag_node(D2R_TagIterator *iter);
internal DW_Tag d2r_tag_iterator_parent_tag (D2R_TagIterator *iter);
////////////////////////////////
//~ Type Conversion
internal void d2r_flag_converted_tag(DW_TagNode *tag_node);
internal B8 d2r_is_tag_converted (DW_TagNode *tag_node);
internal RDIM_Type * d2r_find_or_convert_type(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, Arch arch, DW_Tag tag, DW_AttribKind kind);
internal void d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, Arch arch, DW_TagNode *root);
////////////////////////////////
//~ UDT Conversion
internal B8 d2r_is_udt_tag_converted (DW_TagNode *tag_node);
internal void d2r_flag_converted_udt_tag(DW_TagNode *tag_node);
internal void d2r_inline_anonymous_udt_member(Arena *arena, RDIM_UDT *top_udt, U64 base_off, RDIM_UDT *udt);
internal void d2r_convert_udts(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, DW_TagNode *root);
////////////////////////////////
//~ Symbol Conversion
internal RDIM_Scope * d2r_push_scope (Arena *arena, RDIM_ScopeChunkList *scopes, U64 scope_chunk_cap, D2R_TagFrame *tag_stack, Rng1U64List ranges);
internal RDIM_Type ** d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out);
internal Rng1U64List d2r_range_list_from_tag(Arena *arena, DW_Raw *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag);
internal void d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, DW_Raw *input, DW_CompUnit *cu, DW_Language cu_lang, U64 image_base, Arch arch, DW_TagNode *root, RDIM_Unit *unit_rdi);
////////////////////////////////
//~ Line Table Conversion
internal U64 d2r_hash_line_file(String8 dir_path, DW_LineFile *file);
internal void d2r_sort_ptrs(void **ptrs, U64 count, int (* is_before)(void *a, void *b));
////////////////////////////////
//~ Contrib Map
internal D2R_CompUnitContribMap d2r_cu_contrib_map_from_aranges(Arena *arena, DW_Raw *input, U64 image_base);
internal RDIM_Rng1U64ChunkList d2r_voff_ranges_from_cu_info_off(D2R_CompUnitContribMap map, U64 info_off);
////////////////////////////////
//~ Entry Point
internal RDIM_BakeParams d2r_convert(Arena *arena, D2R_ConvertParams *params);
#endif // RDI_FROM_DWARF_H
+121 -136
View File
@@ -1,136 +1,121 @@
version(2);
project_name = "The RAD Debugger";
indent_width = "2";
default_tab_width = "2";
patterns =
{
"*.c",
"*.cpp",
"*.h",
"*.inc",
"*.hpp",
"*.bat",
"*.sh",
"*.4coder",
"*.glsl",
"*.bfs",
"*.html",
"*.txt",
"*.md",
"*.mdesk",
"*.asm",
};
blacklist_patterns =
{
".*",
"metagen_base_*",
"metagen_os_*",
};
paths =
{
{ .path = ".", .recursive = false, .relative = true, },
{ .path = "src", .recursive = true , .relative = true, },
{ .path = "local", .recursive = true , .relative = true, },
};
load_paths =
{
.win = paths,
.linux = paths,
};
commands =
{
.rjf_f1 =
{
.win = "build raddbg telemetry",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.rjf_f2 =
{
.win = "build raddbg_from_pdb",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.rjf_f3 =
{
.win = "pushd build && raddbg.exe && popd",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.build_raddbg =
{
.win = "build raddbg",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.build_raddbg_from_pdb =
{
.win = "build raddbg_from_pdb",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.build_raddbg_dump =
{
.win = "build raddbg_dump",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.build_mule_main =
{
.win = "build mule_main",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
.run_raddbg =
{
.win = "pushd build && raddbg.exe && popd",
.linux = "",
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.cursor_at_end = false,
},
};
fkey_command =
{
.F1 = "build_raddbg",
.F3 = "run_raddbg",
};
fkey_command_override =
{
.rjf =
{
.F1 = "rjf_f1",
.F2 = "rjf_f2",
.F3 = "rjf_f3",
},
};
version(2);
project_name = "The RAD Debugger";
indent_width = "2";
default_tab_width = "2";
patterns =
{
"*.c",
"*.cpp",
"*.h",
"*.inc",
"*.hpp",
"*.bat",
"*.sh",
"*.4coder",
"*.glsl",
"*.bfs",
"*.html",
"*.txt",
"*.md",
"*.mdesk",
"*.asm",
};
blacklist_patterns =
{
".*",
"metagen_base_*",
"metagen_os_*",
};
paths =
{
{ .path = ".", .recursive = false, .relative = true, },
{ .path = "src", .recursive = true , .relative = true, },
{ .path = "local", .recursive = true , .relative = true, },
};
load_paths =
{
.win = paths,
.linux = paths,
};
commands =
{
//- rjf: [raddbg]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build torture && build ryan_scratch && pushd build && torture eval2/* && ryan_scratch", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [raddbg wsl]
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [scratch]
// .f2 = { .win = "pushd build && for /l %i in (1, 1, 3) do (radbin --rdi raddbg.exe --out:raddbg_%i.rdi && radbin --dump raddbg_%i.rdi --out:raddbg_%i.dump)", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f2 = { .win = "pushd build && radbin --rdi raddbg.exe --thread_count=1 --out:1.rdi && radbin --rdi raddbg.exe --thread_count=8 --out:8.rdi && radbin --dump 1.rdi --out:1.dump && radbin --dump 8.rdi --out:8.dump)", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [textperf]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta telemetry textperf && raddbg_stable --ipc bring_to_front && raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [tester]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta tester", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [radbin]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: running target
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "build torture", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "wsl ./build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "pushd build && raddbg --user:dev.raddbg_user && popd", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "wsl_launch /mnt/c/devel/raddebugger/build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: local target builds
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_from_pdb = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_from_dwarf = { .win = "build rdi_from_dwarf", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_dump = { .win = "build rdi_dump", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_breakpad_from_pdb = { .win = "build rdi_breakpad_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_ryan_scratch = { .win = "build ryan_scratch", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_main = { .win = "build mule_main", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_module = { .win = "build mule_module", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_hotload = { .win = "build mule_hotload", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_peb_trample = { .win = "build mule_peb_trample", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: wsl target builds
.build_raddbg_wsl = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_from_pdb_wsl = { .win = "wsl ./build.sh rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_from_dwarf_wsl = { .win = "wsl ./build.sh rdi_from_dwarf", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_dump_wsl = { .win = "wsl ./build.sh rdi_dump", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_rdi_breakpad_from_pdb_wsl = { .win = "wsl ./build.sh rdi_breakpad_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_ryan_scratch_wsl = { .win = "wsl ./build.sh ryan_scratch", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_main_wsl = { .win = "wsl ./build.sh mule_main", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_module_wsl = { .win = "wsl ./build.sh mule_module", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_hotload_wsl = { .win = "wsl ./build.sh mule_hotload", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.build_mule_peb_trample_wsl = { .win = "wsl ./build.sh mule_peb_trample", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: local target runs
.run_raddbg = { .win = "pushd build && raddbg.exe && popd", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
};
fkey_command =
{
.F1 = "f1",
.F2 = "f2",
.F3 = "f3",
};
fkey_command_override =
{
.rjf =
{
.F1 = "f1",
.F2 = "f2",
.F3 = "f3",
},
};
+75
View File
@@ -0,0 +1,75 @@
// raddbg 0.9.28 project file
name: "The RAD Debugger"
target:
{
executable: "build/raddbg.exe"
working_directory: "../raddebugger"
arguments: "--user:C:/devel/raddebugger/build/raddbg_test.user"
debug_subprocesses: 0
}
target:
{
executable: "build/raddbg.exe"
working_directory: "../raddebugger"
arguments: "--user:test123"
debug_subprocesses: 0
}
target:
{
executable: "build/mule_main.exe"
working_directory: build
output_label: output_a
}
target:
{
executable: "build/torture.exe"
working_directory: build
arguments: "eval2/*"
}
target:
{
executable: "build/metagen.exe"
working_directory: build
}
target:
{
executable: "build/radbin.exe"
working_directory: build
arguments: "--rdi raddbg"
}
target:
{
executable: "build/release_version/raddbg.exe"
working_directory: "build/release_version"
}
target:
{
executable: "build/radbin.exe"
working_directory: build
arguments: "--rdi fat.so --capture"
}
target:
{
executable: "build/radbin.exe"
working_directory: build
arguments: "--rdi fat.debug --capture"
}
target:
{
executable: "build/radbin.exe"
working_directory: build
arguments: "--rdi raddbg"
}
watch_pin: expression: tag_hash_slots
target:
{
executable: "build/ryan_scratch.exe"
working_directory: build
enabled: 1
}
target:
{
executable: "../../Program Files/SuperTux/bin/supertux2.exe"
working_directory: "../../Program Files/SuperTux/bin"
}
+126
View File
@@ -0,0 +1,126 @@
@echo off
setlocal enabledelayedexpansion
set TARGET_VALUES=radlink radbin mule_main mule_module torture
set CC_VALUES=msvc clang
set MODE_VALUES=debug release
set RAW_ARGS=%*
set TORTURE_ARGS=
set RUN_TORTURE=1
:: Make test data directories
if not exist local mkdir local
pushd local
if not exist test_data mkdir test_data
popd
:: Check if we need new test data version
pushd local
set need_test_data=0
curl -sfL -o test_data_version_latest.txt https://data.raddbg.com/public/raddbg_test_data_version.txt || exit /b 1
if exist "test_data_version_current.txt" (
fc /b "test_data_version_latest.txt" "test_data_version_current.txt" > nul
) else (
echo Test data not present.
set need_test_data=1
)
if errorlevel 1 (
echo Test data out-of-date.
set need_test_data=1
)
popd
:: Download test data if stale
if "%need_test_data%"=="1" (
echo Downloading test data...
pushd local
pushd test_data
curl -sfL -o test_data.zip https://data.raddbg.com/public/raddbg_test_data.zip || exit /b 1
tar -xf test_data.zip || exit /b 1
del test_data.zip
popd
copy /y test_data_version_latest.txt test_data_version_current.txt
popd
)
popd
:parse_args
if "%~1" == "" goto parse_done
if "%~1" == "--" goto parse_torture_args
if /i "%~1" == "msvc" set CC_VALUES=msvc && shift /1 && goto parse_args
if /i "%~1" == "clang" set CC_VALUES=clang && shift /1 && goto parse_args
if /i "%~1" == "debug" set MODE_VALUES=debug && shift /1 && goto parse_args
if /i "%~1" == "release" set MODE_VALUES=release && shift /1 && goto parse_args
if /i "%~1" == "no_torture" set RUN_TORTURE=0 && shift /1 && goto parse_args
echo usage: %~nx0 [msvc^|clang] [debug^|release] [no_torture] [-- torture-args]
exit /b 1
:parse_torture_args
shift /1
if "%~1" == "" set "TORTURE_ARGS=" && goto parse_done
set "TORTURE_ARGS=%RAW_ARGS%"
if "%TORTURE_ARGS:~0,3%" == "-- " set "TORTURE_ARGS=%TORTURE_ARGS:~3%" && goto parse_done
set "TORTURE_ARGS=%TORTURE_ARGS:* -- =%"
:parse_done
if not defined TORTURE_ARGS set "TORTURE_ARGS=*
for %%m in (%MODE_VALUES%) do for %%c in (%CC_VALUES%) do (
setlocal
:: nuke artifacts from last run
if exist build/torture_artifacts rmdir /s /q build\torture_artifacts
if exist build\metagen.exe del /q build\metagen.exe
for %%t in (%TARGET_VALUES%) do (
if exist build\%%t.exe del /q build\%%t.exe
if exist build\%%t.pdb del /q build\%%t.pdb
)
if "%%c" == "clang" (
:: Prefer standalone LLVM clang over Visual Studio clang so ASAN runtime files match the compiler.
set "clang_path="
for /f "tokens=*" %%i in ('where clang') do (
set "candidate_clang_path=%%~dpi"
if "!candidate_clang_path:Microsoft Visual Studio=!"=="!candidate_clang_path!" (
if not defined clang_path set "clang_path=!candidate_clang_path!"
)
)
if not defined clang_path (
echo ERROR: standalone LLVM clang not found in PATH
exit /b 1
)
set PATH=!clang_path!;!PATH!
for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v
if not defined clang_version (
echo ERROR: failed to detect clang version
exit /b 1
)
set PATH=!clang_path!..\lib\clang\!clang_version!\lib\windows;!PATH!
)
:: TODO: unblock asan
call build.bat meta %%c %%m raddbg raddbg_non_graphical || (endlocal exit /b 1)
:: clang does not compile with asan in release mode because it runs out of memory
if "%%c" equ "clang" (
if /i "%%m" equ "release" (
call build.bat no_meta %%c %%m !TARGET_VALUES! || (endlocal exit /b 1)
) else (
call build.bat asan no_meta %%c %%m !TARGET_VALUES! || (endlocal exit /b 1)
)
) else (
call build.bat asan no_meta %%c %%m !TARGET_VALUES! || (endlocal exit /b 1)
)
if "%RUN_TORTURE%" equ "1" (
pushd build
torture %TORTURE_ARGS%
popd
if errorlevel 1 (
endlocal
exit /b 1
)
)
endlocal
)
Executable
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
set -eu
cd "$(dirname "$0")"
target_values=(raddbg raddbg_non_graphical radlink radbin torture)
cc_values=(clang gcc)
mode_values=(debug release)
run_torture=1
torture_args=()
while [[ $# -gt 0 ]]; do
case "$1" in
--)
shift
torture_args=("$@")
break
;;
clang)
cc_values=("$1")
shift
;;
gcc)
cc_values=("$1")
shift
;;
debug|release)
mode_values=("$1")
shift
;;
no_torture)
run_torture=0
shift
;;
*)
echo "usage: $0 [clang|gcc] [debug|release] [no_torture] [-- torture-args]"
exit 1
;;
esac
done
if [[ "${#torture_args[@]}" == "0" ]]; then
torture_args=("*")
fi
for m in "${mode_values[@]}"; do
for c in "${cc_values[@]}"; do
# nuke artifacts from last run
rm -rf build/torture_artifacts
rm -f build/metagen
for t in "${target_values[@]}"; do
rm -f "build/$t"
done
# build targets
./build.sh meta "$c" "$m" "${target_values[@]}"
# run torture from build folder
if [[ "$run_torture" == "1" ]]; then
torture_compiler_args=()
has_clang_arg=0
has_gcc_arg=0
for arg in "${torture_args[@]}"; do
case "$arg" in
-clang:*|--clang:*) has_clang_arg=1 ;;
-gcc:*|--gcc:*) has_gcc_arg=1 ;;
esac
done
if [[ "$c" == clang && "$has_clang_arg" == "0" ]]; then
torture_compiler_args=("-clang:$(command -v "${CC:-clang}")")
elif [[ "$c" == gcc && "$has_gcc_arg" == "0" ]]; then
torture_compiler_args=("-gcc:$(command -v "${CC:-gcc}")")
fi
(cd build && ./torture "${torture_compiler_args[@]}" "${torture_args[@]}")
fi
done
done
+15
View File
@@ -0,0 +1,15 @@
Clear-Host
$path_root = git rev-parse --show-toplevel
if ($IsWindows) {
$devshell = Join-Path $path_root 'scripts/helpers/devshell.ps1'
& $devshell -arch amd64
}
Push-Location $path_root
$build_bat = Join-Path $path_root 'build.bat'
& $build_bat @args
Pop-Location
+10
View File
@@ -0,0 +1,10 @@
Clear-Host
$path_root = git rev-parse --show-toplevel
$build_dir = Join-Path $path_root 'build'
if (Test-Path $build_dir) {
Get-ChildItem -Path $build_dir -Recurse | Remove-Item -Force -Recurse
Write-Host "Build directory cleaned."
} else {
Write-Host "Build directory does not exist."
}
+28
View File
@@ -0,0 +1,28 @@
if ($env:VCINSTALLDIR) {
return
}
$ErrorActionPreference = "Stop"
# Use vswhere to find the latest Visual Studio installation
$vswhere_out = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
if ($null -eq $vswhere_out) {
Write-Host "ERROR: Visual Studio installation not found"
exit 1
}
# Find Launch-VsDevShell.ps1 in the Visual Studio installation
$vs_path = $vswhere_out
$vs_devshell = Join-Path $vs_path "\Common7\Tools\Launch-VsDevShell.ps1"
if ( -not (Test-Path $vs_devshell) ) {
Write-Host "ERROR: Launch-VsDevShell.ps1 not found in Visual Studio installation"
Write-Host Tested path: $vs_devshell
exit 1
}
# Launch the Visual Studio Developer Shell
Push-Location
write-host @args
& $vs_devshell @args
Pop-Location
+174
View File
@@ -0,0 +1,174 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Abstracted Architecture Functions
internal ARCH_Info *
arch_info_from_arch(Arch arch)
{
ARCH_Info *result = &arch_info_nil;
switch(arch)
{
default:{}break;
#if defined(X64_H)
case Arch_x64:
{
local_persist U8 trap_inst_bytes[] = {0xcc};
local_persist read_only ARCH_Info info =
{
.reg_block_size = sizeof(X64_RegBlock),
.instruction_pointer_reg_code = X64_RegCode_rip,
.stack_pointer_reg_code = X64_RegCode_rsp,
.reg_code_count = X64_RegCode_COUNT,
.trap_instruction = {trap_inst_bytes, sizeof(trap_inst_bytes)},
.reg_code_rng_table = x64_reg_code_rng_table,
.reg_code_name_table = x64_reg_code_name_table,
.reg_code_base_table = x64_reg_code_base_table,
.reg_code_is_vector_table = x64_reg_code_is_vector_table,
};
result = &info;
}break;
#endif
}
return result;
}
internal ARCH_RegCode
arch_reg_code_from_name(ARCH_Info *arch_info, String8 name)
{
ARCH_RegCode result = 0;
for EachIndex(code, arch_info->reg_code_count)
{
if(str8_match(arch_info->reg_code_name_table[code], name, 0))
{
result = code;
break;
}
}
return result;
}
internal B32
arch_reg_block_read_range(ARCH_Info *arch_info, void *block, Rng1U16 range, void *dst)
{
B32 result = 0;
{
Rng1U16 legal_range = r1u16(0, arch_info->reg_block_size);
Rng1U16 try_range = range;
Rng1U16 read_range = intersect_1u16(legal_range, try_range);
U64 read_size = dim_1u16(read_range);
if(read_size != 0)
{
MemoryCopy(dst, (U8 *)block + read_range.min, read_size);
result = 1;
}
}
return result;
}
internal B32
arch_reg_block_write_range(ARCH_Info *arch_info, void *block, Rng1U16 range, void *src)
{
B32 result = 0;
Rng1U16 legal_range = r1u16(0, arch_info->reg_block_size);
Rng1U16 try_range = range;
Rng1U16 write_range = intersect_1u16(legal_range, try_range);
U64 write_size = dim_1u16(write_range);
if(write_size != 0)
{
MemoryCopy((U8 *)block + write_range.min, src, write_size);
result = 1;
}
return result;
}
internal U64
arch_ip_from_reg_block(ARCH_Info *arch_info, void *block)
{
U64 result = 0;
ARCH_RegCode reg_code = arch_info->instruction_pointer_reg_code;
if(reg_code < arch_info->reg_code_count)
{
arch_reg_block_read_range(arch_info, block, arch_info->reg_code_rng_table[reg_code], &result);
}
return result;
}
internal U64
arch_sp_from_reg_block(ARCH_Info *arch_info, void *block)
{
U64 result = 0;
ARCH_RegCode reg_code = arch_info->stack_pointer_reg_code;
if(reg_code < arch_info->reg_code_count)
{
arch_reg_block_read_range(arch_info, block, arch_info->reg_code_rng_table[reg_code], &result);
}
return result;
}
internal B32
arch_reg_block_write_ip(ARCH_Info *arch_info, void *block, U64 ip)
{
B32 result = 0;
ARCH_RegCode reg_code = arch_info->instruction_pointer_reg_code;
if(reg_code < arch_info->reg_code_count)
{
result = arch_reg_block_write_range(arch_info, block, arch_info->reg_code_rng_table[reg_code], &ip);
}
return result;
}
internal B32
arch_reg_block_write_sp(ARCH_Info *arch_info, void *block, U64 sp)
{
B32 result = 0;
ARCH_RegCode reg_code = arch_info->stack_pointer_reg_code;
if(reg_code < arch_info->reg_code_count)
{
result = arch_reg_block_write_range(arch_info, block, arch_info->reg_code_rng_table[reg_code], &sp);
}
return result;
}
#if defined(RDI_H)
internal ARCH_RegCode
arch_reg_code_from_rdi(Arch arch, RDI_RegCode code)
{
ARCH_RegCode result = 0;
{
ARCH_Info *arch_info = arch_info_from_arch(arch);
U8 *rdi_from_reg_code_table = arch_rdi_from_reg_code_table_from_arch(arch);
for EachIndex(c, arch_info->reg_code_count)
{
if(rdi_from_reg_code_table[c] == code)
{
result = c;
break;
}
}
}
return result;
}
#endif
#if defined(DWARF_H)
internal ARCH_RegCode
arch_reg_code_from_dw(Arch arch, DW_RegCode code)
{
ARCH_RegCode result = 0;
{
ARCH_Info *arch_info = arch_info_from_arch(arch);
U8 *dw_from_reg_code_table = arch_dw_from_reg_code_table_from_arch(arch);
for EachIndex(c, arch_info->reg_code_count)
{
if(dw_from_reg_code_table[c] == code)
{
result = c;
break;
}
}
}
return result;
}
#endif
+54
View File
@@ -0,0 +1,54 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARCH_H
#define ARCH_H
////////////////////////////////
//~ rjf: Abstraction Backend Info
typedef U8 ARCH_RegCode;
typedef struct ARCH_Info ARCH_Info;
struct ARCH_Info
{
U16 reg_block_size;
ARCH_RegCode instruction_pointer_reg_code;
ARCH_RegCode stack_pointer_reg_code;
U16 reg_code_count;
String8 trap_instruction;
Rng1U16 *reg_code_rng_table;
String8 *reg_code_name_table;
U8 *reg_code_base_table;
B8 *reg_code_is_vector_table;
};
////////////////////////////////
//~ rjf: Globals
global read_only Rng1U16 arch_reg_code_rng_nil = {0};
global read_only String8 arch_reg_code_name_nil = {0};
global read_only U8 arch_reg_code_u8_nil = 0;
global read_only B8 arch_reg_code_b8_nil = 0;
global read_only ARCH_Info arch_info_nil = {0, 0, 0, 0, {0}, &arch_reg_code_rng_nil, &arch_reg_code_name_nil, &arch_reg_code_u8_nil, &arch_reg_code_b8_nil};
////////////////////////////////
//~ rjf: Abstracted Architecture Functions
internal ARCH_Info *arch_info_from_arch(Arch arch);
internal ARCH_RegCode arch_reg_code_from_name(ARCH_Info *arch_info, String8 name);
internal B32 arch_reg_block_read_range(ARCH_Info *arch_info, void *block, Rng1U16 range, void *dst);
internal B32 arch_reg_block_write_range(ARCH_Info *arch_info, void *block, Rng1U16 range, void *src);
internal U64 arch_ip_from_reg_block(ARCH_Info *arch_info, void *block);
internal U64 arch_sp_from_reg_block(ARCH_Info *arch_info, void *block);
internal B32 arch_reg_block_write_ip(ARCH_Info *arch_info, void *block, U64 ip);
internal B32 arch_reg_block_write_sp(ARCH_Info *arch_info, void *block, U64 sp);
#if defined(RDI_H)
internal ARCH_RegCode arch_reg_code_from_rdi(Arch arch, RDI_RegCode code);
#endif
#if defined(DWARF_H)
internal ARCH_RegCode arch_reg_code_from_dw(Arch arch, DW_RegCode code);
#endif
#endif // REGS_H
+11
View File
@@ -0,0 +1,11 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#include "arch/arch.c"
#include "arch/os/arch_os.c"
#if defined(DWARF_H)
# include "arch/dwarf/arch_dwarf.c"
#endif
#if defined(RDI_H)
# include "arch/rdi/arch_rdi.c"
#endif
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARCH_INC_H
#define ARCH_INC_H
#include "arch/arch.h"
#include "arch/os/arch_os.h"
#if defined(DWARF_H)
# include "arch/dwarf/arch_dwarf.h"
#endif
#if defined(RDI_H)
# include "arch/rdi/arch_rdi.h"
#endif
#endif // ARCH_INC_H
+19
View File
@@ -0,0 +1,19 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal U8 *
arch_dw_from_reg_code_table_from_arch(Arch arch)
{
U8 *result = &arch_reg_code_u8_nil;
switch(arch)
{
default:{}break;
#if defined(X64_H)
case Arch_x64:
{
result = dw_reg_code_from_x64_table;
}break;
#endif
}
return result;
}
+9
View File
@@ -0,0 +1,9 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARCH_DWARF_H
#define ARCH_DWARF_H
internal U8 *arch_dw_from_reg_code_table_from_arch(Arch arch);
#endif // ARCH_DWARF_H
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal B32
arch_os_write_reg_block_from_thread_ctx(Arch arch, OperatingSystem os, void *reg_block, void *thread_ctx)
{
B32 result = 0;
if(0){}
#define Case(arch_, os_, impl) else if((arch) == arch_ && (os) == os_) do {result = impl(reg_block, thread_ctx);}while(0)
#if defined(X64_H) && defined(WIN32_X64_H)
Case(Arch_x64, OperatingSystem_Windows, w32_x64_write_reg_block_from_thread_ctx);
#endif
#undef Case
else{}
return result;
}
+9
View File
@@ -0,0 +1,9 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARCH_OS_H
#define ARCH_OS_H
internal B32 arch_os_write_reg_block_from_thread_ctx(Arch arch, OperatingSystem os, void *reg_block, void *thread_ctx);
#endif // ARCH_OS_H
+19
View File
@@ -0,0 +1,19 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal U8 *
arch_rdi_from_reg_code_table_from_arch(Arch arch)
{
U8 *result = &arch_reg_code_u8_nil;
switch(arch)
{
default:{}break;
#if defined(X64_H)
case Arch_x64:
{
result = rdi_reg_code_from_x64_table;
}break;
#endif
}
return result;
}
+9
View File
@@ -0,0 +1,9 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARCH_RDI_H
#define ARCH_RDI_H
internal U8 *arch_rdi_from_reg_code_table_from_arch(Arch arch);
#endif // ARCH_RDI_H
+735
View File
@@ -0,0 +1,735 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Layer Initialization
internal void
ac_init(void)
{
Arena *arena = arena_alloc();
ac_shared = push_array(arena, AC_Shared, 1);
ac_shared->arena = arena;
ac_shared->cache_slots_count = 256;
ac_shared->cache_slots = push_array(arena, AC_Cache *, ac_shared->cache_slots_count);
ac_shared->cache_stripes = stripe_array_alloc(arena);
for EachElement(idx, ac_shared->req_batches)
{
ac_shared->req_batches[idx].mutex = mutex_alloc();
ac_shared->req_batches[idx].arena = arena_alloc();
}
ac_shared->cancel_thread_semaphore = semaphore_alloc(0, 1, str8_zero());
ac_shared->cancel_thread = thread_launch(ac_cancel_thread_entry_point, 0);
}
////////////////////////////////
//~ rjf: Cache Lookups
internal AC_Artifact
ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U64 endt_us)
{
ProfBeginFunction();
AC_RequestBatch *req_batch = &ac_shared->req_batches[params->flags & AC_Flag_HighPriority ? 0 : 1];
//- rjf: create function -> cache
AC_Cache *cache = 0;
{
U64 cache_hash = u64_hash_from_str8(str8_struct(&params->create));
U64 cache_slot_idx = cache_hash%ac_shared->cache_slots_count;
Stripe *cache_stripe = stripe_from_slot_idx(&ac_shared->cache_stripes, cache_slot_idx);
for(B32 write_mode = 0; write_mode <= 1; write_mode += 1)
{
RWMutexScope(cache_stripe->rw_mutex, write_mode)
{
for(AC_Cache *c = ac_shared->cache_slots[cache_slot_idx]; c != 0; c = c->next)
{
if(c->create == params->create)
{
cache = c;
break;
}
}
if(write_mode && cache == 0)
{
cache = push_array(cache_stripe->arena, AC_Cache, 1);
SLLStackPush(ac_shared->cache_slots[cache_slot_idx], cache);
cache->create = params->create;
cache->destroy = params->destroy;
cache->slots_count = Max(256, params->slots_count);
cache->slots = push_array(cache_stripe->arena, AC_Slot, cache->slots_count);
cache->stripes = stripe_array_alloc(cache_stripe->arena);
cache->stripe_free_node_ptrs = push_array(cache_stripe->arena, AC_NodePtr *, cache->stripes.count);
}
}
if(cache != 0)
{
break;
}
}
}
//- rjf: unpack key
U64 hash = u64_hash_from_str8(key);
U64 slot_idx = hash%cache->slots_count;
AC_Slot *slot = &cache->slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
//- rjf: unpack thread context
B32 is_node_work_active = (ac_tctx != 0);
//- rjf: cache * key -> existing artifact
B32 artifact_is_stale = 1;
B32 got_artifact = 0;
B32 need_request = 0;
AC_Artifact artifact = {0};
RWMutexScope(stripe->rw_mutex, 0)
{
for(AC_Node *n = slot->first; n != 0; n = n->next)
{
if(str8_match(n->key, key, 0))
{
ins_atomic_u64_eval_assign(&n->last_requested_gen, params->gen);
B32 is_stale = (n->last_completed_gen != params->gen);
if(ins_atomic_u64_eval(&n->completion_count) != 0 && (!is_stale || !(params->flags & AC_Flag_WaitForFresh)))
{
got_artifact = 1;
artifact_is_stale = is_stale;
artifact = n->val;
access_touch(access, &n->access_pt, stripe->cv);
ins_atomic_u64_eval_assign(&n->last_touched_ac_request_gen, ins_atomic_u64_eval(&ac_shared->request_gen));
}
if(is_stale)
{
B32 got_task = (ins_atomic_u64_eval_cond_assign(&n->working_count, 1, 0) == 0);
need_request = got_task;
if(is_node_work_active)
{
ins_atomic_u32_eval_assign(&n->other_nodes_depend_on_me, 1);
}
}
break;
}
}
}
//- rjf: didn't get artifact we want? -> fall back to slow path
if(!got_artifact || need_request)
{
RWMutexScope(stripe->rw_mutex, 1) for(;;)
{
B32 out_of_time = (now_time_us() >= endt_us);
// rjf: find node in cache
AC_Node *node = 0;
for(AC_Node *n = slot->first; n != 0; n = n->next)
{
if(str8_match(n->key, key, 0))
{
node = n;
break;
}
}
// rjf: no node? -> create
if(node == 0)
{
need_request = 1;
node = stripe->free;
if(node)
{
stripe->free = node->next;
}
else
{
node = push_array_no_zero(stripe->arena, AC_Node, 1);
}
MemoryZeroStruct(node);
DLLPushBack(slot->first, slot->last, node);
// TODO(rjf): string allocator for keys
node->key = str8_copy(stripe->arena, key);
node->working_count = 1;
node->evict_threshold_us = params->evict_threshold_us;
if(is_node_work_active)
{
node->other_nodes_depend_on_me = 1;
}
}
node->access_pt.last_time_touched_us = now_time_us();
node->access_pt.last_update_idx_touched = update_tick_idx();
// rjf: request
if(need_request)
{
need_request = 0;
MutexScope(req_batch->mutex)
{
AC_RequestNode *n = push_array(req_batch->arena, AC_RequestNode, 1);
if(params->flags & AC_Flag_Wide)
{
SLLQueuePush(req_batch->first_wide, req_batch->last_wide, n);
req_batch->wide_count += 1;
}
else
{
SLLQueuePush(req_batch->first_thin, req_batch->last_thin, n);
req_batch->thin_count += 1;
}
n->v.key = str8_copy(req_batch->arena, key);
n->v.gen = params->gen;
n->v.cancel_signal = &node->cancelled;
n->v.create = params->create;
}
cond_var_broadcast(async_tick_start_cond_var);
ins_atomic_u32_eval_assign(&async_loop_again, 1);
if(params->flags & AC_Flag_HighPriority)
{
ins_atomic_u32_eval_assign(&async_loop_again_high_priority, 1);
}
}
// rjf: get value from node, if possible
if(!got_artifact && ins_atomic_u64_eval(&node->completion_count) != 0 && ((node->last_completed_gen == params->gen) || !(params->flags & AC_Flag_WaitForFresh) || out_of_time))
{
got_artifact = 1;
artifact_is_stale = (node->last_completed_gen != params->gen);
artifact = node->val;
access_touch(access, &node->access_pt, stripe->cv);
ins_atomic_u64_eval_assign(&node->last_touched_ac_request_gen, ins_atomic_u64_eval(&ac_shared->request_gen));
}
// rjf: abort if needed
if(out_of_time || got_artifact || is_async_thread)
{
break;
}
// rjf: wait for results
cond_var_wait_rw(stripe->cv, stripe->rw_mutex, 1, endt_us);
}
}
//- rjf: report staleness
if(params->stale_out)
{
params->stale_out[0] = artifact_is_stale;
}
ProfEnd();
return artifact;
}
////////////////////////////////
//~ rjf: Asynchronous Tick
internal void
ac_async_tick(void)
{
Temp scratch = scratch_begin(0, 0);
//////////////////////////////
//- rjf: enable cancellation scanning
//
if(lane_idx() == 0)
{
semaphore_drop(ac_shared->cancel_thread_semaphore);
}
//////////////////////////////
//- rjf: do eviction pass across all caches
//
for EachIndex(cache_slot_idx, ac_shared->cache_slots_count)
{
Stripe *cache_stripe = stripe_from_slot_idx(&ac_shared->cache_stripes, cache_slot_idx);
RWMutexScope(cache_stripe->rw_mutex, 0)
{
for EachNode(cache, AC_Cache, ac_shared->cache_slots[cache_slot_idx])
{
Rng1U64 slot_range = lane_range(cache->slots_count);
for EachInRange(slot_idx, slot_range)
{
AC_Slot *slot = &cache->slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
for(B32 write_mode = 0; write_mode <= 1; write_mode += 1)
{
B32 slot_has_work = 0;
RWMutexScope(stripe->rw_mutex, write_mode)
{
for(AC_Node *n = slot->first, *next = 0; n != 0; n = next)
{
next = n->next;
if(access_pt_is_expired(&n->access_pt, .time = n->evict_threshold_us) &&
ins_atomic_u64_eval(&n->working_count) == 0 &&
(ins_atomic_u32_eval(&n->other_nodes_depend_on_me) == 0 || ac_shared->request_gen > n->last_touched_ac_request_gen))
{
slot_has_work = 1;
if(!write_mode)
{
break;
}
else
{
DLLRemove(slot->first, slot->last, n);
n->next = (AC_Node *)stripe->free;
stripe->free = n;
if(cache->destroy)
{
cache->destroy(n->val);
}
}
}
}
}
if(!slot_has_work)
{
break;
}
}
}
}
}
}
//////////////////////////////
//- rjf: gather requests
//
typedef struct RequestBatchTask RequestBatchTask;
struct RequestBatchTask
{
AC_Request *wide;
U64 wide_count;
AC_Request *thin;
U64 thin_count;
};
RequestBatchTask *tasks = 0;
U64 tasks_count = 0;
if(lane_idx() == 0)
{
tasks_count = 2;
tasks = push_array(scratch.arena, RequestBatchTask, tasks_count);
for EachElement(task_idx, ac_shared->req_batches)
{
AC_RequestBatch *batch = &ac_shared->req_batches[task_idx];
MutexScope(batch->mutex)
{
tasks[task_idx].wide_count = batch->wide_count;
tasks[task_idx].thin_count = batch->thin_count;
tasks[task_idx].wide = push_array(scratch.arena, AC_Request, tasks[task_idx].wide_count);
tasks[task_idx].thin = push_array(scratch.arena, AC_Request, tasks[task_idx].thin_count);
{
U64 idx = 0;
for EachNode(n, AC_RequestNode, batch->first_wide)
{
MemoryCopyStruct(&tasks[task_idx].wide[idx], &n->v);
tasks[task_idx].wide[idx].key = str8_copy(scratch.arena, tasks[task_idx].wide[idx].key);
idx += 1;
}
}
{
U64 idx = 0;
for EachNode(n, AC_RequestNode, batch->first_thin)
{
MemoryCopyStruct(&tasks[task_idx].thin[idx], &n->v);
tasks[task_idx].thin[idx].key = str8_copy(scratch.arena, tasks[task_idx].thin[idx].key);
idx += 1;
}
}
arena_clear(batch->arena);
batch->first_wide = batch->last_wide = batch->first_thin = batch->last_thin = 0;
batch->wide_count = batch->thin_count = 0;
}
}
}
lane_sync_u64(&tasks, 0);
lane_sync_u64(&tasks_count, 0);
lane_sync();
//////////////////////////////
//- rjf: set up artifact cache thread context
//
ac_tctx = push_array(scratch.arena, AC_TCTX, 1);
//////////////////////////////
//- rjf: do all requests
//
for EachIndex(task_idx, tasks_count)
{
lane_sync();
RequestBatchTask *task = &tasks[task_idx];
//- rjf: set up cancellation signal
U64 cancelled = 0;
U64 *cancelled_ptr = 0;
if(lane_idx() == 0)
{
cancelled_ptr = &cancelled;
}
lane_sync_u64(&cancelled_ptr, 0);
//- rjf: do all wide requests for this priority
U64 done_wide_count = 0;
ProfScope("wide requests (p%I64u)", task_idx)
{
for EachIndex(idx, task->wide_count)
{
lane_sync();
AC_Request *r = &task->wide[idx];
// rjf: any new higher priority tasks? -> cancel
if(lane_idx() == 0)
{
if(task_idx == 1 && idx != 0 && ins_atomic_u32_eval(&async_loop_again_high_priority))
{
ins_atomic_u64_eval_assign(cancelled_ptr, 1);
}
}
lane_sync();
// rjf: cancelled? -> exit
if(ins_atomic_u32_eval(cancelled_ptr))
{
break;
}
// rjf: compute val
AC_Status status = AC_Status_Good;
U64 gen = r->gen;
AC_Artifact val = r->create(r->key, r->cancel_signal, &status, &gen);
// rjf: retry? -> resubmit request
if(status == AC_Status_NeedRetry && lane_idx() == 0 && !ins_atomic_u32_eval(r->cancel_signal))
{
AC_RequestBatch *batch = &ac_shared->req_batches[task_idx];
MutexScope(batch->mutex)
{
AC_RequestNode *n = push_array(batch->arena, AC_RequestNode, 1);
SLLQueuePush(batch->first_wide, batch->last_wide, n);
batch->wide_count += 1;
MemoryCopyStruct(&n->v, r);
n->v.key = str8_copy(batch->arena, n->v.key);
}
ins_atomic_u32_eval_assign(&async_loop_again, 1);
}
// rjf: create function -> cache
AC_Cache *cache = 0;
if(status != AC_Status_NeedRetry && lane_idx() == 0)
{
U64 cache_hash = u64_hash_from_str8(str8_struct(&r->create));
U64 cache_slot_idx = cache_hash%ac_shared->cache_slots_count;
Stripe *cache_stripe = stripe_from_slot_idx(&ac_shared->cache_stripes, cache_slot_idx);
RWMutexScope(cache_stripe->rw_mutex, 0)
{
for(AC_Cache *c = ac_shared->cache_slots[cache_slot_idx]; c != 0; c = c->next)
{
if(c->create == r->create)
{
cache = c;
break;
}
}
}
}
// rjf: write value into cache
if(status != AC_Status_NeedRetry && lane_idx() == 0)
{
U64 hash = u64_hash_from_str8(r->key);
U64 slot_idx = hash%cache->slots_count;
AC_Slot *slot = &cache->slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
RWMutexScope(stripe->rw_mutex, 1)
{
for(AC_Node *n = slot->first; n != 0; n = n->next)
{
if(str8_match(n->key, r->key, 0))
{
B32 got_new_value = (status == AC_Status_Good);
// rjf: eliminate existing values, if any, if they do not match the current
if(got_new_value && cache->destroy != 0 && !MemoryMatchStruct(&n->val, &val) && ins_atomic_u64_eval(&n->completion_count) > 0) for(;;)
{
if(access_pt_is_expired(&n->access_pt, .time = 0, .update_idxs = 0))
{
cache->destroy(n->val);
MemoryZeroStruct(&n->val);
break;
}
cond_var_wait_rw(stripe->cv, stripe->rw_mutex, 1, max_U64);
}
// rjf: write new value
if(got_new_value)
{
n->val = val;
}
n->last_completed_gen = gen;
ins_atomic_u64_dec_eval(&n->working_count);
ins_atomic_u64_inc_eval(&n->completion_count);
}
}
}
cond_var_broadcast(stripe->cv);
}
// rjf: increment count
lane_sync();
done_wide_count += 1;
}
}
lane_sync();
//- rjf: do all thin requests for this priority
U64 done_thin_count = 0;
ProfScope("thin requests (p%I64u)", task_idx)
{
U64 req_take_counter = 0;
U64 *req_take_counter_ptr = 0;
if(lane_idx() == 0)
{
req_take_counter_ptr = &req_take_counter;
}
lane_sync_u64(&req_take_counter_ptr, 0);
for(;;)
{
// rjf: any new higher priority tasks? -> cancel
if(task_idx == 1 && ins_atomic_u64_eval(req_take_counter_ptr) >= task->thin_count/2 &&
ins_atomic_u32_eval(&async_loop_again_high_priority))
{
ins_atomic_u64_eval_assign(cancelled_ptr, 1);
}
// rjf: cancelled? -> exit
if(ins_atomic_u64_eval(cancelled_ptr))
{
break;
}
// rjf: take next task
U64 req_idx = ins_atomic_u64_inc_eval(req_take_counter_ptr) - 1;
if(req_idx >= task->thin_count) { break; }
AC_Request *r = &task->thin[req_idx];
// rjf: push thin lane ctx
U64 thin_lane_ctx_broadcast_memory = 0;
LaneCtx thin_lane_ctx = {0, 1, {0}, &thin_lane_ctx_broadcast_memory};
LaneCtx lane_ctx_restore = lane_ctx(thin_lane_ctx);
// rjf: compute val
AC_Status status = AC_Status_Good;
U64 gen = r->gen;
AC_Artifact val = r->create(r->key, r->cancel_signal, &status, &gen);
// rjf: restore wide lane ctx
lane_ctx(lane_ctx_restore);
// rjf: retry? -> resubmit request
if(status == AC_Status_NeedRetry && !ins_atomic_u32_eval(r->cancel_signal))
{
AC_RequestBatch *batch = &ac_shared->req_batches[task_idx];
MutexScope(batch->mutex)
{
AC_RequestNode *n = push_array(batch->arena, AC_RequestNode, 1);
SLLQueuePush(batch->first_thin, batch->last_thin, n);
batch->thin_count += 1;
MemoryCopyStruct(&n->v, r);
n->v.key = str8_copy(batch->arena, n->v.key);
}
ins_atomic_u32_eval_assign(&async_loop_again, 1);
}
// rjf: create function -> cache
AC_Cache *cache = 0;
if(status != AC_Status_NeedRetry)
{
U64 cache_hash = u64_hash_from_str8(str8_struct(&r->create));
U64 cache_slot_idx = cache_hash%ac_shared->cache_slots_count;
Stripe *cache_stripe = stripe_from_slot_idx(&ac_shared->cache_stripes, cache_slot_idx);
RWMutexScope(cache_stripe->rw_mutex, 0)
{
for(AC_Cache *c = ac_shared->cache_slots[cache_slot_idx]; c != 0; c = c->next)
{
if(c->create == r->create)
{
cache = c;
break;
}
}
}
}
// rjf: write value into cache
if(status != AC_Status_NeedRetry)
{
U64 hash = u64_hash_from_str8(r->key);
U64 slot_idx = hash%cache->slots_count;
AC_Slot *slot = &cache->slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
RWMutexScope(stripe->rw_mutex, 1)
{
for(AC_Node *n = slot->first; n != 0; n = n->next)
{
if(str8_match(n->key, r->key, 0))
{
B32 got_new_value = (status == AC_Status_Good);
// rjf: eliminate existing values, if any, if they do not match the current
if(got_new_value && cache->destroy != 0 && !MemoryMatchStruct(&n->val, &val) && ins_atomic_u64_eval(&n->completion_count) > 0) for(;;)
{
if(access_pt_is_expired(&n->access_pt, .time = 0, .update_idxs = 0))
{
cache->destroy(n->val);
MemoryZeroStruct(&n->val);
break;
}
cond_var_wait_rw(stripe->cv, stripe->rw_mutex, 1, max_U64);
}
// rjf: store
if(got_new_value)
{
n->val = val;
}
n->last_completed_gen = gen;
ins_atomic_u64_dec_eval(&n->working_count);
ins_atomic_u64_inc_eval(&n->completion_count);
}
}
}
cond_var_broadcast(stripe->cv);
}
}
lane_sync();
done_thin_count = ins_atomic_u64_eval(req_take_counter_ptr);
lane_sync();
}
//- rjf: cancelled early, unfinished tasks? -> defer to next tick
if(lane_idx() == 0 && task_idx > 0)
{
B32 need_another_try = (done_wide_count < task->wide_count || done_thin_count < task->thin_count);
AC_RequestBatch *batch = &ac_shared->req_batches[task_idx];
MutexScope(batch->mutex)
{
// rjf: push leftover wide tasks
for(U64 idx = done_wide_count; idx < task->wide_count; idx += 1)
{
AC_Request *r = &task->wide[idx];
AC_RequestNode *n = push_array(batch->arena, AC_RequestNode, 1);
SLLQueuePush(batch->first_wide, batch->last_wide, n);
batch->wide_count += 1;
MemoryCopyStruct(&n->v, r);
n->v.key = str8_copy(batch->arena, n->v.key);
}
// rjf: push leftover thin tasks
for(U64 idx = done_thin_count; idx < task->thin_count; idx += 1)
{
AC_Request *r = &task->thin[idx];
AC_RequestNode *n = push_array(batch->arena, AC_RequestNode, 1);
SLLQueuePush(batch->first_thin, batch->last_thin, n);
batch->thin_count += 1;
MemoryCopyStruct(&n->v, r);
n->v.key = str8_copy(batch->arena, n->v.key);
}
}
if(need_another_try)
{
ins_atomic_u32_eval_assign(&async_loop_again, 1);
}
}
lane_sync();
}
lane_sync();
//////////////////////////////
//- rjf: increment the request gen, only if all requests are empty
//
if(lane_idx() == 0)
{
B32 have_live_requests = 0;
for EachElement(idx, ac_shared->req_batches)
{
MutexScope(ac_shared->req_batches[idx].mutex)
{
have_live_requests = (ac_shared->req_batches[idx].wide_count != 0 || ac_shared->req_batches[idx].thin_count != 0);
}
}
if(!have_live_requests)
{
ac_shared->request_gen += 1;
}
}
//////////////////////////////
//- rjf: reset thread context
//
ac_tctx = 0;
//////////////////////////////
//- rjf: disable cancellation scanning
//
if(lane_idx() == 0)
{
semaphore_take(ac_shared->cancel_thread_semaphore, max_U64);
}
scratch_end(scratch);
}
////////////////////////////////
//~ rjf: Cancel Thread
internal void
ac_cancel_thread_entry_point(void *p)
{
for(;;)
{
sleep_ms(50);
semaphore_take(ac_shared->cancel_thread_semaphore, max_U64);
{
for EachIndex(cache_slot_idx, ac_shared->cache_slots_count)
{
Stripe *cache_stripe = stripe_from_slot_idx(&ac_shared->cache_stripes, cache_slot_idx);
RWMutexScope(cache_stripe->rw_mutex, 0)
{
for EachNode(cache, AC_Cache, ac_shared->cache_slots[cache_slot_idx])
{
Rng1U64 slot_range = lane_range(cache->slots_count);
for EachInRange(slot_idx, slot_range)
{
AC_Slot *slot = &cache->slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
for(B32 write_mode = 0; write_mode <= 1; write_mode += 1)
{
B32 slot_has_work = 0;
RWMutexScope(stripe->rw_mutex, write_mode)
{
for(AC_Node *n = slot->first, *next = 0; n != 0; n = next)
{
next = n->next;
if(access_pt_is_expired(&n->access_pt, .time = n->evict_threshold_us) && ins_atomic_u64_eval(&n->working_count) > 0)
{
slot_has_work = 1;
if(!write_mode)
{
break;
}
else
{
n->cancelled = 1;
}
}
}
}
if(!slot_has_work)
{
break;
}
}
}
}
}
}
}
semaphore_drop(ac_shared->cancel_thread_semaphore);
}
}
+192
View File
@@ -0,0 +1,192 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef ARTIFACT_CACHE_H
#define ARTIFACT_CACHE_H
////////////////////////////////
//~ rjf: Artifact Computation Statuses
typedef enum AC_Status
{
AC_Status_Good,
AC_Status_NeedRetry,
AC_Status_Failed,
}
AC_Status;
////////////////////////////////
//~ rjf: Artifact Handle Type
typedef struct AC_Artifact AC_Artifact;
struct AC_Artifact
{
U64 u64[4];
};
////////////////////////////////
//~ rjf: Artifact Computation Function Types
typedef AC_Artifact AC_CreateFunctionType(String8 key, B32 *cancel_signal, AC_Status *status_out, U64 *gen_out);
typedef void AC_DestroyFunctionType(AC_Artifact artifact);
typedef U32 AC_Flags;
typedef enum AC_FlagsEnum
{
AC_Flag_WaitForFresh = (1<<0),
AC_Flag_HighPriority = (1<<1),
AC_Flag_Wide = (1<<2),
}
AC_FlagsEnum;
typedef struct AC_ArtifactParams AC_ArtifactParams;
struct AC_ArtifactParams
{
AC_CreateFunctionType *create;
AC_DestroyFunctionType *destroy;
U64 slots_count;
U64 gen;
U64 evict_threshold_us;
B32 *stale_out;
AC_Flags flags;
};
////////////////////////////////
//~ rjf: Cache Types
typedef struct AC_Request AC_Request;
struct AC_Request
{
String8 key;
U64 gen;
B32 *cancel_signal;
AC_CreateFunctionType *create;
};
typedef struct AC_RequestNode AC_RequestNode;
struct AC_RequestNode
{
AC_RequestNode *next;
AC_Request v;
};
typedef struct AC_NodePtr AC_NodePtr;
struct AC_NodePtr
{
AC_NodePtr *next;
struct AC_Node *node;
};
typedef struct AC_Node AC_Node;
struct AC_Node
{
AC_Node *next;
AC_Node *prev;
// rjf: key/gen/value
String8 key;
U64 last_requested_gen;
U64 last_completed_gen;
AC_Artifact val;
// rjf: metadata
AccessPt access_pt;
U64 working_count;
U64 completion_count;
U64 evict_threshold_us;
U64 last_touched_ac_request_gen;
B32 cancelled;
B32 other_nodes_depend_on_me;
};
typedef struct AC_Slot AC_Slot;
struct AC_Slot
{
AC_Node *first;
AC_Node *last;
};
typedef struct AC_Cache AC_Cache;
struct AC_Cache
{
// rjf: link / key for cache-cache
AC_Cache *next;
AC_CreateFunctionType *create;
AC_DestroyFunctionType *destroy;
// rjf: artifact cache
U64 slots_count;
AC_Slot *slots;
StripeArray stripes;
AC_NodePtr **stripe_free_node_ptrs;
};
typedef struct AC_RequestBatch AC_RequestBatch;
struct AC_RequestBatch
{
Mutex mutex;
Arena *arena;
AC_RequestNode *first_wide;
AC_RequestNode *last_wide;
AC_RequestNode *first_thin;
AC_RequestNode *last_thin;
U64 wide_count;
U64 thin_count;
};
typedef struct AC_TCTX AC_TCTX;
struct AC_TCTX
{
U64 _unused_;
};
typedef struct AC_Shared AC_Shared;
struct AC_Shared
{
Arena *arena;
U64 request_gen;
// rjf: cache cache
U64 cache_slots_count;
AC_Cache **cache_slots;
StripeArray cache_stripes;
// rjf: requests
AC_RequestBatch req_batches[2]; // 0: high priority, 1: low priority
// rjf: cancel thread
Thread cancel_thread;
Semaphore cancel_thread_semaphore;
};
////////////////////////////////
//~ rjf: Globals
global AC_Shared *ac_shared = 0;
thread_static AC_TCTX *ac_tctx = 0;
////////////////////////////////
//~ rjf: Layer Initialization
internal void ac_init(void);
////////////////////////////////
//~ rjf: Cache Lookups
internal AC_Artifact ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U64 endt_us);
#define ac_artifact_from_key(access, key, create_fn, destroy_fn, endt_us, ...) ac_artifact_from_key_((access), (key), &(AC_ArtifactParams){.create = (create_fn), .destroy = (destroy_fn), .evict_threshold_us = (2000000), __VA_ARGS__}, (endt_us))
////////////////////////////////
//~ rjf: Asynchronous Tick
#if !defined(NEED_ASYNC)
# define NEED_ASYNC 1
#endif
internal void ac_async_tick(void);
////////////////////////////////
//~ rjf: Cancel Thread
internal void ac_cancel_thread_entry_point(void *p);
#endif // ARTIFACT_CACHE_H
+390 -316
View File
@@ -1,316 +1,390 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
// Implementation
internal Arena *
arena_alloc__sized(U64 init_res, U64 init_cmt)
{
ProfBeginFunction();
Assert(ARENA_HEADER_SIZE < init_cmt && init_cmt <= init_res);
void *memory;
U64 res;
U64 cmt;
B32 large_pages = os_large_pages_enabled();
if (large_pages) {
U64 page_size = os_large_page_size();
res = AlignPow2(init_res, page_size);
#if OS_WINDOWS
cmt = res;
#else
cmt = AlignPow2(init_cmt, page_size);
#endif
memory = os_reserve_large(res);
if (!os_commit_large(memory, cmt)) {
memory = 0;
os_release(memory, res);
}
} else {
U64 page_size = os_page_size();
res = AlignPow2(init_res, page_size);
cmt = AlignPow2(init_cmt, page_size);
memory = os_reserve(res);
if (!os_commit(memory, cmt)) {
memory = 0;
os_release(memory, res);
}
}
Assert(memory);
AsanPoisonMemoryRegion(memory, cmt);
AsanUnpoisonMemoryRegion(memory, ARENA_HEADER_SIZE);
Arena *arena = (Arena*)memory;
if (arena) {
arena->prev = 0;
arena->current = arena;
arena->base_pos = 0;
arena->pos = ARENA_HEADER_SIZE;
arena->cmt = cmt;
arena->res = res;
arena->align = 8;
#if ENABLE_DEV
arena->dev = 0;
#endif
arena->grow = 1;
arena->large_pages = large_pages;
}
ProfEnd();
return arena;
}
internal Arena *
arena_alloc(void)
{
ProfBeginFunction();
U64 init_res, init_cmt;
if (os_large_pages_enabled()) {
init_res = ARENA_RESERVE_SIZE_LARGE_PAGES;
init_cmt = ARENA_COMMIT_SIZE_LARGE_PAGES;
} else {
init_res = ARENA_RESERVE_SIZE;
init_cmt = ARENA_COMMIT_SIZE;
}
Arena *arena = arena_alloc__sized(init_res, init_cmt);
ProfEnd();
return arena;
}
internal void
arena_release(Arena *arena)
{
for (Arena *node = arena->current, *prev = 0; node != 0; node = prev) {
prev = node->prev;
os_release(node, node->res);
}
}
internal U64
arena_huge_push_threshold(void)
{
U64 reserve_size = os_large_pages_enabled() ? ARENA_RESERVE_SIZE_LARGE_PAGES : ARENA_RESERVE_SIZE;
U64 threshold = (reserve_size - ARENA_HEADER_SIZE) / 2 + 1;
return threshold;
}
internal void *
arena_push__impl(Arena *arena, U64 size)
{
Arena *current = arena->current;
U64 pos_mem = AlignPow2(current->pos, arena->align);
U64 pos_new = pos_mem + size;
if (current->res < pos_new && arena->grow) {
Arena *new_block;
// normal growth path
if (size < arena_huge_push_threshold()) {
new_block = arena_alloc();
}
// huge growth path
else {
U64 new_block_size = size + ARENA_HEADER_SIZE;
new_block = arena_alloc__sized(new_block_size, new_block_size);
}
if (new_block) {
new_block->base_pos = current->base_pos + current->res;
SLLStackPush_N(arena->current, new_block, prev);
current = new_block;
pos_mem = AlignPow2(current->pos, current->align);
pos_new = pos_mem + size;
}
}
if (current->cmt < pos_new) {
U64 cmt_new_aligned, cmt_new_clamped, cmt_new_size;
B32 is_cmt_ok;
if (current->large_pages) {
cmt_new_aligned = AlignPow2(pos_new, ARENA_COMMIT_SIZE_LARGE_PAGES);
cmt_new_clamped = ClampTop(cmt_new_aligned, current->res);
cmt_new_size = cmt_new_clamped - current->cmt;
is_cmt_ok = os_commit_large((U8*)current + current->cmt, cmt_new_size);
} else {
cmt_new_aligned = AlignPow2(pos_new, ARENA_COMMIT_SIZE);
cmt_new_clamped = ClampTop(cmt_new_aligned, current->res);
cmt_new_size = cmt_new_clamped - current->cmt;
is_cmt_ok = os_commit((U8*)current + current->cmt, cmt_new_size);
}
Assert(is_cmt_ok);
if (is_cmt_ok) {
current->cmt = cmt_new_clamped;
}
}
void *memory = 0;
if (current->cmt >= pos_new) {
memory = (U8*)current + pos_mem;
current->pos = pos_new;
AsanUnpoisonMemoryRegion(memory, size);
}
#if OS_FEATURE_GRAPHICAL
if(Unlikely(memory == 0))
{
os_graphical_message(1, str8_lit("Fatal Allocation Failure"), str8_lit("Unexpected memory allocation failure."));
os_exit_process(1);
}
#endif
return memory;
}
internal U64
arena_pos(Arena *arena)
{
Arena *current = arena->current;
U64 pos = current->base_pos + current->pos;
return pos;
}
internal void
arena_pop_to(Arena *arena, U64 big_pos_unclamped)
{
U64 big_pos = ClampBot(ARENA_HEADER_SIZE, big_pos_unclamped);
// unroll the chain
Arena *current = arena->current;
for (Arena *prev = 0; current->base_pos >= big_pos; current = prev) {
prev = current->prev;
os_release(current, current->res);
}
AssertAlways(current);
arena->current = current;
// compute arena-relative position
U64 new_pos = big_pos - current->base_pos;
AssertAlways(new_pos <= current->pos);
// poison popped memory block
AsanPoisonMemoryRegion((U8*)current + new_pos, (current->pos - new_pos));
// update position
current->pos = new_pos;
}
internal void
arena_absorb(Arena *arena, Arena *sub)
{
#if ENABLE_DEV
arena_annotate_absorb__dev(arena, sub);
#endif
// base adjustment
Arena *current = arena->current;
U64 base_adjust = current->base_pos + current->res;
for (Arena *node = sub->current; node != 0; node = node->prev) {
node->base_pos += base_adjust;
}
// attach sub to arena
sub->prev = arena->current;
arena->current = sub->current;
sub->current = sub;
}
////////////////////////////////
// Wrappers
internal void *
arena_push(Arena *arena, U64 size)
{
void *memory = arena_push__impl(arena, size);
#if ENABLE_DEV
arena_annotate_push__dev(arena, size, memory);
#endif
return memory;
}
internal void *
arena_push_contiguous(Arena *arena, U64 size)
{
B32 restore = arena->grow;
arena->grow = 0;
void *memory = arena_push(arena, size);
arena->grow = restore;
#if ENABLE_DEV
arena_annotate_push__dev(arena, size, memory);
#endif
return memory;
}
internal void
arena_push_align(Arena *arena, U64 align)
{
Assert(IsPow2(align));
U64 amt = AlignPadPow2(arena->pos, align);
void *ptr = arena_push(arena, amt);
MemoryZero(ptr, amt);
}
internal void
arena_put_back(Arena *arena, U64 amt)
{
U64 pos_old = arena_pos(arena);
U64 pos_new = pos_old;
if (amt < pos_old) {
pos_new = pos_old - amt;
}
arena_pop_to(arena, pos_new);
}
internal void
arena_clear(Arena *arena)
{
arena_pop_to(arena, 0);
}
internal Temp
temp_begin(Arena *arena)
{
U64 pos = arena_pos(arena);
Temp temp = {arena, pos};
return temp;
}
internal void
temp_end(Temp temp)
{
arena_pop_to(temp.arena, temp.pos);
}
////////////////////////////////
//~ NOTE(allen): "Mini-Arena" Helper
internal B32
ensure_commit(void **cmtptr, void *pos, U64 cmt_block_size){
B32 result = 0;
U8 *cmt = (U8*)*cmtptr;
if (cmt < (U8*)pos){
U64 cmt_size_raw = (U8*)pos - cmt;
U64 cmt_size = AlignPow2(cmt_size_raw, cmt_block_size);
if (os_commit(cmt, cmt_size)){
*cmtptr = cmt + cmt_size;
result = 1;
}
}
else{
result = 1;
}
return(result);
}
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Global Arena Table
#if ARENA_TABLE_DEBUG
typedef struct ArenaTableNode ArenaTableNode;
struct ArenaTableNode
{
ArenaTableNode *next;
Arena *arena;
};
global U64 arena_table_take_init = 0;
global U64 arena_table_inited = 0;
global U64 arena_table_lock = 0;
global ArenaTableNode *arena_table = 0;
global U64 arena_table_count = 0;
global U64 arena_table_cap = 0;
global ArenaTableNode *free_arena_table_node = 0;
#endif
////////////////////////////////
//~ rjf: Arena Functions
//- rjf: arena creation/destruction
internal Arena *
arena_alloc_(ArenaParams *params)
{
ProfBeginFunction();
U64 reserve_size = params->reserve_size;
U64 commit_size = params->commit_size;
// rjf: reserve/commit initial block
void *base = params->optional_backing_buffer;
if(base == 0)
{
// rjf: round up reserve/commit sizes
if(params->flags & ArenaFlag_LargePages)
{
reserve_size = AlignPow2(reserve_size, get_system_info()->large_page_size);
commit_size = AlignPow2(commit_size, get_system_info()->large_page_size);
}
else
{
reserve_size = AlignPow2(reserve_size, get_system_info()->page_size);
commit_size = AlignPow2(commit_size, get_system_info()->page_size);
}
if(params->flags & ArenaFlag_LargePages)
{
base = reserve_memory_large(reserve_size);
commit_memory_large(base, commit_size);
}
else
{
base = reserve_memory(reserve_size);
commit_memory(base, commit_size);
}
AsanPoisonMemoryRegion(base, commit_size);
// TODO(rjf): we need to reintroduce this later when we have the ability to remove annotations...
// raddbg_annotate_vaddr_range(base, reserve_size, "arena %s:%i", params->allocation_site_file, params->allocation_site_line);
}
else
{
AsanPoisonMemoryRegion(base, params->reserve_size);
}
// rjf: panic on arena creation failure
#if OS_FEATURE_GRAPHICAL
if(Unlikely(base == 0))
{
wm_graphical_message(1, str8_lit("Fatal Allocation Failure"), str8_lit("Unexpected memory allocation failure."));
abort_self(1);
}
#endif
// rjf: extract arena header & fill
AsanUnpoisonMemoryRegion(base, ARENA_HEADER_SIZE);
Arena *arena = base;
arena->current = arena;
arena->flags = params->flags;
arena->cmt_size = params->commit_size;
arena->res_size = params->reserve_size;
arena->base_pos = 0;
arena->pos = ARENA_HEADER_SIZE;
arena->cmt = commit_size;
arena->res = reserve_size;
arena->allocation_site_file = params->allocation_site_file;
arena->allocation_site_line = params->allocation_site_line;
arena->name = params->name;
#if ARENA_FREE_LIST
arena->free_last = 0;
#endif
// rjf: store in global arena table
#if ARENA_TABLE_DEBUG
if(ins_atomic_u64_eval_cond_assign(&arena_table_take_init, 1, 0) == 0)
{
arena_table = reserve_memory(GB(256));
arena_table_cap = 4096;
commit_memory(arena_table, arena_table_cap * sizeof(arena_table[0]));
ins_atomic_u64_inc_eval(&arena_table_inited);
}
for(;!ins_atomic_u64_eval(&arena_table_inited);) {}
for(;;)
{
B32 got_lock = (ins_atomic_u64_eval_cond_assign(&arena_table_lock, 1, 0) == 0);
if(got_lock)
{
ArenaTableNode *node = free_arena_table_node;
if(node != 0)
{
SLLStackPop(free_arena_table_node);
}
else
{
node = &arena_table[arena_table_count];
if(arena_table_count >= arena_table_cap)
{
U64 arena_table_cap__pre_grow = arena_table_cap;
arena_table_cap *= 2;
U64 arena_table_cap__post_grow = arena_table_cap;
commit_memory(arena_table + arena_table_cap__pre_grow, sizeof(arena_table[0]) * (arena_table_cap__post_grow - arena_table_cap__pre_grow));
}
arena_table_count += 1;
}
node->arena = arena;
arena->table_node = node;
ins_atomic_u64_eval_assign(&arena_table_lock, 0);
break;
}
}
#endif
ProfEnd();
return arena;
}
internal void
arena_release(Arena *arena)
{
ProfBeginFunction();
#if PROFILE_TELEMETRY
{
Arena *base_arena = arena;
while (base_arena->prev) base_arena = base_arena->prev;
tmPlot(0, TM_PLOT_UNITS_MEMORY, TM_PLOT_DRAW_LINE, 0, "%s/%p", base_arena->name, base_arena);
}
#endif
#if ARENA_TABLE_DEBUG
for(Arena *n = arena->current; n != 0; n = n->prev)
{
for(;;)
{
B32 got_lock = (ins_atomic_u64_eval_cond_assign(&arena_table_lock, 1, 0) == 0);
if(got_lock)
{
ArenaTableNode *table_node = n->table_node;
MemoryZeroStruct(table_node);
SLLStackPush(free_arena_table_node, table_node);
ins_atomic_u64_eval_assign(&arena_table_lock, 0);
break;
}
}
}
#endif
for(Arena *n = arena->current, *prev = 0; n != 0; n = prev)
{
prev = n->prev;
AsanUnpoisonMemoryRegion(n, n->cmt);
release_memory(n, n->res);
}
ProfEnd();
}
//- rjf: arena push/pop core functions
internal void *
arena_push(Arena *arena, U64 size, U64 align, B32 zero)
{
Arena *current = arena->current;
U64 pos_pre = AlignPow2(current->pos, align);
U64 pos_pst = pos_pre + size;
// TODO: Newly allocated arenas already have zeroed commited pages,
// so this unnecessarily zeroes them again.
//
// rjf: compute the size we need to zero
U64 size_to_zero = 0;
if(zero)
{
size_to_zero = Min(current->cmt, pos_pst) - pos_pre;
}
// rjf: chain, if needed
if(current->res < pos_pst && !(arena->flags & ArenaFlag_NoChain))
{
Arena *new_block = 0;
#if ARENA_FREE_LIST
{
Arena *prev_block;
for(new_block = arena->free_last, prev_block = 0; new_block != 0; prev_block = new_block, new_block = new_block->prev)
{
if(new_block->res >= AlignPow2(new_block->pos, align) + size)
{
if(prev_block)
{
prev_block->prev = new_block->prev;
}
else
{
arena->free_last = new_block->prev;
}
break;
}
}
}
#endif
if(new_block == 0)
{
U64 res_size = current->res_size;
U64 cmt_size = current->cmt_size;
if(size + ARENA_HEADER_SIZE > res_size)
{
res_size = AlignPow2(size + ARENA_HEADER_SIZE, align);
cmt_size = AlignPow2(size + ARENA_HEADER_SIZE, align);
}
new_block = arena_alloc(.reserve_size = res_size,
.commit_size = cmt_size,
.flags = current->flags,
.allocation_site_file = current->allocation_site_file,
.allocation_site_line = current->allocation_site_line);
size_to_zero = 0;
}
else
{
size_to_zero = size;
}
new_block->base_pos = current->base_pos + current->res;
SLLStackPush_N(arena->current, new_block, prev);
current = new_block;
pos_pre = AlignPow2(current->pos, align);
pos_pst = pos_pre + size;
}
// rjf: commit new pages, if needed
if(current->cmt < pos_pst)
{
U64 cmt_pst_aligned = pos_pst + current->cmt_size-1;
cmt_pst_aligned -= cmt_pst_aligned%current->cmt_size;
U64 cmt_pst_clamped = ClampTop(cmt_pst_aligned, current->res);
U64 cmt_size = cmt_pst_clamped - current->cmt;
U8 *cmt_ptr = (U8 *)current + current->cmt;
if(current->flags & ArenaFlag_LargePages)
{
commit_memory_large(cmt_ptr, cmt_size);
}
else
{
commit_memory(cmt_ptr, cmt_size);
}
AsanPoisonMemoryRegion(cmt_ptr, cmt_size);
current->cmt = cmt_pst_clamped;
}
// rjf: push onto current block
void *result = 0;
if(current->cmt >= pos_pst)
{
result = (U8 *)current+pos_pre;
current->pos = pos_pst;
AsanUnpoisonMemoryRegion(result, size);
MemoryZero(result, size_to_zero);
}
#if PROFILE_TELEMETRY
if(size > KB(1))
{
Arena *base_arena = arena;
while (base_arena->prev) base_arena = base_arena->prev;
tmPlot(0, TM_PLOT_UNITS_MEMORY, TM_PLOT_DRAW_LINE, (double)(current->base_pos + current->pos) / 1024.0 / 1024.0, "%s/%p", base_arena->name, base_arena);
}
#endif
// rjf: panic on failure
#if OS_FEATURE_GRAPHICAL
if(Unlikely(result == 0))
{
wm_graphical_message(1, str8_lit("Fatal Allocation Failure"), str8_lit("Unexpected memory allocation failure."));
abort_self(1);
}
#endif
return result;
}
internal U64
arena_pos(Arena *arena)
{
Arena *current = arena->current;
U64 pos = current->base_pos + current->pos;
return pos;
}
internal void
arena_pop_to(Arena *arena, U64 pos)
{
U64 big_pos = ClampBot(ARENA_HEADER_SIZE, pos);
Arena *current = arena->current;
#if ARENA_FREE_LIST
for(Arena *prev = 0; current->base_pos >= big_pos; current = prev)
{
prev = current->prev;
current->pos = ARENA_HEADER_SIZE;
SLLStackPush_N(arena->free_last, current, prev);
AsanPoisonMemoryRegion((U8*)current + ARENA_HEADER_SIZE, current->res - ARENA_HEADER_SIZE);
}
#else
for(Arena *prev = 0; current->base_pos >= big_pos; current = prev)
{
prev = current->prev;
AsanUnpoisonMemoryRegion(current, current->cmt);
release_memory(current, current->res);
}
#endif
arena->current = current;
U64 new_pos = big_pos - current->base_pos;
AssertAlways(new_pos <= current->pos);
AsanPoisonMemoryRegion((U8*)current + new_pos, (current->pos - new_pos));
current->pos = new_pos;
#if PROFILE_TELEMETRY
if((pos - (new_pos + current->base_pos)) > KB(1))
{
Arena *base_arena = arena;
while (base_arena->prev) base_arena = base_arena->prev;
tmPlot(0, TM_PLOT_UNITS_MEMORY, TM_PLOT_DRAW_LINE, (double)(current->base_pos + current->pos) / 1024.0 / 1024.0, "%s/%p", base_arena->name, base_arena);
}
#endif
}
//- rjf: arena push/pop helpers
internal void
arena_clear(Arena *arena)
{
arena_pop_to(arena, 0);
}
internal void
arena_pop(Arena *arena, U64 amt)
{
U64 pos_old = arena_pos(arena);
U64 pos_new = pos_old;
if(amt < pos_old)
{
pos_new = pos_old - amt;
}
arena_pop_to(arena, pos_new);
}
//- rjf: temporary arena scopes
internal Temp
temp_begin(Arena *arena)
{
U64 pos = arena_pos(arena);
Temp temp = {arena, pos};
return temp;
}
internal void
temp_end(Temp temp)
{
arena_pop_to(temp.arena, temp.pos);
}
+93 -94
View File
@@ -1,94 +1,93 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_ARENA_H
#define BASE_ARENA_H
////////////////////////////////
//~ rjf: Constants
#define ARENA_HEADER_SIZE 128
#ifndef ARENA_RESERVE_SIZE
# define ARENA_RESERVE_SIZE MB(64)
#endif
#ifndef ARENA_COMMIT_SIZE
# define ARENA_COMMIT_SIZE KB(64)
#endif
#ifndef ARENA_RESERVE_SIZE_LARGE_PAGES
# define ARENA_RESERVE_SIZE_LARGE_PAGES MB(8)
#endif
#ifndef ARENA_COMMIT_SIZE_LARGE_PAGES
# define ARENA_COMMIT_SIZE_LARGE_PAGES MB(2)
#endif
////////////////////////////////
//~ rjf: Arena Types
typedef struct Arena Arena;
struct Arena
{
struct Arena *prev;
struct Arena *current;
U64 base_pos;
U64 pos;
U64 cmt;
U64 res;
U64 align;
struct ArenaDev *dev;
B8 grow;
B8 large_pages;
};
typedef struct Temp Temp;
struct Temp
{
Arena *arena;
U64 pos;
};
////////////////////////////////
// Implementation
internal Arena* arena_alloc__sized(U64 init_res, U64 init_cmt);
internal Arena* arena_alloc(void);
internal void arena_release(Arena *arena);
internal void* arena_push__impl(Arena *arena, U64 size);
internal U64 arena_pos(Arena *arena);
internal void arena_pop_to(Arena *arena, U64 pos);
internal void arena_absorb(Arena *arena, Arena *sub);
////////////////////////////////
// Wrappers
internal void* arena_push(Arena *arena, U64 size);
internal void* arena_push_contiguous(Arena *arena, U64 size);
internal void arena_clear(Arena *arena);
internal void arena_push_align(Arena *arena, U64 align);
internal void arena_put_back(Arena *arena, U64 amt);
internal Temp temp_begin(Arena *arena);
internal void temp_end(Temp temp);
////////////////////////////////
//~ NOTE(allen): "Mini-Arena" Helper
internal B32 ensure_commit(void **cmt, void *pos, U64 cmt_block_size);
////////////////////////////////
//~ NOTE(allen): Main API Macros
#if !ENABLE_DEV
# define push_array_no_zero(a,T,c) (T*)arena_push((a), sizeof(T)*(c))
#else
# define push_array_no_zero(a,T,c) (tctx_write_this_srcloc(), (T*)arena_push((a), sizeof(T)*(c)))
#endif
#define push_array_no_zero__no_annotation(a,T,c) (T*)arena_push__impl((a), sizeof(T)*(c))
#define push_array(a,T,c) (T*)MemoryZero(push_array_no_zero(a,T,c), sizeof(T)*(c))
#endif // BASE_ARENA_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_ARENA_H
#define BASE_ARENA_H
////////////////////////////////
//~ rjf: Arena Types
#define ARENA_HEADER_SIZE 128
typedef U64 ArenaFlags;
enum
{
ArenaFlag_NoChain = (1<<0),
ArenaFlag_LargePages = (1<<1),
};
typedef struct ArenaParams ArenaParams;
struct ArenaParams
{
ArenaFlags flags;
U64 reserve_size;
U64 commit_size;
void *optional_backing_buffer;
char *allocation_site_file;
int allocation_site_line;
char *name;
};
typedef struct Arena Arena;
struct Arena
{
Arena *prev; // previous arena in chain
Arena *current; // current arena in chain
ArenaFlags flags;
U64 cmt_size;
U64 res_size;
U64 base_pos;
U64 pos;
U64 cmt;
U64 res;
char *allocation_site_file;
int allocation_site_line;
char *name;
#if ARENA_FREE_LIST
Arena *free_last;
#endif
#if ARENA_TABLE_DEBUG
struct ArenaTableNode *table_node;
#endif
};
StaticAssert(sizeof(Arena) <= ARENA_HEADER_SIZE, arena_header_size_check);
typedef struct Temp Temp;
struct Temp
{
Arena *arena;
U64 pos;
};
////////////////////////////////
//~ rjf: Arena Functions
global U64 arena_default_reserve_size = MB(64);
global U64 arena_default_commit_size = KB(64);
global ArenaFlags arena_default_flags = 0;
//- rjf: arena creation/destruction
internal Arena *arena_alloc_(ArenaParams *params);
#define arena_alloc(...) arena_alloc_(&(ArenaParams){.reserve_size = arena_default_reserve_size, .commit_size = arena_default_commit_size, .flags = arena_default_flags, .allocation_site_file = __FILE__, .allocation_site_line = __LINE__, __VA_ARGS__})
internal void arena_release(Arena *arena);
//- rjf: arena push/pop/pos core functions
internal void *arena_push(Arena *arena, U64 size, U64 align, B32 zero);
internal U64 arena_pos(Arena *arena);
internal void arena_pop_to(Arena *arena, U64 pos);
//- rjf: arena push/pop helpers
internal void arena_clear(Arena *arena);
internal void arena_pop(Arena *arena, U64 amt);
//- rjf: temporary arena scopes
internal Temp temp_begin(Arena *arena);
internal void temp_end(Temp temp);
//- rjf: push helper macros
#define push_array_no_zero_aligned(a, T, c, align) (T *)arena_push((a), sizeof(T)*(c), (align), (0))
#define push_array_aligned(a, T, c, align) (T *)arena_push((a), sizeof(T)*(c), (align), (1))
#define push_array_no_zero(a, T, c) push_array_no_zero_aligned(a, T, c, Max(8, AlignOf(T)))
#define push_array(a, T, c) push_array_aligned(a, T, c, Max(8, AlignOf(T)))
#endif // BASE_ARENA_H
-197
View File
@@ -1,197 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
// NOTE(allen): Dev Arena
#if ENABLE_DEV
internal void
arena_annotate_push__dev(Arena *arena, U64 size, void *ptr){
ArenaDev *dev = arena->dev;
if (dev != 0 && ptr != 0){
//- read location
char *file_name = 0;
U64 line_number = 0;
tctx_read_srcloc(&file_name, &line_number);
tctx_write_srcloc(0, 0);
//- profile
ArenaProf *prof = dev->prof;
if (prof != 0){
// c string -> string
String8 file_name_str = str8_lit("(null)");
if (file_name != 0){
file_name_str = str8_cstring(file_name);
}
// record
arena_prof_inc_counters__dev(dev->arena, prof, file_name_str, line_number, size, 1);
}
}
}
internal void
arena_annotate_absorb__dev(Arena *arena, Arena *sub){
ArenaDev *dev = arena->dev;
ArenaDev *sub_dev = sub->dev;
if (dev != 0 && sub_dev != 0){
//- merge profiles
ArenaProf *prof = dev->prof;
ArenaProf *sub_prof = sub_dev->prof;
if (prof != 0 && sub_prof != 0){
for (ArenaProfNode *sub_node = sub_prof->first;
sub_node != 0;
sub_node = sub_node->next){
arena_prof_inc_counters__dev(dev->arena, prof, sub_node->file_name, sub_node->line,
sub_node->size, sub_node->count);
}
}
}
//- release the sub dev memory
if (sub_dev != 0){
arena_release(sub_dev->arena);
}
}
internal ArenaDev*
arena_equip__dev(Arena *arena){
ArenaDev *result = arena->dev;
if (result == 0){
Arena *dev_arena = arena_alloc();
ArenaDev *dev = (ArenaDev*)arena_push__impl(dev_arena, sizeof(ArenaDev));
MemoryZeroStruct(dev);
dev->arena = dev_arena;
arena->dev = dev;
result = dev;
}
return(result);
}
internal void
arena_equip_profile__dev(Arena *arena){
ArenaDev *dev = arena_equip__dev(arena);
if (dev->prof == 0){
dev->prof = (ArenaProf*)arena_push__impl(dev->arena, sizeof(ArenaProf));
MemoryZeroStruct(dev->prof);
}
}
internal void
arena_print_profile__dev(Arena *arena, Arena *out_arena, String8List *out){
Assert(arena != out_arena);
//- get dev & disable
ArenaDev *dev = arena->dev;
arena->dev = 0;
//- get prof
ArenaProf *prof = (dev != 0)?dev->prof:0;
//- not equipped with prof
if (prof == 0){
str8_list_push(out_arena, out, str8_lit("not equipped with a memory profile\n"));
}
//- print prof
if (prof != 0){
Temp scratch = temp_begin(dev->arena);
//- make flat array
U64 note_count = prof->count;
ArenaProfNode **notes = push_array_no_zero__no_annotation(scratch.arena, ArenaProfNode*, note_count);
{
ArenaProfNode **note_ptr = notes;
for (ArenaProfNode *node = prof->first;
node != 0;
node = node->next, note_ptr += 1){
*note_ptr = node;
}
}
//- file name size
U64 max_file_name_size = 0;
{
ArenaProfNode **note_ptr = notes;
for (U64 i = 0; i < note_count; i += 1, note_ptr += 1){
max_file_name_size = Max(max_file_name_size, (**note_ptr).file_name.size);
}
}
//- sort (> size, < [address])
for (U64 i = 0; i < note_count; i += 1){
ArenaProfNode **i_note = notes + i;
ArenaProfNode **min_note = i_note;
for (U64 j = i + 1; j < note_count; j += 1){
ArenaProfNode **j_note = notes + j;
if ((**j_note).size > (**min_note).size ||
((**j_note).size == (**min_note).size && *j_note < *min_note)){
min_note = j_note;
}
}
if (min_note != i_note){
ArenaProfNode *t = *i_note;
*i_note = *min_note;
*min_note = t;
}
}
//- total size
U64 total_size = 0;
{
ArenaProfNode **note_ptr = notes;
for (U64 i = 0; i < note_count; i += 1, note_ptr += 1){
ArenaProfNode *note = *note_ptr;
total_size += note->size;
}
}
//- print
{
str8_list_pushf(out_arena, out, "memory total: %llu\n", total_size);
ArenaProfNode **note_ptr = notes;
for (U64 i = 0; i < note_count; i += 1, note_ptr += 1){
ArenaProfNode *note = *note_ptr;
String8 location = push_str8f(scratch.arena, "%S:%5llu:",
note->file_name, note->line);
F32 percent = 100.f*((F32)note->size)/total_size;
str8_list_pushf(out_arena, out, "%*.*s %12llu %5.2f%% [%5llu]\n",
max_file_name_size + 7, str8_varg(location),
note->size, percent, note->count);
}
}
temp_end(scratch);
}
//- restore dev
arena->dev = dev;
}
internal void
arena_prof_inc_counters__dev(Arena *dev_arena, ArenaProf *prof, String8 file_name, U64 line,
U64 size, U64 count){
// find existing profile node
ArenaProfNode *prof_node = 0;
for (ArenaProfNode *node = prof->first;
node != 0;
node = node->next){
if (node->line == line && str8_match(file_name, node->file_name, 0)){
prof_node = node;
break;
}
}
// make new histogram node if necessary
if (prof_node == 0){
prof_node = (ArenaProfNode*)arena_push(dev_arena, sizeof(*prof_node));
SLLQueuePush(prof->first, prof->last, prof_node);
prof->count += 1;
prof_node->file_name = file_name;
prof_node->line = line;
}
// record this allocation
prof_node->size += size;
prof_node->count += count;
}
#endif
-47
View File
@@ -1,47 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_ARENA_DEV_H
#define BASE_ARENA_DEV_H
////////////////////////////////
//~ NOTE(allen): Dev Arena Types
typedef struct ArenaDev ArenaDev;
struct ArenaDev
{
Arena *arena;
struct ArenaProf *prof;
};
typedef struct ArenaProf ArenaProf;
struct ArenaProf
{
struct ArenaProfNode *first;
struct ArenaProfNode *last;
U64 count;
};
typedef struct ArenaProfNode ArenaProfNode;
struct ArenaProfNode
{
ArenaProfNode *next;
String8 file_name;
U64 line;
U64 size;
U64 count;
};
////////////////////////////////
//~ NOTE(allen): Dev Arena Functions
#if ENABLE_DEV
internal void arena_annotate_push__dev(Arena *arena, U64 size, void *ptr);
internal void arena_annotate_absorb__dev(Arena *arena, Arena *sub);
internal ArenaDev* arena_equip__dev(Arena *arena);
internal void arena_equip_profile__dev(Arena *arena);
internal void arena_print_profile__dev(Arena *arena, Arena *out_arena, String8List *out);
internal void arena_prof_inc_counters__dev(Arena *dev_arena, ArenaProf *prof, String8 file_name, U64 line, U64 size, U64 count);
#endif
#endif // BASE_ARENA_DEV_H
-103
View File
@@ -1,103 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#if COMPILER_CL || (COMPILER_CLANG && OS_WINDOWS)
internal U64
count_bits_set16(U16 val)
{
return __popcnt16(val);
}
internal U64
count_bits_set32(U32 val)
{
return __popcnt(val);
}
internal U64
count_bits_set64(U64 val)
{
return __popcnt64(val);
}
internal U64
ctz32(U32 mask)
{
unsigned long idx;
_BitScanForward(&idx, mask);
return idx;
}
internal U64
ctz64(U64 mask)
{
unsigned long idx;
_BitScanForward64(&idx, mask);
return idx;
}
internal U64
clz32(U32 mask)
{
unsigned long idx;
_BitScanReverse(&idx, mask);
return 31 - idx;
}
internal U64
clz64(U64 mask)
{
unsigned long idx;
_BitScanReverse64(&idx, mask);
return 63 - idx;
}
#elif COMPILER_CLANG || COMPILER_GCC
internal U64
count_bits_set16(U16 val)
{
NotImplemented;
return 0;
}
internal U64
count_bits_set32(U32 val)
{
NotImplemented;
return 0;
}
internal U64
count_bits_set64(U64 val)
{
NotImplemented;
return 0;
}
internal U64
ctz32(U32 val)
{
NotImplemented;
return 0;
}
internal U64
clz32(U32 val)
{
NotImplemented;
return 0;
}
internal U64
clz64(U64 val)
{
NotImplemented;
return 0;
}
#else
# error "bits not defined for this target"
#endif
-18
View File
@@ -1,18 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_BITS_H
#define BASE_BITS_H
#define ExtractBit(word, idx) (((word) >> (idx)) & 1)
internal U64 count_bits_set16(U16 val);
internal U64 count_bits_set32(U32 val);
internal U64 count_bits_set64(U64 val);
internal U64 ctz32(U32 val);
internal U64 ctz64(U64 val);
internal U64 clz32(U32 val);
internal U64 clz64(U64 val);
#endif // BASE_BITS_H
+228 -229
View File
@@ -1,229 +1,228 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ NOTE(rjf): Command Line Option Parsing
internal U64
cmd_line_hash_from_string(String8 string)
{
U64 result = 5381;
for(U64 i = 0; i < string.size; i += 1)
{
result = ((result << 5) + result) + string.str[i];
}
return result;
}
internal CmdLineOpt **
cmd_line_slot_from_string(CmdLine *cmd_line, String8 string)
{
CmdLineOpt **slot = 0;
if(cmd_line->option_table_size != 0)
{
U64 hash = cmd_line_hash_from_string(string);
U64 bucket = hash % cmd_line->option_table_size;
slot = &cmd_line->option_table[bucket];
}
return slot;
}
internal CmdLineOpt *
cmd_line_opt_from_slot(CmdLineOpt **slot, String8 string)
{
CmdLineOpt *result = 0;
for(CmdLineOpt *var = *slot; var; var = var->hash_next)
{
if(str8_match(string, var->string, 0))
{
result = var;
break;
}
}
return result;
}
internal void
cmd_line_push_opt(CmdLineOptList *list, CmdLineOpt *var)
{
SLLQueuePush(list->first, list->last, var);
list->count += 1;
}
internal CmdLineOpt *
cmd_line_insert_opt(Arena *arena, CmdLine *cmd_line, String8 string, String8List values)
{
CmdLineOpt *var = 0;
CmdLineOpt **slot = cmd_line_slot_from_string(cmd_line, string);
CmdLineOpt *existing_var = cmd_line_opt_from_slot(slot, string);
if(existing_var != 0)
{
var = existing_var;
}
else
{
var = push_array(arena, CmdLineOpt, 1);
var->hash_next = *slot;
var->hash = cmd_line_hash_from_string(string);
var->string = push_str8_copy(arena, string);
var->value_strings = values;
StringJoin join = {0};
join.pre = str8_lit("");
join.sep = str8_lit(",");
join.post = str8_lit("");
var->value_string = str8_list_join(arena, &var->value_strings, &join);
*slot = var;
cmd_line_push_opt(&cmd_line->options, var);
}
return var;
}
internal CmdLine
cmd_line_from_string_list(Arena *arena, String8List command_line)
{
CmdLine parsed = {0};
// NOTE(rjf): Set up config option table.
{
parsed.option_table_size = 4096;
parsed.option_table = push_array(arena, CmdLineOpt *, parsed.option_table_size);
}
// NOTE(rjf): Parse command line.
B32 after_passthrough_option = 0;
for(String8Node *node = command_line.first->next, *next = 0; node != 0; node = next)
{
next = node->next;
String8 option_name = node->string;
// NOTE(rjf): Look at -- or - at the start of an argument to determine if it's
// a flag option. All arguments after a single "--" (with no trailing string
// on the command line will be considered as input files.
B32 is_option = 1;
if(after_passthrough_option == 0)
{
if(str8_match(node->string, str8_lit("--"), 0))
{
after_passthrough_option = 1;
is_option = 0;
}
else if(str8_match(str8_prefix(node->string, 2), str8_lit("--"), 0))
{
option_name = str8_skip(option_name, 2);
}
else if(str8_match(str8_prefix(node->string, 1), str8_lit("-"), 0))
{
option_name = str8_skip(option_name, 1);
}
else
{
is_option = 0;
}
}
else
{
is_option = 0;
}
// NOTE(rjf): This string is an option.
if(is_option)
{
B32 has_arguments = 0;
U64 arg_signifier_position1 = str8_find_needle(option_name, 0, str8_lit(":"), 0);
U64 arg_signifier_position2 = str8_find_needle(option_name, 0, str8_lit("="), 0);
U64 arg_signifier_position = Min(arg_signifier_position1, arg_signifier_position2);
String8 arg_portion_this_string = str8_skip(option_name, arg_signifier_position+1);
if(arg_signifier_position < option_name.size)
{
has_arguments = 1;
}
option_name = str8_prefix(option_name, arg_signifier_position);
String8List arguments = {0};
// NOTE(rjf): Parse arguments.
if(has_arguments)
{
for(String8Node *n = node; n; n = n->next)
{
next = n->next;
String8 string = n->string;
if(n == node)
{
string = arg_portion_this_string;
}
U8 splits[] = { ',' };
String8List args_in_this_string = str8_split(arena, string, splits, ArrayCount(splits), 0);
for(String8Node *sub_arg = args_in_this_string.first; sub_arg; sub_arg = sub_arg->next)
{
str8_list_push(arena, &arguments, sub_arg->string);
}
if(!str8_match(str8_postfix(n->string, 1), str8_lit(","), 0) &&
(n != node || arg_portion_this_string.size != 0))
{
break;
}
}
}
// NOTE(rjf): Register config variable.
cmd_line_insert_opt(arena, &parsed, option_name, arguments);
}
// NOTE(rjf): Default path, treat as a passthrough config option to be
// handled by tool-specific code.
else if(!str8_match(node->string, str8_lit("--"), 0))
{
str8_list_push(arena, &parsed.inputs, node->string);
after_passthrough_option = 1;
}
}
return parsed;
}
internal CmdLineOpt *
cmd_line_opt_from_string(CmdLine *cmd_line, String8 name)
{
return cmd_line_opt_from_slot(cmd_line_slot_from_string(cmd_line, name), name);
}
internal String8List
cmd_line_strings(CmdLine *cmd_line, String8 name)
{
String8List result = {0};
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
if(var != 0)
{
result = var->value_strings;
}
return result;
}
internal String8
cmd_line_string(CmdLine *cmd_line, String8 name)
{
String8 result = {0};
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
if(var != 0)
{
result = var->value_string;
}
return result;
}
internal B32
cmd_line_has_flag(CmdLine *cmd_line, String8 name)
{
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
return(var != 0);
}
internal B32
cmd_line_has_argument(CmdLine *cmd_line, String8 name)
{
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
return(var != 0 && var->value_strings.node_count > 0);
}
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Command Line Parsing Functions
internal CmdLineOpt **
cmd_line_slot_from_string(CmdLine *cmd_line, String8 string)
{
CmdLineOpt **slot = 0;
if(cmd_line->option_table_size != 0)
{
U64 hash = u64_hash_from_str8(string);
U64 bucket = hash % cmd_line->option_table_size;
slot = &cmd_line->option_table[bucket];
}
return slot;
}
internal CmdLineOpt *
cmd_line_opt_from_slot(CmdLineOpt **slot, String8 string)
{
CmdLineOpt *result = 0;
for(CmdLineOpt *var = *slot; var; var = var->hash_next)
{
if(str8_match(string, var->string, 0))
{
result = var;
break;
}
}
return result;
}
internal void
cmd_line_push_opt(CmdLineOptList *list, CmdLineOpt *var)
{
SLLQueuePush(list->first, list->last, var);
list->count += 1;
}
internal CmdLineOpt *
cmd_line_insert_opt(Arena *arena, CmdLine *cmd_line, String8 string, String8List values)
{
CmdLineOpt *var = 0;
CmdLineOpt **slot = cmd_line_slot_from_string(cmd_line, string);
CmdLineOpt *existing_var = cmd_line_opt_from_slot(slot, string);
if(existing_var != 0)
{
var = existing_var;
}
else
{
var = push_array(arena, CmdLineOpt, 1);
var->hash_next = *slot;
var->hash = u64_hash_from_str8(string);
var->string = push_str8_copy(arena, string);
var->value_strings = values;
StringJoin join = {0};
join.pre = str8_lit("");
join.sep = str8_lit(",");
join.post = str8_lit("");
var->value_string = str8_list_join(arena, &var->value_strings, &join);
*slot = var;
cmd_line_push_opt(&cmd_line->options, var);
}
return var;
}
internal CmdLine
cmd_line_from_string_list(Arena *arena, String8List command_line)
{
CmdLine parsed = {0};
parsed.exe_name = command_line.first->string;
parsed.option_table_size = 64;
parsed.option_table = push_array(arena, CmdLineOpt *, parsed.option_table_size);
//- rjf: parse options / inputs
B32 after_passthrough_option = 0;
B32 first_passthrough = 1;
for(String8Node *node = command_line.first->next, *next = 0; node != 0; node = next)
{
next = node->next;
//- rjf: look at --, -, or / (only on Windows) at the start of an
// argument to determine if it's a flag option. all arguments after a
// single "--" (with no trailing string on the command line will be
// considered as passthrough input strings.
B32 is_option = 0;
String8 option_name = node->string;
if(!after_passthrough_option)
{
is_option = 1;
if(str8_match(node->string, str8_lit("--"), 0))
{
after_passthrough_option = 1;
is_option = 0;
}
else if(str8_match(str8_prefix(node->string, 2), str8_lit("--"), 0))
{
option_name = str8_skip(option_name, 2);
}
else if(str8_match(str8_prefix(node->string, 1), str8_lit("-"), 0))
{
option_name = str8_skip(option_name, 1);
}
else if(OperatingSystem_CURRENT == OperatingSystem_Windows &&
str8_match(str8_prefix(node->string, 1), str8_lit("/"), 0))
{
option_name = str8_skip(option_name, 1);
}
else
{
is_option = 0;
}
}
//- rjf: string is an option
if(is_option)
{
// rjf: unpack option prefix
B32 has_values = 0;
U64 value_signifier_position1 = str8_find_needle(option_name, 0, str8_lit(":"), 0);
U64 value_signifier_position2 = str8_find_needle(option_name, 0, str8_lit("="), 0);
U64 value_signifier_position = Min(value_signifier_position1, value_signifier_position2);
String8 value_portion_this_string = str8_skip(option_name, value_signifier_position+1);
if(value_signifier_position < option_name.size)
{
has_values = 1;
}
option_name = str8_prefix(option_name, value_signifier_position);
// rjf: parse option's values
String8List values = {0};
if(has_values)
{
for(String8Node *n = node; n; n = n->next)
{
next = n->next;
String8 string = n->string;
if(n == node)
{
string = value_portion_this_string;
}
U8 splits[] = { ',' };
String8List values_in_this_string = str8_split(arena, string, splits, ArrayCount(splits), 0);
for(String8Node *sub_val = values_in_this_string.first; sub_val; sub_val = sub_val->next)
{
str8_list_push(arena, &values, sub_val->string);
}
if(!str8_match(str8_postfix(n->string, 1), str8_lit(","), 0) &&
(n != node || value_portion_this_string.size != 0))
{
break;
}
}
}
// rjf: store
cmd_line_insert_opt(arena, &parsed, option_name, values);
}
//- rjf: default path - treat as a passthrough input
else if(!str8_match(node->string, str8_lit("--"), 0) || !first_passthrough)
{
str8_list_push(arena, &parsed.inputs, node->string);
first_passthrough = 0;
}
}
//- rjf: fill argc/argv
parsed.argc = command_line.node_count;
parsed.argv = push_array(arena, char *, parsed.argc);
{
U64 idx = 0;
for(String8Node *n = command_line.first; n != 0; n = n->next)
{
parsed.argv[idx] = (char *)push_str8_copy(arena, n->string).str;
idx += 1;
}
}
return parsed;
}
internal CmdLineOpt *
cmd_line_opt_from_string(CmdLine *cmd_line, String8 name)
{
return cmd_line_opt_from_slot(cmd_line_slot_from_string(cmd_line, name), name);
}
internal String8List
cmd_line_strings(CmdLine *cmd_line, String8 name)
{
String8List result = {0};
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
if(var != 0)
{
result = var->value_strings;
}
return result;
}
internal String8
cmd_line_string(CmdLine *cmd_line, String8 name)
{
String8 result = {0};
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
if(var != 0)
{
result = var->value_string;
}
return result;
}
internal B32
cmd_line_has_flag(CmdLine *cmd_line, String8 name)
{
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
return (var != 0);
}
internal B32
cmd_line_has_argument(CmdLine *cmd_line, String8 name)
{
CmdLineOpt *var = cmd_line_opt_from_string(cmd_line, name);
return (var != 0 && var->value_strings.node_count > 0);
}
+55 -53
View File
@@ -1,53 +1,55 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_COMMAND_LINE_H
#define BASE_COMMAND_LINE_H
////////////////////////////////
//~ rjf: Parsed Command Line Types
typedef struct CmdLineOpt CmdLineOpt;
struct CmdLineOpt
{
CmdLineOpt *next;
CmdLineOpt *hash_next;
U64 hash;
String8 string;
String8List value_strings;
String8 value_string;
};
typedef struct CmdLineOptList CmdLineOptList;
struct CmdLineOptList
{
U64 count;
CmdLineOpt *first;
CmdLineOpt *last;
};
typedef struct CmdLine CmdLine;
struct CmdLine
{
CmdLineOptList options;
String8List inputs;
U64 option_table_size;
CmdLineOpt **option_table;
};
////////////////////////////////
//~ NOTE(rjf): Command Line Option Parsing
internal U64 cmd_line_hash_from_string(String8 string);
internal CmdLineOpt** cmd_line_slot_from_string(CmdLine *cmd_line, String8 string);
internal CmdLineOpt* cmd_line_opt_from_slot(CmdLineOpt **slot, String8 string);
internal void cmd_line_push_opt(CmdLineOptList *list, CmdLineOpt *var);
internal CmdLineOpt* cmd_line_insert_opt(Arena *arena, CmdLine *cmd_line, String8 string, String8List values);
internal CmdLine cmd_line_from_string_list(Arena *arena, String8List arguments);
internal CmdLineOpt* cmd_line_opt_from_string(CmdLine *cmd_line, String8 name);
internal String8List cmd_line_strings(CmdLine *cmd_line, String8 name);
internal String8 cmd_line_string(CmdLine *cmd_line, String8 name);
internal B32 cmd_line_has_flag(CmdLine *cmd_line, String8 name);
internal B32 cmd_line_has_argument(CmdLine *cmd_line, String8 name);
#endif // BASE_COMMAND_LINE_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_COMMAND_LINE_H
#define BASE_COMMAND_LINE_H
////////////////////////////////
//~ rjf: Parsed Command Line Types
typedef struct CmdLineOpt CmdLineOpt;
struct CmdLineOpt
{
CmdLineOpt *next;
CmdLineOpt *hash_next;
U64 hash;
String8 string;
String8List value_strings;
String8 value_string;
};
typedef struct CmdLineOptList CmdLineOptList;
struct CmdLineOptList
{
U64 count;
CmdLineOpt *first;
CmdLineOpt *last;
};
typedef struct CmdLine CmdLine;
struct CmdLine
{
String8 exe_name;
CmdLineOptList options;
String8List inputs;
U64 option_table_size;
CmdLineOpt **option_table;
U64 argc;
char **argv;
};
////////////////////////////////
//~ rjf: Command Line Parsing Functions
internal CmdLineOpt** cmd_line_slot_from_string(CmdLine *cmd_line, String8 string);
internal CmdLineOpt* cmd_line_opt_from_slot(CmdLineOpt **slot, String8 string);
internal void cmd_line_push_opt(CmdLineOptList *list, CmdLineOpt *var);
internal CmdLineOpt* cmd_line_insert_opt(Arena *arena, CmdLine *cmd_line, String8 string, String8List values);
internal CmdLine cmd_line_from_string_list(Arena *arena, String8List arguments);
internal CmdLineOpt* cmd_line_opt_from_string(CmdLine *cmd_line, String8 name);
internal String8List cmd_line_strings(CmdLine *cmd_line, String8 name);
internal String8 cmd_line_string(CmdLine *cmd_line, String8 name);
internal B32 cmd_line_has_flag(CmdLine *cmd_line, String8 name);
internal B32 cmd_line_has_argument(CmdLine *cmd_line, String8 name);
#endif // BASE_COMMAND_LINE_H
+295 -144
View File
@@ -1,144 +1,295 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_CONTEXT_CRACKING_H
#define BASE_CONTEXT_CRACKING_H
#if defined(__clang__)
# define COMPILER_CLANG 1
# if defined(_WIN32)
# define OS_WINDOWS 1
# elif defined(__gnu_linux__) || defined(__linux__)
# define OS_LINUX 1
# elif defined(__APPLE__) && defined(__MACH__)
# define OS_MAC 1
# else
# error This compiler/platform combo is not supported yet
# endif
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
# define ARCH_X64 1
# elif defined(i386) || defined(__i386) || defined(__i386__)
# define ARCH_X86 1
# elif defined(__aarch64__)
# define ARCH_ARM64 1
# elif defined(__arm__)
# define ARCH_ARM32 1
# else
# error architecture not supported yet
# endif
#elif defined(_MSC_VER)
# define COMPILER_CL 1
# if defined(_WIN32)
# define OS_WINDOWS 1
# else
# error This compiler/platform combo is not supported yet
# endif
# if defined(_M_AMD64)
# define ARCH_X64 1
# elif defined(_M_IX86)
# define ARCH_X86 1
# elif defined(_M_ARM64)
# define ARCH_ARM64 1
# elif defined(_M_ARM)
# define ARCH_ARM32 1
# else
# error architecture not supported yet
# endif
#elif defined(__GNUC__) || defined(__GNUG__)
# define COMPILER_GCC 1
# if defined(__gnu_linux__) || defined(__linux__)
# define OS_LINUX 1
# else
# error This compiler/platform combo is not supported yet
# endif
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
# define ARCH_X64 1
# elif defined(i386) || defined(__i386) || defined(__i386__)
# define ARCH_X86 1
# elif defined(__aarch64__)
# define ARCH_ARM64 1
# elif defined(__arm__)
# define ARCH_ARM32 1
# else
# error architecture not supported yet
# endif
#else
# error This compiler is not supported yet
#endif
#if defined(ARCH_X64)
# define ARCH_64BIT 1
#elif defined(ARCH_X86)
# define ARCH_32BIT 1
#endif
#if defined(__cplusplus)
# define LANG_CPP 1
#else
# define LANG_C 1
#endif
// zeroify
#if !defined(ARCH_32BIT)
# define ARCH_32BIT 0
#endif
#if !defined(ARCH_64BIT)
# define ARCH_64BIT 0
#endif
#if !defined(ARCH_X64)
# define ARCH_X64 0
#endif
#if !defined(ARCH_X86)
# define ARCH_X86 0
#endif
#if !defined(ARCH_ARM64)
# define ARCH_ARM64 0
#endif
#if !defined(ARCH_ARM32)
# define ARCH_ARM32 0
#endif
#if !defined(COMPILER_CL)
# define COMPILER_CL 0
#endif
#if !defined(COMPILER_GCC)
# define COMPILER_GCC 0
#endif
#if !defined(COMPILER_CLANG)
# define COMPILER_CLANG 0
#endif
#if !defined(OS_WINDOWS)
# define OS_WINDOWS 0
#endif
#if !defined(OS_LINUX)
# define OS_LINUX 0
#endif
#if !defined(OS_MAC)
# define OS_MAC 0
#endif
#if !defined(LANG_CPP)
# define LANG_CPP 0
#endif
#if !defined(LANG_C)
# define LANG_C 0
#endif
#if ARCH_ARM32 || ARCH_ARM64 || ARCH_X64 || ARCH_X86
# define ARCH_LITTLE_ENDIAN 1
#else
# error Endianness of this architecture not understood by context cracker
#endif
#endif // BASE_CONTEXT_CRACKING_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_CONTEXT_CRACKING_H
#define BASE_CONTEXT_CRACKING_H
////////////////////////////////
//~ rjf: Clang OS/Arch Cracking
#if defined(__clang__)
# define COMPILER_CLANG 1
# if defined(_WIN32)
# define OS_WINDOWS 1
# elif defined(__gnu_linux__) || defined(__linux__)
# define OS_LINUX 1
# elif defined(__APPLE__) && defined(__MACH__)
# define OS_MAC 1
# else
# error This compiler/OS combo is not supported.
# endif
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
# define ARCH_X64 1
# elif defined(i386) || defined(__i386) || defined(__i386__)
# define ARCH_X86 1
# elif defined(__aarch64__)
# define ARCH_ARM64 1
# elif defined(__arm__)
# define ARCH_ARM32 1
# else
# error Architecture not supported.
# endif
////////////////////////////////
//~ rjf: MSVC OS/Arch Cracking
#elif defined(_MSC_VER)
# define COMPILER_MSVC 1
# if _MSC_VER >= 1920
# define COMPILER_MSVC_YEAR 2019
# elif _MSC_VER >= 1910
# define COMPILER_MSVC_YEAR 2017
# elif _MSC_VER >= 1900
# define COMPILER_MSVC_YEAR 2015
# elif _MSC_VER >= 1800
# define COMPILER_MSVC_YEAR 2013
# elif _MSC_VER >= 1700
# define COMPILER_MSVC_YEAR 2012
# elif _MSC_VER >= 1600
# define COMPILER_MSVC_YEAR 2010
# elif _MSC_VER >= 1500
# define COMPILER_MSVC_YEAR 2008
# elif _MSC_VER >= 1400
# define COMPILER_MSVC_YEAR 2005
# else
# define COMPILER_MSVC_YEAR 0
# endif
# if defined(_WIN32)
# define OS_WINDOWS 1
# else
# error This compiler/OS combo is not supported.
# endif
# if defined(_M_AMD64)
# define ARCH_X64 1
# elif defined(_M_IX86)
# define ARCH_X86 1
# elif defined(_M_ARM64)
# define ARCH_ARM64 1
# elif defined(_M_ARM)
# define ARCH_ARM32 1
# else
# error Architecture not supported.
# endif
////////////////////////////////
//~ rjf: GCC OS/Arch Cracking
#elif defined(__GNUC__) || defined(__GNUG__)
# define COMPILER_GCC 1
# if defined(__gnu_linux__) || defined(__linux__)
# define OS_LINUX 1
# else
# error This compiler/OS combo is not supported.
# endif
# if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
# define ARCH_X64 1
# elif defined(i386) || defined(__i386) || defined(__i386__)
# define ARCH_X86 1
# elif defined(__aarch64__)
# define ARCH_ARM64 1
# elif defined(__arm__)
# define ARCH_ARM32 1
# else
# error Architecture not supported.
# endif
#else
# error Compiler not supported.
#endif
////////////////////////////////
//~ rjf: Arch Cracking
#if defined(ARCH_X64)
# define ARCH_64BIT 1
#elif defined(ARCH_X86)
# define ARCH_32BIT 1
#endif
#if ARCH_ARM32 || ARCH_ARM64 || ARCH_X64 || ARCH_X86
# define ARCH_LITTLE_ENDIAN 1
#else
# error Endianness of this architecture not understood by context cracker.
#endif
////////////////////////////////
//~ rjf: Language Cracking
#if defined(__cplusplus)
# define LANG_CPP 1
#else
# define LANG_C 1
#endif
////////////////////////////////
//~ rjf: Build Option Cracking
#if !defined(BUILD_DEBUG)
# define BUILD_DEBUG 1
#endif
#if !defined(BUILD_TESTS)
# define BUILD_TESTS 0
#endif
#if !defined(BUILD_SUPPLEMENTARY_UNIT)
# define BUILD_SUPPLEMENTARY_UNIT 0
#endif
#if !defined(BUILD_ENTRY_DEFINING_UNIT)
# define BUILD_ENTRY_DEFINING_UNIT 1
#endif
#if !defined(BUILD_CONSOLE_INTERFACE)
# define BUILD_CONSOLE_INTERFACE 0
#endif
#if !defined(BUILD_VERSION_MAJOR)
# define BUILD_VERSION_MAJOR 0
#endif
#if !defined(BUILD_VERSION_MINOR)
# define BUILD_VERSION_MINOR 9
#endif
#if !defined(BUILD_VERSION_PATCH)
# define BUILD_VERSION_PATCH 28
#endif
#define BUILD_VERSION_STRING_LITERAL Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH)
#if BUILD_DEBUG
# define BUILD_MODE_STRING_LITERAL_APPEND " [Debug]"
#else
# define BUILD_MODE_STRING_LITERAL_APPEND ""
#endif
#if defined(BUILD_GIT_HASH)
# define BUILD_GIT_HASH_STRING_LITERAL_APPEND " [" BUILD_GIT_HASH "]"
#else
# define BUILD_GIT_HASH_STRING_LITERAL_APPEND ""
#endif
#if !defined(BUILD_TITLE)
# define BUILD_TITLE "Untitled"
#endif
#if !defined(BUILD_RELEASE_PHASE_STRING_LITERAL)
# define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
#endif
#if !defined(BUILD_ISSUES_LINK_STRING_LITERAL)
# define BUILD_ISSUES_LINK_STRING_LITERAL "https://github.com/EpicGames/raddebugger/issues"
#endif
#define BUILD_TITLE_STRING_LITERAL BUILD_TITLE " (" BUILD_VERSION_STRING_LITERAL " " BUILD_RELEASE_PHASE_STRING_LITERAL ") - " __DATE__ "" BUILD_GIT_HASH_STRING_LITERAL_APPEND BUILD_MODE_STRING_LITERAL_APPEND
////////////////////////////////
//~ rjf: Zero All Undefined Options
#if !defined(ARCH_32BIT)
# define ARCH_32BIT 0
#endif
#if !defined(ARCH_64BIT)
# define ARCH_64BIT 0
#endif
#if !defined(ARCH_X64)
# define ARCH_X64 0
#endif
#if !defined(ARCH_X86)
# define ARCH_X86 0
#endif
#if !defined(ARCH_ARM64)
# define ARCH_ARM64 0
#endif
#if !defined(ARCH_ARM32)
# define ARCH_ARM32 0
#endif
#if !defined(COMPILER_MSVC)
# define COMPILER_MSVC 0
#endif
#if !defined(COMPILER_GCC)
# define COMPILER_GCC 0
#endif
#if !defined(COMPILER_CLANG)
# define COMPILER_CLANG 0
#endif
#if !defined(OS_WINDOWS)
# define OS_WINDOWS 0
#endif
#if !defined(OS_LINUX)
# define OS_LINUX 0
#endif
#if !defined(OS_MAC)
# define OS_MAC 0
#endif
#if !defined(LANG_CPP)
# define LANG_CPP 0
#endif
#if !defined(LANG_C)
# define LANG_C 0
#endif
////////////////////////////////
//~ rjf: Unsupported Errors
#if ARCH_X86
# error You tried to build in x86 (32 bit) mode, but currently, only building in x64 (64 bit) mode is supported.
#endif
#if !ARCH_X64
# error You tried to build with an unsupported architecture. Currently, only building in x64 mode is supported.
#endif
////////////////////////////////
// extra intrinisc includes, so older clang versions are happy
// when optiona intrinsics like avx2 & avx512 are used later
// these must come first before any other intrinsic includes
// otherwise compiler will define macros that prevent declarations
// of intrinsics when included next time
#if ARCH_X64 && COMPILER_CLANG
# if defined(__IMMINTRIN_H)
# error "include this header before immintrin.h / x86intrin.h / intrin.h"
# endif
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wreserved-macro-identifier"
# pragma push_macro("__SHA__")
# pragma push_macro("__AVX__")
# pragma push_macro("__AVX2__")
# pragma push_macro("__BMI2__")
# pragma push_macro("__SSE4_1__")
# pragma push_macro("__AVX512F__")
# pragma push_macro("__AVX512VL__")
# pragma push_macro("__AVX512BW__")
# pragma push_macro("__AVX512VBMI__")
# define __SHA__ 1
# define __AVX__ 1
# define __AVX2__ 1
# define __BMI2__ 1
# define __SSE4_1__ 1
# define __AVX512F__ 1
# define __AVX512VL__ 1
# define __AVX512BW__ 1
# define __AVX512VBMI__ 1
# include <immintrin.h>
# pragma pop_macro("__AVX512VBMI__")
# pragma pop_macro("__AVX512BW__")
# pragma pop_macro("__AVX512VL__")
# pragma pop_macro("__AVX512F__")
# pragma pop_macro("__SSE4_1__")
# pragma pop_macro("__BMI2__")
# pragma pop_macro("__AVX2__")
# pragma pop_macro("__AVX__")
# pragma pop_macro("__SHA__")
# pragma clang diagnostic pop
#endif
#endif // BASE_CONTEXT_CRACKING_H
+809
View File
@@ -0,0 +1,809 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Safe Casts
internal U16
safe_cast_u16(U32 x)
{
AssertAlways(x <= max_U16);
U16 result = (U16)x;
return result;
}
internal U32
safe_cast_u32(U64 x)
{
AssertAlways(x <= max_U32);
U32 result = (U32)x;
return result;
}
internal S32
safe_cast_s32(S64 x)
{
AssertAlways(x <= max_S32);
S32 result = (S32)x;
return result;
}
////////////////////////////////
//~ rjf: Large Base Type Functions
internal U128
u128_zero(void)
{
U128 v = {0};
return v;
}
internal U128
u128_make(U64 v0, U64 v1)
{
U128 v = { .u64 = { v0, v1 }};
return v;
}
internal B32
u128_match(U128 a, U128 b)
{
return MemoryMatchStruct(&a, &b);
}
////////////////////////////////
//~ rjf: Bit Patterns
internal U32
u32_from_u64_saturate(U64 x){
U32 x32 = (x > max_U32)?max_U32:(U32)x;
return(x32);
}
internal U64
u64_up_to_pow2(U64 x){
if (x == 0){
x = 1;
}
else{
x -= 1;
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
x |= (x >> 32);
x += 1;
}
return(x);
}
internal S32
extend_sign32(U32 x, U32 size)
{
U32 n = size * 8;
U32 m = (U32)1 << (n - 1);
S32 r = (S32)((x ^ m) - m);
return r;
}
internal S64
extend_sign64(U64 x, U64 size)
{
U64 n = size * 8;
U64 m = (U64)1 << (n - 1);
S64 r = (S64)((x ^ m) - m);
return r;
}
internal F32
inf32(void){
union { U32 u; F32 f; } x;
x.u = exponent32;
return(x.f);
}
internal F32
neg_inf32(void){
union { U32 u; F32 f; } x;
x.u = sign32 | exponent32;
return(x.f);
}
internal U16
bswap_u16(U16 x)
{
U16 result = (((x & 0xFF00) >> 8) |
((x & 0x00FF) << 8));
return result;
}
internal U32
bswap_u32(U32 x)
{
U32 result = (((x & 0xFF000000) >> 24) |
((x & 0x00FF0000) >> 8) |
((x & 0x0000FF00) << 8) |
((x & 0x000000FF) << 24));
return result;
}
internal U64
bswap_u64(U64 x)
{
// TODO(nick): naive bswap, replace with something that is faster like an intrinsic
U64 result = (((x & 0xFF00000000000000ULL) >> 56) |
((x & 0x00FF000000000000ULL) >> 40) |
((x & 0x0000FF0000000000ULL) >> 24) |
((x & 0x000000FF00000000ULL) >> 8) |
((x & 0x00000000FF000000ULL) << 8) |
((x & 0x0000000000FF0000ULL) << 24) |
((x & 0x000000000000FF00ULL) << 40) |
((x & 0x00000000000000FFULL) << 56));
return result;
}
#if COMPILER_MSVC || (COMPILER_CLANG && OS_WINDOWS)
internal U64
count_bits_set32(U32 val)
{
return __popcnt(val);
}
internal U64
count_bits_set64(U64 val)
{
return __popcnt64(val);
}
internal U64
ctz32(U32 mask)
{
unsigned long idx;
_BitScanForward(&idx, mask);
return idx;
}
internal U64
ctz64(U64 mask)
{
unsigned long idx;
_BitScanForward64(&idx, mask);
return idx;
}
internal U64
clz32(U32 mask)
{
unsigned long idx;
_BitScanReverse(&idx, mask);
return 31 - idx;
}
internal U64
clz64(U64 mask)
{
unsigned long idx;
_BitScanReverse64(&idx, mask);
return 63 - idx;
}
#elif COMPILER_CLANG || COMPILER_GCC
internal U64
count_bits_set32(U32 val)
{
return __builtin_popcount(val);
}
internal U64
count_bits_set64(U64 val)
{
return __builtin_popcountll(val);
}
internal U64
ctz32(U32 val)
{
return __builtin_ctz(val);
}
internal U64
clz32(U32 val)
{
return __builtin_clz(val);
}
internal U64
ctz64(U64 val)
{
return __builtin_ctzll(val);
}
internal U64
clz64(U64 val)
{
return __builtin_clzll(val);
}
#else
# error "Bit intrinsic functions not defined for this compiler."
#endif
////////////////////////////////
//~ rjf: Enum -> Sign
internal S32
sign_from_side_S32(Side side){
return((side == Side_Min)?-1:1);
}
internal F32
sign_from_side_F32(Side side){
return((side == Side_Min)?-1.f:1.f);
}
////////////////////////////////
//~ rjf: Memory Functions
internal B32
memory_is_zero(void *ptr, U64 size)
{
B32 result = 1;
// break down size
U64 extra = (size&0x7);
U64 count8 = (size >> 3);
// check with 8-byte stride
U64 *p64 = (U64*)ptr;
if(result)
{
for(U64 i = 0; i < count8; i += 1, p64 += 1)
{
if(*p64 != 0)
{
result = 0;
goto done;
}
}
}
// check extra
if(result)
{
U8 *p8 = (U8*)p64;
for(U64 i = 0; i < extra; i += 1, p8 += 1)
{
if(*p8 != 0)
{
result = 0;
goto done;
}
}
}
done:;
return result;
}
internal void UBSAN_NO_ALIGN
memory_write16(void *ptr, U16 v)
{
MemoryCopy(ptr, &v, sizeof(v));
}
internal void UBSAN_NO_ALIGN
memory_write32(void *ptr, U32 v)
{
MemoryCopy(ptr, &v, sizeof(v));
}
internal void UBSAN_NO_ALIGN
memory_write64(void *ptr, U64 v)
{
MemoryCopy(ptr, &v, sizeof(v));
}
internal U8 UBSAN_NO_ALIGN
memory_read8(void *ptr)
{
U8 result;
MemoryCopy(&result, ptr, sizeof(result));
return result;
}
internal U16 UBSAN_NO_ALIGN
memory_read16(void *ptr)
{
U16 result;
MemoryCopy(&result, ptr, sizeof(result));
return result;
}
internal U32 UBSAN_NO_ALIGN
memory_read32(void *ptr)
{
U32 result;
MemoryCopy(&result, ptr, sizeof(result));
return result;
}
internal U64 UBSAN_NO_ALIGN
memory_read64(void *ptr)
{
U64 result;
MemoryCopy(&result, ptr, sizeof(result));
return result;
}
////////////////////////////////
//~ rjf: Text 2D Coordinate/Range Functions
internal TxtPt
txt_pt(S64 line, S64 column)
{
TxtPt p = {0};
p.line = line;
p.column = column;
return p;
}
internal B32
txt_pt_match(TxtPt a, TxtPt b)
{
return a.line == b.line && a.column == b.column;
}
internal B32
txt_pt_less_than(TxtPt a, TxtPt b)
{
B32 result = 0;
if(a.line < b.line)
{
result = 1;
}
else if(a.line == b.line)
{
result = a.column < b.column;
}
return result;
}
internal TxtPt
txt_pt_min(TxtPt a, TxtPt b)
{
TxtPt result = b;
if(txt_pt_less_than(a, b))
{
result = a;
}
return result;
}
internal TxtPt
txt_pt_max(TxtPt a, TxtPt b)
{
TxtPt result = a;
if(txt_pt_less_than(a, b))
{
result = b;
}
return result;
}
internal TxtRng
txt_rng(TxtPt min, TxtPt max)
{
TxtRng range = {0};
if(txt_pt_less_than(min, max))
{
range.min = min;
range.max = max;
}
else
{
range.min = max;
range.max = min;
}
return range;
}
internal TxtRng
txt_rng_intersect(TxtRng a, TxtRng b)
{
TxtRng result = {0};
result.min = txt_pt_max(a.min, b.min);
result.max = txt_pt_min(a.max, b.max);
if(txt_pt_less_than(result.max, result.min))
{
MemoryZeroStruct(&result);
}
return result;
}
internal TxtRng
txt_rng_union(TxtRng a, TxtRng b)
{
TxtRng result = {0};
result.min = txt_pt_min(a.min, b.min);
result.max = txt_pt_max(a.max, b.max);
return result;
}
internal B32
txt_rng_contains(TxtRng r, TxtPt pt)
{
B32 result = ((txt_pt_less_than(r.min, pt) || txt_pt_match(r.min, pt)) &&
txt_pt_less_than(pt, r.max));
return result;
}
////////////////////////////////
//~ rjf: Toolchain/Environment Enum Functions
internal U64
bit_size_from_arch(Arch arch)
{
// TODO(rjf): metacode
U64 arch_bitsize = 0;
switch(arch)
{
case Arch_x64: arch_bitsize = 64; break;
case Arch_x86: arch_bitsize = 32; break;
case Arch_arm64: arch_bitsize = 64; break;
case Arch_arm32: arch_bitsize = 32; break;
default: break;
}
return arch_bitsize;
}
internal U64
byte_size_from_arch(Arch arch)
{
return bit_size_from_arch(arch) / 8;
}
internal U64
max_ops_per_instruction_from_arch(Arch arch)
{
U64 max_ops = 0;
switch (arch)
{
case Arch_Null: break;
case Arch_x64: max_ops = 1; break;
case Arch_x86:
case Arch_arm32:
case Arch_arm64: NotImplemented; break;
default: InvalidPath;
}
return max_ops;
}
internal U64
min_instruction_size_from_arch(Arch arch)
{
U64 min_instruction_size = 0;
switch(arch)
{
case Arch_Null: break;
case Arch_x64: min_instruction_size = 1; break;
case Arch_x86:
case Arch_arm32:
case Arch_arm64: NotImplemented; break;
default: InvalidPath;
}
return min_instruction_size;
}
internal U64
max_instruction_size_from_arch(Arch arch)
{
// TODO(rjf): make this real
return 64;
}
////////////////////////////////
//~ rjf: Time Functions
internal DenseTime
dense_time_from_date_time(DateTime date_time){
DenseTime result = 0;
result += date_time.year;
result *= 12;
result += date_time.mon;
result *= 31;
result += date_time.day;
result *= 24;
result += date_time.hour;
result *= 60;
result += date_time.min;
result *= 61;
result += date_time.sec;
result *= 1000;
result += date_time.msec;
return(result);
}
internal DateTime
date_time_from_dense_time(DenseTime time){
DateTime result = {0};
result.msec = time%1000;
time /= 1000;
result.sec = time%61;
time /= 61;
result.min = time%60;
time /= 60;
result.hour = time%24;
time /= 24;
result.day = time%31;
time /= 31;
result.mon = time%12;
time /= 12;
Assert(time <= max_U32);
result.year = (U32)time;
return(result);
}
internal DateTime
date_time_from_micro_seconds(U64 time){
DateTime result = {0};
result.micro_sec = time%1000;
time /= 1000;
result.msec = time%1000;
time /= 1000;
result.sec = time%60;
time /= 60;
result.min = time%60;
time /= 60;
result.hour = time%24;
time /= 24;
result.day = time%31;
time /= 31;
result.mon = time%12;
time /= 12;
Assert(time <= max_U32);
result.year = (U32)time;
return(result);
}
internal DateTime
date_time_from_unix_time(U64 unix_time)
{
DateTime date = {0};
date.year = 1970;
date.day = 1 + (unix_time / 86400);
date.sec = (U32)unix_time % 60;
date.min = (U32)(unix_time / 60) % 60;
date.hour = (U32)(unix_time / 3600) % 24;
for(;;)
{
for(date.month = 0; date.month < 12; ++date.month)
{
U64 c = 0;
switch(date.month)
{
case Month_Jan: c = 31; break;
case Month_Feb:
{
if((date.year % 4 == 0) && ((date.year % 100) != 0 || (date.year % 400) == 0))
{
c = 29;
}
else
{
c = 28;
}
} break;
case Month_Mar: c = 31; break;
case Month_Apr: c = 30; break;
case Month_May: c = 31; break;
case Month_Jun: c = 30; break;
case Month_Jul: c = 31; break;
case Month_Aug: c = 31; break;
case Month_Sep: c = 30; break;
case Month_Oct: c = 31; break;
case Month_Nov: c = 30; break;
case Month_Dec: c = 31; break;
default: InvalidPath;
}
if(date.day <= c)
{
goto exit;
}
date.day -= c;
}
++date.year;
}
exit:;
return date;
}
////////////////////////////////
//~ rjf: Wrapped Ring Buffer Reads/Writes
internal U64
wrapped_write(U8 *ring_base, U64 ring_size, U64 ring_pos, void *src_data, U64 src_data_size)
{
Assert(src_data_size <= ring_size);
{
U64 ring_off = ring_pos%ring_size;
U64 bytes_before_split = ring_size-ring_off;
U64 pre_split_bytes = Min(bytes_before_split, src_data_size);
U64 pst_split_bytes = src_data_size-pre_split_bytes;
void *pre_split_data = src_data;
void *pst_split_data = ((U8 *)src_data + pre_split_bytes);
MemoryCopy(ring_base+ring_off, pre_split_data, pre_split_bytes);
MemoryCopy(ring_base+0, pst_split_data, pst_split_bytes);
}
return src_data_size;
}
internal U64
wrapped_read(U8 *ring_base, U64 ring_size, U64 ring_pos, void *dst_data, U64 read_size)
{
Assert(read_size <= ring_size);
{
U64 ring_off = ring_pos%ring_size;
U64 bytes_before_split = ring_size-ring_off;
U64 pre_split_bytes = Min(bytes_before_split, read_size);
U64 pst_split_bytes = read_size-pre_split_bytes;
MemoryCopy(dst_data, ring_base+ring_off, pre_split_bytes);
MemoryCopy((U8 *)dst_data + pre_split_bytes, ring_base+0, pst_split_bytes);
}
return read_size;
}
////////////////////////////////
internal U64
u64_array_bsearch(U64 *arr, U64 count, U64 value)
{
if(count > 1 && arr[0] <= value && value < arr[count-1])
{
U64 l = 0;
U64 r = count - 1;
for(; l <= r; )
{
U64 m = l + (r - l) / 2;
if(arr[m] == value)
{
return m;
}
else if(arr[m] < value)
{
l = m + 1;
}
else
{
r = m - 1;
}
}
}
else if (count == 1 && arr[0] == value)
{
return 0;
}
return max_U64;
}
////////////////////////////////
internal U32
idx_of_zero_byte64(U8 *ptr, U64 size)
{
Assert(size == 8);
#if ARCH_X64
__m128i v = _mm_loadl_epi64((__m128i*)ptr);
__m128i m = _mm_cmpeq_epi8(v, _mm_setzero_si128());
U32 bits = _mm_movemask_epi8(m);
return ctz32(bits);
#else
U64 x;
MemoryCopyStruct(&x, ptr);
U64 splat = ~0ULL / 255;
U64 mask_lsb = 0x01 * splat;
U64 mask_msb = 0x80 * splat;
U64 t = (x - mask_lsb) & (~x & mask_msb);
return ctz64(t) / 8;
#endif
}
internal U64
index_of_zero_u32(U32 *ptr, U64 count)
{
for (U64 i = 0; i < count; i += 1) {
if (ptr[i] == 0) {
return i;
}
}
return max_U64;
}
internal U64
index_of_zero_u64(U64 *ptr, U64 count)
{
for (U64 i = 0; i < count; i += 1) {
if (ptr[i] == 0) {
return i;
}
}
return max_U64;
}
internal U64
count_digits_u64(U64 v, U64 radix)
{
if (v == 0) { return 1; }
U64 count = 0;
for (U64 x = v; x > 0; x /= radix) { count += 1; }
return count;
}
////////////////////////////////
//~ rjf: Third Party Includes
#if !BUILD_SUPPLEMENTARY_UNIT
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion"
#elif defined(_MSC_VER)
#pragma warning (push, 0)
#endif
# define STB_SPRINTF_IMPLEMENTATION
# define STB_SPRINTF_STATIC
# include "third_party/stb/stb_sprintf.h"
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(_MSC_VER)
#pragma warning (pop, 0)
#endif
////////////////////////////////
//~ rjf: String <-> Integer Tables
read_only global U8 integer_symbols[16] =
{
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',
};
// NOTE(rjf): Includes reverses for uppercase and lowercase hex.
read_only global U8 integer_symbol_reverse[128] =
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
read_only global U8 base64[64] =
{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'_', '$',
};
read_only global U8 base64_reverse[128] =
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0xFF,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,
0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0xFF,0xFF,0xFF,0xFF,0x3E,
0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF,
};
+1135
View File
File diff suppressed because it is too large. Load diff
@@ -1,2 +1,2 @@
// Copyright (c) 2024 Epic Games Tools
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
+20
View File
@@ -0,0 +1,20 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_DYNAMIC_LIBARIES_H
#define BASE_DYNAMIC_LIBARIES_H
typedef struct Library Library;
struct Library
{
U64 u64[1];
};
////////////////////////////////
//~ rjf: @per_os_impl Dynamically-Loaded Libraries
internal Library library_open(String8 path);
internal void library_close(Library lib);
internal VoidProc *library_load_proc(Library lib, String8 name);
#endif // BASE_DYNAMIC_LIBARIES_H
+249
View File
@@ -0,0 +1,249 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
global U64 global_update_tick_idx = 0;
global U64 async_threads_count = 0;
global CondVar async_tick_start_cond_var = {0};
global Mutex async_tick_start_mutex = {0};
global Mutex async_tick_stop_mutex = {0};
global B32 async_loop_again = 0;
global B32 async_loop_again_high_priority = 0;
global B32 global_async_exit = 0;
thread_static B32 is_async_thread = 0;
// NOTE(rjf): defined by target
raddbg_entry_point(entry_point);
internal void entry_point(CmdLine *cmdline);
internal void
main_thread_base_entry_point(int arguments_count, char **arguments)
{
ThreadNameF("main_thread");
Temp scratch = scratch_begin(0, 0);
//- rjf: set up async thread group info
async_tick_start_cond_var = cond_var_alloc();
async_tick_start_mutex = mutex_alloc();
async_tick_stop_mutex = mutex_alloc();
//- rjf: set up telemetry
#if PROFILE_TELEMETRY
local_persist char tm_data[MB(64)];
tmLoadLibrary(TM_RELEASE);
tmSetMaxThreadCount(256);
tmInitialize(sizeof(tm_data), tm_data);
#endif
//- rjf: set up spall
#if PROFILE_SPALL
spall_profile = spall_init_file_ex("spall_capture", 1, 0);
#endif
//- rjf: parse command line
String8List command_line_argument_strings = {0};
{
for EachIndex(idx, arguments_count)
{
str8_list_push(scratch.arena, &command_line_argument_strings, str8_cstring(arguments[idx]));
}
}
CmdLine cmdline = cmd_line_from_string_list(scratch.arena, command_line_argument_strings);
//- rjf: begin captures
B32 capture = cmd_line_has_flag(&cmdline, str8_lit("capture"));
if(capture)
{
ProfBeginCapture(arguments[0]);
ProfMsg(BUILD_TITLE);
}
//- rjf: initialize all included layers
#if defined(HTTP_H) && !defined(HTTP_INIT_MANUAL)
http_init();
#endif
#if defined(SYMBOL_SERVER_H) && !defined(SMSV_INIT_MANUAL)
smsv_init();
#endif
#if defined(ARTIFACT_CACHE_H) && !defined(AC_INIT_MANUAL)
ac_init();
#endif
#if defined(CONTENT_H) && !defined(C_INIT_MANUAL)
c_init();
#endif
#if defined(FILE_STREAM_H) && !defined(FS_INIT_MANUAL)
fs_init();
#endif
#if defined(MUTABLE_TEXT_H) && !defined(MTX_INIT_MANUAL)
mtx_init();
#endif
#if defined(DBG_INFO_H) && !defined(DI_INIT_MANUAL)
di_init(&cmdline);
#endif
#if defined(DEMON_CORE_H) && !defined(DMN_INIT_MANUAL)
dmn_init();
#endif
#if defined(DBG_ENGINE_CORE_H) && !defined(D_INIT_MANUAL)
d_init();
#endif
#if defined(WINDOW_MANAGER_H) && !defined(WM_INIT_MANUAL)
wm_init();
#endif
#if defined(FONT_PROVIDER_H) && !defined(FP_INIT_MANUAL)
fp_init();
#endif
#if defined(RENDER_CORE_H) && !defined(R_INIT_MANUAL)
r_init(&cmdline);
#endif
#if defined(FONT_CACHE_H) && !defined(FNT_INIT_MANUAL)
fnt_init();
#endif
#if defined(RADDBG_CORE_H) && !defined(RD_INIT_MANUAL)
rd_init(&cmdline);
#endif
//- rjf: launch async threads
#if NEED_ASYNC
Thread *async_threads = 0;
U64 lane_broadcast_val = 0;
{
U64 num_main_threads = 1;
#if defined(DBG_ENGINE_CORE_H)
num_main_threads += 1;
#endif
U64 num_async_threads = get_system_info()->logical_processor_count;
U64 num_main_threads_clamped = Min(num_async_threads, num_main_threads);
num_async_threads -= num_main_threads_clamped;
String8 num_async_threads_string = cmd_line_string(&cmdline, str8_lit("async_thread_count"));
if(num_async_threads_string.size != 0)
{
try_u64_from_str8_c_rules(num_async_threads_string, &num_async_threads);
}
num_async_threads = Max(1, num_async_threads);
Barrier barrier = barrier_alloc(num_async_threads);
LaneCtx *lane_ctxs = push_array(scratch.arena, LaneCtx, num_async_threads);
async_threads_count = num_async_threads;
async_threads = push_array(scratch.arena, Thread, async_threads_count);
for EachIndex(idx, num_async_threads)
{
lane_ctxs[idx].lane_idx = idx;
lane_ctxs[idx].lane_count = async_threads_count;
lane_ctxs[idx].barrier = barrier;
lane_ctxs[idx].broadcast_memory = &lane_broadcast_val;
async_threads[idx] = thread_launch(async_thread_entry_point, &lane_ctxs[idx]);
}
}
#endif
//- rjf: call into entry point
entry_point(&cmdline);
//- rjf: join async threads
#if NEED_ASYNC
ins_atomic_u32_inc_eval(&global_async_exit);
ins_atomic_u32_inc_eval(&async_loop_again);
cond_var_broadcast(async_tick_start_cond_var);
for EachIndex(idx, async_threads_count)
{
thread_join(async_threads[idx], max_U64);
}
#endif
//- rjf: end captures
if(capture)
{
ProfEndCapture();
}
scratch_end(scratch);
}
internal void
supplement_thread_base_entry_point(void (*entry_point)(void *params), void *params)
{
TCTX *tctx = tctx_alloc();
tctx_select(tctx);
entry_point(params);
tctx_release(tctx);
}
internal U64
update_tick_idx(void)
{
U64 result = ins_atomic_u64_eval(&global_update_tick_idx);
return result;
}
internal B32
update(void)
{
ProfTick(0);
ins_atomic_u64_inc_eval(&global_update_tick_idx);
#if defined(FONT_CACHE_H)
fnt_frame();
#endif
#if OS_FEATURE_GRAPHICAL
B32 result = frame();
#else
B32 result = 0;
#endif
return result;
}
internal void
async_thread_entry_point(void *params)
{
LaneCtx lctx = *(LaneCtx *)params;
lane_ctx(lctx);
is_async_thread = 1;
ThreadNameF("async_thread_%I64u", lane_idx());
for(;;)
{
// rjf: wait for signal if we need, otherwise reset loop signal & continue
if(lane_idx() == 0)
{
if(!ins_atomic_u32_eval(&async_loop_again))
{
MutexScope(async_tick_start_mutex) cond_var_wait(async_tick_start_cond_var, async_tick_start_mutex, now_time_us()+1000000);
}
ins_atomic_u32_eval_assign(&async_loop_again, 0);
ins_atomic_u32_eval_assign(&async_loop_again_high_priority, 0);
}
lane_sync();
// rjf: do all ticks for all layers
ProfScope("async tick")
{
#if defined(ARTIFACT_CACHE_H)
ac_async_tick();
#endif
#if defined(CONTENT_H)
c_async_tick();
#endif
#if defined(FILE_STREAM_H)
fs_async_tick();
#endif
#if defined(HTTP_H)
http_async_tick();
#endif
#if defined(SYMBOL_SERVER_H)
smsv_async_tick();
#endif
#if defined(DBG_INFO_H)
di_async_tick();
#endif
}
// rjf: take exit signal; break if set
lane_sync();
B32 need_exit = 0;
if(lane_idx() == 0)
{
need_exit = ins_atomic_u32_eval(&global_async_exit);
}
lane_sync_u64(&need_exit, 0);
if(need_exit)
{
break;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_ENTRY_POINT_H
#define BASE_ENTRY_POINT_H
internal void main_thread_base_entry_point(int argc, char **argv);
internal void supplement_thread_base_entry_point(void (*entry_point)(void *params), void *params);
internal U64 update_tick_idx(void);
internal B32 update(void);
internal void async_thread_entry_point(void *params);
#endif // BASE_ENTRY_POINT_H
+169
View File
@@ -0,0 +1,169 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Handle Type Functions
internal File
file_zero(void)
{
File f = {0};
return f;
}
internal B32
file_match(File a, File b)
{
B32 result = MemoryMatchStruct(&a, &b);
return result;
}
////////////////////////////////
//~ rjf: Filesystem Helpers (Helpers, Implemented Once)
internal String8
data_from_file_path(Arena *arena, String8 path)
{
File file = file_open(AccessFlag_Read|AccessFlag_ShareRead, path);
FileProperties props = properties_from_file(file);
String8 data = string_from_file_range(arena, file, r1u64(0, props.size));
file_close(file);
return data;
}
internal B32
write_data_to_file_path(String8 path, String8 data)
{
B32 good = 0;
File file = file_open(AccessFlag_Write, path);
if(!file_match(file, file_zero()))
{
U64 bytes_written = file_write(file, r1u64(0, data.size), data.str);
good = (bytes_written == data.size);
file_close(file);
}
return good;
}
internal B32
write_data_list_to_file_path(String8 path, String8List list)
{
B32 good = 0;
File file = file_open(AccessFlag_Write, path);
if(!file_match(file, file_zero()))
{
Temp scratch = scratch_begin(0, 0);
U64 write_buffer_size = KB(64);
U8 *write_buffer = push_array_no_zero(scratch.arena, U8, write_buffer_size);
U64 write_buffer_write_pos = 0;
U64 write_buffer_read_pos = 0;
U64 file_off = 0;
{
for(String8Node *n = list.first; n != 0; n = n->next)
{
for(U64 n_off = 0; n_off < n->string.size;)
{
U64 write_buffer_unconsumed_size = (write_buffer_write_pos - write_buffer_read_pos);
U64 write_buffer_available_size = (write_buffer_size - write_buffer_unconsumed_size);
if(write_buffer_available_size == 0)
{
U64 file_write_size = file_write(file, r1u64(file_off, file_off+write_buffer_size), write_buffer);
if(file_write_size != write_buffer_size)
{
goto dbl_break;
}
file_off += write_buffer_size;
write_buffer_read_pos += write_buffer_size;
}
else
{
U64 bytes_to_copy = Min(write_buffer_available_size, n->string.size - n_off);
write_buffer_write_pos += wrapped_write(write_buffer, write_buffer_size, write_buffer_write_pos, n->string.str + n_off, bytes_to_copy);
n_off += bytes_to_copy;
}
}
}
if(write_buffer_write_pos > write_buffer_read_pos)
{
U64 file_write_size = file_write(file, r1u64(file_off, file_off + (write_buffer_write_pos-write_buffer_read_pos)), write_buffer);
file_off += file_write_size;
}
}
dbl_break:;
good = (file_off == list.total_size);
file_close(file);
scratch_end(scratch);
}
return good;
}
internal B32
append_data_to_file_path(String8 path, String8 data)
{
B32 good = 0;
if(data.size != 0)
{
File file = file_open(AccessFlag_Write|AccessFlag_Append, path);
if(!file_match(file, file_zero()))
{
U64 pos = properties_from_file(file).size;
U64 bytes_written = file_write(file, r1u64(pos, pos+data.size), data.str);
good = (bytes_written == data.size);
file_close(file);
}
}
return good;
}
internal FileID
id_from_file_path(String8 path)
{
File file = file_open(AccessFlag_Read|AccessFlag_ShareRead, path);
FileID id = id_from_file(file);
file_close(file);
return id;
}
internal S64
file_id_compare(FileID a, FileID b)
{
S64 cmp = MemoryCompare((void*)&a.v[0], (void*)&b.v[0], sizeof(a.v));
return cmp;
}
internal String8
string_from_file_range(Arena *arena, File file, Rng1U64 range)
{
U64 pre_pos = arena_pos(arena);
String8 result;
result.size = dim_1u64(range);
result.str = push_array_no_zero(arena, U8, result.size);
U64 actual_read_size = file_read(file, range, result.str);
if(actual_read_size < result.size)
{
arena_pop_to(arena, pre_pos + actual_read_size);
result.size = actual_read_size;
}
return result;
}
internal String8
file_read_cstring(Arena *arena, File file, U64 off)
{
Temp scratch = scratch_begin(&arena, 1);
String8List block_list = {0};
for(U64 cursor = off, stride = 256;; cursor += stride)
{
U8 *raw_block = push_array_no_zero(scratch.arena, U8, stride);
U64 read_size = file_read(file, r1u64(cursor, cursor + stride), raw_block);
String8 block = str8_cstring_capped(raw_block, raw_block+read_size);
str8_list_push(scratch.arena, &block_list, block);
if(read_size != stride || (block.size+1 <= read_size && block.str[block.size] == 0))
{
break;
}
}
String8 result = str8_list_join(arena, &block_list, 0);
scratch_end(scratch);
return result;
}
+102
View File
@@ -0,0 +1,102 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_FILES_H
#define BASE_FILES_H
typedef U32 FileIterFlags;
enum
{
FileIterFlag_SkipFolders = (1 << 0),
FileIterFlag_SkipFiles = (1 << 1),
FileIterFlag_SkipHiddenFiles = (1 << 2),
FileIterFlag_Done = (1 << 31),
};
typedef struct FileIter FileIter;
struct FileIter
{
FileIterFlags flags;
U8 memory[800];
};
typedef struct FileInfo FileInfo;
struct FileInfo
{
String8 name;
FileProperties props;
};
// nick: on-disk file identifier
typedef struct FileID FileID;
struct FileID
{
U64 v[3];
};
typedef struct File File;
struct File
{
U64 u64[1];
};
typedef struct FileMap FileMap;
struct FileMap
{
U64 u64[1];
};
////////////////////////////////
//~ rjf: Handle Type Functions
internal File file_zero(void);
internal B32 file_match(File a, File b);
////////////////////////////////
//~ rjf: Filesystem Helpers (Helpers, Implemented Once)
internal String8 data_from_file_path(Arena *arena, String8 path);
internal B32 write_data_to_file_path(String8 path, String8 data);
internal B32 write_data_list_to_file_path(String8 path, String8List list);
internal B32 append_data_to_file_path(String8 path, String8 data);
internal FileID id_from_file_path(String8 path);
internal S64 file_id_compare(FileID a, FileID b);
internal String8 string_from_file_range(Arena *arena, File file, Rng1U64 range);
internal String8 file_read_cstring(Arena *arena, File file, U64 off);
////////////////////////////////
//~ rjf: @per_os_impl File System (Implemented Per-OS)
//- rjf: files
internal File file_open(AccessFlags flags, String8 path);
internal void file_close(File file);
internal U64 file_read(File file, Rng1U64 rng, void *out_data);
#define file_read_struct(f, off, ptr) file_read((f), r1u64((off), (off)+sizeof(*(ptr))), (ptr))
internal U64 file_write(File file, Rng1U64 rng, void *data);
internal B32 file_set_times(File file, DateTime time);
internal FileProperties properties_from_file(File file);
internal FileID id_from_file(File file);
internal B32 file_reserve_size(File file, U64 size);
internal B32 delete_file_at_path(String8 path);
internal B32 copy_file_path(String8 dst, String8 src);
internal B32 move_file_path(String8 dst, String8 src);
internal String8 full_path_from_path(Arena *arena, String8 path);
internal B32 file_path_exists(String8 path);
internal B32 folder_path_exists(String8 path);
internal FileProperties properties_from_file_path(String8 path);
//- rjf: file maps
internal FileMap file_map_open(AccessFlags flags, File file);
internal void file_map_close(FileMap map);
internal void * file_map_view_open(FileMap map, AccessFlags flags, Rng1U64 range);
internal void file_map_view_close(FileMap map, void *ptr, Rng1U64 range);
//- rjf: directory iteration
internal FileIter *file_iter_begin(Arena *arena, String8 path, FileIterFlags flags);
internal B32 file_iter_next(Arena *arena, FileIter *iter, FileInfo *info_out);
internal void file_iter_end(FileIter *iter);
//- rjf: directory creation
internal B32 make_directory(String8 path);
#endif // BASE_FILES_H
+50
View File
@@ -0,0 +1,50 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: MD5
#include "third_party/martins_hash/md5.h"
internal MD5
md5_from_data(String8 data)
{
md5_ctx ctx = {0};
md5_init(&ctx);
md5_update(&ctx, (void*)data.str, data.size);
MD5 result = {0};
md5_finish(&ctx, result.u8);
return result;
}
////////////////////////////////
//~ rjf: SHA
#include "third_party/martins_hash/sha1.h"
#include "third_party/martins_hash/sha256.h"
internal SHA1
sha1_from_data(String8 data)
{
SHA1 result = {0};
{
sha1_ctx ctx = {0};
sha1_init(&ctx);
sha1_update(&ctx, data.str, data.size);
sha1_finish(&ctx, result.u8);
}
return result;
}
internal SHA256
sha256_from_data(String8 data)
{
SHA256 result = {0};
{
sha256_ctx ctx = {0};
sha256_init(&ctx);
sha256_update(&ctx, data.str, data.size);
sha256_finish(&ctx, result.u8);
}
return result;
}
+48
View File
@@ -0,0 +1,48 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_HASH_H
#define BASE_HASH_H
////////////////////////////////
//~ rjf: Hash Result Types
typedef union MD5 MD5;
union MD5
{
U8 u8[16];
U16 u16[8];
U32 u32[4];
U64 u64[2];
U128 u128;
};
typedef union SHA1 SHA1;
union SHA1
{
U8 u8[20];
};
typedef union SHA256 SHA256;
union SHA256
{
U8 u8[32];
U16 u16[16];
U32 u32[8];
U64 u64[4];
U128 u128[2];
U256 u256;
};
////////////////////////////////
//~ rjf: MD5
internal MD5 md5_from_data(String8 data);
////////////////////////////////
//~ rjf: SHA
internal SHA1 sha1_from_data(String8 data);
internal SHA256 sha256_from_data(String8 data);
#endif // BASE_HASH_H
+39 -18
View File
@@ -1,18 +1,39 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Base Includes
#undef RADDBG_LAYER_COLOR
#define RADDBG_LAYER_COLOR 0.20f, 0.60f, 0.80f
#include "base_types.c"
#include "base_markup.c"
#include "base_arena.c"
#include "base_math.c"
#include "base_string.c"
#include "base_thread_context.c"
#include "base_command_line.c"
#include "base_arena_dev.c"
#include "base_bits.c"
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Base Includes
#undef LAYER_COLOR
#define LAYER_COLOR 0x3399ccff
#include "base_core.c"
#include "base_profile.c"
#include "base_memory.c"
#include "base_arena.c"
#include "base_math.c"
#include "base_strings.c"
#include "base_memory_map.c"
#include "base_hash.c"
#include "base_system.c"
#include "base_threads.c"
#include "base_ring.c"
#include "base_thread_context.c"
#include "base_files.c"
#include "base_shared_memory.c"
#include "base_processes.c"
#include "base_dynamic_libraries.c"
#include "base_command_line.c"
#include "base_markup.c"
#include "base_meta.c"
#include "base_log.c"
#include "base_test.c"
#include "base_entry_point.c"
#if OS_WINDOWS
# include "win32/base/win32_base.c"
#elif OS_LINUX
# include "linux/base/linux_base.c"
#else
# error Operating system backend not found for base layer.
#endif
+43 -23
View File
@@ -1,23 +1,43 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_INC_H
#define BASE_INC_H
////////////////////////////////
//~ rjf: Base Includes
#include "base_context_cracking.h"
#include "base_types.h"
#include "base_markup.h"
#include "base_ins.h"
#include "base_linked_lists.h"
#include "base_arena.h"
#include "base_math.h"
#include "base_string.h"
#include "base_thread_context.h"
#include "base_command_line.h"
#include "base_arena_dev.h"
#include "base_bits.h"
#endif // BASE_INC_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_INC_H
#define BASE_INC_H
////////////////////////////////
//~ rjf: Base Includes
#include "base_context_cracking.h"
#include "base_core.h"
#include "base_profile.h"
#include "base_memory.h"
#include "base_arena.h"
#include "base_math.h"
#include "base_strings.h"
#include "base_memory_map.h"
#include "base_hash.h"
#include "base_system.h"
#include "base_threads.h"
#include "base_ring.h"
#include "base_thread_context.h"
#include "base_files.h"
#include "base_shared_memory.h"
#include "base_processes.h"
#include "base_dynamic_libraries.h"
#include "base_command_line.h"
#include "base_markup.h"
#include "base_meta.h"
#include "base_log.h"
#include "base_test.h"
#include "base_entry_point.h"
#if OS_WINDOWS
# include "win32/base/win32_base.h"
#elif OS_LINUX
# include "linux/base/linux_base.h"
#else
# error Operating system backend not found for base layer.
#endif
#endif // BASE_INC_H
-52
View File
@@ -1,52 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_INS_H
#define BASE_INS_H
////////////////////////////////
// NOTE(allen): Implementations of Intrinsics
#if OS_WINDOWS
# include <windows.h>
# include <tmmintrin.h>
# include <wmmintrin.h>
# include <intrin.h>
# if ARCH_X64
# define ins_atomic_u64_eval(x) InterlockedAdd((volatile LONG *)(x), 0)
# define ins_atomic_u64_inc_eval(x) InterlockedIncrement64((volatile __int64 *)(x))
# define ins_atomic_u64_dec_eval(x) InterlockedDecrement64((volatile __int64 *)(x))
# define ins_atomic_u64_eval_assign(x,c) InterlockedExchange64((volatile __int64 *)(x),(c))
# define ins_atomic_u64_add_eval(x,c) InterlockedAdd((volatile LONG *)(x), c)
# define ins_atomic_u32_eval_assign(x,c) InterlockedExchange((volatile LONG *)(x),(c))
# define ins_atomic_u32_eval_cond_assign(x,k,c) InterlockedCompareExchange((volatile LONG *)(x),(k),(c))
# define ins_atomic_ptr_eval_assign(x,c) (void*)ins_atomic_u64_eval_assign((volatile __int64 *)(x), (__int64)(c))
# endif
#elif OS_LINUX
# if ARCH_X64
# define ins_atomic_u64_inc_eval(x) __sync_fetch_and_add((volatile U64 *)(x), 1)
# endif
#else
// TODO(allen):
#endif
////////////////////////////////
// NOTE(allen): Intrinsic Checks
#if ARCH_X64
# if !defined(ins_atomic_u64_inc_eval)
# error missing: ins_atomic_u64_inc_eval
# endif
#else
# error the intrinsic set for this arch is not developed
#endif
#endif //BASE_INS_H
-73
View File
@@ -1,73 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_LINKED_LIST_H
#define BASE_LINKED_LIST_H
////////////////////////////////
//~ rjf: Helpers
#define CheckNil(nil,p) ((p) == 0 || (p) == nil)
#define SetNil(nil,p) ((p) = nil)
////////////////////////////////
//~ rjf: Base Macros
//- rjf: Base Doubly-Linked-List Macros
#define DLLInsert_NPZ(nil,f,l,p,n,next,prev) (CheckNil(nil,f) ? \
((f) = (l) = (n), SetNil(nil,(n)->next), SetNil(nil,(n)->prev)) :\
CheckNil(nil,p) ? \
((n)->next = (f), (f)->prev = (n), (f) = (n), SetNil(nil,(n)->prev)) :\
((p)==(l)) ? \
((l)->next = (n), (n)->prev = (l), (l) = (n), SetNil(nil, (n)->next)) :\
(((!CheckNil(nil,p) && CheckNil(nil,(p)->next)) ? (0) : ((p)->next->prev = (n))), ((n)->next = (p)->next), ((p)->next = (n)), ((n)->prev = (p))))
#define DLLPushBack_NPZ(nil,f,l,n,next,prev) DLLInsert_NPZ(nil,f,l,l,n,next,prev)
#define DLLPushFront_NPZ(nil,f,l,n,next,prev) DLLInsert_NPZ(nil,l,f,f,n,prev,next)
#define DLLRemove_NPZ(nil,f,l,n,next,prev) (((n) == (f) ? (f) = (n)->next : (0)),\
((n) == (l) ? (l) = (l)->prev : (0)),\
(CheckNil(nil,(n)->prev) ? (0) :\
((n)->prev->next = (n)->next)),\
(CheckNil(nil,(n)->next) ? (0) :\
((n)->next->prev = (n)->prev)))
//- rjf: Base Singly-Linked-List Queue Macros
#define SLLQueuePush_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
((f)=(l)=(n),SetNil(nil,(n)->next)):\
((l)->next=(n),(l)=(n),SetNil(nil,(n)->next)))
#define SLLQueuePushFront_NZ(nil,f,l,n,next) (CheckNil(nil,f)?\
((f)=(l)=(n),SetNil(nil,(n)->next)):\
((n)->next=(f),(f)=(n)))
#define SLLQueuePop_NZ(nil,f,l,next) ((f)==(l)?\
(SetNil(nil,f),SetNil(nil,l)):\
((f)=(f)->next))
//- rjf: Base Singly-Linked-List Stack Macros
#define SLLStackPush_N(f,n,next) ((n)->next=(f), (f)=(n))
#define SLLStackPop_N(f,next) ((f)=(f)->next)
////////////////////////////////
//~ rjf: Convenience Wrappers
//- rjf: Doubly-Linked-List Wrappers
#define DLLInsert_NP(f,l,p,n,next,prev) DLLInsert_NPZ(0,f,l,p,n,next,prev)
#define DLLPushBack_NP(f,l,n,next,prev) DLLPushBack_NPZ(0,f,l,n,next,prev)
#define DLLPushFront_NP(f,l,n,next,prev) DLLPushFront_NPZ(0,f,l,n,next,prev)
#define DLLRemove_NP(f,l,n,next,prev) DLLRemove_NPZ(0,f,l,n,next,prev)
#define DLLInsert(f,l,p,n) DLLInsert_NPZ(0,f,l,p,n,next,prev)
#define DLLPushBack(f,l,n) DLLPushBack_NPZ(0,f,l,n,next,prev)
#define DLLPushFront(f,l,n) DLLPushFront_NPZ(0,f,l,n,next,prev)
#define DLLRemove(f,l,n) DLLRemove_NPZ(0,f,l,n,next,prev)
//- rjf: Singly-Linked-List Queue Wrappers
#define SLLQueuePush_N(f,l,n,next) SLLQueuePush_NZ(0,f,l,n,next)
#define SLLQueuePushFront_N(f,l,n,next) SLLQueuePushFront_NZ(0,f,l,n,next)
#define SLLQueuePop_N(f,l,next) SLLQueuePop_NZ(0,f,l,next)
#define SLLQueuePush(f,l,n) SLLQueuePush_NZ(0,f,l,n,next)
#define SLLQueuePushFront(f,l,n) SLLQueuePushFront_NZ(0,f,l,n,next)
#define SLLQueuePop(f,l) SLLQueuePop_NZ(0,f,l,next)
//- rjf: Singly-Linked-List Stack Wrappers
#define SLLStackPush(f,n) SLLStackPush_N(f,n,next)
#define SLLStackPop(f) SLLStackPop_N(f,next)
#endif //BASE_LINKED_LIST_H
+105
View File
@@ -0,0 +1,105 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Globals/Thread-Locals
C_LINKAGE thread_static Log *log_active;
#if !BUILD_SUPPLEMENTARY_UNIT
C_LINKAGE thread_static Log *log_active = 0;
#endif
String8 g_logs_folder;
////////////////////////////////
//~ rjf: Log Creation/Selection
internal Log *
log_alloc(void)
{
Arena *arena = arena_alloc();
Log *log = push_array(arena, Log, 1);
log->arena = arena;
return log;
}
internal void
log_release(Log *log)
{
arena_release(log->arena);
}
internal void
log_select(Log *log)
{
log_active = log;
}
////////////////////////////////
//~ rjf: Log Building/Clearing
internal void
log_msg(LogMsgKind kind, String8 string)
{
if(log_active != 0 && log_active->top_scope != 0)
{
String8 string_copy = push_str8_copy(log_active->arena, string);
str8_list_push(log_active->arena, &log_active->top_scope->strings[kind], string_copy);
}
}
internal void
log_msgf(LogMsgKind kind, char *fmt, ...)
{
if(log_active != 0)
{
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 string = push_str8fv(scratch.arena, fmt, args);
log_msg(kind, string);
va_end(args);
scratch_end(scratch);
}
}
////////////////////////////////
//~ rjf: Log Scopes
internal void
log_scope_begin(void)
{
if(log_active != 0)
{
U64 pos = arena_pos(log_active->arena);
LogScope *scope = push_array(log_active->arena, LogScope, 1);
scope->pos = pos;
SLLStackPush(log_active->top_scope, scope);
}
}
internal LogScopeResult
log_scope_end(Arena *arena)
{
LogScopeResult result = {0};
if(log_active != 0)
{
LogScope *scope = log_active->top_scope;
if(scope != 0)
{
SLLStackPop(log_active->top_scope);
if(arena != 0)
{
for EachEnumVal(LogMsgKind, kind)
{
Temp scratch = scratch_begin(&arena, 1);
String8 result_unindented = str8_list_join(scratch.arena, &scope->strings[kind], 0);
result.strings[kind] = indented_from_string(arena, result_unindented);
scratch_end(scratch);
}
}
arena_pop_to(log_active->arena, scope->pos);
}
}
return result;
}
+70
View File
@@ -0,0 +1,70 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_LOG_H
#define BASE_LOG_H
////////////////////////////////
//~ rjf: Log Types
typedef enum LogMsgKind
{
LogMsgKind_Info,
LogMsgKind_UserError,
LogMsgKind_COUNT
}
LogMsgKind;
typedef struct LogScope LogScope;
struct LogScope
{
LogScope *next;
U64 pos;
String8List strings[LogMsgKind_COUNT];
};
typedef struct LogScopeResult LogScopeResult;
struct LogScopeResult
{
String8 strings[LogMsgKind_COUNT];
};
typedef struct Log Log;
struct Log
{
Arena *arena;
LogScope *top_scope;
};
////////////////////////////////
// Globals
extern String8 g_logs_folder;
////////////////////////////////
//~ rjf: Log Creation/Selection
internal Log *log_alloc(void);
internal void log_release(Log *log);
internal void log_select(Log *log);
////////////////////////////////
//~ rjf: Log Building
internal void log_msg(LogMsgKind kind, String8 string);
internal void log_msgf(LogMsgKind kind, char *fmt, ...);
#define log_info(s) log_msg(LogMsgKind_Info, (s))
#define log_infof(...) log_msgf(LogMsgKind_Info, __VA_ARGS__)
#define log_user_error(s) log_msg(LogMsgKind_UserError, (s))
#define log_user_errorf(...) log_msgf(LogMsgKind_UserError, __VA_ARGS__)
#define LogInfoNamedBlock(s) DeferLoop(log_infof("%S:\n{\n", (s)), log_infof("}\n"))
#define LogInfoNamedBlockF(...) DeferLoop((log_infof(__VA_ARGS__), log_infof(":\n{\n")), log_infof("}\n"))
////////////////////////////////
//~ rjf: Log Scopes
internal void log_scope_begin(void);
internal LogScopeResult log_scope_end(Arena *arena);
#endif // BASE_LOG_H
+2 -2
View File
@@ -1,2 +1,2 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
+20 -79
View File
@@ -1,79 +1,20 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_MARKUP_H
#define BASE_MARKUP_H
////////////////////////////////
//~ rjf: Zero Settings
#if !defined(PROFILE_TELEMETRY)
# define PROFILE_TELEMETRY 0
#endif
#if !defined(MARKUP_LAYER_COLOR)
# define MARKUP_LAYER_COLOR 1.00f, 0.00f, 1.00f
#endif
////////////////////////////////
//~ rjf: Third Party Includes
#if PROFILE_TELEMETRY
# include "rad_tm.h"
# if OS_WINDOWS
# pragma comment(lib, "rad_tm_win64.lib")
# endif
#endif
////////////////////////////////
//~ rjf: Telemetry Profile Defines
#if PROFILE_TELEMETRY
# define ProfBegin(...) tmEnter(0, 0, __VA_ARGS__)
# define ProfBeginDynamic(...) (TM_API_PTR ? TM_API_PTR->_tmEnterZoneV_Core(0, 0, __FILE__, &g_telemetry_filename_id, __LINE__, __VA_ARGS__) : (void)0)
# define ProfEnd(...) (TM_API_PTR ? TM_API_PTR->_tmLeaveZone(0) : (void)0)
# define ProfTick(...) tmTick(0)
# define ProfIsCapturing(...) tmRunning()
# define ProfBeginCapture(...) tmOpen(0, __VA_ARGS__, __DATE__, "localhost", TMCT_TCP, TELEMETRY_DEFAULT_PORT, TMOF_INIT_NETWORKING|TMOF_CAPTURE_CONTEXT_SWITCHES, 100)
# define ProfEndCapture(...) tmClose(0)
# define ProfThreadName(...) (TM_API_PTR ? TM_API_PTR->_tmThreadName(0, 0, __VA_ARGS__) : (void)0)
# define ProfMsg(...) (TM_API_PTR ? TM_API_PTR->_tmMessageV_Core(0, TMMF_ICON_NOTE, __FILE__, &g_telemetry_filename_id, __LINE__, __VA_ARGS__) : (void)0)
# define ProfBeginLockWait(...) tmStartWaitForLock(0, 0, __VA_ARGS__)
# define ProfEndLockWait(...) tmEndWaitForLock(0)
# define ProfLockTake(...) tmAcquiredLock(0, 0, __VA_ARGS__)
# define ProfLockDrop(...) tmReleasedLock(0, __VA_ARGS__)
# define ProfColor(color) tmZoneColorSticky(color)
#endif
////////////////////////////////
//~ rjf: Zeroify Undefined Defines
#if !defined(ProfBegin)
# define ProfBegin(...) (0)
# define ProfBeginDynamic(...) (0)
# define ProfEnd(...) (0)
# define ProfTick(...) (0)
# define ProfIsCapturing(...) (0)
# define ProfBeginCapture(...) (0)
# define ProfEndCapture(...) (0)
# define ProfThreadName(...) (0)
# define ProfMsg(...) (0)
# define ProfBeginLockWait(...) (0)
# define ProfEndLockWait(...) (0)
# define ProfLockTake(...) (0)
# define ProfLockDrop(...) (0)
# define ProfColor(...) (0)
#endif
////////////////////////////////
//~ rjf: Helper Wrappers
#define ProfBeginFunction(...) ProfBegin(this_function_name)
#define ProfScope(...) DeferLoop(ProfBeginDynamic(__VA_ARGS__), ProfEnd())
////////////////////////////////
//~ rjf: General Markup
#define ThreadName(...) (ProfThreadName(__VA_ARGS__))
#endif // BASE_MARKUP_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_MARKUP_H
#define BASE_MARKUP_H
#define RADDBG_MARKUP_IMPLEMENTATION
#define RADDBG_MARKUP_VSNPRINTF raddbg_vsnprintf
#if OS_LINUX
# define RADDBG_MARKUP_STUBS
#endif
#include "lib_raddbg_markup/raddbg_markup.h"
#if !defined(LAYER_COLOR)
# define LAYER_COLOR 0x404040ff
#endif
#define ThreadNameF(...) (set_thread_namef(__VA_ARGS__), raddbg_thread_color_u32(LAYER_COLOR))
#endif // BASE_MARKUP_H
+849 -607
View File
File diff suppressed because it is too large. Load diff
+118 -16
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2024 Epic Games Tools
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_MATH_H
@@ -177,6 +177,28 @@ struct Mat4x4F32
//- rjf: 1-range
typedef union Rng1U8 Rng1U8;
union Rng1U8
{
struct
{
U8 min;
U8 max;
};
U8 v[2];
};
typedef union Rng1U16 Rng1U16;
union Rng1U16
{
struct
{
U16 min;
U16 max;
};
U16 v[2];
};
typedef union Rng1U32 Rng1U32;
union Rng1U32
{
@@ -327,7 +349,29 @@ union Rng2S64
};
////////////////////////////////
//~ rjf: List Types
//~ rjf: Range List Types
typedef struct Rng1U64Node Rng1U64Node;
struct Rng1U64Node
{
Rng1U64Node *next;
Rng1U64 v;
};
typedef struct Rng1U64List Rng1U64List;
struct Rng1U64List
{
Rng1U64Node *first;
Rng1U64Node *last;
U64 count;
};
typedef struct Rng1U64Array Rng1U64Array;
struct Rng1U64Array
{
Rng1U64 *v;
U64 count;
};
typedef struct Rng1S64Node Rng1S64Node;
struct Rng1S64Node
@@ -352,19 +396,20 @@ struct Rng1S64Array
};
////////////////////////////////
//~ rjf: Scalar Ops
//~ rjf: Scalar Math Ops
#define abs_s64(v) (S64)llabs(v)
#define sqrt_f32(v) sqrtf(v)
#define cbrt_f32(v) cbrtf(v)
#define mod_f32(a, b) fmodf((a), (b))
#define pow_f32(b, e) powf((b), (e))
#define ceil_f32(v) ceilf(v)
#define floor_f32(v) floorf(v)
#define round_f32(v) roundf(v)
#define abs_f32(v) fabsf(v)
#define radians_from_turns_f32(v) ((v)*2*3.1415926535897f)
#define turns_from_radians_f32(v) ((v)/2*3.1415926535897f)
#define radians_from_turns_f32(v) ((v)*(2*3.1415926535897f))
#define turns_from_radians_f32(v) ((v)/(2*3.1415926535897f))
#define degrees_from_turns_f32(v) ((v)*360.f)
#define turns_from_degrees_f32(v) ((v)/360.f)
#define degrees_from_radians_f32(v) (degrees_from_turns_f32(turns_from_radians_f32(v)))
@@ -374,14 +419,15 @@ struct Rng1S64Array
#define tan_f32(v) tanf(radians_from_turns_f32(v))
#define sqrt_f64(v) sqrt(v)
#define cbrt_f64(v) cbrt(v)
#define mod_f64(a, b) fmod((a), (b))
#define pow_f64(b, e) pow((b), (e))
#define ceil_f64(v) ceil(v)
#define floor_f64(v) floor(v)
#define round_f64(v) round(v)
#define abs_f64(v) fabs(v)
#define radians_from_turns_f64(v) ((v)*2*3.1415926535897)
#define turns_from_radians_f64(v) ((v)/2*3.1415926535897)
#define radians_from_turns_f64(v) ((v)*(2*3.1415926535897))
#define turns_from_radians_f64(v) ((v)/(2*3.1415926535897))
#define degrees_from_turns_f64(v) ((v)*360.0)
#define turns_from_degrees_f64(v) ((v)/360.0)
#define degrees_from_radians_f64(v) (degrees_from_turns_f64(turns_from_radians_f64(v)))
@@ -419,7 +465,6 @@ internal Vec2S64 scale_2s64(Vec2S64 v, S64 s);
internal S64 dot_2s64(Vec2S64 a, Vec2S64 b);
internal S64 length_squared_2s64(Vec2S64 v);
internal S64 length_2s64(Vec2S64 v);
internal Vec2S64 normalize_2s64(Vec2S64 v);
internal Vec2S64 mix_2s64(Vec2S64 a, Vec2S64 b, F32 t);
#define v2s32(x, y) vec_2s32((x), (y))
@@ -432,7 +477,6 @@ internal Vec2S32 scale_2s32(Vec2S32 v, S32 s);
internal S32 dot_2s32(Vec2S32 a, Vec2S32 b);
internal S32 length_squared_2s32(Vec2S32 v);
internal S32 length_2s32(Vec2S32 v);
internal Vec2S32 normalize_2s32(Vec2S32 v);
internal Vec2S32 mix_2s32(Vec2S32 a, Vec2S32 b, F32 t);
#define v2s16(x, y) vec_2s16((x), (y))
@@ -445,7 +489,6 @@ internal Vec2S16 scale_2s16(Vec2S16 v, S16 s);
internal S16 dot_2s16(Vec2S16 a, Vec2S16 b);
internal S16 length_squared_2s16(Vec2S16 v);
internal S16 length_2s16(Vec2S16 v);
internal Vec2S16 normalize_2s16(Vec2S16 v);
internal Vec2S16 mix_2s16(Vec2S16 a, Vec2S16 b, F32 t);
#define v3f32(x, y, z) vec_3f32((x), (y), (z))
@@ -461,6 +504,7 @@ internal F32 length_3f32(Vec3F32 v);
internal Vec3F32 normalize_3f32(Vec3F32 v);
internal Vec3F32 mix_3f32(Vec3F32 a, Vec3F32 b, F32 t);
internal Vec3F32 cross_3f32(Vec3F32 a, Vec3F32 b);
internal Vec3F32 xform_3f32(Vec3F32 v, Mat3x3F32 m);
#define v3s32(x, y, z) vec_3s32((x), (y), (z))
internal Vec3S32 vec_3s32(S32 x, S32 y, S32 z);
@@ -472,7 +516,6 @@ internal Vec3S32 scale_3s32(Vec3S32 v, S32 s);
internal S32 dot_3s32(Vec3S32 a, Vec3S32 b);
internal S32 length_squared_3s32(Vec3S32 v);
internal S32 length_3s32(Vec3S32 v);
internal Vec3S32 normalize_3s32(Vec3S32 v);
internal Vec3S32 mix_3s32(Vec3S32 a, Vec3S32 b, F32 t);
internal Vec3S32 cross_3s32(Vec3S32 a, Vec3S32 b);
@@ -499,7 +542,6 @@ internal Vec4S32 scale_4s32(Vec4S32 v, S32 s);
internal S32 dot_4s32(Vec4S32 a, Vec4S32 b);
internal S32 length_squared_4s32(Vec4S32 v);
internal S32 length_4s32(Vec4S32 v);
internal Vec4S32 normalize_4s32(Vec4S32 v);
internal Vec4S32 mix_4s32(Vec4S32 a, Vec4S32 b, F32 t);
////////////////////////////////
@@ -507,6 +549,7 @@ internal Vec4S32 mix_4s32(Vec4S32 a, Vec4S32 b, F32 t);
internal Mat3x3F32 mat_3x3f32(F32 diagonal);
internal Mat3x3F32 make_translate_3x3f32(Vec2F32 delta);
internal Mat3x3F32 make_scale_3x3f32(Vec2F32 scale);
internal Mat3x3F32 mul_3x3f32(Mat3x3F32 a, Mat3x3F32 b);
internal Mat4x4F32 mat_4x4f32(F32 diagonal);
@@ -520,11 +563,37 @@ internal Mat4x4F32 mul_4x4f32(Mat4x4F32 a, Mat4x4F32 b);
internal Mat4x4F32 scale_4x4f32(Mat4x4F32 m, F32 scale);
internal Mat4x4F32 inverse_4x4f32(Mat4x4F32 m);
internal Mat4x4F32 derotate_4x4f32(Mat4x4F32 mat);
internal Mat4x4F32 transpose_4x4f32(Mat4x4F32 mat);
////////////////////////////////
//~ rjf: Range Ops
#define r1u8(min, max) rng_1u8((min), (max))
#define r1u8s(min, size) rng_1u8((min), (min)+(size))
internal Rng1U8 rng_1u8(U8 min, U8 max);
internal Rng1U8 shift_1u8(Rng1U8 r, U8 x);
internal Rng1U8 pad_1u8(Rng1U8 r, U8 x);
internal U8 center_1u8(Rng1U8 r);
internal B32 contains_1u8(Rng1U8 r, U8 x);
internal U8 dim_1u8(Rng1U8 r);
internal Rng1U8 union_1u8(Rng1U8 a, Rng1U8 b);
internal Rng1U8 intersect_1u8(Rng1U8 a, Rng1U8 b);
internal U8 clamp_1u8(Rng1U8 r, U8 v);
#define r1u16(min, max) rng_1u16((min), (max))
#define r1u16s(min, size) rng_1u16((min), (min)+(size))
internal Rng1U16 rng_1u16(U16 min, U16 max);
internal Rng1U16 shift_1u16(Rng1U16 r, U16 x);
internal Rng1U16 pad_1u16(Rng1U16 r, U16 x);
internal U16 center_1u16(Rng1U16 r);
internal B32 contains_1u16(Rng1U16 r, U16 x);
internal U16 dim_1u16(Rng1U16 r);
internal Rng1U16 union_1u16(Rng1U16 a, Rng1U16 b);
internal Rng1U16 intersect_1u16(Rng1U16 a, Rng1U16 b);
internal U16 clamp_1u16(Rng1U16 r, U16 v);
#define r1u32(min, max) rng_1u32((min), (max))
#define r1u32s(min, size) rng_1u32((min), (min)+(size))
internal Rng1U32 rng_1u32(U32 min, U32 max);
internal Rng1U32 shift_1u32(Rng1U32 r, U32 x);
internal Rng1U32 pad_1u32(Rng1U32 r, U32 x);
@@ -536,6 +605,7 @@ internal Rng1U32 intersect_1u32(Rng1U32 a, Rng1U32 b);
internal U32 clamp_1u32(Rng1U32 r, U32 v);
#define r1s32(min, max) rng_1s32((min), (max))
#define r1s32s(min,size) rng_1s32((min), (min)+(size))
internal Rng1S32 rng_1s32(S32 min, S32 max);
internal Rng1S32 shift_1s32(Rng1S32 r, S32 x);
internal Rng1S32 pad_1s32(Rng1S32 r, S32 x);
@@ -547,6 +617,7 @@ internal Rng1S32 intersect_1s32(Rng1S32 a, Rng1S32 b);
internal S32 clamp_1s32(Rng1S32 r, S32 v);
#define r1u64(min, max) rng_1u64((min), (max))
#define r1u64s(min, size) rng_1u64((min), (min)+(size))
internal Rng1U64 rng_1u64(U64 min, U64 max);
internal Rng1U64 shift_1u64(Rng1U64 r, U64 x);
internal Rng1U64 pad_1u64(Rng1U64 r, U64 x);
@@ -558,6 +629,7 @@ internal Rng1U64 intersect_1u64(Rng1U64 a, Rng1U64 b);
internal U64 clamp_1u64(Rng1U64 r, U64 v);
#define r1s64(min, max) rng_1s64((min), (max))
#define r1s64s(min, size) rng_1s64((min), (min)+(size))
internal Rng1S64 rng_1s64(S64 min, S64 max);
internal Rng1S64 shift_1s64(Rng1S64 r, S64 x);
internal Rng1S64 pad_1s64(Rng1S64 r, S64 x);
@@ -569,6 +641,7 @@ internal Rng1S64 intersect_1s64(Rng1S64 a, Rng1S64 b);
internal S64 clamp_1s64(Rng1S64 r, S64 v);
#define r1f32(min, max) rng_1f32((min), (max))
#define r1f32s(min, size) rng_1f32((min), (min)+(size))
internal Rng1F32 rng_1f32(F32 min, F32 max);
internal Rng1F32 shift_1f32(Rng1F32 r, F32 x);
internal Rng1F32 pad_1f32(Rng1F32 r, F32 x);
@@ -580,6 +653,7 @@ internal Rng1F32 intersect_1f32(Rng1F32 a, Rng1F32 b);
internal F32 clamp_1f32(Rng1F32 r, F32 v);
#define r2s16(min, max) rng_2s16((min), (max))
#define r2s16s(min, size) r2s16((min), (min)+(size))
#define r2s16p(x, y, z, w) r2s16(v2s16((x), (y)), v2s16((z), (w)))
internal Rng2S16 rng_2s16(Vec2S16 min, Vec2S16 max);
internal Rng2S16 shift_2s16(Rng2S16 r, Vec2S16 x);
@@ -592,6 +666,7 @@ internal Rng2S16 intersect_2s16(Rng2S16 a, Rng2S16 b);
internal Vec2S16 clamp_2s16(Rng2S16 r, Vec2S16 v);
#define r2s32(min, max) rng_2s32((min), (max))
#define r2s32s(min, size) r2s32((min), (min)+(size))
#define r2s32p(x, y, z, w) r2s32(v2s32((x), (y)), v2s32((z), (w)))
internal Rng2S32 rng_2s32(Vec2S32 min, Vec2S32 max);
internal Rng2S32 shift_2s32(Rng2S32 r, Vec2S32 x);
@@ -604,6 +679,7 @@ internal Rng2S32 intersect_2s32(Rng2S32 a, Rng2S32 b);
internal Vec2S32 clamp_2s32(Rng2S32 r, Vec2S32 v);
#define r2s64(min, max) rng_2s64((min), (max))
#define r2s64s(min, size) r2s64((min), (min)+(size))
#define r2s64p(x, y, z, w) r2s64(v2s64((x), (y)), v2s64((z), (w)))
internal Rng2S64 rng_2s64(Vec2S64 min, Vec2S64 max);
internal Rng2S64 shift_2s64(Rng2S64 r, Vec2S64 x);
@@ -616,6 +692,7 @@ internal Rng2S64 intersect_2s64(Rng2S64 a, Rng2S64 b);
internal Vec2S64 clamp_2s64(Rng2S64 r, Vec2S64 v);
#define r2f32(min, max) rng_2f32((min), (max))
#define r2f32s(min, size) r2f32((min), (min)+(size))
#define r2f32p(x, y, z, w) r2f32(v2f32((x), (y)), v2f32((z), (w)))
internal Rng2F32 rng_2f32(Vec2F32 min, Vec2F32 max);
internal Rng2F32 shift_2f32(Rng2F32 r, Vec2F32 x);
@@ -628,21 +705,46 @@ internal Rng2F32 intersect_2f32(Rng2F32 a, Rng2F32 b);
internal Vec2F32 clamp_2f32(Rng2F32 r, Vec2F32 v);
////////////////////////////////
//~ rjf: Miscellaneous Ops
//~ rjf: Color Operations
//- rjf: hsv <-> rgb
internal Vec3F32 hsv_from_rgb(Vec3F32 rgb);
internal Vec3F32 rgb_from_hsv(Vec3F32 hsv);
internal Vec4F32 hsva_from_rgba(Vec4F32 rgba);
internal Vec4F32 rgba_from_hsva(Vec4F32 hsva);
internal Vec4F32 rgba_from_u32(U32 hex);
internal U32 u32_from_rgba(Vec4F32 rgba);
//- rjf: srgb <-> linear
internal Vec3F32 linear_from_srgb(Vec3F32 srgb);
internal Vec3F32 srgb_from_linear(Vec3F32 linear);
internal Vec4F32 linear_from_srgba(Vec4F32 srgba);
internal Vec4F32 srgba_from_linear(Vec4F32 linear);
//- rjf: oklab <-> linear
internal Vec3F32 oklab_from_linear(Vec3F32 linear);
internal Vec3F32 linear_from_oklab(Vec3F32 oklab);
internal Vec4F32 oklab_from_lineara(Vec4F32 lineara);
internal Vec4F32 lineara_from_oklab(Vec4F32 oklab);
//- rjf: rgba <-> u32
internal U32 u32_from_rgba(Vec4F32 rgba);
internal Vec4F32 rgba_from_u32(U32 hex);
#define rgba_from_u32_lit_comp(h) { (((h)&0xff000000)>>24)/255.f, (((h)&0x00ff0000)>>16)/255.f, (((h)&0x0000ff00)>> 8)/255.f, (((h)&0x000000ff)>> 0)/255.f }
////////////////////////////////
//~ rjf: List Type Functions
internal void rng1u64_list_push_node(Rng1U64List *list, Rng1U64Node *n);
internal Rng1U64Node * rng1u64_list_push(Arena *arena, Rng1U64List *list, Rng1U64 rng);
internal void rng1u64_list_concat(Rng1U64List *list, Rng1U64List *to_concat);
internal Rng1U64Array rng1u64_array_from_list(Arena *arena, Rng1U64List *list);
internal U64 rng1u64_array_num_from_value__binary_search(Rng1U64Array *array, U64 value);
internal void rng1s64_list_push(Arena *arena, Rng1S64List *list, Rng1S64 rng);
internal Rng1S64Array rng1s64_array_from_list(Arena *arena, Rng1S64List *list);
#endif // BASE_MATH_H
////////////////////////////////
//~ rjf: N -> M Element Subdivision
internal Rng1U64 m_range_from_n_idx_m_count(U64 n_idx, U64 n_count, U64 m_count);
#endif //BASE_MATH_H
@@ -1,5 +1,2 @@
// Copyright (c) 2024 Epic Games Tools
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- GENERATED CODE
+20
View File
@@ -0,0 +1,20 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_MEMORY_H
#define BASE_MEMORY_H
////////////////////////////////
//~ rjf: @per_os_impl Platform Memory Allocation
//- rjf: basic
internal void *reserve_memory(U64 size);
internal B32 commit_memory(void *ptr, U64 size);
internal void decommit_memory(void *ptr, U64 size);
internal void release_memory(void *ptr, U64 size);
//- rjf: large pages
internal void *reserve_memory_large(U64 size);
internal B32 commit_memory_large(void *ptr, U64 size);
#endif // BASE_MEMORY_H
+56
View File
@@ -0,0 +1,56 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Memory Map Functions
internal void
memory_map_push(Arena *arena, MemoryMap *map, Rng1U64 vaddr_range, void *data)
{
MemoryMapRangeNode *n = push_array(arena, MemoryMapRangeNode, 1);
n->v.vaddr_range = vaddr_range;
n->v.base = data;
SLLQueuePush(map->first_range, map->last_range, n);
}
internal U64
memory_map_read(MemoryMap *map, Rng1U64 range, void *dst)
{
U64 dst_vaddr = range.min;
{
for(;;)
{
U64 start_dst_vaddr = dst_vaddr;
B32 found = 0;
for(MemoryMapRangeNode *n = map->first_range; n != 0; n = n->next)
{
if(contains_1u64(n->v.vaddr_range, dst_vaddr))
{
U64 src_off = dst_vaddr - n->v.vaddr_range.min;
U64 num_bytes_possible = n->v.vaddr_range.max - dst_vaddr;
U64 num_bytes_needed = range.max - dst_vaddr;
U64 num_bytes_to_read = Min(num_bytes_needed, num_bytes_possible);
MemoryCopy((U8 *)dst + (dst_vaddr - range.min), (U8 *)n->v.base + src_off, num_bytes_to_read);
dst_vaddr += num_bytes_to_read;
found = 1;
}
}
if(!found || start_dst_vaddr == dst_vaddr)
{
break;
}
}
}
U64 bytes_read = (dst_vaddr - range.min);
return bytes_read;
}
internal String8
memory_map_data_from_range(Arena *arena, MemoryMap *map, Rng1U64 range)
{
String8 result = {0};
result.size = dim_1u64(range);
result.str = push_array(arena, U8, result.size);
memory_map_read(map, range, result.str);
return result;
}
+39
View File
@@ -0,0 +1,39 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_MEMORY_MAP_H
#define BASE_MEMORY_MAP_H
////////////////////////////////
//~ rjf: Memory Map Types
typedef struct MemoryMapRange MemoryMapRange;
struct MemoryMapRange
{
Rng1U64 vaddr_range;
void *base;
};
typedef struct MemoryMapRangeNode MemoryMapRangeNode;
struct MemoryMapRangeNode
{
MemoryMapRangeNode *next;
MemoryMapRange v;
};
typedef struct MemoryMap MemoryMap;
struct MemoryMap
{
MemoryMapRangeNode *first_range;
MemoryMapRangeNode *last_range;
};
////////////////////////////////
//~ rjf: Memory Map Functions
internal void memory_map_push(Arena *arena, MemoryMap *map, Rng1U64 vaddr_range, void *data);
internal U64 memory_map_read(MemoryMap *map, Rng1U64 range, void *dst);
#define memory_map_read_struct(map, vaddr, ptr) memory_map_read((map), r1u64((vaddr), (vaddr)+sizeof(*(ptr))), (ptr))
internal String8 memory_map_data_from_range(Arena *arena, MemoryMap *map, Rng1U64 range);
#endif // BASE_MEMORY_MAP_H
+421
View File
@@ -0,0 +1,421 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Type Info Lookups
internal Member *
member_from_name(Type *type, String8 name)
{
Member *member = &member_nil;
if(type->members != 0 && name.size != 0)
{
for(U64 idx = 0; idx < type->count; idx += 1)
{
if(str8_match(type->members[idx].name, name, 0))
{
member = &type->members[idx];
break;
}
}
}
return member;
}
////////////////////////////////
//~ rjf: Type Info * Instance Operations
internal void
typed_data_rebase_ptrs(Type *type, String8 data, void *base_ptr)
{
Temp scratch = scratch_begin(0, 0);
typedef struct RebaseTypeTask RebaseTypeTask;
struct RebaseTypeTask
{
RebaseTypeTask *next;
Type *type;
U8 *ptr;
};
RebaseTypeTask start_task = {0, type, data.str};
RebaseTypeTask *first_task = &start_task;
RebaseTypeTask *last_task = first_task;
for(RebaseTypeTask *t = first_task; t != 0; t = t->next)
{
switch(t->type->kind)
{
default:{}break;
case TypeKind_Ptr:
{
*(U64 *)t->ptr = ((U64)(*(U8 **)t->ptr - (U8 *)base_ptr));
}break;
case TypeKind_Array:
{
for(U64 idx = 0; idx < t->type->count; idx += 1)
{
RebaseTypeTask *task = push_array(scratch.arena, RebaseTypeTask, 1);
task->type = t->type->direct;
task->ptr = t->ptr + t->type->direct->size * idx;
SLLQueuePush(first_task, last_task, task);
}
}break;
case TypeKind_Struct:
{
for(U64 idx = 0; idx < t->type->count; idx += 1)
{
Member *member = &t->type->members[idx];
RebaseTypeTask *task = push_array(scratch.arena, RebaseTypeTask, 1);
task->type = member->type;
task->ptr = t->ptr + member->value;
SLLQueuePush(first_task, last_task, task);
}
}break;
}
}
scratch_end(scratch);
}
internal String8
serialized_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params)
{
Temp scratch = scratch_begin(&arena, 1);
String8List strings = {0};
str8_serial_begin(scratch.arena, &strings);
{
typedef struct SerializeTypeTask SerializeTypeTask;
struct SerializeTypeTask
{
SerializeTypeTask *next;
Type *type;
U64 count;
U8 *src;
Type *containing_type;
U8 *containing_ptr;
B32 is_post_header;
};
SerializeTypeTask start_task = {0, type, 1, data.str};
SerializeTypeTask *first_task = &start_task;
SerializeTypeTask *last_task = first_task;
for(SerializeTypeTask *t = first_task; t != 0; t = t->next)
{
switch(t->type->kind)
{
//- rjf: leaf -> just copy the data directly
default:
if(TypeKind_FirstLeaf <= t->type->kind && t->type->kind <= TypeKind_LastLeaf)
{
str8_serial_push_string(scratch.arena, &strings, str8(t->src, t->type->size*t->count));
}break;
//- rjf: pointers -> try to interpret/understand pointer & read/write, otherwise just write as plain data
case TypeKind_Ptr:
{
// rjf: unpack info about this pointer
TypeSerializePtrRefInfo *ptr_ref_info = 0;
for(U64 idx = 0; idx < params->ptr_ref_infos_count; idx += 1)
{
if(params->ptr_ref_infos[idx].type == t->type->direct)
{
ptr_ref_info = &params->ptr_ref_infos[idx];
break;
}
}
// rjf: indexification -> subtract base, divide direct size, write index
if(ptr_ref_info != 0 && ptr_ref_info->indexify_base != 0)
{
U64 ptr_value = 0;
MemoryCopy(&ptr_value, t->src, sizeof(ptr_value));
U64 ptr_write_value = ((U64)((U8 *)ptr_value - (U8 *)ptr_ref_info->indexify_base)/t->type->direct->size);
str8_serial_push_struct(scratch.arena, &strings, &ptr_write_value);
}
// rjf: offsetification -> subtract base, write offsets
else if(ptr_ref_info != 0 && ptr_ref_info->offsetify_base != 0)
{
U64 ptr_value = 0;
MemoryCopy(&ptr_value, t->src, sizeof(ptr_value));
U64 ptr_write_value = (U64)((U8 *)ptr_value - (U8 *)ptr_ref_info->offsetify_base);
str8_serial_push_struct(scratch.arena, &strings, &ptr_write_value);
}
// rjf: size-by-member (pre-header): still potentially dependent on other members which
// delimit our size, so push a new post-header task for pointer.
else if(t->type->count_delimiter_name.size != 0 && !t->is_post_header)
{
SerializeTypeTask *task = push_array(scratch.arena, SerializeTypeTask, 1);
task->type = t->type;
task->count = t->count;
task->src = t->src;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
task->is_post_header = 1;
SLLQueuePush(first_task, last_task, task);
}
// rjf: size-by-member (post-header): all flat parts of containing struct have been
// iterated, so now we can read the size, & descend to new task to read pointer
// destination contents
else if(t->type->count_delimiter_name.size != 0 && t->is_post_header)
{
// rjf: determine count of this pointer
U64 count = 0;
{
Member *count_member = member_from_name(t->containing_type, t->type->count_delimiter_name);
MemoryCopy(&count, t->containing_ptr + count_member->value, count_member->type->size);
}
// rjf: push task
SerializeTypeTask *task = push_array(scratch.arena, SerializeTypeTask, 1);
task->type = t->type->direct;
task->count = count;
task->src = *(void **)t->src;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}
// rjf: catch-all: write pointer value
else
{
str8_serial_push_string(scratch.arena, &strings, str8(t->src, t->type->size*t->count));
}
}break;
//- rjf: arrays -> descend to underlying type, + count
case TypeKind_Array:
{
SerializeTypeTask *task = push_array(scratch.arena, SerializeTypeTask, 1);
task->type = t->type->direct;
task->count = t->type->count;
task->src = t->src;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}break;
//- rjf: struct -> descend to members
case TypeKind_Struct:
{
U64 off = 0;
for(U64 idx = 0; idx < t->count; idx += 1)
{
for(U64 member_idx = 0; member_idx < t->type->count; member_idx += 1)
{
if(t->type->members[member_idx].flags & MemberFlag_DoNotSerialize)
{
continue;
}
SerializeTypeTask *task = push_array(scratch.arena, SerializeTypeTask, 1);
task->type = t->type->members[member_idx].type;
task->count = 1;
task->src = t->src + idx*t->type->size + t->type->members[member_idx].value;
task->containing_type = t->type;
task->containing_ptr = t->src;
SLLQueuePush(first_task, last_task, task);
}
}
}break;
//- rjf: enum -> descend to basic type interpretation
case TypeKind_Enum:
{
SerializeTypeTask *task = push_array(scratch.arena, SerializeTypeTask, 1);
task->type = t->type->direct;
task->count = t->count;
task->src = t->src;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}break;
}
}
}
String8 result = str8_serial_end(arena, &strings);
scratch_end(scratch);
return result;
}
internal String8
deserialized_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params)
{
String8 result = {0};
result.size = type->size;
result.str = push_array(arena, U8, result.size);
{
Temp scratch = scratch_begin(&arena, 1);
typedef struct DeserializeTypeTask DeserializeTypeTask;
struct DeserializeTypeTask
{
DeserializeTypeTask *next;
Type *type;
U64 count;
U8 *dst;
Type *containing_type;
U8 *containing_ptr;
B32 is_post_header;
};
U64 read_off = 0;
DeserializeTypeTask start_task = {0, type, 1, result.str};
DeserializeTypeTask *first_task = &start_task;
DeserializeTypeTask *last_task = first_task;
for(DeserializeTypeTask *t = first_task; t != 0; t = t->next)
{
U8 *t_src = data.str + read_off;
switch(t->type->kind)
{
//- rjf: leaf -> copy the data directly
default:
if(TypeKind_FirstLeaf <= t->type->kind && t->type->kind <= TypeKind_LastLeaf)
{
MemoryCopy(t->dst, t_src, t->type->size*t->count);
read_off += t->type->size*t->count;
}break;
//- rjf: pointers -> try to interpret/understand pointer & read/write, otherwise skip
case TypeKind_Ptr:
{
// rjf: unpack info about this pointer
TypeSerializePtrRefInfo *ptr_ref_info = 0;
for(U64 idx = 0; idx < params->ptr_ref_infos_count; idx += 1)
{
if(params->ptr_ref_infos[idx].type == t->type->direct)
{
ptr_ref_info = &params->ptr_ref_infos[idx];
break;
}
}
// rjf: indexification -> add base, multiply direct size
if(ptr_ref_info != 0 && ptr_ref_info->indexify_base != 0)
{
U64 ptr_value = 0;
MemoryCopy(&ptr_value, t_src, sizeof(ptr_value));
U64 ptr_write_value = (ptr_value + (U64)ptr_ref_info->indexify_base) * t->type->direct->size;
MemoryCopy(t->dst, &ptr_write_value, sizeof(ptr_write_value));
read_off += sizeof(ptr_value);
}
// rjf: offsetification -> subtract base, write offsets
else if(ptr_ref_info != 0 && ptr_ref_info->offsetify_base != 0)
{
U64 ptr_value = 0;
MemoryCopy(&ptr_value, t_src, sizeof(ptr_value));
U64 ptr_write_value = ptr_value + (U64)ptr_ref_info->offsetify_base;
MemoryCopy(t->dst, &ptr_write_value, sizeof(ptr_write_value));
read_off += sizeof(ptr_value);
}
// rjf: size-by-member (pre-header): still potentially dependent on other members which
// delimit our size, so push a new post-header task for pointer.
else if(t->type->count_delimiter_name.size != 0 && !t->is_post_header)
{
DeserializeTypeTask *task = push_array(scratch.arena, DeserializeTypeTask, 1);
task->type = t->type;
task->count = t->count;
task->dst = t->dst;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
task->is_post_header = 1;
SLLQueuePush(first_task, last_task, task);
}
// rjf: size-by-member (post-header): all flat parts of containing struct have been
// iterated, so now we can read the size, & descend to new task to read pointer
// destination contents
else if(t->type->count_delimiter_name.size != 0 && t->is_post_header)
{
// rjf: determine count of this pointer
U64 count = 0;
{
Member *count_member = member_from_name(t->containing_type, t->type->count_delimiter_name);
MemoryCopy(&count, t->containing_ptr + count_member->value, count_member->type->size);
}
// rjf: allocate buffer for pointer destination; write address into pointer value slot
U64 ptr_dest_buffer_size = (count+1)*t->type->direct->size;
U8 *ptr_dest_buffer = push_array(arena, U8, ptr_dest_buffer_size);
MemoryCopy(t->dst, &ptr_dest_buffer, sizeof(ptr_dest_buffer));
// rjf: push task
DeserializeTypeTask *task = push_array(scratch.arena, DeserializeTypeTask, 1);
task->type = t->type->direct;
task->count = count;
task->dst = ptr_dest_buffer;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}
// rjf: catch-all: read pointer value
else
{
MemoryCopy(t->dst, t_src, t->type->size*t->count);
read_off += t->type->size*t->count;
}
}break;
//- rjf: arrays -> descend to underlying type, + count
case TypeKind_Array:
{
DeserializeTypeTask *task = push_array(scratch.arena, DeserializeTypeTask, 1);
task->type = t->type->direct;
task->count = t->type->count;
task->dst = t->dst;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}break;
//- rjf: struct -> descend to members
case TypeKind_Struct:
{
for(U64 idx = 0; idx < t->count; idx += 1)
{
for(U64 member_idx = 0; member_idx < t->type->count; member_idx += 1)
{
if(t->type->members[member_idx].flags & MemberFlag_DoNotSerialize)
{
continue;
}
DeserializeTypeTask *task = push_array(scratch.arena, DeserializeTypeTask, 1);
task->type = t->type->members[member_idx].type;
task->count = 1;
task->dst = t->dst + idx*t->type->size + t->type->members[member_idx].value;
task->containing_type = t->type;
task->containing_ptr = t->dst;
SLLQueuePush(first_task, last_task, task);
}
}
}break;
//- rjf: enum -> descend to basic type interpretation
case TypeKind_Enum:
{
DeserializeTypeTask *task = push_array(scratch.arena, DeserializeTypeTask, 1);
task->type = t->type->direct;
task->count = t->count;
task->dst = t->dst;
task->containing_type = t->containing_type;
task->containing_ptr = t->containing_ptr;
SLLQueuePush(first_task, last_task, task);
}break;
}
}
if(params->advance_out != 0)
{
params->advance_out[0] = read_off;
}
scratch_end(scratch);
}
return result;
}
internal String8
deep_copy_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params)
{
Temp scratch = scratch_begin(&arena, 1);
String8 data_srlz = serialized_from_typed_data(scratch.arena, type, data, params);
String8 data_copy = deserialized_from_typed_data(arena, type, data_srlz, params);
scratch_end(scratch);
return data_copy;
}
+297
View File
@@ -0,0 +1,297 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_META_H
#define BASE_META_H
////////////////////////////////
//~ rjf: Meta Markup Features
#define EmbedFile(name, path)
#define TweakB32(name, default) (TWEAK_##name)
#define TweakF32(name, default, min, max) (TWEAK_##name)
////////////////////////////////
//~ rjf: Tweak Info Tables
typedef struct TweakB32Info TweakB32Info;
struct TweakB32Info
{
String8 name;
B32 default_value;
B32 *value_ptr;
};
typedef struct TweakF32Info TweakF32Info;
struct TweakF32Info
{
String8 name;
F32 default_value;
Rng1F32 value_range;
F32 *value_ptr;
};
typedef struct TweakB32InfoTable TweakB32InfoTable;
struct TweakB32InfoTable
{
TweakB32Info *v;
U64 count;
};
typedef struct TweakF32InfoTable TweakF32InfoTable;
struct TweakF32InfoTable
{
TweakF32Info *v;
U64 count;
};
typedef struct EmbedInfo EmbedInfo;
struct EmbedInfo
{
String8 name;
String8 *data;
U128 *hash;
};
typedef struct EmbedInfoTable EmbedInfoTable;
struct EmbedInfoTable
{
EmbedInfo *v;
U64 count;
};
////////////////////////////////
//~ rjf: Type Info Types
typedef enum TypeKind
{
TypeKind_Null,
// rjf: leaves
TypeKind_Void, TypeKind_FirstLeaf = TypeKind_Void,
TypeKind_U8,
TypeKind_U16,
TypeKind_U32,
TypeKind_U64,
TypeKind_S8,
TypeKind_S16,
TypeKind_S32,
TypeKind_S64,
TypeKind_B8,
TypeKind_B16,
TypeKind_B32,
TypeKind_B64,
TypeKind_F32,
TypeKind_F64, TypeKind_LastLeaf = TypeKind_F64,
// rjf: operators
TypeKind_Ptr,
TypeKind_Array,
// rjf: user-defined-types
TypeKind_Struct,
TypeKind_Union,
TypeKind_Enum,
TypeKind_COUNT
}
TypeKind;
typedef U32 TypeFlags;
enum
{
TypeFlag_IsPlainText = (1<<0),
TypeFlag_IsCodeText = (1<<1),
TypeFlag_IsPathText = (1<<2),
};
typedef U32 MemberFlags;
enum
{
MemberFlag_DoNotSerialize = (1<<0),
};
typedef struct Type Type;
typedef struct Member Member;
struct Member
{
String8 name;
String8 pretty_name;
Type *type;
U64 value;
MemberFlags flags;
};
typedef struct Type Type;
struct Type
{
TypeKind kind;
TypeFlags flags;
U64 size;
Type *direct;
String8 name;
String8 count_delimiter_name; // gathered from surrounding members, turns *->[1] into *->[N]
U64 count;
Member *members;
};
////////////////////////////////
//~ rjf: Type Serialization Parameters
typedef struct TypeSerializePtrRefInfo TypeSerializePtrRefInfo;
struct TypeSerializePtrRefInfo
{
Type *type; // pointers to this
void *indexify_base; // can be indexified using this
void *offsetify_base; // can be offsetified using this
void *nil_ptr; // is terminal if matching 0 or this
};
typedef struct TypeSerializeParams TypeSerializeParams;
struct TypeSerializeParams
{
U64 *advance_out;
TypeSerializePtrRefInfo *ptr_ref_infos;
U64 ptr_ref_infos_count;
};
////////////////////////////////
//~ rjf: Type Name -> Type Info
#define type(T) (&T##__type)
////////////////////////////////
//~ rjf: Type Info Table Initializer Helpers
#define member_lit_comp(S, ti, m, ...) {str8_lit_comp(#m), {0}, (ti), OffsetOf(S, m), __VA_ARGS__}
#define struct_members(S) read_only global Member S##__members[] =
#define struct_type(S, ...) read_only global Type S##__type = {TypeKind_Struct, 0, sizeof(S), &type_nil, str8_lit_comp(#S), {0}, ArrayCount(S##__members), S##__members, __VA_ARGS__}
#define named_struct_type(name, S, ...) read_only global Type name##__type = {TypeKind_Struct, 0, sizeof(S), &type_nil, str8_lit_comp(#name), {0}, ArrayCount(name##__members), name##__members, __VA_ARGS__}
#define ptr_type(name, ti, ...) read_only global Type name = {TypeKind_Ptr, 0, sizeof(void *), (ti), __VA_ARGS__}
////////////////////////////////
//~ rjf: Globals
read_only global Type type_nil = {TypeKind_Null, 0, 0, &type_nil};
read_only global Member member_nil = {{0}, {0}, &type_nil};
////////////////////////////////
//~ rjf: Built-In Types
//- rjf: leaves
read_only global Type void__type = {TypeKind_Void, 0, 0, &type_nil, str8_lit_comp("void")};
read_only global Type U8__type = {TypeKind_U8, 0, sizeof(U8), &type_nil, str8_lit_comp("U8")};
read_only global Type U16__type = {TypeKind_U16, 0, sizeof(U16), &type_nil, str8_lit_comp("U16")};
read_only global Type U32__type = {TypeKind_U32, 0, sizeof(U32), &type_nil, str8_lit_comp("U32")};
read_only global Type U64__type = {TypeKind_U64, 0, sizeof(U64), &type_nil, str8_lit_comp("U64")};
read_only global Type S8__type = {TypeKind_S8, 0, sizeof(S8), &type_nil, str8_lit_comp("S8")};
read_only global Type S16__type = {TypeKind_S16, 0, sizeof(S16), &type_nil, str8_lit_comp("S16")};
read_only global Type S32__type = {TypeKind_S32, 0, sizeof(S32), &type_nil, str8_lit_comp("S32")};
read_only global Type S64__type = {TypeKind_S64, 0, sizeof(S64), &type_nil, str8_lit_comp("S64")};
read_only global Type B8__type = {TypeKind_B8, 0, sizeof(B8), &type_nil, str8_lit_comp("B8")};
read_only global Type B16__type = {TypeKind_B16, 0, sizeof(B16), &type_nil, str8_lit_comp("B16")};
read_only global Type B32__type = {TypeKind_B32, 0, sizeof(B32), &type_nil, str8_lit_comp("B32")};
read_only global Type B64__type = {TypeKind_B64, 0, sizeof(B64), &type_nil, str8_lit_comp("B64")};
read_only global Type F32__type = {TypeKind_F32, 0, sizeof(F32), &type_nil, str8_lit_comp("F32")};
read_only global Type F64__type = {TypeKind_F64, 0, sizeof(F64), &type_nil, str8_lit_comp("F64")};
read_only global Type *type_kind_type_table[] =
{
&type_nil,
type(void),
type(U8),
type(U16),
type(U32),
type(U64),
type(S8),
type(S16),
type(S32),
type(S64),
type(B8),
type(B16),
type(B32),
type(B64),
type(F32),
type(F64),
&type_nil,
&type_nil,
&type_nil,
&type_nil,
&type_nil,
};
//- rjf: Rng1U64
struct_members(Rng1U64)
{
member_lit_comp(Rng1U64, type(U64), min),
member_lit_comp(Rng1U64, type(U64), max),
};
struct_type(Rng1U64);
//- rjf: String8
ptr_type(String8__str_ptr_type, type(U8), str8_lit_comp("size"));
struct_members(String8)
{
member_lit_comp(String8, &String8__str_ptr_type, str),
member_lit_comp(String8, type(U64), size),
};
struct_type(String8);
//- rjf: String8Node
extern Type String8Node__type;
Type String8Node__ptr_type = {TypeKind_Ptr, 0, sizeof(void *), &String8Node__type};
Member String8Node__members[] =
{
{str8_lit_comp("next"), {0}, &String8Node__ptr_type, OffsetOf(String8Node, next)},
{str8_lit_comp("string"), {0}, type(String8), OffsetOf(String8Node, string)},
};
Type String8Node__type =
{
TypeKind_Struct,
0,
sizeof(String8Node),
&type_nil,
str8_lit_comp("String8Node"),
{0},
ArrayCount(String8Node__members),
String8Node__members,
};
//- rjf: String8List
Member String8List__members[] =
{
{str8_lit_comp("first"), {0}, &String8Node__ptr_type, OffsetOf(String8List, first)},
{str8_lit_comp("last"), {0}, &String8Node__ptr_type, OffsetOf(String8List, last), MemberFlag_DoNotSerialize},
{str8_lit_comp("node_count"), {0}, type(U64), OffsetOf(String8List, node_count)},
{str8_lit_comp("total_size"), {0}, type(U64), OffsetOf(String8List, total_size)},
};
Type String8List__type =
{
TypeKind_Struct,
0,
sizeof(String8List),
&type_nil,
str8_lit_comp("String8List"),
{0},
ArrayCount(String8List__members),
String8List__members,
};
////////////////////////////////
//~ rjf: Type Info Lookups
internal Member *member_from_name(Type *type, String8 name);
#define EachMember(T, it) (Member *it = (type(T))->members; it != 0 && it < (type(T))->members + (type(T))->count; it += 1)
////////////////////////////////
//~ rjf: Type Info * Instance Operations
internal void typed_data_rebase_ptrs(Type *type, String8 data, void *base_ptr);
internal String8 serialized_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params);
internal String8 deserialized_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params);
internal String8 deep_copy_from_typed_data(Arena *arena, Type *type, String8 data, TypeSerializeParams *params);
#define struct_rebase_ptrs(T, ptr, base) typed_data_rebase_ptrs(type(T), str8_struct(ptr), (base))
#define serialized_from_struct(arena, T, ptr, ...) serialized_from_typed_data((arena), type(T), str8_struct(ptr), &(TypeSerializeParams){.ptr_ref_infos = 0, __VA_ARGS__})
#define struct_from_serialized(arena, T, string, ...) (T *)deserialized_from_typed_data((arena), type(T), (string), &(TypeSerializeParams){.ptr_ref_infos = 0, __VA_ARGS__}).str
#define deep_copy_from_struct(arena, T, ptr, ...) (T *)deep_copy_from_typed_data((arena), type(T), str8_struct(ptr), &(TypeSerializeParams){.ptr_ref_infos = 0, __VA_ARGS__}).str
#endif // BASE_META_H
+115
View File
@@ -0,0 +1,115 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Handle Type Functions
internal Process
process_zero(void)
{
Process p = {0};
return p;
}
internal B32
process_match(Process a, Process b)
{
B32 result = MemoryMatchStruct(&a, &b);
return result;
}
internal void
process_list_push(Arena *arena, ProcessList *list, Process p)
{
ProcessNode *n = push_array(arena, ProcessNode, 1);
SLLQueuePush(list->first, list->last, n);
n->v = p;
list->count += 1;
}
////////////////////////////////
//~ rjf: Process Launcher Helpers
internal Process
launch_cmd_line(String8 string)
{
Temp scratch = scratch_begin(0, 0);
U8 split_chars[] = {' '};
String8List parts = str8_split(scratch.arena, string, split_chars, ArrayCount(split_chars), 0);
Process process = {0};
if(parts.node_count != 0)
{
// rjf: unpack exe part
String8 exe = parts.first->string;
String8 exe_folder = str8_chop_last_slash(exe);
if(exe_folder.size == 0)
{
exe_folder = get_current_path(scratch.arena);
}
// rjf: find stdout delimiter
String8Node *stdout_delimiter_n = 0;
for(String8Node *n = parts.first; n != 0; n = n->next)
{
if(str8_match(n->string, str8_lit(">"), 0))
{
stdout_delimiter_n = n;
break;
}
}
// rjf: read stdout path
String8 stdout_path = {0};
if(stdout_delimiter_n && stdout_delimiter_n->next)
{
stdout_path = stdout_delimiter_n->next->string;
}
// rjf: open stdout handle
File stdout_handle = {0};
if(stdout_path.size != 0)
{
File file = file_open(AccessFlag_Write|AccessFlag_Read, stdout_path);
file_close(file);
stdout_handle = file_open(AccessFlag_Write|AccessFlag_Append|AccessFlag_ShareRead|AccessFlag_ShareWrite|AccessFlag_Inherited, stdout_path);
}
// rjf: form command line
String8List cmdline = {0};
for(String8Node *n = parts.first; n != stdout_delimiter_n && n != 0; n = n->next)
{
str8_list_push(scratch.arena, &cmdline, n->string);
}
// rjf: launch
ProcessLaunchParams params = {0};
params.cmd_line = cmdline;
params.path = exe_folder;
params.inherit_env = 1;
params.stdout_file = stdout_handle;
process = process_launch(&params);
// rjf: close stdout handle
{
if(stdout_path.size != 0)
{
file_close(stdout_handle);
}
}
}
scratch_end(scratch);
return process;
}
internal Process
launch_cmd_linef(char *fmt, ...)
{
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 string = str8fv(scratch.arena, fmt, args);
Process result = launch_cmd_line(string);
va_end(args);
scratch_end(scratch);
return result;
}
+91
View File
@@ -0,0 +1,91 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_PROCESSES_H
#define BASE_PROCESSES_H
typedef struct ProcessInfo ProcessInfo;
struct ProcessInfo
{
U32 pid;
B32 large_pages_allowed;
String8 binary_file_path;
String8 binary_path;
String8 initial_path;
String8 user_program_config_data_path;
String8 user_program_cache_data_path;
String8 user_program_logs_data_path;
String8List module_load_paths;
String8List environment;
};
typedef struct Process Process;
struct Process
{
U64 u64[1];
};
typedef struct ProcessNode ProcessNode;
struct ProcessNode
{
ProcessNode *next;
Process v;
};
typedef struct ProcessList ProcessList;
struct ProcessList
{
ProcessNode *first;
ProcessNode *last;
U64 count;
};
typedef struct ProcessLaunchParams ProcessLaunchParams;
struct ProcessLaunchParams
{
String8List cmd_line;
String8 path;
String8List env;
B32 inherit_env;
B32 debug_subprocesses;
B32 consoleless;
File stdout_file;
File stderr_file;
File stdin_file;
};
////////////////////////////////
//~ rjf: Handle Type Functions
internal Process process_zero(void);
internal B32 process_match(Process a, Process b);
internal void process_list_push(Arena *arena, ProcessList *list, Process p);
////////////////////////////////
//~ rjf: Process Launcher Helpers
internal Process launch_cmd_line(String8 string);
internal Process launch_cmd_linef(char *fmt, ...);
////////////////////////////////
//~ rjf: @per_os_impl Aborting
internal void abort_self(U64 exit_code);
////////////////////////////////
//~ rjf: @per_os_impl Process Info
internal ProcessInfo *get_process_info(void);
internal String8 get_current_path(Arena *arena);
internal U32 get_process_start_time_unix(void);
////////////////////////////////
//~ rjf: @per_os_impl Child Processes
internal Process process_launch(ProcessLaunchParams *params);
internal U64 pid_from_process(Process process);
internal B32 process_join(Process process, U64 endt_us, U64 *exit_code_out);
internal void process_detach(Process process);
internal B32 process_kill(Process process);
#endif // BASE_PROCESSES_H
+31
View File
@@ -0,0 +1,31 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#if PROFILE_SPALL
internal inline void
spall_begin(char *fmt, ...)
{
if(spall_buffer.data == 0)
{
spall_buffer.length = MB(1);
spall_buffer.data = os_reserve(spall_buffer.length);
os_commit(spall_buffer.data, spall_buffer.length);
spall_buffer_init(&spall_profile, &spall_buffer);
}
if(spall_pid == 0)
{
spall_pid = os_get_process_info()->pid;
}
if(spall_tid == 0)
{
spall_tid = os_tid();
}
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 string = push_str8fv(scratch.arena, fmt, args);
spall_buffer_begin_ex(&spall_profile, &spall_buffer, string.str, string.size, now_time_us(), spall_tid, spall_pid);
va_end(args);
scratch_end(scratch);
}
#endif
+126
View File
@@ -0,0 +1,126 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_PROFILE_H
#define BASE_PROFILE_H
////////////////////////////////
//~ rjf: Zero Settings
#if !defined(PROFILE_TELEMETRY)
# define PROFILE_TELEMETRY 0
#endif
#if !defined(PROFILE_SPALL)
# define PROFILE_SPALL 0
#endif
////////////////////////////////
//~ rjf: Third Party Includes
#if PROFILE_TELEMETRY
# include "rad_tm.h"
# if OS_WINDOWS
# pragma comment(lib, "ws2_32.lib")
# pragma comment(lib, "rad_tm_win64.lib")
# endif
#elif PROFILE_SPALL
# include "spall.h"
#endif
////////////////////////////////
//~ rjf: Telemetry Profile Defines
#if PROFILE_TELEMETRY
# define ProfBegin(...) tmEnter(0, 0, __VA_ARGS__)
# define ProfBeginDynamic(...) (TM_API_PTR ? TM_API_PTR->_tmEnterZoneV_Core(0, 0, __FILE__, &g_telemetry_filename_id, __LINE__, __VA_ARGS__) : (void)0)
# define ProfEnd(...) (TM_API_PTR ? TM_API_PTR->_tmLeaveZone(0) : (void)0)
# define ProfTick(...) tmTick(0)
# define ProfIsCapturing(...) tmRunning()
# define ProfBeginCapture(...) tmOpen(0, __VA_ARGS__, __DATE__, "localhost", TMCT_TCP, TELEMETRY_DEFAULT_PORT, TMOF_INIT_NETWORKING|TMOF_CAPTURE_CONTEXT_SWITCHES, 100)
# define ProfEndCapture(...) tmClose(0)
# define ProfThreadName(...) (TM_API_PTR ? TM_API_PTR->_tmThreadName(0, 0, __VA_ARGS__) : (void)0)
# define ProfMsg(...) (TM_API_PTR ? TM_API_PTR->_tmMessageV_Core(0, TMMF_ICON_NOTE, __FILE__, &g_telemetry_filename_id, __LINE__, __VA_ARGS__) : (void)0)
# define ProfBeginLockWait(...) tmStartWaitForLock(0, 0, __VA_ARGS__)
# define ProfEndLockWait(...) tmEndWaitForLock(0)
# define ProfLockTake(...) tmAcquiredLock(0, 0, __VA_ARGS__)
# define ProfLockDrop(...) tmReleasedLock(0, __VA_ARGS__)
# define ProfColor(color) tmZoneColor((((color) & 0xff000000) >> 24) / 255.f, (((color) & 0x00ff0000) >> 16) / 255.f, (((color) & 0x0000ff00) >> 8) / 255.f)
# define ProfBeginV(...) \
if (TM_API_PTR) { \
static tm_uint64 file_id = 0; TM_API_PTR->_tmStaticString(&file_id, __FILE__); \
Temp scratch = scratch_begin(0,0); \
String8 string = push_str8f(scratch.arena, __VA_ARGS__); \
tm_uint64 hash = TM_API_PTR->_tmHash((char*)string.str, string.size); \
hash = TM_API_PTR->_tmSendDynamicString(hash, (char*)string.str); \
TM_API_PTR->_tmEnterZoneFast_Core(0, 0, file_id, __LINE__, hash); \
scratch_end(scratch); \
}
# define ProfNoteV(...) \
if (TM_API_PTR) { \
static tm_uint64 file_id = 0; TM_API_PTR->_tmStaticString(&file_id, __FILE__); \
Temp scratch = scratch_begin(0,0); \
String8 string = push_str8f(scratch.arena, __VA_ARGS__); \
tm_uint64 hash = TM_API_PTR->_tmHash((char*)string.str, string.size); \
hash = TM_API_PTR->_tmSendDynamicString(hash, (char*)string.str); \
TM_API_PTR->_tmMessageFast_Core(0, TMMF_ICON_NOTE, file_id, __LINE__, hash); \
scratch_end(scratch); \
}
#endif
////////////////////////////////
//~ rjf: Spall Profile Defines
#if PROFILE_SPALL
global U64 spall_capturing = 0;
global SpallProfile spall_profile = {0};
thread_static SpallBuffer spall_buffer = {0};
thread_static U32 spall_tid = 0;
thread_static U32 spall_pid = 0;
internal inline void spall_begin(char *fmt, ...);
# define ProfBegin(...) (spall_capturing ? (spall_begin(__VA_ARGS__), 0) : 0)
# define ProfBeginDynamic(...) (spall_capturing ? (spall_begin(__VA_ARGS__), 0) : 0)
# define ProfEnd(...) (spall_capturing ? (spall_buffer_end_ex(&spall_profile, &spall_buffer, now_time_us(), spall_tid, spall_pid)), 0 : 0)
# define ProfTick(...)
# define ProfIsCapturing(...) (!!spall_capturing)
# define ProfBeginCapture(...) (spall_capturing = 1)
# define ProfEndCapture(...) (spall_capturing = 0, spall_flush(&spall_profile))
# define ProfThreadName(...)
# define ProfMsg(...)
# define ProfBeginLockWait(...)
# define ProfEndLockWait(...)
# define ProfLockTake(...)
# define ProfLockDrop(...)
# define ProfColor(color)
# define ProfBeginV(...)
# define ProfNoteV(...)
#endif
////////////////////////////////
//~ rjf: Zeroify Undefined Defines
#if !defined(ProfBegin)
# define ProfBegin(...) (0)
# define ProfBeginDynamic(...) (0)
# define ProfEnd(...) (0)
# define ProfTick(...) (0)
# define ProfIsCapturing(...) (0)
# define ProfBeginCapture(...) (0)
# define ProfEndCapture(...) (0)
# define ProfThreadName(...) (0)
# define ProfMsg(...) (0)
# define ProfBeginLockWait(...) (0)
# define ProfEndLockWait(...) (0)
# define ProfLockTake(...) (0)
# define ProfLockDrop(...) (0)
# define ProfColor(...) (0)
# define ProfBeginV(...) (0)
# define ProfNoteV(...) (0)
#endif
////////////////////////////////
//~ rjf: Helper Wrappers
#define ProfBeginFunction(...) ProfBegin(this_function_name)
#define ProfScope(...) DeferLoop(ProfBeginDynamic(__VA_ARGS__), ProfEnd())
#endif // BASE_PROFILE_H
+139
View File
@@ -0,0 +1,139 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Ring Functions
internal Ring *
make_ring(Arena *arena, U64 size)
{
Ring *ring = push_array(arena, Ring, 1);
ring->size = size;
ring->base = push_array(arena, U8, ring->size);
return ring;
}
internal B32
ring_try_write(Ring *ring, U64 size, void *ptr)
{
U64 bytes_unconsumed = (ring->write_pos - ring->read_pos);
U64 bytes_available = ring->size - bytes_unconsumed;
B32 result = 0;
if(bytes_available >= size)
{
result = 1;
ring->write_pos += wrapped_write(ring->base, ring->size, ring->write_pos, ptr, size);
}
return result;
}
internal B32
ring_try_read(Ring *ring, U64 size, void *ptr)
{
U64 bytes_unconsumed = (ring->write_pos - ring->read_pos);
B32 result = 0;
if(bytes_unconsumed >= size)
{
result = 1;
ring->read_pos += wrapped_read(ring->base, ring->size, ring->read_pos, ptr, size);
}
return result;
}
////////////////////////////////
//~ rjf: Guarded Ring Functions
internal GuardedRing *
guarded_ring_alloc(Arena *arena, U64 size)
{
ProfBeginFunction();
GuardedRing *gr = push_array(arena, GuardedRing, 1);
gr->ring = make_ring(arena, size);
gr->mutex = mutex_alloc();
gr->cv = cond_var_alloc();
ProfEnd();
return gr;
}
internal void
guarded_ring_release(GuardedRing *ring)
{
ProfBeginFunction();
mutex_release(ring->mutex);
cond_var_release(ring->cv);
ProfEnd();
}
internal RingGuard
guarded_ring_open(GuardedRing *ring)
{
RingGuard guard = {ring};
mutex_take(ring->mutex);
return guard;
}
internal void
guarded_ring_close(RingGuard *guard)
{
mutex_drop(guard->r->mutex);
}
internal B32
guarded_ring_try_write(RingGuard *guard, U64 size, void *ptr)
{
B32 result = ring_try_write(guard->r->ring, size, ptr);
if(result)
{
cond_var_broadcast(guard->r->cv);
}
return result;
}
internal B32
guarded_ring_try_read(RingGuard *guard, U64 size, void *ptr)
{
B32 result = ring_try_read(guard->r->ring, size, ptr);
if(result)
{
cond_var_broadcast(guard->r->cv);
}
return result;
}
internal B32
guarded_ring_write_or_wait(RingGuard *guard, U64 size, void *ptr, U64 endt_us)
{
B32 write_good = 0;
for(;!write_good;)
{
write_good = guarded_ring_try_write(guard, size, ptr);
if(now_time_us() >= endt_us)
{
break;
}
if(!write_good)
{
cond_var_wait(guard->r->cv, guard->r->mutex, endt_us);
}
}
return write_good;
}
internal B32
guarded_ring_read_or_wait(RingGuard *guard, U64 size, void *ptr, U64 endt_us)
{
B32 read_good = 0;
for(;!read_good;)
{
read_good = guarded_ring_try_read(guard, size, ptr);
if(now_time_us() >= endt_us)
{
break;
}
if(!read_good)
{
cond_var_wait(guard->r->cv, guard->r->mutex, endt_us);
}
}
return read_good;
}
+56
View File
@@ -0,0 +1,56 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_RING_H
#define BASE_RING_H
typedef struct Ring Ring;
struct Ring
{
U8 *base;
U64 size;
U64 write_pos;
U64 read_pos;
};
typedef struct GuardedRing GuardedRing;
struct GuardedRing
{
Ring *ring;
Mutex mutex;
CondVar cv;
};
typedef struct RingGuard RingGuard;
struct RingGuard
{
GuardedRing *r;
};
////////////////////////////////
//~ rjf: Ring Functions
internal Ring *make_ring(Arena *arena, U64 size);
internal B32 ring_try_write(Ring *ring, U64 size, void *ptr);
internal B32 ring_try_read(Ring *ring, U64 size, void *ptr);
#define ring_try_write_struct(ring, ptr) ring_try_write((ring), sizeof(*(ptr)), (ptr))
#define ring_try_read_struct(ring, ptr) ring_try_read((ring), sizeof(*(ptr)), (ptr))
////////////////////////////////
//~ rjf: Guarded Ring Functions
internal GuardedRing *guarded_ring_alloc(Arena *arena, U64 size);
internal void guarded_ring_release(GuardedRing *ring);
internal RingGuard guarded_ring_open(GuardedRing *ring);
internal void guarded_ring_close(RingGuard *guard);
internal B32 guarded_ring_try_write(RingGuard *guard, U64 size, void *ptr);
internal B32 guarded_ring_try_read(RingGuard *guard, U64 size, void *ptr);
#define guarded_ring_try_write_struct(ring, ptr) guarded_ring_try_write((ring), sizeof(*(ptr)), (ptr))
#define guarded_ring_try_read_struct(ring, ptr) guarded_ring_try_read((ring), sizeof(*(ptr)), (ptr))
internal B32 guarded_ring_write_or_wait(RingGuard *guard, U64 size, void *ptr, U64 endt_us);
internal B32 guarded_ring_read_or_wait(RingGuard *guard, U64 size, void *ptr, U64 endt_us);
#define guarded_ring_write_struct_or_wait(ring, ptr, endt_us) guarded_ring_write_or_wait((ring), sizeof(*(ptr)), (ptr), (endt_us))
#define guarded_ring_read_struct_or_wait(ring, ptr, endt_us) guarded_ring_read_or_wait((ring), sizeof(*(ptr)), (ptr), (endt_us))
#define guarded_ring_write_string_or_wait(ring, string, endt_us) guarded_ring_write_or_wait((ring), (string).size, (string).str, (endt_us))
#endif // BASE_RING_H
+2
View File
@@ -0,0 +1,2 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
+22
View File
@@ -0,0 +1,22 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_SHARED_MEMORY_H
#define BASE_SHARED_MEMORY_H
typedef struct SharedMemory SharedMemory;
struct SharedMemory
{
U64 u64[1];
};
////////////////////////////////
//~ rjf: @per_os_impl Shared Memory
internal SharedMemory shared_memory_alloc(U64 size, String8 name);
internal SharedMemory shared_memory_open(String8 name);
internal void shared_memory_close(SharedMemory handle);
internal void * shared_memory_view_open(SharedMemory handle, Rng1U64 range);
internal void shared_memory_view_close(SharedMemory handle, void *ptr, Rng1U64 range);
#endif // BASE_SHARED_MEMORY_H
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+480 -351
View File
@@ -1,351 +1,480 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_STRING_H
#define BASE_STRING_H
////////////////////////////////
//~ rjf: Third Party Includes
#define STB_SPRINTF_DECORATE(name) raddbg_##name
#include "third_party/stb/stb_sprintf.h"
////////////////////////////////
//~ rjf: String Types
typedef struct String8 String8;
struct String8
{
U8 *str;
U64 size;
};
typedef struct String16 String16;
struct String16
{
U16 *str;
U64 size;
};
typedef struct String32 String32;
struct String32
{
U32 *str;
U64 size;
};
////////////////////////////////
//~ rjf: String List & Array Types
typedef struct String8Node String8Node;
struct String8Node
{
String8Node *next;
String8 string;
};
typedef struct String8MetaNode String8MetaNode;
struct String8MetaNode
{
String8MetaNode *next;
String8Node *node;
};
typedef struct String8List String8List;
struct String8List
{
String8Node *first;
String8Node *last;
U64 node_count;
U64 total_size;
};
typedef struct String8Array String8Array;
struct String8Array
{
String8 *strings;
U64 count;
};
////////////////////////////////
//~ rjf: String Matching, Splitting, & Joining Types
typedef U32 StringMatchFlags;
enum
{
StringMatchFlag_CaseInsensitive = (1 << 0),
StringMatchFlag_RightSideSloppy = (1 << 1),
StringMatchFlag_SlashInsensitive = (1 << 2),
};
typedef U32 StringSplitFlags;
enum
{
StringSplitFlag_KeepEmpties = (1 << 0),
};
typedef enum PathStyle
{
PathStyle_Relative,
PathStyle_WindowsAbsolute,
PathStyle_UnixAbsolute,
#if OS_WINDOWS
PathStyle_SystemAbsolute = PathStyle_WindowsAbsolute
#elif OS_LINUX
PathStyle_SystemAbsolute = PathStyle_UnixAbsolute
#else
# error "absolute path style is undefined for this OS"
#endif
}
PathStyle;
typedef struct StringJoin StringJoin;
struct StringJoin
{
String8 pre;
String8 sep;
String8 post;
};
////////////////////////////////
//~ rjf: String Pair Types
typedef struct String8TxtPtPair String8TxtPtPair;
struct String8TxtPtPair
{
String8 string;
TxtPt pt;
};
////////////////////////////////
//~ rjf: UTF Decoding Types
typedef struct UnicodeDecode UnicodeDecode;
struct UnicodeDecode
{
U32 inc;
U32 codepoint;
};
////////////////////////////////
//~ rjf: Character Classification & Conversion Functions
internal B32 char_is_space(U8 c);
internal B32 char_is_upper(U8 c);
internal B32 char_is_lower(U8 c);
internal B32 char_is_alpha(U8 c);
internal B32 char_is_slash(U8 c);
internal B32 char_is_digit(U8 c, U32 base);
internal U8 char_to_lower(U8 c);
internal U8 char_to_upper(U8 c);
internal U8 char_to_correct_slash(U8 c);
////////////////////////////////
//~ rjf: C-String Measurement
internal U64 cstring8_length(U8 *c);
internal U64 cstring16_length(U16 *c);
internal U64 cstring32_length(U32 *c);
////////////////////////////////
//~ rjf: String Constructors
#define str8_lit(S) str8((U8*)(S), sizeof(S) - 1)
#define str8_lit_comp(S) {(U8*)(S), sizeof(S) - 1,}
#define str8_varg(S) (int)((S).size), ((S).str)
#define str8_array(S,C) str8((U8*)(S), sizeof(*(S))*(C))
#define str8_array_fixed(S) str8((U8*)(S), sizeof(S))
#define str8_struct(S) str8((U8*)(S), sizeof(*(S)))
internal String8 str8(U8 *str, U64 size);
internal String8 str8_range(U8 *first, U8 *one_past_last);
internal String8 str8_zero(void);
internal String16 str16(U16 *str, U64 size);
internal String16 str16_range(U16 *first, U16 *one_past_last);
internal String16 str16_zero(void);
internal String32 str32(U32 *str, U64 size);
internal String32 str32_range(U32 *first, U32 *one_past_last);
internal String32 str32_zero(void);
internal String8 str8_cstring(char *c);
internal String16 str16_cstring(U16 *c);
internal String32 str32_cstring(U32 *c);
internal String8 str8_cstring_capped(void *cstr, void *cap);
////////////////////////////////
//~ rjf: String Stylization
internal String8 upper_from_str8(Arena *arena, String8 string);
internal String8 lower_from_str8(Arena *arena, String8 string);
internal String8 backslashed_from_str8(Arena *arena, String8 string);
////////////////////////////////
//~ rjf: String Matching
internal B32 str8_match(String8 a, String8 b, StringMatchFlags flags);
internal U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal B32 str8_ends_with(String8 string, String8 end, StringMatchFlags flags);
////////////////////////////////
//~ rjf: String Slicing
internal String8 str8_substr(String8 str, Rng1U64 range);
internal String8 str8_prefix(String8 str, U64 size);
internal String8 str8_skip(String8 str, U64 amt);
internal String8 str8_postfix(String8 str, U64 size);
internal String8 str8_chop(String8 str, U64 amt);
internal String8 str8_skip_chop_whitespace(String8 string);
////////////////////////////////
//~ rjf: String Formatting & Copying
internal String8 push_str8_cat(Arena *arena, String8 s1, String8 s2);
internal String8 push_str8_copy(Arena *arena, String8 s);
internal String8 push_str8fv(Arena *arena, char *fmt, va_list args);
internal String8 push_str8f(Arena *arena, char *fmt, ...);
////////////////////////////////
//~ rjf: String <=> Integer Conversions
//- rjf: string -> integer
internal S64 sign_from_str8(String8 string, String8 *string_tail);
internal B32 str8_is_integer(String8 string, U32 radix);
internal U64 u64_from_str8(String8 string, U32 radix);
internal S64 s64_from_str8(String8 string, U32 radix);
internal B32 try_u64_from_str8_c_rules(String8 string, U64 *x);
internal B32 try_s64_from_str8_c_rules(String8 string, S64 *x);
//- rjf: string -> integer (base64 & base16)
internal U64 base64_size_from_data_size(U64 size_in_bytes);
internal U64 base64_from_data(U8 *dst, U8 *src, U64 src_size);
internal U64 base16_size_from_data_size(U64 size_in_bytes);
internal U64 base16_from_data(U8 *dst, U8 *src, U64 src_size);
//- rjf: integer -> string
internal String8 str8_from_memory_size(Arena *arena, U64 z);
internal String8 str8_from_u64(Arena *arena, U64 u64, U32 radix, U8 min_digits, U8 digit_group_separator);
internal String8 str8_from_s64(Arena *arena, S64 s64, U32 radix, U8 min_digits, U8 digit_group_separator);
////////////////////////////////
//~ rjf: String <=> Float Conversions
internal F64 f64_from_str8(String8 string);
////////////////////////////////
//~ rjf: String List Construction Functions
internal String8Node* str8_list_push_node(String8List *list, String8Node *node);
internal String8Node* str8_list_push_node_set_string(String8List *list, String8Node *node, String8 string);
internal String8Node* str8_list_push_node_front(String8List *list, String8Node *node);
internal String8Node* str8_list_push_node_front_set_string(String8List *list, String8Node *node, String8 string);
internal String8Node* str8_list_push(Arena *arena, String8List *list, String8 string);
internal String8Node* str8_list_push_front(Arena *arena, String8List *list, String8 string);
internal void str8_list_concat_in_place(String8List *list, String8List *to_push);
internal String8Node* str8_list_push_aligner(Arena *arena, String8List *list, U64 min, U64 align);
internal String8Node* str8_list_pushf(Arena *arena, String8List *list, char *fmt, ...);
internal String8Node* str8_list_push_frontf(Arena *arena, String8List *list, char *fmt, ...);
internal String8List str8_list_copy(Arena *arena, String8List *list);
#define str8_list_first(list) ((list)->first ? (list)->first->string : str8_zero())
////////////////////////////////
//~ rjf: String Splitting & Joining
internal String8List str8_split(Arena *arena, String8 string, U8 *split_chars, U64 split_char_count, StringSplitFlags flags);
internal String8List str8_split_by_string_chars(Arena *arena, String8 string, String8 split_chars, StringSplitFlags flags);
internal String8List str8_list_split_by_string_chars(Arena *arena, String8List list, String8 split_chars, StringSplitFlags flags);
internal String8 str8_list_join(Arena *arena, String8List *list, StringJoin *optional_params);
internal void str8_list_from_flags(Arena *arena, String8List *list, U32 flags, String8 *flag_string_table, U32 flag_string_count);
////////////////////////////////
//~ rjf; String Arrays
internal String8Array str8_array_from_list(Arena *arena, String8List *list);
internal String8Array str8_array_reserve(Arena *arena, U64 count);
////////////////////////////////
//~ rjf: String Path Helpers
internal String8 str8_chop_last_slash(String8 string);
internal String8 str8_skip_last_slash(String8 string);
internal String8 str8_chop_last_dot(String8 string);
internal String8 str8_skip_last_dot(String8 string);
internal PathStyle path_style_from_str8(String8 string);
internal String8List str8_split_path(Arena *arena, String8 string);
internal void str8_path_list_resolve_dots_in_place(String8List *path, PathStyle style);
internal String8 str8_path_list_join_by_style(Arena *arena, String8List *path, PathStyle style);
internal String8TxtPtPair str8_txt_pt_pair_from_string(String8 string);
////////////////////////////////
//~ rjf: UTF-8 & UTF-16 Decoding/Encoding
internal UnicodeDecode utf8_decode(U8 *str, U64 max);
internal UnicodeDecode utf16_decode(U16 *str, U64 max);
internal U32 utf8_encode(U8 *str, U32 codepoint);
internal U32 utf16_encode(U16 *str, U32 codepoint);
internal U32 utf8_from_utf32_single(U8 *buffer, U32 character);
////////////////////////////////
//~ rjf: Unicode String Conversions
internal String8 str8_from_16(Arena *arena, String16 in);
internal String16 str16_from_8(Arena *arena, String8 in);
internal String8 str8_from_32(Arena *arena, String32 in);
internal String32 str32_from_8(Arena *arena, String8 in);
////////////////////////////////
//~ rjf: Basic Types & Space Enum -> String Conversions
internal String8 string_from_dimension(Dimension dimension);
internal String8 string_from_side(Side side);
internal String8 string_from_operating_system(OperatingSystem os);
internal String8 string_from_architecture(Architecture arch);
////////////////////////////////
//~ rjf: Time Types -> String
internal String8 string_from_week_day(WeekDay week_day);
internal String8 string_from_month(Month month);
internal String8 push_date_time_string(Arena *arena, DateTime *date_time);
internal String8 push_file_name_date_time_string(Arena *arena, DateTime *date_time);
internal String8 string_from_elapsed_time(Arena *arena, DateTime dt);
////////////////////////////////
//~ rjf: String <-> Color
internal String8 hex_string_from_rgba_4f32(Arena *arena, Vec4F32 rgba);
internal Vec4F32 rgba_from_hex_string_4f32(String8 hex_string);
////////////////////////////////
//~ NOTE(allen): Serialization Helpers
internal void str8_serial_begin(Arena *arena, String8List *srl);
internal String8 str8_serial_end(Arena *arena, String8List *srl);
internal void str8_serial_write_to_dst(String8List *srl, void *out);
internal U64 str8_serial_push_align(Arena *arena, String8List *srl, U64 align);
internal void * str8_serial_push_size(Arena *arena, String8List *srl, U64 size);
internal void * str8_serial_push_data(Arena *arena, String8List *srl, void *data, U64 size);
internal void str8_serial_push_data_list(Arena *arena, String8List *srl, String8Node *first);
internal void str8_serial_push_u64(Arena *arena, String8List *srl, U64 x);
internal void str8_serial_push_u32(Arena *arena, String8List *srl, U32 x);
internal void str8_serial_push_u16(Arena *arena, String8List *srl, U16 x);
internal void str8_serial_push_u8(Arena *arena, String8List *srl, U8 x);
internal void str8_serial_push_cstr(Arena *arena, String8List *srl, String8 str);
internal void str8_serial_push_string(Arena *arena, String8List *srl, String8 str);
#define str8_serial_push_array(arena, srl, ptr, count) str8_serial_push_data(arena, srl, ptr, sizeof(*(ptr)) * (count))
#define str8_serial_push_struct(arena, srl, ptr) str8_serial_push_array(arena, srl, ptr, 1)
////////////////////////////////
//~ rjf: Deserialization Helpers
internal U64 str8_deserial_read(String8 string, U64 off, void *read_dst, U64 read_size, U64 granularity);
internal U64 str8_deserial_find_first_match(String8 string, U64 off, U16 scan_val);
internal void * str8_deserial_get_raw_ptr(String8 string, U64 off, U64 size);internal U64 str8_deserial_read_cstr(String8 string, U64 off, String8 *cstr_out);
internal U64 str8_deserial_read_windows_utf16_string16(String8 string, U64 off, String16 *str_out);
internal U64 str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out);
#define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr))*(count), sizeof(*(ptr)))
#define str8_deserial_read_struct(string, off, ptr) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr)), sizeof(*(ptr)))
#endif // BASE_STRING_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_STRINGS_H
#define BASE_STRINGS_H
////////////////////////////////
//~ rjf: String Types
typedef struct String8 String8;
struct String8
{
U8 *str;
U64 size;
};
typedef struct String16 String16;
struct String16
{
U16 *str;
U64 size;
};
typedef struct String32 String32;
struct String32
{
U32 *str;
U64 size;
};
////////////////////////////////
//~ rjf: String List & Array Types
typedef struct String8Node String8Node;
struct String8Node
{
String8Node *next;
String8 string;
};
typedef struct String8List String8List;
struct String8List
{
String8Node *first;
String8Node *last;
U64 node_count;
U64 total_size;
};
typedef struct String8Array String8Array;
struct String8Array
{
String8 *v;
U64 count;
U64 total_size;
};
////////////////////////////////
//~ rjf: String Matching, Splitting, & Joining Types
typedef U32 StringMatchFlags;
enum
{
StringMatchFlag_CaseInsensitive = (1 << 0),
StringMatchFlag_RightSideSloppy = (1 << 1),
StringMatchFlag_SlashInsensitive = (1 << 2),
};
typedef U32 StringSplitFlags;
enum
{
StringSplitFlag_KeepEmpties = (1 << 0),
};
typedef enum PathStyle
{
PathStyle_Null,
PathStyle_Relative,
PathStyle_WindowsAbsolute,
PathStyle_UnixAbsolute,
#if OS_WINDOWS
PathStyle_SystemAbsolute = PathStyle_WindowsAbsolute
#elif OS_LINUX
PathStyle_SystemAbsolute = PathStyle_UnixAbsolute
#else
# error Absolute path style is undefined for this OS.
#endif
}
PathStyle;
typedef struct StringJoin StringJoin;
struct StringJoin
{
String8 pre;
String8 sep;
String8 post;
};
////////////////////////////////
//~ rjf: String Pair Types
typedef struct String8TxtPtPair String8TxtPtPair;
struct String8TxtPtPair
{
String8 string;
TxtPt pt;
};
////////////////////////////////
//~ rjf: UTF Decoding Types
typedef struct UnicodeDecode UnicodeDecode;
struct UnicodeDecode
{
U32 inc;
U32 codepoint;
};
////////////////////////////////
//~ rjf: String Fuzzy Matching Types
typedef struct FuzzyMatchRangeNode FuzzyMatchRangeNode;
struct FuzzyMatchRangeNode
{
FuzzyMatchRangeNode *next;
Rng1U64 range;
};
typedef struct FuzzyMatchRangeList FuzzyMatchRangeList;
struct FuzzyMatchRangeList
{
FuzzyMatchRangeNode *first;
FuzzyMatchRangeNode *last;
U64 count;
U64 needle_part_count;
U64 total_dim;
};
////////////////////////////////
//~ rjf: Character Classification & Conversion Functions
internal B32 char_is_space(U8 c);
internal B32 char_is_upper(U8 c);
internal B32 char_is_lower(U8 c);
internal B32 char_is_alpha(U8 c);
internal B32 char_is_slash(U8 c);
internal B32 char_is_digit(U8 c, U32 base);
internal U8 lower_from_char(U8 c);
internal U8 upper_from_char(U8 c);
internal U8 correct_slash_from_char(U8 c);
////////////////////////////////
//~ rjf: C-String Measurement
internal U64 cstring8_length(U8 *c);
internal U64 cstring16_length(U16 *c);
internal U64 cstring32_length(U32 *c);
////////////////////////////////
//~ rjf: String Constructors
#define s(S) str8_lit(S)
#define str8_lit(S) str8((U8*)(S), sizeof(S) - 1)
#define str8_lit_comp(S) {(U8*)(S), sizeof(S) - 1,}
#define str8_lit_cstr(S) str8((U8*)(S), sizeof(S))
#define str8_varg(S) (int)((S).size), ((S).str)
#define str8_array(S,C) str8((U8*)(S), sizeof(*(S))*(C))
#define str8_array_fixed(S) str8((U8*)(S), sizeof(S))
#define str8_struct(S) str8((U8*)(S), sizeof(*(S)))
internal String8 str8(U8 *str, U64 size);
internal String8 str8_range(U8 *first, U8 *one_past_last);
internal String8 str8_zero(void);
internal String16 str16(U16 *str, U64 size);
internal String16 str16_range(U16 *first, U16 *one_past_last);
internal String16 str16_zero(void);
internal String32 str32(U32 *str, U64 size);
internal String32 str32_range(U32 *first, U32 *one_past_last);
internal String32 str32_zero(void);
internal String8 str8_cstring(char *c);
internal String16 str16_cstring(U16 *c);
internal String32 str32_cstring(U32 *c);
internal String8 str8_cstring_capped(void *cstr, void *cap);
internal String16 str16_cstring_capped(void *cstr, void *cap);
////////////////////////////////
//~ rjf: String Stylization
internal String8 upper_from_str8(Arena *arena, String8 string);
internal String8 lower_from_str8(Arena *arena, String8 string);
internal String8 backslashed_from_str8(Arena *arena, String8 string);
////////////////////////////////
//~ rjf: String Matching
#define str8_match_lit(a_lit, b, flags) str8_match(str8_lit(a_lit), (b), (flags))
#define str8_match_cstr(a_cstr, b, flags) str8_match(str8_cstring(a_cstr), (b), (flags))
internal B32 str8_match(String8 a, String8 b, StringMatchFlags flags);
#define str8_matchi(a, b) str8_match(a, b, StringMatchFlag_CaseInsensitive)
internal B32 str8_match_wildcard(String8 string, String8 pattern, StringMatchFlags flags);
internal B32 str8_starts_with(String8 string, String8 expected_prefix);
internal B32 str8_starts_withi(String8 string, String8 expected_prefix);
internal U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal U64 str8_find_needle_reverse(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal B32 str8_is_before(String8 a, String8 b);
#define str8_ends_with(string, end, flags) str8_match(str8_postfix((string), (end).size), (end), (flags))
////////////////////////////////
//~ rjf: String Slicing
internal String8 str8_substr(String8 str, Rng1U64 range);
internal String8 str8_prefix(String8 str, U64 size);
internal String8 str8_skip(String8 str, U64 amt);
internal String8 str8_postfix(String8 str, U64 size);
internal String8 str8_chop(String8 str, U64 amt);
internal String8 str8_chop_line(String8 *str);
internal String8 str8_skip_chop_whitespace(String8 string);
internal String8 str8_skip_chop_slashes(String8 string);
////////////////////////////////
//~ rjf: String Formatting & Copying
internal String8 str8_cat(Arena *arena, String8 s1, String8 s2);
internal String8 str8_copy(Arena *arena, String8 s);
internal String8 str8fv(Arena *arena, char *fmt, va_list args);
internal String8 str8f(Arena *arena, char *fmt, ...);
// TODO(rjf): remove these once we're ready to convert all usages:
#define push_str8_cat(arena, s1, s2) str8_cat((arena), (s1), (s2))
#define push_str8_copy(arena, s) str8_copy((arena), (s))
#define push_str8fv(arena, fmt, args) str8fv((arena), (fmt), (args))
#define push_str8f(arena, ...) str8f((arena), __VA_ARGS__)
internal String8 push_cstr(Arena *arena, String8 str); // TODO(rjf): this is unnecessary - this is implied by `push_str8_copy`. need to remove.
////////////////////////////////
//~ rjf: String <=> Integer Conversions
//- rjf: string -> integer
internal S64 sign_from_str8(String8 string, String8 *string_tail);
internal B32 str8_is_integer(String8 string, U32 radix);
internal B32 str8_is_integer_signed(String8 string, U32 radix);
internal U64 u64_from_str8(String8 string, U32 radix);
internal S64 s64_from_str8(String8 string, U32 radix);
internal U32 u32_from_str8(String8 string, U32 radix);
internal S32 s32_from_str8(String8 string, U32 radix);
internal B32 try_u64_from_str8_c_rules(String8 string, U64 *x);
internal B32 try_s64_from_str8_c_rules(String8 string, S64 *x);
//- rjf: integer -> string
internal String8 str8_from_memory_size(Arena *arena, U64 size);
internal String8 str8_from_count(Arena *arena, U64 count);
internal String8 str8_from_bits_u32(Arena *arena, U32 x);
internal String8 str8_from_bits_u64(Arena *arena, U64 x);
internal String8 str8_from_u64(Arena *arena, U64 u64, U32 radix, U8 min_digits, U8 digit_group_separator);
internal String8 str8_from_s64(Arena *arena, S64 s64, U32 radix, U8 min_digits, U8 digit_group_separator);
////////////////////////////////
//~ rjf: String <=> Float Conversions
internal F64 f64_from_str8(String8 string);
////////////////////////////////
//~ rjf: String List Construction Functions
internal String8Node *str8_list_push_node(String8List *list, String8Node *node);
internal String8Node *str8_list_push_node_set_string(String8List *list, String8Node *node, String8 string);
internal String8Node *str8_list_push_node_front(String8List *list, String8Node *node);
internal String8Node *str8_list_push_node_front_set_string(String8List *list, String8Node *node, String8 string);
internal String8Node *str8_list_push(Arena *arena, String8List *list, String8 string);
internal String8Node *str8_list_push_front(Arena *arena, String8List *list, String8 string);
internal void str8_list_concat_in_place(String8List *list, String8List *to_push);
internal String8Node* str8_list_push_aligner(Arena *arena, String8List *list, U64 min, U64 align);
internal String8Node* str8_list_pushf(Arena *arena, String8List *list, char *fmt, ...);
internal String8Node* str8_list_push_frontf(Arena *arena, String8List *list, char *fmt, ...);
internal String8Node* str8_list_pop_front(String8List *list);
internal String8List str8_list_copy(Arena *arena, String8List *list);
internal String8List str8_list_substr(Arena *arena, String8List list, Rng1U64 range);
#define str8_list_first(list) ((list)->first ? (list)->first->string : str8_zero())
////////////////////////////////
//~ rjf: String Splitting & Joining
internal String8List str8_split(Arena *arena, String8 string, U8 *split_chars, U64 split_char_count, StringSplitFlags flags);
internal String8List str8_split_by_string_chars(Arena *arena, String8 string, String8 split_chars, StringSplitFlags flags);
internal String8 str8_list_join(Arena *arena, String8List *list, StringJoin *optional_params);
////////////////////////////////
//~ rjf: Basic Data Stringification Helpers
internal String8List numeric_str8_list_from_data(Arena *arena, U32 radix, String8 data, U64 stride);
////////////////////////////////
//~ rjf; String Arrays
internal String8Array str8_array_zero(void);
internal String8Array str8_array_from_list(Arena *arena, String8List *list);
internal String8Array str8_array_reserve(Arena *arena, U64 count);
internal String8Array str8_array_copy(Arena *arena, String8Array array);
////////////////////////////////
//~ rjf: String <-> Version Helpers
internal U64 version_from_str8(String8 string);
internal String8 str8_from_version(Arena *arena, U64 version);
////////////////////////////////
//~ rjf: String Path Helpers
global read_only struct
{
String8 string;
PathStyle path_style;
}
g_path_style_map[] =
{
{ str8_lit_comp(""), PathStyle_Null },
{ str8_lit_comp("relative"), PathStyle_Relative },
{ str8_lit_comp("windows"), PathStyle_WindowsAbsolute },
{ str8_lit_comp("unix"), PathStyle_UnixAbsolute },
{ str8_lit_comp("system"), PathStyle_SystemAbsolute },
};
internal String8 program_ext_postfix_from_os(OperatingSystem os, B32 require_ext);
internal String8 str8_chop_last_slash(String8 string);
internal String8 str8_skip_last_slash(String8 string);
internal String8 str8_chop_last_dot(String8 string);
internal String8 str8_skip_last_dot(String8 string);
internal PathStyle path_style_from_str8(String8 string);
internal String8List str8_split_path(Arena *arena, String8 string);
internal void str8_path_list_resolve_dots_in_place(String8List *path, PathStyle style);
internal String8 str8_path_list_join_by_style(Arena *arena, String8List *path, PathStyle style);
internal String8TxtPtPair str8_txt_pt_pair_from_string(String8 string);
////////////////////////////////
//~ rjf: Relative <-> Absolute Path
internal String8 path_relative_dst_from_absolute_dst_src(Arena *arena, String8 dst, String8 src);
internal String8 path_absolute_dst_from_relative_dst_src(Arena *arena, String8 dst, String8 src);
////////////////////////////////
//~ rjf: Path Normalization
internal String8List path_normalized_list_from_string(Arena *arena, String8 path, PathStyle *style_out);
internal String8 path_normalized_from_string(Arena *arena, String8 path);
internal B32 path_match_normalized(String8 left, String8 right);
////////////////////////////////
//~ rjf: Misc. Path Helpers
internal PathStyle path_style_from_string(String8 string);
internal String8 string_from_path_style(PathStyle style);
internal String8 path_separator_string_from_style(PathStyle style);
internal StringMatchFlags path_match_flags_from_os(OperatingSystem os);
internal String8 path_convert_slashes(Arena *arena, String8 path, PathStyle path_style);
internal String8 path_replace_file_extension(Arena *arena, String8 file_name, String8 ext);
////////////////////////////////
//~ rjf: UTF-8 & UTF-16 Decoding/Encoding
internal UnicodeDecode utf8_decode(U8 *str, U64 max);
internal UnicodeDecode utf16_decode(U16 *str, U64 max);
internal U32 utf8_encode(U8 *str, U32 codepoint);
internal U32 utf16_encode(U16 *str, U32 codepoint);
////////////////////////////////
//~ rjf: Unicode String Conversions
internal String8 str8_from_16(Arena *arena, String16 in);
internal String16 str16_from_8(Arena *arena, String8 in);
internal String8 str8_from_32(Arena *arena, String32 in);
internal String32 str32_from_8(Arena *arena, String8 in);
////////////////////////////////
//~ rjf: Basic Types & Space Enum <-> String Conversions
internal OperatingSystem operating_system_from_string(String8 string);
internal String8 string_from_dimension(Dimension dimension);
internal String8 string_from_side(Side side);
internal String8 string_from_operating_system(OperatingSystem os);
internal String8 string_from_arch(Arch arch);
internal String8 string_from_week_day(WeekDay week_day);
internal String8 string_from_month(Month month);
internal String8 string_from_date_time(Arena *arena, DateTime *date_time);
internal String8 string_from_date_time__file_name(Arena *arena, DateTime *date_time);
internal String8 string_from_elapsed_time(Arena *arena, DateTime dt);
////////////////////////////////
//~ rjf: String <-> Globally Unique IDs
internal String8 string_from_guid(Arena *arena, Guid guid);
internal B32 try_guid_from_string(String8 string, Guid *guid_out);
internal Guid guid_from_string(String8 string);
////////////////////////////////
//~ rjf: Basic Text Indentation
internal String8 indented_from_string(Arena *arena, String8 string);
////////////////////////////////
//~ rjf: Text Escaping
internal String8 escaped_from_raw_str8(Arena *arena, String8 string);
internal String8 raw_from_escaped_str8(Arena *arena, String8 string);
////////////////////////////////
//~ rjf: Text Wrapping
internal String8List wrapped_lines_from_string(Arena *arena, String8 string, U64 first_line_max_width, U64 max_width, U64 wrap_indent);
////////////////////////////////
//~ rjf: String <-> Color
internal String8 hex_string_from_rgba_4f32(Arena *arena, Vec4F32 rgba);
internal Vec4F32 rgba_from_hex_string_4f32(String8 hex_string);
////////////////////////////////
//~ rjf: String Fuzzy Matching
internal FuzzyMatchRangeList fuzzy_match_find(Arena *arena, String8 needle, String8 haystack);
internal FuzzyMatchRangeList fuzzy_match_range_list_copy(Arena *arena, FuzzyMatchRangeList *src);
////////////////////////////////
//~ NOTE(allen): Serialization Helpers
internal void str8_serial_begin(Arena *arena, String8List *srl);
internal String8 str8_serial_end(Arena *arena, String8List *srl);
internal void str8_serial_write_to_dst(String8List *srl, void *out);
internal U64 str8_serial_push_align(Arena *arena, String8List *srl, U64 align);
internal void * str8_serial_push_size(Arena *arena, String8List *srl, U64 size);
internal void * str8_serial_push_data(Arena *arena, String8List *srl, void *data, U64 size);
internal void str8_serial_push_data_list(Arena *arena, String8List *srl, String8Node *first);
internal void * str8_serial_push_u64(Arena *arena, String8List *srl, U64 x);
internal void * str8_serial_push_u32(Arena *arena, String8List *srl, U32 x);
internal void * str8_serial_push_u16(Arena *arena, String8List *srl, U16 x);
internal void * str8_serial_push_u8(Arena *arena, String8List *srl, U8 x);
internal void * str8_serial_push_cstr(Arena *arena, String8List *srl, String8 str);
internal void * str8_serial_push_string(Arena *arena, String8List *srl, String8 str);
#define str8_serial_push_array(arena, srl, ptr, count) str8_serial_push_data(arena, srl, ptr, sizeof(*(ptr)) * (count))
#define str8_serial_push_struct(arena, srl, ptr) str8_serial_push_array(arena, srl, ptr, 1)
////////////////////////////////
//~ rjf: Deserialization Helpers
internal U64 str8_deserial_read(String8 string, U64 off, void *read_dst, U64 read_size, U64 granularity);
internal U64 str8_deserial_find_first_match(String8 string, U64 off, U16 scan_val);
internal void * str8_deserial_get_raw_ptr(String8 string, U64 off, U64 size);
internal U64 str8_deserial_read_cstr(String8 string, U64 off, String8 *cstr_out);
internal U64 str8_deserial_read_windows_utf16_string16(String8 string, U64 off, String16 *str_out);
internal U64 str8_deserial_read_block(String8 string, U64 off, U64 size, String8 *block_out);
#define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr))*(count), sizeof(*(ptr)))
#define str8_deserial_read_struct(string, off, ptr) str8_deserial_read_array(string, off, ptr, 1)
internal U64 str8_deserial_read_uleb128(String8 string, U64 off, U64 *value_out);
internal U64 str8_deserial_read_sleb128(String8 string, U64 off, S64 *value_out);
////////////////////////////////
//~ string buffer
internal B32 str8_buffer_skip(String8Node *buf, U64 *pos, U64 skip);
internal U64 str8_buffer_read(String8Node *buf, U64 *pos, U64 read_size, void *out);
internal U64 str8_buffer_peek(String8Node *buf, U64 *pos, U64 read_size, void *out);
internal U64 str8_buffer_write(String8Node *buf, U64 *pos, String8 data);
internal U64 str8_buffer_write_u16(String8Node *buf, U64 *pos, U16 v);
internal U64 str8_buffer_write_u32(String8Node *buf, U64 *pos, U32 v);
internal U64 str8_buffer_write_zeroes(String8Node *buf, U64 *pos, U64 size);
internal U64 str8_buffer_write_string_list(String8Node *buf, U64 *pos, String8List list);
////////////////////////////////
//~ rjf: Basic String Hashes
internal U64 u64_hash_from_seed_str8(U64 seed, String8 string);
internal U64 u64_hash_from_str8(String8 string);
internal U128 u128_hash_from_seed_str8(U64 seed, String8 string);
internal U128 u128_hash_from_str8(String8 string);
#endif // BASE_STRINGS_H
+2
View File
@@ -0,0 +1,2 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
+22
View File
@@ -0,0 +1,22 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_SYSTEM_H
#define BASE_SYSTEM_H
typedef struct SystemInfo SystemInfo;
struct SystemInfo
{
U32 logical_processor_count;
U64 page_size;
U64 large_page_size;
U64 allocation_granularity;
String8 machine_name;
};
////////////////////////////////
//~ rjf: @per_os_impl System Info
internal SystemInfo *get_system_info(void);
#endif // BASE_SYSTEM_H
+51
View File
@@ -0,0 +1,51 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#if BUILD_TESTS
internal String8
test_build_exe_path(Arena *arena, String8 name)
{
String8 folder = get_process_info()->binary_path;
String8 path = str8f(arena, "%S/%S%S", folder, name, program_ext_postfix_from_os(OperatingSystem_CURRENT, 0));
return path;
}
internal String8
test_input_path(Arena *arena, TestCtx *ctx, String8 name)
{
String8 path = str8f(arena, "%S/%S", ctx->input_data_path, name);
return path;
}
internal String8
test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name)
{
String8 path = str8f(arena, "%S/%S%S", ctx->input_data_path, name, program_ext_postfix_from_os(OperatingSystem_CURRENT, 1));
return path;
}
internal String8
test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name)
{
String8 path = str8f(arena, "%S/%S", ctx->exemplars_path, name);
return path;
}
internal void
base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_cstr, int line, int skip)
{
String8 file_path = str8_cstring(file_path_cstr);
U64 src_min = str8_find_needle(file_path, 0, s("src/"), StringMatchFlag_SlashInsensitive);
U64 src_max = src_min + str8_lit("src/").size;
U64 layer_slash_max = str8_find_needle(file_path, src_max, s("/"), StringMatchFlag_SlashInsensitive);
TestInfo *t = &test_infos[test_infos_count++];
t->layer = str8_substr(file_path, r1u64(src_max, layer_slash_max));
t->label = str8_cstring(func_name_cstr);
t->decl_line = line;
t->skip = skip;
t->test_fn = fn;
}
#endif
+101
View File
@@ -0,0 +1,101 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_TEST_H
#define BASE_TEST_H
typedef enum TestStatus
{
TestStatus_Fail,
TestStatus_Crash,
TestStatus_Pass,
TestStatus_Skip,
TestStatus_COUNT
}
TestStatus;
typedef struct TestResult TestResult;
struct TestResult
{
TestStatus status;
char *fail_file;
int fail_line;
char *fail_cond;
};
typedef struct TestCtx TestCtx;
struct TestCtx
{
CmdLine *cmdline;
String8 exemplars_path;
String8 artifacts_path;
String8 input_data_path;
TestResult *result_out;
String8List *test_out;
};
#define TEST_FUNCTION_SIG(name) void name(Arena *arena, TestCtx *ctx)
#define TEST_FUNCTION_DEF(name) TEST_FUNCTION_SIG(test__##name)
typedef TEST_FUNCTION_SIG(TestFunctionType);
typedef struct TestInfo TestInfo;
struct TestInfo
{
String8 layer;
String8 label;
S64 decl_line;
B32 skip;
TestFunctionType *test_fn;
};
#if BUILD_TESTS
// alloc storage for the tests
global U16 test_infos_count = 0;
global TestInfo test_infos[0xffff] = {0};
internal String8 test_build_exe_path(Arena *arena, String8 name);
internal String8 test_input_path(Arena *arena, TestCtx *ctx, String8 name);
internal String8 test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name);
internal String8 test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name);
internal void base_register_test(char *func_name, TestFunctionType *fn, char *file_path, int line, int skip);
#define AddTest(name, file_path, line, skip_, ...) \
TEST_FUNCTION_DEF(name); \
__VA_ARGS__ void add_test__##name(void) { base_register_test(Stringify(name), test__##name, file_path, line, skip_); }
# if COMPILER_MSVC
# pragma section(".CRT$XCU", read)
# define DeclareTest(name, skip) \
/* register test */ AddTest(name, __FILE__, __LINE__, (skip)) \
/* alloc function pointer */ __declspec(allocate(".CRT$XCU")) void (*add_test_ptr__##name)(void) = add_test__##name; \
/* do not GC test caller */ __pragma(comment(linker, "/include:" Stringify(add_test_ptr__##name)))
# elif COMPILER_GCC || COMPILER_CLANG
// clang and gcc allocate memory for the function pointer automatically
# define DeclareTest(name, skip) AddTest(name, __FILE__, __LINE__, (skip), __attribute__((constructor)))
# else
# error DeclareTest not defined for this compiler.
# endif
#else
# define DeclareTest(name, skip)
#endif
#define Test(name) DeclareTest(name, 0) TEST_FUNCTION_DEF(name)
#define SkippedTest(name) DeclareTest(name, 1) TEST_FUNCTION_DEF(name)
#define TestCheck(c) do { if (!(c)) { \
/* record failed check */ ctx->result_out[0] = (TestResult){ .fail_file = __FILE__, .fail_line = __LINE__, .fail_cond = Stringify(c) }; \
/* under debugger? -> trap */ if(debugger_is_attached()) { Trap(); } \
/* exit test */ return; \
} } while(0)
#define TestSkip() do { \
ctx->result_out[0] = (TestResult){ .status = TestStatus_Skip }; \
return; \
} while(0)
// test log
#define test_out(string) str8_list_push(arena, ctx->test_out, (string))
#define test_outf(...) str8_list_pushf(arena, ctx->test_out, __VA_ARGS__)
#endif // BASE_TEST_H
+234 -78
View File
@@ -1,78 +1,234 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
// NOTE(allen): Thread Context Functions
C_LINKAGE thread_static TCTX* tctx_thread_local;
#if !SUPPLEMENT_UNIT
C_LINKAGE thread_static TCTX* tctx_thread_local = 0;
#endif
internal void
tctx_init_and_equip(TCTX *tctx){
MemoryZeroStruct(tctx);
Arena **arena_ptr = tctx->arenas;
for (U64 i = 0; i < ArrayCount(tctx->arenas); i += 1, arena_ptr += 1){
*arena_ptr = arena_alloc();
}
tctx_thread_local = tctx;
}
internal TCTX*
tctx_get_equipped(void){
return(tctx_thread_local);
}
internal Arena*
tctx_get_scratch(Arena **conflicts, U64 count){
TCTX *tctx = tctx_get_equipped();
Arena *result = 0;
Arena **arena_ptr = tctx->arenas;
for (U64 i = 0; i < ArrayCount(tctx->arenas); i += 1, arena_ptr += 1){
Arena **conflict_ptr = conflicts;
B32 has_conflict = 0;
for (U64 j = 0; j < count; j += 1, conflict_ptr += 1){
if (*arena_ptr == *conflict_ptr){
has_conflict = 1;
break;
}
}
if (!has_conflict){
result = *arena_ptr;
break;
}
}
return(result);
}
internal void
tctx_set_thread_name(String8 string){
TCTX *tctx = tctx_get_equipped();
U64 size = ClampTop(string.size, sizeof(tctx->thread_name));
MemoryCopy(tctx->thread_name, string.str, size);
tctx->thread_name_size = size;
}
internal String8
tctx_get_thread_name(void){
TCTX *tctx = tctx_get_equipped();
String8 result = str8(tctx->thread_name, tctx->thread_name_size);
return(result);
}
internal void
tctx_write_srcloc(char *file_name, U64 line_number){
TCTX *tctx = tctx_get_equipped();
tctx->file_name = file_name;
tctx->line_number = line_number;
}
internal void
tctx_read_srcloc(char **file_name, U64 *line_number){
TCTX *tctx = tctx_get_equipped();
*file_name = tctx->file_name;
*line_number = tctx->line_number;
}
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Globals
C_LINKAGE thread_static TCTX *tctx_thread_local;
#if !BUILD_SUPPLEMENTARY_UNIT
C_LINKAGE thread_static TCTX *tctx_thread_local = 0;
#endif
////////////////////////////////
//~ rjf: Thread Context Functions
//- rjf: thread-context allocation & selection
internal TCTX *
tctx_alloc(void)
{
#if PROFILE_TELEMETRY
thread_static static char name[2][1024];
raddbg_snprintf(name[0], sizeof(name[0]), "Scratch/0[TID:%u]", tid());
raddbg_snprintf(name[1], sizeof(name[1]), "Scratch/1[TID:%u]", tid());
Arena *arena_0 = arena_alloc(.name = name[0]);
Arena *arena_1 = arena_alloc(.name = name[1]);
#else
Arena *arena_0 = arena_alloc();
Arena *arena_1 = arena_alloc();
#endif
TCTX *tctx = push_array(arena_0, TCTX, 1);
tctx->arenas[0] = arena_0;
tctx->arenas[1] = arena_1;
tctx->lane_ctx.lane_count = 1;
return tctx;
}
internal void
tctx_release(TCTX *tctx)
{
arena_release(tctx->arenas[1]);
arena_release(tctx->arenas[0]);
}
internal void
tctx_select(TCTX *tctx)
{
tctx_thread_local = tctx;
}
internal TCTX *
tctx_selected(void)
{
return tctx_thread_local;
}
//- rjf: scratch arenas
internal Arena *
tctx_get_scratch(Arena **conflicts, U64 count)
{
TCTX *tctx = tctx_selected();
Arena *result = 0;
Arena **arena_ptr = tctx->arenas;
for(U64 i = 0; i < ArrayCount(tctx->arenas); i += 1, arena_ptr += 1)
{
Arena **conflict_ptr = conflicts;
B32 has_conflict = 0;
for(U64 j = 0; j < count; j += 1, conflict_ptr += 1)
{
if(*arena_ptr == *conflict_ptr)
{
has_conflict = 1;
break;
}
}
if(!has_conflict)
{
result = *arena_ptr;
break;
}
}
return result;
}
//- rjf: lane metadata
internal LaneCtx
tctx_set_lane_ctx(LaneCtx lane_ctx)
{
TCTX *tctx = tctx_selected();
LaneCtx restore = tctx->lane_ctx;
tctx->lane_ctx = lane_ctx;
return restore;
}
internal void
tctx_lane_barrier_wait(void *broadcast_ptr, U64 broadcast_size, U64 broadcast_src_lane_idx)
{
ProfBeginFunction();
ProfColor(0x00000ff);
TCTX *tctx = tctx_selected();
// rjf: doing broadcast -> copy to broadcast memory on source lane
U64 broadcast_size_clamped = ClampTop(broadcast_size, sizeof(tctx->lane_ctx.broadcast_memory[0]));
if(broadcast_ptr != 0 && lane_idx() == broadcast_src_lane_idx)
{
MemoryCopy(tctx->lane_ctx.broadcast_memory, broadcast_ptr, broadcast_size_clamped);
}
// rjf: all cases: barrier
barrier_wait(tctx->lane_ctx.barrier);
// rjf: doing broadcast -> copy from broadcast memory on destination lanes
if(broadcast_ptr != 0 && lane_idx() != broadcast_src_lane_idx)
{
MemoryCopy(broadcast_ptr, tctx->lane_ctx.broadcast_memory, broadcast_size_clamped);
}
// rjf: doing broadcast -> barrier on all lanes
if(broadcast_ptr != 0)
{
barrier_wait(tctx->lane_ctx.barrier);
}
ProfEnd();
}
//- rjf: thread names
internal void
tctx_set_thread_name(String8 string)
{
TCTX *tctx = tctx_selected();
U64 size = ClampTop(string.size, sizeof(tctx->thread_name));
MemoryCopy(tctx->thread_name, string.str, size);
tctx->thread_name_size = size;
}
internal String8
tctx_get_thread_name(void)
{
TCTX *tctx = tctx_selected();
String8 result = str8(tctx->thread_name, tctx->thread_name_size);
return result;
}
//- rjf: thread source-locations
internal void
tctx_write_srcloc(char *file_name, U64 line_number)
{
TCTX *tctx = tctx_selected();
tctx->file_name = file_name;
tctx->line_number = line_number;
}
internal void
tctx_read_srcloc(char **file_name, U64 *line_number)
{
TCTX *tctx = tctx_selected();
*file_name = tctx->file_name;
*line_number = tctx->line_number;
}
////////////////////////////////
//~ rjf: Touch Scope Functions
internal Access *
access_open(void)
{
if(tctx_thread_local->access_arena == 0)
{
tctx_thread_local->access_arena = arena_alloc();
}
Access *access = tctx_thread_local->free_access;
if(access != 0)
{
SLLStackPop(tctx_thread_local->free_access);
}
else
{
access = push_array_no_zero(tctx_thread_local->access_arena, Access, 1);
}
MemoryZeroStruct(access);
return access;
}
internal void
access_close(Access *access)
{
for(Touch *touch = access->top_touch, *next = 0; touch != 0; touch = next)
{
next = touch->next;
ins_atomic_u64_dec_eval(&touch->pt->access_refcount);
if(touch->cv.u64[0] != 0) { cond_var_broadcast(touch->cv); }
SLLStackPush(tctx_thread_local->free_touch, touch);
}
SLLStackPush(tctx_thread_local->free_access, access);
}
internal void
access_touch(Access *access, AccessPt *pt, CondVar cv)
{
ins_atomic_u64_inc_eval(&pt->access_refcount);
ins_atomic_u64_eval_assign(&pt->last_time_touched_us, now_time_us());
ins_atomic_u64_eval_assign(&pt->last_update_idx_touched, update_tick_idx());
Touch *touch = tctx_thread_local->free_touch;
if(touch != 0)
{
SLLStackPop(tctx_thread_local->free_touch);
}
else
{
touch = push_array_no_zero(tctx_thread_local->access_arena, Touch, 1);
}
MemoryZeroStruct(touch);
SLLStackPush(access->top_touch, touch);
touch->cv = cv;
touch->pt = pt;
}
//- rjf: access points
internal B32
access_pt_is_expired_(AccessPt *pt, AccessPtExpireParams *params)
{
U64 access_refcount = ins_atomic_u64_eval(&pt->access_refcount);
U64 last_time_touched_us = ins_atomic_u64_eval(&pt->last_time_touched_us);
U64 last_update_idx_touched = ins_atomic_u64_eval(&pt->last_update_idx_touched);
B32 result = (access_refcount == 0 &&
last_time_touched_us + params->time <= now_time_us() &&
last_update_idx_touched + params->update_idxs <= update_tick_idx());
return result;
}
+132 -40
View File
@@ -1,40 +1,132 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_THREAD_CONTEXT_H
#define BASE_THREAD_CONTEXT_H
////////////////////////////////
// NOTE(allen): Thread Context
typedef struct TCTX TCTX;
struct TCTX
{
Arena *arenas[2];
U8 thread_name[32];
U64 thread_name_size;
char *file_name;
U64 line_number;
};
////////////////////////////////
// NOTE(allen): Thread Context Functions
internal void tctx_init_and_equip(TCTX *tctx);
internal TCTX* tctx_get_equipped(void);
internal Arena* tctx_get_scratch(Arena **conflicts, U64 count);
internal void tctx_set_thread_name(String8 name);
internal String8 tctx_get_thread_name(void);
internal void tctx_write_srcloc(char *file_name, U64 line_number);
internal void tctx_read_srcloc(char **file_name, U64 *line_number);
#define tctx_write_this_srcloc() tctx_write_srcloc(__FILE__, __LINE__)
#define scratch_begin(conflicts, count) temp_begin(tctx_get_scratch((conflicts), (count)))
#define scratch_end(scratch) temp_end(scratch)
#endif //BASE_THREAD_CONTEXT_H
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_THREAD_CONTEXT_H
#define BASE_THREAD_CONTEXT_H
////////////////////////////////
//~ rjf: Lane Context
typedef struct LaneCtx LaneCtx;
struct LaneCtx
{
U64 lane_idx;
U64 lane_count;
Barrier barrier;
U64 *broadcast_memory;
};
////////////////////////////////
//~ rjf: Access Scopes
typedef struct AccessPt AccessPt;
struct AccessPt
{
U64 access_refcount;
U64 last_time_touched_us;
U64 last_update_idx_touched;
};
typedef struct AccessPtExpireParams AccessPtExpireParams;
struct AccessPtExpireParams
{
U64 time;
U64 update_idxs;
};
typedef struct Touch Touch;
struct Touch
{
Touch *next;
AccessPt *pt;
CondVar cv;
};
typedef struct Access Access;
struct Access
{
Access *next;
Touch *top_touch;
};
////////////////////////////////
//~ rjf: Base Per-Thread State Bundle
typedef struct TCTX TCTX;
struct TCTX
{
// rjf: scratch arenas
Arena *arenas[2];
// rjf: thread name
U8 thread_name[32];
U64 thread_name_size;
// rjf: lane context
LaneCtx lane_ctx;
// rjf: source location info
char *file_name;
U64 line_number;
// rjf: accesses
Arena *access_arena;
Access *free_access;
Touch *free_touch;
// rjf: progress
U64 *progress_counter_ptr;
U64 *progress_target_ptr;
};
////////////////////////////////
//~ rjf: Thread Context Functions
//- rjf: thread-context allocation & selection
internal TCTX *tctx_alloc(void);
internal void tctx_release(TCTX *tctx);
internal void tctx_select(TCTX *tctx);
internal TCTX *tctx_selected(void);
//- rjf: scratch arenas
internal Arena *tctx_get_scratch(Arena **conflicts, U64 count);
#define scratch_begin(conflicts, count) temp_begin(tctx_get_scratch((conflicts), (count)))
#define scratch_end(scratch) temp_end(scratch)
//- rjf: lane metadata
internal LaneCtx tctx_set_lane_ctx(LaneCtx lane_ctx);
internal void tctx_lane_barrier_wait(void *broadcast_ptr, U64 broadcast_size, U64 broadcast_src_lane_idx);
#define lane_idx() (tctx_selected()->lane_ctx.lane_idx)
#define lane_count() (tctx_selected()->lane_ctx.lane_count)
#define lane_from_task_idx(idx) ((idx)%lane_count())
#define lane_ctx(ctx) tctx_set_lane_ctx((ctx))
#define lane_sync() tctx_lane_barrier_wait(0, 0, 0)
#define lane_sync_u64(ptr, src_lane_idx) tctx_lane_barrier_wait((ptr), sizeof(*(ptr)), (src_lane_idx))
#define lane_range(count) m_range_from_n_idx_m_count(lane_idx(), lane_count(), (count))
//- rjf: thread names
internal void tctx_set_thread_name(String8 name);
internal String8 tctx_get_thread_name(void);
//- rjf: thread source-locations
internal void tctx_write_srcloc(char *file_name, U64 line_number);
internal void tctx_read_srcloc(char **file_name, U64 *line_number);
#define tctx_write_this_srcloc() tctx_write_srcloc(__FILE__, __LINE__)
//- rjf: access scopes
internal Access *access_open(void);
internal void access_close(Access *access);
internal void access_touch(Access *access, AccessPt *pt, CondVar cv);
//- rjf: access points
internal B32 access_pt_is_expired_(AccessPt *pt, AccessPtExpireParams *params);
#define access_pt_is_expired(pt, ...) access_pt_is_expired_((pt), &(AccessPtExpireParams){.time = 2000000, .update_idxs = 2, __VA_ARGS__})
//- rjf: progress counters
#define set_progress_ptr(ptr) (tctx_selected()->progress_counter_ptr = (ptr))
#define set_progress_target_ptr(ptr) (tctx_selected()->progress_target_ptr = (ptr))
#define set_progress(val) (tctx_selected()->progress_counter_ptr ? ins_atomic_u64_eval_assign(tctx_selected()->progress_counter_ptr, (val)) : (void)0)
#define add_progress(val) (tctx_selected()->progress_counter_ptr ? ins_atomic_u64_add_eval(tctx_selected()->progress_counter_ptr, (val)) : (void)0)
#define set_progress_target(val) (tctx_selected()->progress_target_ptr ? ins_atomic_u64_eval_assign(tctx_selected()->progress_target_ptr, (val)) : (void)0)
#endif // BASE_THREAD_CONTEXT_H
+204
View File
@@ -0,0 +1,204 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Table Stripe Functions
internal StripeArray
stripe_array_alloc(Arena *arena)
{
StripeArray array = {0};
array.count = get_system_info()->logical_processor_count;
array.v = push_array(arena, Stripe, array.count);
for EachIndex(idx, array.count)
{
array.v[idx].arena = arena_alloc();
array.v[idx].rw_mutex = rw_mutex_alloc();
array.v[idx].cv = cond_var_alloc();
}
return array;
}
internal void
stripe_array_release(StripeArray *stripes)
{
for EachIndex(idx, stripes->count)
{
arena_release(stripes->v[idx].arena);
rw_mutex_release(stripes->v[idx].rw_mutex);
cond_var_release(stripes->v[idx].cv);
}
}
internal Stripe *
stripe_from_slot_idx(StripeArray *stripes, U64 slot_idx)
{
Stripe *stripe = &stripes->v[slot_idx%stripes->count];
return stripe;
}
////////////////////////////////
//~ rjf: Thread Info Helpers
internal void
set_thread_name(String8 string)
{
ProfThreadName("%.*s", str8_varg(string));
set_platform_thread_name(string);
}
internal void
set_thread_namef(char *fmt, ...)
{
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 string = push_str8fv(scratch.arena, fmt, args);
set_thread_name(string);
va_end(args);
scratch_end(scratch);
}
////////////////////////////////
//~ rjf: Platform-Abstracted Synchronization Primitive Functions
//- rjf: slow barriers
typedef struct BarrierNode BarrierNode;
struct BarrierNode
{
BarrierNode *next;
U64 count;
U64 threads_left_to_enter;
U64 threads_left_to_leave;
RWMutex rw_mutex;
CondVar cv;
};
typedef struct BarrierTCTX BarrierTCTX;
struct BarrierTCTX
{
Arena *arena;
BarrierNode *free_barrier_node;
};
thread_static BarrierTCTX *barrier_tctx = 0;
internal Barrier
slow_barrier_alloc(U64 count)
{
if(barrier_tctx == 0)
{
Arena *arena = arena_alloc();
barrier_tctx = push_array(arena, BarrierTCTX, 1);
barrier_tctx->arena = arena;
}
BarrierNode *n = barrier_tctx->free_barrier_node;
if(n != 0)
{
SLLStackPop(barrier_tctx->free_barrier_node);
}
else
{
n = push_array_no_zero(barrier_tctx->arena, BarrierNode, 1);
}
MemoryZeroStruct(n);
n->count = count;
n->threads_left_to_enter = count;
n->rw_mutex = rw_mutex_alloc();
n->cv = cond_var_alloc();
Barrier result = {(U64)n};
return result;
}
internal void
slow_barrier_release(Barrier barrier)
{
if(barrier_tctx == 0)
{
Arena *arena = arena_alloc();
barrier_tctx = push_array(arena, BarrierTCTX, 1);
barrier_tctx->arena = arena;
}
BarrierNode *n = (BarrierNode *)barrier.u64[0];
rw_mutex_release(n->rw_mutex);
cond_var_release(n->cv);
SLLStackPush(barrier_tctx->free_barrier_node, n);
}
internal void
slow_barrier_wait(Barrier barrier)
{
ProfBeginFunction();
BarrierNode *n = (BarrierNode *)barrier.u64[0];
U64 threads_left_to_enter = ins_atomic_u64_dec_eval(&n->threads_left_to_enter);
//- rjf: threads left to enter > 0 => wait
if(threads_left_to_enter > 0)
{
// rjf: first try a spin loop
B32 done_waiting = 0;
ProfScope("spin loop wait") for(U64 spin_count = 0; spin_count < 10000; spin_count += 1)
{
if(ins_atomic_u64_eval(&n->threads_left_to_leave) != 0)
{
done_waiting = 1;
break;
}
}
// rjf: not done waiting -> need to do slow wait on condition variable
if(!done_waiting) ProfScope("slow wait")
{
RWMutexScope(n->rw_mutex, 0) for(;;)
{
if(ins_atomic_u64_eval(&n->threads_left_to_leave) != 0)
{
break;
}
cond_var_wait_rw(n->cv, n->rw_mutex, 0, max_U64);
}
}
// rjf: decrement leave counter
if(ins_atomic_u64_dec_eval(&n->threads_left_to_leave) > 0)
{
ProfScope("signal") cond_var_signal(n->cv);
}
}
//- rjf: threads left to enter == 0 -> last thread, wakeup
else
{
ins_atomic_u64_eval_assign(&n->threads_left_to_enter, n->count);
ProfScope("wake up") RWMutexScope(n->rw_mutex, 1)
{
ins_atomic_u64_eval_assign(&n->threads_left_to_leave, n->count-1);
}
ProfScope("signal") cond_var_signal(n->cv);
}
//- rjf: wait for threads left to leave == 0
ProfScope("wait for threads to leave")
{
for(U64 spin_count = 0;; spin_count += 1)
{
if(ins_atomic_u64_eval(&n->threads_left_to_leave) == 0)
{
break;
}
}
}
ProfEnd();
}
////////////////////////////////
///~ Semaphore
internal void
semaphore_drop(Semaphore semaphore)
{
semaphore_drop_count(semaphore, 1);
}
+159
View File
@@ -0,0 +1,159 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_THREADS_H
#define BASE_THREADS_H
////////////////////////////////
//~ rjf: Thread Types
typedef struct Thread Thread;
struct Thread
{
U64 u64[1];
};
typedef void ThreadEntryPointFunctionType(void *p);
////////////////////////////////
//~ rjf: Synchronization Primitive Types
typedef struct Mutex Mutex;
struct Mutex
{
U64 u64[1];
};
typedef struct RWMutex RWMutex;
struct RWMutex
{
U64 u64[1];
};
typedef struct CondVar CondVar;
struct CondVar
{
U64 u64[1];
};
typedef struct Semaphore Semaphore;
struct Semaphore
{
U64 u64[1];
};
typedef struct Barrier Barrier;
struct Barrier
{
U64 u64[1];
};
////////////////////////////////
//~ rjf: Table Stripes
typedef struct Stripe Stripe;
struct Stripe
{
Arena *arena;
RWMutex rw_mutex;
CondVar cv;
void *free;
};
typedef struct StripeArray StripeArray;
struct StripeArray
{
Stripe *v;
U64 count;
};
////////////////////////////////
//~ rjf: Table Stripe Functions
internal StripeArray stripe_array_alloc(Arena *arena);
internal void stripe_array_release(StripeArray *stripes);
internal Stripe *stripe_from_slot_idx(StripeArray *stripes, U64 slot_idx);
////////////////////////////////
//~ rjf: Thread Info Helpers
internal void set_thread_name(String8 string);
internal void set_thread_namef(char *fmt, ...);
////////////////////////////////
//~ rjf: @per_os_impl Current Thread Info
internal U32 tid(void);
internal void set_platform_thread_name(String8 name);
////////////////////////////////
//~ rjf: @per_os_impl Thread Functions
internal Thread thread_launch(ThreadEntryPointFunctionType *f, void *p);
internal B32 thread_join(Thread thread, U64 endt_us);
internal void thread_detach(Thread thread);
////////////////////////////////
//~ rjf: @per_os_impl Synchronization Primitive Functions
//- rjf: recursive mutexes
internal Mutex mutex_alloc(void);
internal void mutex_release(Mutex mutex);
internal void mutex_take(Mutex mutex);
internal void mutex_drop(Mutex mutex);
//- rjf: reader/writer mutexes
internal RWMutex rw_mutex_alloc(void);
internal void rw_mutex_release(RWMutex mutex);
internal void rw_mutex_take(RWMutex mutex, B32 write_mode);
internal void rw_mutex_drop(RWMutex mutex, B32 write_mode);
#define rw_mutex_take_r(m) rw_mutex_take((m), (0))
#define rw_mutex_take_w(m) rw_mutex_take((m), (1))
#define rw_mutex_drop_r(m) rw_mutex_drop((m), (0))
#define rw_mutex_drop_w(m) rw_mutex_drop((m), (1))
//- rjf: condition variables
internal CondVar cond_var_alloc(void);
internal void cond_var_release(CondVar cv);
// returns false on timeout, true on signal, (max_wait_ms = max_U64) -> no timeout
internal B32 cond_var_wait(CondVar cv, Mutex mutex, U64 endt_us);
internal B32 cond_var_wait_rw(CondVar cv, RWMutex mutex_rw, B32 write_mode, U64 endt_us);
#define cond_var_wait_rw_r(cv, m, endt) cond_var_wait_rw((cv), (m), (0), (endt))
#define cond_var_wait_rw_w(cv, m, endt) cond_var_wait_rw((cv), (m), (1), (endt))
internal void cond_var_signal(CondVar cv);
internal void cond_var_broadcast(CondVar cv);
//- rjf: cross-process semaphores
internal Semaphore semaphore_alloc(U32 initial_count, U32 max_count, String8 name);
internal void semaphore_release(Semaphore semaphore);
internal Semaphore semaphore_open(String8 name);
internal void semaphore_close(Semaphore semaphore);
internal B32 semaphore_take(Semaphore semaphore, U64 endt_us);
internal void semaphore_drop(Semaphore semaphore);
internal void semaphore_drop_count(Semaphore semaphore, U64 drop_count);
//- rjf: barriers
internal Barrier barrier_alloc(U64 count);
internal void barrier_release(Barrier barrier);
internal void barrier_wait(Barrier barrier);
//- rjf: scope macros
#define MutexScope(mutex) DeferLoop(mutex_take(mutex), mutex_drop(mutex))
#define RWMutexScope(mutex, write_mode) DeferLoop(rw_mutex_take((mutex), (write_mode)), rw_mutex_drop((mutex), (write_mode)))
#define MutexScopeR(mutex) DeferLoop(rw_mutex_take_r(mutex), rw_mutex_drop_r(mutex))
#define MutexScopeW(mutex) DeferLoop(rw_mutex_take_w(mutex), rw_mutex_drop_w(mutex))
#define MutexScopeRWPromote(mutex) DeferLoop((rw_mutex_drop_r(mutex), rw_mutex_take_w(mutex)), (rw_mutex_drop_w(mutex), rw_mutex_take_r(mutex)))
////////////////////////////////
//~ rjf: Platform-Abstracted Synchronization Primitive Functions
//- rjf: slow barriers
internal Barrier slow_barrier_alloc(U64 count);
internal void slow_barrier_release(Barrier barrier);
internal void slow_barrier_wait(Barrier barrier);
////////////////////////////////
//~ rjf: @per_os_impl Safe Calls
internal void safe_call(ThreadEntryPointFunctionType *func, ThreadEntryPointFunctionType *fail_handler, void *ptr);
#endif // BASE_THREADS_H
-454
View File
@@ -1,454 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ Safe Casts
internal U16
safe_cast_u16(U32 x)
{
AssertAlways(x <= max_U16);
U16 result = (U16)x;
return result;
}
internal U32
safe_cast_u32(U64 x)
{
AssertAlways(x <= max_U32);
U32 result = (U32)x;
return result;
}
internal S32
safe_cast_s32(S64 x)
{
AssertAlways(x <= max_S32);
S32 result = (S32)x;
return result;
}
////////////////////////////////
//~ rjf: Large Base Type Functions
internal U128
u128_zero(void)
{
U128 v = {0};
return v;
}
internal U128
u128_make(U64 v0, U64 v1)
{
U128 v = {v0, v1};
return v;
}
internal B32
u128_match(U128 a, U128 b)
{
return MemoryMatchStruct(&a, &b);
}
////////////////////////////////
//~ rjf: Bit Patterns
internal U32
u32_from_u64_saturate(U64 x){
U32 x32 = (x > max_U32)?max_U32:(U32)x;
return(x32);
}
internal U64
u64_up_to_pow2(U64 x){
if (x == 0){
x = 1;
}
else{
x -= 1;
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
x |= (x >> 32);
x += 1;
}
return(x);
}
internal S32
extend_sign32(U32 x, U32 size){
U32 high_bit = size * 8;
U32 shift = 32 - high_bit;
S32 result = ((S32)x << shift) >> shift;
return result;
}
internal S64
extend_sign64(U64 x, U64 size){
U64 high_bit = size * 8;
U64 shift = 64 - high_bit;
S64 result = ((S64)x << shift) >> shift;
return result;
}
internal F32
inf32(void){
union { U32 u; F32 f; } x;
x.u = exponent32;
return(x.f);
}
internal F32
neg_inf32(void){
union { U32 u; F32 f; } x;
x.u = sign32 | exponent32;
return(x.f);
}
internal U16
bswap_u16(U16 x)
{
U16 result = (((x & 0xFF00) >> 8) |
((x & 0x00FF) << 8));
return result;
}
internal U32
bswap_u32(U32 x)
{
U32 result = (((x & 0xFF000000) >> 24) |
((x & 0x00FF0000) >> 8) |
((x & 0x0000FF00) << 8) |
((x & 0x000000FF) << 24));
return result;
}
internal U64
bswap_u64(U64 x)
{
// TODO(nick): naive bswap, replace with something that is faster like an intrinsic
U64 result = (((x & 0xFF00000000000000ULL) >> 56) |
((x & 0x00FF000000000000ULL) >> 40) |
((x & 0x0000FF0000000000ULL) >> 24) |
((x & 0x000000FF00000000ULL) >> 8) |
((x & 0x00000000FF000000ULL) << 8) |
((x & 0x0000000000FF0000ULL) << 24) |
((x & 0x000000000000FF00ULL) << 40) |
((x & 0x00000000000000FFULL) << 56));
return result;
}
////////////////////////////////
//~ rjf: Enum -> Sign
internal S32
sign_from_side_S32(Side side){
return((side == Side_Min)?-1:1);
}
internal F32
sign_from_side_F32(Side side){
return((side == Side_Min)?-1.f:1.f);
}
////////////////////////////////
//~ rjf: Memory Functions
internal B32
memory_is_zero(void *ptr, U64 size){
B32 result = 1;
// break down size
U64 extra = (size&0x7);
U64 count8 = (size >> 3);
// check with 8-byte stride
U64 *p64 = (U64*)ptr;
if(result)
{
for (U64 i = 0; i < count8; i += 1, p64 += 1){
if (*p64 != 0){
result = 0;
goto done;
}
}
}
// check extra
if(result)
{
U8 *p8 = (U8*)p64;
for (U64 i = 0; i < extra; i += 1, p8 += 1){
if (*p8 != 0){
result = 0;
goto done;
}
}
}
done:;
return(result);
}
////////////////////////////////
//~ rjf: Text 2D Coordinate/Range Functions
internal TxtPt
txt_pt(S64 line, S64 column)
{
TxtPt p = {0};
p.line = line;
p.column = column;
return p;
}
internal B32
txt_pt_match(TxtPt a, TxtPt b)
{
return a.line == b.line && a.column == b.column;
}
internal B32
txt_pt_less_than(TxtPt a, TxtPt b)
{
B32 result = 0;
if(a.line < b.line)
{
result = 1;
}
else if(a.line == b.line)
{
result = a.column < b.column;
}
return result;
}
internal TxtPt
txt_pt_min(TxtPt a, TxtPt b)
{
TxtPt result = b;
if(txt_pt_less_than(a, b))
{
result = a;
}
return result;
}
internal TxtPt
txt_pt_max(TxtPt a, TxtPt b)
{
TxtPt result = a;
if(txt_pt_less_than(a, b))
{
result = b;
}
return result;
}
internal TxtRng
txt_rng(TxtPt min, TxtPt max)
{
TxtRng range = {0};
if(txt_pt_less_than(min, max))
{
range.min = min;
range.max = max;
}
else
{
range.min = max;
range.max = min;
}
return range;
}
internal TxtRng
txt_rng_intersect(TxtRng a, TxtRng b)
{
TxtRng result = {0};
result.min = txt_pt_max(a.min, b.min);
result.max = txt_pt_min(a.max, b.max);
if(txt_pt_less_than(result.max, result.min))
{
MemoryZeroStruct(&result);
}
return result;
}
internal TxtRng
txt_rng_union(TxtRng a, TxtRng b)
{
TxtRng result = {0};
result.min = txt_pt_min(a.min, b.min);
result.max = txt_pt_max(a.max, b.max);
return result;
}
////////////////////////////////
//~ rjf: Toolchain/Environment Enum Functions
internal U64
bit_size_from_arch(Architecture arch)
{
// TODO(rjf): metacode
U64 arch_bitsize = 0;
switch(arch)
{
case Architecture_x64: arch_bitsize = 64; break;
case Architecture_x86: arch_bitsize = 32; break;
case Architecture_arm64: arch_bitsize = 64; break;
case Architecture_arm32: arch_bitsize = 32; break;
default: break;
}
return arch_bitsize;
}
internal U64
max_instruction_size_from_arch(Architecture arch)
{
// TODO(rjf): make this real
return 64;
}
internal OperatingSystem
operating_system_from_context(void){
OperatingSystem os = OperatingSystem_Null;
#if OS_WINDOWS
os = OperatingSystem_Windows;
#elif OS_LINUX
os = OperatingSystem_Linux;
#elif OS_MAC
os = OperatingSystem_Mac;
#endif
return os;
}
internal Architecture
architecture_from_context(void){
Architecture arch = Architecture_Null;
#if ARCH_X64
arch = Architecture_x64;
#elif ARCH_X86
arch = Architecture_x86;
#elif ARCH_ARM64
arch = Architecture_arm64;
#elif ARCH_ARM32
arch = Architecture_arm32;
#endif
return arch;
}
internal Compiler
compiler_from_context(void){
Compiler compiler = Compiler_Null;
#if COMPILER_CL
compiler = Compiler_cl;
#elif COMPILER_GCC
compiler = Compiler_gcc;
#elif COMPILER_CLANG
compiler = Compiler_clang;
#endif
return compiler;
}
////////////////////////////////
//~ rjf: Time Functions
internal DenseTime
dense_time_from_date_time(DateTime date_time){
DenseTime result = 0;
result += date_time.year;
result *= 12;
result += date_time.mon;
result *= 31;
result += date_time.day;
result *= 24;
result += date_time.hour;
result *= 60;
result += date_time.min;
result *= 61;
result += date_time.sec;
result *= 1000;
result += date_time.msec;
return(result);
}
internal DateTime
date_time_from_dense_time(DenseTime time){
DateTime result = {0};
result.msec = time%1000;
time /= 1000;
result.sec = time%61;
time /= 61;
result.min = time%60;
time /= 60;
result.hour = time%24;
time /= 24;
result.day = time%31;
time /= 31;
result.mon = time%12;
time /= 12;
Assert(time <= max_U32);
result.year = (U32)time;
return(result);
}
internal DateTime
date_time_from_micro_seconds(U64 time){
DateTime result = {0};
result.micro_sec = time%1000;
time /= 1000;
result.msec = time%1000;
time /= 1000;
result.sec = time%60;
time /= 60;
result.min = time%60;
time /= 60;
result.hour = time%24;
time /= 24;
result.day = time%31;
time /= 31;
result.mon = time%12;
time /= 12;
Assert(time <= max_U32);
result.year = (U32)time;
return(result);
}
////////////////////////////////
//~ rjf: Non-Fancy Ring Buffer Reads/Writes
internal U64
ring_write(U8 *ring_base, U64 ring_size, U64 ring_pos, void *src_data, U64 src_data_size)
{
Assert(src_data_size <= ring_size);
{
U64 ring_off = ring_pos%ring_size;
U64 bytes_before_split = ring_size-ring_off;
U64 pre_split_bytes = Min(bytes_before_split, src_data_size);
U64 pst_split_bytes = src_data_size-pre_split_bytes;
void *pre_split_data = src_data;
void *pst_split_data = ((U8 *)src_data + pre_split_bytes);
MemoryCopy(ring_base+ring_off, pre_split_data, pre_split_bytes);
MemoryCopy(ring_base+0, pst_split_data, pst_split_bytes);
}
return src_data_size;
}
internal U64
ring_read(U8 *ring_base, U64 ring_size, U64 ring_pos, void *dst_data, U64 read_size)
{
Assert(read_size <= ring_size);
{
U64 ring_off = ring_pos%ring_size;
U64 bytes_before_split = ring_size-ring_off;
U64 pre_split_bytes = Min(bytes_before_split, read_size);
U64 pst_split_bytes = read_size-pre_split_bytes;
MemoryCopy(dst_data, ring_base+ring_off, pre_split_bytes);
MemoryCopy((U8 *)dst_data + pre_split_bytes, ring_base+0, pst_split_bytes);
}
return read_size;
}
-680
View File
@@ -1,680 +0,0 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef BASE_TYPES_H
#define BASE_TYPES_H
////////////////////////////////
//~ rjf: Foreign Includes
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
////////////////////////////////
//~ rjf: Build Configuration
#if !defined(ENABLE_DEV)
# define ENABLE_DEV 0
#endif
#if !defined(SUPPLEMENT_UNIT)
# define SUPPLEMENT_UNIT 0
#endif
////////////////////////////////
//~ rjf: Codebase Keywords
#define internal static
#define global static
#define local_persist static
#if COMPILER_CL || (COMPILER_CLANG && OS_WINDOWS)
# pragma section(".rdata$", read)
# define read_only __declspec(allocate(".rdata$"))
#elif (COMPILER_CLANG && OS_LINUX)
# define read_only __attribute__((section(".rodata")))
#else
// NOTE(rjf): I don't know of a useful way to do this in GCC land.
// __attribute__((section(".rodata"))) looked promising, but it introduces a
// strange warning about malformed section attributes, and it doesn't look
// like writing to that section reliably produces access violations, strangely
// enough. (It does on Clang)
# define read_only
#endif
////////////////////////////////
//~ rjf: Memory Operation Macros
#define MemoryCopy(dst, src, size) memmove((dst), (src), (size))
#define MemorySet(dst, byte, size) memset((dst), (byte), (size))
#define MemoryCompare(a, b, size) memcmp((a), (b), (size))
#define MemoryStrlen(ptr) strlen(ptr)
#define MemoryCopyStruct(d,s) MemoryCopy((d),(s),sizeof(*(d)))
#define MemoryCopyArray(d,s) MemoryCopy((d),(s),sizeof(d))
#define MemoryCopyTyped(d,s,c) MemoryCopy((d),(s),sizeof(*(d))*(c))
#define MemoryZero(s,z) memset((s),0,(z))
#define MemoryZeroStruct(s) MemoryZero((s),sizeof(*(s)))
#define MemoryZeroArray(a) MemoryZero((a),sizeof(a))
#define MemoryZeroTyped(m,c) MemoryZero((m),sizeof(*(m))*(c))
#define MemoryMatch(a,b,z) (MemoryCompare((a),(b),(z)) == 0)
#define MemoryMatchStruct(a,b) MemoryMatch((a),(b),sizeof(*(a)))
#define MemoryMatchArray(a,b) MemoryMatch((a),(b),sizeof(a))
#define MemoryRead(T,p,e) ( ((p)+sizeof(T)<=(e))?(*(T*)(p)):(0) )
#define MemoryConsume(T,p,e) \
( ((p)+sizeof(T)<=(e))?((p)+=sizeof(T),*(T*)((p)-sizeof(T))):((p)=(e),0) )
////////////////////////////////
//~ rjf: Units
#define KB(n) (((U64)(n)) << 10)
#define MB(n) (((U64)(n)) << 20)
#define GB(n) (((U64)(n)) << 30)
#define TB(n) (((U64)(n)) << 40)
#define Thousand(n) ((n)*1000)
#define Million(n) ((n)*1000000)
#define Billion(n) ((n)*1000000000)
////////////////////////////////
//~ rjf: Asserts
#if COMPILER_CL
# define Trap() __debugbreak()
#elif COMPILER_CLANG || COMPILER_GCC
# define Trap() __builtin_trap()
# else
# error "undefined trap"
#endif
#define AssertAlways(x) do{if(!(x)) {Trap();}}while(0)
#if !defined(NDEBUG)
# define Assert(x) AssertAlways(x)
#else
# define Assert(x) (void)(x)
#endif
#define AssertImplies(a,b) Assert(!(a) || b)
#define AssertIff(a,b) Assert(!!(a) == !!(b))
#define InvalidPath Assert(!"Invalid Path!")
#define NotImplemented Assert(!"Not Implemented!")
#define StaticAssert(C,ID) global U8 Glue(ID,__LINE__)[(C)?1:-1]
////////////////////////////////
//~ rjf: Branch Predictor Hints
#if defined(__clang__)
# define Expect(expr, val) __builtin_expect((expr), (val))
#else
# define Expect(expr, val) (expr)
#endif
#define Likely(expr) Expect(expr,1)
#define Unlikely(expr) Expect(expr,0)
////////////////////////////////
//~ rjf: Misc. Helper Macros
#define ArrayCount(a) (sizeof(a) / sizeof((a)[0]))
#define Stmnt(S) do{ S }while(0)
#define Stringify_(S) #S
#define Stringify(S) Stringify_(S)
#define Glue_(A,B) A##B
#define Glue(A,B) Glue_(A,B)
#define Min(A,B) ( ((A)<(B))?(A):(B) )
#define Max(A,B) ( ((A)>(B))?(A):(B) )
#define ClampTop(A,X) Min(A,X)
#define ClampBot(X,B) Max(X,B)
#define Clamp(A,X,B) ( ((X)<(A))?(A):((X)>(B))?(B):(X) )
#define PtrClampTop(A,X) ClampTop(A,X)
#define PtrClampBot(X,B) ClampBot(X,B)
#define PtrClamp(A,X,B) Clamp(A,X,B)
#define CeilIntegerDiv(a,b) (((a) + (b) - 1)/(b))
#define Swap(T,a,b) Stmnt( T t__ = a; a = b; b = t__; )
#if ARCH_64BIT
# define IntFromPtr(ptr) ((U64)(ptr))
#elif ARCH_32BIT
# define IntFromPtr(ptr) ((U32)(ptr))
#else
# error missing ptr cast for this architecture
#endif
#define PtrFromInt(i) (void*)((U8*)0 + (i))
#define Member(T,m) (((T*)0)->m)
#define OffsetOf(T,m) IntFromPtr(&Member(T,m))
#define MemberFromOffset(T,ptr,off) (T)((((U8 *)ptr)+(off)))
#define CastFromMember(T,m,ptr) (T*)(((U8*)ptr) - OffsetOf(T,m))
#define Compose64Bit(a,b) ((((U64)a) << 32) | ((U64)b));
#define AlignPow2(x,b) (((x) + (b) - 1)&(~((b) - 1)))
#define AlignDownPow2(x,b) ((x)&(~((b) - 1)))
#define AlignPadPow2(x,b) ((0-(x)) & ((b) - 1))
#define IsPow2(x) ((x)!=0 && ((x)&((x)-1))==0)
#define IsPow2OrZero(x) ((((x) - 1)&(x)) == 0)
#define DeferLoop(begin, end) for(int _i_ = ((begin), 0); !_i_; _i_ += 1, (end))
#define DeferLoopChecked(begin, end) for(int _i_ = 2 * !(begin); (_i_ == 2 ? ((end), 0) : !_i_); _i_ += 1, (end))
#if LANG_CPP
# define zero_struct {}
#else
# define zero_struct {0}
#endif
#if COMPILER_MSVC && COMPILER_MSVC_YEAR < 2015
# define this_function_name "unknown"
#else
# define this_function_name __func__
#endif
#if LANG_CPP
# define C_LINKAGE_BEGIN extern "C"{
# define C_LINKAGE_END }
# define C_LINKAGE extern "C"
#else
# define C_LINKAGE_BEGIN
# define C_LINKAGE_END
# define C_LINKAGE
#endif
#if COMPILER_CL
# define thread_static __declspec(thread)
#elif COMPILER_CLANG || COMPILER_GCC
# define thread_static __thread
#endif
#if OS_WINDOWS
# define shared_function C_LINKAGE __declspec(dllexport)
#else
# define shared_function C_LINKAGE
#endif
////////////////////////////////
//~ ASAN
#if COMPILER_CL
# if defined(__SANITIZE_ADDRESS__)
# define ASAN_ENABLED 1
# define NO_ASAN __declspec(no_sanitize_address)
# else
# define NO_ASAN
# endif
#elif COMPILER_CLANG
# if defined(__has_feature)
# if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
# define ASAN_ENABLED 1
# endif
# endif
# define NO_ASAN __attribute__((no_sanitize("address")))
#else
# error "NO_ASAN is not defined"
#endif
#if ASAN_ENABLED
#pragma comment(lib, "clang_rt.asan-x86_64.lib")
C_LINKAGE_BEGIN
void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
C_LINKAGE_END
# define AsanPoisonMemoryRegion(addr, size) __asan_poison_memory_region((addr), (size))
# define AsanUnpoisonMemoryRegion(addr, size) __asan_unpoison_memory_region((addr), (size))
#else
# define AsanPoisonMemoryRegion(addr, size) ((void)(addr), (void)(size))
# define AsanUnpoisonMemoryRegion(addr, size) ((void)(addr), (void)(size))
#endif
////////////////////////////////
//~ rjf: Base Types
typedef uint8_t U8;
typedef uint16_t U16;
typedef uint32_t U32;
typedef uint64_t U64;
typedef int8_t S8;
typedef int16_t S16;
typedef int32_t S32;
typedef int64_t S64;
typedef S8 B8;
typedef S16 B16;
typedef S32 B32;
typedef S64 B64;
typedef float F32;
typedef double F64;
////////////////////////////////
//~ rjf: Large Base Types
typedef struct U128 U128;
struct U128
{
U64 u64[2];
};
////////////////////////////////
//~ rjf: Basic Types & Spaces
typedef void VoidProc(void);
typedef enum Dimension
{
Dimension_X,
Dimension_Y,
Dimension_Z,
Dimension_W,
}
Dimension;
typedef enum Side
{
Side_Invalid = -1,
Side_Min,
Side_Max,
Side_COUNT,
}
Side;
#define side_flip(s) ((Side)(!(s)))
typedef enum Axis2
{
Axis2_Invalid = -1,
Axis2_X,
Axis2_Y,
Axis2_COUNT,
}
Axis2;
#define axis2_flip(a) ((Axis2)(!(a)))
typedef enum Corner
{
Corner_Invalid = -1,
Corner_00,
Corner_01,
Corner_10,
Corner_11,
Corner_COUNT
}
Corner;
////////////////////////////////
//~ rjf: Toolchain/Environment Enums
typedef enum OperatingSystem
{
OperatingSystem_Null,
OperatingSystem_Windows,
OperatingSystem_Linux,
OperatingSystem_Mac,
OperatingSystem_COUNT,
}
OperatingSystem;
typedef enum Architecture
{
Architecture_Null,
Architecture_x64,
Architecture_x86,
Architecture_arm64,
Architecture_arm32,
Architecture_COUNT,
}
Architecture;
typedef enum Compiler
{
Compiler_Null,
Compiler_cl,
Compiler_gcc,
Compiler_clang,
Compiler_COUNT,
}
Compiler;
////////////////////////////////
//~ rjf: Text 2D Coordinates & Ranges
typedef struct TxtPt TxtPt;
struct TxtPt
{
S64 line;
S64 column;
};
typedef struct TxtRng TxtRng;
struct TxtRng
{
TxtPt min;
TxtPt max;
};
////////////////////////////////
//~ NOTE(allen): Constants
global U32 sign32 = 0x80000000;
global U32 exponent32 = 0x7F800000;
global U32 mantissa32 = 0x007FFFFF;
global F32 big_golden32 = 1.61803398875f;
global F32 small_golden32 = 0.61803398875f;
global F32 pi32 = 3.1415926535897f;
global F64 machine_epsilon64 = 4.94065645841247e-324;
global U64 max_U64 = 0xffffffffffffffffull;
global U32 max_U32 = 0xffffffff;
global U16 max_U16 = 0xffff;
global U8 max_U8 = 0xff;
global S64 max_S64 = (S64)0x7fffffffffffffffull;
global S32 max_S32 = (S32)0x7fffffff;
global S16 max_S16 = (S16)0x7fff;
global S8 max_S8 = (S8)0x7f;
global S64 min_S64 = (S64)0xffffffffffffffffull;
global S32 min_S32 = (S32)0xffffffff;
global S16 min_S16 = (S16)0xffff;
global S8 min_S8 = (S8)0xff;
global const U32 bitmask1 = 0x00000001;
global const U32 bitmask2 = 0x00000003;
global const U32 bitmask3 = 0x00000007;
global const U32 bitmask4 = 0x0000000f;
global const U32 bitmask5 = 0x0000001f;
global const U32 bitmask6 = 0x0000003f;
global const U32 bitmask7 = 0x0000007f;
global const U32 bitmask8 = 0x000000ff;
global const U32 bitmask9 = 0x000001ff;
global const U32 bitmask10 = 0x000003ff;
global const U32 bitmask11 = 0x000007ff;
global const U32 bitmask12 = 0x00000fff;
global const U32 bitmask13 = 0x00001fff;
global const U32 bitmask14 = 0x00003fff;
global const U32 bitmask15 = 0x00007fff;
global const U32 bitmask16 = 0x0000ffff;
global const U32 bitmask17 = 0x0001ffff;
global const U32 bitmask18 = 0x0003ffff;
global const U32 bitmask19 = 0x0007ffff;
global const U32 bitmask20 = 0x000fffff;
global const U32 bitmask21 = 0x001fffff;
global const U32 bitmask22 = 0x003fffff;
global const U32 bitmask23 = 0x007fffff;
global const U32 bitmask24 = 0x00ffffff;
global const U32 bitmask25 = 0x01ffffff;
global const U32 bitmask26 = 0x03ffffff;
global const U32 bitmask27 = 0x07ffffff;
global const U32 bitmask28 = 0x0fffffff;
global const U32 bitmask29 = 0x1fffffff;
global const U32 bitmask30 = 0x3fffffff;
global const U32 bitmask31 = 0x7fffffff;
global const U32 bitmask32 = 0xffffffff;
global const U64 bitmask33 = 0x00000001ffffffffull;
global const U64 bitmask34 = 0x00000003ffffffffull;
global const U64 bitmask35 = 0x00000007ffffffffull;
global const U64 bitmask36 = 0x0000000fffffffffull;
global const U64 bitmask37 = 0x0000001fffffffffull;
global const U64 bitmask38 = 0x0000003fffffffffull;
global const U64 bitmask39 = 0x0000007fffffffffull;
global const U64 bitmask40 = 0x000000ffffffffffull;
global const U64 bitmask41 = 0x000001ffffffffffull;
global const U64 bitmask42 = 0x000003ffffffffffull;
global const U64 bitmask43 = 0x000007ffffffffffull;
global const U64 bitmask44 = 0x00000fffffffffffull;
global const U64 bitmask45 = 0x00001fffffffffffull;
global const U64 bitmask46 = 0x00003fffffffffffull;
global const U64 bitmask47 = 0x00007fffffffffffull;
global const U64 bitmask48 = 0x0000ffffffffffffull;
global const U64 bitmask49 = 0x0001ffffffffffffull;
global const U64 bitmask50 = 0x0003ffffffffffffull;
global const U64 bitmask51 = 0x0007ffffffffffffull;
global const U64 bitmask52 = 0x000fffffffffffffull;
global const U64 bitmask53 = 0x001fffffffffffffull;
global const U64 bitmask54 = 0x003fffffffffffffull;
global const U64 bitmask55 = 0x007fffffffffffffull;
global const U64 bitmask56 = 0x00ffffffffffffffull;
global const U64 bitmask57 = 0x01ffffffffffffffull;
global const U64 bitmask58 = 0x03ffffffffffffffull;
global const U64 bitmask59 = 0x07ffffffffffffffull;
global const U64 bitmask60 = 0x0fffffffffffffffull;
global const U64 bitmask61 = 0x1fffffffffffffffull;
global const U64 bitmask62 = 0x3fffffffffffffffull;
global const U64 bitmask63 = 0x7fffffffffffffffull;
global const U64 bitmask64 = 0xffffffffffffffffull;
global const U32 bit1 = (1<<0);
global const U32 bit2 = (1<<1);
global const U32 bit3 = (1<<2);
global const U32 bit4 = (1<<3);
global const U32 bit5 = (1<<4);
global const U32 bit6 = (1<<5);
global const U32 bit7 = (1<<6);
global const U32 bit8 = (1<<7);
global const U32 bit9 = (1<<8);
global const U32 bit10 = (1<<9);
global const U32 bit11 = (1<<10);
global const U32 bit12 = (1<<11);
global const U32 bit13 = (1<<12);
global const U32 bit14 = (1<<13);
global const U32 bit15 = (1<<14);
global const U32 bit16 = (1<<15);
global const U32 bit17 = (1<<16);
global const U32 bit18 = (1<<17);
global const U32 bit19 = (1<<18);
global const U32 bit20 = (1<<19);
global const U32 bit21 = (1<<20);
global const U32 bit22 = (1<<21);
global const U32 bit23 = (1<<22);
global const U32 bit24 = (1<<23);
global const U32 bit25 = (1<<24);
global const U32 bit26 = (1<<25);
global const U32 bit27 = (1<<26);
global const U32 bit28 = (1<<27);
global const U32 bit29 = (1<<28);
global const U32 bit30 = (1<<29);
global const U32 bit31 = (1<<30);
global const U32 bit32 = (1<<31);
global const U64 bit33 = (1ull<<32);
global const U64 bit34 = (1ull<<33);
global const U64 bit35 = (1ull<<34);
global const U64 bit36 = (1ull<<35);
global const U64 bit37 = (1ull<<36);
global const U64 bit38 = (1ull<<37);
global const U64 bit39 = (1ull<<38);
global const U64 bit40 = (1ull<<39);
global const U64 bit41 = (1ull<<40);
global const U64 bit42 = (1ull<<41);
global const U64 bit43 = (1ull<<42);
global const U64 bit44 = (1ull<<43);
global const U64 bit45 = (1ull<<44);
global const U64 bit46 = (1ull<<45);
global const U64 bit47 = (1ull<<46);
global const U64 bit48 = (1ull<<47);
global const U64 bit49 = (1ull<<48);
global const U64 bit50 = (1ull<<49);
global const U64 bit51 = (1ull<<50);
global const U64 bit52 = (1ull<<51);
global const U64 bit53 = (1ull<<52);
global const U64 bit54 = (1ull<<53);
global const U64 bit55 = (1ull<<54);
global const U64 bit56 = (1ull<<55);
global const U64 bit57 = (1ull<<56);
global const U64 bit58 = (1ull<<57);
global const U64 bit59 = (1ull<<58);
global const U64 bit60 = (1ull<<59);
global const U64 bit61 = (1ull<<60);
global const U64 bit62 = (1ull<<61);
global const U64 bit63 = (1ull<<62);
global const U64 bit64 = (1ull<<63);
////////////////////////////////
//~ allen: Time
typedef enum WeekDay
{
WeekDay_Sun,
WeekDay_Mon,
WeekDay_Tue,
WeekDay_Wed,
WeekDay_Thu,
WeekDay_Fri,
WeekDay_Sat,
WeekDay_COUNT,
}
WeekDay;
typedef enum Month
{
Month_Jan,
Month_Feb,
Month_Mar,
Month_Apr,
Month_May,
Month_Jun,
Month_Jul,
Month_Aug,
Month_Sep,
Month_Oct,
Month_Nov,
Month_Dec,
Month_COUNT,
}
Month;
typedef struct DateTime DateTime;
struct DateTime
{
U16 micro_sec; // [0,999]
U16 msec; // [0,999]
U16 sec; // [0,60]
U16 min; // [0,59]
U16 hour; // [0,24]
U16 day; // [0,30]
union{
WeekDay week_day;
U32 wday;
};
union{
Month month;
U32 mon;
};
U32 year; // 1 = 1 CE, 0 = 1 BC
};
typedef U64 DenseTime;
////////////////////////////////
//~ allen: Files
typedef U32 FilePropertyFlags;
enum
{
FilePropertyFlag_IsFolder = (1 << 0),
};
typedef struct FileProperties FileProperties;
struct FileProperties
{
U64 size;
DenseTime modified;
DenseTime created;
FilePropertyFlags flags;
};
////////////////////////////////
//~ Safe Casts
internal U16 safe_cast_u16(U32 x);
internal U32 safe_cast_u32(U64 x);
internal S32 safe_cast_s32(S64 x);
////////////////////////////////
//~ rjf: Large Base Type Functions
internal U128 u128_zero(void);
internal U128 u128_make(U64 v0, U64 v1);
internal B32 u128_match(U128 a, U128 b);
////////////////////////////////
//~ rjf: Bit Patterns
internal U32 u32_from_u64_saturate(U64 x);
internal U64 u64_up_to_pow2(U64 x);
internal S32 extend_sign32(U32 x, U32 size);
internal S64 extend_sign64(U64 x, U64 size);
internal F32 inf32(void);
internal F32 neg_inf32(void);
internal U16 bswap_u16(U16 x);
internal U32 bswap_u32(U32 x);
internal U64 bswap_u64(U64 x);
////////////////////////////////
//~ rjf: Enum -> Sign
internal S32 sign_from_side_S32(Side side);
internal F32 sign_from_side_F32(Side side);
////////////////////////////////
//~ rjf: Memory Functions
internal B32 memory_is_zero(void *ptr, U64 size);
////////////////////////////////
//~ rjf: Text 2D Coordinate/Range Functions
internal TxtPt txt_pt(S64 line, S64 column);
internal B32 txt_pt_match(TxtPt a, TxtPt b);
internal B32 txt_pt_less_than(TxtPt a, TxtPt b);
internal TxtPt txt_pt_min(TxtPt a, TxtPt b);
internal TxtPt txt_pt_max(TxtPt a, TxtPt b);
internal TxtRng txt_rng(TxtPt min, TxtPt max);
internal TxtRng txt_rng_intersect(TxtRng a, TxtRng b);
internal TxtRng txt_rng_union(TxtRng a, TxtRng b);
////////////////////////////////
//~ rjf: Toolchain/Environment Enum Functions
internal U64 bit_size_from_arch(Architecture arch);
internal U64 max_instruction_size_from_arch(Architecture arch);
internal OperatingSystem operating_system_from_context(void);
internal Architecture architecture_from_context(void);
internal Compiler compiler_from_context(void);
////////////////////////////////
//~ rjf: Time Functions
internal DenseTime dense_time_from_date_time(DateTime date_time);
internal DateTime date_time_from_dense_time(DenseTime time);
internal DateTime date_time_from_micro_seconds(U64 time);
////////////////////////////////
//~ rjf: Non-Fancy Ring Buffer Reads/Writes
internal U64 ring_write(U8 *ring_base, U64 ring_size, U64 ring_pos, void *src_data, U64 src_data_size);
internal U64 ring_read(U8 *ring_base, U64 ring_size, U64 ring_pos, void *dst_data, U64 read_size);
#define ring_write_struct(ring_base, ring_size, ring_pos, ptr) ring_write((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
#define ring_read_struct(ring_base, ring_size, ring_pos, ptr) ring_read((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
#endif // BASE_TYPES_H
+340
View File
@@ -0,0 +1,340 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
Test(str8_list_substr)
{
String8List zero_list = {0};
{
String8List list = {0};
str8_list_pushf(arena, &list, "a");
str8_list_pushf(arena, &list, "b");
str8_list_pushf(arena, &list, "c");
String8List sub = str8_list_substr(arena, list, r1u64(0, 3));
String8 result = str8_list_join(arena, &list, 0);
T_Ok(str8_match(result, str8_lit("abc"), 0));
}
{
String8List list = {0};
str8_list_pushf(arena, &list, "a");
str8_list_pushf(arena, &list, "b");
str8_list_pushf(arena, &list, "c");
String8List sub = str8_list_substr(arena, list, r1u64(0, max_U64));
String8 result = str8_list_join(arena, &list, 0);
T_Ok(str8_match(result, str8_lit("abc"), 0));
}
{
String8List list = {0};
str8_list_pushf(arena, &list, "a");
str8_list_pushf(arena, &list, "bcd");
String8List sub = str8_list_substr(arena, list, r1u64(2, 3));
String8 result = str8_list_join(arena, &sub, 0);
T_Ok(str8_match(result, str8_lit("c"), 0));
}
{
String8List list = {0};
str8_list_pushf(arena, &list, "a");
str8_list_pushf(arena, &list, "bcd");
String8List sub = str8_list_substr(arena, list, r1u64(1, 2));
String8 result = str8_list_join(arena, &sub, 0);
T_Ok(str8_match(result, str8_lit("b"), 0));
}
{
String8List list = {0};
str8_list_pushf(arena, &list, "ab");
str8_list_pushf(arena, &list, "cd");
str8_list_pushf(arena, &list, "ef");
String8List sub = str8_list_substr(arena, list, r1u64(1, 5));
String8 result = str8_list_join(arena, &sub, 0);
T_Ok(str8_match(result, str8_lit("bcde"), 0));
}
{
String8List list = {0};
str8_list_pushf(arena, &list, "abc");
String8List zero = str8_list_substr(arena, list, r1u64(0, 0));
T_Ok(MemoryMatchStruct(&zero, &zero_list));
String8List out_of_bounds_range = str8_list_substr(arena, list, r1u64(max_U64/2, max_U64));
T_Ok(MemoryMatchStruct(&out_of_bounds_range, &zero_list));
}
}
TEST(bit_array)
{
for (U64 start=0; start<32*3; start++) {
for (U64 end=start; end<32*3; end++) {
U32 v[3] = { 0 };
for (U64 i=start; i<end; i++) {
v[i/32] |= 1 << (i%32);
}
for (U64 lo=0; lo<32*3; lo++) {
for (U64 hi=0; hi<32*3; hi++) {
U64 expected_idx = Min(hi, end) - 1;
B32 expected_r = hi <= start || lo >= end || lo >= hi || start >= end ? 0 : 1;
U64 idx = bit_array_scan_right_to_left32((U32Array){.v=v, .count=ArrayCount(v)}, lo, hi, 1);
B32 r = idx < hi;
T_Ok(r == expected_r);
if (r) {
T_Ok(idx == expected_idx);
}
}
}
}
}
}
TEST(count_digits)
{
T_Ok(count_digits_u64(0, 10) == 1);
T_Ok(count_digits_u64(99, 10) == 2);
T_Ok(count_digits_u64(999, 10) == 3);
T_Ok(count_digits_u64(9999, 10) == 4);
T_Ok(count_digits_u64(99999, 10) == 5);
T_Ok(count_digits_u64(999999, 10) == 6);
}
TEST(match_wildcard)
{
// empty strings
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit(""), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("**"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("?"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("*?"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("?*"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit(""), 0) == 0);
// exact
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("a"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("A"), 0) == 0);
// ?
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("?"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("?"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("?"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("a?"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("?b"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("??"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("a?c"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("???"), 0) == 0);
// *
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("a*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*c"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*b*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("a*c"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("b*"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("**"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("a**c"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("a*b*c"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*a*d*"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("abcd"), str8_lit("a*d"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abefcdgiescdfimde"), str8_lit("ab*cd?i*de"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("mississippi"), str8_lit("m*iss*ppi"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*b"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("aa"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("aa"), str8_lit("a"), 0) == 0);
// case insensitive
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("A"), StringMatchFlag_CaseInsensitive) == 1);
T_Ok(str8_match_wildcard(str8_lit("FooBar"), str8_lit("foobar"), StringMatchFlag_CaseInsensitive) == 1);
T_Ok(str8_match_wildcard(str8_lit("Foobar"), str8_lit("foo*"), StringMatchFlag_CaseInsensitive) == 1);
// right side sloppy
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("ab"), StringMatchFlag_RightSideSloppy) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit(""), StringMatchFlag_RightSideSloppy) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("a"), StringMatchFlag_RightSideSloppy) == 0);
// slash insensitive
T_Ok(str8_match_wildcard(str8_lit("a/b"), str8_lit("a\\b"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("a/b"), str8_lit("a\\b"), StringMatchFlag_SlashInsensitive) == 1);
T_Ok(str8_match_wildcard(str8_lit("a/b/c"), str8_lit("a\\*\\c"), StringMatchFlag_SlashInsensitive) == 1);
// combined
T_Ok(str8_match_wildcard(str8_lit("Ab\\Cde"), str8_lit("ab/*e"), StringMatchFlag_CaseInsensitive|StringMatchFlag_SlashInsensitive) == 1);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("*?*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("*?*"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit(""), str8_lit("*?*"), 0) == 0);
T_Ok(str8_match_wildcard(str8_lit("abc"), str8_lit("?*?"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("ab"), str8_lit("?*?"), 0) == 1);
T_Ok(str8_match_wildcard(str8_lit("a"), str8_lit("?*?"), 0) == 0);
}
TEST(hash_map)
{
{
HashMap hm = {0};
U64 test_count = 256;
for EachIndex(i, test_count) { hash_map_push_u64_u64(arena, &hm, i, i*2); }
// test tombstone reuse
for (U64 i = 10; i < test_count; ++i) {
HashMapNode *test_node = hash_map_search(&hm, hash_map_hasher(str8_struct(&i)), (HashMapKey){ .key_u64 = i }, hash_map_match_u64);
T_Ok(hash_map_purge_u64(&hm, i) == 1);
T_Ok(hash_map_push_u64_u64(arena, &hm, i, 10) == test_node);
}
// delete some items and after search them
for (U64 i = 0; i < 10; ++i) {
T_Ok(hash_map_purge_u64(&hm, i));
}
T_Ok(hm.tombstone_count == 10);
for (U64 i = 0; i < 10; ++i) {
T_Ok(hash_map_search_u64_raw(&hm, i) == 0);
}
// extract pairs and test sorting
HashMapKeyValue *pairs = key_value_from_hash_map(arena, &hm);
sort_hash_map_key_value_u64(pairs, hm.count);
for (U64 i = 1; i < hm.count; ++i) {
T_Ok(pairs[i-1].key.key_u64 < pairs[i].key.key_u64);
}
// did purge put all the nodes on free list?
hash_map_purge(&hm);
U64 free_list_count = 0;
for (HashMapNode *n = hm.free_list; n != 0; n = n->next) { free_list_count += 1; }
T_Ok(free_list_count == test_count);
}
// test search through tombstones
{
HashMap hm = {0};
U64 hash = 12345;
hash_map_push(arena, &hm, hash, (HashMapKeyValue){ .key = { .key_u64 = 1 }, .value = { .value_u64 = 10 } }, hash_map_match_u64);
hash_map_push(arena, &hm, hash, (HashMapKeyValue){ .key = { .key_u64 = 2 }, .value = { .value_u64 = 20 } }, hash_map_match_u64);
hash_map_push(arena, &hm, hash, (HashMapKeyValue){ .key = { .key_u64 = 3 }, .value = { .value_u64 = 30 } }, hash_map_match_u64);
T_Ok(hash_map_purge_u64(&hm, 1));
T_Ok(hash_map_search(&hm, hash, (HashMapKey){ .key_u64 = 2 }, hash_map_match_u64)->v.value.value_u64 == 20);
T_Ok(hash_map_search(&hm, hash, (HashMapKey){ .key_u64 = 3 }, hash_map_match_u64)->v.value.value_u64 == 30);
}
// interleaved purges
{
HashMap hm = {0};
for EachIndex(round, 100) {
for EachIndex(i, 256) { hash_map_push_u64_u64(arena, &hm, i, round); }
for (U64 i = 0; i < 256; i += 2) { hash_map_purge_u64(&hm, i); }
for (U64 i = 0; i < 256; i += 2) { hash_map_push_u64_u64(arena, &hm, i, round + 1); }
T_Ok(hm.count == 256);
T_Ok(hm.tombstone_count == 0);
}
for EachIndex(i, 100) {
T_Ok(hash_map_purge_u64(&hm, 123123123 + i) == 0);
}
}
// empty hash map test
{
HashMap hm = {0};
T_Ok(hash_map_search_u64_raw(&hm, 123) == 0);
T_Ok(hash_map_purge_u64(&hm, 123) == 0);
HashMapKeyValue *pairs = key_value_from_hash_map(arena, &hm);
T_Ok(pairs == 0 || hm.count == 0);
hash_map_purge(&hm);
T_Ok(hm.count == 0);
T_Ok(hm.tombstone_count == 0);
}
// heavy collision
{
HashMap hm = {0};
U64 hash = 12345;
U64 count = 1024;
for EachIndex(i, count) {
hash_map_push(arena, &hm, hash, (HashMapKeyValue){ .key = { .key_u64 = i }, .value = { .value_u64 = i*3 } }, hash_map_match_u64);
}
for EachIndex(i, count) {
T_Ok(hash_map_search(&hm, hash, (HashMapKey){ .key_u64 = i }, hash_map_match_u64)->v.value.value_u64 == i*3);
}
}
// duplicate key test
{
HashMap hm = {0};
U64 a = 1;
U64 b = 2;
HashMapNode *n0 = hash_map_push_u64_u64(arena, &hm, 1, a);
HashMapNode *n1 = hash_map_push_u64_u64(arena, &hm, 1, b);
T_Ok(hm.count == 1);
T_Ok(n0 == n1);
U64 test = *hash_map_search_u64_u64(&hm, 1);
T_Ok(test != b);
}
// test paths
{
HashMap hm = {0};
U64 foo = 0;
U64 bar = 1;
hash_map_push_path_raw(arena, &hm, str8_lit("c:/DEVEL/test"), &foo);
hash_map_push_path_raw(arena, &hm, str8_lit("c:\\DEVEL\\test"), &foo);
hash_map_push_path_raw(arena, &hm, str8_lit("c:/devel\\test"), &foo);
hash_map_push_path_raw(arena, &hm, str8_lit("/mnt/devel"), &bar);
hash_map_push_path_raw(arena, &hm, str8_lit("/MNT/devel"), &bar);
T_Ok(hm.count == 2);
T_Ok(hash_map_search_path_raw(&hm, str8_lit("c:/devel/test")) == &foo);
T_Ok(hash_map_search_path_raw(&hm, str8_lit("c:\\devel\\TEST")) == &foo);
T_Ok(hash_map_search_path_raw(&hm, str8_lit("/mnt/devel")) == &bar);
T_Ok(hash_map_search_path_raw(&hm, str8_lit("/MNT/DEVEL")) == &bar);
}
// test strings
{
HashMap hm = {0};
U64 foo = 0;
U64 bar = 1;
hash_map_push_string_raw(arena, &hm, str8_lit("c:/DEVEL/test"), &foo);
hash_map_push_string_raw(arena, &hm, str8_lit("c:\\DEVEL\\test"), &foo);
hash_map_push_string_raw(arena, &hm, str8_lit("c:/devel\\test"), &foo);
hash_map_push_string_raw(arena, &hm, str8_lit("/mnt/devel"), &bar);
hash_map_push_string_raw(arena, &hm, str8_lit("/MNT/devel"), &bar);
T_Ok(hm.count == 5);
T_Ok(hash_map_search_string_raw(&hm, str8_lit("c:/DEVEL/test")) == &foo);
T_Ok(hash_map_search_string_raw(&hm, str8_lit("c:\\DEVEL\\test")) == &foo);
T_Ok(hash_map_search_string_raw(&hm, str8_lit("c:/devel\\test")) == &foo);
T_Ok(hash_map_search_string_raw(&hm, str8_lit("/mnt/devel")) == &bar);
T_Ok(hash_map_search_string_raw(&hm, str8_lit("/MNT/devel")) == &bar);
}
}
File diff suppressed because it is too large. Load diff
Loaded 100 of 786 files, more files were not shown because too many files have changed in this diff. Show more