• P
    qom/object: Display more helpful message when an interface is missing · a9ee3a9e
    Philippe Mathieu-Daudé 提交于
    When adding new devices implementing QOM interfaces, we might
    forgot to add the Kconfig dependency that pulls the required
    objects in when building.
    
    Since QOM dependencies are resolved at runtime, we don't get any
    link-time failures, and QEMU aborts while starting:
    
      $ qemu ...
      Segmentation fault (core dumped)
    
      (gdb) bt
      #0  0x00007ff6e96b1e35 in raise () from /lib64/libc.so.6
      #1  0x00007ff6e969c895 in abort () from /lib64/libc.so.6
      #2  0x00005572bc5051cf in type_initialize (ti=0x5572be6f1200) at qom/object.c:323
      #3  0x00005572bc505074 in type_initialize (ti=0x5572be6f1800) at qom/object.c:301
      #4  0x00005572bc505074 in type_initialize (ti=0x5572be6e48e0) at qom/object.c:301
      #5  0x00005572bc506939 in object_class_by_name (typename=0x5572bc56109a) at qom/object.c:959
      #6  0x00005572bc503dd5 in cpu_class_by_name (typename=0x5572bc56109a, cpu_model=0x5572be6d9930) at hw/core/cpu.c:286
    
    Since the caller has access to the qdev parent/interface names,
    we can simply display them to avoid starting a debugger:
    
      $ qemu ...
      qemu: missing interface 'fancy-if' for object 'fancy-dev'
      Aborted (core dumped)
    
    This commit is similar to e02bdf1c ("Display more helpful message
    when an object type is missing").
    Signed-off-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20200118162348.17823-1-philmd@redhat.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    a9ee3a9e
object.c 66.2 KB