Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-18529

improper handling of enum in special condition

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • Qt Creator 4.3.1
    • Debugger

      considering the following code:

      class listOption_c{
      public:
      typedef enum {
      INFERRING_RAM,
      READ_FILES,
      SYNTHESIS,
      NO_USAGE
      }usage_print;
      
      private:
      usage_print _command;
      
      public:
      listOption_c(void):_command(INFERRING_RAM){}
      };

      When debugging a varaible of this type, the debugger goes can;t display the class member

      However, if the definition is using he more classic (C++) writting;

      class listOption_c{
      public:
      enum usage_print{
      INFERRING_RAM,
      READ_FILES,
      SYNTHESIS,
      NO_USAGE
      };
      
      private:
      usage_print _command;
      
      public:
      listOption_c(void):_command(INFERRING_RAM){}
      };

       The debugger properly display the class member.

      Analysis:

      the gdbbridge api:

      def nativeTypeId(self, nativeType):
        if nativeType.code == gdb.TYPE_CODE_TYPEDEF:
          return '%s{%s}' % (nativeType, nativeType.strip_typedefs())
        name = str(nativeType)
        if len(name) == 0:
          c = '0'
        elif name == 'union {...}':
          c = 'u'
        elif name.endswith('{...}'):
          c = 's'
        else:
        return name
        typeId = c + ''.join(['{%s:%s}' % (f.name, self.nativeTypeId(f.type))
             for f in nativeType.fields()])
        return typeId

      is responsible for the bug:

      Last line ,the access to the f.type field is invalid. It is stated in GDB documentation that:

       

      "The type of the field. This is usually an instance of Type, but it can be None in some situations."

      this is the case here and it is not handled property

        For Gerrit Dashboard: QTCREATORBUG-18529
        # Subject Branch Project Status CR V

            hjk hjk
            toolinfo stephane petithomme
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes