Started to fix some runtime bugs.

This commit is contained in:
2023-05-08 20:54:24 -04:00
parent 59042a162c
commit d00de42969
14 changed files with 298 additions and 42 deletions

View File

@ -13,7 +13,7 @@
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Users/Ed/scoop/apps/llvm/current/bin/clang++.exe",
"intelliSenseMode": "windows-clang-x64"
"intelliSenseMode": "windows-clang-x64",
}
],
"version": 4

31
.vscode/gencpp.natvis vendored Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="String">
<DisplayString Condition="Data == nullptr">null</DisplayString>
<DisplayString>{Data,na}</DisplayString>
<Expand>
<!-- Define a synthetic child element for the Header -->
<Synthetic Name="Header">
<!-- Construct a Header object from the Data pointer -->
<DisplayString>{(Header*)((char*)Data - sizeof(Header))}</DisplayString>
<!-- Define the children of the synthetic element -->
<Expand>
<Item Name="Allocator">((Header*)((char*)Data - sizeof(Header)))->Allocator</Item>
<Item Name="Length">((Header*)((char*)Data - sizeof(Header)))->Length</Item>
<Item Name="Capacity">((Header*)((char*)Data - sizeof(Header)))->Capacity</Item>
</Expand>
</Synthetic>
</Expand>
</Type>
<Type Name="String::Header">
<DisplayString>Length: {Length}, Capacity: {Capacity}</DisplayString>
<Expand>
<Item Name="Allocator">Allocator</Item>
<Item Name="Length">Length</Item>
<Item Name="Capacity">Capacity</Item>
</Expand>
</Type>
</AutoVisualizer>

84
.vscode/gencpp_lldbvis.py vendored Normal file
View File

@ -0,0 +1,84 @@
import lldb
class String_SyntheticChildrenProvider:
def __init__(self, valobj, internal_dict):
self.valobj = valobj
def num_children(self):
return 3
def get_child_index(self, name):
if name == "Data":
return 0
if name == "Length":
return 1
if name == "Capacity":
return 2
return None
def get_child_at_index(self, index):
if index == 0:
return self.valobj.GetChildMemberWithName("Data")
data = self.valobj.GetChildMemberWithName("Data")
header_ptr = data.GetValueAsUnsigned() - 16
target = self.valobj.GetTarget()
header_type = target.FindFirstType("gen::String::Header")
header = self.valobj.CreateValueFromAddress("Header", header_ptr, header_type)
if index == 1:
return header.GetChildMemberWithName("Length")
if index == 2:
return header.GetChildMemberWithName("Capacity")
return None
def update(self):
pass
def list_synthetic_providers(debugger):
print("Listing synthetic providers (start)")
num_categories = debugger.GetNumCategories()
print("Debugger language categories count:", num_categories)
cpp_category = None
for i in range(num_categories):
print("WERE HERE")
print(debugger)
cat = debugger.GetCategoryAtIndex(i)
print("Category name: {}, language: {}".format(cat.GetName(), cat.GetLanguage()))
if cat.GetLanguage() == lldb.eLanguageTypeC_plus_plus:
cpp_category = cat
break
if not cpp_category:
print("Could not get C++ category")
return
synthetic_providers = cpp_category.GetSyntheticChildren()
if not synthetic_providers:
print("Could not get synthetic children")
return
num_providers = synthetic_providers.GetSize()
print("Number of synthetic providers:", num_providers)
for i in range(num_providers):
provider = synthetic_providers.GetSyntheticChildAtIndex(i)
print("Provider regex: {}, class name: {}".format(provider.GetRegex(), provider.GetDescription()))
print("Listing synthetic providers (finish)")
def __lldb_init_module(debugger, internal_dict):
print("Importing the String visualization")
debugger.HandleCommand("type synthetic add -x '^gen::String$' -l gencpp_libvis.String_SyntheticChildrenProvider")
print("Before list_synthetic_providers")
list_synthetic_providers(debugger)
lldb.debugger = None

28
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug gentime lldb",
"program": "${workspaceFolder}/test/gen/build/gencpp.exe",
"args": [],
"cwd": "${workspaceFolder}",
"postRunCommands": [
"command script import \"${workspaceFolder}/.vscode/gencpp_lldbvis.py\""
]
},
{
"type": "cppvsdbg",
"request": "launch",
"name": "Debug gentime vsdbg",
"program": "${workspaceFolder}/test/gen/build/gencpp.exe",
"args": [],
"cwd": "${workspaceFolder}",
"visualizerFile": "${workspaceFolder}/.vscode/gencpp.natvis"
}
]
}

View File

@ -18,5 +18,6 @@
"algorithm": "cpp",
"limits": "cpp"
},
"C_Cpp.intelliSenseEngineFallback": "disabled"
"C_Cpp.intelliSenseEngineFallback": "disabled",
"mesonbuild.configureOnOpen": true
}