chore(natvis): Add natvis files for all used wwlib containers - #3283
chore(natvis): Add natvis files for all used wwlib containers#3283xezon wants to merge 2 commits into
Conversation
PR Summary by QodoAdd Visual Studio visualizers for WWLib containers
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Code Review by Qodo
1. New hash iterators show debugger errors
|
|
| Filename | Overview |
|---|---|
| resources/CMakeLists.txt | Registers all twelve WWLib natvis resources for MSVC IDE projects. |
| resources/visualstudio/asciistring.natvis | Adds bounded length, capacity, reference-count, and string-view presentation. |
| resources/visualstudio/unicodestring.natvis | Adds the corresponding bounded wide-string metadata and string view. |
| resources/visualstudio/wwlib/wwstring.natvis | Correctly falls back to scanning the buffer when the cached length is unset, resolving the previous finding. |
| resources/visualstudio/wwlib/widestring.natvis | Applies the same effective-length behavior to wide strings. |
| resources/visualstudio/wwlib/hash.natvis | Adds chained-bucket visualization but, like the other new WWLib natvis files, lacks the required file prologue. |
| resources/visualstudio/wwlib/multilist.natvis | Adds visualizers for multi-list containers, nodes, objects, and iterators; its required file prologue is missing. |
| resources/visualstudio/wwlib/vector.natvis | Adds vector, dynamic-vector, and packed-boolean visualization; its required file prologue is missing. |
Prompt To Fix All With AI
### Issue 1
resources/visualstudio/wwlib/hash.natvis:1
**Required Prologues Are Missing**
This new natvis file starts directly with the XML declaration and omits the required GPL license prologue and TheSuperHackers copyright notice. The same omission appears in all twelve new files under `resources/visualstudio/wwlib/`. This repository requirement must be satisfied before merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (2): Last reviewed commit: "chore(natvis): Show length, capacity and..." | Re-trigger Greptile
…ontainers (#3283) The WWLib containers showed up in the Visual Studio debugger as raw structs, so reading their elements meant expanding pointers and slicing arrays by hand. Each WWLib header that declares a container used by the game now has a matching natvis file in resources/visualstudio/wwlib, registered alongside the existing natvis files under MSVC_IDE, so the containers expand directly to their elements. Covered are VectorClass, DynamicVectorClass, BooleanVectorClass, SimpleVecClass, SimpleDynVecClass, ShareBufferClass, UniqueArrayClass, GenericList, List, Node, DataNode, SList, the MultiList classes and their iterators, HashTableClass, HashTemplateClass, StringClass, WideStringClass and MPSCIntrusiveQueue. Types with no users outside WWLib are left out: IndexClass, NTreeClass, BinaryHeapClass, HashListClass, DoubleNode and Buffer. DynamicVectorClass, SimpleDynVecClass and the typed MultiList classes have rules of their own because natvis rules are inherited, and the base class rule would list the allocated slots instead of the live elements. BooleanVectorClass reports Copy for LastIndex, because that bit is only written back into the packed array once a different index is fetched. StringClass and WideStringClass count the characters when the stored length is 0, as Get_Length does, since a write through Get_Buffer leaves the stored length at 0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ing and UnicodeString (#3283) The [data] item of both visualizers was bound to the ref counted header instead of the text, so expanding it showed the reference count and the allocation size under a misleading name, and the length was not shown at all. Both visualizers now list [length], [capacity] and [refs] as named items. No length is stored, so [length] counts the characters like getLength does, capped at the allocation so that a missing terminator cannot read past the buffer. [capacity] includes the slot for the terminator, matching StringClass. A [refs] above 1 means the buffer is shared and will be copied on the next write. A StringView adds the text visualizer for long strings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
43d73d3 to
bccf3f5
Compare
Merge with Rebase
This change adds natvis files for all used wwlib containers. It allows to inspect them properly in Visual Studio.
I only looked at
DynamicVectorClassin Visual Studio and it looked fine.It also improves the natvis for
AsciiStringandUnicodeStringto better match what theWWStringsvisualizers show.Coverage
Twelve new files in a new
resources/visualstudio/wwlib/subfolder, one per WWLib header,matching the existing one-family-per-file naming. The subfolder keeps the WWLib set from
crowding the four existing top-level files and makes the source library each visualizer
belongs to obvious from the path.
vector.natvisVectorClass<T>,DynamicVectorClass<T>,BooleanVectorClasssimplevec.natvisSimpleVecClass<T>,SimpleDynVecClass<T>sharebuf.natvisShareBufferClass<T>uarray.natvisUniqueArrayClass<T>listnode.natvisGenericNode,GenericList,Node<T>,List<T>,DataNode<T>slist.natvisSList<T>,SLNode<T>multilist.natvisMultiListObjectClass,GenericMultiListClass,MultiListClass<T>,RefMultiListClass<T>,GenericMultiListIterator,MultiListIterator<T>,RefMultiListIterator<T>hash.natvisHashTableClass,HashTableIteratorClasshashtemplate.natvisHashTemplateClass<K,V>,HashTemplateIterator<K,V>wwstring.natvisStringClasswidestring.natvisWideStringClassmpsc_intrusive_queue.natvisMPSCIntrusiveQueue<T>Deliberately not covered:
IndexClass(INDEX.h),NTreeClass/NTreeLeafClass,BinaryHeapClass,HashListClass,DoubleNode,Buffer— zero instantiations outsideWWLib, so the rules could not be validated against real data.
hashtab.his entirelyinside
#if 0,search.his a dead duplicate ofINDEX.h, andSTLUtils.hrange/const_rangeare trivial iterator pairs.AI Use
This was a one shot generation with Claude Opus 5. It claimed to have verified all of them with Visual Studio.
wwlib.lib/wwdebug.lib/wwstub.lib, driven headlessly bycdb.exewith.nvload+dx -r2. All 12 files reported "Successfully loaded visualizers", no<error>nodes, and every container's contents matched what the harness wrote —g_dynvec→{ size=3 }10/20/30, the MultiList → 301/302/303, the hash table →alpha/beta,g_string→"hello natvis"length 12.