# # gdb helper commands and functions for Linux kernel debugging # # module tools # # Copyright (c) Siemens AG, 2013 # # Authors: # Jan Kiszka # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import cpus, utils, lists module_type = utils.CachedType("struct module") def module_list(): global module_type modules = utils.gdb_eval_or_none("modules") if modules is None: return module_ptr_type = module_type.get_type().pointer() for module in lists.list_for_each_entry(modules, module_ptr_type, "list"): yield module def find_module_by_name(name): for module in module_list(): if module['name'].string() == name: return module return None class LxModule(gdb.Function): """Find module by name and return the module variable. $lx_module("MODULE"): Given the name MODULE, iterate over all loaded modules of the target and return that module variable which MODULE matches.""" def __init__(self): super(LxModule, self).__init__("lx_module") def invoke(self, mod_name): mod_name = mod_name.string() module = find_module_by_name(mod_name) if module: return module.dereference() else: raise gdb.GdbError("Unable to find MODULE " + mod_name) LxModule() class LxLsmod(gdb.Command): """List currently loaded modules.""" _module_use_type = utils.CachedType("struct module_use") def __init__(self): super(LxLsmod, self).__init__("lx-lsmod", gdb.COMMAND_DATA) def invoke(self, arg, from_tty): gdb.write( "Address{0} Module Size Used by\n".format( " " if utils.get_long_type().sizeof == 8 else "")) for module in module_list(): layout = module['core_layout'] gdb.write("{address} {name:<19} {size:>8} {ref}".format( address=str(layout['base']).split()[0], name=module['name'].string(), size=str(layout['size']), ref=str(module['refcnt']['counter'] - 1))) t = self._module_use_type.get_type().pointer() first = True sources = module['source_list'] for use in lists.list_for_each_entry(sources, t, "source_list"): gdb.write("{separator}{name}".format( separator=" " if first else ",", name=use['source']['name'].string())) first = False gdb.write("\n") LxLsmod() le='2025-10-13 21:50:40 -0400'>2025-10-13Use CONFIG_EXT4_FS instead of CONFIG_EXT3_FS in all of the defconfigsTheodore Ts'o 2025-09-01ARM: s3c6400_defconfig: Drop MTD_NAND_S3C2410Krzysztof Kozlowski 2024-01-11ARM: defconfig: remove sysfs-deprecated entriesArnd Bergmann 2022-08-29ARM: defconfig: reorder defconfig filesArnd Bergmann 2022-07-22ARM: s3c: mark most board files as unusedArnd Bergmann 2022-07-22ARM: defconfig: address renamed CONFIG_DEBUG_INFO=yArnd Bergmann 2022-07-22ARM: refresh defconfig filesArnd Bergmann 2019-06-26Merge tag 'samsung-defconfig-5.3' of https://git.kernel.org/pub/scm/linux/ker...Olof Johansson 2019-06-19ARM: configs: Remove useless UEVENT_HELPER_PATHKrzysztof Kozlowski 2019-06-19ARM: config: Remove left-over BACKLIGHT_LCD_SUPPORTKrzysztof Kozlowski 2019-06-13ARM: defconfig: samsung: Cleanup with savedefconfigKrzysztof Kozlowski 2019-04-18mtd: rawnand: Clarify Kconfig entry MTD_NANDMiquel Raynal 2017-06-10ARM: s3c6400_defconfig: Save defconfigKrzysztof Kozlowski 2017-06-10ARM: s3c6400_defconfig: Bring back lost (but wanted) optionsKrzysztof Kozlowski 2017-06-10ARM: defconfig: samsung: Re-order entries to match savedefconfigKrzysztof Kozlowski 2017-06-10ARM: defconfig: Cleanup from old Kconfig optionsKrzysztof Kozlowski 2015-12-01ARM: s3c64xx: multiplatform supportArnd Bergmann 2014-05-27USB: delete CONFIG_USB_DEVICEFS from defconfigNaoki MATSUMOTO 2012-08-11ARM: s3c6400_defconfig: enable more boards in defconfigKukjin Kim 2010-06-10ARM: reduce defconfigsUwe Kleine-König 2010-05-28ARM: s3c6400_defconfig: Add framebuffer and basic LCDBen Dooks 2010-05-28ARM: s3c6400_defconfig: Add RTC driver supportBen Dooks 2010-05-28ARM: s3c6400_defconfig: Enable USB host sideBen Dooks 2010-05-28ARM: s3c6400_defconfig: Add SPI driverBen Dooks 2010-05-28ARM: s3c6400_defconfig: Update compiled machinesBen Dooks 2010-05-26ARM: s3c6400_defconfig: Update s3c6400_defconfig to v2.6.34-gitBen Dooks 2010-05-23ARM: s3c6400_defconfig: Add NAND driverBen Dooks 2010-05-23ARM: s3c6400_defconfig: enable sound as modulesBen Dooks 2010-05-23ARM: s3c6400_defconfig: enable power managementBen Dooks 2010-05-23ARM: s3c6400_defconfig: Update s3c6400_defconfig to v2.6.34Ben Dooks 2010-01-21ARM: S3C64XX: Update s3c6400_defconfig for current kernelBen Dooks 2010-01-21ARM: S3C6400: Update s3c6400_defconfig for bigger initrds for SMDK6410Ben Dooks 2009-12-18ARM: Kill CONFIG_CPU_32Russell King 2009-06-23[ARM] S3C: Remove unused CONFIG_DEBUG_S3C_PORTBen Dooks 2009-01-26eeprom: More consistent symbol namesJean Delvare 2008-12-15[ARM] s3c6400_defconfig: Add SDHCI driverBen Dooks 2008-12-15[ARM] s3c6400_defconfig: Add I2C driver and devicesBen Dooks 2008-12-15[ARM] S3C64XX: Add s3c6400_defconfigBen Dooks