mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
on lambda types we have to replace unique name with hash,
otherwise visual studio wont show local variables in lambdas
This commit is contained in:
+20
-12
@@ -2505,7 +2505,7 @@ THREAD_POOL_TASK_FUNC(lnk_replace_type_names_with_hashes_lenient_task)
|
|||||||
map = &task->maps[task_id];
|
map = &task->maps[task_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
U64 hash_max_chars = hash_length;
|
U64 hash_max_chars = hash_length*2;
|
||||||
U8 temp[128];
|
U8 temp[128];
|
||||||
|
|
||||||
for (U64 leaf_idx = range.min; leaf_idx < range.max; ++leaf_idx) {
|
for (U64 leaf_idx = range.min; leaf_idx < range.max; ++leaf_idx) {
|
||||||
@@ -2513,7 +2513,9 @@ THREAD_POOL_TASK_FUNC(lnk_replace_type_names_with_hashes_lenient_task)
|
|||||||
if (leaf.kind == CV_LeafKind_STRUCTURE || leaf.kind == CV_LeafKind_CLASS) {
|
if (leaf.kind == CV_LeafKind_STRUCTURE || leaf.kind == CV_LeafKind_CLASS) {
|
||||||
CV_UDTInfo udt_info = cv_get_udt_info(leaf.kind, leaf.data);
|
CV_UDTInfo udt_info = cv_get_udt_info(leaf.kind, leaf.data);
|
||||||
|
|
||||||
if (udt_info.props & CV_TypeProp_HasUniqueName && udt_info.unique_name.size > hash_max_chars) {
|
if ((udt_info.props & CV_TypeProp_HasUniqueName) &&
|
||||||
|
udt_info.unique_name.size > hash_max_chars &&
|
||||||
|
udt_info.name.size > hash_max_chars) {
|
||||||
// hash unique name
|
// hash unique name
|
||||||
U128 name_hash;
|
U128 name_hash;
|
||||||
blake3_hasher hasher; blake3_hasher_init(&hasher);
|
blake3_hasher hasher; blake3_hasher_init(&hasher);
|
||||||
@@ -2523,27 +2525,33 @@ THREAD_POOL_TASK_FUNC(lnk_replace_type_names_with_hashes_lenient_task)
|
|||||||
// emit hash -> unique name map
|
// emit hash -> unique name map
|
||||||
if (make_map) {
|
if (make_map) {
|
||||||
lnk_format_u128(temp, sizeof(temp), hash_length, name_hash);
|
lnk_format_u128(temp, sizeof(temp), hash_length, name_hash);
|
||||||
str8_list_pushf(map_arena, map, "%s %.*s\n", temp, str8_varg(udt_info.unique_name));
|
str8_list_pushf(map_arena, map, "%s %S\n", temp, str8_varg(udt_info.unique_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse leaf size
|
// parse leaf size
|
||||||
CV_NumericParsed dummy;
|
CV_NumericParsed dummy;
|
||||||
U64 numeric_size = cv_read_numeric(leaf.data, sizeof(CV_LeafStruct), &dummy);
|
U64 numeric_size = cv_read_numeric(leaf.data, sizeof(CV_LeafStruct), &dummy);
|
||||||
|
|
||||||
U64 colon_pos = str8_find_needle_reverse(udt_info.name, 0, str8_lit("<lambda_"), 0);
|
String8 lambda_prefix = str8_lit("<lambda_");
|
||||||
B32 is_lambda = colon_pos != 0;
|
U64 colon_pos = str8_find_needle_reverse(udt_info.name, 0, lambda_prefix, 0);
|
||||||
|
B32 is_lambda = colon_pos != 0;
|
||||||
|
|
||||||
if (is_lambda) {
|
if (is_lambda) {
|
||||||
// replace display type string with unique type name hash
|
U64 size = lnk_format_u128(temp, sizeof(temp), hash_length, name_hash);
|
||||||
udt_info.name.size = lnk_format_u128(udt_info.name.str, udt_info.name.size, hash_length, name_hash);
|
Assert(size < udt_info.name.size);
|
||||||
|
Assert(size < udt_info.unique_name.size);
|
||||||
|
MemoryCopy(udt_info.name.str, temp, size+1);
|
||||||
|
MemoryCopy(udt_info.name.str+size+1, temp, size+1);
|
||||||
|
udt_info.name.size = size;
|
||||||
|
udt_info.unique_name.size = size;
|
||||||
|
|
||||||
// update leaf header
|
// update leaf header
|
||||||
CV_LeafHeader *header = cv_debug_t_get_leaf_header(debug_t, leaf_idx);
|
CV_LeafHeader *header = cv_debug_t_get_leaf_header(debug_t, leaf_idx);
|
||||||
header->size = sizeof(CV_LeafKind) + sizeof(CV_LeafStruct) + numeric_size + udt_info.name.size + 1;
|
header->size = sizeof(CV_LeafKind) +
|
||||||
|
sizeof(CV_LeafStruct) +
|
||||||
// discard unique name
|
numeric_size +
|
||||||
CV_LeafStruct *lf = (CV_LeafStruct *)(header + 1);
|
udt_info.name.size + 1 +
|
||||||
lf->props &= ~CV_TypeProp_HasUniqueName;
|
udt_info.unique_name.size + 1;
|
||||||
} else {
|
} else {
|
||||||
// replace uniuqe type name with hash
|
// replace uniuqe type name with hash
|
||||||
udt_info.unique_name.str = udt_info.name.str + udt_info.name.size + 1;
|
udt_info.unique_name.str = udt_info.name.str + udt_info.name.size + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user