mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	scripts/gdb: fix 'lx-lsmod' show the wrong size
'lsmod' shows total core layout size, so we need to sum up all the
sections in core layout in gdb scripts.
/ # lsmod
kasan_test 200704 0 - Live 0xffff80007f640000
Before patch:
(gdb) lx-lsmod
Address            Module                  Size  Used by
0xffff80007f640000 kasan_test             36864  0
After patch:
(gdb) lx-lsmod
Address            Module                  Size  Used by
0xffff80007f640000 kasan_test            200704  0
Link: https://lkml.kernel.org/r/20230710092852.31049-1-Kuan-Ying.Lee@mediatek.com
Fixes: b4aff7513d ("scripts/gdb: use mem instead of core_layout to get the module address")
Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Reviewed-by: Pankaj Raghav <p.raghav@samsung.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Qun-Wei Lin <qun-wei.lin@mediatek.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									02d7f74a04
								
							
						
					
					
						commit
						fb40b05373
					
				
					 2 changed files with 12 additions and 3 deletions
				
			
		|  | @ -64,6 +64,9 @@ LX_GDBPARSED(IRQ_HIDDEN) | ||||||
| 
 | 
 | ||||||
| /* linux/module.h */ | /* linux/module.h */ | ||||||
| LX_GDBPARSED(MOD_TEXT) | LX_GDBPARSED(MOD_TEXT) | ||||||
|  | LX_GDBPARSED(MOD_DATA) | ||||||
|  | LX_GDBPARSED(MOD_RODATA) | ||||||
|  | LX_GDBPARSED(MOD_RO_AFTER_INIT) | ||||||
| 
 | 
 | ||||||
| /* linux/mount.h */ | /* linux/mount.h */ | ||||||
| LX_VALUE(MNT_NOSUID) | LX_VALUE(MNT_NOSUID) | ||||||
|  |  | ||||||
|  | @ -73,11 +73,17 @@ class LxLsmod(gdb.Command): | ||||||
|                 "        " if utils.get_long_type().sizeof == 8 else "")) |                 "        " if utils.get_long_type().sizeof == 8 else "")) | ||||||
| 
 | 
 | ||||||
|         for module in module_list(): |         for module in module_list(): | ||||||
|             layout = module['mem'][constants.LX_MOD_TEXT] |             text = module['mem'][constants.LX_MOD_TEXT] | ||||||
|  |             text_addr = str(text['base']).split()[0] | ||||||
|  |             total_size = 0 | ||||||
|  | 
 | ||||||
|  |             for i in range(constants.LX_MOD_TEXT, constants.LX_MOD_RO_AFTER_INIT + 1): | ||||||
|  |                 total_size += module['mem'][i]['size'] | ||||||
|  | 
 | ||||||
|             gdb.write("{address} {name:<19} {size:>8}  {ref}".format( |             gdb.write("{address} {name:<19} {size:>8}  {ref}".format( | ||||||
|                 address=str(layout['base']).split()[0], |                 address=text_addr, | ||||||
|                 name=module['name'].string(), |                 name=module['name'].string(), | ||||||
|                 size=str(layout['size']), |                 size=str(total_size), | ||||||
|                 ref=str(module['refcnt']['counter'] - 1))) |                 ref=str(module['refcnt']['counter'] - 1))) | ||||||
| 
 | 
 | ||||||
|             t = self._module_use_type.get_type().pointer() |             t = self._module_use_type.get_type().pointer() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Kuan-Ying Lee
						Kuan-Ying Lee