@@ -1225,7 +1225,7 @@ export abstract class Variable {
12251225 type : effectiveType ,
12261226 declaredType : debugVariable . type ,
12271227 } ;
1228-
1228+
12291229 /* Value struct or scalar types are not so interesting for us */
12301230 if ( context . debug . isValueStruct ( debugVariable , effectiveType )
12311231 || context . debug . isScalarType ( debugVariable , effectiveType ) ) {
@@ -1248,16 +1248,20 @@ export abstract class Variable {
12481248 /*
12491249 * Pointer types can be NULL or contain invalid pointers.
12501250 * cppdbg do not recognize invalid pointers, but CodeLLDB - <invalid pointer>.
1251+ *
1252+ * For such variables use special InvalidVariable, which do not
1253+ * act like RealVariable, so it prevent some potential errors.
12511254 */
1252- if ( ! context . debug . isValidPointerType ( debugVariable ) ) {
1255+ if ( ! ( context . debug . isValidPointerType ( debugVariable )
1256+ || context . debug . isFixedSizeArray ( debugVariable ) ) ) {
12531257 /*
12541258 * We are here if got scalar type or value struct (not pointer).
12551259 * These types are not so interesting for us, so pass here to
12561260 * quickly return usual variable.
12571261 */
12581262
12591263 if ( context . debug . isNull ( debugVariable )
1260- && debugVariable . type . endsWith ( 'List *' ) ) {
1264+ && effectiveType . endsWith ( 'List *' ) ) {
12611265 /*
12621266 * Empty List is NIL == NULL == '0x0' Also 'endsWith'
12631267 * covers cases like 'const List *'.
@@ -1275,7 +1279,7 @@ export abstract class Variable {
12751279 return new ListNodeVariable ( 'List' , args ) ;
12761280 }
12771281
1278- if ( parent && dbg . isFlexibleArrayMember ( debugVariable . type ) ) {
1282+ if ( parent && dbg . isFlexibleArrayMember ( effectiveType ) ) {
12791283 /*
12801284 * Flexible array members for now recognized as non-valid
12811285 * pointers/scalars, but we actually can handle them.
@@ -1288,7 +1292,7 @@ export abstract class Variable {
12881292 }
12891293 }
12901294
1291- return new InvalidPointerType ( args ) ;
1295+ return new InvalidVariable ( args ) ;
12921296 }
12931297
12941298 /*
@@ -1618,7 +1622,7 @@ class ScalarVariable extends Variable {
16181622 }
16191623}
16201624
1621- class InvalidPointerType extends Variable {
1625+ class InvalidVariable extends Variable {
16221626 constructor ( args : RealVariableArgs ) {
16231627 super ( args . name , args . value , args . type , args . declaredType ,
16241628 args . context , args . frameId , args . parent ) ;
@@ -1817,8 +1821,12 @@ export class RealVariable extends Variable {
18171821 if ( m instanceof RealVariable ) {
18181822 return m ;
18191823 }
1824+
1825+ if ( m instanceof InvalidVariable ) {
1826+ return ;
1827+ }
18201828
1821- throw new EvaluationError ( `member "${ member } " is not RealVariable` ) ;
1829+ throw new EvaluationError ( `member "${ member } " is neither RealVariable nor InvalidPointer ` ) ;
18221830 }
18231831
18241832 /**
@@ -2469,7 +2477,7 @@ class ExprNodeVariable extends NodeVariable {
24692477 }
24702478
24712479 const alias = await rte . getRealMember ( 'alias' ) ;
2472- if ( alias . isValidPointer ( ) ) {
2480+ if ( alias ) {
24732481 const aliasColnames = await alias . getListMemberElements ( 'colnames' ) ;
24742482
24752483 if ( varattno <= aliasColnames . length ) {
@@ -2534,7 +2542,7 @@ class ExprNodeVariable extends NodeVariable {
25342542 }
25352543
25362544 const eref = await rte . getRealMember ( 'eref' ) ;
2537- if ( eref . isValidPointer ( ) ) {
2545+ if ( eref ) {
25382546 const erefColnames = await eref . getListMemberElements ( 'colnames' ) ;
25392547 if ( varattno <= erefColnames . length ) {
25402548 const colname = erefColnames [ varattno - 1 ] ;
0 commit comments