mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
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:
@@ -70,8 +70,20 @@ class DiagnoseReport(gdb.Command):
|
|||||||
for clz in commands:
|
for clz in commands:
|
||||||
if hasattr(clz, "diagnose"):
|
if hasattr(clz, "diagnose"):
|
||||||
command = clz()
|
command = clz()
|
||||||
gdb.write(f"Run command: {clz.__name__}\n")
|
name = clz.__name__.lower()
|
||||||
results.append(command.diagnose())
|
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")
|
gdb.write(f"Write report to {reportfile}\n")
|
||||||
with open(reportfile, "w") as f:
|
with open(reportfile, "w") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user