Commit c509f8c
committed
DLPX-87579 sdb: use drgn helper for task states
= Problem
Currently having our own custom function for figuring out a task's
state has two drawbacks:
1] As we saw in a2bdd57 things can
get out of date and it is up to us to fix them.
2] There are some weird edge cases that we don't handle as well
like the following crash that I have never been able to reproduce
locally but it occasionally reproduces in the Github runners
of PR delphix#337:
```
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/internal/repl.py", line 107, in eval_cmd
for obj in invoke([], input_):
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/pipeline.py", line 152, in invoke
yield from execute_pipeline(first_input, pipeline)
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/pipeline.py", line 84, in execute_pipeline
yield from massage_input_and_call(pipeline[-1], this_input)
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/pipeline.py", line 67, in massage_input_and_call
yield from cmd.call(objs)
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/command.py", line 413, in call
yield from self.__invalid_memory_objects_check(
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/command.py", line 358, in __invalid_memory_objects_check
for obj in objs:
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/command.py", line 625, in _call
self.pretty_print(self.caller(objs))
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/commands/linux/stacks.py", line 407, in pretty_print
self.print_stacks(filter(self.match_stack, objs))
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/commands/linux/stacks.py", line 382, in print_stacks
for stack_key, tasks in KernelStacks.aggregate_stacks(objs):
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/commands/linux/stacks.py", line 375, in aggregate_stacks
stack_key = (KernelStacks.task_struct_get_state(task),
File "/usr/local/lib/python3.8/dist-packages/sdb-0.1.0-py3.8.egg/sdb/commands/linux/stacks.py", line 221, in task_struct_get_state
return KernelStacks.TASK_STATES[(state | exit_state) & 0x7f]
KeyError: 101
```
= This Patch
Uses the drgn helper whose implementation handles more edge cases
and is more probable to stay up to date with the latest kernels
while keeping backwards compatibility.
= Testing
The above stack trace that I was able to reproduce consistently
in that PR no longer shows up with this patch.1 parent 3a1fadc commit c509f8c
2 files changed
+16
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
| 208 | + | |
206 | 209 | | |
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 213 | + | |
222 | 214 | | |
223 | 215 | | |
224 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
| |||
0 commit comments