gdb/diag: catch gdb.error in diagnositics
gdb.error could report if memory is corrupted. Save and report the exception and continue to next command. Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
191dbcc4f1
commit
5b477aacca
1 changed files with 14 additions and 2 deletions
|
@ -70,8 +70,20 @@ class DiagnoseReport(gdb.Command):
|
|||
for clz in commands:
|
||||
if hasattr(clz, "diagnose"):
|
||||
command = clz()
|
||||
gdb.write(f"Run command: {clz.__name__}\n")
|
||||
results.append(command.diagnose())
|
||||
name = clz.__name__.lower()
|
||||
gdb.write(f"Run command: {name}\n")
|
||||
try:
|
||||
result = command.diagnose()
|
||||
except gdb.error as e:
|
||||
result = {
|
||||
"command": name,
|
||||
"error": str(e),
|
||||
}
|
||||
|
||||
gdb.write(f"Failed: {e}\n")
|
||||
|
||||
result.setdefault("command", name)
|
||||
results.append(result)
|
||||
|
||||
gdb.write(f"Write report to {reportfile}\n")
|
||||
with open(reportfile, "w") as f:
|
||||
|
|
Loading…
Reference in a new issue