@@ -106,7 +106,18 @@ export class NodeVarRegistry {
106
106
let typeName = utils . getStructNameFromType ( type ) ;
107
107
108
108
/* [const] [struct] NAME * */
109
- return this . nodeTags . has ( typeName ) && utils . getPointersCount ( type ) === 1
109
+ if ( this . nodeTags . has ( typeName ) && utils . getPointersCount ( type ) === 1 ) {
110
+ return true ;
111
+ }
112
+
113
+ const alias = this . aliases . get ( typeName ) ;
114
+ if ( ! alias ) {
115
+ return false ;
116
+ }
117
+
118
+ type = type . replace ( typeName , alias ) ;
119
+ typeName = utils . getStructNameFromType ( type ) ;
120
+ return this . nodeTags . has ( typeName ) && utils . getPointersCount ( type ) === 1 ;
110
121
}
111
122
112
123
/**
@@ -432,7 +443,7 @@ export abstract class Variable {
432
443
}
433
444
434
445
/* Embedded or top level structs */
435
- if ( utils . isRawStruct ( this ) ) {
446
+ if ( utils . isRawStruct ( this . type , this . value ) ) {
436
447
return true ;
437
448
}
438
449
@@ -508,7 +519,9 @@ export abstract class Variable {
508
519
context,
509
520
logger,
510
521
} ;
511
- if ( utils . isRawStruct ( debugVariable ) ||
522
+
523
+ const realType = Variable . getRealType ( debugVariable , context ) ;
524
+ if ( utils . isRawStruct ( realType , debugVariable . value ) ||
512
525
! utils . isValidPointer ( debugVariable . value ) ) {
513
526
if ( utils . isNull ( debugVariable . value ) && debugVariable . type === 'List *' ) {
514
527
/* Empty List is NIL == NULL == '0x0' */
@@ -518,8 +531,6 @@ export abstract class Variable {
518
531
return new RealVariable ( args ) ;
519
532
}
520
533
521
- const realType = Variable . getRealType ( debugVariable , context ) ;
522
-
523
534
/*
524
535
* PostgreSQL versions prior 16 do not have Bitmapset Node.
525
536
* So handle Bitmapset (with Relids) here.
@@ -531,7 +542,7 @@ export abstract class Variable {
531
542
/* NodeTag variables: Node, List, Bitmapset etc.. */
532
543
if ( context . nodeVarRegistry . isNodeVar ( realType ) ) {
533
544
const nodeTagVar = await NodeVariable . create ( debugVariable , frameId ,
534
- context , logger , parent ) ;
545
+ context , logger , parent ) ;
535
546
if ( nodeTagVar ) {
536
547
return nodeTagVar ;
537
548
}
@@ -1052,7 +1063,7 @@ export class NodeVariable extends RealVariable {
1052
1063
*
1053
1064
* @example `OpExpr *' was `Node *'
1054
1065
*/
1055
- realType : string | undefined ;
1066
+ realType ? : string ;
1056
1067
1057
1068
constructor ( realNodeTag : string , args : RealVariableArgs ) {
1058
1069
super ( args ) ;
@@ -1068,12 +1079,13 @@ export class NodeVariable extends RealVariable {
1068
1079
/*
1069
1080
* Also try find aliases for some NodeTags
1070
1081
*/
1071
- const alias = this . context . nodeVarRegistry . aliases . get ( this . realNodeTag ) ;
1082
+ let type = this . type ;
1083
+ const alias = this . context . nodeVarRegistry . aliases . get ( tagFromType ) ;
1072
1084
if ( alias ) {
1073
- return utils . substituteStructName ( this . type , alias ) ;
1085
+ type = utils . substituteStructName ( type , alias ) ;
1074
1086
}
1075
1087
1076
- return utils . substituteStructName ( this . type , this . realNodeTag ) ;
1088
+ return utils . substituteStructName ( type , this . realNodeTag ) ;
1077
1089
}
1078
1090
1079
1091
getRealType ( ) : string {
@@ -1146,7 +1158,7 @@ export class NodeVariable extends RealVariable {
1146
1158
* We should substitute current type with target, because
1147
1159
* there may be qualifiers such `struct' or `const'
1148
1160
*/
1149
- const resultType = utils . substituteStructName ( this . type , tag ) ;
1161
+ const resultType = utils . substituteStructName ( this . getRealType ( ) , tag ) ;
1150
1162
return await this . castToType ( resultType ) ;
1151
1163
}
1152
1164
@@ -1216,7 +1228,7 @@ export class NodeVariable extends RealVariable {
1216
1228
context : ExecContext , logger : utils . ILogger ,
1217
1229
parent ?: Variable ) : Promise < NodeVariable | undefined > {
1218
1230
const getRealNodeTag = async ( ) => {
1219
- const nodeTagExpression = `((Node*)(${ variable . evaluateName } ))->type` ;
1231
+ const nodeTagExpression = `((Node*)(${ variable . value } ))->type` ;
1220
1232
const response = await context . debug . evaluate ( nodeTagExpression , frameId ) ;
1221
1233
let realTag = response . result ?. replace ( 'T_' , '' ) ;
1222
1234
if ( ! this . isValidNodeTag ( realTag ) ) {
0 commit comments