diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2025-10-03 14:25:53 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2025-10-03 14:32:09 +0000 |
| commit | ea675a43f09ba569adf1dd17b4f1ced970e48de4 (patch) | |
| tree | 0d685c12979006e220584345a85bcde257e80f4a /libexec | |
| parent | 07747afd516e710814fdc65afb0e5000d046f28f (diff) | |
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/Makefile | 1 | ||||
| -rw-r--r-- | libexec/kgdb/Makefile | 5 | ||||
| -rw-r--r-- | libexec/kgdb/acttrace.py | 63 |
3 files changed, 0 insertions, 69 deletions
diff --git a/libexec/Makefile b/libexec/Makefile index 7ce78321f08e..e87b48b153a8 100644 --- a/libexec/Makefile +++ b/libexec/Makefile @@ -10,7 +10,6 @@ SUBDIR= ${_atf} \ flua \ getty \ ${_hyperv} \ - kgdb \ ${_mail.local} \ ${_makewhatis.local} \ ${_mknetid} \ diff --git a/libexec/kgdb/Makefile b/libexec/kgdb/Makefile deleted file mode 100644 index f6b255ab4f60..000000000000 --- a/libexec/kgdb/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -FILESDIR?= /usr/libexec/kgdb - -FILES= acttrace.py - -.include <bsd.prog.mk> diff --git a/libexec/kgdb/acttrace.py b/libexec/kgdb/acttrace.py deleted file mode 100644 index 3229ff708de1..000000000000 --- a/libexec/kgdb/acttrace.py +++ /dev/null @@ -1,63 +0,0 @@ -#- -# Copyright (c) 2022 The FreeBSD Foundation -# -# This software was developed by Mark Johnston under sponsorship from the -# FreeBSD Foundation. -# - -import gdb - - -def symval(name): - return gdb.lookup_global_symbol(name).value() - - -def tid_to_gdb_thread(tid): - for thread in gdb.inferiors()[0].threads(): - if thread.ptid[2] == tid: - return thread - else: - return None - - -def all_pcpus(): - mp_maxid = symval("mp_maxid") - cpuid_to_pcpu = symval("cpuid_to_pcpu") - - cpu = 0 - while cpu <= mp_maxid: - pcpu = cpuid_to_pcpu[cpu] - if pcpu: - yield pcpu - cpu = cpu + 1 - - -class acttrace(gdb.Command): - def __init__(self): - super(acttrace, self).__init__("acttrace", gdb.COMMAND_USER) - - def invoke(self, arg, from_tty): - # Save the current thread so that we can switch back after. - curthread = gdb.selected_thread() - - for pcpu in all_pcpus(): - td = pcpu['pc_curthread'] - tid = td['td_tid'] - - gdb_thread = tid_to_gdb_thread(tid) - if gdb_thread is None: - print("failed to find GDB thread with TID {}".format(tid)) - else: - gdb_thread.switch() - - p = td['td_proc'] - print("Tracing command {} pid {} tid {} (CPU {})".format( - p['p_comm'], p['p_pid'], td['td_tid'], pcpu['pc_cpuid'])) - gdb.execute("bt") - print() - - curthread.switch() - - -# Registers the command with gdb, doesn't do anything. -acttrace() |
