Commit 67e0bd3
committed
[lldb] Restore register state if PrepareTrivialCall fails
Fixes #124269
PrepareTrivalCall always had the possibility of failing, but
given that it only wrote to general purpose registers, if it
did, you had bigger problems.
When it failed, we did not mark the thread plan valid and
when it was torn down we didn't try to restore the register
state. This meant that if you tried to continue, the program
unlikely to work.
When I added GCS, I needed to handle the situation where the
GCS pointer points to unmapped memory and we fail to write
the extra entry we need. So I added code to restore the gcspr_el0
register specifically if this happened, and ordered the operations
such that we tried this first.
In this change I've made the teardown of an invalid thread plan
restore the register state if one was saved. It may be there isn't
one if ConstructorSetup fails, but this is ok because that function
does not modify anything.
Now that we're doing that, I don't need the GCS specific code
anymore, and all thread plans are protected from this in the rare
event something does fail.
Testing is done by the existing GCS test case that points
the gcspr into unmapped memory which causes PrepareTrivialCall
to fail.
I tried adding a simulated test using a mock gdb server. This
was not possible because they all use DynamicLoaderStatic which
disables all JIT features.1 parent 241a56d commit 67e0bd3
File tree
2 files changed
+13
-7
lines changed- lldb/source
- Plugins/ABI/AArch64
- Target
2 files changed
+13
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 105 | + | |
111 | 106 | | |
112 | 107 | | |
113 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| |||
185 | 197 | | |
186 | 198 | | |
187 | 199 | | |
188 | | - | |
189 | 200 | | |
190 | 201 | | |
191 | 202 | | |
| |||
0 commit comments