Bug in visualizing enum value in bit-field defined struct

Sysprogs forums Forums VisualGDB Bug in visualizing enum value in bit-field defined struct

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12278
    Otatiaro
    Participant

    Hello,

    I have an enum value embedded in a bit-field defined structure:

    enum fix_type_t : uint8_t
    {
    no_fix = 0,
    kf_solution_1_sv = 0b001,
    kf_solution_2_sv = 0b010,
    kf_solution_3_sv = 0b011,
    kf_solution_4_or_mode_sv = 0b100,
    least_squares_solution_2_d = 0b101,
    least_squares_solution_3_d = 0b110,
    dr_solution = 0b111,
    };

    struct __attribute__((packed))
    {
    fix_type_t fix_type : 3;
    bool tricke_power : 1;
    altitude_hold_t altitude_hold : 2;
    bool dop_limits_exceeded : 1;
    bool dgps_correction_applied : 1;
    bool sensor_dr : 1;
    bool navigation_overdetermined : 1;
    bool velocity_dr_timeout : 1;
    bool reserved : 1;
    bool invalid_velocity : 1;
    bool altitude_hold_diabled : 1;
    dr_error_t dr_error : 2;
    };

    Compilation is ok (I get a warning about type being too small to contain all values, but that’s fine), I can check the result is ok (I know the expected value, so I placed an “if(value == expected_value) then __nop()” and the nop is getting called. So function wise all is perfect.

    But when debugging, if I try to check the enum value at runtime with the debugger, I get a value “-4” instead of kf_solution_4_or_mode_sv. This seems to be a visualization bug.

    Thomas.

    #12289
    support
    Keymaster

    Hi,

    This looks like a gdb bug actually. Can you confirm that you also get the wrong value when running “print <expression>” manually via the GDB Session window?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.