Skip to content

[BUG] Enumerations values are always shown as unsigned integers in the watch window #455

@felpafel

Description

@felpafel

Expected: The watch window should respect the sign of the underlying integral type.

Observed behavior:

  • MSVC Build: (refers to the example program compiled with MSVC)
    • Raddbg: Fails to display the tag and does not respect the sign of the underlying integer on negative values.
    • RemedyBG: Display the correct tag and respects the sign of the underlying integer.
  • CLANG Build: (refers to the example program compiled with CLANG)
    • Raddbg: Displays the correct tag in all cases but treats all values as unsigned.
    • RemedyBG: Shows the correct sign but fails to display the tag for negative values.

Similar issue: #233

Debugger version 0.9.15 ALPHA - Apr 10 2025 [33326a8]

Example program
// main.c
#include <stdint.h>
#include <windows.h>

enum MyEnum {
  MY_ENUM_NEGATIVE = -1,
  MY_ENUM_POSITIVE = 1,
};

enum MyEnum_S32 : int32_t {
  MY_ENUM_S32_NEGATIVE = -1,
  MY_ENUM_S32_POSITIVE = 1,
};

int main(void) {
  enum MyEnum my_enum_negative = MY_ENUM_NEGATIVE;
  enum MyEnum my_enum_positive = MY_ENUM_POSITIVE;
  if (my_enum_negative < 0) {
    OutputDebugString("my_enum_negative is negative.\n");
  } else {
    OutputDebugString("my_enum_negative is positive.\n");
  }

  enum MyEnum_S32 my_enum_s32_negative = MY_ENUM_S32_NEGATIVE;
  enum MyEnum_S32 my_enum_s32_positive = MY_ENUM_S32_POSITIVE;
  if (my_enum_s32_negative < 0) {
    OutputDebugString("my_enum_s32_negative is negative.\n");
  } else {
    OutputDebugString("my_enum_s32_negative is positive.\n");
  }
  return 0;
}
MVSC build

Build command: cl main.c /Zi
Compiler version: Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34809 for x64

Note: In the MSVC build the enum "MyEnum_S32" is commented out bacause fixed-width enums are only supported in CLANG.

Raddbg watch window

raddbg_msvc

RemedyBG watch window

remedybg_msvc

CLANG build

Build command: clang main.c -g -omain.exe
Compiler version:

clang version 20.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
Raddbg watch window

raddbg_clang

RemedyBG watch window

remedybg_clang

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA report of unintended or broken behavior.DebuggerPertains to the debugger.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions