Win32 debugger: stop cutting off register values in CtrlRegisterList

The name and value columns were hardcoded at x=17 and x=77. The control has
a fixed width in the dialog and can not be widened, so the 8 hex digits of a
GPR only just fit - and once the register list got a vertical scrollbar, the
~17px it takes off the client width pushed the last digits off the edge.

Derive the value column from the client width each paint instead, pulling it
in far enough for a whole value to fit and clipping anything longer rather
than letting it spill. Same for the category tab labels.

Float registers print with %g rather than %f: in a column that narrow, a
clipped %f of a large value is worse than useless (1e20 would read as
100000000), while %g keeps six significant digits and stays short for the
values you normally see.
This commit is contained in:
Henrik Rydgård
2026-09-12 13:46:12 -06:00
parent a6996f570f
commit c81bc5c212
5 changed files with 40 additions and 12 deletions
+2 -2
View File
@@ -41,8 +41,8 @@ public:
void PrintRegValue(int cat, int index, char *out, size_t outSize) const override {
switch (cat) {
case 0: snprintf(out, outSize, "%08X", ctx.r[index]); break;
case 1: snprintf(out, outSize, "%f", ctx.f[index]); break;
case 2: snprintf(out, outSize, "%f", ctx.v[voffset[index]]); break;
case 1: snprintf(out, outSize, "%g", ctx.f[index]); break;
case 2: snprintf(out, outSize, "%g", ctx.v[voffset[index]]); break;
}
}