mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[debugging] Fix gdb script koid refs & panic CPU display
Two minor debugging helpers: - the GDB script was still referencing m_koid on objects, switched to the replacement m_obj_id instead. - finally gave in and made panic print 1-based CPU ids like GDB uses instead of 0-based like the hardware and LITERALLY EVERYTHING ELSE
This commit is contained in:
@@ -168,12 +168,12 @@ class GetThreadsCommand(gdb.Command):
|
|||||||
rsp = int(gdb.parse_and_eval(f"{tcb}->rsp"))
|
rsp = int(gdb.parse_and_eval(f"{tcb}->rsp"))
|
||||||
pri = int(gdb.parse_and_eval(f"{tcb}->priority"))
|
pri = int(gdb.parse_and_eval(f"{tcb}->priority"))
|
||||||
flags = int(gdb.parse_and_eval(f"{thread}->m_state"))
|
flags = int(gdb.parse_and_eval(f"{thread}->m_state"))
|
||||||
koid = int(gdb.parse_and_eval(f"{thread}->m_koid"))
|
koid = int(gdb.parse_and_eval(f"{thread}->m_obj_id"))
|
||||||
proc = int(gdb.parse_and_eval(f"{thread}->m_parent.m_koid"))
|
proc = int(gdb.parse_and_eval(f"{thread}->m_parent.m_obj_id"))
|
||||||
|
|
||||||
creator = int(gdb.parse_and_eval(f"{thread}->m_creator"))
|
creator = int(gdb.parse_and_eval(f"{thread}->m_creator"))
|
||||||
if creator != 0:
|
if creator != 0:
|
||||||
creator_koid = int(gdb.parse_and_eval(f"{thread}->m_creator->m_koid"))
|
creator_koid = int(gdb.parse_and_eval(f"{thread}->m_creator->m_obj_id"))
|
||||||
creator = f"{creator_koid:x}"
|
creator = f"{creator_koid:x}"
|
||||||
else:
|
else:
|
||||||
creator = "<no thread>"
|
creator = "<no thread>"
|
||||||
@@ -236,7 +236,7 @@ class GetThreadsCommand(gdb.Command):
|
|||||||
if previous != 0:
|
if previous != 0:
|
||||||
tcb = f"((TCB*){previous:#x})"
|
tcb = f"((TCB*){previous:#x})"
|
||||||
thread = f"({tcb}->thread)"
|
thread = f"({tcb}->thread)"
|
||||||
koid = int(gdb.parse_and_eval(f"{thread}->m_koid"))
|
koid = int(gdb.parse_and_eval(f"{thread}->m_obj_id"))
|
||||||
print(f" prev: {koid:x}")
|
print(f" prev: {koid:x}")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ class CapTablePrinter:
|
|||||||
refcount = int(node["holders"]),
|
refcount = int(node["holders"]),
|
||||||
caps = int(node["caps"]),
|
caps = int(node["caps"]),
|
||||||
type = str(node["type"])[14:],
|
type = str(node["type"])[14:],
|
||||||
koid = node['object']['m_koid']))
|
koid = node['object']['m_obj_id']))
|
||||||
|
|
||||||
self.nodes.sort(key=lambda n: n.id, reverse=True)
|
self.nodes.sort(key=lambda n: n.id, reverse=True)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ print_cpu(serial_port &out, cpu_data &cpu)
|
|||||||
{
|
{
|
||||||
out.write("\n \e[0;31m==[ CPU: ");
|
out.write("\n \e[0;31m==[ CPU: ");
|
||||||
char cpuid[7];
|
char cpuid[7];
|
||||||
util::format({cpuid, sizeof(cpuid)}, "%4x", cpu.id);
|
util::format({cpuid, sizeof(cpuid)}, "%4d", cpu.id + 1); // gdb uses 1-based CPU indices
|
||||||
out.write(cpuid);
|
out.write(cpuid);
|
||||||
out.write(" ]====================================================================\n");
|
out.write(" ]====================================================================\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user