@@ -17,6 +17,7 @@ def verify_core_file(
17
17
expected_modules ,
18
18
expected_threads ,
19
19
stacks_to_sps_map ,
20
+ stacks_to_registers_map ,
20
21
):
21
22
# To verify, we'll launch with the mini dump
22
23
target = self .dbg .CreateTarget (None )
@@ -62,6 +63,17 @@ def verify_core_file(
62
63
# Try to read just past the red zone and fail
63
64
process .ReadMemory (sp - red_zone - 1 , 1 , error )
64
65
self .assertTrue (error .Fail (), "No failure when reading past the red zone" )
66
+ # Verify the registers are the same
67
+ self .assertIn (thread_id , stacks_to_registers_map )
68
+ register_val_list = stacks_to_registers_map [thread_id ]
69
+ frame_register_list = frame .GetRegisters ()
70
+ for x in register_val_list :
71
+ self .assertEqual (
72
+ x .GetValueAsUnsigned (),
73
+ frame_register_list .GetFirstValueByName (
74
+ x .GetName ()
75
+ ).GetValueAsUnsigned (),
76
+ )
65
77
66
78
self .dbg .DeleteTarget (target )
67
79
@@ -93,12 +105,16 @@ def test_save_linux_mini_dump(self):
93
105
expected_number_of_threads = process .GetNumThreads ()
94
106
expected_threads = []
95
107
stacks_to_sp_map = {}
108
+ stakcs_to_registers_map = {}
96
109
97
110
for thread_idx in range (process .GetNumThreads ()):
98
111
thread = process .GetThreadAtIndex (thread_idx )
99
112
thread_id = thread .GetThreadID ()
100
113
expected_threads .append (thread_id )
101
114
stacks_to_sp_map [thread_id ] = thread .GetFrameAtIndex (0 ).GetSP ()
115
+ stakcs_to_registers_map [thread_id ] = thread .GetFrameAtIndex (
116
+ 0
117
+ ).GetRegisters ()
102
118
103
119
# save core and, kill process and verify corefile existence
104
120
base_command = "process save-core --plugin-name=minidump "
@@ -110,6 +126,7 @@ def test_save_linux_mini_dump(self):
110
126
expected_modules ,
111
127
expected_threads ,
112
128
stacks_to_sp_map ,
129
+ stakcs_to_registers_map ,
113
130
)
114
131
115
132
self .runCmd (base_command + " --style=modified-memory '%s'" % (core_dirty ))
@@ -120,6 +137,7 @@ def test_save_linux_mini_dump(self):
120
137
expected_modules ,
121
138
expected_threads ,
122
139
stacks_to_sp_map ,
140
+ stakcs_to_registers_map ,
123
141
)
124
142
125
143
self .runCmd (base_command + " --style=full '%s'" % (core_full ))
@@ -130,6 +148,7 @@ def test_save_linux_mini_dump(self):
130
148
expected_modules ,
131
149
expected_threads ,
132
150
stacks_to_sp_map ,
151
+ stakcs_to_registers_map ,
133
152
)
134
153
135
154
options = lldb .SBSaveCoreOptions ()
@@ -147,6 +166,7 @@ def test_save_linux_mini_dump(self):
147
166
expected_modules ,
148
167
expected_threads ,
149
168
stacks_to_sp_map ,
169
+ stakcs_to_registers_map ,
150
170
)
151
171
152
172
options = lldb .SBSaveCoreOptions ()
@@ -163,6 +183,7 @@ def test_save_linux_mini_dump(self):
163
183
expected_modules ,
164
184
expected_threads ,
165
185
stacks_to_sp_map ,
186
+ stakcs_to_registers_map ,
166
187
)
167
188
168
189
# Minidump can now save full core files, but they will be huge and
@@ -181,6 +202,7 @@ def test_save_linux_mini_dump(self):
181
202
expected_modules ,
182
203
expected_threads ,
183
204
stacks_to_sp_map ,
205
+ stakcs_to_registers_map ,
184
206
)
185
207
186
208
self .assertSuccess (process .Kill ())
@@ -276,13 +298,16 @@ def test_save_linux_mini_dump_default_options(self):
276
298
expected_threads = []
277
299
stacks_to_sp_map = {}
278
300
expected_pid = process .GetProcessInfo ().GetProcessID ()
301
+ stacks_to_registers_map = {}
279
302
280
303
for thread_idx in range (process .GetNumThreads ()):
281
304
thread = process .GetThreadAtIndex (thread_idx )
282
305
thread_id = thread .GetThreadID ()
283
306
expected_threads .append (thread_id )
284
307
stacks_to_sp_map [thread_id ] = thread .GetFrameAtIndex (0 ).GetSP ()
285
-
308
+ stacks_to_registers_map [thread_id ] = thread .GetFrameAtIndex (
309
+ 0
310
+ ).GetRegisters ()
286
311
287
312
# This is almost identical to the single thread test case because
288
313
# minidump defaults to stacks only, so we want to see if the
@@ -294,7 +319,14 @@ def test_save_linux_mini_dump_default_options(self):
294
319
error = process .SaveCore (options )
295
320
self .assertTrue (error .Success ())
296
321
297
- self .verify_core_file (default_value_file , expected_pid , expected_modules , expected_threads , stacks_to_sp_map )
322
+ self .verify_core_file (
323
+ default_value_file ,
324
+ expected_pid ,
325
+ expected_modules ,
326
+ expected_threads ,
327
+ stacks_to_sp_map ,
328
+ stacks_to_registers_map ,
329
+ )
298
330
299
331
finally :
300
332
self .assertTrue (self .dbg .DeleteTarget (target ))
0 commit comments