This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: -var-update using formatted value
> I was suggesting:
>
> (gdb) print 0b1101
> $1 = 13
I guess the change below to c-exp.y does that, at least for C. But AFAIK 0b
is not a recognised prefix for C.
I was thinking of:
(gdb) print/t 13
$1 = 0b1101
and
-var-create - * i22
^done,name="var1",numchild="0",value="6",type="volatile int"
(gdb)
-var-set-format var1 binary
^done,format="binary"
(gdb)
-var-update --all-values var1
^done,changelist=[{name="var1",value="0b110",in_scope="true",type_changed="false"}]
(gdb)
the change below to printcmd.c does this. This seems to be consistent with
existing usage, e.g. in Modula-2 hexadecimals are input like 0FFH but
output in a lanuage independent way as 0xff.
--
Nick http://www.inet.net.nz/~nickrob
*** printcmd.c.~1.116.~ 2008-01-12 11:31:27.000000000 +1300
--- printcmd.c 2008-01-14 19:23:16.000000000 +1300
*************** print_scalar_formatted (const void *vala
*** 484,489 ****
--- 484,490 ----
cp--;
}
strcpy (buf, cp);
+ fputs_filtered ("0b", stream);
fputs_filtered (buf, stream);
}
break;
*** c-exp.y.~1.42.~ 2008-01-10 09:15:34.000000000 +1300
--- c-exp.y 2008-01-14 18:38:06.000000000 +1300
*************** parse_number (p, len, parsed_float, puti
*** 1180,1185 ****
--- 1180,1194 ----
}
break;
+ case 'b':
+ if (len >= 3)
+ {
+ p += 2;
+ base = 2;
+ len -= 2;
+ }
+ break;
+
default:
base = 8;
break;