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

This commit is contained in:
Ryan Fleury
2026-04-08 13:44:55 -07:00
parent 1f5bbb9702
commit e9a142b536
3 changed files with 24 additions and 18 deletions
+1
View File
@@ -431,6 +431,7 @@ type_coverage_eval_tests(void)
char data[4]; char data[4];
}; };
SomeDataStructured *some_data = (SomeDataStructured *)&some_data_with_a_string[0]; SomeDataStructured *some_data = (SomeDataStructured *)&some_data_with_a_string[0];
char *string_ptr = &string[0];
const char *const_string = "Hello, World!"; const char *const_string = "Hello, World!";
const char const_string_array[] = "Hello, World!"; const char const_string_array[] = "Hello, World!";
+12 -10
View File
@@ -1237,10 +1237,18 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(type_key)); commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(type_key));
} }
//- rjf: determine if commit string is quoted
B32 is_quoted = 0;
if(string.size >= 1 && string.str[0] == '"')
{
string = str8_skip(string, 1);
is_quoted = 1;
}
//- rjf: pointer or array to characters/integers? -> try to treat //- rjf: pointer or array to characters/integers? -> try to treat
// new value string as textual data // new value string as textual data
if(!got_commit_data && if(!got_commit_data &&
((type_kind == E_TypeKind_Ptr || type_kind == E_TypeKind_Array) && (((is_quoted && type_kind == E_TypeKind_Ptr) || type_kind == E_TypeKind_Array) &&
(direct_type_kind == E_TypeKind_Char8 || (direct_type_kind == E_TypeKind_Char8 ||
direct_type_kind == E_TypeKind_Char16 || direct_type_kind == E_TypeKind_Char16 ||
direct_type_kind == E_TypeKind_Char32 || direct_type_kind == E_TypeKind_Char32 ||
@@ -1250,12 +1258,6 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
e_type_kind_is_integer(direct_type_kind)))) e_type_kind_is_integer(direct_type_kind))))
{ {
got_commit_data = 1; got_commit_data = 1;
B32 is_quoted = 0;
if(string.size >= 1 && string.str[0] == '"')
{
string = str8_skip(string, 1);
is_quoted = 1;
}
if(string.size >= 1 && string.str[string.size-1] == '"') if(string.size >= 1 && string.str[string.size-1] == '"')
{ {
string = str8_chop(string, 1); string = str8_chop(string, 1);
@@ -1306,9 +1308,9 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
src_eval_value.irtree.mode == E_Mode_Value) src_eval_value.irtree.mode == E_Mode_Value)
{ {
got_commit_data = 1; got_commit_data = 1;
commit_data = push_str8_copy(scratch.arena, str8_struct(&src_eval.value)); commit_data = str8_copy(scratch.arena, str8_struct(&src_eval.value));
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(src_eval.irtree.type_key)); commit_data.size = Max(commit_data.size, e_type_byte_size_from_key(src_eval.irtree.type_key));
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(type_key)); commit_data.size = Max(commit_data.size, e_type_byte_size_from_key(type_key));
} }
} }
} }
+11 -8
View File
@@ -5,21 +5,24 @@
//~ rjf: post-0.9.20 TODO notes //~ rjf: post-0.9.20 TODO notes
// //
//- fabian complaints / reports //- fabian complaints / reports
// [x] `foo, x` needs to correctly match `hex(foo)`, e.g. in application to expansions
// [ ] broadly, need to complete memory view & fix issues // [ ] broadly, need to complete memory view & fix issues
// [ ] dumb panel click-through thing // [ ] dumb panel click-through thing
// [ ] correct type interpretations; togglable interpretations // [ ] correct type interpretations; togglable interpretations
// [ ] make address editable; specialized version of the cursor address editor in tab right-click menu // [ ] make address editable; specialized version of the cursor address editor in tab right-click menu
// [x] eval: pointer casts of register space should promote to process space
// [ ] simplified default layout // [ ] simplified default layout
// [ ] signify empty watch window "expression" slot more as a text field? // [ ] memory view deserves larger spot, in default layout
// [ ] ambiguous parsing cases - need to re-introduce identifier resolution into eval parse. (foo *)&bar
// [ ] more control over string visualization; specifically, when *not* to do it, even when using e.g. char *s
// [ ] broadly, view discoverability / docs
// [ ] memory view deserves larger spot, in default layout
// [ ] sign bits should not display on unsigned integers?
// [ ] fix for-loop stepping oddities, likely single-line for-loop stepping // [ ] fix for-loop stepping oddities, likely single-line for-loop stepping
// [x] `foo, x` needs to correctly match `hex(foo)`, e.g. in application to expansions
// [x] eval: pointer casts of register space should promote to process space
// [x] more control over string visualization; specifically, when *not* to do it, even when using e.g. char *s
// [x] sign bits should not display on unsigned integers?
// [ ] ambiguous parsing cases - need to re-introduce identifier resolution into eval parse. (foo *)&bar
// [ ] broadly, view discoverability / docs
// [ ] source/disasm ctx menu should include options for e.g. "go to selected thread" // [ ] source/disasm ctx menu should include options for e.g. "go to selected thread"
// [ ] signify empty watch window "expression" slot more as a text field?
//
//- jeff viz notes
// [ ] single-line viz for pointers w/ bad (unmapped) addresses
// //
//- namespace/locations/variables RDI pass //- namespace/locations/variables RDI pass
// [ ] RDI_Local, RDI_GlobalVariable, RDI_ThreadVariable -> RDI_Variable // [ ] RDI_Local, RDI_GlobalVariable, RDI_ThreadVariable -> RDI_Variable