Skip to content

Commit

Permalink
fix string and tuple struct formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Walnut356 committed Feb 12, 2025
1 parent 0819c16 commit d6f5d34
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/etc/lldb_commands
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Forces test-compliant formatting to all other types
type synthetic add -l lldb_lookup.synthetic_lookup -x ".*" --category Rust
type summary add -F _ -e -x -h "^.*$" --category Rust
# Std String
type synthetic add -l lldb_lookup.StdStringSyntheticProvider -x "^(alloc::([a-z_]+::)+)String$" --category Rust
Expand Down
2 changes: 1 addition & 1 deletion src/etc/lldb_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def StdStringSummaryProvider(valobj, dict):
length = inner_vec.GetChildMemberWithName("len").GetValueAsUnsigned()

if length <= 0:
return ""
return '""'
error = SBError()
process = pointer.GetProcess()
data = process.ReadMemory(pointer.GetValueAsUnsigned(), length, error)
Expand Down
2 changes: 1 addition & 1 deletion tests/debuginfo/empty-string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// lldb-command:run

// lldb-command:fr v empty_string
// lldb-check:[...] empty_string = "" { vec = size=0 }
// lldb-check:[...] empty_string = ""

// lldb-command:fr v empty_str
// lldb-check:[...] empty_str = ""
Expand Down
2 changes: 1 addition & 1 deletion tests/debuginfo/msvc-pretty-enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// lldb-check:(msvc_pretty_enums::CStyleEnum) j = High

// lldb-command:v k
// lldb-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { vec = size=21 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } }
// lldb-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } }

// lldb-command:v l
// lldb-check:(core::result::Result<u32, msvc_pretty_enums::Empty>) l = { value = { 0 = {} } }
Expand Down
3 changes: 2 additions & 1 deletion tests/debuginfo/pretty-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
// lldb-check:[...] str_slice = "IAMA string slice!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = ' ' [12] = 's' [13] = 'l' [14] = 'i' [15] = 'c' [16] = 'e' [17] = '!' }

// lldb-command:v string
// lldb-check:[...] string = "IAMA string!" { vec = size=12 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = '!' } }
// lldb-check:[...] string = "IAMA string!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = '!' }


// lldb-command:v some
// lldb-check:[...] some = Some(8)
Expand Down
2 changes: 1 addition & 1 deletion tests/debuginfo/strings-and-strs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// === LLDB TESTS ==================================================================================
// lldb-command:run
// lldb-command:v plain_string
// lldb-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } }
// lldb-check:(alloc::string::String) plain_string = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' }

// lldb-command:v plain_str
// lldb-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' }
Expand Down

0 comments on commit d6f5d34

Please # to comment.