Changeset 206 in dev for trunk/abdev/BasicCompiler_Common/WatchList.cpp
- Timestamp:
- Jul 12, 2007, 2:58:26 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/WatchList.cpp
r182 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 4 5 #include <Compiler.h> 2 6 3 7 #include "common.h" … … 12 16 #include "debug.h" 13 17 14 int Debugging_GetArray( const int *SubScripts,char *array,const Type &type,LONG_PTR *plpOffset);18 int Debugging_GetArray( const Subscripts &subscripts,char *array,const Type &type,LONG_PTR *plpOffset); 15 19 16 20 ULONG_PTR Debugging_GetVarPtr(RELATIVE_VAR *pRelativeVar){ … … 117 121 char lpPtrOffset[VN_SIZE]; //第2次配列 118 122 char NestMember[VN_SIZE]; //入れ子メンバ 119 CClass::RefTyperefType;123 ReferenceKind refType; 120 124 lstrcpy(VarName,member); 121 125 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember, refType ) ) return 0; … … 145 149 //ポインタ変数の場合 146 150 if( resultType.IsPointer() ){ 147 if( pMember->SubScripts[0]==-1){151 if( pMember->GetSubscripts().size() == 0 ){ 148 152 lstrcpy(lpPtrOffset,array); 149 153 array[0]=0; … … 159 163 //配列オフセット 160 164 i2=Debugging_GetArray( 161 pMember-> SubScripts,165 pMember->GetSubscripts(), 162 166 array, 163 167 resultType, … … 172 176 } 173 177 } 174 else if( pMember->SubScripts[0]!=-1){178 else if( pMember->GetSubscripts().size() > 0 ){ 175 179 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 176 180 } … … 180 184 181 185 if( resultType.IsObject() || resultType.IsStruct() ){ 182 if( refType != CClass::Dot ) return 0;186 if( refType != RefDot ) return 0; 183 187 184 188 if( resultType.IsObject() ){ … … 195 199 196 200 if(lpPtrOffset[0]){ 197 if( refType != CClass::Dot ) return 0;201 if( refType != RefDot ) return 0; 198 202 199 203 //直接参照に切り替え … … 203 207 } 204 208 else{ 205 if( refType != CClass::Pointer ) return 0;209 if( refType != RefPointer ) return 0; 206 210 207 211 extern HANDLE hDebugProcess; … … 235 239 return 1; 236 240 } 237 int Debugging_GetArray( const int *SubScripts,char *array,const Type &type,LONG_PTR *plpOffset){241 int Debugging_GetArray( const Subscripts &subscripts,char *array,const Type &type,LONG_PTR *plpOffset){ 238 242 extern HANDLE hHeap; 239 243 int i,i2,i3,i4,i5,array_offset; … … 254 258 } 255 259 if(array[i]==','||array[i]=='\0'){ 256 if(SubScripts[i3]==-1){ 260 if( i3 >= (int)subscripts.size() ) 261 { 257 262 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]); 258 263 return 0; … … 267 272 268 273 if(array[i]=='\0'){ 269 if(SubScripts[i3]!=-1){ 274 if( i3 < (int)subscripts.size() ) 275 { 270 276 for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]); 271 277 return 0; … … 302 308 i5=(int)i64data; 303 309 304 for(i2=i+1,i4=1;i2<i3;i2++) i4*= SubScripts[i2]+1;310 for(i2=i+1,i4=1;i2<i3;i2++) i4*=subscripts[i2]+1; 305 311 306 312 array_offset+=i5*i4; … … 316 322 } 317 323 ULONG_PTR Debugging_GetThisPtrOffset(LONG_PTR obp_Rip){ 318 GlobalProc *pUserProc = GetSubFromObp(obp_Rip);319 320 BOOST_FOREACH( Variable *pVar, pUserProc-> localVars){324 UserProc *pUserProc = GetSubFromObp(obp_Rip); 325 326 BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){ 321 327 if( pVar->GetName() == "_System_LocalThis" ){ 322 return pVar-> offset;328 return pVar->GetOffsetAddress(); 323 329 } 324 330 } 325 331 return 0; 326 332 } 327 int Debugging_GetVarOffset( char *variable,RELATIVE_VAR *pRelativeVar, Type &resultType, int *pss){333 int Debugging_GetVarOffset( char *variable,RELATIVE_VAR *pRelativeVar, Type &resultType, Subscripts *pResultSubscripts){ 328 334 extern HANDLE hDebugProcess; 329 335 int i2,i3; … … 333 339 334 340 lstrcpy(VarName,variable); 335 CClass::RefTyperefType;341 ReferenceKind refType; 336 342 GetVarFormatString(VarName,array,lpPtrOffset,member,refType); 337 343 338 const int *pSubScripts;344 const Subscripts *pSubscripts; 339 345 bool isArray; 340 346 … … 344 350 ///////////////// 345 351 if( UserProc::IsLocalAreaCompiling() ){ 346 const Variable *pVar = UserProc::CompilingUserProc(). localVars.Find( Symbol( VarName ) );352 const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().Find( Symbol( VarName ) ); 347 353 348 354 if( pVar ){ 349 355 //ポインタ変数の場合 350 if( pVar-> IsPointer() ){356 if( pVar->GetType().IsPointer() ){ 351 357 if( !pVar->IsArray() ){ 352 358 lstrcpy(lpPtrOffset,array); … … 358 364 } 359 365 360 pRelativeVar->offset = pVar-> offset;366 pRelativeVar->offset = pVar->GetOffsetAddress(); 361 367 if( pVar->IsRef() ){ 362 368 pRelativeVar->dwKind=VAR_REFLOCAL; … … 365 371 pRelativeVar->dwKind=VAR_LOCAL; 366 372 } 367 resultType = *pVar;373 resultType = pVar->GetType(); 368 374 isArray = pVar->IsArray(); 369 pSub Scripts = pVar->GetSubScriptsPtr();370 } 371 } 372 373 if( Smoothie::Temp::pCompilingClass){375 pSubscripts = &pVar->GetSubscripts(); 376 } 377 } 378 379 if(compiler.pCompilingClass){ 374 380 /////////////////////// 375 381 // クラスメンバの参照 … … 385 391 386 392 bool isFound = false; 387 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){393 BOOST_FOREACH( CMember *pMember, compiler.pCompilingClass->GetDynamicMembers() ){ 388 394 if( pMember->GetName() == VarName ){ 389 395 isFound = true; … … 414 420 pRelativeVar->dwKind=VAR_DIRECTMEM; 415 421 416 i3=Debugging_GetMember(* Smoothie::Temp::pCompilingClass,variable,pRelativeVar,resultType,1);422 i3=Debugging_GetMember(*compiler.pCompilingClass,variable,pRelativeVar,resultType,1); 417 423 if(i3==0){ 418 424 //式エラー … … 434 440 /////////////////// 435 441 436 const Variable *pVar = globalVars.Find( VarName );442 const Variable *pVar = compiler.GetMeta().GetGlobalVars().Find( VarName ); 437 443 if( !pVar ){ 438 444 //一致しないとき … … 441 447 442 448 //ポインタ変数の場合 443 if( pVar-> IsPointer() ){449 if( pVar->GetType().IsPointer() ){ 444 450 if( !pVar->IsArray() ){ 445 451 lstrcpy(lpPtrOffset,array); … … 451 457 } 452 458 453 pRelativeVar->offset=pVar-> offset;459 pRelativeVar->offset=pVar->GetOffsetAddress(); 454 460 if(pVar->IsRef()) pRelativeVar->dwKind=VAR_REFGLOBAL; 455 461 else pRelativeVar->dwKind=VAR_GLOBAL; 456 resultType = *pVar;462 resultType = pVar->GetType(); 457 463 isArray = pVar->IsArray(); 458 pSub Scripts=pVar->GetSubScriptsPtr();464 pSubscripts = &pVar->GetSubscripts(); 459 465 } 460 466 … … 463 469 //配列の先頭ポインタを示す場合 464 470 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 465 if(pss) memcpy(pss,pSubScripts,MAX_ARRAYDIM*sizeof(int)); 471 if( pResultSubscripts ) 472 { 473 (*pResultSubscripts) = *pSubscripts; 474 } 466 475 return 1; 467 476 } 468 477 469 478 if(array[0]){ 470 i3=Debugging_GetArray( pSubScripts,array,resultType,&pRelativeVar->offset);479 i3=Debugging_GetArray( *pSubscripts, array,resultType,&pRelativeVar->offset); 471 480 if(i3==0){ 472 481 //式エラー … … 481 490 if( resultType.IsObject() || resultType.IsStruct() ){ 482 491 //実態オブジェクトのメンバを参照(obj.member) 483 if( refType != CClass::Dot ){492 if( refType != RefDot ){ 484 493 return 0; 485 494 } … … 499 508 if(lpPtrOffset[0]){ 500 509 //pObj[n].member 501 if( refType != CClass::Dot ) return 0;510 if( refType != RefDot ) return 0; 502 511 Debugging_SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 503 512 … … 514 523 else{ 515 524 //pObj->member 516 if( refType != CClass::Pointer ) return 0;525 if( refType != RefPointer ) return 0; 517 526 518 527 pRelativeVar->offset=Debugging_GetVarPtr(pRelativeVar);
Note:
See TracChangeset
for help on using the changeset viewer.