Commit 69bec87a authored by Mike Gerdts's avatar Mike Gerdts Committed by Tomasz Zawadzki
Browse files

scripts: gdb macros should allow missing symbols



When gdb_macros.py is used with unit tests some of the globals it
expects are not present. This commit handles the relevant exceptions so
a missing symbol does not prevent the use of macros that are initialized
later.

Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Change-Id: Ic81f0dfa705839c9a03fb76e934684716b710390
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15999


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 555ca7ad
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
#   SPDX-License-Identifier: BSD-3-Clause
#   Copyright (C) 2019 Intel Corporation.
#   Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#

import gdb
@@ -126,7 +127,11 @@ class IoDevices(SpdkRbTree):
class spdk_print_io_devices(SpdkPrintCommand):

    def __init__(self):
        try:
            io_devices = IoDevices()
        except RuntimeError as e:
            print("Cannot load IO devices: " + str(e))
            return
        name = 'spdk_print_io_devices'
        super(spdk_print_io_devices, self).__init__(name, io_devices)

@@ -147,7 +152,11 @@ class spdk_print_bdevs(SpdkPrintCommand):
    name = 'spdk_print_bdevs'

    def __init__(self):
        try:
            bdevs = BdevMgrBdevs()
        except RuntimeError as e:
            print("Cannot load bdevs: " + str(e))
            return
        super(spdk_print_bdevs, self).__init__(self.name, bdevs)


@@ -210,7 +219,11 @@ class SpdkNvmfTgtSubsystems(SpdkArr):
            return int(self.spdk_nvmf_tgt['opts']['max_subsystems'])

    def __init__(self):
        try:
            self.spdk_nvmf_tgt = gdb.parse_and_eval("g_spdk_nvmf_tgt")
        except RuntimeError as e:
            print("Cannot load nvmf target subsystems: " + str(e))
            return
        subsystems = gdb.parse_and_eval("g_spdk_nvmf_tgt->subsystems")
        super(SpdkNvmfTgtSubsystems, self).__init__(subsystems,
                                                    self.get_num_subsystems(),