[3] | 1 | #include "../BasicCompiler_Common/common.h"
|
---|
| 2 | #include "opcode.h"
|
---|
| 3 |
|
---|
| 4 | //デバッグ用
|
---|
| 5 | #include "../BasicCompiler_Common/debug.h"
|
---|
| 6 |
|
---|
[75] | 7 | int Debugging_GetArray( const int *SubScripts,char *array,const Type &type,LONG_PTR *plpOffset);
|
---|
[3] | 8 |
|
---|
| 9 | ULONG_PTR Debugging_GetVarPtr(RELATIVE_VAR *pRelativeVar){
|
---|
| 10 | extern DWORD ImageBase;
|
---|
| 11 | extern int MemPos_RWSection;
|
---|
| 12 | int i2;
|
---|
| 13 |
|
---|
| 14 | if(pRelativeVar->dwKind==VAR_GLOBAL){
|
---|
| 15 | return ImageBase+MemPos_RWSection+pRelativeVar->offset;
|
---|
| 16 | }
|
---|
[62] | 17 | else if( pRelativeVar->dwKind == VAR_REFGLOBAL ){
|
---|
| 18 | extern HANDLE hDebugProcess;
|
---|
| 19 | LONG_PTR lpData;
|
---|
| 20 | SIZE_T stAccBytes;
|
---|
| 21 | ReadProcessMemory(hDebugProcess,
|
---|
| 22 | (void *)(ImageBase+MemPos_RWSection+pRelativeVar->offset),
|
---|
| 23 | &lpData,
|
---|
| 24 | sizeof(LONG_PTR),
|
---|
| 25 | &stAccBytes);
|
---|
| 26 |
|
---|
| 27 | return lpData;
|
---|
| 28 | }
|
---|
[3] | 29 | else if(pRelativeVar->dwKind==VAR_LOCAL){
|
---|
| 30 | extern HWND hDebugWnd;
|
---|
| 31 | i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
| 32 | i2=pobj_dti->iProcLevel-i2;
|
---|
| 33 |
|
---|
| 34 | if(pobj_dti->lplpSpBase[i2]==0) return 0;
|
---|
| 35 |
|
---|
| 36 | return pobj_dti->lplpSpBase[i2]+pRelativeVar->offset;
|
---|
| 37 | }
|
---|
[40] | 38 | else if( pRelativeVar->dwKind == VAR_REFLOCAL ){
|
---|
[3] | 39 | extern HWND hDebugWnd;
|
---|
| 40 | i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
| 41 | i2=pobj_dti->iProcLevel-i2;
|
---|
| 42 |
|
---|
| 43 | if(pobj_dti->lplpSpBase[i2]==0) return 0;
|
---|
| 44 |
|
---|
| 45 | extern HANDLE hDebugProcess;
|
---|
| 46 | LONG_PTR lpData;
|
---|
| 47 | SIZE_T stAccBytes;
|
---|
| 48 | ReadProcessMemory(hDebugProcess,
|
---|
| 49 | (void *)(pobj_dti->lplpSpBase[i2]+(int)pRelativeVar->offset),
|
---|
| 50 | &lpData,
|
---|
| 51 | sizeof(LONG_PTR),
|
---|
| 52 | &stAccBytes);
|
---|
| 53 |
|
---|
| 54 | return lpData;
|
---|
| 55 | }
|
---|
| 56 | else if(pRelativeVar->dwKind==VAR_DIRECTMEM){
|
---|
| 57 | return pRelativeVar->offset;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | return 0;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
[75] | 63 | bool Debugging_SetRelativeOffset( Type &type,RELATIVE_VAR *pRelativeVar,char *lpPtrOffset){
|
---|
[3] | 64 | int array_num;
|
---|
| 65 |
|
---|
| 66 | _int64 i64data;
|
---|
[75] | 67 | if( !StaticCalculation( true, lpPtrOffset, 0, &i64data, Type(), 1 ) ){
|
---|
| 68 | return false;
|
---|
| 69 | }
|
---|
| 70 | if( type.IsReal() ){
|
---|
[3] | 71 | double dbl;
|
---|
| 72 | memcpy(&dbl,&i64data,sizeof(double));
|
---|
| 73 | i64data=(_int64)dbl;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | array_num=(int)i64data;
|
---|
| 77 |
|
---|
[75] | 78 | if( type.PtrLevel() ){
|
---|
| 79 | type.PtrLevelDown();
|
---|
| 80 | array_num *= type.GetSize();
|
---|
[3] | 81 | }
|
---|
| 82 | else{
|
---|
| 83 | //エラー
|
---|
[75] | 84 | return false;
|
---|
[3] | 85 | }
|
---|
| 86 |
|
---|
| 87 | extern HANDLE hDebugProcess;
|
---|
| 88 | LONG_PTR lpData;
|
---|
| 89 | SIZE_T stAccBytes;
|
---|
| 90 | lpData=Debugging_GetVarPtr(pRelativeVar);
|
---|
[75] | 91 | if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&stAccBytes)){
|
---|
| 92 | return false;
|
---|
| 93 | }
|
---|
[3] | 94 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 95 |
|
---|
| 96 | pRelativeVar->offset+=array_num;
|
---|
[75] | 97 | return true;
|
---|
[3] | 98 | }
|
---|
| 99 |
|
---|
[75] | 100 | int Debugging_GetMember( const CClass &objClass,char *member,RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){
|
---|
[63] | 101 | int i,i2;
|
---|
[3] | 102 |
|
---|
| 103 | //直接参照に切り替え
|
---|
| 104 | pRelativeVar->offset=(LONG_PTR)Debugging_GetVarPtr(pRelativeVar);
|
---|
| 105 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 106 |
|
---|
| 107 | //クラス、配列の構成要素を解析する
|
---|
| 108 | char VarName[VN_SIZE]; //変数名
|
---|
| 109 | char array[VN_SIZE]; //第1次配列
|
---|
| 110 | char lpPtrOffset[VN_SIZE]; //第2次配列
|
---|
| 111 | char NestMember[VN_SIZE]; //入れ子メンバ
|
---|
[64] | 112 | CClass::RefType refType;
|
---|
[3] | 113 | lstrcpy(VarName,member);
|
---|
[64] | 114 | if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember, refType ) ) return 0;
|
---|
[3] | 115 |
|
---|
| 116 |
|
---|
| 117 | ////////////////////////////
|
---|
| 118 | // メンバオフセットを取得
|
---|
| 119 | ////////////////////////////
|
---|
| 120 |
|
---|
[75] | 121 | int offset = objClass.GetMemberOffset( VarName, &i );
|
---|
| 122 | if(i==objClass.iMemberNum) return 0;
|
---|
[3] | 123 |
|
---|
| 124 |
|
---|
| 125 | //アクセシビリティをチェック
|
---|
[75] | 126 | if((bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||
|
---|
| 127 | objClass.ppobj_Member[i]->dwAccess==ACCESS_NON){
|
---|
[3] | 128 | return 0;
|
---|
| 129 | }
|
---|
[75] | 130 | else if(bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PROTECTED)
|
---|
[3] | 131 | return 0;
|
---|
| 132 |
|
---|
[75] | 133 | resultType = *objClass.ppobj_Member[i];
|
---|
[3] | 134 |
|
---|
| 135 | //ポインタ変数の場合
|
---|
[75] | 136 | if( resultType.IsPointer() ){
|
---|
| 137 | if(objClass.ppobj_Member[i]->SubScripts[0]==-1){
|
---|
[3] | 138 | lstrcpy(lpPtrOffset,array);
|
---|
| 139 | array[0]=0;
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 | else{
|
---|
| 143 | if(lpPtrOffset[0]) return 0;
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | pRelativeVar->offset+=offset;
|
---|
| 147 |
|
---|
| 148 | if(array[0]){
|
---|
| 149 | //配列オフセット
|
---|
| 150 | i2=Debugging_GetArray(
|
---|
[75] | 151 | objClass.ppobj_Member[i]->SubScripts,
|
---|
[3] | 152 | array,
|
---|
[75] | 153 | resultType,
|
---|
[3] | 154 | &pRelativeVar->offset);
|
---|
| 155 | if(i2==0){
|
---|
| 156 | //式エラー
|
---|
| 157 | return 0;
|
---|
| 158 | }
|
---|
| 159 | if(i2==-1){
|
---|
| 160 | //アクセスエラー
|
---|
| 161 | return -1;
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
[75] | 164 | else if(objClass.ppobj_Member[i]->SubScripts[0]!=-1){
|
---|
| 165 | resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR );
|
---|
[3] | 166 | }
|
---|
| 167 |
|
---|
| 168 | if(NestMember[0]){
|
---|
| 169 | //入れ子構造の場合
|
---|
| 170 |
|
---|
[75] | 171 | if( resultType.IsObject() || resultType.IsStruct() ){
|
---|
[64] | 172 | if( refType != CClass::Dot ) return 0;
|
---|
| 173 |
|
---|
[75] | 174 | if( resultType.IsObject() ){
|
---|
[64] | 175 | extern HANDLE hDebugProcess;
|
---|
| 176 | LONG_PTR lpData;
|
---|
| 177 | SIZE_T stAccBytes;
|
---|
| 178 | lpData=Debugging_GetVarPtr(pRelativeVar);
|
---|
| 179 | if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&stAccBytes)) return -1;
|
---|
| 180 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 181 | }
|
---|
[3] | 182 | }
|
---|
[75] | 183 | else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){
|
---|
[3] | 184 | //構造体ポインタ型メンバ変数
|
---|
| 185 |
|
---|
| 186 | if(lpPtrOffset[0]){
|
---|
[64] | 187 | if( refType != CClass::Dot ) return 0;
|
---|
[3] | 188 |
|
---|
| 189 | //直接参照に切り替え
|
---|
[75] | 190 | Debugging_SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
|
---|
[3] | 191 |
|
---|
| 192 | lpPtrOffset[0]=0;
|
---|
| 193 | }
|
---|
| 194 | else{
|
---|
[64] | 195 | if( refType != CClass::Pointer ) return 0;
|
---|
[3] | 196 |
|
---|
| 197 | extern HANDLE hDebugProcess;
|
---|
| 198 | LONG_PTR lpData;
|
---|
| 199 | SIZE_T stAccBytes;
|
---|
| 200 | lpData=Debugging_GetVarPtr(pRelativeVar);
|
---|
| 201 | if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&stAccBytes)) return -1;
|
---|
| 202 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 203 | }
|
---|
| 204 | }
|
---|
| 205 |
|
---|
[75] | 206 | i2=Debugging_GetMember(objClass.ppobj_Member[i]->GetClass(),
|
---|
[3] | 207 | NestMember,
|
---|
| 208 | pRelativeVar,
|
---|
[75] | 209 | resultType,
|
---|
[3] | 210 | 0);
|
---|
| 211 | if(i2==0){
|
---|
| 212 | //式エラー
|
---|
| 213 | return 0;
|
---|
| 214 | }
|
---|
| 215 | if(i2==-1){
|
---|
| 216 | //アクセスエラー
|
---|
| 217 | return -1;
|
---|
| 218 | }
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | if(lpPtrOffset[0]){
|
---|
[75] | 222 | Debugging_SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
|
---|
[3] | 223 | }
|
---|
| 224 |
|
---|
| 225 | return 1;
|
---|
| 226 | }
|
---|
[75] | 227 | int Debugging_GetArray( const int *SubScripts,char *array,const Type &type,LONG_PTR *plpOffset){
|
---|
[3] | 228 | extern HANDLE hHeap;
|
---|
[75] | 229 | int i,i2,i3,i4,i5,array_offset;
|
---|
[3] | 230 | char temporary[VN_SIZE],*pParm[MAX_PARMS];
|
---|
| 231 |
|
---|
| 232 | for(i=0,i2=0,i3=0;;i++,i2++){
|
---|
| 233 | if(array[i]=='('){
|
---|
| 234 | i4=GetStringInPare(temporary+i2,array+i);
|
---|
| 235 | i+=i4-1;
|
---|
| 236 | i2+=i4-1;
|
---|
| 237 | continue;
|
---|
| 238 | }
|
---|
| 239 | if(array[i]=='['){
|
---|
| 240 | i4=GetStringInBracket(temporary+i2,array+i);
|
---|
| 241 | i+=i4-1;
|
---|
| 242 | i2+=i4-1;
|
---|
| 243 | continue;
|
---|
| 244 | }
|
---|
| 245 | if(array[i]==','||array[i]=='\0'){
|
---|
| 246 | if(SubScripts[i3]==-1){
|
---|
| 247 | for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]);
|
---|
| 248 | return 0;
|
---|
| 249 | }
|
---|
| 250 |
|
---|
| 251 | temporary[i2]=0;
|
---|
| 252 |
|
---|
| 253 | pParm[i3]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
---|
| 254 | lstrcpy(pParm[i3],temporary);
|
---|
| 255 |
|
---|
| 256 | i3++;
|
---|
| 257 |
|
---|
| 258 | if(array[i]=='\0'){
|
---|
| 259 | if(SubScripts[i3]!=-1){
|
---|
| 260 | for(i3--;i3>=0;i3--) HeapDefaultFree(pParm[i3]);
|
---|
| 261 | return 0;
|
---|
| 262 | }
|
---|
| 263 | break;
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | i2=-1;
|
---|
| 267 | continue;
|
---|
| 268 | }
|
---|
| 269 | temporary[i2]=array[i];
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | array_offset=0;
|
---|
| 273 |
|
---|
| 274 | for(i=i3-1;i>=0;i--){
|
---|
| 275 | _int64 i64data;
|
---|
[75] | 276 | Type resultType;
|
---|
| 277 | bool isMemoryAccessError;
|
---|
| 278 | if( !StaticCalculation(true, pParm[i],0,&i64data,resultType,1, &isMemoryAccessError ) ){
|
---|
[3] | 279 | //式エラー
|
---|
| 280 | return 0;
|
---|
| 281 | }
|
---|
[75] | 282 | if(isMemoryAccessError){
|
---|
[3] | 283 | //アクセスエラー
|
---|
| 284 | return -1;
|
---|
| 285 | }
|
---|
| 286 |
|
---|
[75] | 287 | if(resultType.IsReal()){
|
---|
[3] | 288 | double dbl;
|
---|
| 289 | memcpy(&dbl,&i64data,sizeof(double));
|
---|
| 290 | i64data=(_int64)dbl;
|
---|
| 291 | }
|
---|
| 292 | i5=(int)i64data;
|
---|
| 293 |
|
---|
| 294 | for(i2=i+1,i4=1;i2<i3;i2++) i4*=SubScripts[i2]+1;
|
---|
| 295 |
|
---|
| 296 | array_offset+=i5*i4;
|
---|
| 297 |
|
---|
| 298 | HeapDefaultFree(pParm[i]);
|
---|
| 299 | }
|
---|
| 300 |
|
---|
[75] | 301 | array_offset *= type.GetSize();
|
---|
[3] | 302 |
|
---|
| 303 | *plpOffset+=array_offset;
|
---|
| 304 |
|
---|
| 305 | return 1;
|
---|
| 306 | }
|
---|
| 307 | ULONG_PTR Debugging_GetThisPtrOffset(LONG_PTR obp_Rip){
|
---|
[75] | 308 | UserProc *pUserProc = GetSubFromObp(obp_Rip);
|
---|
[3] | 309 |
|
---|
[75] | 310 | foreach( Variable *pVar, pUserProc->localVars ){
|
---|
| 311 | if( pVar->GetName() == "_System_LocalThis" ){
|
---|
| 312 | return pVar->offset;
|
---|
| 313 | }
|
---|
[3] | 314 | }
|
---|
[75] | 315 | return 0;
|
---|
[3] | 316 | }
|
---|
[75] | 317 | int Debugging_GetVarOffset( char *variable,RELATIVE_VAR *pRelativeVar, Type &resultType, int *pss){
|
---|
[3] | 318 | extern HANDLE hDebugProcess;
|
---|
[64] | 319 | int i,i2,i3;
|
---|
[3] | 320 | char member[VN_SIZE],VarName[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE];
|
---|
| 321 | LONG_PTR lpData;
|
---|
| 322 | SIZE_T stAccBytes;
|
---|
| 323 |
|
---|
| 324 | lstrcpy(VarName,variable);
|
---|
[64] | 325 | CClass::RefType refType;
|
---|
| 326 | GetVarFormatString(VarName,array,lpPtrOffset,member,refType);
|
---|
[3] | 327 |
|
---|
[75] | 328 | const int *pSubScripts;
|
---|
| 329 | bool isArray;
|
---|
[3] | 330 |
|
---|
| 331 |
|
---|
| 332 | /////////////////
|
---|
| 333 | // ローカル変数
|
---|
| 334 | /////////////////
|
---|
[75] | 335 | const Variable *pVar = UserProc::CompilingUserProc().localVars.Find( VarName );
|
---|
| 336 | if( pVar ){
|
---|
[3] | 337 | //ポインタ変数の場合
|
---|
[75] | 338 | if( pVar->IsPointer() ){
|
---|
| 339 | if( !pVar->IsArray() ){
|
---|
[3] | 340 | lstrcpy(lpPtrOffset,array);
|
---|
| 341 | array[0]=0;
|
---|
| 342 | }
|
---|
| 343 | }
|
---|
| 344 | else{
|
---|
| 345 | if(lpPtrOffset[0]) return 0;
|
---|
| 346 | }
|
---|
| 347 |
|
---|
[75] | 348 | pRelativeVar->offset = pVar->offset;
|
---|
| 349 | if( pVar->IsRef() ){
|
---|
| 350 | pRelativeVar->dwKind=VAR_REFLOCAL;
|
---|
| 351 | }
|
---|
| 352 | else{
|
---|
| 353 | pRelativeVar->dwKind=VAR_LOCAL;
|
---|
| 354 | }
|
---|
| 355 | resultType = *pVar;
|
---|
| 356 | isArray = pVar->IsArray();
|
---|
| 357 | pSubScripts = pVar->GetSubScriptsPtr();
|
---|
[3] | 358 | }
|
---|
| 359 | else{
|
---|
| 360 | if(pobj_CompilingClass){
|
---|
| 361 | ///////////////////////
|
---|
| 362 | // クラスメンバの参照
|
---|
| 363 | ///////////////////////
|
---|
| 364 |
|
---|
| 365 | if(memicmp(variable,"This.",5)==0){
|
---|
| 366 | //Thisオブジェクトのメンバを参照するとき
|
---|
| 367 | SlideString(variable+5,-5);
|
---|
| 368 | lstrcpy(VarName,variable);
|
---|
| 369 | }
|
---|
| 370 | else{
|
---|
| 371 | //クラス内メンバを参照するとき(通常)
|
---|
| 372 |
|
---|
| 373 | for(i=0;i<pobj_CompilingClass->iMemberNum;i++){
|
---|
| 374 | if(lstrcmp(VarName,pobj_CompilingClass->ppobj_Member[i]->name)==0) break;
|
---|
| 375 | }
|
---|
| 376 | if(i==pobj_CompilingClass->iMemberNum) goto NonClassMember;
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | /////////////////////////////
|
---|
| 380 | // thisポインタを取得
|
---|
| 381 |
|
---|
| 382 | extern HWND hDebugWnd;
|
---|
| 383 | i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
| 384 | i2=pobj_dti->iProcLevel-i2;
|
---|
| 385 |
|
---|
| 386 | lpData=Debugging_GetThisPtrOffset(pobj_dti->lplpObp[i2]);
|
---|
| 387 | if(!lpData){
|
---|
| 388 | //式エラー
|
---|
| 389 | return 0;
|
---|
| 390 | }
|
---|
| 391 | lpData+=pobj_dti->lplpSpBase[i2];
|
---|
| 392 | if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&stAccBytes)){
|
---|
| 393 | //メモリにアクセスできないとき
|
---|
| 394 | return -1;
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 398 |
|
---|
[75] | 399 | i3=Debugging_GetMember(*pobj_CompilingClass,variable,pRelativeVar,resultType,1);
|
---|
[3] | 400 | if(i3==0){
|
---|
| 401 | //式エラー
|
---|
| 402 | return 0;
|
---|
| 403 | }
|
---|
| 404 | if(i3==-1){
|
---|
| 405 | //アクセスエラー
|
---|
| 406 | return -1;
|
---|
| 407 | }
|
---|
| 408 |
|
---|
| 409 | return 1;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | NonClassMember:
|
---|
| 413 |
|
---|
| 414 | ///////////////////
|
---|
| 415 | // グローバル変数
|
---|
| 416 | ///////////////////
|
---|
| 417 |
|
---|
[75] | 418 | const Variable *pVar = globalVars.Find( VarName );
|
---|
| 419 | if( !pVar ){
|
---|
[3] | 420 | //一致しないとき
|
---|
| 421 | return 0;
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | //ポインタ変数の場合
|
---|
[75] | 425 | if( pVar->IsPointer() ){
|
---|
| 426 | if( !pVar->IsArray() ){
|
---|
[3] | 427 | lstrcpy(lpPtrOffset,array);
|
---|
| 428 | array[0]=0;
|
---|
| 429 | }
|
---|
| 430 | }
|
---|
| 431 | else{
|
---|
| 432 | if(lpPtrOffset[0]) return 0;
|
---|
| 433 | }
|
---|
| 434 |
|
---|
[75] | 435 | pRelativeVar->offset=pVar->offset;
|
---|
| 436 | if(pVar->IsRef()) pRelativeVar->dwKind=VAR_REFGLOBAL;
|
---|
[62] | 437 | else pRelativeVar->dwKind=VAR_GLOBAL;
|
---|
[75] | 438 | resultType = *pVar;
|
---|
| 439 | isArray = pVar->IsArray();
|
---|
| 440 | pSubScripts=pVar->GetSubScriptsPtr();
|
---|
[3] | 441 | }
|
---|
| 442 |
|
---|
| 443 |
|
---|
[75] | 444 | if(array[0]==0&&isArray){
|
---|
[3] | 445 | //配列の先頭ポインタを示す場合
|
---|
[75] | 446 | resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR );
|
---|
| 447 | if(pss) memcpy(pss,pSubScripts,MAX_ARRAYDIM*sizeof(int));
|
---|
[3] | 448 | return 1;
|
---|
| 449 | }
|
---|
| 450 |
|
---|
| 451 | if(array[0]){
|
---|
[75] | 452 | i3=Debugging_GetArray(pSubScripts,array,resultType,&pRelativeVar->offset);
|
---|
[3] | 453 | if(i3==0){
|
---|
| 454 | //式エラー
|
---|
| 455 | return 0;
|
---|
| 456 | }
|
---|
| 457 | if(i3==-1){
|
---|
| 458 | //アクセスエラー
|
---|
| 459 | return -1;
|
---|
| 460 | }
|
---|
| 461 | }
|
---|
| 462 | if(member[0]){
|
---|
[75] | 463 | if( resultType.IsObject() || resultType.IsStruct() ){
|
---|
[3] | 464 | //実態オブジェクトのメンバを参照(obj.member)
|
---|
[64] | 465 | if( refType != CClass::Dot ){
|
---|
[3] | 466 | return 0;
|
---|
| 467 | }
|
---|
| 468 |
|
---|
[75] | 469 | i3=Debugging_GetMember(resultType.GetClass(),member,pRelativeVar,resultType,0);
|
---|
[3] | 470 | if(i3==0){
|
---|
| 471 | //式エラー
|
---|
| 472 | return 0;
|
---|
| 473 | }
|
---|
| 474 | if(i3==-1){
|
---|
| 475 | //アクセスエラー
|
---|
| 476 | return -1;
|
---|
| 477 | }
|
---|
| 478 | }
|
---|
[75] | 479 | else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){
|
---|
[3] | 480 | //ポインタオブジェクトが示すメンバを参照
|
---|
| 481 | if(lpPtrOffset[0]){
|
---|
| 482 | //pObj[n].member
|
---|
[64] | 483 | if( refType != CClass::Dot ) return 0;
|
---|
[75] | 484 | Debugging_SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset);
|
---|
[3] | 485 |
|
---|
[75] | 486 | i3=Debugging_GetMember(resultType.GetClass(),member,pRelativeVar,resultType,0);
|
---|
[3] | 487 | if(i3==0){
|
---|
| 488 | //式エラー
|
---|
| 489 | return 0;
|
---|
| 490 | }
|
---|
| 491 | if(i3==-1){
|
---|
| 492 | //アクセスエラー
|
---|
| 493 | return -1;
|
---|
| 494 | }
|
---|
| 495 | }
|
---|
| 496 | else{
|
---|
| 497 | //pObj->member
|
---|
[64] | 498 | if( refType != CClass::Pointer ) return 0;
|
---|
[3] | 499 |
|
---|
| 500 | pRelativeVar->offset=Debugging_GetVarPtr(pRelativeVar);
|
---|
| 501 | pRelativeVar->dwKind=VAR_DIRECTMEM;
|
---|
| 502 |
|
---|
| 503 | if(!ReadProcessMemory(hDebugProcess,(void *)pRelativeVar->offset,&lpData,sizeof(LONG_PTR),&stAccBytes)) return -1;
|
---|
| 504 | pRelativeVar->offset=lpData;
|
---|
| 505 |
|
---|
[75] | 506 | i3=Debugging_GetMember(resultType.GetClass(),member,pRelativeVar,resultType,0);
|
---|
[3] | 507 | if(i3==0){
|
---|
| 508 | //式エラー
|
---|
| 509 | return 0;
|
---|
| 510 | }
|
---|
| 511 | if(i3==-1){
|
---|
| 512 | //アクセスエラー
|
---|
| 513 | return -1;
|
---|
| 514 | }
|
---|
| 515 | }
|
---|
| 516 | }
|
---|
| 517 | else{
|
---|
| 518 | return 0;
|
---|
| 519 | }
|
---|
| 520 | return 1;
|
---|
| 521 | }
|
---|
| 522 |
|
---|
| 523 | if(lpPtrOffset[0]){
|
---|
[75] | 524 | if(!Debugging_SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset)) return 0;
|
---|
[3] | 525 | }
|
---|
| 526 |
|
---|
| 527 | return 1;
|
---|
| 528 | }
|
---|