@@ -696,18 +696,23 @@ export abstract class Variable {
696696 } ;
697697
698698 const realType = Variable . getRealType ( debugVariable , context ) ;
699- if ( context . debug . isValueStruct ( debugVariable , realType ) || /* Raw struct, i.e. allocated on stack */
700- ! context . debug . isValidPointerType ( debugVariable ) ) { /* NULL */
699+ if ( context . debug . isValueStruct ( debugVariable , realType ) ||
700+ ! context . debug . isValidPointerType ( debugVariable ) ) {
701701 if ( context . debug . isNull ( debugVariable ) &&
702702 debugVariable . type . endsWith ( 'List *' ) ) {
703703 /*
704704 * Empty List is NIL == NULL == '0x0'
705705 *
706- * Also 'endsWith' checks for 'const List *'
706+ * Also 'endsWith' covers cases like 'const List *'
707707 */
708708 return new ListNodeVariable ( 'List' , args ) ;
709709 }
710710
711+ if ( realType === 'bitmapword' ) {
712+ /* Show bitmapword as bitmask, not integer */
713+ return new BitmapwordVariable ( args ) ;
714+ }
715+
711716 return new RealVariable ( args ) ;
712717 }
713718
@@ -4137,6 +4142,33 @@ class BitmapSetSpecialMember extends NodeVariable {
41374142 }
41384143}
41394144
4145+ /**
4146+ * Represent single 'bitmapword' as bitmask, not integer
4147+ */
4148+ class BitmapwordVariable extends RealVariable {
4149+ async getTreeItem ( ) : Promise < vscode . TreeItem > {
4150+ const value = Number ( this . value ) ;
4151+ if ( Number . isNaN ( value ) ) {
4152+ return await super . getTreeItem ( ) ;
4153+ }
4154+
4155+ let bitmask = value . toString ( 2 ) ;
4156+
4157+ /*
4158+ * Pad length to nearest power of 2, so it is easier to compare
4159+ * multiple bitmapwords lying together.
4160+ */
4161+ const length = Math . pow ( 2 , Math . ceil ( Math . log2 ( bitmask . length ) ) )
4162+ bitmask = bitmask . padStart ( length , '0' ) ;
4163+
4164+ return {
4165+ label : `${ this . name } : bitmapword` ,
4166+ description : bitmask ,
4167+ collapsibleState : vscode . TreeItemCollapsibleState . None
4168+ }
4169+ }
4170+ }
4171+
41404172/**
41414173 * Represents Integer, String, Boolean, Float or BitString nodes.
41424174 * In older systems there was single 'Value' struct for them,
0 commit comments