File tree 5 files changed +72
-0
lines changed
5 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,7 @@ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)R
16
16
type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefMut<.+>$" --category Rust
17
17
type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)RefCell<.+>$" --category Rust
18
18
type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)NonZero<.+>$" --category Rust
19
+ type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero.+$" --category Rust
20
+ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(std::([a-z_]+::)+)PathBuf$" --category Rust
21
+ type summary add -F lldb_lookup.summary_lookup -e -x -h "^&(mut )?(std::([a-z_]+::)+)Path$" --category Rust
19
22
type category enable Rust
Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ def summary_lookup(valobj, dict):
58
58
if rust_type == RustType .STD_NONZERO_NUMBER :
59
59
return StdNonZeroNumberSummaryProvider (valobj , dict )
60
60
61
+ if rust_type == RustType .STD_PATHBUF :
62
+ return StdPathBufSummaryProvider (valobj , dict )
63
+ if rust_type == RustType .STD_PATH :
64
+ return StdPathSummaryProvider (valobj , dict )
65
+
61
66
return ""
62
67
63
68
Original file line number Diff line number Diff line change @@ -173,6 +173,35 @@ def StdStrSummaryProvider(valobj, dict):
173
173
return '"%s"' % data
174
174
175
175
176
+ def StdPathBufSummaryProvider (valobj , dict ):
177
+ # type: (SBValue, dict) -> str
178
+ # logger = Logger.Logger()
179
+ # logger >> "[StdPathBufSummaryProvider] for " + str(valobj.GetName())
180
+ return StdOsStringSummaryProvider (valobj .GetChildMemberWithName ("inner" ), dict )
181
+
182
+
183
+ def StdPathSummaryProvider (valobj , dict ):
184
+ # type: (SBValue, dict) -> str
185
+ # logger = Logger.Logger()
186
+ # logger >> "[StdPathSummaryProvider] for " + str(valobj.GetName())
187
+ length = valobj .GetChildMemberWithName ("length" ).GetValueAsUnsigned ()
188
+ if length == 0 :
189
+ return '""'
190
+
191
+ data_ptr = valobj .GetChildMemberWithName ("data_ptr" )
192
+
193
+ start = data_ptr .GetValueAsUnsigned ()
194
+ error = SBError ()
195
+ process = data_ptr .GetProcess ()
196
+ data = process .ReadMemory (start , length , error )
197
+ if PY3 :
198
+ try :
199
+ data = data .decode (encoding = 'UTF-8' )
200
+ except UnicodeDecodeError :
201
+ return '%r' % data
202
+ return '"%s"' % data
203
+
204
+
176
205
class StructSyntheticProvider :
177
206
"""Pretty-printer for structs and struct enum variants"""
178
207
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ class RustType(object):
32
32
STD_REF_MUT = "StdRefMut"
33
33
STD_REF_CELL = "StdRefCell"
34
34
STD_NONZERO_NUMBER = "StdNonZeroNumber"
35
+ STD_PATH = "StdPath"
36
+ STD_PATHBUF = "StdPathBuf"
35
37
36
38
37
39
STD_STRING_REGEX = re .compile (r"^(alloc::([a-z_]+::)+)String$" )
@@ -51,6 +53,8 @@ class RustType(object):
51
53
STD_REF_MUT_REGEX = re .compile (r"^(core::([a-z_]+::)+)RefMut<.+>$" )
52
54
STD_REF_CELL_REGEX = re .compile (r"^(core::([a-z_]+::)+)RefCell<.+>$" )
53
55
STD_NONZERO_NUMBER_REGEX = re .compile (r"^(core::([a-z_]+::)+)NonZero<.+>$" )
56
+ STD_PATHBUF_REGEX = re .compile (r"^(std::([a-z_]+::)+)PathBuf$" )
57
+ STD_PATH_REGEX = re .compile (r"^&(mut )?(std::([a-z_]+::)+)Path$" )
54
58
55
59
TUPLE_ITEM_REGEX = re .compile (r"__\d+$" )
56
60
@@ -75,6 +79,8 @@ class RustType(object):
75
79
RustType .STD_REF_CELL : STD_REF_CELL_REGEX ,
76
80
RustType .STD_CELL : STD_CELL_REGEX ,
77
81
RustType .STD_NONZERO_NUMBER : STD_NONZERO_NUMBER_REGEX ,
82
+ RustType .STD_PATHBUF : STD_PATHBUF_REGEX ,
83
+ RustType .STD_PATH : STD_PATH_REGEX ,
78
84
}
79
85
80
86
def is_tuple_fields (fields ):
Original file line number Diff line number Diff line change
1
+ //@ ignore-gdb
2
+
3
+ //@ compile-flags:-g
4
+
5
+ // === LLDB TESTS =================================================================================
6
+
7
+ // lldb-command:run
8
+
9
+ // lldb-command:print pathbuf
10
+ // lldb-check:[...] "/some/path" { inner = "/some/path" { inner = { inner = size=10 { [0] = '/' [1] = 's' [2] = 'o' [3] = 'm' [4] = 'e' [5] = '/' [6] = 'p' [7] = 'a' [8] = 't' [9] = 'h' } } } }
11
+ // lldb-command:po pathbuf
12
+ // lldb-check:"/some/path"
13
+ // lldb-command:print path
14
+ // lldb-check:[...] "/some/path" { data_ptr = [...] length = 10 }
15
+ // lldb-command:po path
16
+ // lldb-check:"/some/path"
17
+
18
+ use std:: path:: Path ;
19
+
20
+ fn main ( ) {
21
+ let path = Path :: new ( "/some/path" ) ;
22
+ let pathbuf = path. to_path_buf ( ) ;
23
+
24
+ zzz ( ) ; // #break
25
+ }
26
+
27
+ fn zzz ( ) {
28
+ ( )
29
+ }
You can’t perform that action at this time.
0 commit comments