/linux/scripts/gdb/linux/ |
H A D | proc.py | 3 # gdb helper commands and functions for Linux kernel debugging 15 import gdb 25 class LxCmdLine(gdb.Command): 30 super(LxCmdLine, self).__init__("lx-cmdline", gdb.COMMAND_DATA) 33 gdb.write(gdb.parse_and_eval("saved_command_line").string() + "\n") 39 class LxVersion(gdb.Command): 44 super(LxVersion, self).__init__("lx-version", gdb.COMMAND_DATA) 48 gdb.write(gdb [all...] |
H A D | cpus.py | 2 # gdb helper commands and functions for Linux kernel debugging 14 import gdb 27 return gdb.selected_thread().num - 1 29 return gdb.parse_and_eval("kgdb_active.counter") 31 raise gdb.GdbError("Sorry, obtaining the current CPU is not yet " 32 "supported with this gdb server.") 39 offset = gdb.parse_and_eval( 43 offset = gdb.parse_and_eval( 45 except gdb.error: 58 gdb [all...] |
H A D | page_owner.py | 9 import gdb 27 gdb.write("Unrecognized command\n") 28 raise gdb.GdbError(t) 30 class DumpPageOwner(gdb.Command): 39 super(DumpPageOwner, self).__init__("lx-dump-page-owner", gdb.COMMAND_SUPPORT) 43 raise gdb.GdbError('CONFIG_PAGE_OWNER does not enable') 45 page_owner_inited = gdb.parse_and_eval('page_owner_inited') 47 raise gdb.GdbError('page_owner_inited is not enabled') 51 argv = gdb.string_to_argv(args) 64 self.min_pfn = int(gdb [all...] |
H A D | symbols.py | 2 # gdb helper commands and functions for Linux kernel debugging 14 import gdb 23 if hasattr(gdb, 'Breakpoint'): 24 class LoadModuleBreakpoint(gdb.Breakpoint): 31 module = gdb.parse_and_eval("mod") 43 gdb.write("refreshing all symbols to reload module " 55 paddr_vmcoreinfo_note = gdb.parse_and_eval("*(unsigned long long *)" + 65 gdb.execute("symbol-file {0} -o {1}".format( 67 kaslr_offset = gdb.parse_and_eval("vm_layout.kaslr_offset") 69 inferior = gdb [all...] |
H A D | vmalloc.py | 9 import gdb 22 class LxVmallocInfo(gdb.Command): 26 super(LxVmallocInfo, self).__init__("lx-vmallocinfo", gdb.COMMAND_DATA) 30 raise gdb.GdbError("Requires MMU support") 32 nr_vmap_nodes = gdb.parse_and_eval('nr_vmap_nodes') 34 vn = gdb.parse_and_eval('&vmap_nodes[%d]' % i) 37 gdb.write("0x%x-0x%x %10d vm_map_ram\n" % (vmap_area['va_start'], vmap_area['va_end'], 41 gdb.write("0x%x-0x%x %10d" % (v['addr'], v['addr'] + v['size'], v['size'])) 43 gdb.write(" %s" % str(v['caller']).split(' ')[-1]) 45 gdb [all...] |
H A D | utils.py | 2 # gdb helper commands and functions for Linux kernel debugging 19 import gdb 29 gdb.events.new_objfile.disconnect(self._new_objfile_handler) 33 self._type = gdb.lookup_type(self._name) 35 raise gdb.GdbError( 37 if hasattr(gdb, 'events') and hasattr(gdb.events, 'new_objfile'): 38 gdb.events.new_objfile.connect(self._new_objfile_handler) 70 element = gdb.Value(0).cast(typeobj) 79 class ContainerOf(gdb [all...] |
H A D | slab.py | 9 import gdb 34 track_type = gdb.lookup_type('struct track') 35 track_alloc = int(gdb.parse_and_eval('TRACK_ALLOC')) 36 track_free = int(gdb.parse_and_eval('TRACK_FREE')) 39 return slab.cast(gdb.lookup_type("struct folio").pointer()) 56 return cache['inuse'] + gdb.lookup_type("void").pointer().sizeof 64 p += gdb.lookup_type('struct track').sizeof * 2 118 jiffies = gdb.parse_and_eval("jiffies_64") 158 while p != gdb.Value(0): 173 track = gdb [all...] |
H A D | lists.py | 2 # gdb helper commands and functions for Linux kernel debugging 14 import gdb 31 gdb.write("list_for_each: Uninitialized list '{}' treated as empty\n" 69 raise gdb.GdbError('argument must be of type (struct list_head [*])') 72 gdb.write("Starting with: {}\n".format(c)) 73 except gdb.MemoryError: 74 gdb.write('head is not accessible\n') 81 gdb.write('prev.next != current: ' 90 except gdb.MemoryError: 91 gdb [all...] |
H A D | mm.py | 9 import gdb 26 raise gdb.GdbError('Only support CONFIG_SPARSEMEM_VMEMMAP now') 30 raise gdb.GdbError('Only support aarch64 now') 54 tcr_el1 = gdb.execute("info registers $TCR_EL1", to_string=True) 60 self.kimage_voffset = gdb.parse_and_eval('kimage_voffset') & ((1 << 64) - 1) 76 self.SECTIONS_PER_ROOT = self.PAGE_SIZE // gdb.lookup_type("struct mem_section").sizeof 87 self.SECTION_HAS_MEM_MAP = 1 << int(gdb.parse_and_eval('SECTION_HAS_MEM_MAP_BIT')) 88 self.SECTION_IS_EARLY = 1 << int(gdb.parse_and_eval('SECTION_IS_EARLY_BIT')) 105 self.memstart_addr = gdb.parse_and_eval("memstart_addr") 107 self.vmemmap = gdb [all...] |
H A D | modules.py | 2 # gdb helper commands and functions for Linux kernel debugging 14 import gdb 44 class LxModule(gdb.Function): 59 raise gdb.GdbError("Unable to find MODULE " + mod_name) 65 class LxLsmod(gdb.Command): 71 super(LxLsmod, self).__init__("lx-lsmod", gdb.COMMAND_DATA) 74 gdb.write( 86 gdb.write("{address} {name:<19} {size:>8} {ref}".format( 96 gdb.write("{separator}{name}".format( 101 gdb [all...] |
H A D | clk.py | 5 import gdb 18 class LxClkSummary(gdb.Command): 27 super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA) 30 gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % ( 45 raise gdb.GdbError("No clocks registered") 46 gdb.write(" enable prepare protect \n") 47 gdb.write(" clock count count count rate \n") 48 gdb.write("------------------------------------------------------------------------\n") 49 for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")): 51 for clk in clk_core_for_each_child(gdb [all...] |
H A D | device.py | 5 import gdb 36 for kobj in kset_for_each_object(gdb.parse_and_eval('bus_kset')): 43 for kobj in kset_for_each_object(gdb.parse_and_eval('class_kset')): 53 raise gdb.GdbError("Can't find bus type {!r}".format(name)) 60 raise gdb.GdbError("Can't find device class {!r}".format(name)) 91 gdb.write('{}dev {}:\t{}\n'.format('\t' * level, dev_name(dev), dev)) 97 class LxDeviceListBus(gdb.Command): 101 super(LxDeviceListBus, self).__init__('lx-device-list-bus', gdb.COMMAND_DATA) 106 gdb.write('bus {}:\t{}\n'.format(bus['bus']['name'].string(), bus)) 112 raise gdb [all...] |
H A D | config.py | 5 import gdb 11 class LxConfigDump(gdb.Command): 17 super(LxConfigDump, self).__init__("lx-configdump", gdb.COMMAND_DATA, 18 gdb.COMPLETE_FILENAME) 27 py_config_ptr = gdb.parse_and_eval("&kernel_config_data") 28 py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end") 30 except gdb.error as e: 31 raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?") 33 inf = gdb.inferiors()[0] 41 gdb [all...] |
H A D | genpd.py | 5 import gdb 38 class LxGenPDSummary(gdb.Command): 44 super(LxGenPDSummary, self).__init__('lx-genpd-summary', gdb.COMMAND_DATA) 59 gdb.write('%-30s %-15s %s\n' % ( 70 gdb.write(' %-50s %s\n' % (kobj_path, rtpm_status_str(dev))) 74 raise gdb.GdbError("No power domain(s) registered") 75 gdb.write('domain status children\n'); 76 gdb.write(' /device runtime status\n'); 77 gdb.write('----------------------------------------------------------------------\n'); 79 gdb [all...] |
H A D | tasks.py | 2 # gdb helper commands and functions for Linux kernel debugging 14 import gdb 24 init_task = gdb.parse_and_eval("init_task").address 45 class LxTaskByPidFunc(gdb.Function): 59 raise gdb.GdbError("No task of PID " + str(pid)) 65 class LxPs(gdb.Command): 69 super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA) 72 gdb.write("{:>10} {:>12} {:>7}\n".format("TASK", "PID", "COMM")) 74 gdb.write("{} {:^5} {}\n".format( 94 class LxThreadInfoFunc (gdb [all...] |
H A D | rbtree.py | 5 import gdb 29 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) 45 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) 58 parent = gdb.Value(node['__rb_parent_color'] & ~3) 70 raise gdb.GdbError("Must be struct rb_node not {}".format(node.type)) 93 raise gdb.GdbError("Must be struct rb_node not {}".format(node.type)) 112 class LxRbFirst(gdb.Function): 124 raise gdb.GdbError("No entry in tree") 132 class LxRbLast(gdb.Function): 144 raise gdb [all...] |
H A D | pgtable.py | 3 # gdb helper commands and functions for Linux kernel debugging 11 import gdb 15 PHYSICAL_ADDRESS_MASK = gdb.parse_and_eval('0xfffffffffffff') 21 return gdb.parse_and_eval('(u64) ~0xfff') 24 return gdb.parse_and_eval('(u64) ~0x1fffff') 27 return gdb.parse_and_eval('(u64) ~0x3fffffff') 33 pob_symbol = gdb.lookup_global_symbol('page_offset_base') 35 return gdb.parse_and_eval(pob) 89 memoryview(gdb.selected_inferior().read_memory(address, 8)), 195 class TranslateVM(gdb [all...] |
H A D | kasan.py | 9 import gdb 16 gdb.write("Unrecognized command\n") 17 raise gdb.GdbError(t) 19 class KasanMemToShadow(gdb.Command): 26 super(KasanMemToShadow, self).__init__("lx-kasan_mem_to_shadow", gdb.COMMAND_SUPPORT) 30 raise gdb.GdbError('CONFIG_KASAN_GENERIC or CONFIG_KASAN_SW_TAGS is not set') 32 argv = gdb.string_to_argv(args) 38 gdb.write('shadow addr: 0x%x\n' % shadow_addr)
|
H A D | interrupts.py | 5 import gdb 18 return desc['action'] and desc['action'] == gdb.parse_and_eval("&chained_action") 26 desc = mapletree.mtree_load(gdb.parse_and_eval("&sparse_irqs"), irq) 76 gdb.lookup_type("struct irqaction") 101 irq_stat = gdb.parse_and_eval("&irq_stat") 110 pvar = gdb.parse_and_eval(var) 187 text += "%*s: %10lu\n" % (prec, "ERR", gdb.parse_and_eval("irq_err_count")) 201 raise gdb.GdbError("Unsupported architecture: {}".format(target_arch)) 205 class LxInterruptList(gdb.Command): 209 super(LxInterruptList, self).__init__("lx-interruptlist", gdb [all...] |
H A D | timerlist.py | 6 import gdb 23 tk_core = gdb.parse_and_eval("&tk_core") 70 jiffies = gdb.parse_and_eval("jiffies_64") 71 tick_sched_ptr = gdb.parse_and_eval("&tick_cpu_sched") 154 nr_cpu_ids = gdb.parse_and_eval("nr_cpu_ids") 156 inf = gdb.inferiors()[0] 181 class LxTimerList(gdb.Command): 185 super(LxTimerList, self).__init__("lx-timerlist", gdb.COMMAND_DATA) 188 hrtimer_bases = gdb.parse_and_eval("&hrtimer_bases") 189 max_clock_bases = gdb [all...] |
H A D | mapletree.py | 10 import gdb 39 raise gdb.GdbError("must be {} not {}" 111 raise gdb.GdbError("{} must be {} not {}" 126 raise gdb.GdbError("{} must be {} not {}" 132 raise gdb.GdbError("{} must be {} not {}" 146 raise gdb.GdbError("{} must be {} not {}" 153 raise gdb.GdbError("{} must be {} not {}" 172 raise gdb.GdbError("{}: must be {} not {}" 183 raise gdb.GdbError("{}: must be {} not {}"
|
/linux/Documentation/translations/zh_CN/dev-tools/ |
H A D | gdb-kernel-debugging.rst | 5 :Original: Documentation/dev-tools/gdb-kernel-debugging.rst 20 - gdb 7.2+ (推荐版本: 7.4+) 且开启python支持 (通常发行版上都已支持) 51 - 启动gdb:gdb vmlinux 54 如果gdb报告拒绝加载vmlinux-gdb.py(相关命令找不到),请将:: 62 (gdb) target remote :1234 70 (gdb) lx-symbols 83 (gdb) b btrfs_init_sysfs 90 (gdb) c 104 (gdb) lx-dmesg 116 (gdb) [all...] |
/linux/Documentation/translations/zh_TW/dev-tools/ |
H A D | gdb-kernel-debugging.rst | 5 :Original: Documentation/dev-tools/gdb-kernel-debugging.rst 20 - gdb 7.2+ (推薦版本: 7.4+) 且開啓python支持 (通常發行版上都已支持) 47 - 啓動gdb:gdb vmlinux 50 如果gdb報告拒絕加載vmlinux-gdb.py(相關命令找不到),請將:: 58 (gdb) target remote :1234 66 (gdb) lx-symbols 79 (gdb) b btrfs_init_sysfs 86 (gdb) c 100 (gdb) lx-dmesg 112 (gdb) [all...] |
/linux/Documentation/process/debugging/ |
H A D | gdb-kernel-debugging.rst | 3 Debugging kernel and modules via gdb 8 using gdb. Gdb comes with a powerful scripting interface for python. The 12 be transferred to the other gdb stubs as well. 18 - gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true 42 - Build the gdb scripts (required on kernels v5.1 and above):: 46 - Enable the gdb stub of QEMU/KVM, either 57 - Start gdb: gdb vmlinux 59 Note: Some distros may restrict auto-loading of gdb scripts to known safe 60 directories. In case gdb report [all...] |
/linux/Documentation/translations/zh_CN/admin-guide/ |
H A D | bug-hunting.rst | 104 通常来说使用 ``gdb`` 会比较容易,不过内核需要用调试信息来预编译。 106 gdb section in 找到缺陷位置 109 GNU 调试器(GNU debugger, ``gdb`` )是从 ``vmlinux`` 文件中找出OOPS的确切 123 $ gdb vmlinux 124 (gdb) l *0xc021e50e 134 $ gdb vmlinux 135 (gdb) l *vt_ioctl+0xda8 150 (gdb) p vt_ioctl 152 (gdb) l *0xae0+0xda8 157 $ gdb driver [all...] |