scripts/gdb/vmalloc: disable on no-MMU
authorBen Wolsieffer <ben.wolsieffer@hefring.com>
Tue, 31 Oct 2023 20:22:36 +0000 (16:22 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 1 Nov 2023 19:46:59 +0000 (12:46 -0700)
commit6620999f0d41e4fd6f047727936a964c3399d249
tree286aef7fdfa750c7b52a85f9f1d9db09d5821041
parent16501630bdeb107141a0139ddc33f92ab5582c6f
scripts/gdb/vmalloc: disable on no-MMU

vmap_area does not exist on no-MMU, therefore the GDB scripts fail to
load:

Traceback (most recent call last):
  File "<...>/vmlinux-gdb.py", line 51, in <module>
    import linux.vmalloc
  File "<...>/scripts/gdb/linux/vmalloc.py", line 14, in <module>
    vmap_area_ptr_type = vmap_area_type.get_type().pointer()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<...>/scripts/gdb/linux/utils.py", line 28, in get_type
    self._type = gdb.lookup_type(self._name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
gdb.error: No struct type named vmap_area.

To fix this, disable the command and add an informative error message if
CONFIG_MMU is not defined, following the example of lx-slabinfo.

Link: https://lkml.kernel.org/r/20231031202235.2655333-2-ben.wolsieffer@hefring.com
Fixes: 852622bf3616 ("scripts/gdb/vmalloc: add vmallocinfo support")
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/gdb/linux/constants.py.in
scripts/gdb/linux/vmalloc.py